Simulate Service Distribution of SDC Service in Catalog DB

Change-Id: I9437305940dacd985ad12d0af3c19ba2b78eca0b
Issue-ID: SO-1948
Signed-off-by: rope252 <gareth.roper@est.tech>
diff --git a/plans/so/integration-etsi-testing/config/distribution-test-zip/distributionTestZip.zip b/plans/so/integration-etsi-testing/config/distribution-test-zip/distributionTestZip.zip
new file mode 100644
index 0000000..ac96bd9
--- /dev/null
+++ b/plans/so/integration-etsi-testing/config/distribution-test-zip/distributionTestZip.zip
Binary files differ
diff --git a/plans/so/integration-etsi-testing/docker-compose.yml b/plans/so/integration-etsi-testing/docker-compose.yml
index 2286c9a..148b6dc 100644
--- a/plans/so/integration-etsi-testing/docker-compose.yml
+++ b/plans/so/integration-etsi-testing/docker-compose.yml
@@ -167,4 +167,37 @@
       - vnfm-adapter
     command:
       - "/config/apply-workarounds.sh"
+#################################################################################
+  sdc-controller:
+    image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/sdc-controller:${TAG}
+    ports:
+      - "8085:8085"
+    volumes:
+      - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates
+      - ${TEST_LAB_DIR}/volumes/so/config/sdc-controller/onapheat:/app/config
+      - ${CONFIG_DIR_PATH}/distribution-test-zip/distributionTestZip.zip:/distribution-test-zip/distributionTestZip.zip
+    environment:
+      - APP=sdc-controller
+      - JVM_ARGS=-Xms64m -Xmx512m
+      - DB_HOST=mariadb
+      - DB_PORT=3306
+      - DB_USERNAME=so_user
+      - DB_PASSWORD=so_User123
+      - DB_ADMIN_USERNAME=so_admin
+      - DB_ADMIN_PASSWORD=so_Admin123
+    hostname:
+      sdc-controller.so.testlab.onap.org
+    depends_on:
+      - mariadb
+      - catalog-db-adapter
+      - request-db-adapter
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "30m"
+        max-file: "5"
+    command: 
+      - /bin/sh
+      - -c
+      - 'mkdir -p /distribution-test-zip/unzipped && unzip /distribution-test-zip/distributionTestZip.zip -d /distribution-test-zip/unzipped && /app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"'
 ################################################################################
diff --git a/plans/so/integration-etsi-testing/testplan.txt b/plans/so/integration-etsi-testing/testplan.txt
index 94b5442..c68e4fb 100644
--- a/plans/so/integration-etsi-testing/testplan.txt
+++ b/plans/so/integration-etsi-testing/testplan.txt
@@ -1,2 +1,3 @@
 # Test suites are relative paths under [integration/csit.git]/tests/.
 # Place the suites in run order.
