X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=docker-compose%2Fdata%2FsendMsgToMediator.sh;fp=docker-compose%2Fdata%2FsendMsgToMediator.sh;h=a2f3db31b9281de739907612b7c4834716ccc4ad;hb=586432bccb77b0e0b7cd9f387b8e1a22131fe3e2;hp=0000000000000000000000000000000000000000;hpb=1ed3146635bb9cb256e8ea7b47df985b5afde310;p=nonrtric.git diff --git a/docker-compose/data/sendMsgToMediator.sh b/docker-compose/data/sendMsgToMediator.sh new file mode 100755 index 00000000..a2f3db31 --- /dev/null +++ b/docker-compose/data/sendMsgToMediator.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +# The scripts in data/ will generate some dummy data in the running system. +# It will send a dmaap msg of job to mediator: + +# Run command: +# ./sendMsgToMediator.sh [dmaap-mr port] [http/https] + +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) +bash ${SHELL_FOLDER}/prepareEcsData.sh + +dmaa_mr_port=${1:-3904} +httpx=${2:-"http"} + +echo "using dmaap-mr port: "$dmaa_mr_port +echo "using protocol: "$httpx +echo -e "\n" + +echo "dmaap-mr topics:" +curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll +echo -e "\n" + +echo "dmaap-mr create topic unauthenticated.VES_NOTIFICATION_OUTPUT:" +curl -skw %{http_code} -X POST "$httpx://localhost:$dmaa_mr_port/topics/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"topicName\": \"unauthenticated.VES_NOTIFICATION_OUTPUT\", \"topicDescription\": \"test topic\", \"partitionCount\": 1, \"replicationCount\": 1, \"transactionEnabled\": \"false\"}" +echo -e "\n" + +echo "dmaap-mr topics:" +curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll +echo -e "\n" + +echo "send job msg to dmaap-mr:" +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/unauthenticated.VES_NOTIFICATION_OUTPUT/" --data-binary @${SHELL_FOLDER}/testdata/dmaap-mediator-java/job.json +echo -e "\n" \ No newline at end of file