aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/model/aaiTree
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/model/aaiTree')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java178
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java53
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/FailureAAITreeNode.java31
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java20
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java139
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java52
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java193
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java41
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java54
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java52
10 files changed, 813 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java
new file mode 100644
index 00000000..e6f82296
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java
@@ -0,0 +1,178 @@
+package org.onap.vid.model.aaiTree;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.*;
+
+public class AAITreeNode {
+
+ private String type;
+ private int uniqueNumber;
+ private String orchestrationStatus;
+ private String provStatus;
+ private Boolean inMaint = null;
+ private String modelVersionId;
+ private String modelCustomizationId;
+ private String modelInvariantId;
+ private String id;
+ private String name;
+ private String modelVersion;
+ private String modelName;
+ private String modelCustomizationName;
+ private final List<AAITreeNode> children = Collections.synchronizedList(new LinkedList<>());
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private String keyInModel;
+ private AAITreeNode parent;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public int getUniqueNumber() {
+ return uniqueNumber;
+ }
+
+ public void setUniqueNumber(int uniqueNumber) {
+ this.uniqueNumber = uniqueNumber;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+
+ public Boolean getInMaint() {
+ return inMaint;
+ }
+
+ public void setInMaint(Boolean inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ public List<AAITreeNode> getChildren() {
+ return children;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ public String getNodeKey() {
+ if (this.keyInModel != null) {
+ return this.keyInModel;
+ }
+
+ return StringUtils.defaultIfEmpty(this.modelVersionId, "not provided");
+ }
+
+ public String getUniqueNodeKey() {
+ return getNodeKey() + ":" + String.format("%03d", this.uniqueNumber);
+ }
+
+ public void setKeyInModel(String keyInModel) {
+ this.keyInModel = keyInModel;
+ }
+
+ public String getKeyInModel() {
+ return keyInModel;
+ }
+
+ public AAITreeNode getParent() {
+ return parent;
+ }
+
+ public void setParent(AAITreeNode parent) {
+ this.parent = parent;
+ }
+
+ public void addChildren(List<AAITreeNode> children) {
+ for (AAITreeNode child : children) {
+ child.setParent(this);
+ }
+
+ this.getChildren().addAll(children);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java
new file mode 100644
index 00000000..86669e92
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java
@@ -0,0 +1,53 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.model.Action;
+import org.onap.vid.mso.model.ModelInfo;
+
+public abstract class AbstractNode {
+
+ protected final Action action;
+ protected String instanceName;
+ protected String instanceId;
+ protected String orchStatus;
+ protected String productFamilyId;
+ protected String lcpCloudRegionId;
+ protected String tenantId;
+ protected ModelInfo modelInfo;
+
+ public AbstractNode() {
+ this.action = Action.None;
+ }
+
+ public final Action getAction() {
+ return action;
+ }
+
+ public final String getInstanceName() {
+ return instanceName;
+ }
+
+ public final String getInstanceId() {
+ return instanceId;
+ }
+
+ public final String getOrchStatus() {
+ return orchStatus;
+ }
+
+ public final String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public final String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ public final String getTenantId() {
+ return tenantId;
+ }
+
+ public final ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/FailureAAITreeNode.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/FailureAAITreeNode.java
new file mode 100644
index 00000000..e6234fca
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/FailureAAITreeNode.java
@@ -0,0 +1,31 @@
+package org.onap.vid.model.aaiTree;
+
+import org.apache.commons.proxy.Invoker;
+import org.apache.commons.proxy.factory.javassist.JavassistProxyFactory;
+import org.jetbrains.annotations.NotNull;
+import org.onap.vid.exceptions.GenericUncheckedException;
+
+public class FailureAAITreeNode extends AAITreeNode {
+
+ private static final Class[] classes = {AAITreeNode.class};
+ private static final JavassistProxyFactory proxyFactory = new JavassistProxyFactory(); // can proxy a class without an interface
+
+ private FailureAAITreeNode() {
+ // don't instantiate this class
+ }
+
+ /*
+ Returns a new AAITreeNode instance that throws an exception when
+ invoking any of its methods
+ */
+ public static AAITreeNode of(Exception failureException) {
+ return (AAITreeNode) proxyFactory.createInvokerProxy(exceptionThrower(failureException), classes);
+ }
+
+ @NotNull
+ private static Invoker exceptionThrower(Exception exception) {
+ return (self, thisMethod, args) -> {
+ throw new GenericUncheckedException("AAI node fetching failed.", exception);
+ };
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java
new file mode 100644
index 00000000..959f741c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java
@@ -0,0 +1,20 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.aai.util.AAITreeConverter;
+
+import static org.onap.vid.aai.util.AAITreeConverter.NETWORK_TYPE;
+
+public class Network extends Node {
+
+ public Network(AAITreeNode node) {
+ super(node, AAITreeConverter.ModelType.network);
+ }
+
+ public static Network from(AAITreeNode node) {
+ Network network = new Network(node);
+ if (node.getAdditionalProperties().get(NETWORK_TYPE) != null) {
+ network.setInstanceType(node.getAdditionalProperties().get(NETWORK_TYPE).toString());
+ }
+ return network;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java
new file mode 100644
index 00000000..6f0a4a05
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java
@@ -0,0 +1,139 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.aai.util.AAITreeConverter;
+import org.onap.vid.mso.model.ModelInfo;
+
+public class Node extends AbstractNode {
+ private String instanceType;
+
+ private String provStatus;
+ private Boolean inMaint;
+
+ private String uuid;
+ private String originalName;
+
+ private String legacyRegion;
+ private String lineOfBusiness;
+ private String platformName;
+
+ private final String trackById;
+
+ public Node(AAITreeNode aaiNode, AAITreeConverter.ModelType modelType) {
+ super();
+ this.instanceId = aaiNode.getId();
+ this.instanceName = aaiNode.getName();
+ this.orchStatus = aaiNode.getOrchestrationStatus();
+ this.provStatus = aaiNode.getProvStatus();
+ this.inMaint = aaiNode.getInMaint();
+ this.uuid = aaiNode.getModelVersionId();
+ this.originalName = aaiNode.getModelCustomizationName();
+ this.trackById = aaiNode.getUniqueNodeKey();
+
+ ModelInfo nodeModelInfo = new ModelInfo();
+ nodeModelInfo.setModelType(modelType.name());
+ nodeModelInfo.setModelName(aaiNode.getModelName());
+ nodeModelInfo.setModelVersion(aaiNode.getModelVersion());
+ nodeModelInfo.setModelVersionId(aaiNode.getModelVersionId());
+ nodeModelInfo.setModelInvariantId(aaiNode.getModelInvariantId());
+ nodeModelInfo.setModelCustomizationId(aaiNode.getModelCustomizationId());
+ nodeModelInfo.setModelCustomizationName(aaiNode.getModelCustomizationName());
+
+ this.modelInfo = nodeModelInfo;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public String getInstanceType() {
+ return instanceType;
+ }
+
+ public void setInstanceType(String instanceType) {
+ this.instanceType = instanceType;
+ }
+
+ public void setOrchStatus(String orchStatus) {
+ this.orchStatus = orchStatus;
+ }
+
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+
+ public Boolean getInMaint() {
+ return inMaint;
+ }
+
+ public void setInMaint(Boolean inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public String getOriginalName() {
+ return originalName;
+ }
+
+ public void setOriginalName(String originalName) {
+ this.originalName = originalName;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+ public String getLegacyRegion() {
+ return legacyRegion;
+ }
+
+ public void setLegacyRegion(String legacyRegion) {
+ this.legacyRegion = legacyRegion;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getLineOfBusiness() {
+ return lineOfBusiness;
+ }
+
+ public void setLineOfBusiness(String lineOfBusiness) {
+ this.lineOfBusiness = lineOfBusiness;
+ }
+
+ public String getPlatformName() {
+ return platformName;
+ }
+
+ public void setPlatformName(String platformName) {
+ this.platformName = platformName;
+ }
+
+ public String getTrackById() {
+ return trackById;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java
new file mode 100644
index 00000000..043d2ccd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java
@@ -0,0 +1,52 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.aai.util.AAITreeConverter;
+
+import static org.onap.vid.aai.util.AAITreeConverter.VNF_TYPE;
+
+public class RelatedVnf extends Node {
+
+ private String serviceInstanceId;
+ private String serviceInstanceName;
+ private String tenantName;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public RelatedVnf(AAITreeNode node) {
+ super(node, AAITreeConverter.ModelType.vnf);
+ }
+
+ public static RelatedVnf from(AAITreeNode node) {
+ RelatedVnf vnf = new RelatedVnf(node);
+ vnf.setServiceInstanceId(node.getParent().getId());
+ vnf.setServiceInstanceName(node.getParent().getName());
+
+ if (node.getAdditionalProperties().get(VNF_TYPE) != null) {
+ vnf.setInstanceType(node.getAdditionalProperties().get(VNF_TYPE).toString());
+ }
+
+ return vnf;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java
new file mode 100644
index 00000000..6c660077
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java
@@ -0,0 +1,193 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.mso.model.ModelInfo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ServiceInstance extends AbstractNode {
+
+ private String globalSubscriberId;
+ private String subscriptionServiceType;
+
+ private String owningEntityId;
+
+ private String owningEntityName;
+ private String tenantName;
+ private String aicZoneId;
+ private String aicZoneName;
+ private String projectName;
+
+ private String rollbackOnFailure;
+ private boolean isALaCarte;
+
+ private Map<String, Vnf> vnfs = new HashMap<>();
+ private Map<String, Network> networks = new HashMap<>();
+
+ private Map<String, VnfGroup> vnfGroups = new HashMap<>();
+
+ private int validationCounter;
+ private Map<String, Long> existingVNFCounterMap;
+ private Map<String, Long> existingNetworksCounterMap;
+ private Map<String, Long> existingVnfGroupCounterMap;
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setOrchStatus(String orchStatus) {
+ this.orchStatus = orchStatus;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public String getOwningEntityId() {
+ return owningEntityId;
+ }
+
+ public void setOwningEntityId(String owningEntityId) {
+ this.owningEntityId = owningEntityId;
+ }
+
+ public String getOwningEntityName() {
+ return owningEntityName;
+ }
+
+ public void setOwningEntityName(String owningEntityName) {
+ this.owningEntityName = owningEntityName;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public String getAicZoneId() {
+ return aicZoneId;
+ }
+
+ public void setAicZoneId(String aicZoneId) {
+ this.aicZoneId = aicZoneId;
+ }
+
+ public String getAicZoneName() {
+ return aicZoneName;
+ }
+
+ public void setAicZoneName(String aicZoneName) {
+ this.aicZoneName = aicZoneName;
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+ public String getRollbackOnFailure() {
+ return rollbackOnFailure;
+ }
+
+ public void setRollbackOnFailure(String rollbackOnFailure) {
+ this.rollbackOnFailure = rollbackOnFailure;
+ }
+
+ public boolean getIsALaCarte() {
+ return isALaCarte;
+ }
+
+ public void setIsALaCarte(boolean isALaCarte) {
+ this.isALaCarte = isALaCarte;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public Map<String, Vnf> getVnfs() {
+ return vnfs;
+ }
+
+ public void setVnfs(Map<String, Vnf> vnfs) {
+ this.vnfs = vnfs;
+ }
+
+ public Map<String, Network> getNetworks() {
+ return networks;
+ }
+
+ public void setNetworks(Map<String, Network> networks) {
+ this.networks = networks;
+ }
+
+ public Map<String, VnfGroup> getVnfGroups() { return vnfGroups; }
+
+ public void setVnfGroups(Map<String, VnfGroup> vnfGroups) { this.vnfGroups = vnfGroups; }
+
+ public int getValidationCounter() {
+ return validationCounter;
+ }
+
+ public void setValidationCounter(int validationCounter) {
+ this.validationCounter = validationCounter;
+ }
+
+ public Map<String, Long> getExistingVNFCounterMap() {
+ return existingVNFCounterMap;
+ }
+
+ public void setExistingVNFCounterMap(Map<String, Long> existingVNFCounterMap) {
+ this.existingVNFCounterMap = existingVNFCounterMap;
+ }
+
+ public Map<String, Long> getExistingNetworksCounterMap() {
+ return existingNetworksCounterMap;
+ }
+
+ public void setExistingNetworksCounterMap(Map<String, Long> existingNetworksCounterMap) {
+ this.existingNetworksCounterMap = existingNetworksCounterMap;
+ }
+
+ public Map<String, Long> getExistingVnfGroupCounterMap() {
+ return existingVnfGroupCounterMap;
+ }
+
+ public void setExistingVnfGroupCounterMap(Map<String, Long> existingVnfGroupCounterMap) {
+ this.existingVnfGroupCounterMap = existingVnfGroupCounterMap;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java
new file mode 100644
index 00000000..14a43e79
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java
@@ -0,0 +1,41 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.aai.util.AAITreeConverter;
+
+import static org.onap.vid.aai.util.AAITreeConverter.IS_BASE_VF_MODULE;
+
+public class VfModule extends Node {
+
+ private boolean isBase;
+ private String volumeGroupName;
+
+ public VfModule(AAITreeNode node) {
+ super(node, AAITreeConverter.ModelType.vfModule);
+ }
+
+ public boolean getIsBase() {
+ return isBase;
+ }
+
+ public void setIsBase(boolean isBase) {
+ this.isBase = isBase;
+ }
+
+ public String getVolumeGroupName() {
+ return volumeGroupName;
+ }
+
+ public void setVolumeGroupName(String volumeGroupName) {
+ this.volumeGroupName = volumeGroupName;
+ }
+
+ public static VfModule from(AAITreeNode node) {
+ VfModule vfModule = new VfModule(node);
+
+ if (node.getAdditionalProperties().get(IS_BASE_VF_MODULE) != null) {
+ vfModule.setIsBase(Boolean.valueOf(node.getAdditionalProperties().get(IS_BASE_VF_MODULE).toString()));
+ }
+
+ return vfModule;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java
new file mode 100644
index 00000000..a3280f4e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java
@@ -0,0 +1,54 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.aai.util.AAITreeConverter;
+import org.onap.vid.services.AAITreeNodeBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.onap.vid.aai.util.AAITreeConverter.VNF_TYPE;
+
+public class Vnf extends Node {
+
+ private Map<String, Map<String, VfModule>> vfModules = new HashMap<>();
+ private Map<String, Network> networks = new HashMap<>();
+
+ public Vnf(AAITreeNode node) {
+ super(node, AAITreeConverter.ModelType.vnf);
+ }
+
+ public Map<String, Map<String, VfModule>> getVfModules() {
+ return vfModules;
+ }
+
+ public void setVfModules(Map<String, Map<String, VfModule>> vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ public Map<String, Network> getNetworks() {
+ return networks;
+ }
+
+ public void setNetworks(Map<String, Network> networks) {
+ this.networks = networks;
+ }
+
+ public static Vnf from(AAITreeNode node) {
+ Vnf vnf = new Vnf(node);
+ if (node.getAdditionalProperties().get(VNF_TYPE) != null) {
+ vnf.setInstanceType(node.getAdditionalProperties().get(VNF_TYPE).toString());
+ }
+
+ node.getChildren().forEach(child -> {
+ if (child.getType().equals(AAITreeNodeBuilder.VF_MODULE)) {
+ vnf.getVfModules().putIfAbsent(child.getNodeKey(), new HashMap<>());
+ vnf.getVfModules().get(child.getNodeKey())
+ .put(child.getUniqueNodeKey(), VfModule.from(child));
+ } else if (child.getType().equals(AAITreeNodeBuilder.NETWORK)) {
+ vnf.getNetworks().put(child.getUniqueNodeKey(), Network.from(child));
+ }
+ });
+
+ return vnf;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java
new file mode 100644
index 00000000..00e7ed8d
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java
@@ -0,0 +1,52 @@
+package org.onap.vid.model.aaiTree;
+
+import org.onap.vid.aai.util.AAITreeConverter;
+
+
+public class VnfGroup extends Node {
+
+ public static final String INSTANCE_GROUP_TYPE = "instance-group-type";
+ public static final String INSTANCE_GROUP_ROLE = "instance-group-role";
+ public static final String INSTANCE_GROUP_FUNCTION = "instance-group-function";
+
+ private String instanceGroupRole;
+ private String instanceGroupFunction;
+
+
+ public VnfGroup(AAITreeNode node) {
+ super(node, AAITreeConverter.ModelType.instanceGroup);
+ }
+
+ public static VnfGroup from(AAITreeNode node) {
+ VnfGroup vnfGroup = new VnfGroup(node);
+ if (node.getAdditionalProperties().get(INSTANCE_GROUP_TYPE) != null) {
+ vnfGroup.setInstanceType(node.getAdditionalProperties().get(INSTANCE_GROUP_TYPE).toString());
+ }
+ if (node.getAdditionalProperties().get(INSTANCE_GROUP_FUNCTION) != null) {
+ vnfGroup.setInstanceGroupFunction(node.getAdditionalProperties().get(INSTANCE_GROUP_FUNCTION).toString());
+ }
+ if (node.getAdditionalProperties().get(INSTANCE_GROUP_ROLE) != null) {
+ vnfGroup.setInstanceGroupRole(node.getAdditionalProperties().get(INSTANCE_GROUP_ROLE).toString());
+ }
+
+ return vnfGroup;
+ }
+
+ public String getInstanceGroupRole() {
+ return instanceGroupRole;
+ }
+
+ public void setInstanceGroupRole(String instanceGroupRole) {
+ this.instanceGroupRole = instanceGroupRole;
+ }
+
+ public String getInstanceGroupFunction() {
+ return instanceGroupFunction;
+ }
+
+ public void setInstanceGroupFunction(String instanceGroupFunction) {
+ this.instanceGroupFunction = instanceGroupFunction;
+ }
+
+
+} \ No newline at end of file