summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authoraosull01 <adrian.osullivan@huawei.com>2019-03-05 10:43:15 +0000
committeraosull01 <adrian.osullivan@huawei.com>2019-03-05 11:13:55 +0000
commitc28c83fbe81f11ba5b636da29f969b72d58df9b5 (patch)
tree5da61d9ecf8ed91b01b8898428769bf862bbc9f4 /src/test
parent54f4f123ca4fd37ded22dc7887a4bb7bb468f01b (diff)
Use SDC Tosca Jar to extract and parse SDC CSAR
Change-Id: I0e8261ed338eaafa35bb663f95a19fe97be57652 Issue-ID: EXTAPI-205 Signed-off-by: aosull01 <adrian.osullivan@huawei.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java360
-rw-r--r--src/test/resources/__files/toscafile/service-Sdwanvpninfraservice-csar.csarbin0 -> 33640 bytes
-rw-r--r--src/test/resources/karatetest/features/00--ServiceCatalog.feature7
-rw-r--r--src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json10
-rw-r--r--src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json213
5 files changed, 348 insertions, 242 deletions
diff --git a/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java b/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java
index 3a770ae..8849607 100644
--- a/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java
+++ b/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java
@@ -1,273 +1,149 @@
/**
* Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.onap.nbi.apis.servicecatalog;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertNull;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import java.io.File;
-import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-
-import org.assertj.core.api.AbstractBooleanAssert;
import org.junit.Test;
import org.onap.nbi.exceptions.TechnicalException;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
public class ToscaInfosProcessorTest {
- final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson databind
-
- ToscaInfosProcessor toscaInfosProcessor = new ToscaInfosProcessor();
-
-
- private LinkedHashMap parseToscaFile(String fileName) {
-
- File toscaFile = new File(fileName);
- if (!toscaFile.exists()) {
- throw new TechnicalException("unable to find file : " + fileName);
- }
- try {
- return (LinkedHashMap) mapper.readValue(toscaFile, Object.class);
- } catch (IOException e) {
- throw new TechnicalException("Unable to parse tosca file : " + fileName);
+ final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson databind
- } catch (NullPointerException e) {
- throw new TechnicalException("unable to find tosca file : " + fileName);
- }
- }
-
-
- @Test
- public void buildResponseWithToscaInfos() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource("toscafile/service-TestNetwork-template.yml").getFile());
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "e2b12ac6-cbb6-4517-9c58-b846d1f68caf");
- resources.add(resource1);
- LinkedHashMap toscaFile = parseToscaFile(file.getPath());
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
- toscaInfosProcessor.buildResponseWithToscaInfos((LinkedHashMap) toscaFile.get("topology_template"), response);
-
- resources = (List<LinkedHashMap>) response.get("resourceSpecification");
- assertNull(resources.get(0).get("modelCustomizationId"));
- assertNull(resources.get(0).get("modelCustomizationName"));
+ ToscaInfosProcessor toscaInfosProcessor = new ToscaInfosProcessor();
- }
-
- @Test
- public void buildResponseWithSdcToscaParser() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile()).toPath().toAbsolutePath();
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "7baa7742-3a13-4288-8330-868015adc340");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
- resources.add(resource2);
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
- try {
- toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
- }
- catch(SdcToscaParserException e) {
- throw new TechnicalException("unable to build response from tosca csar using sdc-parser : " + path.toString()+" "+e.getMessage());
- }
- resources = (List<LinkedHashMap>) response.get("resourceSpecification");
- List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
- serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
- assertThat(serviceSpecCharacteristic.get(0).get("name")).isEqualTo("sdwanconnectivity0_topology");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
- assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
- assertThat(resources.get(0).get("modelCustomizationId")).isEqualTo("94ec574b-2306-4cbd-8214-09662b040f73");
- assertThat(resources.get(1).get("modelCustomizationId")).isEqualTo("a7baba5d-6ac3-42b5-b47d-070841303ab1");
-
- }
- @Test
- public void buildResponseWithSdcToscaParserWithDefaultInputs() {
+ @Test
+ public void buildResponseWithSdcToscaParser() {
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(classLoader.getResource("toscafile/service-Sotnvpninfraservice-csar.csar").getFile()).toPath().toAbsolutePath();
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "218df3c3-50dd-4c26-9e36-4771387bb771");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
- resources.add(resource2);
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(
+ classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile())
+ .toPath().toAbsolutePath();
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "7baa7742-3a13-4288-8330-868015adc340");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
+ resources.add(resource2);
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("resourceSpecification", resources);
- try {
- toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
- }
- catch(SdcToscaParserException e) {
- throw new TechnicalException("unable to build response from tosca csar using sdc-parser : " + path.toString()+" "+e.getMessage());
- }
- resources = (List<LinkedHashMap>) response.get("resourceSpecification");
- List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
- serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
- assertThat(resources.get(0).get("modelCustomizationId")).isEqualTo("b44071c8-04fd-4d6b-b6af-772cbfaa1129");
- assertThat(resources.get(1).get("modelCustomizationId")).isEqualTo("c3612284-6c67-4d8c-8b41-b699cc90e76d");
- assertThat(serviceSpecCharacteristic.get(12).get("serviceSpecCharacteristicValue")).isNull();
- assertThat(serviceSpecCharacteristic.get(13).get("serviceSpecCharacteristicValue")).isNotNull();
+ try {
+ toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException e) {
+ throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
+ + path.toString() + " " + e.getMessage());
}
-
- @Test
- public void buildResponseWithSdcToscaParserwithMetaDataMisMatch() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile()).toPath().toAbsolutePath();
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "some bad resource id no in TOSCA CSAR");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "some bad resource id no in TOSCA CSAR");
- resources.add(resource2);
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
-
- try {
- toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
- }
- catch(SdcToscaParserException e) {
- throw new TechnicalException("unable to build response from tosca csar using sdc-parser : " + path.toString()+" "+e.getMessage());
- }
- resources = (List<LinkedHashMap>) response.get("resourceSpecification");
- List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
- serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
- assertThat(serviceSpecCharacteristic.get(0).get("name")).isEqualTo("sdwanconnectivity0_topology");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
- assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
- // Check that resources cannot be found in the TOSCA template
- assertThat(resources.get(0).get("modelCustomizationId")).isNull();
- assertThat(resources.get(1).get("modelCustomizationId")).isNull();
-
+ resources = (List<LinkedHashMap>) response.get("resourceSpecification");
+ List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
+ serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
+ assertThat(serviceSpecCharacteristic.get(0).get("name"))
+ .isEqualTo("sdwanconnectivity0_topology");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
+ assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
+ assertThat(resources.get(0).get("modelCustomizationId"))
+ .isEqualTo("94ec574b-2306-4cbd-8214-09662b040f73");
+ assertThat(resources.get(1).get("modelCustomizationId"))
+ .isEqualTo("a7baba5d-6ac3-42b5-b47d-070841303ab1");
+
+ }
+
+ @Test
+ public void buildResponseWithSdcToscaParserWithDefaultInputs() {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(
+ classLoader.getResource("toscafile/service-Sotnvpninfraservice-csar.csar").getFile())
+ .toPath().toAbsolutePath();
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "218df3c3-50dd-4c26-9e36-4771387bb771");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
+ resources.add(resource2);
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("resourceSpecification", resources);
+
+ try {
+ toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException e) {
+ throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
+ + path.toString() + " " + e.getMessage());
}
- @Test
- public void buildResponseWithToscaInfosOk() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource("toscafile/service-VfwService2vfBased-template.yml").getFile());
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "e2b12ac6-cbb6-4517-9c58-b846d1f68caf");
- resources.add(resource1);
- LinkedHashMap toscaFile = parseToscaFile(file.getPath());
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
- toscaInfosProcessor.buildResponseWithToscaInfos((LinkedHashMap) toscaFile.get("topology_template"), response);
-
- ArrayList toscaInfos = (ArrayList) response.get("serviceSpecCharacteristic");
- assertThat(toscaInfos.size()).isEqualTo(4);
-
- for (Object toscaInfo : toscaInfos) {
- LinkedHashMap info = (LinkedHashMap) toscaInfo;
- if (((String) info.get("name")).equalsIgnoreCase("fortigate_image_url")) {
- assertThat(info.get("name")).isEqualTo("fortigate_image_url");
- assertThat(info.get("description")).isNull();
- assertThat(info.get("valueType")).isEqualTo("string");
- assertThat(info.get("@type")).isEqualTo("ONAPserviceCharacteristic");
- assertThat(info.get("required")).isEqualTo(false);
- assertThat(info.get("status")).isNull();
- assertThat(((ArrayList) info.get("serviceSpecCharacteristicValue")).size()).isEqualTo(0);
-
- }
-
- if (((String) info.get("name")).equalsIgnoreCase("flavor")) {
- assertThat(info.get("name")).isEqualTo("flavor");
- assertThat(info.get("description")).isNull();
- assertThat(info.get("valueType")).isEqualTo("string");
- assertThat(info.get("@type")).isEqualTo("ONAPserviceCharacteristic");
- assertThat(info.get("required")).isNull();
- assertThat(info.get("status")).isNull();
- assertThat(((ArrayList) info.get("serviceSpecCharacteristicValue")).size()).isEqualTo(0);
-
- }
-
- if (((String) info.get("name")).equalsIgnoreCase("external_network_name")) {
- assertThat(info.get("name")).isEqualTo("external_network_name");
- assertThat(info.get("description")).isNull();
- assertThat(info.get("valueType")).isEqualTo("string");
- assertThat(info.get("@type")).isEqualTo("ONAPserviceCharacteristic");
- assertThat(info.get("required")).isNull();
- assertThat(info.get("status")).isEqualTo("inactive");
- ;
- assertThat(((ArrayList) info.get("serviceSpecCharacteristicValue")).size()).isEqualTo(0);
-
- }
-
- if (((String) info.get("name")).equalsIgnoreCase("cpus")) {
- assertThat(info.get("name")).isEqualTo("cpus");
- assertThat(info.get("description")).isEqualTo("Number of CPUs for the server.");
- assertThat(info.get("valueType")).isEqualTo("integer");
- assertThat(info.get("@type")).isEqualTo("ONAPserviceCharacteristic");
- assertThat(info.get("required")).isNull();
- assertThat(info.get("status")).isNull();
- ;
- assertThat(((ArrayList) info.get("serviceSpecCharacteristicValue")).size()).isEqualTo(4);
- ArrayList serviceSpecCharacteristicValues = (ArrayList) info.get("serviceSpecCharacteristicValue");
-
- for (Object serviceSpecCharacteristicValue : serviceSpecCharacteristicValues) {
- LinkedHashMap serviceSpecValue = (LinkedHashMap) serviceSpecCharacteristicValue;
- if (((String) serviceSpecValue.get("value")).equalsIgnoreCase("1")) {
- assertThat(serviceSpecValue.get("isDefault")).isEqualTo(false);
- assertThat(serviceSpecValue.get("value")).isEqualTo("1");
- assertThat(serviceSpecValue.get("valueType")).isEqualTo("integer");
- }
- if (((String) serviceSpecValue.get("value")).equalsIgnoreCase("2")) {
- assertThat(serviceSpecValue.get("isDefault")).isEqualTo(true);
- assertThat(serviceSpecValue.get("value")).isEqualTo("2");
- assertThat(serviceSpecValue.get("valueType")).isEqualTo("integer");
- }
- if (((String) serviceSpecValue.get("value")).equalsIgnoreCase("3")) {
- assertThat(serviceSpecValue.get("isDefault")).isEqualTo(false);
- assertThat(serviceSpecValue.get("value")).isEqualTo("3");
- assertThat(serviceSpecValue.get("valueType")).isEqualTo("integer");
- }
- if (((String) serviceSpecValue.get("value")).equalsIgnoreCase("4")) {
- assertThat(serviceSpecValue.get("isDefault")).isEqualTo(false);
- assertThat(serviceSpecValue.get("value")).isEqualTo("4");
- assertThat(serviceSpecValue.get("valueType")).isEqualTo("integer");
- }
-
- }
-
-
- }
-
- }
-
-
+ resources = (List<LinkedHashMap>) response.get("resourceSpecification");
+ List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
+ serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
+ assertThat(resources.get(0).get("modelCustomizationId"))
+ .isEqualTo("b44071c8-04fd-4d6b-b6af-772cbfaa1129");
+ assertThat(resources.get(1).get("modelCustomizationId"))
+ .isEqualTo("c3612284-6c67-4d8c-8b41-b699cc90e76d");
+ assertThat(serviceSpecCharacteristic.get(12).get("serviceSpecCharacteristicValue")).isNull();
+ assertThat(serviceSpecCharacteristic.get(13).get("serviceSpecCharacteristicValue")).isNotNull();
+ }
+
+ @Test
+ public void buildResponseWithSdcToscaParserwithMetaDataMisMatch() {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(
+ classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile())
+ .toPath().toAbsolutePath();
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "some bad resource id no in TOSCA CSAR");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "some bad resource id no in TOSCA CSAR");
+ resources.add(resource2);
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("resourceSpecification", resources);
+
+ try {
+ toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException e) {
+ throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
+ + path.toString() + " " + e.getMessage());
}
-} \ No newline at end of file
+ resources = (List<LinkedHashMap>) response.get("resourceSpecification");
+ List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
+ serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
+ assertThat(serviceSpecCharacteristic.get(0).get("name"))
+ .isEqualTo("sdwanconnectivity0_topology");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
+ assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
+ // Check that resources cannot be found in the TOSCA template
+ assertThat(resources.get(0).get("modelCustomizationId")).isNull();
+ assertThat(resources.get(1).get("modelCustomizationId")).isNull();
+
+ }
+}
diff --git a/src/test/resources/__files/toscafile/service-Sdwanvpninfraservice-csar.csar b/src/test/resources/__files/toscafile/service-Sdwanvpninfraservice-csar.csar
new file mode 100644
index 0000000..52bdfe2
--- /dev/null
+++ b/src/test/resources/__files/toscafile/service-Sdwanvpninfraservice-csar.csar
Binary files differ
diff --git a/src/test/resources/karatetest/features/00--ServiceCatalog.feature b/src/test/resources/karatetest/features/00--ServiceCatalog.feature
index 31fd148..2a40526 100644
--- a/src/test/resources/karatetest/features/00--ServiceCatalog.feature
+++ b/src/test/resources/karatetest/features/00--ServiceCatalog.feature
@@ -18,6 +18,13 @@ And match $.resourceSpecification[0] contains { name : 'vFW-vSINK', resourceInst
And match $.resourceSpecification == '#[2]'
And match $.attachment == '#[5]'
+Scenario: testServiceCatalogGetServiceWithToscaInput
+Given path 'serviceSpecification','462f84e5-f0e5-44c5-ab95-38fb4bf77064'
+When method get
+Then status 200
+And match $ contains { id : '462f84e5-f0e5-44c5-ab95-38fb4bf77064' , name : 'vFW' , invariantUUID : 'b58a118e-eeb9-4f6e-bdca-e292f84d17df' , toscaModelURL : '/sdc/v1/catalog/services/462f84e5-f0e5-44c5-ab95-38fb4bf77064/toscaModel' , distributionStatus : 'DISTRIBUTED' , version : '2.0' , lifecycleStatus : 'CERTIFIED' , @type : 'ONAPservice' , attachment : '#array' , relatedParty : '#notnull' , resourceSpecification : '#array' }
+And match $.serviceSpecCharacteristic[0] contains { name : 'sdwanconnectivity0_topology', description : 'full mesh, hub-spoke', valueType : 'string', required : '#boolean', serviceSpecCharacteristicValue : '#null' }
+
Scenario: findServiceCatalog
Given path 'serviceSpecification'
When method get
diff --git a/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json b/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json
new file mode 100644
index 0000000..9886df7
--- /dev/null
+++ b/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json
@@ -0,0 +1,10 @@
+{
+ "request": {
+ "method": "GET",
+ "url": "/sdc/v1/catalog/services/462f84e5-f0e5-44c5-ab95-38fb4bf77064/toscaModel"
+ },
+ "response": {
+ "status": 200,
+ "bodyFileName": "toscafile/service-Sdwanvpninfraservice-csar.csar"
+ }
+}
diff --git a/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json b/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json
new file mode 100644
index 0000000..848b725
--- /dev/null
+++ b/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json
@@ -0,0 +1,213 @@
+{
+ "request": {
+ "method": "GET",
+ "url": "/sdc/v1/catalog/services/462f84e5-f0e5-44c5-ab95-38fb4bf77064/metadata"
+ },
+ "response": {
+ "status": 200,
+ "jsonBody": {
+ "uuid": "462f84e5-f0e5-44c5-ab95-38fb4bf77064",
+ "invariantUUID": "b58a118e-eeb9-4f6e-bdca-e292f84d17df",
+ "name": "vFW",
+ "version": "2.0",
+ "toscaModelURL": "/sdc/v1/catalog/services/462f84e5-f0e5-44c5-ab95-38fb4bf77064/toscaModel",
+ "category": "Network Service",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "jm0007",
+ "distributionStatus": "DISTRIBUTED",
+ "lastUpdaterFullName": "Joni Mitchell",
+ "resources": [{
+ "resourceInstanceName": "vFW-vSINK 0",
+ "resourceName": "vFW-vSINK",
+ "resourceInvariantUUID": "18b90934-aa82-456f-938e-e74a07a426f3",
+ "resourceVersion": "2.0",
+ "resoucreType": "VF",
+ "resourceUUID": "89a6b4c5-3973-4c19-b651-fae3713ca8d5",
+ "artifacts": [{
+ "artifactName": "vf-license-model.xml",
+ "artifactType": "VF_LICENSE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vfwvsink0/artifacts/f6fa3f94-f5cd-4233-a7b2-b5e8dc2e1ec6",
+ "artifactDescription": "VF license file",
+ "artifactChecksum": "NDQ2NzIxNzgyMjZhNTc1NDNlMWU0ODI1ZmIyNjc3Zjg=",
+ "artifactUUID": "f6fa3f94-f5cd-4233-a7b2-b5e8dc2e1ec6",
+ "artifactVersion": "1",
+ "artifactLabel": "vflicense",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "vfwvsink0_modules.json",
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vfwvsink0/artifacts/d0aaecf9-6ffb-4b4b-81fd-c59c1e8e6fb6",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactChecksum": "ZGIyOWY3YzE0MTM2MjlhMjY1ZjkzNDg3YjE2ZmQxY2Y=",
+ "artifactUUID": "d0aaecf9-6ffb-4b4b-81fd-c59c1e8e6fb6",
+ "artifactVersion": "1",
+ "artifactLabel": "vfModulesMetadata",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "base_vfw.yaml",
+ "artifactType": "HEAT",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vfwvsink0/artifacts/c94e8eec-b1a7-431c-ab6f-2fda5f0ee920",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": 60,
+ "artifactChecksum": "YTY0MDg5ODUwZDE4YzQyYWI0NjE5Y2NjYmM3ZDg5ZGE=",
+ "artifactUUID": "c94e8eec-b1a7-431c-ab6f-2fda5f0ee920",
+ "artifactVersion": "4",
+ "artifactLabel": "heat1",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "vendor-license-model.xml",
+ "artifactType": "VENDOR_LICENSE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vfwvsink0/artifacts/423d2c66-6c3a-4257-9342-7b57ebf9dd54",
+ "artifactDescription": " Vendor license file",
+ "artifactChecksum": "YTNhYTc3ZGE4ZWViMmYzOThkOGQ3ZTVjZGNmNmU0ZmQ=",
+ "artifactUUID": "423d2c66-6c3a-4257-9342-7b57ebf9dd54",
+ "artifactVersion": "1",
+ "artifactLabel": "vendorlicense",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "base_vfw.env",
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vfwvsink0/artifacts/a1a58cc9-8225-4b6f-b81a-02fa3c7fb6ec",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactChecksum": "ZmVkM2MwODhlZjcwNWY5MDk5ZGEyMjI5ZTAyYWRjNjY=",
+ "artifactUUID": "a1a58cc9-8225-4b6f-b81a-02fa3c7fb6ec",
+ "artifactVersion": "2",
+ "generatedFromUUID": "32591489-33c9-4461-a47c-7c463250788d.heat1",
+ "artifactLabel": "heat1env",
+ "artifactGroupType": "DEPLOYMENT"
+ }
+ ]
+ },
+ {
+ "resourceInstanceName": "vPkG 0",
+ "resourceName": "vPkG",
+ "resourceInvariantUUID": "8d8a20c0-746c-4d5e-a1a2-fa49fa5786ad",
+ "resourceVersion": "2.0",
+ "resoucreType": "VF",
+ "resourceUUID": "31961e27-2a2c-4beb-87c9-bfe0067088f5",
+ "artifacts": [{
+ "artifactName": "vf-license-model.xml",
+ "artifactType": "VF_LICENSE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vpkg0/artifacts/7af6cc3b-2ba3-4164-9d7d-65b3b46a71f4",
+ "artifactDescription": "VF license file",
+ "artifactChecksum": "MWM5NDlmNjdhZTdmZTA5MzIzY2RhYjcxZmFkYzQyZDM=",
+ "artifactUUID": "7af6cc3b-2ba3-4164-9d7d-65b3b46a71f4",
+ "artifactVersion": "1",
+ "artifactLabel": "vflicense",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "vpkg0_modules.json",
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vpkg0/artifacts/37b16173-bd54-447f-a5a2-1a5e24db8afb",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactChecksum": "ZDA3MWQ3MTE3MTA1MzNkY2M1ODQ4YTUxN2YwMDk0MmM=",
+ "artifactUUID": "37b16173-bd54-447f-a5a2-1a5e24db8afb",
+ "artifactVersion": "1",
+ "artifactLabel": "vfModulesMetadata",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "base_vpkg.yaml",
+ "artifactType": "HEAT",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vpkg0/artifacts/43184998-c107-40a7-92f6-00ba74de8539",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": 60,
+ "artifactChecksum": "NDZhY2U0YTExZjllNTFmZjc4ZTE4YzU2Zjk1ZDc2MWI=",
+ "artifactUUID": "43184998-c107-40a7-92f6-00ba74de8539",
+ "artifactVersion": "4",
+ "artifactLabel": "heat1",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "vendor-license-model.xml",
+ "artifactType": "VENDOR_LICENSE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vpkg0/artifacts/6cd5f968-20aa-4b86-9a50-97db5e4ca806",
+ "artifactDescription": " Vendor license file",
+ "artifactChecksum": "YTNhYTc3ZGE4ZWViMmYzOThkOGQ3ZTVjZGNmNmU0ZmQ=",
+ "artifactUUID": "6cd5f968-20aa-4b86-9a50-97db5e4ca806",
+ "artifactVersion": "1",
+ "artifactLabel": "vendorlicense",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "base_vpkg.env",
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/resourceInstances/vpkg0/artifacts/60944038-d382-4aa6-b387-7b87c9c9df19",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactChecksum": "OGU0OGFlZTFiZDdhYmQ0MmM0MjAyY2U5YjljYWViYTA=",
+ "artifactUUID": "60944038-d382-4aa6-b387-7b87c9c9df19",
+ "artifactVersion": "2",
+ "generatedFromUUID": "0d3918df-ea14-4fc3-a5c9-34032eaae573.heat1",
+ "artifactLabel": "heat1env",
+ "artifactGroupType": "DEPLOYMENT"
+ }
+ ]
+ }
+ ],
+ "artifacts": [{
+ "artifactName": "AAI-vFW-service-2VF-based-service-2.0.xml",
+ "artifactType": "MODEL_INVENTORY_PROFILE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/artifacts/2e6cd967-93c2-4f53-82bd-c56ab98e8df7",
+ "artifactDescription": "AAI Service Model",
+ "artifactChecksum": "ZTY5ZTJmYTY4YzE2NGUxMTQxNWNkN2QzMmI4MWIzNDU=",
+ "artifactUUID": "2e6cd967-93c2-4f53-82bd-c56ab98e8df7",
+ "artifactVersion": "1",
+ "artifactLabel": "aaiservice1603481860",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "AAI-Vpkg..base_vpkg..module-0-resource-2.xml",
+ "artifactType": "MODEL_INVENTORY_PROFILE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/artifacts/ad600a09-edde-4356-bb0a-9e638a671d06",
+ "artifactDescription": "AAI Resource Model",
+ "artifactChecksum": "MzQyMjczOGVmYzM1OWQ1NmFhZjBhOWUxM2JjMmYxZTQ=",
+ "artifactUUID": "ad600a09-edde-4356-bb0a-9e638a671d06",
+ "artifactVersion": "1",
+ "artifactLabel": "aairesource529289386",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "AAI-vFW-vSINK-resource-2.0.xml",
+ "artifactType": "MODEL_INVENTORY_PROFILE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/artifacts/413a631e-69c4-453b-ab68-fac09b390259",
+ "artifactDescription": "AAI Resource Model",
+ "artifactChecksum": "ZWRmMzQzYzc0MThlYjQ1YjY2ZTFkYzJmMjAyNzQ1YWU=",
+ "artifactUUID": "413a631e-69c4-453b-ab68-fac09b390259",
+ "artifactVersion": "1",
+ "artifactLabel": "aairesource1461475898",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "AAI-vPkG-resource-2.0.xml",
+ "artifactType": "MODEL_INVENTORY_PROFILE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/artifacts/aee30754-eec4-4820-ae3a-790b80b76e81",
+ "artifactDescription": "AAI Resource Model",
+ "artifactChecksum": "OGQ4ZTdhYjkyZDRkYmFiZTBhNWU4MDc4YTM2YjY1NmI=",
+ "artifactUUID": "aee30754-eec4-4820-ae3a-790b80b76e81",
+ "artifactVersion": "1",
+ "artifactLabel": "aairesource936479495",
+ "artifactGroupType": "DEPLOYMENT"
+ },
+ {
+ "artifactName": "AAI-VfwVsink..base_vfw..module-0-resource-2.xml",
+ "artifactType": "MODEL_INVENTORY_PROFILE",
+ "artifactURL": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/artifacts/ac9a3bbf-a052-4176-abff-fe2d2741194a",
+ "artifactDescription": "AAI Resource Model",
+ "artifactChecksum": "OWIzNjVhNmI2ZWYyZThlMjk1NjA2MDFhZTU3MGQ0ZDU=",
+ "artifactUUID": "ac9a3bbf-a052-4176-abff-fe2d2741194a",
+ "artifactVersion": "1",
+ "artifactLabel": "aairesource1106409880",
+ "artifactGroupType": "DEPLOYMENT"
+ }
+ ]
+ },
+ "headers": {
+ "Content-Type": "application/json"
+ }
+ }
+}