Create basic Test case to invoke ETSI flow

Change-Id: I6786ec0a97789965825f4d0b390a44c5a3aa5d64
Issue-ID: SO-2144
Signed-off-by: eHanan <eoin.hanan@est.tech>
diff --git a/plans/so/integration-etsi-testing/config/override-files/so-monitoring/onapheat/override.yaml b/plans/so/integration-etsi-testing/config/override-files/so-monitoring/onapheat/override.yaml
new file mode 100644
index 0000000..7e61c7d
--- /dev/null
+++ b/plans/so/integration-etsi-testing/config/override-files/so-monitoring/onapheat/override.yaml
@@ -0,0 +1,24 @@
+server:
+  port: 30224
+  tomcat:
+    max-threads: 4
+ssl-enable: false
+camunda:
+  rest:
+    api:
+      url: http://bpmn-infra:8081/sobpmnengine/engine/
+      engine: default
+      auth: Basic YXBpaEJwbW46cGFzc3dvcmQxJA==
+mso:
+  database:
+    rest:
+      api:
+        url: http://request-db-adapter:8083/infraActiveRequests/
+        auth: Basic YnBlbDpwYXNzd29yZDEk
+spring:
+ security:
+   usercredentials:
+   -
+     username: gui
+     password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+     role: GUI-Client
diff --git a/plans/so/integration-etsi-testing/docker-compose.yml b/plans/so/integration-etsi-testing/docker-compose.yml
index 69fb685..e5e56d6 100644
--- a/plans/so/integration-etsi-testing/docker-compose.yml
+++ b/plans/so/integration-etsi-testing/docker-compose.yml
@@ -231,7 +231,7 @@
   so-monitoring:
     image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/so-monitoring:${TAG}
     ports:
-      - "30224:9091"
+      - "30224:30224"
     volumes:
       - ${TEST_LAB_DIR}/volumes/so/config/api-handler-infra/onapheat:/app/config
     environment:
diff --git a/plans/so/integration-etsi-testing/setup.sh b/plans/so/integration-etsi-testing/setup.sh
index a3eb784..6f0c010 100755
--- a/plans/so/integration-etsi-testing/setup.sh
+++ b/plans/so/integration-etsi-testing/setup.sh
@@ -41,6 +41,7 @@
 SIMULATOR_MAVEN_PROJECT_POM="$SCRIPT_HOME/so-simulators/pom.xml"
 WAIT_FOR_WORKAROUND_SCRIPT=$CONFIG_DIR/"wait-for-workaround-job.sh"
 WAIT_FOR_POPULATE_AAI_SCRIPT=$CONFIG_DIR/"wait-for-aai-config-job.sh"
+WAIT_FOR_CONTAINER_SCRIPT=$CONFIG_DIR/"wait-for-container.sh"
 
 echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..."
 
@@ -137,7 +138,7 @@
 if [ $? -ne 0 ]; then
    echo "ERROR: $WAIT_FOR_WORKAROUND_SCRIPT failed"
    echo "Will stop running docker containers . . ."
-   docker-compose -f $DOCKER_COMPOSE_FILE_PATH down
+   docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down
    exit 1
 fi
 
@@ -147,7 +148,18 @@
 if [ $? -ne 0 ]; then
    echo "ERROR: $WAIT_FOR_POPULATE_AAI_SCRIPT failed"
    echo "Will stop running docker containers . . ."
-   docker-compose -f $DOCKER_COMPOSE_FILE_PATH down
+   docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down
+   exit 1
+fi
+
+API_INFRA_CONTAINER_NAME="api-handler-infra"
+echo "Will execute $WAIT_FOR_CONTAINER_SCRIPT to wait for $API_INFRA_CONTAINER_NAME container to start up"
+$WAIT_FOR_CONTAINER_SCRIPT -n "$API_INFRA_CONTAINER_NAME" -t "300" -p "${PROJECT_NAME}_default"
+
+if [ $? -ne 0 ]; then
+   echo "ERROR: $WAIT_FOR_CONTAINER_SCRIPT failed"
+   echo "Will stop running docker containers . . ."
+   docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down
    exit 1
 fi
 
