Integrated PMS 2.0 to test env and test cases
Issue-ID: NONRTRIC-307
Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: I696591192eeb3f9a04c91d6b0c3b19d7005cd6ec
diff --git a/test/auto-test/.gitignore b/test/auto-test/.gitignore
index 89e22de..6091e4a 100644
--- a/test/auto-test/.gitignore
+++ b/test/auto-test/.gitignore
@@ -14,3 +14,4 @@
.timer*
.pid*
.result*
+tmp
diff --git a/test/auto-test/FTC1.sh b/test/auto-test/FTC1.sh
index e4482b6..4d05b9b 100755
--- a/test/auto-test/FTC1.sh
+++ b/test/auto-test/FTC1.sh
@@ -79,6 +79,9 @@
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 1 STD_2.0.0
+ fi
start_mr
@@ -107,15 +110,27 @@
sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
- api_equal json:rics 2 60
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:rics 3 60
- api_equal json:policy_schemas 2 120
+ #api_equal json:policy_schemas 2 120
- api_equal json:policy_types 2
+ api_equal json:policy-types 2 120
- api_equal json:policies 0
+ api_equal json:policies 0
- api_equal json:policy_ids 0
+ api_equal json:policy_instances 0
+ else
+ api_equal json:rics 2 60
+
+ api_equal json:policy_schemas 2 120
+
+ api_equal json:policy_types 2
+
+ api_equal json:policies 0
+
+ api_equal json:policy_ids 0
+ fi
echo "############################################"
echo "############## Health check ################"
@@ -137,25 +152,40 @@
echo "############## RIC Repository ##############"
echo "############################################"
- api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:NOTYPE:AVAILABLE"
+ else
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
+ fi
echo "############################################"
echo "########### A1 Policy Management ###########"
echo "############################################"
- api_put_policy 201 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
- api_put_policy 200 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+ if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+ else
+ notificationurl=""
+ fi
+ api_put_policy 201 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
+ api_put_policy 200 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
- api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
- api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
+ api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
api_delete_policy 204 5000
api_delete_policy 204 5100
- api_equal json:policies 0
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policies 0
- api_equal json:policy_ids 0
+ api_equal json:policy_instances 0
+ else
+ api_equal json:policies 0
+
+ api_equal json:policy_ids 0
+ fi
cr_equal received_callbacks 0
@@ -173,9 +203,15 @@
if [[ $interface = *"SDNC"* ]]; then
sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ sim_contains_str ricsim_g3_1 remote_hosts "a1-controller"
+ fi
else
sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+ fi
fi
check_policy_agent_logs
diff --git a/test/auto-test/FTC10.sh b/test/auto-test/FTC10.sh
index 42b8f58..52a2bb3 100755
--- a/test/auto-test/FTC10.sh
+++ b/test/auto-test/FTC10.sh
@@ -47,6 +47,10 @@
start_ric_simulators ricsim_g2 5 STD_1.1.3
+if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 1 STD_2.0.0
+fi
+
start_mr
start_cr
@@ -70,38 +74,52 @@
sim_print ricsim_g2_1 interface
+if [ "$PMS_VERSION" == "V2" ]; then
+ sim_print ricsim_g3_1 interface
+fi
+
sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
-api_equal json:policy_types 2 60
-
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 2 60
+else
+ api_equal json:policy_types 2 60
+fi
# Create policies
+
+if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+else
+ notificationurl=""
+fi
+
use_agent_rest_http
api_put_service 201 "service1" 3600 "$CR_PATH/1"
-api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 1
use_agent_dmaap_http
-api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 2
use_agent_rest_http
-api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 1
use_agent_dmaap_http
-api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 2
@@ -111,14 +129,14 @@
api_put_service 200 "service1" 3600 "$CR_PATH/1"
-api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 2
use_agent_dmaap_http
-api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 2
@@ -126,22 +144,29 @@
use_agent_rest_http
-api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 2
use_agent_dmaap_http
-api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 2
# Check policies
-api_get_policy 200 2000 testdata/OSC/pi1_template.json
-api_get_policy 200 3000 testdata/OSC/pi1_template.json
-api_get_policy 200 2100 testdata/STD/pi1_template.json
-api_get_policy 200 3100 testdata/STD/pi1_template.json
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
+ api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
+ api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
+ api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
+else
+ api_get_policy 200 2000 testdata/OSC/pi1_template.json
+ api_get_policy 200 3000 testdata/OSC/pi1_template.json
+ api_get_policy 200 2100 testdata/STD/pi1_template.json
+ api_get_policy 200 3100 testdata/STD/pi1_template.json
+fi
# Remove policies
@@ -157,10 +182,17 @@
sim_equal ricsim_g1_1 num_instances 0
sim_equal ricsim_g2_1 num_instances 0
+if [ "$PMS_VERSION" == "V2" ]; then
+ sim_equal ricsim_g3_1 num_instances 0
+fi
+
# Check remote host access to simulator
sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+if [ "$PMS_VERSION" == "V2" ]; then
+ sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+fi
# Check policy removal
use_agent_rest_http
diff --git a/test/auto-test/FTC100.sh b/test/auto-test/FTC100.sh
index b617d3f..13d375b 100755
--- a/test/auto-test/FTC100.sh
+++ b/test/auto-test/FTC100.sh
@@ -33,8 +33,10 @@
# Tested variants of REST/DMAAP/SDNC config
TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
+
#Test agent and simulator protocol versions (others are http only)
TESTED_PROTOCOLS="HTTP HTTPS"
+
for __httpx in $TESTED_PROTOCOLS ; do
for interface in $TESTED_VARIANTS ; do
@@ -77,6 +79,9 @@
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 1 STD_2.0.0
+ fi
start_mr
@@ -105,15 +110,27 @@
sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
- api_equal json:rics 2 60
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:rics 3 60
- api_equal json:policy_schemas 3 120
+ #api_equal json:policy-schemas 3 120
- api_equal json:policy_types 3
+ api_equal json:policy-types 3 120
- api_equal json:policies 0
+ api_equal json:policies 0
- api_equal json:policy_ids 0
+ api_equal json:policy_instances 0
+ else
+ api_equal json:rics 2 60
+
+ api_equal json:policy_schemas 3 120
+
+ api_equal json:policy_types 3
+
+ api_equal json:policies 0
+
+ api_equal json:policy_ids 0
+ fi
echo "############################################"
@@ -204,47 +221,90 @@
echo "############## RIC Repository ##############"
echo "############################################"
- api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
-
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:NOTYPE:AVAILABLE"
+ else
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
+ fi
api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
api_get_rics 404 47
api_get_rics 404 "test"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_get_ric 200 me1_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
- api_get_ric 200 me1_ricsim_g1_1 ricsim_g1_1
+ api_get_ric 200 me2_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
- api_get_ric 200 me2_ricsim_g1_1 ricsim_g1_1
+ api_get_ric 200 me1_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
- api_get_ric 200 me1_ricsim_g2_1 ricsim_g2_1
+ api_get_ric 200 me2_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
- api_get_ric 200 me2_ricsim_g2_1 ricsim_g2_1
+ api_get_ric 200 NOME ricsim_g1_1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
- api_get_ric 404 test
+ api_get_ric 200 NOME ricsim_g2_1 "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
+ api_get_ric 404 NOME test1
+
+ api_get_ric 404 test NORIC
+
+ api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1
+
+ api_get_ric 400 me1_ricsim_g1_1 TESTRIC
+
+ api_get_ric 400 TESTME ricsim_g1_1
+
+ else
+ api_get_ric 200 me1_ricsim_g1_1 ricsim_g1_1
+
+ api_get_ric 200 me2_ricsim_g1_1 ricsim_g1_1
+
+ api_get_ric 200 me1_ricsim_g2_1 ricsim_g2_1
+
+ api_get_ric 200 me2_ricsim_g2_1 ricsim_g2_1
+
+ api_get_ric 404 test
+ fi
echo "############################################"
echo "########### A1 Policy Management ###########"
echo "############################################"
- deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
- #Behaviour accepted for now
- api_get_policy_schema 200 1 testdata/OSC/1-agent-modified.json
- deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
- #Behaviour accepted for now
- api_get_policy_schema 200 2 testdata/OSC/2-agent-modified.json
- api_get_policy_schema 404 3
- deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
- #Behaviour accepted for now
- api_get_policy_schemas 200 NORIC testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json NOFILE
- deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
- #Behaviour accepted for now
- api_get_policy_schemas 200 ricsim_g1_1 testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json
+ if [ "$PMS_VERSION" == "V2" ]; then
+ deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+ #Behaviour accepted for now
+ api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
+ deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+ #Behaviour accepted for now
+ api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
- api_get_policy_schemas 200 ricsim_g2_1 NOFILE
+ api_get_policy_type 404 3
+ else
+ deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+ #Behaviour accepted for now
+ api_get_policy_schema 200 1 testdata/OSC/1-agent-modified.json
+ deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+ #Behaviour accepted for now
+ api_get_policy_schema 200 2 testdata/OSC/2-agent-modified.json
- api_get_policy_schemas 404 test
+ api_get_policy_schema 404 3
+ fi
+
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_get_policy_schemas 404
+ else
+ deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+ #Behaviour accepted for now
+ api_get_policy_schemas 200 NORIC testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json NOFILE
+ deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+ #Behaviour accepted for now
+ api_get_policy_schemas 200 ricsim_g1_1 testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json
+
+ api_get_policy_schemas 200 ricsim_g2_1 NOFILE
+
+ api_get_policy_schemas 404 test
+ fi
@@ -260,23 +320,28 @@
api_put_service 201 "service10" 3600 "$CR_PATH/1"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+ else
+ notificationurl=""
+ fi
deviation "TR10 - agent allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
#Kept until decison
#api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
#Allow 201 for now
- api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
+ api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
- api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
- api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+ api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
- api_put_policy 200 "service10" ricsim_g1_1 1 5000 true testdata/OSC/pi1_template.json
- api_put_policy 200 "service10" ricsim_g1_1 1 5000 false testdata/OSC/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json
- api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
- api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
+ api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
- api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true testdata/STD/pi1_template.json
- api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false testdata/STD/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
VAL='NOT IN EFFECT'
api_get_policy_status 200 5000 OSC "$VAL" "false"
@@ -293,7 +358,11 @@
#kept until decision
#api_equal json:policy_ids 2
#Allow 3 for now
- api_equal json:policy_ids 3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances 3
+ else
+ api_equal json:policy_ids 3
+ fi
deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
#kept until decision
@@ -323,14 +392,19 @@
api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl
- api_get_policy 200 5000 testdata/OSC/pi1_template.json
+ api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
- api_get_policy 200 5100 testdata/STD/pi1_template.json
+ api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json
+ else
+ api_get_policy 200 5000 testdata/OSC/pi1_template.json
+ api_get_policy 200 5100 testdata/STD/pi1_template.json
- api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 testdata/OSC/pi1_template.json
-
+ api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 testdata/OSC/pi1_template.json
+ fi
deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
#kept until decision
@@ -344,13 +418,21 @@
api_equal json:policies 1
- api_equal json:policy_ids 1
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances 1
+ else
+ api_equal json:policy_ids 1
+ fi
api_delete_policy 204 5100
api_equal json:policies 0
- api_equal json:policy_ids 0
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances 0
+ else
+ api_equal json:policy_ids 0
+ fi
cr_equal received_callbacks 0
@@ -369,9 +451,15 @@
if [[ $interface = *"SDNC"* ]]; then
sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ sim_contains_str ricsim_g3_1 remote_hosts "a1-controller"
+ fi
else
sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+ fi
fi
check_policy_agent_logs
diff --git a/test/auto-test/FTC110.sh b/test/auto-test/FTC110.sh
index c840800..23f68c7 100755
--- a/test/auto-test/FTC110.sh
+++ b/test/auto-test/FTC110.sh
@@ -45,6 +45,10 @@
clean_containers
start_ric_simulators ricsim_g1 1 OSC_2.1.0
+start_ric_simulators ricsim_g2 1 STD_1.1.3
+if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 1 STD_2.0.0
+fi
start_mr
@@ -70,6 +74,10 @@
#Print simulator interface version
sim_print ricsim_g1_1 interface
+sim_print ricsim_g2_1 interface
+if [ "$PMS_VERSION" == "V2" ]; then
+ sim_print ricsim_g3_1 interface
+fi
api_put_service 201 "service1" 15 "$CR_PATH/service1"
@@ -151,32 +159,54 @@
sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
-api_equal json:rics 1 60
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:rics 3 60
-api_equal json:policy_schemas 1 120
+ #api_equal json:policy_schemas 2 120
-api_equal json:policy_types 1
+ api_equal json:policy-types 2 120
-api_equal json:policies 0
+ api_equal json:policies 0
+else
+ api_equal json:rics 2 60
-api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+ api_equal json:policy_schemas 2 120
-api_equal json:policies 1
+ api_equal json:policy_types 2
-sim_equal ricsim_g1_1 num_instances 1
+ api_equal json:policies 0
+fi
-api_put_policy 201 "service10" ricsim_g1_1 1 5001 true testdata/OSC/pi1_template.json
+if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+else
+ notificationurl=""
+fi
+
+api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
+api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
api_equal json:policies 2
+sim_equal ricsim_g1_1 num_instances 1
+sim_equal ricsim_g2_1 num_instances 1
+
+api_put_policy 201 "service10" ricsim_g1_1 1 5001 true $notificationurl testdata/OSC/pi1_template.json
+api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5101 true $notificationurl testdata/STD/pi1_template.json
+
+api_equal json:policies 4
+
sim_equal ricsim_g1_1 num_instances 2
+sim_equal ricsim_g2_1 num_instances 2
sim_post_delete_instances 200 ricsim_g1_1
+sim_post_delete_instances 200 ricsim_g2_1
#Wait for recreate of non transient policy
-api_equal json:policies 1 180
+api_equal json:policies 2 180
sim_equal ricsim_g1_1 num_instances 1
+sim_equal ricsim_g2_1 num_instances 1
api_put_service 200 "service10" 10 "$CR_PATH/service10"
@@ -184,12 +214,13 @@
api_equal json:policies 0 120
sim_equal ricsim_g1_1 num_instances 0
-
+sim_equal ricsim_g2_1 num_instances 0
api_get_service_ids 200
deviation "TR18 Agents sends callback with empty body"
-cr_equal received_callbacks 4
+deviation "TR18 Unclear when callbacks are sent...."
+#cr_equal received_callbacks 8
mr_equal requests_submitted 0
check_policy_agent_logs
diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh
index 63c2931..0a1a014 100755
--- a/test/auto-test/FTC1100.sh
+++ b/test/auto-test/FTC1100.sh
@@ -29,6 +29,8 @@
#### TEST BEGIN ####
+FLAT_A1_EI="1"
+
clean_containers
use_ecs_rest_http
@@ -94,14 +96,27 @@
ecs_api_edp_delete_producer 404 test-prod
-ecs_api_a1_get_job_ids 404 test-type NOWNER
-ecs_api_a1_get_job_ids 404 test-type test-owner
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job_ids 404 test-type NOWNER
+ ecs_api_a1_get_job_ids 404 test-type test-owner
-ecs_api_a1_get_job 404 test-type test-job
+ ecs_api_a1_get_job 404 test-type test-job
-ecs_api_a1_get_job_status 404 test-type test-job
+ ecs_api_a1_get_job_status 404 test-type test-job
+else
+ ecs_api_a1_get_job_ids 200 test-type NOWNER EMPTY
+ ecs_api_a1_get_job_ids 200 test-type test-owner EMPTY
-ecs_api_a1_delete_job 404 test-type test-job
+ ecs_api_a1_get_job 404 test-job
+
+ ecs_api_a1_get_job_status 404 test-job
+fi
+
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_delete_job 404 test-type test-job
+else
+ ecs_api_a1_delete_job 404 test-job
+fi
ecs_api_edp_get_producer_jobs 404 test-prod
@@ -112,7 +127,11 @@
ecs_api_edp_put_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
ecs_api_a1_get_type_ids 200 type1
-ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
+else
+ ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
+fi
ecs_api_edp_get_type_ids 200 type1
ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
@@ -125,40 +144,72 @@
ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
-ecs_api_a1_get_job 404 type1 test-job
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job 404 type1 test-job
-ecs_api_a1_get_job_status 404 type1 test-job
+ ecs_api_a1_get_job_status 404 type1 test-job
+else
+ ecs_api_a1_get_job 404 test-job
+
+ ecs_api_a1_get_job_status 404 test-job
+fi
ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
#job1 - prod-a
-ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
+else
+ ecs_api_a1_put_job 201 job1 type1 http://localhost:80/target1 ric1 http://localhost:80/status1 testdata/ecs/job-template.json
+fi
prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
ecs_api_a1_get_job_ids 200 type1 NOWNER job1
ecs_api_a1_get_job_ids 200 type1 ric1 job1
+if [ ! -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1
+fi
-ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
-ecs_api_a1_get_job_status 200 type1 job1 ENABLED
+ ecs_api_a1_get_job_status 200 type1 job1 ENABLED
+else
+ ecs_api_a1_get_job 200 job1 type1 http://localhost:80/target1 ric1 http://localhost:80/status1 testdata/ecs/job-template.json
+
+ ecs_api_a1_get_job_status 200 job1 ENABLED
+fi
ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
#job2 - prod-a
-ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
+else
+ ecs_api_a1_put_job 201 job2 type1 http://localhost:80/target2 ric2 http://localhost:80/status2 testdata/ecs/job-template.json
+fi
prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
ecs_api_a1_get_job_ids 200 type1 ric1 job1
ecs_api_a1_get_job_ids 200 type1 ric2 job2
+if [ ! -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
+fi
-ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
-ecs_api_a1_get_job_status 200 type1 job2 ENABLED
+ ecs_api_a1_get_job_status 200 type1 job2 ENABLED
+else
+ ecs_api_a1_get_job 200 job2 type1 http://localhost:80/target2 ric2 http://localhost:80/status2 testdata/ecs/job-template.json
+
+ ecs_api_a1_get_job_status 200 job2 ENABLED
+fi
ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
@@ -167,8 +218,13 @@
ecs_api_edp_put_producer 201 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
ecs_api_a1_get_type_ids 200 type1 type2
-ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
-ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
+ ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
+else
+ ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
+ ecs_api_a1_get_type 200 type2 testdata/ecs/empty-type.json
+fi
ecs_api_edp_get_type_ids 200 type1 type2
ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
@@ -182,7 +238,11 @@
#job3 - prod-b
-ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
+else
+ ecs_api_a1_put_job 201 job3 type2 http://localhost:80/target3 ric3 http://localhost:80/status3 testdata/ecs/job-template.json
+fi
prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
@@ -192,9 +252,15 @@
ecs_api_a1_get_job_ids 200 type1 ric2 job2
ecs_api_a1_get_job_ids 200 type2 ric3 job3
-ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
-ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+ ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+else
+ ecs_api_a1_get_job 200 job3 type2 http://localhost:80/target3 ric3 http://localhost:80/status3 testdata/ecs/job-template.json
+
+ ecs_api_a1_get_job_status 200 job3 ENABLED
+fi
ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
@@ -210,7 +276,11 @@
ecs_api_edp_get_producer_status 200 prod-c ENABLED
-ecs_api_a1_delete_job 204 type2 job3
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_delete_job 204 type2 job3
+else
+ ecs_api_a1_delete_job 204 job3
+fi
ecs_api_edp_delete_producer 204 prod-b
@@ -222,8 +292,12 @@
ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
-ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json
-
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json
+else
+ ecs_api_a1_put_job 201 job8 type4 http://localhost:80/target8 ric4 http://localhost:80/status4 testdata/ecs/job-template.json
+fi
+read -p "<continue>"
prodstub_equal create/prod-d/job8 1
prodstub_equal delete/prod-d/job8 0
@@ -231,11 +305,32 @@
ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d NOTYPE
-ecs_api_a1_get_job_ids 404 type4 NOWNER
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job_ids 404 type4 NOWNER
+else
+ ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
+ ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job8
+fi
prodstub_equal create/prod-d/job8 1
prodstub_equal delete/prod-d/job8 0
+
+
+ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d type4 testdata/ecs/ei-type-1.json
+
+if [ -z "$FLAT_A1_EI" ]; then
+ ecs_api_a1_get_job_ids 404 type4 NOWNER
+else
+ ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
+ ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job8
+fi
+
+
+
+
+
+
check_sdnc_logs
check_ecs_logs
diff --git a/test/auto-test/FTC150.sh b/test/auto-test/FTC150.sh
index bb527be..1cd7754 100755
--- a/test/auto-test/FTC150.sh
+++ b/test/auto-test/FTC150.sh
@@ -55,6 +55,9 @@
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 1 STD_2.0.0
+ fi
start_sdnc
diff --git a/test/auto-test/FTC300.sh b/test/auto-test/FTC300.sh
index fb7bc34..6e00c9d 100755
--- a/test/auto-test/FTC300.sh
+++ b/test/auto-test/FTC300.sh
@@ -17,7 +17,7 @@
# ============LICENSE_END=================================================
#
-TC_ONELINE_DESCR="Resync 10000 policies using OSC interface over REST"
+TC_ONELINE_DESCR="Resync 10000 policies using OSC and STD interface"
#App names to include in the test, space separated list
INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
@@ -78,6 +78,10 @@
start_ric_simulators ricsim_g2 4 STD_1.1.3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 4 STD_2.0.0
+ fi
+
start_mr
start_cr
@@ -105,65 +109,79 @@
sim_print ricsim_g2_1 interface
+ if [ "$PMS_VERSION" == "V2" ]; then
+ sim_print ricsim_g3_1 interface
+ fi
+
sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
- api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulator
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 2 120 #Wait for the agent to refresh types from the simulator
+ else
+ api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulator
+ fi
api_put_service 201 "serv1" 3600 "$CR_PATH/1"
START_ID=2000
NUM_POLICIES=10000
- if [[ $interface == *"BATCH"* ]]; then
- api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
+ if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
else
- api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
+ notificationurl=""
fi
- sim_equal ricsim_g1_1 num_instances 10000
+ if [[ $interface == *"BATCH"* ]]; then
+ api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
+ else
+ api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
+ fi
+
+ sim_equal ricsim_g1_1 num_instances $NUM_POLICIES
sim_post_delete_instances 200 ricsim_g1_1
sim_equal ricsim_g1_1 num_instances 0
- sim_equal ricsim_g1_1 num_instances 10000 300
+ sim_equal ricsim_g1_1 num_instances $NUM_POLICIES 300
- START_ID=$(($START_ID+$NUM_POLICIES))
+ START_ID2=$(($START_ID+$NUM_POLICIES))
if [[ $interface == *"BATCH"* ]]; then
- api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID2 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
else
- api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID2 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
fi
- sim_equal ricsim_g2_1 num_instances 10000
+ sim_equal ricsim_g2_1 num_instances $NUM_POLICIES
sim_post_delete_instances 200 ricsim_g2_1
sim_equal ricsim_g2_1 num_instances 0
- sim_equal ricsim_g2_1 num_instances 10000 300
+ sim_equal ricsim_g2_1 num_instances $NUM_POLICIES 300
- api_delete_policy 204 2435
+ api_delete_policy 204 $(($START_ID+47))
- api_delete_policy 204 8693
+ api_delete_policy 204 $(($START_ID+$NUM_POLICIES-39))
sim_post_delete_instances 200 ricsim_g1_1
- sim_equal ricsim_g1_1 num_instances 9998 300
+ sim_equal ricsim_g1_1 num_instances $(($NUM_POLICIES-2)) 300
- api_delete_policy 204 12435
+ api_delete_policy 204 $(($START_ID2+37))
- api_delete_policy 204 18693
+ api_delete_policy 204 $(($START_ID2+$NUM_POLICIES-93))
- api_delete_policy 204 18697
+ api_delete_policy 204 $(($START_ID2+$NUM_POLICIES-91))
sim_post_delete_instances 200 ricsim_g2_1
- sim_equal ricsim_g1_1 num_instances 9998 300
+ sim_equal ricsim_g1_1 num_instances $(($NUM_POLICIES-2)) 300
- sim_equal ricsim_g2_1 num_instances 9997 300
+ sim_equal ricsim_g2_1 num_instances $(($NUM_POLICIES-3)) 300
- api_equal json:policies 19995
+ api_equal json:policies $(($NUM_POLICIES-2+$NUM_POLICIES-3))
check_policy_agent_logs
diff --git a/test/auto-test/FTC310.sh b/test/auto-test/FTC310.sh
index 856d6f5..bf5785e 100755
--- a/test/auto-test/FTC310.sh
+++ b/test/auto-test/FTC310.sh
@@ -38,6 +38,9 @@
# Start one RIC of each type
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
+if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 1 STD_2.0.0
+fi
start_mr
@@ -53,29 +56,41 @@
start_policy_agent
-api_equal json:rics 2 120
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:rics 3 120
+else
+ api_equal json:rics 2 120
+fi
-# Add an OSC RIC and check
+# Add an STD RIC and check
start_ric_simulators ricsim_g2 2 STD_1.1.3
prepare_consul_config NOSDNC ".consul_config.json"
consul_config_app ".consul_config.json"
-api_equal json:rics 3 120
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:rics 4 120
+else
+ api_equal json:rics 3 120
+fi
check_policy_agent_logs
check_control_panel_logs
-# Remove one OSC RIC and check
+# Remove one RIC RIC and check
start_ric_simulators ricsim_g2 1 STD_1.1.3
prepare_consul_config NOSDNC ".consul_config.json"
consul_config_app ".consul_config.json"
-api_equal json:rics 2 120
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:rics 3 120
+else
+ api_equal json:rics 2 120
+fi
check_policy_agent_logs
check_control_panel_logs
diff --git a/test/auto-test/FTC350.sh b/test/auto-test/FTC350.sh
index 4b2e3cb..4f2244c 100755
--- a/test/auto-test/FTC350.sh
+++ b/test/auto-test/FTC350.sh
@@ -138,17 +138,31 @@
sim_put_policy_type 201 ricsim_g1_8 5 testdata/OSC/sim_5.json
sim_put_policy_type 201 ricsim_g1_9 5 testdata/OSC/sim_5.json
- api_equal json:policy_types 5 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 5 120
- echo "Check the number of types in the agent for each ric"
- api_equal json:policy_types?ric=ricsim_g1_1 1 120
- api_equal json:policy_types?ric=ricsim_g1_2 2 120
- api_equal json:policy_types?ric=ricsim_g1_3 3 120
- api_equal json:policy_types?ric=ricsim_g1_4 4 120
- api_equal json:policy_types?ric=ricsim_g1_5 5 120
- api_equal json:policy_types?ric=ricsim_g1_6 4 120
- api_equal json:policy_types?ric=ricsim_g1_7 3 120
- api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
+ api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
+ else
+ api_equal json:policy_types 5 120
+
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ fi
api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
@@ -165,17 +179,33 @@
api_equal json:rics 10 120
- echo "Check the number of types in the agent for each ric"
- api_equal json:policy_types?ric=ricsim_g1_1 1 120
- api_equal json:policy_types?ric=ricsim_g1_2 2 120
- api_equal json:policy_types?ric=ricsim_g1_3 3 120
- api_equal json:policy_types?ric=ricsim_g1_4 4 120
- api_equal json:policy_types?ric=ricsim_g1_5 5 120
- api_equal json:policy_types?ric=ricsim_g1_6 4 120
- api_equal json:policy_types?ric=ricsim_g1_7 3 120
- api_equal json:policy_types?ric=ricsim_g1_8 2 120
- api_equal json:policy_types?ric=ricsim_g1_9 1 120
- api_equal json:policy_types?ric=ricsim_g1_10 0 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
+ api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
+ else
+
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ api_equal json:policy_types?ric=ricsim_g1_9 1 120
+ api_equal json:policy_types?ric=ricsim_g1_10 0 120
+ fi
api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
@@ -191,13 +221,27 @@
#No policy type in sim #10
- api_equal json:policy_types 5
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 5
+ else
+ api_equal json:policy_types 5
+ fi
api_put_service 201 "serv1" 3600 "$CR_PATH/serv1"
- api_put_policy 201 "serv1" ricsim_g1_9 5 2000 NOTRANSIENT testdata/OSC/pi5_template.json 1
+ if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+ else
+ notificationurl=""
+ fi
- api_equal json:policy_ids 1
+ api_put_policy 201 "serv1" ricsim_g1_9 5 2000 NOTRANSIENT $notificationurl testdata/OSC/pi5_template.json 1
+
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances 1
+ else
+ api_equal json:policy_ids 1
+ fi
sim_equal ricsim_g1_9 num_instances 1
@@ -207,15 +251,27 @@
api_equal json:rics 8 120
- echo "Check the number of types in the agent for each ric"
- api_equal json:policy_types?ric=ricsim_g1_1 1 120
- api_equal json:policy_types?ric=ricsim_g1_2 2 120
- api_equal json:policy_types?ric=ricsim_g1_3 3 120
- api_equal json:policy_types?ric=ricsim_g1_4 4 120
- api_equal json:policy_types?ric=ricsim_g1_5 5 120
- api_equal json:policy_types?ric=ricsim_g1_6 4 120
- api_equal json:policy_types?ric=ricsim_g1_7 3 120
- api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
+ api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
+ else
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ fi
api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
@@ -228,7 +284,11 @@
sleep_wait 120
- api_equal json:policy_ids 0
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances 0
+ else
+ api_equal json:policy_ids 0
+ fi
api_get_policy_types 404 ricsim_g1_9
@@ -241,17 +301,31 @@
api_equal json:rics 10 120
- echo "Check the number of types in the agent for each ric"
- api_equal json:policy_types?ric=ricsim_g1_1 1 120
- api_equal json:policy_types?ric=ricsim_g1_2 2 120
- api_equal json:policy_types?ric=ricsim_g1_3 3 120
- api_equal json:policy_types?ric=ricsim_g1_4 4 120
- api_equal json:policy_types?ric=ricsim_g1_5 5 120
- api_equal json:policy_types?ric=ricsim_g1_6 4 120
- api_equal json:policy_types?ric=ricsim_g1_7 3 120
- api_equal json:policy_types?ric=ricsim_g1_8 2 120
- api_equal json:policy_types?ric=ricsim_g1_9 1 120
- api_equal json:policy_types?ric=ricsim_g1_10 0 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
+ api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
+ else
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ api_equal json:policy_types?ric=ricsim_g1_9 1 120
+ api_equal json:policy_types?ric=ricsim_g1_10 0 120
+ fi
api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
@@ -266,7 +340,11 @@
sleep_wait 120
- api_equal json:policy_ids 0
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances 0
+ else
+ api_equal json:policy_ids 0
+ fi
sim_equal ricsim_g1_9 num_instances 0
@@ -278,16 +356,29 @@
sleep_wait 120
- api_equal json:policy_types?ric=ricsim_g1_1 1 120
- api_equal json:policy_types?ric=ricsim_g1_2 2 120
- api_equal json:policy_types?ric=ricsim_g1_3 3 120
- api_equal json:policy_types?ric=ricsim_g1_4 3 120
- api_equal json:policy_types?ric=ricsim_g1_5 4 120
- api_equal json:policy_types?ric=ricsim_g1_6 3 120
- api_equal json:policy_types?ric=ricsim_g1_7 2 120
- api_equal json:policy_types?ric=ricsim_g1_8 2 120
- api_equal json:policy_types?ric=ricsim_g1_9 1 120
- api_equal json:policy_types?ric=ricsim_g1_10 0 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_4 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_5 4 120
+ api_equal json:policy-types?ric_id=ricsim_g1_6 3 120
+ api_equal json:policy-types?ric_id=ricsim_g1_7 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
+ api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
+ api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
+ else
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 3 120
+ api_equal json:policy_types?ric=ricsim_g1_5 4 120
+ api_equal json:policy_types?ric=ricsim_g1_6 3 120
+ api_equal json:policy_types?ric=ricsim_g1_7 2 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ api_equal json:policy_types?ric=ricsim_g1_9 1 120
+ api_equal json:policy_types?ric=ricsim_g1_10 0 120
+ fi
api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
@@ -302,7 +393,11 @@
sim_delete_policy_type 204 ricsim_g1_8 4
- api_equal json:policy_types?ric=ricsim_g1_8 1 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types?ric_id=ricsim_g1_8 1 120
+ else
+ api_equal json:policy_types?ric=ricsim_g1_8 1 120
+ fi
api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
diff --git a/test/auto-test/FTC800.sh b/test/auto-test/FTC800.sh
index 25678be..6d25c29 100755
--- a/test/auto-test/FTC800.sh
+++ b/test/auto-test/FTC800.sh
@@ -72,6 +72,9 @@
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators ricsim_g3 1 STD_2.0.0
+ fi
start_mr
@@ -105,13 +108,22 @@
sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
-
- api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulators
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 2 120 #Wait for the agent to refresh types from the simulators
+ else
+ api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulators
+ fi
api_put_service 201 "serv1" 3600 "$CR_PATH/1"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+ else
+ notificationurl=""
+ fi
+
start_timer "Create polices in OSC via agent REST and $interface using "$__httpx
- api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
print_timer "Create polices in OSC via agent REST and $interface using "$__httpx
sim_equal ricsim_g1_1 num_instances $NUM_POLICIES
@@ -119,7 +131,7 @@
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in STD via agent REST and $interface using "$__httpx
- api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
print_timer "Create polices in STD via agent REST and $interface using "$__httpx
sim_equal ricsim_g2_1 num_instances $NUM_POLICIES
@@ -135,7 +147,7 @@
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx
- api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
print_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx
sim_equal ricsim_g1_1 num_instances $((2*$NUM_POLICIES))
@@ -143,7 +155,7 @@
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
- api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
print_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
sim_equal ricsim_g2_1 num_instances $((2*$NUM_POLICIES))
@@ -151,7 +163,7 @@
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx
- api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
print_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx
sim_equal ricsim_g1_1 num_instances $((3*$NUM_POLICIES))
@@ -159,7 +171,7 @@
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
- api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
print_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
sim_equal ricsim_g2_1 num_instances $((3*$NUM_POLICIES))
@@ -167,9 +179,15 @@
if [ $interface == "SDNC" ]; then
sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ sim_contains_str ricsim_g3_1 remote_hosts "a1-controller"
+ fi
else
sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+ fi
fi
check_policy_agent_logs
diff --git a/test/auto-test/FTC810.sh b/test/auto-test/FTC810.sh
index 009efc0..4cc00bd 100755
--- a/test/auto-test/FTC810.sh
+++ b/test/auto-test/FTC810.sh
@@ -114,12 +114,20 @@
done
echo "Wait for the agent to refresh types from the simulator"
-api_equal json:policy_types 2 120
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 2 120
+else
+ api_equal json:policy_types 2 120
+fi
echo "Check the number of types in the agent for each ric is 1"
for ((i=1; i<=$NUM_RICS; i++))
do
- api_equal json:policy_types?ric=ricsim_g1_$i 1 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
+ else
+ api_equal json:policy_types?ric=ricsim_g1_$i 1 120
+ fi
done
echo "Register a service"
@@ -132,6 +140,12 @@
MR_MESSAGES=0
+if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+else
+ notificationurl=""
+fi
+
while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
echo ""
@@ -166,14 +180,14 @@
INSTANCE_ID=200000
INSTANCES=0
if [ $interface == "REST_PARALLEL" ]; then
- api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES 3
+ api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
fi
for ((i=1; i<=$NUM_RICS; i++))
do
if [ $interface == "DMAAP-BATCH" ]; then
- api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES
+ api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
- api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES
+ api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
fi
if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
@@ -183,18 +197,22 @@
INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
done
- api_equal json:policy_ids $INSTANCES
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances $INSTANCES
+ else
+ api_equal json:policy_ids $INSTANCES
+ fi
echo "Create $NUM_INSTANCES instances in each STD RIC"
if [ $interface == "REST_PARALLEL" ]; then
- api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES 3
+ api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
fi
for ((i=1; i<=$NUM_RICS; i++))
do
if [ $interface == "DMAAP-BATCH" ]; then
- api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES
+ api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
- api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES
+ api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
fi
if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
@@ -204,7 +222,11 @@
INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
done
- api_equal json:policy_ids $INSTANCES
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances $INSTANCES
+ else
+ api_equal json:policy_ids $INSTANCES
+ fi
echo "Delete all instances in each OSC RIC"
@@ -228,7 +250,11 @@
INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
done
- api_equal json:policy_ids $INSTANCES
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances $INSTANCES
+ else
+ api_equal json:policy_ids $INSTANCES
+ fi
echo "Delete all instances in each STD RIC"
@@ -250,7 +276,11 @@
INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
done
- api_equal json:policy_ids 0
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy_instances $INSTANCES
+ else
+ api_equal json:policy_ids $INSTANCES
+ fi
cr_equal received_callbacks 0
diff --git a/test/auto-test/FTC850.sh b/test/auto-test/FTC850.sh
index 7391331..b6376f0 100755
--- a/test/auto-test/FTC850.sh
+++ b/test/auto-test/FTC850.sh
@@ -20,7 +20,7 @@
TC_ONELINE_DESCR="Create/delete policies in parallel over a number of ric using a number of child process"
#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL, CP, CR, MR, PA, RICSIM, SDNC"
+INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
@@ -42,6 +42,12 @@
generate_uuid
+if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+else
+ notificationurl=""
+fi
+
for __httpx in $TESTED_PROTOCOLS ; do
for interface in $TESTED_VARIANTS ; do
@@ -108,22 +114,29 @@
sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
done
-
- api_equal json:policy_types 1 120 #Wait for the agent to refresh types from the simulator
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 1 120 #Wait for the agent to refresh types from the simulator
+ else
+ api_equal json:policy_types 1 120 #Wait for the agent to refresh types from the simulator
+ fi
api_put_service 201 "serv1" 600 "$CR_PATH/1"
echo "Check the number of types in the agent for each ric is 1"
for ((i=1; i<=$NUM_RICS; i++))
do
- api_equal json:policy_types?ric=ricsim_g1_$i 1 120
+ if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
+ else
+ api_equal json:policy_types?ric=ricsim_g1_$i 1 120
+ fi
done
START_ID=2000
start_timer "Create $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices over $interface using "$__httpx
- api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES_PER_RIC 7
+ api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES_PER_RIC 7
print_timer "Create $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices over $interface using "$__httpx
diff --git a/test/auto-test/FTC900.sh b/test/auto-test/FTC900.sh
index 3256797..6dbe544 100755
--- a/test/auto-test/FTC900.sh
+++ b/test/auto-test/FTC900.sh
@@ -43,6 +43,10 @@
start_ric_simulators $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
+if [ "$PMS_VERSION" == "V2" ]; then
+ start_ric_simulators $RIC_SIM_PREFIX"_g3" $STD_NUM_RICS STD_2.0.0
+fi
+
start_mr #Just to prevent errors in the agent log...
start_control_panel
@@ -82,36 +86,58 @@
#Check the number of schemas and the individual schemas in OSC
-api_equal json:policy_types 4 120
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 4 120
-for ((i=1; i<=$OSC_NUM_RICS; i++))
-do
- api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 3 120
-done
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g1_"$i 3 120
+ done
-# Check the schemas in OSC
-for ((i=1; i<=$OSC_NUM_RICS; i++))
-do
- api_get_policy_schema 200 2 testdata/OSC/hw-agent-modified.json
- api_get_policy_schema 200 100 testdata/OSC/qos-agent-modified.json
- api_get_policy_schema 200 20008 testdata/OSC/tsa-agent-modified.json
-done
+ # Check the schemas in OSC
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_get_policy_type 200 2 testdata/OSC/hw-agent-modified.json
+ api_get_policy_type 200 100 testdata/OSC/qos-agent-modified.json
+ api_get_policy_type 200 20008 testdata/OSC/tsa-agent-modified.json
+ done
+else
+ api_equal json:policy_types 4 120
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 3 120
+ done
+
+ # Check the schemas in OSC
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_get_policy_schema 200 2 testdata/OSC/hw-agent-modified.json
+ api_get_policy_schema 200 100 testdata/OSC/qos-agent-modified.json
+ api_get_policy_schema 200 20008 testdata/OSC/tsa-agent-modified.json
+ done
+fi
# Create policies
use_agent_rest_http
api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+else
+ notificationurl=""
+fi
+
# Create policies in OSC
for ((i=1; i<=$OSC_NUM_RICS; i++))
do
generate_uuid
- api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 2 $((2000+$i)) NOTRANSIENT testdata/OSC/pihw_template.json 1
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 2 $((2000+$i)) NOTRANSIENT $notificationurl testdata/OSC/pihw_template.json 1
generate_uuid
- api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT testdata/OSC/piqos_template.json 1
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT $notificationurl testdata/OSC/piqos_template.json 1
generate_uuid
- api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT testdata/OSC/pitsa_template.json 1
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT $notificationurl testdata/OSC/pitsa_template.json 1
done
@@ -126,7 +152,7 @@
for ((i=1; i<=$STD_NUM_RICS; i++))
do
generate_uuid
- api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT testdata/STD/pi1_template.json 1
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
done
diff --git a/test/auto-test/PM_DEMO.sh b/test/auto-test/PM_DEMO.sh
index 3696d56..c309ddc 100755
--- a/test/auto-test/PM_DEMO.sh
+++ b/test/auto-test/PM_DEMO.sh
@@ -32,6 +32,13 @@
##########################
# Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
+
+if [ "$PMS_VERSION" == "V2" ]; then
+ notificationurl="http://localhost:80"
+else
+ notificationurl=""
+fi
+
use_cr_http
use_agent_rest_http
use_sdnc_http
@@ -87,19 +94,35 @@
#Check the number of schemas and the individual schemas in OSC
-api_equal json:policy_types 3 120
+if [ "$PMS_VERSION" == "V2" ]; then
+ api_equal json:policy-types 3 120
-for ((i=1; i<=$OSC_NUM_RICS; i++))
-do
- api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 2 120
-done
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g1_"$i 2 120
+ done
-# Check the schemas in OSC
-for ((i=1; i<=$OSC_NUM_RICS; i++))
-do
- api_get_policy_schema 200 100 demo-testdata/OSC/qos-agent-modified.json
- api_get_policy_schema 200 20008 demo-testdata/OSC/tsa-agent-modified.json
-done
+ # Check the schemas in OSC
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_get_policy_type 200 100 demo-testdata/OSC/qos-agent-modified.json
+ api_get_policy_type 200 20008 demo-testdata/OSC/tsa-agent-modified.json
+ done
+else
+ api_equal json:policy_types 3 120
+
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 2 120
+ done
+
+ # Check the schemas in OSC
+ for ((i=1; i<=$OSC_NUM_RICS; i++))
+ do
+ api_get_policy_schema 200 100 demo-testdata/OSC/qos-agent-modified.json
+ api_get_policy_schema 200 20008 demo-testdata/OSC/tsa-agent-modified.json
+ done
+fi
# Create policies
@@ -111,9 +134,9 @@
for ((i=1; i<=$OSC_NUM_RICS; i++))
do
generate_uuid
- api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT demo-testdata/OSC/piqos_template.json 1
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT $notificationurl demo-testdata/OSC/piqos_template.json 1
generate_uuid
- api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT demo-testdata/OSC/pitsa_template.json 1
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT $notificationurl demo-testdata/OSC/pitsa_template.json 1
done
@@ -128,7 +151,7 @@
for ((i=1; i<=$STD_NUM_RICS; i++))
do
generate_uuid
- api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT demo-testdata/STD/pi1_template.json 1
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT $notificationurl demo-testdata/STD/pi1_template.json 1
done
diff --git a/test/auto-test/README.md b/test/auto-test/README.md
index 0429e36..95e523c 100644
--- a/test/auto-test/README.md
+++ b/test/auto-test/README.md
@@ -4,7 +4,7 @@
## Automated test scripts
There are two types of scripts, filenames in the format FTCXXX.sh test one or more components of the Non-RT RIC. Filenames in the format SuiteZZZZ.sh tests a number of FTCXXX.sh script as one suite. (XXX is an integer selected from the categories described further below).
-FTC is short for Function Test Case.
+FTC is short for Function Test Case. In addition, there are also other test scripts with other naming format used for demo setup etc (e.g PM_DEMO.sh).
The requirements, in terms of the execution enviroment, to run a script or a suite is to have docker, docker-compose and python3 installed (the scripts warns if not installed).
The scripts have been tested to work on both MacOS and Ubuntu. They should work also in git bash on windows but not yet verified.
@@ -24,7 +24,7 @@
The test scripts produce quite a number of logs; all container logs, a log of all http/htps calls from the test scripts including the payload, some configuration created during test and also a test case log (same as what is printed on the screen during execution). All these logs are stored in `logs/FTCXXX/`. So each test script is using its own log directory.
## Test case categories
-The test script are number using these basic categories.
+The test script are number using these basic categories where 0-999 are releated to the policy managment and 1000-1999 are related to enrichment management.
1-99 - Basic sanity tests
diff --git a/test/auto-test/Suite-all.sh b/test/auto-test/Suite-all.sh
deleted file mode 100755
index 9a51d3b..0000000
--- a/test/auto-test/Suite-all.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-# ============LICENSE_START===============================================
-# Copyright (C) 2020 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=================================================
-#
-
-TS_ONELINE_DESCR="Test suite - all test cases except the stab test(s)"
-
-. ../common/testsuite_common.sh
-
-suite_setup
-
-############# TEST CASES #################
-ARG1=$1
-
-./FTC1.sh $ARG1
-
-if [ $ARG1 == "remote-remove" ]; then
- #Prevent image removal for every test case
- ARG1="remote"
-fi
-
-./FTC10.sh $ARG1
-./FTC100.sh $ARG1
-./FTC110.sh $ARG1
-./FTC150.sh $ARG1
-./FTC300.sh $ARG1
-./FTC310.sh $ARG1
-./FTC350.sh $ARG1
-./FTC800.sh $ARG1
-./FTC850.sh $ARG1
-
-##########################################
-
-suite_complete
\ No newline at end of file
diff --git a/test/auto-test/Suite-interfaces.sh b/test/auto-test/Suite-policy-all.sh
similarity index 78%
copy from test/auto-test/Suite-interfaces.sh
copy to test/auto-test/Suite-policy-all.sh
index 7a21646..c032d2d 100755
--- a/test/auto-test/Suite-interfaces.sh
+++ b/test/auto-test/Suite-policy-all.sh
@@ -17,7 +17,7 @@
# ============LICENSE_END=================================================
#
-TS_ONELINE_DESCR="Test suite - interface testing. Agent REST, DMAAP and SNDC controller resconf"
+TS_ONELINE_DESCR="Test suite - all test cases except the stab test(s)"
. ../common/testsuite_common.sh
@@ -25,17 +25,16 @@
############# TEST CASES #################
-ARG1=$1
-
-./FTC100.sh $ARG1
-
-if [ $ARG1 == "remote-remove" ]; then
- #Prevent image removal for every test case
- ARG1="remote"
-fi
-
-./FTC110.sh $ARG1
-./FTC150.sh $ARG1
+./FTC1.sh $@
+./FTC10.sh $@
+./FTC100.sh $@
+./FTC110.sh $@
+./FTC150.sh $@
+./FTC300.sh $@
+./FTC310.sh $@
+./FTC350.sh $@
+./FTC800.sh $@
+./FTC850.sh $@
##########################################
diff --git a/test/auto-test/Suite-interfaces.sh b/test/auto-test/Suite-policy-interfaces.sh
similarity index 87%
rename from test/auto-test/Suite-interfaces.sh
rename to test/auto-test/Suite-policy-interfaces.sh
index 7a21646..afa3b66 100755
--- a/test/auto-test/Suite-interfaces.sh
+++ b/test/auto-test/Suite-policy-interfaces.sh
@@ -27,15 +27,9 @@
ARG1=$1
-./FTC100.sh $ARG1
-
-if [ $ARG1 == "remote-remove" ]; then
- #Prevent image removal for every test case
- ARG1="remote"
-fi
-
-./FTC110.sh $ARG1
-./FTC150.sh $ARG1
+./FTC100.sh $@
+./FTC110.sh $@
+./FTC150.sh $@
##########################################
diff --git a/test/auto-test/testdata/ecs/empty-type.json b/test/auto-test/testdata/ecs/empty-type.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/test/auto-test/testdata/ecs/empty-type.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/test/common/README.md b/test/common/README.md
index 7492113..75b16b5 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -510,12 +510,16 @@
# Description of functions in agent_api_function.sh #
+## General ##
+Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
+
## Function: api_equal() ##
Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the array length becomes equal to the target value or not.
See the 'cr' dir for more details.
+
| arg list |
|--|
| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
@@ -527,13 +531,18 @@
| `<timeout-in-sec>` | Max time to wait for the length to reach the target value |
## Function: api_get_policies() ##
-Test of GET '/policies' and optional check of the array of returned policies.
+Test of GET '/policies' or V2 GET '/v2/policy_instances' and optional check of the array of returned policies.
To test the response code only, provide the response code parameter as well as the following three parameters.
-To also test the response payload add the 'NOID' for an expected empty array or repeat the last five parameters for each expected policy.
+To also test the response payload add the 'NOID' for an expected empty array or repeat the last five/seven parameters for each expected policy.
+
| arg list |
|--|
| `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]` |
+| arg list V2 |
+|--|
+| `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]` |
+
| parameter | description |
| --------- | ----------- |
| `<response-code>` | Expected http response code |
@@ -546,31 +555,48 @@
| `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
| `<policy-id>` | Id of the policy |
| `EMPTY` | Indicate for the special empty policy type |
+| `transient` | Transient, true or false |
+| `notification-url` | Url for notifications |
| `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
## Function: api_get_policy() ##
-Test of GET /policy and optional check of the returned json payload.
+Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
To test the the response code only, provide the expected response code and policy id.
To test the contents of the returned json payload, add a path to the template file used when creating the policy.
+
| arg list |
|--|
| `<response-code> <policy-id> [<template-file>]` |
+| arg list V2|
+|--|
+| `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
+
| parameter | description |
| --------- | ----------- |
| `<response-code>` | Expected http response code |
| `<policy-id>` | Id of the policy |
| `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
+| `<service-id>` | Id of the service |
+| `<ric-id>` | Id of the ric |
+| `<policy-type-id>` | Id of the policy type |
+| `NOTYPE` | Indicator that no type id is provided |
+| `transient` | Transient, true or false |
+| `notification-url` | Url for notifications |
## Function: api_put_policy() ##
-Test of PUT '/policy'.
-To test the response code only, provide the response code parameter as well as the following three parameters.
-To also test the response payload add the 'NOID' for an expected empty array or repeat the last five parameters for each expected policy.
+Test of PUT '/policy' or V2 PUT '/policies'.
+If more than one policy shall be created, add a count value to indicate the number of policies to create. Note that if more than one policy shall be created the provided policy-id must be numerical (will be used as the starting id).
+
| arg list |
|--|
| `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
+| arg list V2 |
+|--|
+| `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
+
| parameter | description |
| --------- | ----------- |
| `<response-code>` | Expected http response code |
@@ -579,6 +605,8 @@
| `<policy-type-id>` | Id of the policy type |
| `<policy-id>` | Id of the policy. This value shall be a numeric value if more than one policy shall be created |
| `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
+| `notification-url` | Url for notifications |
+|`NOURL`| Indicator for no url |
| `<template-file>` | Path to the template file for the policy |
| `<count>` | An optional count (default is 1). If a value greater than 1 is given, the policy ids will use the given policy id as the first id and add 1 to that id for each new policy |
@@ -589,10 +617,17 @@
## Function: api_put_policy_parallel() ##
This tests the same as function 'api_put_policy' except that the policy create is spread out over a number of processes and it only uses the agent rest API. The total number of policies created is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the creation of all the policies in one ric.
+
| arg list |
|--|
| `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
+| arg list |
+|--|
+| `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>`
+
+| parameter | description |
+| --------- | ----------- |
| `<response-code>` | Expected http response code |
| `<service-id>` | Id of the service |
| `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
@@ -600,12 +635,14 @@
| `<policy-type-id>` | Id of the policy type |
| `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
| `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
+| `notification-url` | Url for notifications |
| `<template-file>` | Path to the template file for the policy |
| `<count-per-ric>` | Number of policies per ric |
| `<number-of-threads>` | Number of threads (processes) to run in parallel |
## Function: api_delete_policy() ##
-This tests the DELETE /policy. Removes the indicated policy or a 'count' number of policies starting with 'policy-id' as the first id.
+This tests the DELETE '/policy' or V2 DELETE '/v2/policies/{policy_id}'. Removes the indicated policy or a 'count' number of policies starting with 'policy-id' as the first id.
+
| arg list |
|--|
| `<response-code> <policy-id> [<count>]`
@@ -623,10 +660,13 @@
## Function: api_delete_policy_parallel() ##
This tests the same as function 'api_delete_policy' except that the policy delete is spread out over a number of processes and it only uses the agent rest API. The total number of policies deleted is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the deletion of all the policies in one ric.
+
| arg list |
|--|
| `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
+| parameter | description |
+| --------- | ----------- |
| `<response-code>` | Expected http response code |
| `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
| `<number-of-rics>` | The number of rics, assuming the first index is '1' |
@@ -637,9 +677,10 @@
## Function: api_get_policy_ids() ##
-Test of GET '/policy_ids'.
+Test of GET '/policy_ids' or V2 GET '/v2/policies'.
To test response code only, provide the response code parameter as well as the following three parameters.
To also test the response payload add the 'NOID' for an expected empty array or repeat the 'policy-instance-id' for each expected policy id.
+
| arg list |
|--|
| `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
@@ -657,9 +698,25 @@
| `<policy-instance-id>` | Id of the policy |
## Function: api_get_policy_schema() ##
-Test of GET /policy_schema and optional check of the returned json schema.
+Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
To test the response code only, provide the expected response code and policy type id.
To test the contents of the returned json schema, add a path to a schema file to compare with.
+
+| arg list |
+|--|
+| `<response-code> <policy-type-id> [<schema-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<policy-type-id>` | Id of the policy type |
+| `<schema-file>` | Path to the schema file for the policy type |
+
+## Function: api_get_policy_schema() ##
+Test of GET '/policy_schema' and optional check of the returned json schema.
+To test the response code only, provide the expected response code and policy type id.
+To test the contents of the returned json schema, add a path to a schema file to compare with.
+
| arg list |
|--|
| `<response-code> <policy-type-id> [<schema-file>]` |
@@ -671,9 +728,10 @@
| `<schema-file>` | Path to the schema file for the policy type |
## Function: api_get_policy_schemas() ##
-Test of GET /policy_schemas and optional check of the returned json schemas.
+Test of GET '/policy_schemas' and optional check of the returned json schemas.
To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
To test the contents of the returned json schema, add a path to a schema file to compare with (or NOFILE to represent an empty '{}' type)
+
| arg list |
|--|
| `<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*` |
@@ -687,7 +745,8 @@
| `NOFILE` | Indicate the template for an empty type |
## Function: api_get_policy_status() ##
-Test of GET /policy_status.
+Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
+
| arg list |
|--|
| `<response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)` |
@@ -704,7 +763,7 @@
| `<has-been-deleted>` | Deleted status, true or false |
## Function: api_get_policy_types() ##
-Test of GET /policy_types and optional check of the returned ids.
+Test of GET '/policy_types' or V2 GET '/v2/policy-types' and optional check of the returned ids.
To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
@@ -721,7 +780,8 @@
| `EMPTY` | Indicate the empty type |
## Function: api_get_status() ##
-Test of GET /status
+Test of GET /status or V2 GET /status
+
| arg list |
|--|
| `<response-code>` |
@@ -731,25 +791,34 @@
| `<response-code>` | Expected http response code |
## Function: api_get_ric() ##
-Test of GET /ric
+Test of GET '/ric' or V2 GET '/v2/rics/ric'
To test the response code only, provide the expected response code and managed element id.
To test the returned ric id, provide the expected ric id.
+
| arg list |
|--|
| `<reponse-code> <managed-element-id> [<ric-id>]` |
+| arg list V2 |
+|--|
+| `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
+
| parameter | description |
| --------- | ----------- |
| `<response-code>` | Expected http response code |
| `<managed-element-id>` | Id of the managed element |
-| `<ric-id>` | Id of the ric |
+| `NOME` | Indicator for no ME |
+| `ric-id` | Id of the ric |
+| `NORIC` | Indicator no RIC |
+| `string-of-ricinfo` | String of ric info |
## Function: api_get_rics() ##
-Test of GET /rics and optional check of the returned json payload (ricinfo).
+Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
To test also the returned payload, add the formatted string of info in the returned payload.
Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
+
| arg list |
|--|
| `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
@@ -762,7 +831,7 @@
| `<space-separate-string-of-ricinfo>` | A space separated string of ric info - needs to be quoted |
## Function: api_put_service() ##
-Test of PUT /service
+Test of PUT '/service' or V2 PUT '/service'.
| arg list |
|--|
| `<response-code> <service-name> <keepalive-timeout> <callbackurl>` |
@@ -775,9 +844,10 @@
| `<callbackurl>` | Callback url |
## Function: api_get_services() ##
-Test of GET /service and optional check of the returned json payload.
+Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
To test only the response code, omit all parameters except the expected response code.
To test the returned json, provide the parameters after the response code.
+
| arg list |
|--|
| `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
@@ -792,7 +862,8 @@
| `NOSERVICE` | Indicator of no target service name |
## Function: api_get_service_ids() ##
-Test of GET /services
+Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
+
| arg list |
|--|
| `<response-code> [<service-name>]*` |
@@ -803,7 +874,8 @@
| `<service-name>` | Service name |
## Function: api_delete_services() ##
-Test of DELETE /services
+Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
+
| arg list |
|--|
| `<response-code> [<service-name>]*` |
@@ -814,7 +886,8 @@
| `<service-name>` | Service name |
## Function: api_put_services_keepalive() ##
-Test of PUT /services/keepalive
+Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
+
| arg list |
|--|
| <response-code> <service-name>` |
@@ -832,6 +905,7 @@
Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
See the 'a1-interface' repo for more details.
+
| arg list |
|--|
| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
@@ -845,6 +919,7 @@
## Function: sim_print ##
Prints the value of a variable in the RIC simulator.
See the 'a1-interface' repo for more details.
+
| arg list |
|--|
| `<variable-name>` |
@@ -859,6 +934,7 @@
Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value contains the target string or not.
See the 'a1-interface' repo for more details.
+
| arg list |
|--|
| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
@@ -871,6 +947,7 @@
## Function: sim_put_policy_type ##
Loads a policy type to the simulator
+
| arg list |
|--|
| `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
@@ -884,6 +961,7 @@
## Function: sim_delete_policy_type ##
Deletes a policy type from the simulator
+
| arg list |
|--|
| `<response-code> <ric-id> <policy_type_id>` |
@@ -896,6 +974,7 @@
## Function: sim_post_delete_instances ##
Deletes all instances (and status), for one ric
+
| arg list |
|--|
| `<response-code> <ric-id>` |
@@ -908,6 +987,7 @@
## Function: sim_post_delete_all ##
Deletes all types, instances (and status), for one ric
+
| arg list |
|--|
| `<response-code> <ric-id>` |
@@ -920,6 +1000,7 @@
## Function: sim_post_forcedresponse ##
Sets (or resets) response code for next (one) A1 message, for one ric.
The intention is to simulate error response on the A1 interface.
+
| arg list |
|--|
| `<response-code> <ric-id> [<forced_response_code>]`|
@@ -933,6 +1014,7 @@
## Function: sim_post_forcedelay ##
Sets (or resets) A1 response delay, for one ric
The intention is to delay responses on the A1 interface. Setting remains until removed.
+
| arg list |
|--|
| `<response-code> <ric-id> [<delay-in-seconds>]`|
@@ -951,6 +1033,7 @@
Test of GET policy ids towards OSC or STD type simulator.
To test response code only, provide the response code, 'OSC' + policy type or 'STD'
To test the response payload, include the ids of the expexted response.
+
| arg list |
|--|
| `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
@@ -967,6 +1050,7 @@
## Function: controller_api_get_A1_policy_type ##
Test of GET a policy type (OSC only)
+
| arg list |
|--|
| `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
@@ -981,6 +1065,7 @@
## Function: controller_api_delete_A1_policy ##
Deletes a policy instance
+
| arg list |
|--|
| `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
@@ -997,6 +1082,7 @@
## Function: controller_api_put_A1_policy ##
Creates a policy instance
+
| arg list |
|--|
| `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
@@ -1013,6 +1099,7 @@
## Function: controller_api_get_A1_policy_status ##
Checks the status of a policy
+
arg list |
|--|
| `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
@@ -1039,6 +1126,7 @@
Test of GET '/A1-EI/v1/eitypes/{eiTypeId}/eijobs' and optional check of the array of returned job ids.
To test the response code only, provide the response code parameter as well as a type id and an owner id.
To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
+
| arg list |
|--|
| `<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
@@ -1056,6 +1144,7 @@
Test of GET '/A1-EI/v1/eitypes/{eiTypeId}' and optional check of the returned schema.
To test the response code only, provide the response code parameter as well as the type-id.
To also test the response payload add a path to the expected schema file.
+
| arg list |
|--|
| `<response-code> <type-id> [<schema-file>]` |
@@ -1070,6 +1159,7 @@
Test of GET '/A1-EI/v1/eitypes' and optional check of returned list of type ids.
To test the response code only, provide the response only.
To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
+
| arg list |
|--|
| `<response-code> [ (EMPTY | [<type-id>]+) ]` |
@@ -1084,6 +1174,7 @@
Test of GET '/A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}/status' and optional check of the returned status.
To test the response code only, provide the response code, type id and job id.
To also test the response payload add the expected status.
+
| arg list |
|--|
| `<response-code> <type-id> <job-id> [<status>]` |
@@ -1099,6 +1190,7 @@
Test of GET '/A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}' and optional check of the returned job.
To test the response code only, provide the response code, type id and job id.
To also test the response payload add the remaining parameters.
+
| arg list |
|--|
| `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
@@ -1115,6 +1207,7 @@
## Function: ecs_api_a1_delete_job() ##
Test of DELETE '/A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}'.
To test, provide all the specified parameters.
+
| arg list |
|--|
| `<response-code> <type-id> <job-id> |
@@ -1128,6 +1221,7 @@
## Function: ecs_api_a1_put_job() ##
Test of PUT '/A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}'.
To test, provide all the specified parameters.
+
| arg list |
|--|
| `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
@@ -1145,6 +1239,7 @@
Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
To test the response code only, provide the response code.
To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
+
| arg list |
|--|
| `<response-code> [ EMPTY | <type-id>+]` |
@@ -1159,6 +1254,7 @@
Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
To test the response code only, provide the response code and producer id.
To also test the response payload add the expected status.
+
| arg list |
|--|
| `<response-code> <producer-id> [<status>]` |
@@ -1173,6 +1269,7 @@
Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
To test the response code only, provide the response.
To also test the response payload add the list of expected producer-ids (or EMPTY if the list of ids is expected to be empty).
+
| arg list |
|--|
| `<response-code> [ EMPTY | <producer-id>+]` |
@@ -1187,6 +1284,7 @@
Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
To test the response code only, provide the response and the type-id.
To also test the response payload add a path to a job schema file and a list expected producer-id (or EMPTY if the list of ids is expected to be empty).
+
| arg list |
|--|
| `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
@@ -1203,6 +1301,7 @@
Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
To test the response code only, provide the response and the producer-id.
To also test the response payload add the remaining parameters defining thee producer.
+
| arg list |
|--|
| `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
@@ -1221,6 +1320,7 @@
## Function: ecs_api_edp_delete_producer() ##
Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
To test, provide all parameters.
+
| arg list |
|--|
| `<response-code> <producer-id>` |
@@ -1233,6 +1333,7 @@
## Function: ecs_api_edp_put_producer() ##
Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
To test, provide all parameters. The list of type/schema pair may be empty.
+
| arg list |
|--|
| `<response-code> <producer-id> <create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
@@ -1252,6 +1353,7 @@
Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
To test the response code only, provide the response and the producer-id.
To also test the response payload add the remaining parameters.
+
| arg list |
|--|
| `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)` |
@@ -1268,6 +1370,7 @@
## Function: ecs_api_service_status() ##
Test of GET '/status'.
+
| arg list |
|--|
| `<response-code>` |
@@ -1281,6 +1384,7 @@
## Function: prodstub_arm_producer() ##
Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
+
| arg list |
|--|
| `<response-code> <producer-id> [<forced_response_code>]` |
@@ -1293,6 +1397,7 @@
## Function: prodstub_arm_job_create() ##
Preconfigure the prodstub with a job or update an existing job. Optional create/update job response code, if not given the response code will be set to 200/201 depending on if the job has been previously created or not.
+
| arg list |
|--|
| `<response-code> <job-id> [<forced_response_code>]` |
@@ -1305,6 +1410,7 @@
## Function: prodstub_arm_job_delete() ##
Preconfigure the prodstub with a job. Optional delete job response code, if not given the response code will be set to 204/404 depending on if the job exists or not.
+
| arg list |
|--|
| `<response-code> <job-id> [<forced_response_code>]` |
@@ -1317,6 +1423,7 @@
## Function: prodstub_arm_type() ##
Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
+
| arg list |
|--|
| `<response-code> <producer-id> <type-id>` |
@@ -1329,6 +1436,7 @@
## Function: prodstub_disarm_type() ##
Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
+
| arg list |
|--|
| `<response-code> <producer-id> <type-id>` |
@@ -1341,6 +1449,7 @@
## Function: prodstub_check_jobdata() ##
Check a job in the prodstub towards the list of provided parameters.
+
| arg list |
|--|
| `<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>` |
@@ -1358,6 +1467,7 @@
Tests if a variable value in the prodstub is equal to a target value.
Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
+
| arg list |
|--|
| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
diff --git a/test/common/agent_api_functions.sh b/test/common/agent_api_functions.sh
index 29e1bf1..507e011 100644
--- a/test/common/agent_api_functions.sh
+++ b/test/common/agent_api_functions.sh
@@ -35,7 +35,11 @@
echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
if [ $# -eq 2 ] || [ $# -eq 3 ]; then
if [[ $1 == "json:"* ]]; then
- __var_test "Policy Agent" $LOCALHOST$POLICY_AGENT_EXTERNAL_PORT"/" $1 "=" $2 $3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ __var_test "Policy Agent" $LOCALHOST$POLICY_AGENT_EXTERNAL_PORT"/v2/" $1 "=" $2 $3
+ else
+ __var_test "Policy Agent" $LOCALHOST$POLICY_AGENT_EXTERNAL_PORT"/" $1 "=" $2 $3
+ fi
return 0
fi
fi
@@ -45,92 +49,184 @@
return 1
}
-# API Test function: GET /policies
-# args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-ype-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]
+# API Test function: GET /policies and V2 GET /v2/policy_instances
+# args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]
+# args(V2): <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]
# (Function for test scripts)
api_get_policies() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- paramError=0
- if [ $# -lt 4 ]; then
- paramError=1
- elif [ $# -eq 5 ] && [ $5 != "NOID" ]; then
- paramError=1
- elif [ $# -gt 4 ] && [ $(($#%5)) -ne 4 ]; then
- paramError=1
+
+ if [ "$PMS_VERSION" == "V2" ]; then
+ paramError=0
+ variableParams=$(($#-4))
+ if [ $# -lt 4 ]; then
+ paramError=1
+ elif [ $# -eq 5 ] && [ $5 != "NOID" ]; then
+ paramError=1
+ elif [ $# -gt 5 ] && [ $(($variableParams%7)) -ne 0 ]; then
+ paramError=1
+ fi
+
+ if [ $paramError -ne 0 ]; then
+ __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]" $@
+ return 1
+ fi
+ else
+ paramError=0
+ variableParams=$(($#-4))
+ if [ $# -lt 4 ]; then
+ paramError=1
+ elif [ $# -eq 5 ] && [ $5 != "NOID" ]; then
+ paramError=1
+ elif [ $# -gt 5 ] && [ $(($variableParams%5)) -ne 0 ]; then
+ paramError=1
+ fi
+
+ if [ $paramError -ne 0 ]; then
+ __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
+ return 1
+ fi
fi
- if [ $paramError -ne 0 ]; then
- __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
- return 1
- fi
queryparams=""
- if [ $2 != "NORIC" ]; then
- queryparams="?ric="$2
- fi
- if [ $3 != "NOSERVICE" ]; then
- if [ -z $queryparams ]; then
- queryparams="?service="$3
- else
- queryparams=$queryparams"&service="$3
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $2 != "NORIC" ]; then
+ queryparams="?ric_id="$2
fi
- fi
- if [ $4 != "NOTYPE" ]; then
- if [ -z $queryparams ]; then
- queryparams="?type="$4
- else
- queryparams=$queryparams"&type="$4
+ if [ $3 != "NOSERVICE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?service_id="$3
+ else
+ queryparams=$queryparams"&service_id="$3
+ fi
fi
- fi
-
- query="/policies"$queryparams
- res="$(__do_curl_to_api PA GET $query)"
- status=${res:${#res}-3}
-
- if [ $status -ne $1 ]; then
- echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
- ((RES_FAIL++))
- __check_stop_at_error
- return 1
- fi
-
- if [ $# -gt 4 ]; then
- if [ $# -eq 5 ] && [ $5 == "NOID" ]; then
- targetJson="["
- else
- body=${res:0:${#res}-3}
- targetJson="["
- arr=(${@:5})
-
- for ((i=0; i<$(($#-4)); i=i+5)); do
-
- if [ "$targetJson" != "[" ]; then
- targetJson=$targetJson","
- fi
- targetJson=$targetJson"{\"id\":\"$UUID${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
- if [ "${arr[$i+3]}" == "EMPTY" ]; then
- targetJson=$targetJson"\"\","
- else
- targetJson=$targetJson"\"${arr[$i+3]}\","
- fi
- file="./tmp/.p.json"
- sed 's/XXX/'${arr[$i]}'/g' ${arr[$i+4]} > $file
- json=$(cat $file)
- targetJson=$targetJson"\"json\":"$json"}"
- done
+ if [ $4 != "NOTYPE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?policytype_id="$4
+ else
+ queryparams=$queryparams"&policytype_id="$4
+ fi
fi
- targetJson=$targetJson"]"
- echo "TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ query="/v2/policy_instances"$queryparams
+ res="$(__do_curl_to_api PA GET $query)"
+ status=${res:${#res}-3}
- if [ $res -ne 0 ]; then
- echo -e $RED" FAIL, returned body not correct"$ERED
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
__check_stop_at_error
return 1
fi
+
+ if [ $# -gt 4 ]; then
+ body=${res:0:${#res}-3}
+ if [ $# -eq 5 ] && [ $5 == "NOID" ]; then
+ targetJson="["
+ else
+ targetJson="["
+ arr=(${@:5})
+
+ for ((i=0; i<$(($#-4)); i=i+7)); do
+
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ targetJson=$targetJson"{\"policy_id\":\"$UUID${arr[$i]}\",\"ric_id\":\"${arr[$i+1]}\",\"service_id\":\"${arr[$i+2]}\",\"policy_type_id\":"
+ if [ "${arr[$i+3]}" == "EMPTY" ]; then
+ targetJson=$targetJson"\"\","
+ else
+ targetJson=$targetJson"\"${arr[$i+3]}\","
+ fi
+ targetJson=$targetJson"\"transient\":${arr[$i+4]},\"status_notification_uri\":\"${arr[$i+5]}\","
+ file="./tmp/.p.json"
+ sed 's/XXX/'${arr[$i]}'/g' ${arr[$i+6]} > $file
+ json=$(cat $file)
+ targetJson=$targetJson"\"policy_data\":"$json"}"
+ done
+ fi
+
+ targetJson=$targetJson"]"
+ targetJson="{\"policies\": $targetJson}"
+ echo "TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
+ else
+ if [ $2 != "NORIC" ]; then
+ queryparams="?ric="$2
+ fi
+ if [ $3 != "NOSERVICE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?service="$3
+ else
+ queryparams=$queryparams"&service="$3
+ fi
+ fi
+ if [ $4 != "NOTYPE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?type="$4
+ else
+ queryparams=$queryparams"&type="$4
+ fi
+ fi
+
+ query="/policies"$queryparams
+ res="$(__do_curl_to_api PA GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ if [ $# -gt 4 ]; then
+ if [ $# -eq 5 ] && [ $5 == "NOID" ]; then
+ targetJson="["
+ else
+ body=${res:0:${#res}-3}
+ targetJson="["
+ arr=(${@:5})
+
+ for ((i=0; i<$(($#-4)); i=i+5)); do
+
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ targetJson=$targetJson"{\"id\":\"$UUID${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
+ if [ "${arr[$i+3]}" == "EMPTY" ]; then
+ targetJson=$targetJson"\"\","
+ else
+ targetJson=$targetJson"\"${arr[$i+3]}\","
+ fi
+ file="./tmp/.p.json"
+ sed 's/XXX/'${arr[$i]}'/g' ${arr[$i+4]} > $file
+ json=$(cat $file)
+ targetJson=$targetJson"\"json\":"$json"}"
+ done
+ fi
+
+ targetJson=$targetJson"]"
+ echo "TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
fi
((RES_PASS++))
@@ -139,20 +235,31 @@
}
-# API Test function: GET /policy
-#args: <response-code> <policy-id> [<template-file>]
+
+# API Test function: GET /policy and V2 GET /v2/policies/{policy_id}
+# args: <response-code> <policy-id> [<template-file>]
+# args(V2): <response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]
+
# (Function for test scripts)
api_get_policy() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 2 ] || [ $# -gt 3 ]; then
- __print_err "<response-code> <policy-id> [<template-file>] " $@
- return 1
- fi
- query="/policy?id=$UUID$2"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -ne 2 ] && [ $# -ne 8 ]; then
+ __print_err "<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]" $@
+ return 1
+ fi
+ query="/v2/policies/$UUID$2"
+ else
+ if [ $# -lt 2 ] || [ $# -gt 3 ]; then
+ __print_err "<response-code> <policy-id> [<template-file>] " $@
+ return 1
+ fi
+ query="/policy?id=$UUID$2"
+ fi
res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
@@ -163,19 +270,54 @@
return 1
fi
- if [ $# -eq 3 ]; then
- #Create a policy json to compare with
- body=${res:0:${#res}-3}
- file="./tmp/.p.json"
- sed 's/XXX/'${2}'/g' $3 > $file
- targetJson=$(< $file)
- echo "TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
- if [ $res -ne 0 ]; then
- echo -e $RED" FAIL, returned body not correct"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
- return 1
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -eq 8 ]; then
+
+ #Create a policy json to compare with
+ body=${res:0:${#res}-3}
+ file="./tmp/.p.json"
+
+ targetJson="\"ric_id\":\"$5\",\"policy_id\":\"$UUID$2\",\"service_id\":\"$4\""
+ if [ $7 != "NOTRANSIENT" ]; then
+ targetJson=$targetJson", \"transient\":$7"
+ fi
+ if [ $6 != "NOTYPE" ]; then
+ targetJson=$targetJson", \"policy_type_id\":\"$6\""
+ else
+ targetJson=$targetJson", \"policy_type_id\":\"\""
+ fi
+ if [ $8 != "NOURL" ]; then
+ targetJson=$targetJson", \"status_notification_uri\":\"$8\""
+ fi
+
+ data=$(sed 's/XXX/'${2}'/g' $temp)
+ targetJson=$targetJson", \"policy_data\":$data"
+ targetJson="{$targetJson}"
+
+ echo "TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
+ else
+ if [ $# -eq 3 ]; then
+ #Create a policy json to compare with
+ body=${res:0:${#res}-3}
+ file="./tmp/.p.json"
+ sed 's/XXX/'${2}'/g' $3 > $file
+ targetJson=$(< $file)
+ echo "TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
fi
fi
@@ -184,43 +326,84 @@
return 0
}
-# API Test function: PUT /policy
-# args: <response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]
+# API Test function: PUT /policy and V2 PUT /policies
+# args: <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <template-file> [<count>]
+# args(V2): <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]
# (Function for test scripts)
api_put_policy() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 7 ] || [ $# -gt 8 ]; then
- __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient>|NOTRANSIENT <template-file> [<count>]" $@
- return 1
- fi
-
- ric=$3
- count=0
- max=1
-
- if [ $# -eq 8 ]; then
- max=$8
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -lt 8 ] || [ $# -gt 9 ]; then
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]" $@
+ return 1
+ fi
+ else
+ if [ $# -lt 7 ] || [ $# -gt 8 ]; then
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <template-file> [<count>]" $@
+ return 1
+ fi
fi
+ count=0
+ max=1
+ serv=$2
+ ric=$3
+ pt=$4
pid=$5
- file=$7
+ trans=$6
+
+ if [ "$PMS_VERSION" == "V2" ]; then
+ noti=$7
+ temp=$8
+ if [ $# -eq 9 ]; then
+ max=$9
+ fi
+ else
+ temp=$7
+ if [ $# -eq 8 ]; then
+ max=$8
+ fi
+ fi
while [ $count -lt $max ]; do
- query="/policy?id=$UUID$pid&ric=$ric&service=$2"
+ if [ "$PMS_VERSION" == "V2" ]; then
- if [ $4 != "NOTYPE" ]; then
- query=$query"&type=$4"
+ query="/v2/policies"
+
+ inputJson="\"ric_id\":\"$ric\",\"policy_id\":\"$UUID$pid\",\"service_id\":\"$serv\""
+ if [ $trans != "NOTRANSIENT" ]; then
+ inputJson=$inputJson", \"transient\":$trans"
+ fi
+ if [ $pt != "NOTYPE" ]; then
+ inputJson=$inputJson", \"policy_type_id\":$pt"
+ else
+ inputJson=$inputJson", \"policy_type_id\":\"\""
+ fi
+ if [ $noti != "NOURL" ]; then
+ inputJson=$inputJson", \"status_notification_uri\":\"$noti\""
+ fi
+ file="./tmp/.p.json"
+ data=$(sed 's/XXX/'${pid}'/g' $temp)
+ inputJson=$inputJson", \"policy_data\":$data"
+ inputJson="{$inputJson}"
+ echo $inputJson > $file
+ else
+ query="/policy?id=$UUID$pid&ric=$ric&service=$serv"
+
+ if [ $pt != "NOTYPE" ]; then
+ query=$query"&type=$pt"
+ fi
+
+ if [ $trans != NOTRANSIENT ]; then
+ query=$query"&transient=$trans"
+ fi
+
+ file="./tmp/.p.json"
+ sed 's/XXX/'${pid}'/g' $temp > $file
fi
-
- if [ $6 != NOTRANSIENT ]; then
- query=$query"&transient=$6"
- fi
-
- file="./tmp/.p.json"
- sed 's/XXX/'${pid}'/g' $7 > $file
res="$(__do_curl_to_api PA PUT $query $file)"
status=${res:${#res}-3}
echo -ne " Executing "$count"("$max")${SAMELINE}"
@@ -243,43 +426,83 @@
return 0
}
-# API Test function: PUT /policy to run in batch
-# args: <response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]
+# API Test function: PUT /policy and V2 PUT /policies, to run in batch
+# args: <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <template-file> [<count>]
+# args(V2): <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <notification-url>|NOURL <template-file> [<count>]
# (Function for test scripts)
+
api_put_policy_batch() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 7 ] || [ $# -gt 8 ]; then
- __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]" $@
- return 1
- fi
-
- ric=$3
- count=0
- max=1
-
- if [ $# -eq 8 ]; then
- max=$8
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -lt 8 ] || [ $# -gt 9 ]; then
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <notification-url>|NOURL <template-file> [<count>]" $@
+ return 1
+ fi
+ else
+ if [ $# -lt 7 ] || [ $# -gt 8 ]; then
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient> <template-file> [<count>]" $@
+ return 1
+ fi
fi
+ count=0
+ max=1
+ serv=$2
+ ric=$3
+ pt=$4
pid=$5
- file=$7
+ trans=$6
+ if [ "$PMS_VERSION" == "V2" ]; then
+ noti=$7
+ temp=$8
+ if [ $# -eq 9 ]; then
+ max=$9
+ fi
+ else
+ temp=$7
+ if [ $# -eq 8 ]; then
+ max=$8
+ fi
+ fi
+
ARR=""
while [ $count -lt $max ]; do
- query="/policy?id=$UUID$pid&ric=$ric&service=$2"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/policies"
- if [ $4 != "NOTYPE" ]; then
- query=$query"&type=$4"
+ inputJson="\"ric_id\":\"$ric\",\"policy_id\":\"$UUID$pid\",\"service_id\":\"$serv\""
+ if [ $trans != "NOTRANSIENT" ]; then
+ inputJson=$inputJson", \"transient\":$trans"
+ fi
+ if [ $pt != "NOTYPE" ]; then
+ inputJson=$inputJson", \"policy_type_id\":$pt"
+ else
+ inputJson=$inputJson", \"policy_type_id\":\"\""
+ fi
+ if [ $noti != "NOURL" ]; then
+ inputJson=$inputJson", \"status_notification_uri\":\"$noti\""
+ fi
+ file="./tmp/.p.json"
+ data=$(sed 's/XXX/'${pid}'/g' $temp)
+ inputJson=$inputJson", \"policy_data\":$data"
+ inputJson="{$inputJson}"
+ echo $inputJson > $file
+ else
+ query="/policy?id=$UUID$pid&ric=$ric&service=$serv"
+
+ if [ $pt != "NOTYPE" ]; then
+ query=$query"&type=$pt"
+ fi
+
+ if [ $trans != NOTRANSIENT ]; then
+ query=$query"&transient=$trans"
+ fi
+ file="./tmp/.p.json"
+ sed 's/XXX/'${pid}'/g' $temp > $file
fi
-
- if [ $6 != NOTRANSIENT ]; then
- query=$query"&transient=$6"
- fi
-
- file="./tmp/.p.json"
- sed 's/XXX/'${pid}'/g' $7 > $file
res="$(__do_curl_to_api PA PUT_BATCH $query $file)"
status=${res:${#res}-3}
echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
@@ -304,10 +527,10 @@
res="$(__do_curl_to_api PA RESPONSE $cid)"
status=${res:${#res}-3}
- echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
+ echo -ne " Accepting(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
- echo " Requested(batch) "$count"?("$max")"
+ echo " Accepted(batch) "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
__check_stop_at_error
@@ -315,7 +538,7 @@
fi
let count=$count+1
- echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
+ echo -ne " Accepted(batch) "$count"("$max")${SAMELINE}"
done
echo ""
@@ -325,18 +548,26 @@
return 0
}
-# API Test function: PUT /policy to run in i parallel for a number of rics
+# API Test function: PUT /policy and V2 PUT /policies, to run in i parallel for a number of rics
# args: <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>
+# args(V2): <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>
# (Function for test scripts)
api_put_policy_parallel() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -ne 10 ]; then
- __print_err " <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>" $@
- return 1
- fi
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -ne 11 ]; then
+ __print_err "<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>" $@
+ return 1
+ fi
+ else
+ if [ $# -ne 10 ]; then
+ __print_err " <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>" $@
+ return 1
+ fi
+ fi
resp_code=$1; shift;
serv=$1; shift
ric_base=$1; shift;
@@ -344,6 +575,11 @@
type=$1; shift;
start_id=$1; shift;
transient=$1; shift;
+ if [ "$PMS_VERSION" == "V2" ]; then
+ noti=$1; shift;
+ else
+ noti=""
+ fi
template=$1; shift;
count=$1; shift;
pids=$1; shift;
@@ -352,18 +588,24 @@
echo " Info - api_put_policy_parallel uses only the agent REST interface - create over dmaap in parallel is not supported"
echo " Info - will execute over agent REST"
fi
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $serv == "NOSERVICE" ]; then
+ serv=""
+ fi
+ query="/v2/policies"
+ else
+ if [ $serv == "NOSERVICE" ]; then
+ serv=""
+ fi
+ query="/policy?service=$serv"
- if [ $serv == "NOSERVICE" ]; then
- serv=""
- fi
- query="/policy?service=$serv"
+ if [ $type != "NOTYPE" ]; then
+ query=$query"&type=$type"
+ fi
- if [ $type != "NOTYPE" ]; then
- query=$query"&type=$type"
- fi
-
- if [ $transient != NOTRANSIENT ]; then
- query=$query"&transient=$transient"
+ if [ $transient != NOTRANSIENT ]; then
+ query=$query"&transient=$transient"
+ fi
fi
urlbase=${ADAPTER}${query}
@@ -375,7 +617,11 @@
uuid="NOUUID"
fi
echo "" > "./tmp/.pid${i}.res.txt"
- echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $template $count $pids $i > "./tmp/.pid${i}.txt"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $serv $type $transient $noti $template $count $pids $i > "./tmp/.pid${i}.txt"
+ else
+ echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $template $count $pids $i > "./tmp/.pid${i}.txt"
+ fi
echo $i
done | xargs -n 1 -I{} -P $pids bash -c '{
arg=$(echo {})
@@ -414,7 +660,7 @@
return 1
}
-# API Test function: DELETE /policy
+# API Test function: DELETE /policy and V2 DELETE /v2/policies/{policy_id}
# args: <response-code> <policy-id> [count]
# (Function for test scripts)
api_delete_policy() {
@@ -437,7 +683,11 @@
pid=$2
while [ $count -lt $max ]; do
- query="/policy?id="$UUID$pid
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/policies/"$UUID$pid
+ else
+ query="/policy?id="$UUID$pid
+ fi
res="$(__do_curl_to_api PA DELETE $query)"
status=${res:${#res}-3}
echo -ne " Executing "$count"("$max")${SAMELINE}"
@@ -460,7 +710,7 @@
return 0
}
-# API Test function: DELETE /policy to run in batch
+# API Test function: DELETE /policy and V2 DELETE /v2/policies/{policy_id}, to run in batch
# args: <response-code> <policy-id> [count]
# (Function for test scripts)
api_delete_policy_batch() {
@@ -483,7 +733,11 @@
pid=$2
ARR=""
while [ $count -lt $max ]; do
- query="/policy?id="$UUID$pid
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/policies/"$UUID$pid
+ else
+ query="/policy?id="$UUID$pid
+ fi
res="$(__do_curl_to_api PA DELETE_BATCH $query)"
status=${res:${#res}-3}
echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
@@ -509,7 +763,7 @@
res="$(__do_curl_to_api PA RESPONSE $cid)"
status=${res:${#res}-3}
- echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
+ echo -ne " Deleting(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
echo " Deleted(batch) "$count"?("$max")"
@@ -523,12 +777,14 @@
echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
done
+ echo ""
+
((RES_PASS++))
echo -e $GREEN" PASS"$EGREEN
return 0
}
-# API Test function: DELETE /policy to run in i parallel for a number of rics
+# API Test function: DELETE /policy and V2 DELETE /v2/policies/{policy_id}, to run in i parallel for a number of rics
# args: <response-code> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>
# (Function for test scripts)
api_delete_policy_parallel() {
@@ -551,7 +807,11 @@
echo " Info - will execute over agent REST"
fi
- query="/policy"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/policies/"
+ else
+ query="/policy"
+ fi
urlbase=${ADAPTER}${query}
@@ -567,8 +827,8 @@
done | xargs -n 1 -I{} -P $pids bash -c '{
arg=$(echo {})
echo " Parallel process $arg started"
- tmp=$(< "./tmp/pid${arg}.del.txt")
- python3 ../common/delete_policies_process.py $tmp > ./tmp/pid${arg}.del.res.txt
+ tmp=$(< "./tmp/.pid${arg}.del.txt")
+ python3 ../common/delete_policies_process.py $tmp > ./tmp/.pid${arg}.del.res.txt
}'
msg=""
for ((i=1; i<=$pids; i++))
@@ -601,7 +861,7 @@
return 1
}
-# API Test function: GET /policy_ids
+# API Test function: GET /policy_ids and V2 GET /v2/policies
# args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)
# (Function for test scripts)
api_get_policy_ids() {
@@ -616,26 +876,50 @@
queryparams=""
- if [ $2 != "NORIC" ]; then
- queryparams="?ric="$2
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $2 != "NORIC" ]; then
+ queryparams="?ric_id="$2
+ fi
+
+ if [ $3 != "NOSERVICE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?service_id="$3
+ else
+ queryparams=$queryparams"&service_id="$3
+ fi
+ fi
+ if [ $4 != "NOTYPE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?policytype_id="$4
+ else
+ queryparams=$queryparams"&policytype_id="$4
+ fi
+ fi
+
+ query="/v2/policies"$queryparams
+ else
+ if [ $2 != "NORIC" ]; then
+ queryparams="?ric="$2
+ fi
+
+ if [ $3 != "NOSERVICE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?service="$3
+ else
+ queryparams=$queryparams"&service="$3
+ fi
+ fi
+ if [ $4 != "NOTYPE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?type="$4
+ else
+ queryparams=$queryparams"&type="$4
+ fi
+ fi
+
+ query="/policy_ids"$queryparams
fi
- if [ $3 != "NOSERVICE" ]; then
- if [ -z $queryparams ]; then
- queryparams="?service="$3
- else
- queryparams=$queryparams"&service="$3
- fi
- fi
- if [ $4 != "NOTYPE" ]; then
- if [ -z $queryparams ]; then
- queryparams="?type="$4
- else
- queryparams=$queryparams"&type="$4
- fi
- fi
-
- query="/policy_ids"$queryparams
res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
@@ -660,6 +944,62 @@
done
targetJson=$targetJson"]"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson="{\"policy_ids\": $targetJson}"
+ fi
+ echo "TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: V2 GET /v2/policy-types/{policyTypeId}
+# args(V2): <response-code> <policy-type-id> [<schema-file>]
+# (Function for test scripts)
+api_get_policy_type() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ "$PMS_VERSION" != "V2" ]; then
+ echo -e $RED" FAIL, function not supported"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ if [ $# -lt 2 ] || [ $# -gt 3 ]; then
+ __print_err "<response-code> <policy-type-id> [<schema-file>]" $@
+ return 1
+ fi
+ query="/v2/policy-types/$2"
+
+ res="$(__do_curl_to_api PA GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ if [ $# -eq 3 ]; then
+
+ body=${res:0:${#res}-3}
+
+ targetJson=$(< $3)
+ targetJson="{\"policy_schema\":$targetJson}"
echo "TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -684,11 +1024,17 @@
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
+ if [ "$PMS_VERSION" == "V2" ]; then
+ echo -e $RED" FAIL, function not supported"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
__print_err "<response-code> <policy-type-id> [<schema-file>]" $@
return 1
fi
-
query="/policy_schema?id=$2"
res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
@@ -705,6 +1051,7 @@
body=${res:0:${#res}-3}
targetJson=$(< $3)
+
echo "TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -723,20 +1070,31 @@
# API Test function: GET /policy_schemas
# args: <response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*
+# args(V2): <response-code>
# (Function for test scripts)
api_get_policy_schemas() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 2 ]; then
- __print_err "<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*" $@
- return 1
- fi
-
- query="/policy_schemas"
- if [ $2 != "NORIC" ]; then
- query=$query"?ric="$2
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -ne 1 ]; then
+ __print_err "<response-code>" $@
+ return 1
+ fi
+ else
+ if [ $# -lt 2 ]; then
+ __print_err "<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*" $@
+ return 1
+ fi
+ fi
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/policy-schemas"
+ else
+ query="/policy_schemas"
+ if [ $2 != "NORIC" ]; then
+ query=$query"?ric="$2
+ fi
fi
res="$(__do_curl_to_api PA GET $query)"
@@ -765,6 +1123,9 @@
done
targetJson=$targetJson"]"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson="{\"policy_schemas\": $targetJson }"
+ fi
echo "TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -781,13 +1142,14 @@
return 0
}
-# API Test function: GET /policy_status
+# API Test function: GET /policy_status and V2 GET /policies/{policy_id}/status
# arg: <response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)
# (Function for test scripts)
api_get_policy_status() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
+
if [ $# -lt 4 ] || [ $# -gt 5 ]; then
__print_err "<response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)" $@
return 1
@@ -812,7 +1174,12 @@
return 1
fi
- query="/policy_status?id="$UUID$2
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/policies/$UUID$2/status"
+ targetJson="{\"last_modified\":\"????\",\"status\":$targetJson}"
+ else
+ query="/policy_status?id="$UUID$2
+ fi
res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
@@ -840,7 +1207,7 @@
return 0
}
-# API Test function: GET /policy_types
+# API Test function: GET /policy_types and V2 GET /v2/policy-types
# args: <response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]
# (Function for test scripts)
api_get_policy_types() {
@@ -853,12 +1220,22 @@
return 1
fi
- if [ $# -eq 1 ]; then
- query="/policy_types"
- elif [ $2 == "NORIC" ]; then
- query="/policy_types"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -eq 1 ]; then
+ query="/v2/policy-types"
+ elif [ $2 == "NORIC" ]; then
+ query="/v2/policy-types"
+ else
+ query="/v2/policy-types?ric_id=$2"
+ fi
else
- query="/policy_types?ric=$2"
+ if [ $# -eq 1 ]; then
+ query="/policy_types"
+ elif [ $2 == "NORIC" ]; then
+ query="/policy_types"
+ else
+ query="/policy_types?ric=$2"
+ fi
fi
res="$(__do_curl_to_api PA GET $query)"
@@ -886,6 +1263,9 @@
done
targetJson=$targetJson"]"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson="{\"policy_type_ids\": $targetJson }"
+ fi
echo "TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -906,7 +1286,7 @@
#### Test case functions Health check
#########################################################
-# API Test function: GET /status
+# API Test function: GET /status and V2 GET /status
# args: <response-code>
# (Function for test scripts)
api_get_status() {
@@ -917,7 +1297,11 @@
__print_err "<response-code>" $@
return 1
fi
- query="/status"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/status"
+ else
+ query="/status"
+ fi
res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
@@ -937,46 +1321,102 @@
#### Test case functions RIC Repository
#########################################################
-# API Test function: GET /ric
+# API Test function: GET /ric and V2 GET /v2/rics/ric
# args: <reponse-code> <management-element-id> [<ric-id>]
+# (V2) args: <reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]
+# (V2) example of <string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4"
+# (V2) format of ric-info: <ric-id>:<list-of-mes>:<list-of-policy-type-ids>
+
+
# (Function for test scripts)
api_get_ric() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 2 ] || [ $# -gt 3 ]; then
- __print_err "<reponse-code> <management-element-id> [<ric-id>]" $@
- return 1
- fi
- query="/ric?managedElementId="$2
+ if [ "$PMS_VERSION" == "V2" ]; then
+ if [ $# -lt 3 ]; then
+ __print_err "<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [string-of-ricinfo>]" $@
+ return 1
+ fi
+ search=""
+ if [ $2 != "NOME" ]; then
+ search="?managed_element_id="$2
+ fi
+ if [ $3 != "NORIC" ]; then
+ if [ -z $search ]; then
+ search="?ric_id="$3
+ else
+ search=$search"&ric_id="$3
+ fi
+ fi
+ query="/v2/rics/ric"$search
- res="$(__do_curl_to_api PA GET $query)"
- status=${res:${#res}-3}
+ res="$(__do_curl_to_api PA GET $query)"
+ status=${res:${#res}-3}
- if [ $status -ne $1 ]; then
- echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
- ((RES_FAIL++))
- __check_stop_at_error
- return 1
- fi
-
- if [ $# -eq 3 ]; then
- body=${res:0:${#res}-3}
- if [ "$body" != "$3" ]; then
- echo -e $RED" FAIL, returned body not correct"$ERED
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
__check_stop_at_error
return 1
fi
- fi
+ if [ $# -gt 3 ]; then
+ body=${res:0:${#res}-3}
+ res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$4" )
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, could not create target ric info json"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ targetJson=$(<./tmp/.tmp_rics.json)
+ targetJson=${targetJson:1:${#targetJson}-2} #remove array brackets
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
+ else
+ if [ $# -lt 2 ] || [ $# -gt 3 ]; then
+ __print_err "<reponse-code> <management-element-id> [<ric-id>]" $@
+ return 1
+ fi
+
+ query="/ric?managedElementId="$2
+
+ res="$(__do_curl_to_api PA GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ if [ $# -eq 3 ]; then
+ body=${res:0:${#res}-3}
+ if [ "$body" != "$3" ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
+ fi
((RES_PASS++))
echo -e $GREEN" PASS"$EGREEN
return 0
}
-# API test function: GET /rics
+# API test function: GET /rics and V2 GET /v2/rics
# args: <reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]
# example of <space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."
# format of ric-info: <ric-id>:<list-of-mes>:<list-of-policy-type-ids>
@@ -991,9 +1431,16 @@
return 1
fi
- query="/rics"
- if [ $2 != "NOTYPE" ]; then
- query="/rics?policyType="$2
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/rics"
+ if [ $2 != "NOTYPE" ]; then
+ query="/v2/rics?policytype_id="$2
+ fi
+ else
+ query="/rics"
+ if [ $2 != "NOTYPE" ]; then
+ query="/rics?policyType="$2
+ fi
fi
res="$(__do_curl_to_api PA GET $query)"
@@ -1008,7 +1455,11 @@
if [ $# -gt 2 ]; then
body=${res:0:${#res}-3}
- res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "$3" )
+ if [ "$PMS_VERSION" == "V2" ]; then
+ res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$3" )
+ else
+ res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V1" "$3" )
+ fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, could not create target ric info json"$ERED
((RES_FAIL++))
@@ -1017,6 +1468,9 @@
fi
targetJson=$(<./tmp/.tmp_rics.json)
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson="{\"rics\": $targetJson }"
+ fi
echo "TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
if [ $res -ne 0 ]; then
@@ -1036,7 +1490,7 @@
#### API Test case functions Service registry and supervision ####
##################################################################
-# API test function: PUT /service
+# API test function: PUT /service and V2 PUT /service
# args: <response-code> <service-name> <keepalive-timeout> <callbackurl>
# (Function for test scripts)
api_put_service() {
@@ -1048,8 +1502,13 @@
return 1
fi
- query="/service"
- json="{\"callbackUrl\": \""$4"\",\"keepAliveIntervalSeconds\": \""$3"\",\"serviceName\": \""$2"\"}"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/services"
+ json="{\"callback_url\": \""$4"\",\"keep_alive_interval_seconds\": \""$3"\",\"service_id\": \""$2"\"}"
+ else
+ query="/service"
+ json="{\"callbackUrl\": \""$4"\",\"keepAliveIntervalSeconds\": \""$3"\",\"serviceName\": \""$2"\"}"
+ fi
file="./tmp/.tmp.json"
echo "$json" > $file
@@ -1068,7 +1527,7 @@
return 0
}
-# API test function: GET /services
+# API test function: GET /services and V2 GET /v2/services
#args: <response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]
# (Function for test scripts)
api_get_services() {
@@ -1095,12 +1554,19 @@
return 1
fi
- query="/services"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/services"
- if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then
- query="/services?name="$2
+ if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then
+ query="/v2/services?service_id="$2
+ fi
+ else
+ query="/services"
+
+ if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then
+ query="/services?name="$2
+ fi
fi
-
res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
@@ -1125,10 +1591,17 @@
targetJson=$targetJson","
fi
# timeSinceLastActivitySeconds value cannot be checked since value varies
- targetJson=$targetJson"{\"serviceName\": \""$servicename"\",\"keepAliveIntervalSeconds\": "$timeout",\"timeSinceLastActivitySeconds\":\"????\",\"callbackUrl\": \""$callback"\"}"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson=$targetJson"{\"service_id\": \""$servicename"\",\"keep_alive_interval_seconds\": "$timeout",\"time_since_last_activity_seconds\":\"????\",\"callback_url\": \""$callback"\"}"
+ else
+ targetJson=$targetJson"{\"serviceName\": \""$servicename"\",\"keepAliveIntervalSeconds\": "$timeout",\"timeSinceLastActivitySeconds\":\"????\",\"callbackUrl\": \""$callback"\"}"
+ fi
let cntr=cntr+3
done
targetJson=$targetJson"]"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson="{\"service_list\": $targetJson }"
+ fi
echo "TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
if [ $res -ne 0 ]; then
@@ -1144,7 +1617,7 @@
return 0
}
-# API test function: GET /services (only checking service names)
+# API test function: GET /services V2 GET /v2/services - (only checking service names)
# args: <response-code> [<service-name>]*"
# (Function for test scripts)
api_get_service_ids() {
@@ -1157,7 +1630,11 @@
return 1
fi
- query="/services"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/services"
+ else
+ query="/services"
+ fi
res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
@@ -1174,10 +1651,17 @@
if [ "$targetJson" != "[" ]; then
targetJson=$targetJson","
fi
- targetJson=$targetJson"{\"callbackUrl\":\"????\",\"keepAliveIntervalSeconds\":\"????\",\"serviceName\":\""$rapp"\",\"timeSinceLastActivitySeconds\":\"????\"}"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson=$targetJson"{\"callback_url\":\"????\",\"keep_alive_interval_seconds\":\"????\",\"service_id\":\""$rapp"\",\"time_since_last_activity_seconds\":\"????\"}"
+ else
+ targetJson=$targetJson"{\"callbackUrl\":\"????\",\"keepAliveIntervalSeconds\":\"????\",\"serviceName\":\""$rapp"\",\"timeSinceLastActivitySeconds\":\"????\"}"
+ fi
done
targetJson=$targetJson"]"
+ if [ "$PMS_VERSION" == "V2" ]; then
+ targetJson="{\"service_list\": $targetJson }"
+ fi
echo "TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -1193,7 +1677,7 @@
return 0
}
-# API test function: DELETE /services
+# API test function: DELETE /services and V2 DELETE /v2/services/{serviceId}
# args: <response-code> <service-name>
# (Function for test scripts)
api_delete_services() {
@@ -1205,8 +1689,11 @@
__print_err "<response-code> <service-name>" $@
return 1
fi
-
- query="/services?name="$2
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/services/"$2
+ else
+ query="/services?name="$2
+ fi
res="$(__do_curl_to_api PA DELETE $query)"
status=${res:${#res}-3}
@@ -1222,7 +1709,7 @@
return 0
}
-# API test function: PUT /services/keepalive
+# API test function: PUT /services/keepalive and V2 PUT /v2/services/{service_id}/keepalive
# args: <response-code> <service-name>
# (Function for test scripts)
api_put_services_keepalive() {
@@ -1234,8 +1721,12 @@
__print_err "<response-code> <service-name>" $@
return 1
fi
+ if [ "$PMS_VERSION" == "V2" ]; then
+ query="/v2/services/$2/keepalive"
+ else
+ query="/services/keepalive?name="$2
+ fi
- query="/services/keepalive?name="$2
res="$(__do_curl_to_api PA PUT $query)"
status=${res:${#res}-3}
diff --git a/test/common/count_json_elements.py b/test/common/count_json_elements.py
index 936e3f8..65e32c7 100644
--- a/test/common/count_json_elements.py
+++ b/test/common/count_json_elements.py
@@ -20,16 +20,24 @@
import sys
# Print the length of json array, -1 will be printed in any problem is encountered
+# Assumes the top level json is an array.
+# If not (and the number of keys on top level is 1) then assumes that key contains the array.
+arr_len=-1
try:
with open(sys.argv[1]) as json_file:
jsonarray = json.load(json_file)
-
if isinstance(jsonarray, list):
- print(len(jsonarray))
- else:
- print(-1)
+ arr_len=len(jsonarray)
+ elif isinstance(jsonarray, dict) and len(jsonarray) == 1:
+ key=next(iter(jsonarray))
+ jsonarray=jsonarray[key]
+ if isinstance(jsonarray, list):
+ arr_len = len(jsonarray)
except Exception as e:
- print(-1)
+ print(arr_len)
+ sys.exit()
+
+print(arr_len)
sys.exit()
\ No newline at end of file
diff --git a/test/common/create_policies_process.py b/test/common/create_policies_process.py
index 8d37678..d1bfd6f 100644
--- a/test/common/create_policies_process.py
+++ b/test/common/create_policies_process.py
@@ -31,21 +31,44 @@
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
#arg responsecode baseurl ric_base num_rics uuid startid templatepath count pids pid_id
+data_out=""
+url_out=""
try:
- if len(sys.argv) != 11:
- print("1Expected 10 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics uuid startid templatepath count pids pid_id")
- sys.exit()
+ if len(sys.argv) < 11:
+ print("1Expected 11/14 args, got "+str(len(sys.argv)-1))
+ print (sys.argv[1:])
+ sys.exit()
responsecode=int(sys.argv[1])
- baseurl=sys.argv[2]
- ric_base=sys.argv[3]
+ baseurl=str(sys.argv[2])
+ ric_base=str(sys.argv[3])
num_rics=int(sys.argv[4])
- uuid=sys.argv[5]
+ uuid=str(sys.argv[5])
start=int(sys.argv[6])
- templatepath=sys.argv[7]
- count=int(sys.argv[8])
- pids=int(sys.argv[9])
- pid_id=int(sys.argv[10])
+ if ("/v2/" in baseurl):
+ if len(sys.argv) != 15:
+ print("1Expected 14 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics uuid startid service type transient notification-url templatepath count pids pid_id")
+ print (sys.argv[1:])
+ sys.exit()
+
+ serv=str(sys.argv[7])
+ pt=str(sys.argv[8])
+ trans=str(sys.argv[9])
+ noti=str(sys.argv[10])
+ templatepath=str(sys.argv[11])
+ count=int(sys.argv[12])
+ pids=int(sys.argv[13])
+ pid_id=int(sys.argv[14])
+ else:
+ if len(sys.argv) != 11:
+ print("1Expected 10 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics uuid startid templatepath count pids pid_id")
+ print (sys.argv[1:])
+ sys.exit()
+
+ templatepath=str(sys.argv[7])
+ count=int(sys.argv[8])
+ pids=int(sys.argv[9])
+ pid_id=int(sys.argv[10])
if uuid == "NOUUID":
uuid=""
@@ -61,18 +84,44 @@
payload=template.replace("XXX",str(i))
ric_id=(i%num_rics)+1
ric=ric_base+str(ric_id)
- url=baseurl+"&id="+uuid+str(i)+"&ric="+str(ric)
+
try:
headers = {'Content-type': 'application/json'}
- resp=requests.put(url, json.dumps(json.loads(payload)), headers=headers, verify=False, timeout=90)
+ if ("/v2/" in baseurl):
+ url=baseurl
+
+ data={}
+ data["ric_id"]=ric
+ data["policy_id"]=uuid+str(i)
+ data["service_id"]=serv
+ if (trans != "NOTRANSIENT"):
+ data["transient"]=trans
+ if (pt != "NOTYPE"):
+ data["policy_type_id"]=pt
+ else:
+ data["policy_type_id"]=""
+ if (noti != "NOURL"):
+ data["status_notification_uri"]=noti
+ data["policy_data"]=json.loads(payload)
+
+ url_out=url
+ data_out=json.dumps(data)
+ resp=requests.put(url, data_out, headers=headers, verify=False, timeout=90)
+ else:
+ url=baseurl+"&id="+uuid+str(i)+"&ric="+str(ric)
+ url_out=url
+ data_out=json.dumps(json.loads(payload))
+ resp=requests.put(url, data_out, headers=headers, verify=False, timeout=90)
except Exception as e1:
print("1Put failed for id:"+uuid+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
sys.exit()
if (resp.status_code == None):
- print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: None")
+ print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+str(responsecode)+", got: None")
sys.exit()
if (resp.status_code != responsecode):
- print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+ print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+str(responsecode)+", got: "+str(resp.status_code))
+ print(url_out)
+ print(str(data_out))
sys.exit()
print("0")
@@ -80,4 +129,6 @@
except Exception as e:
print("1"+str(e))
+ traceback.print_exc()
+ print(str(data_out))
sys.exit()
\ No newline at end of file
diff --git a/test/common/create_rics_json.py b/test/common/create_rics_json.py
index d6a095b..b2ad528 100644
--- a/test/common/create_rics_json.py
+++ b/test/common/create_rics_json.py
@@ -28,28 +28,41 @@
#To indicate that special STD zero length name type, use 'EMPTYTYPE'. Ex. ricsim_g1_1:kista_ricsim_g1_1,stockholm_ricsim_g1_1:EMPTYTYPE
#Save in indicated file
+#arg: <file-name-for-result> <api-version> <list-ric-info>
try:
file_name = sys.argv[1]
- ric_string = sys.argv[2]
+ api_version=sys.argv[2]
+ ric_string = sys.argv[3]
ric_string=ric_string.strip()
ric_string = re.sub(' +',' ',ric_string)
ric_arr=[]
rics=ric_string.split(' ')
+ if (api_version == "V2"):
+ param_ric='ric_id'
+ param_me='managed_element_ids'
+ param_policy_type='policy_type_ids'
+ param_state='state'
+ else:
+ param_ric='ricName'
+ param_me='managedElementIds'
+ param_policy_type='policyTypes'
+ param_state='state'
+
for i in range(len(rics)):
ricDict={}
items=rics[i].split(':')
- ricDict['ricName']=items[0]
- ricDict['managedElementIds']=items[1].split(',')
+ ricDict[param_ric]=items[0]
+ ricDict[param_me]=items[1].split(',')
if (items[2] == "EMPTYTYPE"):
empty_arr=[]
empty_arr.append("")
- ricDict['policyTypes']=empty_arr
+ ricDict[param_policy_type]=empty_arr
elif (items[2] == "NOTYPE"):
empty_arr=[]
- ricDict['policyTypes']=empty_arr
+ ricDict[param_policy_type]=empty_arr
else:
- ricDict['policyTypes']=items[2].split(',')
- ricDict['state']=items[3]
+ ricDict[param_policy_type]=items[2].split(',')
+ ricDict[param_state]=items[3]
ric_arr.append(ricDict)
with open(file_name, 'w') as f:
diff --git a/test/common/delete_policies_process.py b/test/common/delete_policies_process.py
index e647118..cf293c8 100644
--- a/test/common/delete_policies_process.py
+++ b/test/common/delete_policies_process.py
@@ -38,9 +38,9 @@
sys.exit()
responsecode=int(sys.argv[1])
- baseurl=sys.argv[2]
+ baseurl=str(sys.argv[2])
num_rics=int(sys.argv[3])
- uuid=sys.argv[4]
+ uuid=str(sys.argv[4])
start=int(sys.argv[5])
count=int(sys.argv[6])
pids=int(sys.argv[7])
@@ -52,17 +52,20 @@
stop=count*num_rics+start
for i in range(start,stop):
if (i%pids == (pid_id-1)):
- url=str(baseurl+"?id="+uuid+str(i))
+ if ("/v2/policies/" in baseurl):
+ url=str(baseurl+uuid+str(i))
+ else:
+ url=str(baseurl+"?id="+uuid+str(i))
try:
resp=requests.delete(url, verify=False, timeout=90)
except Exception as e1:
print("1Delete failed for id:"+uuid+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
sys.exit()
if (resp.status_code == None):
- print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: None")
+ print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+str(responsecode)+", got: None")
sys.exit()
if (resp.status_code != responsecode):
- print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+ print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+str(responsecode)+", got: "+str(resp.status_code))
sys.exit()
print("0")
@@ -70,4 +73,5 @@
except Exception as e:
print("1"+str(e))
+ traceback.print_exc()
sys.exit()
\ No newline at end of file
diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh
index dfa6e4b..b76d43b 100644
--- a/test/common/ecs_api_functions.sh
+++ b/test/common/ecs_api_functions.sh
@@ -34,23 +34,44 @@
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs
# args: <response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
+# args (flat uri structure): <response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
# (Function for test scripts)
ecs_api_a1_get_job_ids() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- # Valid number of parameters 3,4,5,6 etc
- if [ $# -lt 1 ]; then
- __print_err "<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
- return 1
+ if [ -z "$FLAT_A1_EI" ]; then
+ # Valid number of parameters 4,5,6 etc
+ if [ $# -lt 3 ]; then
+ __print_err "<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
+ return 1
+ fi
+ else
+ echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
+ # Valid number of parameters 4,5,6 etc
+ if [ $# -lt 3 ]; then
+ __print_err "<response-code> <type-id>|NOTYPE <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]" $@
+ return 1
+ fi
fi
- owner=""
+ search=""
if [ $3 != "NOWNER" ]; then
- owner="?owner="$3
+ search="?owner="$3
fi
- query="/A1-EI/v1/eitypes/$2/eijobs$owner"
+ if [ -z "$FLAT_A1_EI" ]; then
+ query="/A1-EI/v1/eitypes/$2/eijobs$search"
+ else
+ if [ $2 != "NOTYPE" ]; then
+ if [ -z "$search" ]; then
+ search="?eiTypeId="$2
+ else
+ search=$search"&eiTypeId="$2
+ fi
+ fi
+ query="/A1-EI/v1/eijobs$search"
+ fi
res="$(__do_curl_to_api ECS GET $query)"
status=${res:${#res}-3}
@@ -125,7 +146,11 @@
__check_stop_at_error
return 1
fi
- targetJson="{\"eiJobParametersSchema\":$schema}"
+ if [ -z "$FLAT_A1_EI" ]; then
+ targetJson="{\"eiJobParametersSchema\":$schema}"
+ else
+ targetJson=$schema
+ fi
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
@@ -137,7 +162,6 @@
fi
fi
-
((RES_PASS++))
echo -e $GREEN" PASS"$EGREEN
return 0
@@ -196,39 +220,74 @@
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}/status
# args: <response-code> <type-id> <job-id> [<status>]
+# args (flat uri structure): <response-code> <job-id> [<status>]
# (Function for test scripts)
ecs_api_a1_get_job_status() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -ne 3 ] && [ $# -ne 4 ]; then
- __print_err "<response-code> <type-id> <job-id>" $@
- return 1
- fi
+ if [ -z "$FLAT_A1_EI" ]; then
+ if [ $# -ne 3 ] && [ $# -ne 4 ]; then
+ __print_err "<response-code> <type-id> <job-id> [<status>]" $@
+ return 1
+ fi
- query="/A1-EI/v1/eitypes/$2/eijobs/$3/status"
- res="$(__do_curl_to_api ECS GET $query)"
- status=${res:${#res}-3}
+ query="/A1-EI/v1/eitypes/$2/eijobs/$3/status"
- if [ $status -ne $1 ]; then
- echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
- ((RES_FAIL++))
- __check_stop_at_error
- return 1
- fi
- if [ $# -eq 4 ]; then
- body=${res:0:${#res}-3}
- targetJson="{\"operationalState\": \"$4\"}"
- echo " TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
- if [ $res -ne 0 ]; then
- echo -e $RED" FAIL, returned body not correct"$ERED
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
__check_stop_at_error
return 1
fi
+ if [ $# -eq 4 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="{\"operationalState\": \"$4\"}"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
+ else
+ echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
+ if [ $# -ne 2 ] && [ $# -ne 3 ]; then
+ __print_err "<response-code> <job-id> [<status>]" $@
+ return 1
+ fi
+
+ query="/A1-EI/v1/eijobs/$2/status"
+
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ if [ $# -eq 3 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="{\"eiJobStatus\": \"$3\"}"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
fi
((RES_PASS++))
@@ -238,18 +297,27 @@
# API Test function: GET /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
# args: <response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]
+# args (flat uri structure): <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
# (Function for test scripts)
ecs_api_a1_get_job() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -ne 3 ] && [ $# -ne 6 ]; then
- __print_err "<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]" $@
- return 1
+ if [ -z "$FLAT_A1_EI" ]; then
+ if [ $# -ne 3 ] && [ $# -ne 6 ]; then
+ __print_err "<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]" $@
+ return 1
+ fi
+ query="/A1-EI/v1/eitypes/$2/eijobs/$3"
+ else
+ echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
+ if [ $# -ne 2 ] && [ $# -ne 7 ]; then
+ __print_err "<response-code> <job-id> [<type-id> <target-url> <owner-id> <notification-url> <template-job-file>]" $@
+ return 1
+ fi
+ query="/A1-EI/v1/eijobs/$2"
fi
-
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
res="$(__do_curl_to_api ECS GET $query)"
status=${res:${#res}-3}
@@ -260,27 +328,53 @@
return 1
fi
- if [ $# -eq 6 ]; then
- body=${res:0:${#res}-3}
+ if [ -z "$FLAT_A1_EI" ]; then
+ if [ $# -eq 6 ]; then
+ body=${res:0:${#res}-3}
- if [ -f $6 ]; then
- jobfile=$(cat $6)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
- else
- echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
- return 1
+ if [ -f $6 ]; then
+ jobfile=$(cat $6)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
+ else
+ echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
fi
- targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
- echo " TARGET JSON: $targetJson" >> $HTTPLOG
- res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ else
+ if [ $# -eq 7 ]; then
+ body=${res:0:${#res}-3}
- if [ $res -ne 0 ]; then
- echo -e $RED" FAIL, returned body not correct"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
- return 1
+ if [ -f $7 ]; then
+ jobfile=$(cat $7)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
+ else
+ echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ targetJson="{\"eiTypeId\": \"$3\", \"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
fi
fi
@@ -291,18 +385,28 @@
# API Test function: DELETE /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
# args: <response-code> <type-id> <job-id>
+# args (flat uri structure): <response-code> <job-id>
# (Function for test scripts)
ecs_api_a1_delete_job() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 3 ]; then
- __print_err "<response-code> <type-id> <job-id>" $@
- return 1
- fi
+ if [ -z "$FLAT_A1_EI" ]; then
+ if [ $# -ne 3 ]; then
+ __print_err "<response-code> <type-id> <job-id>" $@
+ return 1
+ fi
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
+ query="/A1-EI/v1/eitypes/$2/eijobs/$3"
+ else
+ echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
+ if [ $# -ne 2 ]; then
+ __print_err "<response-code> <job-id>" $@
+ return 1
+ fi
+ query="/A1-EI/v1/eijobs/$2"
+ fi
res="$(__do_curl_to_api ECS DELETE $query)"
status=${res:${#res}-3}
@@ -320,31 +424,56 @@
# API Test function: PUT /A1-EI/v1/eitypes/{eiTypeId}/eijobs/{eiJobId}
# args: <response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>
+# args (flat uri structure): <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
# (Function for test scripts)
ecs_api_a1_put_job() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 6 ]; then
- __print_err "<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>" $@
- return 1
- fi
- if [ -f $6 ]; then
- jobfile=$(cat $6)
- jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
+ if [ -z "$FLAT_A1_EI" ]; then
+ if [ $# -lt 6 ]; then
+ __print_err "<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>" $@
+ return 1
+ fi
+ if [ -f $6 ]; then
+ jobfile=$(cat $6)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
+ else
+ echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ inputJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+
+ query="/A1-EI/v1/eitypes/$2/eijobs/$3"
else
- echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
- return 1
+ echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
+ if [ $# -lt 7 ]; then
+ __print_err "<response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>" $@
+ return 1
+ fi
+ if [ -f $7 ]; then
+ jobfile=$(cat $7)
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
+ else
+ echo -e $RED" FAIL. Job template file "$7", does not exist"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ inputJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+
+ query="/A1-EI/v1/eijobs/$2"
fi
- inputJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
- file="./tmp/.p.json"
- echo "$inputJson" > $file
-
- query="/A1-EI/v1/eitypes/$2/eijobs/$3"
res="$(__do_curl_to_api ECS PUT $query $file)"
status=${res:${#res}-3}
diff --git a/test/common/test_env-onap-guilin.sh b/test/common/test_env-onap-guilin.sh
index e7a9030..f92bf79 100644
--- a/test/common/test_env-onap-guilin.sh
+++ b/test/common/test_env-onap-guilin.sh
@@ -79,6 +79,7 @@
export POLICY_AGENT_INTERNAL_PORT=8081 # Policy Agent container internal port (container -> container)
export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433 # Policy Agent container external secure port (host -> container)
export POLICY_AGENT_INTERNAL_SECURE_PORT=8433 # Policy Agent container internal secure port (container -> container)
+export POLICY_AGENT_APIS="V1" # Supported northbound api versions
export POLICY_AGENT_APP_NAME="policy-agent" # Name for Policy Agent container
POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
diff --git a/test/common/test_env-onap-master.sh b/test/common/test_env-onap-master.sh
index 7ecd687..da6906d 100644
--- a/test/common/test_env-onap-master.sh
+++ b/test/common/test_env-onap-master.sh
@@ -60,7 +60,7 @@
RIC_SIM_LOCAL_IMAGE_TAG="latest"
# Near RT RIC Simulator remote image and tag
RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
+RIC_SIM_REMOTE_IMAGE_TAG="2.1.0"
#Consul remote image and tag
@@ -97,6 +97,8 @@
export POLICY_AGENT_INTERNAL_PORT=8081 # Policy Agent container internal port (container -> container)
export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433 # Policy Agent container external secure port (host -> container)
export POLICY_AGENT_INTERNAL_SECURE_PORT=8433 # Policy Agent container internal secure port (container -> container)
+export POLICY_AGENT_APIS="V1 V2" # Supported northbound api versions
+export PMS_VERSION="V2"
export POLICY_AGENT_APP_NAME="policy-agent" # Name for Policy Agent container
POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
diff --git a/test/common/test_env-oran-master.sh b/test/common/test_env-oran-master.sh
index b24ecae..7b8e8f8 100755
--- a/test/common/test_env-oran-master.sh
+++ b/test/common/test_env-oran-master.sh
@@ -101,6 +101,7 @@
export POLICY_AGENT_INTERNAL_PORT=8081 # Policy Agent container internal port (container -> container)
export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433 # Policy Agent container external secure port (host -> container)
export POLICY_AGENT_INTERNAL_SECURE_PORT=8433 # Policy Agent container internal secure port (container -> container)
+export POLICY_AGENT_APIS="V1" # Supported northbound api versions
export POLICY_AGENT_APP_NAME="policy-agent" # Name for Policy Agent container
POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh
index f8ff19f..ea940a1 100755
--- a/test/common/testcase_common.sh
+++ b/test/common/testcase_common.sh
@@ -269,9 +269,13 @@
G1_A1_VERSION=""
G2_A1_VERSION=""
G3_A1_VERSION=""
+G4_A1_VERSION=""
+G5_A1_VERSION=""
G1_COUNT=0
G2_COUNT=0
G3_COUNT=0
+G4_COUNT=0
+G5_COUNT=0
# Vars to switch between http and https. Extra curl flag needed for https
export RIC_SIM_HTTPX="http"
@@ -1457,9 +1461,9 @@
echo ""
}
-# Start one group (ricsim_g1, ricsim_g2 or ricsim_g3) with a number of RIC Simulators using a given A interface
+# Start one group (ricsim_g1, ricsim_g2 .. ricsim_g5) with a number of RIC Simulators using a given A interface
# 'ricsim' may be set on command line to other prefix
-# args: ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>
+# args: ricsim_g1|ricsim_g2|ricsim_g3|ricsim_g4|ricsim_g5 <count> <interface-id>
# (Function for test scripts)
start_ric_simulators() {
@@ -1475,10 +1479,12 @@
RIC1=$RIC_SIM_PREFIX"_g1"
RIC2=$RIC_SIM_PREFIX"_g2"
RIC3=$RIC_SIM_PREFIX"_g3"
+ RIC4=$RIC_SIM_PREFIX"_g4"
+ RIC5=$RIC_SIM_PREFIX"_g5"
if [ $# != 3 ]; then
((RES_CONF_FAIL++))
- __print_err "need three args, $RIC1|$RIC2|$RIC3 <count> <interface-id>" $@
+ __print_err "need three args, $RIC1|$RIC2|$RIC3|$RIC4|$RIC5 <count> <interface-id>" $@
exit 1
fi
echo " $2 simulators using basename: $1 on interface: $3"
@@ -1492,9 +1498,15 @@
elif [ $1 == "$RIC3" ]; then
G3_COUNT=$2
G3_A1_VERSION=$3
+ elif [ $1 == "$RIC4" ]; then
+ G4_COUNT=$2
+ G4_A1_VERSION=$3
+ elif [ $1 == "$RIC5" ]; then
+ G5_COUNT=$2
+ G5_A1_VERSION=$3
else
((RES_CONF_FAIL++))
- __print_err "need three args, $RIC1|$RIC2|$RIC3 <count> <interface-id>" $@
+ __print_err "need three args, $RIC1|$RIC2|$RIC3|$RIC4|$RIC5 <count> <interface-id>" $@
exit 1
fi
@@ -1504,8 +1516,10 @@
export G1_A1_VERSION
export G2_A1_VERSION
export G3_A1_VERSION
+ export G4_A1_VERSION
+ export G5_A1_VERSION
- docker_args="--scale g1=$G1_COUNT --scale g2=$G2_COUNT --scale g3=$G3_COUNT"
+ docker_args="--scale g1=$G1_COUNT --scale g2=$G2_COUNT --scale g3=$G3_COUNT --scale g4=$G4_COUNT --scale g5=$G5_COUNT"
app_data=""
cntr=1
while [ $cntr -le $2 ]; do
diff --git a/test/prodstub/app/prodstub.py b/test/prodstub/app/prodstub.py
index df4898d..7323d3a 100644
--- a/test/prodstub/app/prodstub.py
+++ b/test/prodstub/app/prodstub.py
@@ -537,7 +537,7 @@
data["job"]=""+key
data["sequence_no"]=""+str(job['delivery_attempts'])
data["value"]=str(100)
- print("Sending "+json.dumps(data))
+ print("Sending to "+url+" payload:"+json.dumps(data))
requests.post(url, json=data, verify=False, timeout=2) #NOSONAR
job['delivery_attempts'] += 1