From 331ccd8a82f354720a109bc5bcb1ea17e8104b00 Mon Sep 17 00:00:00 2001 From: ecaiyanlinux Date: Tue, 26 Oct 2021 03:56:36 +0200 Subject: [PATCH] Improve test scripts so that these scripts can be run from any location Signed-off-by: ecaiyanlinux Issue-ID: NONRTRIC-580 Change-Id: Ieaf97c190cc13e91bf103e4fb951f0c09116ab52 --- .../integration/smo/non-rt-ric/data/prepareDmaapMsg.sh | 17 +++++++++-------- .../integration/smo/non-rt-ric/data/prepareEcsData.sh | 9 +++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/solution/integration/smo/non-rt-ric/data/prepareDmaapMsg.sh b/solution/integration/smo/non-rt-ric/data/prepareDmaapMsg.sh index a100b32..eebaf01 100755 --- a/solution/integration/smo/non-rt-ric/data/prepareDmaapMsg.sh +++ b/solution/integration/smo/non-rt-ric/data/prepareDmaapMsg.sh @@ -32,6 +32,7 @@ a1_sim_OSC_port=${2:-30001} a1_sim_STD_port=${3:-30003} a1_sim_STD_v2_port=${4:-30005} httpx=${5:-"http"} +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) echo "using dmaap-mr port: "$dmaa_mr_port echo "using a1-sim-OSC port: "$a1_sim_OSC_port @@ -69,11 +70,11 @@ curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_v2_port/counter/interface echo -e "\n" echo "create policy type 1 to ric1:" -curl -X PUT -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/policytype?id=1 -H Content-Type:application/json --data-binary @testdata/OSC/policy_type.json +curl -X PUT -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/policytype?id=1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/OSC/policy_type.json echo -e "\n" echo "create policy type 2 to ric3:" -curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_v2_port/policytype?id=2 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @testdata/v2/policy_type.json +curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_v2_port/policytype?id=2 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @${SHELL_FOLDER}/testdata/v2/policy_type.json echo -e "\n" for i in {1..12}; do @@ -92,7 +93,7 @@ done ## Using PMS v1 interface echo "create service 1 to policy agent via dmaap_mr:" -curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v1/dmaap-msg-service-create.json +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v1/dmaap-msg-service-create.json echo -e "\n" echo "get result from mr of previous request:" @@ -100,7 +101,7 @@ curl -X GET "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-WRITE/users echo -e "\n" echo "create policies to ric1 & ric2 & ric3 with type1 and service1 via dmaa_mr:" -curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v1/dmaap-msg-policy-create.json +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v1/dmaap-msg-policy-create.json echo -e "\n" echo "get result from mr of previous request:" @@ -108,7 +109,7 @@ curl -X GET "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-WRITE/users echo -e "\n" echo "get policy from policy agent via dmaap_mr:" -curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v1/dmaap-msg-policy-get.json +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v1/dmaap-msg-policy-get.json echo -e "\n" echo "get result from mr of previous request:" @@ -117,7 +118,7 @@ echo -e "\n" ## Using PMS v2 interface echo "create service 2 to policy agent via dmaap_mr:" -curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v2/dmaap-msg-service-create.json +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v2/dmaap-msg-service-create.json echo -e "\n" echo "get result from mr of previous request:" @@ -125,7 +126,7 @@ curl -X GET "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-WRITE/users echo -e "\n" echo "create policies to ric1 & ric2 & ric3 with type1 and service1 via dmaa_mr:" -curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v2/dmaap-msg-policy-create.json +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v2/dmaap-msg-policy-create.json echo -e "\n" echo "get result from mr of previous request:" @@ -133,7 +134,7 @@ curl -X GET "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-WRITE/users echo -e "\n" echo "get policy from policy agent via dmaap_mr:" -curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v2/dmaap-msg-policy-get.json +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v2/dmaap-msg-policy-get.json echo -e "\n" echo "get result from mr of previous request:" diff --git a/solution/integration/smo/non-rt-ric/data/prepareEcsData.sh b/solution/integration/smo/non-rt-ric/data/prepareEcsData.sh index 11b0dc8..6224f75 100755 --- a/solution/integration/smo/non-rt-ric/data/prepareEcsData.sh +++ b/solution/integration/smo/non-rt-ric/data/prepareEcsData.sh @@ -27,7 +27,8 @@ # ./prepareEcsData.sh [ECS port] [http/https] ecs_port=${1:-8083} -httpx=${4:-"http"} +httpx=${2:-"http"} +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) echo "using ecs port: "$ecs_port echo "using protocol: "$httpx @@ -39,7 +40,7 @@ echo -e "\n" # Create EiType echo "Create EiType:" -curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @testdata/ECS/EiType.json +curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiType.json echo -e "\n" # Get EiTypes @@ -54,7 +55,7 @@ echo -e "\n" # Create EiProducer echo "Create EiProducer:" -curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @testdata/ECS/EiProducer.json +curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiProducer.json echo -e "\n" # Get EiProducers @@ -74,7 +75,7 @@ echo -e "\n" # Create EiJob echo "Create EiJob Of A Certain Type type1:" -curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @testdata/ECS/EiJob.json +curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiJob.json echo -e "\n" # Get EiJobs -- 2.16.6