summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
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 /src/main/java/org
parenta37aaa36a18516f296908638f9f4399e7d487d92 (diff)
SDNC Context Builder: network
Issue-ID: LOG-768 Change-Id: I2835f7122cc7e59e2e31bd4180f923675618b455 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java102
1 files changed, 64 insertions, 38 deletions
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);
}
}