[PMSH] TLS support refactoring

Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: I169a072bdbc7ad3fddd4d002a76b798fa5627e8f
Issue-ID: DCAEGEN2-2146
diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai-initializer.json b/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai-initializer.json
index 5406f99..3b8c127 100644
--- a/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai-initializer.json
+++ b/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai-initializer.json
@@ -1,7 +1,7 @@
 [
   {
     "httpRequest": {
-      "path": "/aai/v16/query.*"
+      "path": "/aai/v19/query.*"
     },
     "httpResponse": {
       "statusCode": 200,
diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai_mockserver.properties b/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai_mockserver.properties
index 9c59230..04b9cc4 100644
--- a/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai_mockserver.properties
+++ b/plans/dcaegen2-services-pmsh/testsuite/assets/aai_sim/aai_mockserver.properties
@@ -14,10 +14,13 @@
 # certificate domain name (default "localhost")
 mockserver.sslCertificateDomainName=localhost
 # comma separated list of domain names for Subject Alternative Name domain names (default empty list)
-mockserver.sslSubjectAlternativeNameDomains=www.example.com,www.another.com
+mockserver.sslSubjectAlternativeNameDomains=aai,aai.onap
 # comma separated list of ip addresses for Subject Alternative Name ips (default empty list)
 mockserver.sslSubjectAlternativeNameIps=127.0.0.1
 
+mockserver.certificateAuthorityPrivateKey=/var/tmp/mock_server_key.pem
+mockserver.certificateAuthorityCertificate=/var/tmp/mock_server_cacert.pem
+
 # CORS
 
 # enable CORS for MockServer REST API
diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json b/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json
index 1a1ba9e..16d6893 100644
--- a/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json
+++ b/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json
@@ -77,12 +77,14 @@
             "control_loop_name": "pmsh-control-loop",
             "operational_policy_name": "pmsh-operational-policy",
             "cert_path": "/opt/app/pmsh/etc/certs/cert.pem",
+            "enable_tls": true,
+            "ca_cert_path": "/opt/app/pmsh/etc/certs/cacert.pem",
             "streams_publishes": {
               "policy_pm_publisher": {
                 "dmaap_info": {
                   "client_id": "1475976809466",
                   "client_role": "org.onap.dcae.pmPublisher",
-                  "topic_url": "https://mr-sim:3095/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS",
+                  "topic_url": "https://mr-sim:3095/events/unauthenticated.DCAE_CL_OUTPUT",
                   "location": "san-francisco"
                 },
                 "type": "message_router"
@@ -101,7 +103,7 @@
               "policy_pm_subscriber": {
                 "dmaap_info": {
                   "location": "san-francisco",
-                  "topic_url": "https://mr-sim:3095/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS",
+                  "topic_url": "https://mr-sim:3095/events/unauthenticated.PMSH_CL_INPUT",
                   "client_role": "org.onap.dcae.pmSubscriber",
                   "client_id": "1575876809456"
                 },
diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr-initializer.json b/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr-initializer.json
index 2eac840..6b12a83 100644
--- a/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr-initializer.json
+++ b/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr-initializer.json
@@ -1,7 +1,10 @@
 [
   {
     "httpRequest": {
-      "path": "/events/AAI_EVENT/dcae_pmsh_cg/AAI-EVENT"
+      "path": "/events/AAI_EVENT/dcae_pmsh_cg/dcae_pmsh_aai_event",
+      "queryStringParameters" : {
+        "timeout" : [ "1000" ]
+      }
     },
     "httpResponse": {
       "statusCode": 200,
@@ -15,7 +18,10 @@
   },
   {
     "httpRequest": {
-      "path": "/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS"
+      "path": "/events/unauthenticated.DCAE_CL_OUTPUT",
+      "queryStringParameters" : {
+        "timeout" : [ "1000" ]
+      }
     },
     "httpResponse": {
       "statusCode": 200,
@@ -32,7 +38,10 @@
   },
   {
     "httpRequest": {
-      "path": "/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS/dcae_pmsh_cg/policy_response_consumer"
+      "path": "/events/unauthenticated.PMSH_CL_INPUT/dcae_pmsh_cg/dcae_pmsh_policy_cl_input",
+      "queryStringParameters" : {
+        "timeout" : [ "1000" ]
+      }
     },
     "httpResponse": {
       "statusCode": 200,
diff --git a/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml b/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml
index ed991c3..6df60f1 100644
--- a/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml
+++ b/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml
@@ -11,15 +11,18 @@
     networks:
       pmsh-network:
 
-  aai-sim:
+  aai:
     container_name: aai-sim
     image: mockserver/mockserver:mockserver-5.9.0
     environment:
       MOCKSERVER_PROPERTY_FILE: /config/mockserver.properties
       MOCKSERVER_INITIALIZATION_JSON_PATH: /config/aai-initializer.json
+      LOG_LEVEL: "DEBUG"
     volumes:
       - ./assets/aai_sim/aai_mockserver.properties:/config/mockserver.properties
       - ./assets/aai_sim/aai-initializer.json:/config/aai-initializer.json
+      - ./assets/ssl_certs/mock_server_cacert.pem:/var/tmp/mock_server_cacert.pem
+      - ./assets/ssl_certs/mock_server_key.pem:/var/tmp/mock_server_key.pem
     networks:
       pmsh-network:
 
@@ -68,7 +71,6 @@
       PMSH_PG_URL: db
       PMSH_PG_USERNAME: $DB_USER
       PMSH_PG_PASSWORD: $DB_PASSWORD
-      AAI_SERVICE_HOST: aai-sim
       AAI_SERVICE_PORT: 1080
       DCAE_CA_CERTPATH: '/opt/app/pmsh/etc/certs/cacert.pem'
     networks:
diff --git a/plans/dcaegen2-services-pmsh/testsuite/setup.sh b/plans/dcaegen2-services-pmsh/testsuite/setup.sh
index eb2196a..4b939fd 100644
--- a/plans/dcaegen2-services-pmsh/testsuite/setup.sh
+++ b/plans/dcaegen2-services-pmsh/testsuite/setup.sh
@@ -6,7 +6,7 @@
 
 TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-pmsh/testsuite
 
-docker-compose -f ${TEST_PLANS_DIR}/docker-compose.yml up -d db aai-sim cbs-sim mr-sim
+docker-compose -f ${TEST_PLANS_DIR}/docker-compose.yml up -d db aai cbs-sim mr-sim
 
 # Slow machine running CSITs can affect db coming up in time for PMSH
 echo "Waiting for postgres db to come up..."
diff --git a/plans/dcaegen2-services-pmsh/testsuite/teardown.sh b/plans/dcaegen2-services-pmsh/testsuite/teardown.sh
index c5bac31..a01dfda 100644
--- a/plans/dcaegen2-services-pmsh/testsuite/teardown.sh
+++ b/plans/dcaegen2-services-pmsh/testsuite/teardown.sh
@@ -2,7 +2,7 @@
 echo "Starting teardown script"
 TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-pmsh/testsuite
 mkdir -p $WORKSPACE/archives
-docker exec pmsh /bin/sh -c "ls -l /var/log/ONAP/dcaegen2/services/pmsh/"
 docker exec pmsh /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pmsh/*"
+docker cp pmsh:/var/log/ONAP/dcaegen2/services/pmsh/application.log $WORKSPACE/archives/
 docker-compose -f $TEST_PLANS_DIR/docker-compose.yml logs --no-color > $WORKSPACE/archives/pmsh-docker-compose.log
 docker-compose -f $TEST_PLANS_DIR/docker-compose.yml down -v