diff --git a/tests/so/etsi/data/serviceInstantiationRequest.json b/tests/so/etsi/data/serviceInstantiationRequest.json
new file mode 100644
index 0000000..054a2ff
--- /dev/null
+++ b/tests/so/etsi/data/serviceInstantiationRequest.json
@@ -0,0 +1,33 @@
+{
+    "requestDetails": {
+        "requestInfo": {
+            "instanceName": "CsitEtsiInstance",
+            "source": "VID",
+            "suppressRollback": false,
+            "requestorId": "demo"
+        },
+        "modelInfo": {
+            "modelType": "service",
+            "modelInvariantId": "0ddc448d-5513-44bc-8b02-5759d84600d5",
+            "modelVersionId": "28d4acf3-4791-4998-8d06-1cdf6d1767a9",
+            "modelName": "manualDistributionTestService",
+            "modelVersion": "1.0"
+        },
+        "requestParameters": {
+            "userParams": [],
+            "testApi": "GR_API",
+            "subscriptionServiceType": "vCPE",
+            "aLaCarte": true
+        },
+        "subscriberInfo": {
+            "globalSubscriberId": "DemoCustomer"
+        },
+        "project": {
+            "projectName": "etsiCsitProject"
+        },
+        "owningEntity": {
+            "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a",
+            "owningEntityName": "OE-Demonstration"
+        }
+    }
+}
diff --git a/tests/so/etsi/etsi_tests.robot b/tests/so/etsi/etsi_tests.robot
index e3d0a95..a3b658c 100644
--- a/tests/so/etsi/etsi_tests.robot
+++ b/tests/so/etsi/etsi_tests.robot
@@ -5,16 +5,36 @@
 Library     json
 
 *** Variables ***
-${MESSAGE}    Hello, world!
+
 
 *** Test Cases ***
-
 Distribute Service Template
-    Create Session   refrepo  http://${REPO_IP}:8085
+    Create Session   sdc_controller_session  http://${REPO_IP}:8085
     ${data}=    Get Binary File     ${CURDIR}${/}data${/}distributeServiceTemplate.json
     &{headers}=  Create Dictionary    Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ=    resource-location=/distribution-test-zip/unzipped     Content-Type=application/json    Accept=application/json
-    log to console  \nAbout to POST ${REPO_IP}
-    ${resp}=    Post Request    refrepo    /test/treatNotification/v1    data=${data}    headers=${headers}
-    log to console  \nAFRTE POST
+    ${resp}=    Post Request    sdc_controller_session    /test/treatNotification/v1    data=${data}    headers=${headers}
     Run Keyword If  '${resp.status_code}' == '200'  log to console  \nexecuted with expected result
 
+Invoke Service Instantiation
+    Create Session   api_handler_session  http://${REPO_IP}:8080
+    ${data}=    Get Binary File     ${CURDIR}${/}data${/}serviceInstantiationRequest.json
+    &{headers}=  Create Dictionary    Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==    Content-Type=application/json    Accept=application/json
+    ${service_instantiation_request}=    Post Request    api_handler_session    /onap/so/infra/serviceInstantiation/v7/serviceInstances    data=${data}    headers=${headers}
+    Run Keyword If  '${service_instantiation_request.status_code}' == '200'  log to console   \nexecuted with expected result
+    log to console      ${service_instantiation_request.content}
+    ${service_instantiation_json_responce}=    Evaluate     json.loads("""${service_instantiation_request.content}""")    json
+
+    ${actual_request_state}=    SET VARIABLE    ""
+
+    : FOR    ${INDEX}    IN RANGE    48
+    \   ${orchestration_status_request}=   Get Request  api_handler_session   /onap/so/infra/orchestrationRequests/v7/${service_instantiation_json_responce}[requestReferences][requestId]
+    \   Run Keyword If  '${orchestration_status_request.status_code}' == '200'  log to console   \nexecuted with expected result
+    \   log to console      ${orchestration_status_request.content}
+    \   ${orchestration_json_responce}=    Evaluate     json.loads("""${orchestration_status_request.content}""")    json
+    \   ${actual_request_state}=     SET VARIABLE       ${orchestration_json_responce}[request][requestStatus][requestState]
+    \   RUN KEYWORD IF   '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED'      Exit For Loop
+    \   log to console  Received actual repsonse status:${actual_request_state}
+    \   log to console  Will try again after 5 seconds
+    \   SLEEP   5s
+
+    Run Keyword If  '${actual_request_state}' == 'COMPLETE'  log to console   \nexecuted with expected result