+so/etsi/etsi_tests.robot
diff --git a/tests/so/etsi/data/distributeServiceTemplate.json b/tests/so/etsi/data/distributeServiceTemplate.json
new file mode 100644
index 0000000..11b9880
--- /dev/null
+++ b/tests/so/etsi/data/distributeServiceTemplate.json
@@ -0,0 +1,103 @@
+{
+  "distributionID": "cfe30d6c-eb67-4ffb-ba98-4b654162223a",
+  "serviceName": "manualDistributionTestService",
+  "serviceVersion": "1.0",
+  "serviceUUID": "28d4acf3-4791-4998-8d06-1cdf6d1767a9",
+  "serviceDescription": "Test",
+  "serviceInvariantUUID": "0ddc448d-5513-44bc-8b02-5759d84600d5",
+  "resources": [
+    {
+      "resourceInstanceName": "manualDistributionTestVNF 0",
+      "resourceCustomizationUUID": "82ad3aa0-edc6-410c-a217-655fb064323f",
+      "resourceName": "manualDistributionTestVNF",
+      "resourceVersion": "1.0",
+      "resoucreType": "VF",
+      "resourceUUID": "e8e39dc4-4761-4da7-aedf-7d1fd3637772",
+      "resourceInvariantUUID": "0a0b9979-863d-4b7e-b7f4-d27725a182b3",
+      "category": "Application L4+",
+      "subcategory": "Media Servers",
+      "artifacts": [
+        {
+          "artifactName": "manualdistributiontestvnf0_modules.json",
+          "artifactType": "VF_MODULES_METADATA",
+          "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/manualdistributiontestvnf0_modules.json",
+          "artifactChecksum": "NTc0NDlkNzdmYzVmMDM3ZjMxMTE2NDBmYWJiMDM1NzY\u003d",
+          "artifactDescription": "Auto-generated VF Modules information artifact",
+          "artifactTimeout": 120,
+          "artifactVersion": "1",
+          "artifactUUID": "a10f397a-6546-4a27-843f-25821955ef3e",
+          "relatedArtifactsInfo": []
+        },
+        {
+          "artifactName": "base_ves_med1.yaml",
+          "artifactType": "HEAT",
+          "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.yaml",
+          "artifactChecksum": "YTAwNTQ3NjczY2Y5MmUwZjUzZTY1ZjNhNTA0NGQyMDY\u003d",
+          "artifactDescription": "created from csar",
+          "artifactTimeout": 120,
+          "artifactVersion": "2",
+          "artifactUUID": "e216d9da-18c4-460f-8b2b-d7f8dd9e9295",
+          "generatedArtifact": {
+            "artifactName": "base_ves_med1.env",
+            "artifactType": "HEAT_ENV",
+            "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.env",
+            "artifactChecksum": "Mjg5YTVhNTlmYTdjYTFlYjYxMDlhODYzNmJhZGJiZGE\u003d",
+            "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+            "artifactTimeout": 120,
+            "artifactVersion": "2",
+            "artifactUUID": "6243747f-e794-4519-82b2-6399846f1951",
+            "generatedFromUUID": "e216d9da-18c4-460f-8b2b-d7f8dd9e9295"
+          },
+          "relatedArtifactsInfo": []
+        },
+        {
+          "artifactName": "base_ves_med1.env",
+          "artifactType": "HEAT_ENV",
+          "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.env",
+          "artifactChecksum": "Mjg5YTVhNTlmYTdjYTFlYjYxMDlhODYzNmJhZGJiZGE\u003d",
+          "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+          "artifactTimeout": 120,
+          "artifactVersion": "2",
+          "artifactUUID": "6243747f-e794-4519-82b2-6399846f1951",
+          "relatedArtifactsInfo": []
+        },
+        {
+          "artifactName": "TOSCA.meta",
+          "artifactType": "OTHER",
+          "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/TOSCA.meta",
+          "artifactChecksum": "NWE2ODcyOWY0NGI2MzEyOGViYjUxNTEwMjU5OWRhZmI\u003d",
+          "artifactDescription": "created from csar",
+          "artifactTimeout": 120,
+          "artifactVersion": "1",
+          "artifactUUID": "6c64d38b-186f-4339-9a76-a266c40f40ec",
+          "relatedArtifactsInfo": []
+        },
+        {
+          "artifactName": "descriptor.yaml",
+          "artifactType": "OTHER",
+          "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/descriptor.yaml",
+          "artifactChecksum": "YWZkNTg2ZGMzZjRhZjgxNzNkODJiNjgwZmRlZjlmNDE\u003d",
+          "artifactDescription": "created from csar",
+          "artifactTimeout": 120,
+          "artifactVersion": "1",
+          "artifactUUID": "4bd0cdf6-0b12-4d19-b3d8-6dbc34fe397e",
+          "relatedArtifactsInfo": []
+        }
+      ]
+    }
+  ],
+  "serviceArtifacts": [
+    {
+      "artifactName": "service-Manualdistributiontestservice-csar.csar",
+      "artifactType": "TOSCA_CSAR",
+      "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/artifacts/service-Manualdistributiontestservice-csar.csar",
+      "artifactChecksum": "YWYxNmUxNTlhMmE3MjA1NGVhNTBhYTdkMmU0OTZjNzM\u003d",
+      "artifactDescription": "TOSCA definition package of the asset",
+      "artifactTimeout": 0,
+      "artifactVersion": "1",
+      "artifactUUID": "e6e8c36a-b939-4845-995a-41c50be890a0"
+    }
+  ],
+  "workloadContext": "Production"
+}
+
diff --git a/tests/so/etsi/etsi_tests.robot b/tests/so/etsi/etsi_tests.robot
new file mode 100644
index 0000000..e3d0a95
--- /dev/null
+++ b/tests/so/etsi/etsi_tests.robot
@@ -0,0 +1,20 @@
+*** Settings ***
+Library     Collections
+Library     RequestsLibrary
+Library     OperatingSystem
+Library     json
+
+*** Variables ***
+${MESSAGE}    Hello, world!
+
+*** Test Cases ***
+
+Distribute Service Template
+    Create Session   refrepo  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
+    Run Keyword If  '${resp.status_code}' == '200'  log to console  \nexecuted with expected result
+