Enhancing SO SDC Controller to invoke ONAP-ETSI Catalog APIs

Change-Id: I9f0ba05c14478b9165c2c470559567513e1919cf
Issue-ID: SO-2406
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index 9fa2055..60cd2d9 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -102,3 +102,11 @@
     endpoint: http://localhost:${wiremock.server.port}
   config:
     defaultpath: src/test/resources
+
+sdc:
+  endpoint: http://localhost:${wiremock.server.port}
+  
+etsi-catalog-manager:
+  endpoint:  http://localhost:${wiremock.server.port}/api/catalog/v1
+  rest:
+    timeoutInSeconds: 5
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml
new file mode 100644
index 0000000..6499a58
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml
@@ -0,0 +1 @@
+<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><version>1.0</version><name>EP</name><description/><increments/><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>LKG</name><description/><type>Unique</type><increments/><manufacturerReferenceNumber/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><sp-limits/><vendor-limits/></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml
new file mode 100644
index 0000000..581a3ac
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml
@@ -0,0 +1 @@
+<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><vf-id>fa87b9536b704787981357393f36b3fc</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>EP</name><description/><increments/><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>LKG</name><description/><type>Unique</type><increments/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><manufacturer-reference-number/><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></license-key-group></license-key-group-list><name>FG</name><feature-group-uuid>2218d90f94944a94952be83354847631</feature-group-uuid><description/><part-number>234594</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar
new file mode 100644
index 0000000..56dbb2b
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar
new file mode 100644
index 0000000..7ddfb6e
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml
new file mode 100644
index 0000000..6499a58
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml
@@ -0,0 +1 @@
+<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><version>1.0</version><name>EP</name><description/><increments/><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>LKG</name><description/><type>Unique</type><increments/><manufacturerReferenceNumber/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><sp-limits/><vendor-limits/></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml
new file mode 100644
index 0000000..581a3ac
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml
@@ -0,0 +1 @@
+<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><vf-id>fa87b9536b704787981357393f36b3fc</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>EP</name><description/><increments/><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>LKG</name><description/><type>Unique</type><increments/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><manufacturer-reference-number/><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></license-key-group></license-key-group-list><name>FG</name><feature-group-uuid>2218d90f94944a94952be83354847631</feature-group-uuid><description/><part-number>234594</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json
new file mode 100644
index 0000000..d936cd1
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json
@@ -0,0 +1,66 @@
+{
+    "distributionID": "35f20eb9-238a-4cc2-96dc-0a08f71bc209",
+    "serviceName": "VgwServiceV1",
+    "serviceVersion": "1.0",
+    "serviceUUID": "e051ff77-fb79-451c-8457-1cbf94e4db8f",
+    "serviceDescription": "Test VGW Service",
+    "serviceInvariantUUID": "c2ce924f-0aa1-4777-9b42-c0fec006a883",
+    "resources": [
+        {
+            "resourceInstanceName": "VgwVspV1 0",
+            "resourceName": "VgwVspV1",
+            "resourceVersion": "1.0",
+            "resourceType": "VF",
+            "resourceUUID": "655aa939-d589-4333-8cc6-8fcb15db858a",
+            "resourceInvariantUUID": "c53a0c91-35f6-40ff-bcda-f75030cfaf2d",
+            "resourceCustomizationUUID": "db1673e1-351a-4d04-8e2f-84b2b4c52cc7",
+            "category": "Generic",
+            "subcategory": "Network Service",
+            "artifacts": [
+                {
+                    "artifactName": "vf-license-model.xml",
+                    "artifactType": "VF_LICENSE",
+                    "artifactURL": "/VF_LICENSE/vf-license-model.xml",
+                    "artifactChecksum": "NjMwZDc0YzhiNDRlZDAyYjIxMmFlM2M0MWRkZjFmNDA\u003d",
+                    "artifactDescription": "VF license file",
+                    "artifactTimeout": 120,
+                    "artifactUUID": "8dda263d-90bb-4b3d-b8e0-0048222dc658",
+                    "artifactVersion": "1"
+                },
+                {
+                    "artifactName": "vgw6.csar",
+                    "artifactType": "ONBOARDED_PACKAGE",
+                    "artifactURL": "/ONBOARDED_PACKAGE/vgw6.csar",
+                    "artifactChecksum": "NjdmNGU3ZDlkODQ0YTUzMTU5NjZmOThiYjMxNTJiNGI\u003d",
+                    "artifactDescription": "Artifact created from csar",
+                    "artifactTimeout": 120,
+                    "artifactUUID": "9e9930b8-898e-4b8b-999e-66c43e1611f4",
+                    "artifactVersion": "1"
+                },
+                {
+                    "artifactName": "vendor-license-model.xml",
+                    "artifactType": "VENDOR_LICENSE",
+                    "artifactURL": "/VENDOR_LICENSE/vendor-license-model.xml",
+                    "artifactChecksum": "NGNmNzU4MDhjN2FjMTJkNWIxMjNkZDZhOWQyYzU0ZjA\u003d",
+                    "artifactDescription": " Vendor license file",
+                    "artifactTimeout": 120,
+                    "artifactUUID": "b3f7a4cf-6a35-4f66-b800-cd4a9a0e9719",
+                    "artifactVersion": "1"
+                }
+            ]
+        }
+    ],
+    "serviceArtifacts": [
+        {
+            "artifactName": "service-Vgwservicev1-csar.csar",
+            "artifactType": "TOSCA_CSAR",
+            "artifactURL": "/service-Vgwservicev1-csar.csar",
+            "artifactChecksum": "MzcxNTMwMDhmNGY0MjRkMjFkNzk1MDNjOTVhNjQzMmE\u003d",
+            "artifactDescription": "TOSCA definition package of the asset",
+            "artifactTimeout": 0,
+            "artifactUUID": "0cc70c6e-6ddc-4ecc-8052-d9f1433c14b8",
+            "artifactVersion": "1"
+        }
+    ],
+    "workloadContext": "Production"
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json
new file mode 100644
index 0000000..8dc07b9
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json
@@ -0,0 +1,20 @@
+{
+    "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30",
+    "responseDescriptor": 
+    {
+        "status": "error",
+        "progress": "255",
+        "statusDescription": "VNF package() already exists.",
+        "errorCode": "1",
+        "responseId": "2",
+        "responseHistoryList": [
+            {
+                "status": "processing",
+                "progress": "5",
+                "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.",
+                "errorCode": "0",
+                "responseId": "1"
+            }
+        ]
+    }
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json
new file mode 100644
index 0000000..13f346f
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json
@@ -0,0 +1,20 @@
+{
+    "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30",
+    "responseDescriptor": 
+    {
+        "status": "error",
+        "progress": "255",
+        "statusDescription": "Failed to query artifacts(resources) from sdc.",
+        "errorCode": "0",
+        "responseId": "2",
+        "responseHistoryList": [
+            {
+                "status": "processing",
+                "progress": "5",
+                "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.",
+                "errorCode": "0",
+                "responseId": "1"
+            }
+        ]
+    }
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json
new file mode 100644
index 0000000..b5dc1fe
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json
@@ -0,0 +1,27 @@
+{
+    "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30",
+    "responseDescriptor": 
+    {
+        "status": "finished",
+        "progress": "100",
+        "statusDescription": "CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute successfully.",
+        "errorCode": "0",
+        "responseId": "3",
+        "responseHistoryList": [
+            {
+                "status": "processing",
+                "progress": "30",
+                "statusDescription": "Save CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) to database.",
+                "errorCode": "0",
+                "responseId": "2"
+            },
+            {
+                "status": "processing",
+                "progress": "5",
+                "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.",
+                "errorCode": "0",
+                "responseId": "1"
+            }
+        ]
+    }
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar
new file mode 100644
index 0000000..51a9e19
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar
Binary files differ