Minor updates to CSIT tests

Adapted scripts to changes in the test environment.
Using PMS 2.0 for master

Issue-ID: CCSDK-2981

Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: Ia5ea7f4468bdb2c67a85b440c5f30ab617eb0c66
diff --git a/plans/ccsdk-oran/polmansuite/FTC1.sh b/plans/ccsdk-oran/polmansuite/FTC1.sh
index 1ccb425..ce9aa73 100755
--- a/plans/ccsdk-oran/polmansuite/FTC1.sh
+++ b/plans/ccsdk-oran/polmansuite/FTC1.sh
@@ -23,9 +23,13 @@
 #App names to include in the test, space separated list
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
+#Supported test env file (profile)
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
+. ../common/cr_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -46,28 +50,23 @@
         echo "#####################################################################"
         echo "#####################################################################"
 
-        #Local vars in test script
-        ##########################
-
-        if [ $__httpx == "HTTPS" ]; then
-            # Path to callback receiver
-            CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
-            use_cr_https
-        else
-            # Path to callback receiver
-            CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
-            use_cr_http
-        fi
-
         # Clean container and start all needed containers #
         clean_containers
 
         if [ $__httpx == "HTTPS" ]; then
+            use_cr_https
+            #echo "Using secure ports between agent and MR"
+            use_mr_https
             #"Using secure ports towards simulators"
             use_simulator_https
+            use_agent_rest_https
         else
+            use_cr_http
+            #"Using non-secure ports between agent and MR"
+            use_mr_http
             #"Using non-secure ports towards simulators"
             use_simulator_http
+            use_agent_rest_http
         fi
 
         start_ric_simulators ricsim_g1 1  OSC_2.1.0
@@ -75,16 +74,16 @@
 
         start_mr
 
-        if [ $__httpx == "HTTPS" ]; then
-            #echo "Using secure ports between agent and MR"
-            use_mr_https
-        else
-            #"Using non-secure ports between agent and MR"
-            use_mr_http
-        fi
-
         start_cr
 
+        start_policy_agent
+
+        set_agent_debug
+
+        # Create service to be able to receive events when rics becomes available
+        # Must use rest towards the agent since dmaap is not configured yet
+        api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
+
         if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
 
             start_sdnc
@@ -98,6 +97,8 @@
             fi
         fi
 
+        cr_equal received_callbacks 0
+
         start_consul_cbs
 
         if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
@@ -110,10 +111,6 @@
 
         start_control_panel
 
-        start_policy_agent
-
-        set_agent_debug
-
         if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
             if [ $__httpx == "HTTPS" ]; then
                 echo "Using secure ports towards dmaap"
@@ -132,21 +129,29 @@
             fi
         fi
 
-
-        cr_equal received_callbacks 0
         mr_equal requests_submitted 0
 
         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 2 60
 
-        api_equal json:policy_schemas 2 120
+            api_equal json:policy-types 2 120
 
-        api_equal json:policy_types 2
+            api_equal json:policies 0
 
-        api_equal json:policies 0
+            api_equal json:policy-instances 0
+        else
+            api_equal json:rics 2 60
 
-        api_equal json:policy_ids 0
+            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 ################"
@@ -160,7 +165,7 @@
 
         api_put_service 201 "serv1" 1000 "$CR_PATH/1"
 
-        api_get_service_ids 200 "serv1"
+        api_get_service_ids 200 "serv1" "ric-registration"
 
         api_put_services_keepalive 200 "serv1"
 
@@ -174,11 +179,16 @@
         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=$CR_PATH/2
+        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
 
@@ -186,9 +196,17 @@
 
         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
+        if [ "$PMS_VERSION" == "V2" ]; then
+            cr_equal received_callbacks?id=ric-registration 2
+
+            cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1
+        fi
 
         if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
             VAL=11 # Number of Agent API calls over DMAAP
diff --git a/plans/ccsdk-oran/polmansuite/FTC150.sh b/plans/ccsdk-oran/polmansuite/FTC150.sh
index c6c690d..fd30dcb 100755
--- a/plans/ccsdk-oran/polmansuite/FTC150.sh
+++ b/plans/ccsdk-oran/polmansuite/FTC150.sh
@@ -23,6 +23,9 @@
 #App names to include in the test, space separated list
 INCLUDED_IMAGES="RICSIM SDNC"
 
