summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2019-01-21 17:21:35 -0500
committerTait,Trevor(rt0435) <rtait@amdocs.com>2019-01-21 17:21:49 -0500
commit5b6272525b9cd876191104d4c1e64a91cace1c74 (patch)
tree1a8b80b3d31c41832583a4d5e94b82cbb5723e48
parenta37aaa36a18516f296908638f9f4399e7d487d92 (diff)
SDNC Context Builder: network
Issue-ID: LOG-768 Change-Id: I2835f7122cc7e59e2e31bd4180f923675618b455 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
-rw-r--r--config/sdncgenericresource.spec80
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java102
-rw-r--r--src/test/resources/junit/sdncGenericResponse.json62
3 files changed, 172 insertions, 72 deletions
diff --git a/config/sdncgenericresource.spec b/config/sdncgenericresource.spec
index c8a8ffc..7a1ffc1 100644
--- a/config/sdncgenericresource.spec
+++ b/config/sdncgenericresource.spec
@@ -25,12 +25,22 @@
"vnf-data": {
"vnf-topology": {
"onap-model-information": {
- "model-uuid": "vfList[&4].uuid",
- "model-invariant-uuid": "vfList[&4].invariantUUID"
+ "model-uuid": "vnfList[&4].uuid",
+ "model-invariant-uuid": "vnfList[&4].invariantUUID"
},
"vnf-topology-identifier-structure": {
- "vnf-type": "vfList[&4].type",
- "vnf-name": "vfList[&4].name"
+ "vnf-type": "vnfList[&4].type",
+ "vnf-name": "vnfList[&4].name"
+ },
+ "vnf-resource-assignments": {
+ "vnf-networks": {
+ "*": {
+ "network-name": "vnfList[&6].networkList[&1].name",
+ "network-id": "vnfList[&6].networkList[&1].uuid",
+ "#networkRole": "vnfList[&6].networkList[&1].attributeList[0].name",
+ "network-role": "vnfList[&6].networkList[&1].attributeList[0].value"
+ }
+ }
}
},
"vf-modules": {
@@ -39,11 +49,11 @@
"vf-module-data": {
"vf-module-topology": {
"vf-module-topology-identifier": {
- "vf-module-name": "vfList[&8].vfModuleList[&4].name"
+ "vf-module-name": "vnfList[&8].vfModuleList[&4].name"
},
"onap-model-information": {
- "model-uuid": "vfList[&8].vfModuleList[&4].uuid",
- "model-invariant-uuid": "vfList[&8].vfModuleList[&4].invariantUUID"
+ "model-uuid": "vnfList[&8].vfModuleList[&4].uuid",
+ "model-invariant-uuid": "vnfList[&8].vfModuleList[&4].invariantUUID"
},
"vf-module-assignments": {
"vms": {
@@ -52,33 +62,41 @@
"vm-names": {
"vm-name": {
"*": {
- "@": "vfList[&14].vfModuleList[&10].vmList[&1].name",
- "@(3,vm-type)": "vfList[&14].vfModuleList[&10].vmList[&1].nfNamingCode",
+ "@": "vnfList[&14].vfModuleList[&10].vmList[&1].name",
+ "@(3,vm-type)": "vnfList[&14].vfModuleList[&10].vmList[&1].nfNamingCode",
"@(3,inMaint)": {
- "#lockedBoolean": "vfList[&15].vfModuleList[&11].vmList[&2].attributeList[0].name",
+ "#lockedBoolean": "vnfList[&15].vfModuleList[&11].vmList[&2].attributeList[0].name",
"yes": {
- "#true": "vfList[&16].vfModuleList[&12].vmList[&3].attributeList[0].value"
+ "#true": "vnfList[&16].vfModuleList[&12].vmList[&3].attributeList[0].value"
},
"no": {
- "#false": "vfList[&16].vfModuleList[&12].vmList[&3].attributeList[0].value"
+ "#false": "vnfList[&16].vfModuleList[&12].vmList[&3].attributeList[0].value"
}
},
"@(3,prov-status)": {
- "#provStatus": "vfList[&15].vfModuleList[&11].vmList[&2].attributeList[1].name",
- "@(4,prov-status)": "vfList[&15].vfModuleList[&11].vmList[&2].attributeList[1].value"
+ "#provStatus": "vnfList[&15].vfModuleList[&11].vmList[&2].attributeList[1].name",
+ "@(4,prov-status)": "vnfList[&15].vfModuleList[&11].vmList[&2].attributeList[1].value"
},
"@(3,pserver)": {
- "#hostName": "vfList[&15].vfModuleList[&11].vmList[&2].attributeList[2].name",
- "hostname": "vfList[&15].vfModuleList[&11].vmList[&2].attributeList[2].value"
+ "#hostName": "vnfList[&15].vfModuleList[&11].vmList[&2].attributeList[2].name",
+ "hostname": "vnfList[&15].vfModuleList[&11].vmList[&2].attributeList[2].value"
},
"@(3,image)": {
- "#imageId": "vfList[&15].vfModuleList[&11].vmList[&2].attributeList[3].name",
- "image-name": "vfList[&15].vfModuleList[&11].vmList[&2].attributeList[3].value"
+ "#imageId": "vnfList[&15].vfModuleList[&11].vmList[&2].attributeList[3].name",
+ "image-name": "vnfList[&15].vfModuleList[&11].vmList[&2].attributeList[3].value"
}
}
}
}
}
+ },
+ "vm-networks": {
+ "*": {
+ "network-id": "vnfList[&11].vfModuleList[&7].networkList[&1].uuid",
+ "network-name": "vnfList[&11].vfModuleList[&7].networkList[&1].name",
+ "#networkRole": "vnfList[&11].vfModuleList[&7].networkList[&1].attributeList[0].name",
+ "network-role": "vnfList[&11].vfModuleList[&7].networkList[&1].attributeList[0].value"
+ }
}
}
}
@@ -96,22 +114,18 @@
"*": {
"network-data": {
"network-topology": {
- "onap-model-information": {
- "model-uuid": "vfList[0].vfModuleList[0].networkList[&4].uuid",
- "model-invariant-uuid": "vfList[0].vfModuleList[0].networkList[&4].invariantUUID"
- },
"network-topology-identifier-structure": {
- "network-type": "vfList[0].vfModuleList[0].networkList[&4].type",
- "network-name": "vfList[0].vfModuleList[0].networkList[&4].name",
- "isShared": {
- "#sharedNetworkBoolean": "vfList[0].vfModuleList[0].networkList[&5].attributeList[0].name",
- "yes": {
- "#true": "vfList[0].vfModuleList[0].networkList[&6].attributeList[0].value"
- },
- "no": {
- "#false": "vfList[0].vfModuleList[0].networkList[&6].attributeList[0].value"
- }
- }
+ "network-name": "networkList[&4].name",
+ "network-id": "networkList[&4].uuid",
+ "#networkRole": "networkList[&4].attributeList[0].name",
+ "network-role": "networkList[&4].attributeList[0].value",
+ "#networkType": "networkList[&4].attributeList[1].name",
+ "network-type": "networkList[&4].attributeList[1].value",
+ "#networkTechnology": "networkList[&4].attributeList[2].name",
+ "network-technology": "networkList[&4].attributeList[2].value"
+ },
+ "onap-model-information": {
+ "model-invariant-uuid": "networkList[&4].invariantUUID"
}
}
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
index 635f254..ec1d0c9 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
@@ -46,6 +46,7 @@ import org.onap.aai.restclient.client.RestClient;
import org.onap.pomba.common.datatypes.Attribute;
import org.onap.pomba.common.datatypes.Attribute.Name;
import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.Network;
import org.onap.pomba.common.datatypes.Service;
import org.onap.pomba.common.datatypes.VFModule;
import org.onap.pomba.common.datatypes.VNF;
@@ -56,8 +57,10 @@ import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
import org.onap.pomba.contextbuilder.sdnc.model.VfModule;
import org.onap.pomba.contextbuilder.sdnc.model.VmName;
import org.onap.pomba.contextbuilder.sdnc.model.Vnf;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfAssignments;
import org.onap.pomba.contextbuilder.sdnc.model.VnfInstance;
import org.onap.pomba.contextbuilder.sdnc.model.VnfList;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfNetwork;
import org.onap.pomba.contextbuilder.sdnc.model.VnfTopologyIdentifier;
import org.onap.pomba.contextbuilder.sdnc.model.VnfVm;
import org.onap.pomba.contextbuilder.sdnc.service.rs.RestService;
@@ -240,51 +243,58 @@ public class RestUtil {
vnf.setUuid("null");
List<Vnf> sdncVnfList = sdncVnfMap.get(aaiVnfInstance.getVnfId());
try {
- // Set the common model VF name and type from the SDNC topology info
- VnfTopologyIdentifier vnfTopologyId = null;
+ // Set the common model VNF name and type from the SDNC topology info
if (sdncVnfList != null && !sdncVnfList.isEmpty()) {
for(Vnf sdncVnf : sdncVnfList) {
- vnfTopologyId = sdncVnf.getServiceData().getVnfTopologyInformation().getVnfTopologyIdentifier();
- if (vnf.getName().contentEquals("null")) {
- vnf.setName(vnfTopologyId.getGenericVnfName());
+ if (null == sdncVnf.getServiceData()) {
+ break;
}
- if (vnf.getType().contentEquals("null")) {
- vnf.setType(vnfTopologyId.getGenericVnfType());
+ if (null == sdncVnf.getServiceData().getVnfTopologyInformation()) {
+ break;
}
- if (vnf.getAttributes().isEmpty()) {
- if ((null != vnfTopologyId.getInMaint()) && !(vnfTopologyId.getInMaint().isEmpty())) {
- Attribute lockedBoolean = new Attribute();
- lockedBoolean.setName(Name.lockedBoolean);
- if (vnfTopologyId.getInMaint().equalsIgnoreCase("yes")) {
- lockedBoolean.setValue("true");
- }
- if (vnfTopologyId.getInMaint().equalsIgnoreCase("no")) {
- lockedBoolean.setValue("false");
- }
- vnf.addAttribute(lockedBoolean);
+ VnfTopologyIdentifier vnfTopologyId = sdncVnf.getServiceData().getVnfTopologyInformation().getVnfTopologyIdentifier();
+ if (null != vnfTopologyId) {
+ if (vnf.getName().contentEquals("null")) {
+ vnf.setName(vnfTopologyId.getGenericVnfName());
}
- if ((null != vnfTopologyId.getProvStatus()) && !(vnfTopologyId.getProvStatus().isEmpty())) {
- Attribute provStatus = new Attribute();
- // attribute.setName(Name.provStatus);
- provStatus.setValue(vnfTopologyId.getProvStatus());
- vnf.addAttribute(provStatus);
+ if (vnf.getType().contentEquals("null")) {
+ vnf.setType(vnfTopologyId.getGenericVnfType());
}
- if (null != vnfTopologyId.getPserver()) {
- if ((null != vnfTopologyId.getPserver().getHostname()) && !(vnfTopologyId.getPserver().getHostname().isEmpty())) {
- Attribute hostname = new Attribute();
- hostname.setName(Name.hostName);
- hostname.setValue(vnfTopologyId.getPserver().getHostname());
- vnf.addAttribute(hostname);
-
+ if (vnf.getAttributes().isEmpty()) {
+ if ((null != vnfTopologyId.getInMaint()) && !(vnfTopologyId.getInMaint().isEmpty())) {
+ Attribute lockedBoolean = new Attribute();
+ lockedBoolean.setName(Name.lockedBoolean);
+ if (vnfTopologyId.getInMaint().equalsIgnoreCase("yes")) {
+ lockedBoolean.setValue("true");
+ }
+ if (vnfTopologyId.getInMaint().equalsIgnoreCase("no")) {
+ lockedBoolean.setValue("false");
+ }
+ vnf.addAttribute(lockedBoolean);
}
- }
- if (null != vnfTopologyId.getImage()) {
- if ((null != vnfTopologyId.getImage().getImageName()) && !(vnfTopologyId.getImage().getImageName().isEmpty())) {
- Attribute imageName = new Attribute();
- imageName.setName(Name.imageId);
- imageName.setValue(vnfTopologyId.getImage().getImageName());
- vnf.addAttribute(imageName);
-
+ if ((null != vnfTopologyId.getProvStatus()) && !(vnfTopologyId.getProvStatus().isEmpty())) {
+ Attribute provStatus = new Attribute();
+ provStatus.setName(Name.provStatus);
+ provStatus.setValue(vnfTopologyId.getProvStatus());
+ vnf.addAttribute(provStatus);
+ }
+ if (null != vnfTopologyId.getPserver()) {
+ if ((null != vnfTopologyId.getPserver().getHostname()) && !(vnfTopologyId.getPserver().getHostname().isEmpty())) {
+ Attribute hostname = new Attribute();
+ hostname.setName(Name.hostName);
+ hostname.setValue(vnfTopologyId.getPserver().getHostname());
+ vnf.addAttribute(hostname);
+
+ }
+ }
+ if (null != vnfTopologyId.getImage()) {
+ if ((null != vnfTopologyId.getImage().getImageName()) && !(vnfTopologyId.getImage().getImageName().isEmpty())) {
+ Attribute imageName = new Attribute();
+ imageName.setName(Name.imageId);
+ imageName.setValue(vnfTopologyId.getImage().getImageName());
+ vnf.addAttribute(imageName);
+
+ }
}
}
}
@@ -549,6 +559,22 @@ public class RestUtil {
VFModule vfModule = new VFModule();
vfModule.setUuid(modelVersionId);
vfModule.setMaxInstances(entry.getValue().intValue());
+ VnfAssignments vnfAssignments = sdncVnf.getServiceData().getVnfTopologyInformation().getVnfAssignments();
+ if (null != vnfAssignments) {
+ List<Network> networks = new ArrayList<>();
+ for (VnfNetwork vnfNetwork : vnfAssignments.getVnfNetworks()) {
+ Network network = new Network();
+ network.setName(vnfNetwork.getNetworkName());
+ network.setUuid(vnfNetwork.getNetworkId());
+ if (null != vnfNetwork.getNetworkRole()) {
+ Attribute networkRole = new Attribute();
+ networkRole.setName(Name.networkRole);
+ networkRole.setValue(vnfNetwork.getNetworkRole());
+ }
+ networks.add(network);
+ }
+ vfModule.setNetworks(networks);
+ }
vfmoduleLst.add(vfModule);
}
}
diff --git a/src/test/resources/junit/sdncGenericResponse.json b/src/test/resources/junit/sdncGenericResponse.json
index edd7d82..b51d3aa 100644
--- a/src/test/resources/junit/sdncGenericResponse.json
+++ b/src/test/resources/junit/sdncGenericResponse.json
@@ -42,7 +42,26 @@
"vnf-name": "mDNS_Preload_1802_0108_rk_01"
},
"vnf-resource-assignments": {
- "vnf-networks": {}
+ "vnf-networks": [
+ {
+ "network-role": "signaling",
+ "network-name": "vnfTest1",
+ "ipv6-subnet-id": "936e0970-7403-48ef-9cf3-6374b42c5497",
+ "neutron-id": "5755dd95-b8f4-469a-931f-200727ed1933",
+ "network-id": "vnfTest1-c41f-43e4-a5be-9a39b21949c8",
+ "contrail-network-fqdn": "default-domain:APP-C-24595-T-IST-05A:vshaken_signal",
+ "ipv6-subnet-name": "vshaken_signal_v6_s1"
+ },
+ {
+ "network-role": "management",
+ "subnet-name": "vshaken_mgmt_v4_s1",
+ "network-name": "vnfTest2",
+ "subnet-id": "1bf746bc-aace-4575-b8e6-4c8f9ccddd42",
+ "neutron-id": "96f4178f-ef7a-4754-acd0-269e9c5f0fc4",
+ "network-id": "vnfTest2-3359-4a47-a868-458c13545624",
+ "contrail-network-fqdn": "default-domain:APP-C-24595-T-IST-05A:vshaken_mgmt"
+ }
+ ]
},
"aic-cloud-region": "mtn23a"
},
@@ -106,6 +125,26 @@
]
}
}
+ ],
+ "vm-networks": [
+ {
+ "network-role": "signaling",
+ "network-name": "vshaken_signal",
+ "ipv6-subnet-id": "936e0970-7403-48ef-9cf3-6374b42c5497",
+ "neutron-id": "5755dd95-b8f4-469a-931f-200727ed1933",
+ "network-id": "77747167-c41f-43e4-a5be-9a39b21949c8",
+ "contrail-network-fqdn": "default-domain:APP-C-24595-T-IST-05A:vshaken_signal",
+ "ipv6-subnet-name": "vshaken_signal_v6_s1"
+ },
+ {
+ "network-role": "management",
+ "subnet-name": "vshaken_mgmt_v4_s1",
+ "network-name": "vshaken_mgmt",
+ "subnet-id": "1bf746bc-aace-4575-b8e6-4c8f9ccddd42",
+ "neutron-id": "96f4178f-ef7a-4754-acd0-269e9c5f0fc4",
+ "network-id": "1dc87784-3359-4a47-a868-458c13545624",
+ "contrail-network-fqdn": "default-domain:APP-C-24595-T-IST-05A:vshaken_mgmt"
+ }
]
}
},
@@ -175,6 +214,27 @@
}
}
]
+ },
+ "networks": {
+ "network": [
+ {
+ "network-data": {
+ "network-topology": {
+ "tennant": "testNetwork",
+ "network-topology-identifier-structure": {
+ "network-id": "testNetworkId",
+ "network-role": "testNetworkRole",
+ "network-technology": "testNetworkTechnology",
+ "network-type": "testNetworkType",
+ "network-name": "testNetworkName"
+ },
+ "onap-model-information": {
+ "model-invariant-uuid": "testNetworkNameInvariantUUID"
+ }
+ }
+ }
+ }
+ ]
}
}
}