aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorm Traxler <normant@amdocs.com>2019-02-01 16:56:25 +0000
committerNorm Traxler <normant@amdocs.com>2019-02-05 21:35:35 +0000
commit85dda672f8d9a3bed20ca36852fa6e94c378f5b4 (patch)
tree5d6020abcf34a0d045c3cd24cf529fdb94693d60
parent3d61552b11dd676e15421de324cbf91e93178e4f (diff)
Ctx Builder l3-network support3.0.1-ONAP
Issue-ID: SDNC-475 Network Discovery Ctx Builder to support l3-network attribute mapping to common model. Fix jenkins JUnit failures Change-Id: I64ded411a74ffb037df17a047c16e210d41c4992 Signed-off-by: Norm Traxler <normant@amdocs.com>
-rw-r--r--config/jolt/l3-networkSpec.json49
-rw-r--r--config/jolt/sdToModelContextSpec.json24
-rw-r--r--config/jolt/sdToNdResourcesSpec.json22
-rw-r--r--config/jolt/vserverSpec.json61
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java191
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/rs/RestServiceImpl.java30
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/util/TransformationUtil.java50
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/test/jolt/TransformationTest.java123
-rw-r--r--src/test/resources/jolt/networkDiscoveryL3NetworkResponse.json59
-rw-r--r--src/test/resources/jolt/networkDiscoveryL3NetworkToNetwork-expected.json15
-rw-r--r--src/test/resources/jolt/networkDiscoveryVserverResponse.json99
-rw-r--r--src/test/resources/jolt/networkDiscoveryVserverToVm-expected.json38
-rw-r--r--src/test/resources/jolt/serviceDecompResponse2.json263
-rw-r--r--src/test/resources/jolt/serviceDecompToModelContext-expected.json70
-rw-r--r--src/test/resources/jolt/serviceDecompToModelContext2-expected.json149
-rw-r--r--src/test/resources/jolt/serviceDecompToNdResources2-expected.json39
16 files changed, 1104 insertions, 178 deletions
diff --git a/config/jolt/l3-networkSpec.json b/config/jolt/l3-networkSpec.json
new file mode 100644
index 0000000..8924920
--- /dev/null
+++ b/config/jolt/l3-networkSpec.json
@@ -0,0 +1,49 @@
+[
+ // This section converts the json from network discovery micro-service
+ // to org.onap.pomba.audit.common.model.Network
+
+ {
+ "operation": "shift",
+ "spec": {
+ "resources": {
+ "*": {
+ "id": "uuid",
+ "name": "name",
+ "dataQuality": "dataQuality",
+ "attributeList": {
+ "*": {
+ // filter the Network Discovery attributes that we want to keep, to a temporary list:
+ "name": {
+ "sharedNetwork": {
+ "@2": "tempList[]"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ,
+ {
+ // Convert the attribute names to common model names.
+ "operation": "shift",
+ "spec": {
+ "tempList": {
+ "*": {
+ "name" : {
+ "sharedNetwork": {
+ "#sharedNetworkBoolean": "attributeList[#4].name"
+ }
+ },
+ "*" : {
+ "@" : "attributeList[#3].&"
+ }
+ }
+ },
+ "*": {
+ "@" : "&"
+ }
+ }
+ }
+]
diff --git a/config/jolt/sdToModelContextSpec.json b/config/jolt/sdToModelContextSpec.json
index 88201a7..77a71f1 100644
--- a/config/jolt/sdToModelContextSpec.json
+++ b/config/jolt/sdToModelContextSpec.json
@@ -7,8 +7,13 @@
"operation": "shift",
"spec": {
"service-instance-id": "service.uuid",
- "generic-vnfs": {
+ "l3-networks": {
"*": {
+ "network-id": "networkList[&1].uuid"
+ }
+ },
+ "generic-vnfs": {
+ "*": {
"vservers": {
"*": {
"vserver-id": "vnfList[&3].vfModuleList[0].vmList[&1].uuid"
@@ -16,9 +21,20 @@
},
"l3-networks": {
"*": {
- "network-id": "vnfList[&3].vfModuleList[0].networkList[&1].uuid"
+ "network-id": "vnfList[&3].networkList[&1].uuid"
}
},
+ "vf-modules": {
+ "vf-module": {
+ "*": {
+ "l3-networks" : {
+ "*": {
+ "network-id": "vnfList[&6].vfModuleList[0].networkList[&1].uuid"
+ }
+ }
+ }
+ }
+ },
"vnfcs": {
"*": {
"vnfc-id": "vnfList[&3].vnfcList[&1].uuid"
@@ -27,5 +43,5 @@
}
}
}
- }
- ]
+ }
+]
diff --git a/config/jolt/sdToNdResourcesSpec.json b/config/jolt/sdToNdResourcesSpec.json
index c7d7496..bce2d68 100644
--- a/config/jolt/sdToNdResourcesSpec.json
+++ b/config/jolt/sdToNdResourcesSpec.json
@@ -6,6 +6,14 @@
// to org.onap.pomba.contextbuilder.networkdiscovery.model.NdResources
"operation": "shift",
"spec": {
+ "l3-networks": {
+ "*": {
+ "network-id": {
+ "@": "tempResourceId",
+ "#l3-network": "tempResourceType"
+ }
+ }
+ },
"generic-vnfs": {
"*": {
"vservers": {
@@ -16,6 +24,20 @@
}
}},
+ "vf-modules": {
+ "vf-module": {
+ "*": {
+ "l3-networks": {
+ "*": {
+ "network-id": {
+ "@": "tempResourceId",
+ "#l3-network": "tempResourceType"
+ }
+ }
+ }
+ }
+ }
+ },
"l3-networks": {
"*": {
"network-id": {
diff --git a/config/jolt/vserverSpec.json b/config/jolt/vserverSpec.json
new file mode 100644
index 0000000..00659cd
--- /dev/null
+++ b/config/jolt/vserverSpec.json
@@ -0,0 +1,61 @@
+[
+ // This section converts the json from network discovery micro-service
+ // to org.onap.pomba.audit.common.model.VM
+
+ {
+ "operation": "shift",
+ "spec": {
+ "resources": {
+ "*": {
+ "id": "uuid",
+ "name": "name",
+ "dataQuality": "dataQuality",
+ "attributeList": {
+ "*": {
+ // filter the Network Discovery attributes that we want to keep, to a temporary list:
+ "name": {
+ "inMaintenance": {
+ "@2": "tempList[]"
+ },
+ "hostname": {
+ "@2": "tempList[]"
+ },
+ "imageId": {
+ "@2": "tempList[]"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ,
+ {
+ // Convert the attribute names to common model names.
+ "operation": "shift",
+ "spec": {
+ "tempList": {
+ "*": {
+ "name" : {
+ "inMaintenance": {
+ "#lockedBoolean": "attributeList[#4].name"
+ },
+ "hostname": {
+ "#hostName": "attributeList[#4].name"
+ },
+ "imageId": {
+ "#imageId": "attributeList[#4].name"
+ }
+ },
+ "*" : {
+ "@" : "attributeList[#3].&"
+ }
+ }
+ },
+ "*": {
+ "@" : "&"
+ }
+ }
+ }
+]
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java
index 2df082c..774980b 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java
@@ -24,8 +24,11 @@ import com.google.gson.Gson;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
@@ -38,7 +41,6 @@ import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.Response.Status.Family;
import org.onap.aai.restclient.client.Headers;
-import org.onap.pomba.common.datatypes.Attribute;
import org.onap.pomba.common.datatypes.DataQuality;
import org.onap.pomba.common.datatypes.ModelContext;
import org.onap.pomba.common.datatypes.Network;
@@ -50,6 +52,7 @@ import org.onap.pomba.contextbuilder.networkdiscovery.model.NdResource;
import org.onap.pomba.contextbuilder.networkdiscovery.model.NdResources;
import org.onap.pomba.contextbuilder.networkdiscovery.service.rs.RestService;
import org.onap.pomba.contextbuilder.networkdiscovery.util.RestUtil;
+import org.onap.pomba.contextbuilder.networkdiscovery.util.TransformationUtil;
import org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.NetworkDiscoveryNotification;
import org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Resource;
import org.slf4j.Logger;
@@ -59,7 +62,10 @@ import org.springframework.beans.factory.annotation.Autowired;
@org.springframework.stereotype.Service
public class SpringServiceImpl implements SpringService {
+ private static final String ND_TYPE_VSERVER = "vserver";
+ private static final String ND_TYPE_L3_NETWORK = "l3-network";
private static Logger log = LoggerFactory.getLogger(RestService.class);
+
public static final String APP_NAME = "NetworkDiscoveryContextBuilder";
public static final String MDC_REQUEST_ID = "RequestId";
@@ -193,134 +199,59 @@ public class SpringServiceImpl implements SpringService {
return reply;
}
- private void updateNetworkDiscoveryCtx(ModelContext networkDiscoveryCtx, Resource resource) {
- // Future: try to replace this with a Jolt transformation.
- for (VNF vnf : networkDiscoveryCtx.getVnfs()) {
- for (VFModule vfModule : vnf.getVfModules()) {
- for (VM vm : vfModule.getVms()) {
- if (vm.getUuid().equals(resource.getId()) && "vserver".equals(resource.getType())) {
- vm.setDataQuality(resource.getDataQuality());
- if (null != resource.getAttributeList()) {
- for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource
- .getAttributeList()) {
- try {
- String ndattributeName = ndattribute.getName();
- // Some Network Discovery attribute name do not exactly
- // match the pomba-audit-common model Attribute Enums,
- // so we have to do some custom mapping here:
- switch (ndattributeName) {
- case "id":
- vm.setUuid(ndattribute.getValue());
- break;
- case "name":
- vm.setName(ndattribute.getValue());
- break;
- case "inMaintenance":
- Attribute attribute = new Attribute();
- attribute.setName(Attribute.Name.lockedBoolean);
- attribute.setValue(ndattribute.getValue());
- attribute.setDataQuality(ndattribute.getDataQuality());
- vm.addAttribute(attribute);
- break;
- case "hostname":
- attribute = new Attribute();
- attribute.setName(Attribute.Name.hostName);
- attribute.setValue(ndattribute.getValue());
- attribute.setDataQuality(ndattribute.getDataQuality());
- vm.addAttribute(attribute);
- break;
- default:
- attribute = new Attribute();
- attribute.setName(Attribute.Name.valueOf(ndattributeName));
- attribute.setValue(ndattribute.getValue());
- attribute.setDataQuality(ndattribute.getDataQuality());
- vm.addAttribute(attribute);
- }
- } catch (IllegalArgumentException ex) {
- // The attribute Name passed back from Network Discovery is not in our enum
- log.info("Attribute Name: {} for Resource: {} Id: {} is invalid",
- ndattribute.getName(), resource.getName(), resource.getId());
- }
- }
- }
- }
- }
- for (Network network : vfModule.getNetworks()) {
- if (network.getUuid().equals(resource.getId()) && "l3-network".equals(resource.getType())) {
- network.setDataQuality(resource.getDataQuality());
- if (null != resource.getAttributeList()) {
- for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource
- .getAttributeList()) {
- try {
- String ndattributeName = ndattribute.getName();
- // Some Network Discovery attribute name do not exactly
- // match the pomba-audit-common model Attribute Enums,
- // so we have to do some custom mapping here:
- switch (ndattributeName) {
- case "id":
- network.setUuid(ndattribute.getValue());
- break;
- case "name":
- network.setName(ndattribute.getValue());
- break;
- case "AdminState":
- Attribute attribute = new Attribute();
- attribute.setName(Attribute.Name.adminStatus);
- attribute.setValue(ndattribute.getValue());
- attribute.setDataQuality(ndattribute.getDataQuality());
- network.addAttribute(attribute);
- break;
- case "sharedNetwork":
- attribute = new Attribute();
- attribute.setName(Attribute.Name.sharedNetworkBoolean);
- attribute.setValue(ndattribute.getValue());
- attribute.setDataQuality(ndattribute.getDataQuality());
- network.addAttribute(attribute);
- break;
- default:
- attribute = new Attribute();
- attribute.setName(Attribute.Name.valueOf(ndattributeName));
- attribute.setValue(ndattribute.getValue());
- attribute.setDataQuality(ndattribute.getDataQuality());
- network.addAttribute(attribute);
- }
- } catch (IllegalArgumentException ex) {
- // The attribute Name passed back from Network Discovery is not in our enum
- log.info("Attribute Name: {} for Resource: {} Id: {} is invalid",
- ndattribute.getName(), resource.getName(), resource.getId());
- }
- }
- }
- }
- }
+ private void updateNetworkDiscoveryCtx(ModelContext networkDiscoveryCtx, Map<String, String> resourceMap) {
- }
+ for (Network network : networkDiscoveryCtx.getNetworkList()) {
+ updateNetworkInstance(resourceMap, network);
}
- }
- private void updateNetworkDiscoveryCtxDataQuality(ModelContext networkDiscoveryCtx, String resourceId,
- DataQuality dataQuality) {
for (VNF vnf : networkDiscoveryCtx.getVnfs()) {
+ for (Network network : vnf.getNetworks()) {
+ updateNetworkInstance(resourceMap, network);
+ }
+
for (VFModule vfModule : vnf.getVfModules()) {
for (VM vm : vfModule.getVms()) {
- if (vm.getUuid().equals(resourceId)) {
- vm.setDataQuality(dataQuality);
- }
+ updateVmInstance(resourceMap, vm);
}
+
for (Network network : vfModule.getNetworks()) {
- if (network.getUuid().equals(resourceId)) {
- network.setDataQuality(dataQuality);
- }
+ updateNetworkInstance(resourceMap, network);
}
-
}
}
}
+ private void updateVmInstance(Map<String, String> resourceMap, VM vm) {
+ String resources = resourceMap.get(vm.getUuid());
+ String resultJson = TransformationUtil.transform(resources, ND_TYPE_VSERVER);
+
+ // copy the result into the VM class:
+ Gson gson = new Gson();
+ VM ndVm = gson.fromJson(resultJson, VM.class);
+ vm.setName(ndVm.getName());
+ vm.setDataQuality(ndVm.getDataQuality());
+ vm.setAttributes(ndVm.getAttributes());
+ }
+
+ private void updateNetworkInstance(Map<String, String> resourceMap, Network network) {
+ String resources = resourceMap.get(network.getUuid());
+ String resultJson = TransformationUtil.transform(resources, ND_TYPE_L3_NETWORK);
+
+ // copy the results into the Network class:
+ Gson gson = new Gson();
+ Network ndNetwork = gson.fromJson(resultJson, Network.class);
+ network.setName(ndNetwork.getName());
+ network.setDataQuality(ndNetwork.getDataQuality());
+ network.setAttributes(ndNetwork.getAttributes());
+ }
+
/* Return list of requestIds sent to network-discovery microService. */
private void sendNetworkDiscoveryRequest(ModelContext networkDiscoveryCtx, NdResources ndResources,
String parentRequestId, String partnerName) throws DiscoveryException {
-
+
+ Map<String, String> resourceMap = new HashMap<>();
+
for (NdResource ndResource : ndResources.getNdResources()) {
try {
// The old_requestId is inherited from ServiceDecomposition.
@@ -329,23 +260,33 @@ public class SpringServiceImpl implements SpringService {
String requestId = parentRequestId + NETWORK_DISCOVERY_RSP_REQUESTID_SPLITTER
+ uniqueSeq.incrementAndGet();
- NetworkDiscoveryNotification nt = sendNetworkDiscoveryRequestToSpecificServer(partnerName,
+ String resultJson = sendNetworkDiscoveryRequestToSpecificServer(partnerName,
parentRequestId, requestId, ndResource.getResourceId(), ndResource.getResourceType());
- List<Resource> resourceList = nt.getResources();
- for (Resource resource1 : resourceList) {
- updateNetworkDiscoveryCtx(networkDiscoveryCtx, resource1);
- }
+ resourceMap.put(ndResource.getResourceId(), resultJson);
} catch (Exception e) {
- log.error("Error from Network Disovery Request - resourceId: {}, message: {}",
+ log.error("Error from Network Discovery Request - resourceId: {}, message: {}",
ndResource.getResourceId(), e.getMessage());
- DataQuality dataQuality = DataQuality.error("Error from Network Disovery Request: " + e.getMessage());
- updateNetworkDiscoveryCtxDataQuality(networkDiscoveryCtx, ndResource.getResourceId(), dataQuality);
+
+ // Build a fake Network Discovery error result, so it will be returned to the client:
+ Resource errorResource = new Resource();
+ errorResource.setId(ndResource.getResourceId());
+ DataQuality dataQuality = DataQuality.error(e.getMessage());
+ errorResource.setDataQuality(dataQuality);
+ List<Resource> resourceList = new ArrayList<>();
+ resourceList.add(errorResource);
+ NetworkDiscoveryNotification ndErrorResult = new NetworkDiscoveryNotification();
+ ndErrorResult.setResources(resourceList);
+ ndErrorResult.setCode(404);
+ Gson gson = new Gson();
+ String ndErrorResultToJson = gson.toJson(ndErrorResult);
+ resourceMap.put(ndResource.getResourceId(), ndErrorResultToJson);
}
}
+ updateNetworkDiscoveryCtx(networkDiscoveryCtx, resourceMap);
}
- private NetworkDiscoveryNotification sendNetworkDiscoveryRequestToSpecificServer(String partnerName,
+ private String sendNetworkDiscoveryRequestToSpecificServer(String partnerName,
String parentRequestId, String requestId, String resourceId, String resourceType)
throws DiscoveryException {
@@ -378,9 +319,9 @@ public class SpringServiceImpl implements SpringService {
Response.Status.fromStatusCode(response.getStatus()));
}
- NetworkDiscoveryNotification ndResponse = response.readEntity(NetworkDiscoveryNotification.class);
- log.info("Message sent. Response Payload: {}", ndResponse);
- return ndResponse;
+ String ndResult = response.readEntity(String.class);
+ log.info("Message sent. Response ndResult: {}", ndResult);
+ return ndResult;
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/rs/RestServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/rs/RestServiceImpl.java
index 67899ac..3a1b974 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/rs/RestServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/rs/RestServiceImpl.java
@@ -18,6 +18,8 @@
package org.onap.pomba.contextbuilder.networkdiscovery.service.rs;
+import com.google.gson.ExclusionStrategy;
+import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -28,6 +30,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.VFModule;
import org.onap.pomba.contextbuilder.networkdiscovery.exception.DiscoveryException;
import org.onap.pomba.contextbuilder.networkdiscovery.exception.ErrorMessage;
import org.onap.pomba.contextbuilder.networkdiscovery.service.SpringService;
@@ -46,6 +49,27 @@ public class RestServiceImpl implements RestService {
@Autowired
private SpringService service;
+ /**
+ * Certain attributes in the common model do not apply (are not available) from network discovery.
+ * This exclusion strategy will make sure that any defaulted attributes that are not available/not valid are
+ * excluded from the json response.
+ *
+ * For now, there a two known attributes that need to be excluded from the VFModule:
+ * - minInstances (because it's an integer that defaults to zero)
+ * - maxInstances (because it's an integer that defaults to zero)
+ */
+ public class ContextBuilderExclusionStrategy implements ExclusionStrategy {
+
+ public boolean shouldSkipClass(Class<?> arg0) {
+ return false;
+ }
+
+ public boolean shouldSkipField(FieldAttributes f) {
+ return (f.getDeclaringClass() == VFModule.class && f.getName().equals("minInstances"))
+ || (f.getDeclaringClass() == VFModule.class && f.getName().equals("maxInstances"));
+ }
+ }
+
@Override
public Response getContext(HttpServletRequest req, String authorization, String partnerName, String requestId,
String fromAppId, String transactionId, String serviceInstanceId, String modelVersionId,
@@ -79,7 +103,9 @@ public class RestServiceImpl implements RestService {
// Return empty JSON
return Response.ok().entity(EMPTY_JSON_OBJECT).build();
} else {
- Gson gson = new GsonBuilder().create();
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ gsonBuilder.setExclusionStrategies(new ContextBuilderExclusionStrategy());
+ Gson gson = gsonBuilder.create();
return Response.ok().entity(gson.toJson(sdContext)).build();
}
} catch (DiscoveryException x) {
@@ -89,7 +115,7 @@ public class RestServiceImpl implements RestService {
} catch (Exception x) {
log.error(ErrorMessage.CONTEXT_BUILDER_FAILED, x);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(x.getMessage()).build();
-
+
} finally {
MDC.clear();
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/util/TransformationUtil.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/util/TransformationUtil.java
new file mode 100644
index 0000000..7e7af3e
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/util/TransformationUtil.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2014 Bazaarvoice, Inc.
+ *
+ * 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.
+ */
+package org.onap.pomba.contextbuilder.networkdiscovery.util;
+
+import com.bazaarvoice.jolt.Chainr;
+import com.bazaarvoice.jolt.JsonUtils;
+
+import java.io.File;
+import java.util.List;
+
+public class TransformationUtil {
+
+ private static final String CONFIG_JOLT = "config/jolt";
+
+ private TransformationUtil() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ /**
+ * Transforms the sourceJson using the jolt specification for the given resourceType.
+ *
+ * @param sourceJson
+ * @param resourceType
+ * @return
+ */
+ public static String transform(String sourceJson, String resourceType) {
+
+ Object sourceObject = JsonUtils.jsonToObject(sourceJson);
+
+ List<Object> chainrSpecJSON = JsonUtils.filepathToList(CONFIG_JOLT + File.separator + resourceType + "Spec.json");
+ Chainr chainr = Chainr.fromSpec(chainrSpecJSON);
+ Object output = chainr.transform(sourceObject);
+
+ return JsonUtils.toJsonString(output);
+ }
+
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/test/jolt/TransformationTest.java b/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/test/jolt/TransformationTest.java
index 29a4a6f..29173fb 100644
--- a/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/test/jolt/TransformationTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/networkdiscovery/test/jolt/TransformationTest.java
@@ -29,7 +29,10 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.Network;
+import org.onap.pomba.common.datatypes.VM;
import org.onap.pomba.contextbuilder.networkdiscovery.model.NdResources;
+import org.onap.pomba.contextbuilder.networkdiscovery.util.TransformationUtil;
public class TransformationTest {
@@ -39,29 +42,24 @@ public class TransformationTest {
@Rule
public ExpectedException expectedEx = ExpectedException.none();
-
@Test
public void testTransformNdResources() {
Object sourceObject = JsonUtils.filepathToObject(TEST_RESOURCES + "/serviceDecompResponse.json");
Object sourceObject1 = JsonUtils.jsonToObject(JsonUtils.toJsonString(sourceObject));
-
+
List<Object> chainrSpecJson = JsonUtils.filepathToList(CONFIG_JOLT_DIRECTORY + "sdToNdResourcesSpec.json");
Chainr chainr = Chainr.fromSpec(chainrSpecJson);
Object output = chainr.transform(sourceObject1);
String resultJson = JsonUtils.toJsonString(output);
-
- System.err.println(resultJson);
-
+
// read the result into the NqQuery class:
Gson gson = new Gson();
NdResources ndQuery = gson.fromJson(resultJson, NdResources.class);
-
+
// convert ndQuery back to json:
String ndQueryToJson = gson.toJson(ndQuery);
-
-
// Compare with expected output:
Object expectedObject = JsonUtils.filepathToObject(TEST_RESOURCES + "serviceDecompToNdResources-expected.json");
@@ -69,7 +67,34 @@ public class TransformationTest {
Assert.assertEquals("Json transformation result does not match expected content",
JsonUtils.toPrettyJsonString(expectedObject),
JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(ndQueryToJson)));
+ }
+
+ @Test
+ public void testTransformNdResourcesL3Network() {
+
+ Object sourceObject = JsonUtils.filepathToObject(TEST_RESOURCES + "/serviceDecompResponse2.json");
+ Object sourceObject1 = JsonUtils.jsonToObject(JsonUtils.toJsonString(sourceObject));
+
+ List<Object> chainrSpecJson = JsonUtils.filepathToList(CONFIG_JOLT_DIRECTORY + "sdToNdResourcesSpec.json");
+ Chainr chainr = Chainr.fromSpec(chainrSpecJson);
+ Object output = chainr.transform(sourceObject1);
+
+ String resultJson = JsonUtils.toJsonString(output);
+
+ // read the result into the NqQuery class:
+ Gson gson = new Gson();
+ NdResources ndQuery = gson.fromJson(resultJson, NdResources.class);
+
+ // convert ndQuery back to json:
+ String ndQueryToJson = gson.toJson(ndQuery);
+ // Compare with expected output:
+ Object expectedObject = JsonUtils
+ .filepathToObject(TEST_RESOURCES + "serviceDecompToNdResources2-expected.json");
+
+ Assert.assertEquals("Json transformation result does not match expected content",
+ JsonUtils.toPrettyJsonString(expectedObject),
+ JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(ndQueryToJson)));
}
@Test
@@ -77,27 +102,103 @@ public class TransformationTest {
Object sourceObject = JsonUtils.filepathToObject(TEST_RESOURCES + "serviceDecompResponse.json");
Object sourceObject1 = JsonUtils.jsonToObject(JsonUtils.toJsonString(sourceObject));
-
+
List<Object> chainrSpecJson = JsonUtils.filepathToList(CONFIG_JOLT_DIRECTORY + "sdToModelContextSpec.json");
Chainr chainr = Chainr.fromSpec(chainrSpecJson);
Object output = chainr.transform(sourceObject1);
String resultJson = JsonUtils.toJsonString(output);
-
+
// read the result into the NqQuery class:
Gson gson = new Gson();
ModelContext ndQuery = gson.fromJson(resultJson, ModelContext.class);
+
+ // convert ndQuery back to json:
+ String ndQueryToJson = gson.toJson(ndQuery);
+
+ // Compare with expected output:
+ Object expectedObject = JsonUtils
+ .filepathToObject(TEST_RESOURCES + "serviceDecompToModelContext-expected.json");
+
+ Assert.assertEquals("Json transformation result does not match expected content",
+ JsonUtils.toPrettyJsonString(expectedObject),
+ JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(ndQueryToJson)));
+ }
+
+ @Test
+ public void testTransformModelContextL3Network() {
+
+ Object sourceObject = JsonUtils.filepathToObject(TEST_RESOURCES + "serviceDecompResponse2.json");
+ Object sourceObject1 = JsonUtils.jsonToObject(JsonUtils.toJsonString(sourceObject));
+
+ List<Object> chainrSpecJson = JsonUtils.filepathToList(CONFIG_JOLT_DIRECTORY + "sdToModelContextSpec.json");
+ Chainr chainr = Chainr.fromSpec(chainrSpecJson);
+ Object output = chainr.transform(sourceObject1);
+
+ String resultJson = JsonUtils.toJsonString(output);
+ System.err.println(resultJson);
+
+ // read the result into the NqQuery class:
+ Gson gson = new Gson();
+ ModelContext ndQuery = gson.fromJson(resultJson, ModelContext.class);
+
// convert ndQuery back to json:
String ndQueryToJson = gson.toJson(ndQuery);
// Compare with expected output:
- Object expectedObject = JsonUtils.filepathToObject(TEST_RESOURCES + "serviceDecompToModelContext-expected.json");
+ Object expectedObject = JsonUtils
+ .filepathToObject(TEST_RESOURCES + "serviceDecompToModelContext2-expected.json");
+
+ Assert.assertEquals("Json transformation result does not match expected content",
+ JsonUtils.toPrettyJsonString(expectedObject),
+ JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(ndQueryToJson)));
+ }
+
+ @Test
+ public void testTransformVserverToVm() {
+
+ Object sourceObject = JsonUtils.filepathToObject(TEST_RESOURCES + "networkDiscoveryVserverResponse.json");
+
+ String resultJson = TransformationUtil.transform(JsonUtils.toJsonString(sourceObject), "vserver");
+
+ // read the result into the VM class:
+ Gson gson = new Gson();
+ VM ndVm = gson.fromJson(resultJson, VM.class);
+
+ // convert VM object back to json:
+ String ndQueryToJson = gson.toJson(ndVm);
+
+ // Compare with expected output:
+ Object expectedObject = JsonUtils
+ .filepathToObject(TEST_RESOURCES + "networkDiscoveryVserverToVm-expected.json");
Assert.assertEquals("Json transformation result does not match expected content",
JsonUtils.toPrettyJsonString(expectedObject),
JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(ndQueryToJson)));
+ }
+
+ @Test
+ public void testTransformL3NetworkToNetworkModel() {
+
+ Object sourceObject = JsonUtils.filepathToObject(TEST_RESOURCES + "networkDiscoveryL3NetworkResponse.json");
+
+ String resultJson = TransformationUtil.transform(JsonUtils.toJsonString(sourceObject), "l3-network");
+
+ // read the result into the VM class:
+ Gson gson = new Gson();
+ Network ndNetwork = gson.fromJson(resultJson, Network.class);
+
+ // convert VM object back to json:
+ String ndQueryToJson = gson.toJson(ndNetwork);
+ // Compare with expected output:
+ Object expectedObject = JsonUtils
+ .filepathToObject(TEST_RESOURCES + "networkDiscoveryL3NetworkToNetwork-expected.json");
+
+ Assert.assertEquals("Json transformation result does not match expected content",
+ JsonUtils.toPrettyJsonString(expectedObject),
+ JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(ndQueryToJson)));
}
}
diff --git a/src/test/resources/jolt/networkDiscoveryL3NetworkResponse.json b/src/test/resources/jolt/networkDiscoveryL3NetworkResponse.json
new file mode 100644
index 0000000..3ecf22a
--- /dev/null
+++ b/src/test/resources/jolt/networkDiscoveryL3NetworkResponse.json
@@ -0,0 +1,59 @@
+{
+ "requestId": "88001",
+ "code": 200,
+ "message": "OK",
+ "ackFinalIndicator": true,
+ "resources": [
+ {
+ "id": "01e8d84a-17a6-47b5-a167-6a45d1d56603",
+ "name": "NET_1106",
+ "type": "l3-network",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ },
+ "attributeList": [
+ {
+ "name": "adminState",
+ "value": "true",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "sharedNetwork",
+ "value": "true",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "status",
+ "value": "ACTIVE",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "subnets",
+ "value": "089c9160-6f7a-4ae0-83b7-33536b4c6672",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "tenantId",
+ "value": "cbd5e07f58d84ea6b795aa9f5f207df0",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/jolt/networkDiscoveryL3NetworkToNetwork-expected.json b/src/test/resources/jolt/networkDiscoveryL3NetworkToNetwork-expected.json
new file mode 100644
index 0000000..def92bd
--- /dev/null
+++ b/src/test/resources/jolt/networkDiscoveryL3NetworkToNetwork-expected.json
@@ -0,0 +1,15 @@
+{
+ "uuid" : "01e8d84a-17a6-47b5-a167-6a45d1d56603",
+ "name" : "NET_1106",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ {
+ "name" : "sharedNetworkBoolean",
+ "value" : "true",
+ "dataQuality" : {
+ "status" : "ok"
+ }
+ } ],
+ "networkPolicyList" : [ ]
+} \ No newline at end of file
diff --git a/src/test/resources/jolt/networkDiscoveryVserverResponse.json b/src/test/resources/jolt/networkDiscoveryVserverResponse.json
new file mode 100644
index 0000000..e555d4c
--- /dev/null
+++ b/src/test/resources/jolt/networkDiscoveryVserverResponse.json
@@ -0,0 +1,99 @@
+{
+ "requestId": "5d115268-564b-4db6-9d59-aa28cbd2d022___4",
+ "code": 200,
+ "message": "OK",
+ "ackFinalIndicator": true,
+ "resources": [
+ {
+ "id": "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9",
+ "name": "norm-rancher",
+ "type": "vserver",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ },
+ "attributeList": [
+ {
+ "name": "inMaintenance",
+ "value": "false",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "hostname",
+ "value": "norm-rancher",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "imageId",
+ "value": "87e000f6-9a81-4841-b446-5d6751c42c48",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "status",
+ "value": "ACTIVE",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "vmState",
+ "value": "active",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "userId",
+ "value": "0aae369d1c874bb7827f61ca4f11edae",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "tenantId",
+ "value": "1130b349e19c4827bf91a29d51256af1",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "hostId",
+ "value": "a4b1deed35881a129eabaaf9abef99b83706567bf026d8d7120a8ff3",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "host",
+ "value": "Setup-D2-OTT-A-C1",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ },
+ {
+ "name": "hostStatus",
+ "value": "UP",
+ "dataQuality": {
+ "status": "ok",
+ "errorText": null
+ }
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/jolt/networkDiscoveryVserverToVm-expected.json b/src/test/resources/jolt/networkDiscoveryVserverToVm-expected.json
new file mode 100644
index 0000000..41ebe3f
--- /dev/null
+++ b/src/test/resources/jolt/networkDiscoveryVserverToVm-expected.json
@@ -0,0 +1,38 @@
+{
+ "uuid": "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9",
+ "name": "norm-rancher",
+ "dataQuality": {
+ "status": "ok"
+ },
+ "attributeList": [
+ {
+ "name": "lockedBoolean",
+ "value": "false",
+ "dataQuality": {
+ "status": "ok"
+ }
+ },
+ {
+ "name": "hostName",
+ "value": "norm-rancher",
+ "dataQuality": {
+ "status": "ok"
+ }
+ },
+ {
+ "name": "imageId",
+ "value": "87e000f6-9a81-4841-b446-5d6751c42c48",
+ "dataQuality": {
+ "status": "ok"
+ }
+ }
+ ],
+ "pServer": {
+ "dataQuality": {
+ "status": "ok"
+ },
+ "attributeList": [],
+ "pInterfaceList": []
+ },
+ "lInterfaceList": []
+} \ No newline at end of file
diff --git a/src/test/resources/jolt/serviceDecompResponse2.json b/src/test/resources/jolt/serviceDecompResponse2.json
new file mode 100644
index 0000000..2d43499
--- /dev/null
+++ b/src/test/resources/jolt/serviceDecompResponse2.json
@@ -0,0 +1,263 @@
+{
+ "service-instance-id": "PombaDemoCust_002-ServiceInst-002",
+ "service-instance-name": "PombaDemoCust_002-ServiceInst-002-name",
+ "model-invariant-id": "pomba-demo-sdc-model-002",
+ "model-version-id": "pomba-demo-sdc-model-002-version002",
+ "resource-version": "1548702838544",
+ "generic-vnfs": [
+ {
+ "nf-role": "nf-role1",
+ "service-id": "8ea56b0d-459d-4668-b363-c9567432d8b7",
+ "vnf-id": "PombaDemoCust_002-VNF-id-002",
+ "nf-type": "nf-type1",
+ "l3-networks": [
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf1-001",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484061985",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1105",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ },
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf1-002",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484429696",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1106",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ }
+ ],
+ "prov-status": "PREPROV",
+ "vnf-type": "vFW-vSINK-service/vFWvSINK 0",
+ "orchestration-status": "Created",
+ "nf-naming-code": "nf-naming-code1",
+ "in-maint": false,
+ "nf-function": "nf-function1",
+ "model-version-id": "pomba-demo-sdc-model-002-version002",
+ "vservers": [
+ {
+ "in-maint": false,
+ "resource-version": "1548702799178",
+ "vserver-name": "Firewall-002",
+ "prov-status": "ACTIVE",
+ "vserver-id": "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9",
+ "vserver-name2": "Firewall-002",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/a6a609e3-967a-48bd-8ce5-41c7ff5c19b9/servers/a6a609e3-967a-48bd-8ce5-41c7ff5c19b9",
+ "is-closed-loop-disabled": false
+ }
+ ],
+ "resource-version": "1548702975892",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "model-invariant-id": "pomba-demo-sdc-model-002",
+ "vnf-name": "Firewall-1",
+ "is-closed-loop-disabled": false,
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-name": "PombaDemoCust_002-VNF-id-002-VfModule002-name",
+ "l3-networks": [
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf1-vfmodule1-001",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484061985",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1105",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ },
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf1-vfmodule1-002",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484429696",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1106",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ }
+ ],
+ "module-index": 0,
+ "orchestration-status": "Active",
+ "automated-assignment": true,
+ "model-version-id": "pomba-demo-sdc-model-002-version002",
+ "heat-stack-id": "HeatStackId-002",
+ "resource-version": "1548707876095",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "is-base-vf-module": true,
+ "vf-module-id": "PombaDemoCust_002-VNF-id-002-VfModule002",
+ "model-invariant-id": "pomba-demo-sdc-model-002"
+ }
+ ]
+ }
+ },
+ {
+ "nf-role": "",
+ "service-id": "8ea56b0d-459d-4668-b363-c9567432d8b7",
+ "vnf-id": "PombaDemoCust_002-VNF-id-002-2",
+ "nf-type": "",
+ "l3-networks": [
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf2-001",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484061985",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1105",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ },
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf2-002",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484429696",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1106",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ }
+ ],
+ "prov-status": "PREPROV",
+ "vnf-type": "vFW-vSINK-service/vFWvSINK 0",
+ "orchestration-status": "Created",
+ "nf-naming-code": "",
+ "in-maint": false,
+ "nf-function": "",
+ "model-version-id": "pomba-demo-sdc-model-002-version002",
+ "vservers": [
+ {
+ "in-maint": true,
+ "resource-version": "1548702805873",
+ "vserver-name": "Firewall-002-2",
+ "prov-status": "UNKNOWN",
+ "vserver-id": "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9-2",
+ "vserver-name2": "Firewall-002-2",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/a6a609e3-967a-48bd-8ce5-41c7ff5c19b9/servers/a6a609e3-967a-48bd-8ce5-41c7ff5c19b9-2",
+ "is-closed-loop-disabled": false
+ }
+ ],
+ "resource-version": "1548708278469",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-name": "PombaDemoCust_002-VNF-id-002-VfModule002-name",
+ "model-version-id": "pomba-demo-sdc-model-002-version002",
+ "heat-stack-id": "HeatStackId-002",
+ "resource-version": "1548708278830",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "is-base-vf-module": true,
+ "vf-module-id": "PombaDemoCust_002-VNF-id-002-VfModule002",
+ "module-index": 0,
+ "model-invariant-id": "pomba-demo-sdc-model-002",
+ "orchestration-status": "Active",
+ "automated-assignment": true,
+ "l3-networks": [
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf2-vfmodule1-001",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484061985",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1105",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ },
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-vnf2-vfmodule1-002",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484429696",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1106",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ }
+ ]
+ }
+ ]
+ },
+ "model-invariant-id": "pomba-demo-sdc-model-002",
+ "vnf-name": "Firewall-2",
+ "is-closed-loop-disabled": false
+ }
+ ],
+ "l3-networks": [
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-service-001",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484061985",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1105",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ },
+ {
+ "network-role": "",
+ "network-technology": "",
+ "network-id": "network-id-service-002",
+ "is-external-network": false,
+ "is-bound-to-vpn": false,
+ "is-provider-network": false,
+ "network-type": "",
+ "model-version-id": "pomba-demo-sdc-model-001-version001",
+ "resource-version": "1547484429696",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "network-name": "NET_1106",
+ "is-shared-network": true,
+ "model-invariant-id": "pomba-demo-sdc-model-001"
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/jolt/serviceDecompToModelContext-expected.json b/src/test/resources/jolt/serviceDecompToModelContext-expected.json
index 31f1318..ea15bf4 100644
--- a/src/test/resources/jolt/serviceDecompToModelContext-expected.json
+++ b/src/test/resources/jolt/serviceDecompToModelContext-expected.json
@@ -33,29 +33,28 @@
"status" : "ok"
},
"attributeList" : [ ],
- "pInterfaceList" : [ ],
- "logicalLinkList" : [ ]
+ "pInterfaceList" : [ ]
},
"lInterfaceList" : [ ]
} ],
- "networkList" : [ {
- "uuid" : "2ea02809-7279-4b5e-931a-62b231615497",
- "dataQuality" : {
- "status" : "ok"
- },
- "attributeList" : [ ],
- "networkPolicyList" : [ ]
- }, {
- "uuid" : "01e8d84a-17a6-47b5-a167-6a45d1d56603",
- "dataQuality" : {
- "status" : "ok"
- },
- "attributeList" : [ ],
- "networkPolicyList" : [ ]
- } ]
+ "networkList" : [ ]
} ],
"vnfcList" : [ ],
- "networkList" : [ ]
+ "networkList" : [ {
+ "uuid" : "2ea02809-7279-4b5e-931a-62b231615497",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ }, {
+ "uuid" : "01e8d84a-17a6-47b5-a167-6a45d1d56603",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ } ]
}, {
"dataQuality" : {
"status" : "ok"
@@ -79,29 +78,28 @@
"status" : "ok"
},
"attributeList" : [ ],
- "pInterfaceList" : [ ],
- "logicalLinkList" : [ ]
+ "pInterfaceList" : [ ]
},
"lInterfaceList" : [ ]
} ],
- "networkList" : [ {
- "uuid" : "2ea02809-7279-4b5e-931a-62b231615497-1",
- "dataQuality" : {
- "status" : "ok"
- },
- "attributeList" : [ ],
- "networkPolicyList" : [ ]
- }, {
- "uuid" : "01e8d84a-17a6-47b5-a167-6a45d1d56603-1",
- "dataQuality" : {
- "status" : "ok"
- },
- "attributeList" : [ ],
- "networkPolicyList" : [ ]
- } ]
+ "networkList" : [ ]
} ],
"vnfcList" : [ ],
- "networkList" : [ ]
+ "networkList" : [ {
+ "uuid" : "2ea02809-7279-4b5e-931a-62b231615497-1",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ }, {
+ "uuid" : "01e8d84a-17a6-47b5-a167-6a45d1d56603-1",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ } ]
} ],
"pnfList" : [ ],
"networkList" : [ ]
diff --git a/src/test/resources/jolt/serviceDecompToModelContext2-expected.json b/src/test/resources/jolt/serviceDecompToModelContext2-expected.json
new file mode 100644
index 0000000..bf8589d
--- /dev/null
+++ b/src/test/resources/jolt/serviceDecompToModelContext2-expected.json
@@ -0,0 +1,149 @@
+{
+ "service" : {
+ "uuid" : "PombaDemoCust_002-ServiceInst-002",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ]
+ },
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "vnfList" : [ {
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "vfModuleList" : [ {
+ "maxInstances" : 0,
+ "minInstances" : 0,
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "vmList" : [ {
+ "uuid" : "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "pServer" : {
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "pInterfaceList" : [ ]
+ },
+ "lInterfaceList" : [ ]
+ } ],
+ "networkList" : [ {
+ "uuid" : "network-id-vnf1-vfmodule1-001",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ }, {
+ "uuid" : "network-id-vnf1-vfmodule1-002",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ } ]
+ } ],
+ "vnfcList" : [ ],
+ "networkList" : [ {
+ "uuid" : "network-id-vnf1-001",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ }, {
+ "uuid" : "network-id-vnf1-002",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ } ]
+ }, {
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "vfModuleList" : [ {
+ "maxInstances" : 0,
+ "minInstances" : 0,
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "vmList" : [ {
+ "uuid" : "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9-2",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "pServer" : {
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "pInterfaceList" : [ ]
+ },
+ "lInterfaceList" : [ ]
+ } ],
+ "networkList" : [ {
+ "uuid" : "network-id-vnf2-vfmodule1-001",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ }, {
+ "uuid" : "network-id-vnf2-vfmodule1-002",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ } ]
+ }],
+ "vnfcList" : [ ],
+ "networkList" : [ {
+ "uuid" : "network-id-vnf2-001",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ }, {
+ "uuid" : "network-id-vnf2-002",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ } ]
+ } ],
+ "pnfList" : [ ],
+ "networkList" : [ {
+ "uuid" : "network-id-service-001",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ }, {
+ "uuid" : "network-id-service-002",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ ],
+ "networkPolicyList" : [ ]
+ } ]
+
+} \ No newline at end of file
diff --git a/src/test/resources/jolt/serviceDecompToNdResources2-expected.json b/src/test/resources/jolt/serviceDecompToNdResources2-expected.json
new file mode 100644
index 0000000..173a357
--- /dev/null
+++ b/src/test/resources/jolt/serviceDecompToNdResources2-expected.json
@@ -0,0 +1,39 @@
+{
+ "ndResources" : [ {
+ "resourceId" : "network-id-service-001",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "network-id-service-002",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9",
+ "resourceType" : "vserver"
+ }, {
+ "resourceId" : "network-id-vnf1-vfmodule1-001",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "network-id-vnf1-vfmodule1-002",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "network-id-vnf1-001",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "network-id-vnf1-002",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "a6a609e3-967a-48bd-8ce5-41c7ff5c19b9-2",
+ "resourceType" : "vserver"
+ }, {
+ "resourceId" : "network-id-vnf2-vfmodule1-001",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "network-id-vnf2-vfmodule1-002",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "network-id-vnf2-001",
+ "resourceType" : "l3-network"
+ }, {
+ "resourceId" : "network-id-vnf2-002",
+ "resourceType" : "l3-network"
+ } ]
+} \ No newline at end of file