+#SUPPORTED TEST ENV FILE
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+
 . ../common/testcase_common.sh  $@
 . ../common/controller_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
diff --git a/plans/ccsdk-oran/polmansuite/test_env-guilin.sh b/plans/ccsdk-oran/polmansuite/test_env-guilin.sh
index e7a9030..85445ec 100644
--- a/plans/ccsdk-oran/polmansuite/test_env-guilin.sh
+++ b/plans/ccsdk-oran/polmansuite/test_env-guilin.sh
@@ -17,6 +17,9 @@
 #  ============LICENSE_END=================================================
 #
 
+#Profile for guilin release
+TEST_ENV_PROFILE="ONAP-GUILIN"
+
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
 # NOTE: A env var for each container is created by the test script.
@@ -26,7 +29,7 @@
 # Tag for guilin branch
 # Remote Policy Agent image and tag
 POLICY_AGENT_REMOTE_IMAGE="nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice"
-POLICY_AGENT_REMOTE_IMAGE_TAG="1.0.1-SNAPSHOT"
+POLICY_AGENT_REMOTE_IMAGE_TAG="1.0.2-SNAPSHOT"
 
 
 # Control Panel remote image and tag
@@ -36,7 +39,7 @@
 # Tag for guilin branch
 # SDNC A1 Controller remote image and tag
 SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.onap.org:10003/onap/sdnc-image"
-SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.0.2-STAGING-latest"
+SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.0.3-STAGING-latest"
 
 
 #SDNC DB remote image and tag
@@ -97,6 +100,7 @@
 export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
 export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
 export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+export CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
 
 export CONSUL_HOST="consul-server"                              # Host name of consul
 export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
@@ -145,3 +149,8 @@
 DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
 ADAPTER=$RESTBASE                                               # Adapter holds the address the agent R-APP interface (REST OR DMAAP)
                                                                 # The values of this var is swiched between the two base url when needed
+
+CR_RESTBASE="http://localhost:"$CR_EXTERNAL_PORT                # Base url to the Callback receiver REST interface
+CR_RESTBASE_SECURE="https://localhost:"$CR_EXTERNAL_SECURE_PORT # Base url to the secure Callback receiver REST interface
+CR_ADAPTER=$CR_RESTBASE                                         # Adapter holds the address the CR admin interface (REST only)
+                                                                # The values of this var is swiched between the two base url when needed
\ No newline at end of file
diff --git a/plans/ccsdk-oran/polmansuite/test_env-master.sh b/plans/ccsdk-oran/polmansuite/test_env-master.sh
index 874c8bd..3d5a6c8 100644
--- a/plans/ccsdk-oran/polmansuite/test_env-master.sh
+++ b/plans/ccsdk-oran/polmansuite/test_env-master.sh
@@ -17,6 +17,9 @@
 #  ============LICENSE_END=================================================
 #
 
+#Profile for current master branch
+TEST_ENV_PROFILE="ONAP-MASTER"
+
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
 # NOTE: A env var for each container is created by the test script.
@@ -79,6 +82,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 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
@@ -97,6 +101,7 @@
 export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
 export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
 export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+export CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
 
 export CONSUL_HOST="consul-server"                              # Host name of consul
 export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
@@ -145,3 +150,8 @@
 DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
 ADAPTER=$RESTBASE                                               # Adapter holds the address the agent R-APP interface (REST OR DMAAP)
                                                                 # The values of this var is swiched between the two base url when needed
+
+CR_RESTBASE="http://localhost:"$CR_EXTERNAL_PORT                # Base url to the Callback receiver REST interface
+CR_RESTBASE_SECURE="https://localhost:"$CR_EXTERNAL_SECURE_PORT # Base url to the secure Callback receiver REST interface
+CR_ADAPTER=$CR_RESTBASE                                         # Adapter holds the address the CR admin interface (REST only)
+                                                                # The values of this var is swiched between the two base url when needed
\ No newline at end of file