summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-01-30 18:21:27 -0500
committerLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-02-01 18:39:26 -0500
commit09e3af8778d9a84ecea2f2085708f22554bd04b8 (patch)
treeefcb6b746919658a723c06d030e9d0463dbf1043 /src
parentef2ccf9b828b4cd09cdb35d8056dc3aa74cf7e8a (diff)
Handle l3Network in AaiCtxBuilder
Issue-ID: LOG-763 Change-Id: I7c1d24727824eb43603b096f63201e4e7195f35b Signed-off-by: Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/L3networkInstance.java276
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VfModule.java24
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java577
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java125
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java13
-rw-r--r--src/test/resources/junit/aai-service-instance_set3.json43
-rw-r--r--src/test/resources/junit/aai-vserver-set2.json78
-rw-r--r--src/test/resources/junit/aai-vserver.json6
-rw-r--r--src/test/resources/junit/genericVnfInput.json36
-rw-r--r--src/test/resources/junit/genericVnfInput_set2.json36
-rw-r--r--src/test/resources/junit/genericVnfInput_set3.json100
-rw-r--r--src/test/resources/junit/genericVnfInput_set4.json120
-rw-r--r--src/test/resources/junit/l3-network-1.json93
-rw-r--r--src/test/resources/junit/l3-network-2.json93
-rw-r--r--src/test/resources/junit/queryNodeData-nullResourceLink.json2
15 files changed, 1357 insertions, 265 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/L3networkInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/L3networkInstance.java
new file mode 100644
index 0000000..10f830b
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/L3networkInstance.java
@@ -0,0 +1,276 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * 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.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.aai.datatype;
+
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+import javax.validation.Valid;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.onap.pomba.contextbuilder.aai.exception.AuditError;
+import org.onap.pomba.contextbuilder.aai.exception.AuditException;
+
+public class L3networkInstance {
+ @SerializedName("network-id")
+ @Expose
+ private String networkId;
+
+ @SerializedName("network-name")
+ @Expose
+ private String networkName;
+ @SerializedName("network-type")
+ @Expose
+ private String networkType;
+ @SerializedName("network-role")
+ @Expose
+ private String networkRole;
+ @SerializedName("network-technology")
+ @Expose
+ private String networkTechnology;
+ @SerializedName("resource-version")
+ @Expose
+ private String resourceVersion;
+ @SerializedName("model-invariant-id")
+ @Expose
+ private String modelInvariantId;
+ @SerializedName("model-version-id")
+ @Expose
+ private String modelVersionId;
+ @SerializedName("physical-network-name")
+ @Expose
+ private String physicalNetworkName;
+ @SerializedName("is-shared-network")
+ @Expose
+ private String sharedNetworkBoolean;
+
+ @SerializedName("relationship-list")
+ @Expose
+ @Valid
+ private RelationshipList relationshipList;
+
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ public void setNetworkId(String networkId) {
+ this.networkId = networkId;
+ }
+
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ public void setNetworkName(String networkName) {
+ this.networkName = networkName;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public void setNetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+
+ public String getNetworkRole() {
+ return networkRole;
+ }
+
+ public void setNetworkRole(String networkRole) {
+ this.networkRole = networkRole;
+ }
+
+ public String getNetworkTechnology() {
+ return networkTechnology;
+ }
+
+ public void setNetworkTechnology(String networkTechnology) {
+ this.networkTechnology = networkTechnology;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getPhysicalNetworkName() {
+ return physicalNetworkName;
+ }
+
+ public void setPhysicalNetworkName(String physicalNetworkName) {
+ this.physicalNetworkName = physicalNetworkName;
+ }
+
+ public String getSharedNetworkBoolean() {
+ return sharedNetworkBoolean;
+ }
+
+ public void setSharedNetworkBoolean(String sharedNetworkBoolean) {
+ this.sharedNetworkBoolean = sharedNetworkBoolean;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
+ private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+
+ public String toJson() {
+ return gson.toJson(this);
+ }
+
+ public static L3networkInstance fromJson(String payload) throws AuditException {
+ try {
+ if (payload == null || payload.isEmpty()) {
+ throw new AuditException("Empty Json response");
+ }
+ return gson.fromJson(payload, L3networkInstance.class);
+ } catch (Exception ex) {
+ throw new AuditException(AuditError.JSON_READER_PARSE_ERROR, ex);
+ }
+ }
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public L3networkInstance() {
+ }
+
+ /**
+ *
+ * @param networkId
+ * @param networkName
+ * @param networkType
+ * @param networkRole
+ * @param networkTechnology
+ * @param resourceVersion
+ * @param modelInvariantId
+ * @param modelVersionId
+ * @param physicalNetworkName
+ * @param sharedNetworkBoolean
+ *
+ */
+ public L3networkInstance(String networkId, String networkName, String networkType,
+ String networkRole, String networkTechnology,String resourceVersion,
+ String modelInvariantId, String modelVersionId, String physicalNetworkName,String sharedNetworkBoolean,
+ RelationshipList relationshipList) {
+ super();
+ this.networkId = networkId;
+ this.networkName = networkName;
+ this.networkType = networkType;
+ this.networkRole = networkRole;
+ this.networkTechnology = networkTechnology;
+ this.resourceVersion = resourceVersion;
+ this.modelInvariantId = modelInvariantId;
+ this.modelVersionId = modelVersionId;
+ this.physicalNetworkName = physicalNetworkName;
+ this.sharedNetworkBoolean = sharedNetworkBoolean;
+ this.relationshipList = relationshipList;
+ }
+
+
+
+ /////////// common functions //////////////////////
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("networkId", networkId)
+ .append("networkName", networkName)
+ .append("networkType", networkType)
+ .append("networkRole", networkRole)
+ .append("networkTechnology", networkTechnology)
+ .append("resourceVersion", resourceVersion)
+ .append("modelInvariantId", modelInvariantId)
+ .append("modelVersionId", modelVersionId)
+ .append("physicalNetworkName", physicalNetworkName)
+ .append("sharedNetworkBoolean", sharedNetworkBoolean)
+ .append("relationshipList", relationshipList)
+ .toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder()
+ .append(networkId)
+ .append(networkName)
+ .append(networkType)
+ .append(networkRole)
+ .append(networkTechnology)
+ .append(resourceVersion)
+ .append(modelInvariantId)
+ .append(modelVersionId)
+ .append(physicalNetworkName)
+ .append(sharedNetworkBoolean)
+ .append(relationshipList)
+ .toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof L3networkInstance)) {
+ return false;
+ }
+ L3networkInstance rhs = ((L3networkInstance) other);
+ return new EqualsBuilder()
+ .append(networkId, rhs.networkId)
+ .append(networkName, rhs.networkName)
+ .append(networkType, rhs.networkType)
+ .append(networkRole, rhs.networkRole)
+ .append(networkTechnology, rhs.networkTechnology)
+ .append(resourceVersion, rhs.resourceVersion)
+ .append(modelInvariantId, rhs.modelInvariantId)
+ .append(modelVersionId, rhs.modelVersionId)
+ .append(physicalNetworkName, rhs.physicalNetworkName)
+ .append(sharedNetworkBoolean, rhs.sharedNetworkBoolean)
+ .isEquals();
+ }
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VfModule.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VfModule.java
index 33312ee..22289ba 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VfModule.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VfModule.java
@@ -19,6 +19,9 @@ package org.onap.pomba.contextbuilder.aai.datatype;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
import javax.validation.Valid;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -61,6 +64,8 @@ public class VfModule {
@Valid
private RelationshipList relationshipList;
+ private List<L3networkInstance> l3NetworkList;
+
/**
* No args constructor for use in serialization
*
@@ -82,7 +87,7 @@ public class VfModule {
* @param relationshipList
* @param modelVersionId
*/
- public VfModule(String vfModuleId, String vfModuleName, String heatStackId, String orchestrationStatus, Boolean isBaseVfModule, String resourceVersion, String modelInvariantId, String modelVersionId, String modelCustomizationId, Integer moduleIndex, RelationshipList relationshipList) {
+ public VfModule(String vfModuleId, String vfModuleName, String heatStackId, String orchestrationStatus, Boolean isBaseVfModule, String resourceVersion, String modelInvariantId, String modelVersionId, String modelCustomizationId, Integer moduleIndex, RelationshipList relationshipList, List<L3networkInstance> l3NetworkList) {
super();
this.vfModuleId = vfModuleId;
this.vfModuleName = vfModuleName;
@@ -95,6 +100,7 @@ public class VfModule {
this.modelCustomizationId = modelCustomizationId;
this.moduleIndex = moduleIndex;
this.relationshipList = relationshipList;
+ this.l3NetworkList = l3NetworkList;
}
public String getVfModuleId() {
@@ -105,7 +111,7 @@ public class VfModule {
this.vfModuleId = vfModuleId;
}
- public String getVfMduleName() {
+ public String getVfModuleName() {
return vfModuleName;
}
@@ -185,14 +191,22 @@ public class VfModule {
this.relationshipList = relationshipList;
}
+ public List<L3networkInstance> getL3NetworkList() {
+ return l3NetworkList;
+ }
+
+ public void setL3NetworkList(List<L3networkInstance> l3NetworkList) {
+ this.l3NetworkList = l3NetworkList;
+ }
+
@Override
public String toString() {
- return new ToStringBuilder(this).append("vfModuleId", vfModuleId).append("vfModuleName", vfModuleName).append("heatStackId", heatStackId).append("orchestrationStatus", orchestrationStatus).append("isBaseVfModule", isBaseVfModule).append("resourceVersion", resourceVersion).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelCustomizationId", modelCustomizationId).append("moduleIndex", moduleIndex).append("relationshipList", relationshipList).toString();
+ return new ToStringBuilder(this).append("vfModuleId", vfModuleId).append("vfModuleName", vfModuleName).append("heatStackId", heatStackId).append("orchestrationStatus", orchestrationStatus).append("isBaseVfModule", isBaseVfModule).append("resourceVersion", resourceVersion).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelCustomizationId", modelCustomizationId).append("moduleIndex", moduleIndex).append("relationshipList", relationshipList).append("l3NetworkList", l3NetworkList).toString();
}
@Override
public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationId).append(moduleIndex).append(vfModuleName).append(orchestrationStatus).append(vfModuleId).append(modelInvariantId).append(heatStackId).append(isBaseVfModule).append(resourceVersion).append(relationshipList).append(modelVersionId).toHashCode();
+ return new HashCodeBuilder().append(modelCustomizationId).append(moduleIndex).append(vfModuleName).append(orchestrationStatus).append(vfModuleId).append(modelInvariantId).append(heatStackId).append(isBaseVfModule).append(resourceVersion).append(relationshipList).append(l3NetworkList).append(modelVersionId).toHashCode();
}
@Override
@@ -204,7 +218,7 @@ public class VfModule {
return false;
}
VfModule rhs = ((VfModule) other);
- return new EqualsBuilder().append(modelCustomizationId, rhs.modelCustomizationId).append(moduleIndex, rhs.moduleIndex).append(vfModuleName, rhs.vfModuleName).append(orchestrationStatus, rhs.orchestrationStatus).append(vfModuleId, rhs.vfModuleId).append(modelInvariantId, rhs.modelInvariantId).append(heatStackId, rhs.heatStackId).append(isBaseVfModule, rhs.isBaseVfModule).append(resourceVersion, rhs.resourceVersion).append(relationshipList, rhs.relationshipList).append(modelVersionId, rhs.modelVersionId).isEquals();
+ return new EqualsBuilder().append(modelCustomizationId, rhs.modelCustomizationId).append(moduleIndex, rhs.moduleIndex).append(vfModuleName, rhs.vfModuleName).append(orchestrationStatus, rhs.orchestrationStatus).append(vfModuleId, rhs.vfModuleId).append(modelInvariantId, rhs.modelInvariantId).append(heatStackId, rhs.heatStackId).append(isBaseVfModule, rhs.isBaseVfModule).append(resourceVersion, rhs.resourceVersion).append(relationshipList, rhs.relationshipList).append(l3NetworkList, rhs.l3NetworkList).append(modelVersionId, rhs.modelVersionId).isEquals();
}
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
index 7c4f6bd..958f656 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
@@ -41,6 +41,7 @@ import org.onap.pomba.common.datatypes.VNF;
import org.onap.pomba.common.datatypes.VFModule;
import org.onap.pomba.common.datatypes.VM;
import org.onap.pomba.common.datatypes.VNFC;
+import org.onap.pomba.common.datatypes.Network;
import org.onap.pomba.contextbuilder.aai.common.LogMessages;
import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
@@ -51,6 +52,7 @@ import org.onap.pomba.contextbuilder.aai.datatype.VnfcInstance;
import org.onap.pomba.contextbuilder.aai.datatype.Vserver;
import org.onap.pomba.contextbuilder.aai.datatype.PserverInstance;
import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstance;
+import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance;
import org.onap.pomba.contextbuilder.aai.exception.AuditError;
import org.onap.pomba.contextbuilder.aai.exception.AuditException;
import org.slf4j.Logger;
@@ -84,6 +86,7 @@ public class RestUtil {
private static final String CATALOG_VSERVER = "vserver";
private static final String CATALOG_IMAGE = "image";
private static final String CATALOG_PSERVER = "pserver";
+ private static final String CATALOG_L3_NETWORK = "l3-network";
private static final String VF_MODULES = "vf-modules";
private static final String VF_MODULE = "vf-module";
@@ -129,6 +132,12 @@ public class RestUtil {
private static final String ATTRIBUTE_EQUIPTMENT_ID = "equipmentID";
private static final String ATTRIBUTE_INTERFACE_ROLE = "interfaceRole";
private static final String ATTRIBUTE_INTERFACE_TYPE = "interfaceType";
+ private static final String ATTRIBUTE_NETWORK_TYPE = "networkType";
+ private static final String ATTRIBUTE_NETWORK_TECHNOLOGY = "networkTechnology";
+ private static final String ATTRIBUTE_PHYSICAL_NETWORK_NAME = "physicalNetworkName";
+ private static final String ATTRIBUTE_SHARED_NETWORK_BOOLEAN = "sharedNetworkBoolean";
+
+
/**
* Validates the URL parameter.
@@ -197,12 +206,15 @@ public class RestUtil {
String serviceInstancePayload = null;
String genericVNFPayload = null;
- List<VnfInstance> vnfLst = new ArrayList<VnfInstance>(); // List of the VNF POJO object
+ List<VnfInstance> vnfLst = new ArrayList<>(); // List of the VNF POJO object
//Map to track multiple vnfc under the Gerneric VNF id. The key = vnf-id. The value = list of vnfc instance
- Map<String, List<VnfcInstance>> vnfcMap = new HashMap<String, List<VnfcInstance>>();
+ Map<String, List<VnfcInstance>> vnfcMap = new HashMap<>();
//Map to track the relationship between vnf->vfmodule->verver
- Map<String, Map<String, List<Vserver>>> vnf_vfmodule_vserver_Map = new HashMap<String, Map<String, List<Vserver>>>();
+ Map<String, Map<String, List<Vserver>>> vnfVfmoduleVserverMap = new HashMap<>();
+
+ //Map to track multiple l3-network under the Gerneric VNF id. The key = vnf-id. The value = list of l3-network instance
+ Map<String, List<L3networkInstance>> l3networkMapInVnf = new HashMap<>();
// Obtain resource-link based on resource-type = service-Instance
String resourceLink = obtainResouceLinkBasedOnServiceInstanceFromAAI(aaiClient, baseURL, aaiPathToSearchNodeQuery, serviceInstanceId, transactionId, aaiBasicAuthorization);
@@ -213,8 +225,7 @@ public class RestUtil {
return null;
}
- log.info("ResourceLink from AAI:" + resourceLink);
-
+ log.info(String.format("ResourceLink from AAI: %s", resourceLink));
// Build URl to get ServiceInstance Payload
String url = baseURL + resourceLink;
@@ -228,7 +239,8 @@ public class RestUtil {
// Only return the empty Json on the root level. i.e service instance
return null;
}
- log.info("Message from AAI:" + JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(serviceInstancePayload)) );
+
+ log.info("Message from AAI:%s", JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(serviceInstancePayload)));
List<String> genericVNFLinkLst = extractRelatedLink(serviceInstancePayload, CATALOG_GENERIC_VNF);
log.info(LogMessages.NUMBER_OF_API_CALLS, "genericVNF", genericVNFLinkLst.size());
@@ -245,27 +257,67 @@ public class RestUtil {
if (isEmptyJson(genericVNFPayload)) {
log.info(LogMessages.NOT_FOUND, "GenericVNF with url ", genericVNFLink);
} else {
- log.info("Message from AAI for VNF " + genericVNFURL + ",message body:" + JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(genericVNFPayload)) );
-
+ log.info("Message from AAI for VNF %s,message body: %s", genericVNFURL, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(genericVNFPayload)));
// Logic to Create the Generic VNF Instance POJO object
VnfInstance vnfInstance = VnfInstance.fromJson(genericVNFPayload);
vnfLst.add(vnfInstance);
+ // Update VModule with l3-network list from aai, if any.
+ buildVModuleWithL3NetworkInfo (vnfInstance, aaiClient, baseURL, transactionId, aaiBasicAuthorization);
+
// Build the vnf_vnfc relationship map
- vnfcMap = buildVnfcMap(vnfcMap, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization );
+ buildVnfcMap(vnfcMap, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization );
// Build vnf_vfmodule_vserver relationship map
- vnf_vfmodule_vserver_Map= buildVfmoduleVserverMap(vnf_vfmodule_vserver_Map, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization);
+ buildVfmoduleVserverMap(vnfVfmoduleVserverMap, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization);
+ // Build the vnf_l3_network relationship map
+ buildVnfWithL3networkInfo(l3networkMapInVnf, genericVNFPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization );
}
}
//Obtain PNF (Physical Network Function)
List<PnfInstance> pnfLst = retrieveAAIModelData_PNF (aaiClient, baseURL, transactionId, serviceInstanceId, aaiBasicAuthorization, serviceInstancePayload) ;
+ //Obtain l3-network on service level
+ List<L3networkInstance> l3networkLstInService = retrieveAaiModelDataL3NetworkInServiceLevel (aaiClient, baseURL, transactionId, aaiBasicAuthorization, serviceInstancePayload) ;
// Transform to common model and return
- return transform(ServiceInstance.fromJson(serviceInstancePayload), vnfLst, vnfcMap, vnf_vfmodule_vserver_Map, pnfLst);
+ return transform(ServiceInstance.fromJson(serviceInstancePayload), vnfLst, vnfcMap, l3networkMapInVnf, vnfVfmoduleVserverMap, pnfLst, l3networkLstInService);
+ }
+
+ private static void buildVModuleWithL3NetworkInfo (VnfInstance vnfInstance,
+ RestClient aaiClient, String baseURL,
+ String transactionId, String aaiBasicAuthorization
+ ) throws AuditException {
+
+ if ((vnfInstance != null ) && (vnfInstance.getVfModules()) != null) {
+ List<VfModule> vfModuleList_from_aai = vnfInstance.getVfModules().getVfModule();
+ for (VfModule t_vfModule : vfModuleList_from_aai ) {
+ RelationshipList vfModuleRelateionShipList = t_vfModule.getRelationshipList();
+ if ( vfModuleRelateionShipList != null) {
+ List<Relationship> vfModuleRelateionShipLocalList = vfModuleRelateionShipList.getRelationship();
+ if ( vfModuleRelateionShipLocalList != null) {
+ List<String> relatedLinkList = new ArrayList<>();
+
+ for ( Relationship vfModuleRelationShip : vfModuleRelateionShipLocalList ) {
+ if (vfModuleRelationShip.getRelatedTo().equals(CATALOG_L3_NETWORK)) {
+ String vfModule_L3_network_RelatedLink = vfModuleRelationShip.getRelatedLink();
+ relatedLinkList.add(vfModule_L3_network_RelatedLink);
+ }
+ }
+
+ if (!(relatedLinkList.isEmpty())) {
+ List<L3networkInstance> l3nwInsLst = queryAaiForL3networkInfo (aaiClient,baseURL,transactionId,aaiBasicAuthorization,relatedLinkList);
+
+ if ((l3nwInsLst != null) && (!l3nwInsLst.isEmpty())) {
+ t_vfModule.setL3NetworkList(l3nwInsLst);
+ }
+ }
+ }
+ }
+ }
+ }
}
private static List<PnfInstance> retrieveAAIModelData_PNF(RestClient aaiClient, String baseURL,
@@ -275,12 +327,12 @@ public class RestUtil {
log.info(LogMessages.NUMBER_OF_API_CALLS, "PNF", genericPNFLinkLst.size());
log.info(LogMessages.API_CALL_LIST, "PNF", printOutAPIList(genericPNFLinkLst));
- if ( genericPNFLinkLst.size() == 0) {
+ if ( genericPNFLinkLst.isEmpty()) {
return null;
}
String genericPNFPayload = null;
- List<PnfInstance> pnfLst = new ArrayList<PnfInstance>(); // List of the PNF POJO object
+ List<PnfInstance> pnfLst = new ArrayList<>(); // List of the PNF POJO object
for (String genericPNFLink : genericPNFLinkLst) {
// With latest AAI development, in order to retrieve the both generic PNF
@@ -292,8 +344,7 @@ public class RestUtil {
if (isEmptyJson(genericPNFPayload)) {
log.info(LogMessages.NOT_FOUND, "GenericPNF with url ", genericPNFLink);
} else {
- log.info("Message from AAI for PNF " + genericPNFLink + ",message body:" + JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(genericPNFPayload)) );
-
+ log.info(String.format("Message from AAI for PNF %s ,message body: %s", genericPNFLink, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(genericPNFPayload))));
// Logic to Create the Generic VNF Instance POJO object
PnfInstance pnfInstance = PnfInstance.fromJson(genericPNFPayload);
pnfLst.add(pnfInstance);
@@ -303,6 +354,45 @@ public class RestUtil {
return pnfLst;
}
+ private static List<L3networkInstance> queryAaiForL3networkInfo(RestClient aaiClient, String baseURL,
+ String transactionId, String aaiBasicAuthorization, List<String> genericL3networkLinkLst) throws AuditException {
+ if ( genericL3networkLinkLst.isEmpty()) {
+ return null;
+ }
+ log.info(LogMessages.NUMBER_OF_API_CALLS, "L3Network", genericL3networkLinkLst.size());
+ log.info(LogMessages.API_CALL_LIST, "L3Network", printOutAPIList(genericL3networkLinkLst));
+
+ String genericL3networkPayload = null;
+ List<L3networkInstance> l3nwLst = new ArrayList<>(); // List of the L3-Network POJO object
+
+ for (String genericNetworkLink : genericL3networkLinkLst) {
+ // With latest AAI development, in order to retrieve the both generic l3-network
+ String genericL3NetworkURL = baseURL + genericNetworkLink + DEPTH;
+ // Response from generic l3-network API call
+ genericL3networkPayload =
+ getResource(aaiClient, genericL3NetworkURL, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+
+ if (isEmptyJson(genericL3networkPayload)) {
+ log.info(LogMessages.NOT_FOUND, "GenericPNF with url ", genericNetworkLink);
+ } else {
+ log.info("Message from AAI for l3-network %s ,message body: %s", genericNetworkLink, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(genericL3networkPayload)));
+ // Logic to Create the Generic VNF Instance POJO object
+ L3networkInstance l3NetworkInstance = L3networkInstance.fromJson(genericL3networkPayload);
+ l3nwLst.add(l3NetworkInstance);
+ }
+ }
+
+ return l3nwLst;
+ }
+
+ private static List<L3networkInstance> retrieveAaiModelDataL3NetworkInServiceLevel(RestClient aaiClient, String baseURL,
+ String transactionId, String aaiBasicAuthorization, String relationShipPayload) throws AuditException {
+
+ List<String> genericL3networkLinkLst = extractRelatedLink(relationShipPayload, CATALOG_L3_NETWORK);
+
+ return (queryAaiForL3networkInfo (aaiClient,baseURL,transactionId,aaiBasicAuthorization,genericL3networkLinkLst) ) ;
+ }
+
/*
* The map is to track the relationship of vnf-id with multiple vnfc relationship
*/
@@ -315,23 +405,23 @@ public class RestUtil {
log.info(LogMessages.NUMBER_OF_API_CALLS, "vnfc", vnfcLinkLst.size());
log.info(LogMessages.API_CALL_LIST, "vnfc", printOutAPIList(vnfcLinkLst));
- List<VnfcInstance> vnfcLst = new ArrayList<VnfcInstance>();
+ List<VnfcInstance> vnfcLst = new ArrayList<>();
for (String vnfcLink : vnfcLinkLst) {
String vnfcURL = baseURL + vnfcLink;
vnfcPayload = getResource(aaiClient, vnfcURL, aaiBasicAuthorization, transactionId,
- MediaType.valueOf(MediaType.APPLICATION_XML));
+ MediaType.valueOf(MediaType.APPLICATION_JSON));
if (isEmptyJson(vnfcPayload)) {
log.info(LogMessages.NOT_FOUND, "VNFC with url", vnfcLink);
} else {
- log.info("Message from AAI for VNFC with url " + vnfcLink + ",message body:" + JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(vnfcPayload)) );
+ log.info(String.format("Message from AAI for VNFC with url %s, ,message body: %s", vnfcLink, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(vnfcPayload))));
// Logic to Create the VNFC POJO object
VnfcInstance vnfcInstance = VnfcInstance.fromJson(vnfcPayload);
vnfcLst.add(vnfcInstance);
}
}
- if (vnfcLst.size() > 0) {
+ if (!vnfcLst.isEmpty()) {
// Assume the vnf-id is unique as a key
vnfcMap.put(getVnfId(genericVNFPayload), vnfcLst);
}
@@ -340,6 +430,21 @@ public class RestUtil {
}
/*
+ * The map is to track the relationship of vnf-id with multiple l3-network relationship at vnf level
+ */
+ private static Map<String, List<L3networkInstance>> buildVnfWithL3networkInfo(Map<String, List<L3networkInstance>> l3networkMap_in_vnf, String genericVNFPayload, RestClient aaiClient, String baseURL,
+ String transactionId, String aaiBasicAuthorization) throws AuditException {
+
+ List<L3networkInstance> l3NwLst = retrieveAaiModelDataL3NetworkInServiceLevel (aaiClient, baseURL, transactionId, aaiBasicAuthorization, genericVNFPayload) ;
+
+ if ((l3NwLst != null ) && (!l3NwLst.isEmpty())) {
+ // Assume the vnf-id is unique as a key
+ l3networkMap_in_vnf.put(getVnfId(genericVNFPayload), l3NwLst);
+ }
+ return l3networkMap_in_vnf;
+ }
+
+ /*
* This is a two layer map to track the relationship between vnf->vfmodule->verver
*
* The Map<String, List<Vserver> is to track multiple vserver under the vfModule.
@@ -350,21 +455,21 @@ public class RestUtil {
*/
private static Map<String, Map<String, List<Vserver>>> buildVfmoduleVserverMap(Map<String, Map<String, List<Vserver>>> vnf_vfmodule_vserver_Map, String genericVNFPayload, RestClient aaiClient, String baseURL, String transactionId, String aaiBasicAuthorization) throws AuditException {
- Map<String, List<Vserver>> vServerMap = new HashMap<String, List<Vserver>>();
+ Map<String, List<Vserver>> vServerMap = new HashMap<>();
Map<String, List<String>> vServerRelatedLinkMap = extractRelatedLinkFromVfmodule(genericVNFPayload, CATALOG_VSERVER);
String vnfId= getVnfId(genericVNFPayload);
String vserverPayload = null;
- if (vServerRelatedLinkMap !=null && vServerRelatedLinkMap.size() >0) {
+ if (vServerRelatedLinkMap !=null && (!vServerRelatedLinkMap.isEmpty())) {
for(Map.Entry<String, List<String>> entry : vServerRelatedLinkMap.entrySet()) {
List<String> vserverLinkLst = entry.getValue();
- log.info(LogMessages.NUMBER_OF_API_CALLS, "vserver", vserverLinkLst.size());
- log.info(LogMessages.API_CALL_LIST, "vserver", printOutAPIList(vserverLinkLst));
+ log.info(LogMessages.NUMBER_OF_API_CALLS, CATALOG_VSERVER, vserverLinkLst.size());
+ log.info(LogMessages.API_CALL_LIST, CATALOG_VSERVER, printOutAPIList(vserverLinkLst));
- List<Vserver> vserverLst = new ArrayList<Vserver>();
+ List<Vserver> vserverLst = new ArrayList<>();
for (String vserverLink : vserverLinkLst) {
String vserverURL = baseURL + vserverLink;
vserverPayload = getResource(aaiClient, vserverURL, aaiBasicAuthorization, transactionId,
@@ -375,16 +480,16 @@ public class RestUtil {
} else {
// Logic to Create the Vserver POJO object
Vserver vserver = Vserver.fromJson(vserverPayload);
- vserver.setPserverInstanceList(getPserverInfo_from_aai(vserverPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization));
+ vserver.setPserverInstanceList(getPserverInfoFromAai(vserverPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization));
vserverLst.add(vserver);
}
}
- if (vserverLst.size() > 0) {
+ if (!vserverLst.isEmpty()) {
vServerMap.put(entry.getKey(), vserverLst);
}
}
- if (vServerMap.size()> 0) {
+ if (!vServerMap.isEmpty()) {
vnf_vfmodule_vserver_Map.put(vnfId, vServerMap);
}
}
@@ -392,20 +497,20 @@ public class RestUtil {
return vnf_vfmodule_vserver_Map;
}
- private static List<PserverInstance> getPserverInfo_from_aai (String vserverPayload, RestClient aaiClient, String baseURL, String transactionId, String aaiBasicAuthorization) throws AuditException {
+ private static List<PserverInstance> getPserverInfoFromAai (String vserverPayload, RestClient aaiClient, String baseURL, String transactionId, String aaiBasicAuthorization) throws AuditException {
if (vserverPayload == null) {
//already reported.
return null;
}
//Obtain related Pserver info
- List<String> pserverRelatedLinkList = handleRelationship_general (vserverPayload,CATALOG_PSERVER );
+ List<String> pserverRelatedLinkList = handleRelationshipGeneral (vserverPayload,CATALOG_PSERVER );
List<PserverInstance> pserverLst = null;
if ((pserverRelatedLinkList == null) || (pserverRelatedLinkList.isEmpty())){
// already reported
return null;
}
- pserverLst = new ArrayList<PserverInstance>();
+ pserverLst = new ArrayList<>();
for (String pserverRelatedLink : pserverRelatedLinkList) {
String pserverURL = baseURL + pserverRelatedLink + DEPTH;;
String pserverPayload = getResource(aaiClient, pserverURL, aaiBasicAuthorization, transactionId,
@@ -414,8 +519,7 @@ public class RestUtil {
if (isEmptyJson(pserverPayload)) {
log.info(LogMessages.NOT_FOUND, "PSERVER with url", pserverURL);
} else {
- log.info("Message from AAI for pserver " + pserverURL + ",message body:" + pserverPayload) ;
-
+ log.info("Message from AAI for pserver %s ,message body: %s", pserverURL,pserverPayload);
// Logic to Create the Pserver POJO object
PserverInstance pserver = PserverInstance.fromJson(pserverPayload);
@@ -437,7 +541,10 @@ public class RestUtil {
* Transform AAI Representation to Common Model
*/
private static ModelContext transform(ServiceInstance svcInstance, List<VnfInstance> vnfLst,
- Map<String, List<VnfcInstance>> vnfcMap, Map<String, Map<String, List<Vserver>>> vnf_vfmodule_vserver_Map, List<PnfInstance> pnfLst_fromAAi) {
+ Map<String, List<VnfcInstance>> vnfcMap,
+ Map<String, List<L3networkInstance>> l3networkMap_in_vnf,
+ Map<String, Map<String, List<Vserver>>> vnf_vfmodule_vserver_Map, List<PnfInstance> pnfLst_fromAAi,
+ List<L3networkInstance> l3networkLst_in_service) {
ModelContext context = new ModelContext();
Service service = new Service();
service.setModelInvariantUUID(svcInstance.getModelInvariantId());
@@ -445,7 +552,7 @@ public class RestUtil {
service.setModelVersionID(svcInstance.getModelVersionId());
service.setUuid(svcInstance.getServiceInstanceId());
service.setDataQuality(DataQuality.ok());
- List<VNF> vfLst = new ArrayList<VNF>();
+ List<VNF> vfLst = new ArrayList<>();
for (VnfInstance vnf : vnfLst) {
VNF vf = new VNF();
@@ -459,7 +566,7 @@ public class RestUtil {
String key = vnf.getVnfId(); // generic vnf-id (top level of the key)
// ---------------- Handle VNFC data
- List<VNFC> vnfcLst = new ArrayList<VNFC>();
+ List<VNFC> vnfcLst = new ArrayList<>();
for (Map.Entry<String, List<VnfcInstance>> entry : vnfcMap.entrySet()) {
if (key.equals(entry.getKey())) {
@@ -476,9 +583,21 @@ public class RestUtil {
}
vf.setVnfcs(vnfcLst);
+ // add vnf level l3-network
+ List<Network> nwLst_in_vnf = null;
+ for (Map.Entry<String, List<L3networkInstance>> entry : l3networkMap_in_vnf.entrySet()) {
+ if (key.equals(entry.getKey())) {
+ List<L3networkInstance> l3NwInstanceLst_in_vnf = entry.getValue();
+ nwLst_in_vnf = transformL3Network (l3NwInstanceLst_in_vnf) ;
+ }
+ }
+
+ if ((nwLst_in_vnf != null) && (!nwLst_in_vnf.isEmpty())) {
+ vf.setNetworks(nwLst_in_vnf);
+ }
// --------------- Handle the vfModule
- List<VFModule> vfModuleLst = new ArrayList<VFModule>();
+ List<VFModule> vfModuleLst = new ArrayList<>();
//Map to calculate the Vf Module MaxInstance.
if (vnf.getVfModules() != null) {
List<VfModule> vfModuleList_from_aai = vnf.getVfModules().getVfModule();
@@ -489,11 +608,15 @@ public class RestUtil {
VFModule vfModule = new VFModule();
vfModule.setUuid(t_vfModule.getVfModuleId());
vfModule.setModelInvariantUUID(t_vfModule.getModelInvariantId());
- vfModule.setName(t_vfModule.getVfMduleName());
+ vfModule.setName(t_vfModule.getVfModuleName());
vfModule.setModelVersionID(t_vfModule.getModelVersionId());
vfModule.setModelCustomizationUUID(t_vfModule.getModelCustomizationId());
vfModule.setMaxInstances(maxInstanceMap.size());
vfModule.setDataQuality(DataQuality.ok());
+ List<Network> l3networkInVfModule = transformL3Network(t_vfModule.getL3NetworkList());
+ if ((l3networkInVfModule != null) && (!l3networkInVfModule.isEmpty()) ){
+ vfModule.setNetworks(l3networkInVfModule);
+ }
for ( Map.Entry<String, Map<String, List<Vserver>>> entry: vnf_vfmodule_vserver_Map.entrySet() ) {
// find the vnf-id
@@ -514,14 +637,14 @@ public class RestUtil {
vfModule.setMaxInstances(getMaxInstance(vfmoduleEntry.getKey(), maxInstanceMap));
// Handle VM
- List<VM> vmList = new ArrayList<VM>();
+ List<VM> vmList = new ArrayList<>();
for (Vserver vserver: vserverList) {
- List<Attribute> attributeList = new ArrayList<Attribute>();
+ List<Attribute> attributeList = new ArrayList<>();
// Iterate through the ENUM Attribute list
for (Attribute.Name name: Attribute.Name.values()) {
- if (name.toString().equals(ATTRIBUTE_LOCKEDBOOLEAN)) {
+ if (name.name().equals(ATTRIBUTE_LOCKEDBOOLEAN)) {
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.lockedBoolean);
@@ -529,7 +652,7 @@ public class RestUtil {
attributeList.add(att);
}
- if (name.toString().equals(ATTRIBUTE_HOSTNAME)) {
+ if (name.name().equals(ATTRIBUTE_HOSTNAME)) {
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.hostName);
@@ -537,7 +660,7 @@ public class RestUtil {
attributeList.add(att);
}
- if (name.toString().equals(ATTRIBUTE_IMAGEID)) {
+ if (name.name().equals(ATTRIBUTE_IMAGEID)) {
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.imageId);
@@ -560,7 +683,7 @@ public class RestUtil {
vmList.add(vm);
}
- if (vmList.size() > 0) {
+ if (!vmList.isEmpty()) {
vfModule.setVms(vmList);
}
}
@@ -581,10 +704,9 @@ public class RestUtil {
context.setVnfs(vfLst);
//Add PNF info
context.setPnfs(transformPNF(pnfLst_fromAAi));
- //Add Pserver info
-
- log.info("ModelContext body: {}", JsonUtils.toPrettyJsonString(context));
-
+ //Add service-level l3-network info
+ context.setNetworkList(transformL3Network (l3networkLst_in_service));
+ log.info((String.format("ModelContext body: %s ", JsonUtils.toPrettyJsonString(context))));
return context;
}
@@ -600,91 +722,91 @@ public class RestUtil {
pserver.setUuid(pserverInstance.getPserverId());
pserver.setName(pserverInstance.getHostname());
- List<Attribute> attributeList = new ArrayList<Attribute>();
+ List<Attribute> attributeList = new ArrayList<>();
// Iterate through the ENUM Attribute list
for (Attribute.Name name: Attribute.Name.values()) {
- if ((name.toString().equals(ATTRIBUTE_NAME2 ))
- && (pserverInstance.getPserverName2() != null)){
+ if ((name.name().equals(ATTRIBUTE_NAME2 ))
+ && isValid(pserverInstance.getPserverName2())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.name2);
att.setValue(String.valueOf(pserverInstance.getPserverName2()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_PTNII_NAME ))
- && (pserverInstance.getPtniiEquipName() != null)){
+ if ((name.name().equals(ATTRIBUTE_PTNII_NAME ))
+ && isValid(pserverInstance.getPtniiEquipName())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.ptniiName);
att.setValue(String.valueOf(pserverInstance.getPtniiEquipName()));
attributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_EQUIPMENT_TYPE ))
- &&(pserverInstance.getEquipType() != null)){
+ if ((name.name().equals( ATTRIBUTE_EQUIPMENT_TYPE ))
+ && isValid(pserverInstance.getEquipType())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.equipType);
att.setValue(String.valueOf(pserverInstance.getEquipType()));
attributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_EQUIPMENT_VENDOR ))
- &&(pserverInstance.getEquipVendor() != null)){
+ if ((name.name().equals( ATTRIBUTE_EQUIPMENT_VENDOR ))
+ && isValid(pserverInstance.getEquipVendor())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.equipVendor);
att.setValue(String.valueOf(pserverInstance.getEquipVendor()));
attributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_EQUIPMENT_MODEL ))
- &&(pserverInstance.getEquipModel() != null)){
+ if ((name.name().equals( ATTRIBUTE_EQUIPMENT_MODEL ))
+ && isValid(pserverInstance.getEquipModel())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.equipModel);
att.setValue(String.valueOf(pserverInstance.getEquipModel()));
attributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_FQDN ))
- &&(pserverInstance.getFqdn() != null)){
+ if ((name.name().equals( ATTRIBUTE_FQDN ))
+ && isValid(pserverInstance.getFqdn())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.fqdn);
att.setValue(String.valueOf(pserverInstance.getFqdn()));
attributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_SERIAL_NUMBER ))
- &&(pserverInstance.getSerialNumber() != null)){
+ if ((name.name().equals( ATTRIBUTE_SERIAL_NUMBER ))
+ && isValid(pserverInstance.getSerialNumber())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.serialNumber);
att.setValue(String.valueOf(pserverInstance.getSerialNumber()));
attributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_TOPOLOGY ))
- &&(pserverInstance.getInternetTopology() != null)){
+ if ((name.name().equals( ATTRIBUTE_TOPOLOGY ))
+ && isValid(pserverInstance.getInternetTopology())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.topology);
att.setValue(String.valueOf(pserverInstance.getInternetTopology()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_LOCKEDBOOLEAN))
- &&(pserverInstance.getInMaint() != null)){
+ if ((name.name().equals(ATTRIBUTE_LOCKEDBOOLEAN))
+ && isValid(pserverInstance.getInMaint())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.lockedBoolean);
att.setValue(String.valueOf(pserverInstance.getInMaint()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_RESOURCE_VERSION))
- &&(pserverInstance.getResourceVersion() != null)){
+ if ((name.name().equals(ATTRIBUTE_RESOURCE_VERSION))
+ && isValid(pserverInstance.getResourceVersion())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.resourceVersion);
att.setValue(String.valueOf(pserverInstance.getResourceVersion()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_PURPOSE))
- &&(pserverInstance.getPurpose() != null)){
+ if ((name.name().equals(ATTRIBUTE_PURPOSE))
+ && isValid(pserverInstance.getPurpose())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.purpose);
@@ -693,14 +815,14 @@ public class RestUtil {
}
}
- if (attributeList.size() > 0) {
+ if (!attributeList.isEmpty()) {
pserver.setAttributes(attributeList);
}
// Update P-Interface if any,
PInterfaceInstanceList pInterfaceInstanceList = pserverInstance.getPInterfaceInstanceList();
- if ((pInterfaceInstanceList != null) && (pInterfaceInstanceList.getPInterfaceList().size() > 0)) {
- pserver = UpdatePserverInfoWithPInterface (pserver, pInterfaceInstanceList.getPInterfaceList());
+ if ((pInterfaceInstanceList != null) && (!(pInterfaceInstanceList.getPInterfaceList().isEmpty()))) {
+ pserver = updatePserverInfoWithPInterface (pserver, pInterfaceInstanceList.getPInterfaceList());
}
// NOTE: we only support one pserver per vserver hence we only add
@@ -711,28 +833,25 @@ public class RestUtil {
return pserver;
}
- private static Pserver UpdatePserverInfoWithPInterface (Pserver pserver, List<PInterfaceInstance> pInterfaceInstanceList) {
+ private static Pserver updatePserverInfoWithPInterface (Pserver pserver, List<PInterfaceInstance> pInterfaceInstanceList) {
- List<PInterface> pInterfaceList = new ArrayList<PInterface>();
+ List<PInterface> pInterfaceList = new ArrayList<>();
for (PInterfaceInstance pInterfaceInst_aai: pInterfaceInstanceList) {
PInterface pInterface = new PInterface();
// pInterface.setUuid( ); // there is no mapping data for UUID from AAI data.
pInterface.setName(pInterfaceInst_aai.getInterfaceName());
pInterface.setDataQuality(DataQuality.ok());
- List<Attribute> pInterface_attributeList = new ArrayList<Attribute>();
+ List<Attribute> pInterface_attributeList = new ArrayList<>();
updatePInterfaceAttributeList (pInterfaceInst_aai, pInterface_attributeList) ;
- if (pInterface_attributeList.size() > 0) {
+ if (!pInterface_attributeList.isEmpty()) {
pInterface.setAttributes(pInterface_attributeList);
}
- if (pInterface_attributeList.size() > 0) {
- pInterface.setAttributes(pInterface_attributeList);
- }
pInterfaceList.add(pInterface);
}
- if (pInterfaceList.size() > 0) {
+ if (!pInterfaceList.isEmpty()) {
pserver.setPInterfaceList(pInterfaceList);;
}
@@ -747,154 +866,153 @@ public class RestUtil {
log.info(LogMessages.API_CALL_LIST, "Nill PNF list");
return null;
}
- List<PNF> pnfLst = new ArrayList<PNF>();
+ List<PNF> pnfLst = new ArrayList<>();
- for (PnfInstance pnf_from_aai : pnfLst_from_AAI) {
+ for (PnfInstance pnfFromAai : pnfLst_from_AAI) {
PNF pnf = new PNF();
- pnf.setUuid(pnf_from_aai.getPnfId());
- pnf.setName(pnf_from_aai.getPnfName());
- pnf.setModelVersionID(pnf_from_aai.getModelVersionId());
- pnf.setModelInvariantUUID(pnf_from_aai.getModelInvariantId());
+ pnf.setUuid(pnfFromAai.getPnfId());
+ pnf.setName(pnfFromAai.getPnfName());
+ pnf.setModelVersionID(pnfFromAai.getModelVersionId());
+ pnf.setModelInvariantUUID(pnfFromAai.getModelInvariantId());
pnf.setDataQuality(DataQuality.ok());
- List<Attribute> attributeList = new ArrayList<Attribute>();
+ List<Attribute> attributeList = new ArrayList<>();
pnf.setAttributes(attributeList);
// Iterate through the ENUM Attribute list
for (Attribute.Name name: Attribute.Name.values()) {
- if ((name.toString().equals(ATTRIBUTE_NETWORK_FUNCTION ))
- &&(pnf_from_aai.getNfFunction() != null)){
+ if ((name.name().equals(ATTRIBUTE_NETWORK_FUNCTION ))
+ && isValid(pnfFromAai.getNfFunction())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.networkFunction);
- att.setValue(String.valueOf( pnf_from_aai.getNfFunction()));
+ att.setValue(String.valueOf( pnfFromAai.getNfFunction()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_NETWORK_ROLE ))
- && (pnf_from_aai.getNfRole() != null )){
+ if ((name.name().equals(ATTRIBUTE_NETWORK_ROLE ))
+ && isValid(pnfFromAai.getNfRole())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.networkRole);
- att.setValue(String.valueOf( pnf_from_aai.getNfRole()));
+ att.setValue(String.valueOf( pnfFromAai.getNfRole()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_RESOURCE_VERSION))
- && (pnf_from_aai.getResourceVersion() != null)){
+ if ((name.name().equals(ATTRIBUTE_RESOURCE_VERSION))
+ && isValid(pnfFromAai.getResourceVersion())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.resourceVersion);
- att.setValue(String.valueOf( pnf_from_aai.getResourceVersion()));
+ att.setValue(String.valueOf( pnfFromAai.getResourceVersion()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_NAME2))
- && (pnf_from_aai.getPnfName2() != null )){
+ if ((name.name().equals(ATTRIBUTE_NAME2))
+ && isValid(pnfFromAai.getPnfName2() )){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.name2);
- att.setValue(String.valueOf( pnf_from_aai.getPnfName2()));
+ att.setValue(String.valueOf( pnfFromAai.getPnfName2()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_NAME2_SOURCE ))
- && (pnf_from_aai.getPnfName2Source() != null)){
+ if ((name.name().equals(ATTRIBUTE_NAME2_SOURCE ))
+ && isValid(pnfFromAai.getPnfName2Source())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.name2Source);
- att.setValue(String.valueOf( pnf_from_aai.getPnfName2Source()));
+ att.setValue(String.valueOf( pnfFromAai.getPnfName2Source()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_EQUIPMENT_TYPE ))
- && (pnf_from_aai.getEquipmentType() != null)){
+ if ((name.name().equals(ATTRIBUTE_EQUIPMENT_TYPE ))
+ && isValid(pnfFromAai.getEquipmentType())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.equipType);
- att.setValue(String.valueOf( pnf_from_aai.getEquipmentType()));
+ att.setValue(String.valueOf( pnfFromAai.getEquipmentType()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_EQUIPMENT_VENDOR ))
- && (pnf_from_aai.getEquipmentVendor() != null)){
+ if ((name.name().equals(ATTRIBUTE_EQUIPMENT_VENDOR ))
+ && isValid(pnfFromAai.getEquipmentVendor())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.equipVendor);
- att.setValue(String.valueOf( pnf_from_aai.getEquipmentVendor()));
+ att.setValue(String.valueOf( pnfFromAai.getEquipmentVendor()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_EQUIPMENT_MODEL))
- && (pnf_from_aai.getEquipmentModel() != null)){
+ if ((name.name().equals(ATTRIBUTE_EQUIPMENT_MODEL))
+ && isValid(pnfFromAai.getEquipmentModel())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.equipModel);
- att.setValue(String.valueOf( pnf_from_aai.getEquipmentModel()));
+ att.setValue(String.valueOf( pnfFromAai.getEquipmentModel()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_MANAGEMENT_OPTIONS))
- &&(pnf_from_aai.getManagementOptions() != null)){
+ if ((name.name().equals(ATTRIBUTE_MANAGEMENT_OPTIONS))
+ && isValid(pnfFromAai.getManagementOptions())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.managementOptions);
- att.setValue(String.valueOf( pnf_from_aai.getManagementOptions()));
+ att.setValue(String.valueOf( pnfFromAai.getManagementOptions()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_SW_VERSION))
- &&(pnf_from_aai.getSwVersion()!= null)){
+ if ((name.name().equals(ATTRIBUTE_SW_VERSION))
+ && isValid(pnfFromAai.getSwVersion())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.swVersion);
- att.setValue(String.valueOf( pnf_from_aai.getSwVersion()));
+ att.setValue(String.valueOf( pnfFromAai.getSwVersion()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_FRAME_ID))
- &&(pnf_from_aai.getFrameId() != null)){
+ if ((name.name().equals(ATTRIBUTE_FRAME_ID))
+ && isValid(pnfFromAai.getFrameId())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.frameId);
- att.setValue(String.valueOf( pnf_from_aai.getFrameId()));
+ att.setValue(String.valueOf( pnfFromAai.getFrameId()));
attributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_SERIAL_NUMBER))
- &&(pnf_from_aai.getSerialNumber() != null)){
+ if ((name.name().equals(ATTRIBUTE_SERIAL_NUMBER))
+ && isValid(pnfFromAai.getSerialNumber())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.serialNumber);
- att.setValue(String.valueOf( pnf_from_aai.getSerialNumber()));
+ att.setValue(String.valueOf( pnfFromAai.getSerialNumber()));
attributeList.add(att);
}
-
}
pnf.setAttributes(attributeList);
// Update P-Interface
- if ((pnf_from_aai.getPInterfaceInstanceList() != null)
- &&(pnf_from_aai.getPInterfaceInstanceList().getPInterfaceList().size()> 0)) {
+ if ((pnfFromAai.getPInterfaceInstanceList() != null)
+ &&(!(pnfFromAai.getPInterfaceInstanceList().getPInterfaceList().isEmpty()))) {
- List<PInterface> pInterfaceList = new ArrayList<PInterface>();
- List<PInterfaceInstance> pInterfaceInstList_aai = pnf_from_aai.getPInterfaceInstanceList().getPInterfaceList();
+ List<PInterface> pInterfaceList = new ArrayList<>();
+ List<PInterfaceInstance> pInterfaceInstList_aai = pnfFromAai.getPInterfaceInstanceList().getPInterfaceList();
for (PInterfaceInstance pInterfaceInst_aai : pInterfaceInstList_aai) {
PInterface pInterface = new PInterface();
pInterface.setUuid(pInterfaceInst_aai.getEquipmentIdentifier() );
pInterface.setName(pInterfaceInst_aai.getInterfaceName());
pInterface.setDataQuality(DataQuality.ok());
- List<Attribute> pInterface_attributeList = new ArrayList<Attribute>();
+ List<Attribute> pInterface_attributeList = new ArrayList<>();
updatePInterfaceAttributeList (pInterfaceInst_aai, pInterface_attributeList) ;
- if (pInterface_attributeList.size() > 0) {
+ if (!pInterface_attributeList.isEmpty()) {
pInterface.setAttributes(pInterface_attributeList);
}
pInterfaceList.add(pInterface);
}
- if (pInterfaceList.size() > 0) {
+ if (!pInterfaceList.isEmpty()) {
pnf.setPInterfaceList(pInterfaceList);
}
}
@@ -906,79 +1024,166 @@ public class RestUtil {
return pnfLst;
}
- private static void updatePInterfaceAttributeList(PInterfaceInstance pInterfaceInst_aai, List<Attribute> pInterface_attributeList ) {
+ /*
+ * Transform AAI Representation to Common Model
+ */
+ public static List<Network> transformL3Network(List<L3networkInstance> l3networkLstFromAAI) {
+ if ((l3networkLstFromAAI == null ) || (l3networkLstFromAAI.isEmpty())) {
+ log.info(LogMessages.API_CALL_LIST, "Nill L3-Network list");
+ return null;
+ }
+ List<Network> l3NetworkLst = new ArrayList<>();
+
+ for (L3networkInstance l3networkFromAai : l3networkLstFromAAI) {
+ Network l3network = new Network();
+ l3network.setUuid(l3networkFromAai.getNetworkId());
+ l3network.setName(l3networkFromAai.getNetworkName());
+ l3network.setModelVersionID(l3networkFromAai.getModelVersionId());
+ l3network.setModelInvariantUUID(l3networkFromAai.getModelInvariantId());
+ l3network.setDataQuality(DataQuality.ok());
+ List<Attribute> attributeList = new ArrayList<>();
+
+ // Iterate through the ENUM Attribute list
+ for (Attribute.Name name: Attribute.Name.values()) {
+ if ((name.name().equals(ATTRIBUTE_NETWORK_TYPE ))
+ && isValid(l3networkFromAai.getNetworkType())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.networkType);
+ att.setValue(String.valueOf( l3networkFromAai.getNetworkType()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_NETWORK_ROLE ))
+ && isValid(l3networkFromAai.getNetworkRole())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.networkRole);
+ att.setValue(String.valueOf( l3networkFromAai.getNetworkRole()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_NETWORK_TECHNOLOGY ))
+ && isValid(l3networkFromAai.getNetworkTechnology())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.networkTechnology);
+ att.setValue(String.valueOf( l3networkFromAai.getNetworkTechnology()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_RESOURCE_VERSION ))
+ && isValid(l3networkFromAai.getResourceVersion())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.resourceVersion);
+ att.setValue(String.valueOf( l3networkFromAai.getResourceVersion()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_PHYSICAL_NETWORK_NAME ))
+ && isValid(l3networkFromAai.getPhysicalNetworkName())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.physicalNetworkName);
+ att.setValue(String.valueOf( l3networkFromAai.getPhysicalNetworkName()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_SHARED_NETWORK_BOOLEAN ))
+ && isValid(l3networkFromAai.getSharedNetworkBoolean())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.sharedNetworkBoolean);
+ att.setValue(String.valueOf( l3networkFromAai.getSharedNetworkBoolean()));
+ attributeList.add(att);
+ }
+
+ }
+
+ if (!attributeList.isEmpty()) {
+ l3network.setAttributes(attributeList);
+ }
+
+ l3NetworkLst.add(l3network);
+ } // done the vnfInstance
+
+ return l3NetworkLst;
+ }
+
+ private static void updatePInterfaceAttributeList(PInterfaceInstance pInterfaceInstFromAai, List<Attribute> pInterfaceAttributeList ) {
// Iterate through the ENUM Attribute list
for (Attribute.Name name: Attribute.Name.values()) {
- if ((name.toString().equals(ATTRIBUTE_SPEED_VALUE ))
- &&(pInterfaceInst_aai.getSpeedValue() != null)){
+ if ((name.name().equals(ATTRIBUTE_SPEED_VALUE ))
+ && isValid(pInterfaceInstFromAai.getSpeedValue())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.speedValue);
- att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedValue()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getSpeedValue()));
+ pInterfaceAttributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_SPEED_UNITS ))
- &&(pInterfaceInst_aai.getSpeedUnits() != null)){
+ if ((name.name().equals(ATTRIBUTE_SPEED_UNITS ))
+ && isValid(pInterfaceInstFromAai.getSpeedUnits())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.speedUnits);
- att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedUnits()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getSpeedUnits()));
+ pInterfaceAttributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_PORT_DESCRIPTION ))
- &&(pInterfaceInst_aai.getPortDescription() != null)){
+ if ((name.name().equals(ATTRIBUTE_PORT_DESCRIPTION ))
+ && isValid(pInterfaceInstFromAai.getPortDescription())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.description);
- att.setValue(String.valueOf( pInterfaceInst_aai.getPortDescription()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getPortDescription()));
+ pInterfaceAttributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_EQUIPTMENT_ID ))
- &&(pInterfaceInst_aai.getEquipmentIdentifier() != null)){
+ if ((name.name().equals(ATTRIBUTE_EQUIPTMENT_ID ))
+ && isValid(pInterfaceInstFromAai.getEquipmentIdentifier())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.equipmentID);
- att.setValue(String.valueOf( pInterfaceInst_aai.getEquipmentIdentifier()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getEquipmentIdentifier()));
+ pInterfaceAttributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_INTERFACE_ROLE ))
- &&(pInterfaceInst_aai.getInterfaceRole() != null)){
+ if ((name.name().equals(ATTRIBUTE_INTERFACE_ROLE ))
+ && isValid(pInterfaceInstFromAai.getInterfaceRole())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.interfaceRole);
- att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceRole()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getInterfaceRole()));
+ pInterfaceAttributeList.add(att);
}
- if ((name.toString().equals(ATTRIBUTE_INTERFACE_TYPE ))
- &&(pInterfaceInst_aai.getInterfaceType() != null)){
+ if ((name.name().equals(ATTRIBUTE_INTERFACE_TYPE ))
+ && isValid(pInterfaceInstFromAai.getInterfaceType())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.interfaceType);
- att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceType()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getInterfaceType()));
+ pInterfaceAttributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_RESOURCE_VERSION ))
- &&(pInterfaceInst_aai.getResourceVersion() != null)){
+ if ((name.name().equals( ATTRIBUTE_RESOURCE_VERSION ))
+ && isValid(pInterfaceInstFromAai.getResourceVersion())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.resourceVersion);
- att.setValue(String.valueOf( pInterfaceInst_aai.getResourceVersion()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getResourceVersion()));
+ pInterfaceAttributeList.add(att);
}
- if ((name.toString().equals( ATTRIBUTE_LOCKEDBOOLEAN ))
- &&(pInterfaceInst_aai.getInMaint() != null)){
+ if ((name.name().equals( ATTRIBUTE_LOCKEDBOOLEAN ))
+ && isValid(pInterfaceInstFromAai.getInMaint())){
Attribute att = new Attribute();
att.setDataQuality(DataQuality.ok());
att.setName(Attribute.Name.lockedBoolean);
- att.setValue(String.valueOf( pInterfaceInst_aai.getInMaint()));
- pInterface_attributeList.add(att);
+ att.setValue(String.valueOf( pInterfaceInstFromAai.getInMaint()));
+ pInterfaceAttributeList.add(att);
}
}
return;
@@ -990,7 +1195,7 @@ public class RestUtil {
* the value of the attribute "hostname" from the last substring of the "related-link"
* {
* "related-to": "pserver",
- * "related-link": "/aai/v11/cloud-infrastructure/pservers/pserver/rdm5r10c008.rdm5a.cci.att.com",
+ * "related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/rdm5r10c008.rdm5a.cci.att.com",
* "relationship-data": [ {
* "relationship-key": "pserver.hostname",
* "relationship-value": "rdm5r10c008.rdm5a.cci.att.com"
@@ -1018,7 +1223,7 @@ public class RestUtil {
* Get the last substring from the related-link
* For example the value of the attribute "hostname" will be "rdm5r10c008.rdm5a.cci.att.com"
* "related-to": "pserver",
- * "related-link": "/aai/v11/cloud-infrastructure/pservers/pserver/rdm5r10c008.rdm5a.cci.att.com",
+ * "related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/rdm5r10c008.rdm5a.cci.att.com",
*/
private static String extractAttValue(String relatedLink) {
return relatedLink.substring(relatedLink.lastIndexOf("/")+1);
@@ -1089,7 +1294,7 @@ public class RestUtil {
* Extract the related-Link from Json payload. For example
* {
* "related-to": "vnfc",
- * "related-link": "/aai/v11/network/vnfcs/vnfc/zrdm5aepdg01vmg003",
+ * "related-link": "/aai/v13/network/vnfcs/vnfc/zrdm5aepdg01vmg003",
* "relationship-data": [
* { "relationship-key": "vnfc.vnfc-name",
* "relationship-value": "zrdm5aepdg01vmg003" }
@@ -1099,7 +1304,7 @@ public class RestUtil {
private static List<String> extractRelatedLink(String payload, String catalog) {
JSONObject jsonPayload = new JSONObject(payload);
JSONArray relationships = null;
- List<String> relatedLinkList = new ArrayList<String>();
+ List<String> relatedLinkList = new ArrayList<>();
log.debug("Fetching the related link");
try {
@@ -1142,7 +1347,7 @@ public class RestUtil {
*/
private static Map<String, List<String>> extractRelatedLinkFromVfmodule(String payload, String catalog) {
- Map<String, List<String>> vServerRelatedLinkMap = new HashMap<String, List<String>>();
+ Map<String, List<String>> vServerRelatedLinkMap = new HashMap<>();
JSONObject jsonPayload = new JSONObject(payload);
JSONArray vfmoduleArray = null;
@@ -1161,13 +1366,13 @@ public class RestUtil {
}
if (vfmoduleArray != null && vfmoduleArray.length() > 0) {
- vServerRelatedLinkMap = handleRelationship_vserver(vfmoduleArray, jsonPayload, catalog);
+ vServerRelatedLinkMap = handleRelationshipVserver(vfmoduleArray, jsonPayload, catalog);
}
return vServerRelatedLinkMap;
}
- private static List<String> handleRelationship_general(String payload_str, String catalog) {
+ private static List<String> handleRelationshipGeneral(String payload_str, String catalog) {
if (payload_str == null) {
return null;
@@ -1180,7 +1385,7 @@ public class RestUtil {
try {
JSONObject relationshipList = jsonPayload.getJSONObject(RELATIONSHIP_LIST);
if (relationshipList != null) {
- relatedLinkList = new ArrayList<String>();
+ relatedLinkList = new ArrayList<>();
relationships = relationshipList.getJSONArray(RELATIONSHIP);
}
} catch (JSONException e) {
@@ -1206,12 +1411,12 @@ public class RestUtil {
return relatedLinkList;
}
- private static Map<String, List<String>> handleRelationship_vserver(JSONArray vfmoduleArray, JSONObject vnf_jsonPayload, String catalog) {
- Map<String, List<String>> vServerRelatedLinkMap = new HashMap<String, List<String>>();
+ private static Map<String, List<String>> handleRelationshipVserver(JSONArray vfmoduleArray, JSONObject vnf_jsonPayload, String catalog) {
+ Map<String, List<String>> vServerRelatedLinkMap = new HashMap<>();
JSONArray relationships = null;
// If there are multiple vf-module, but one of vf-module missing relationship, we should log the exception and keep loop
for (int i = 0; i < vfmoduleArray.length(); i++) {
- List<String> relatedLinkList = new ArrayList<String>();
+ List<String> relatedLinkList = new ArrayList<>();
JSONObject obj = vfmoduleArray.optJSONObject(i);
String key = (String)obj.get("vf-module-id") + DELIMITER
+ (String)obj.get("model-invariant-id");
@@ -1252,7 +1457,7 @@ public class RestUtil {
}
private static Map<String, List<String>> buildHeaders(String aaiBasicAuthorization, String transactionId) {
- MultivaluedHashMap<String, String> headers = new MultivaluedHashMap<String, String>();
+ MultivaluedHashMap<String, String> headers = new MultivaluedHashMap<>();
headers.put(TRANSACTION_ID, Collections.singletonList(transactionId));
headers.put(FROM_APP_ID, Collections.singletonList(APP_NAME));
headers.put(AUTHORIZATION, Collections.singletonList(aaiBasicAuthorization));
@@ -1303,15 +1508,14 @@ public class RestUtil {
* "result-data": [
* {
* "resource-type": "service-instance",
- * "resource-link": "/aai/v11/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb"
+ * "resource-link": "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb"
* }
* ]
* }
*/
private static String extractResourceLinkBasedOnResourceType(String payload, String catalog) throws AuditException {
String resourceLink = null;
- log.info("Fetching the resource-link based on resource-type=" + catalog);
-
+ log.info(String.format("Fetching the resource-link based on resource-type= %s", catalog));
try {
JSONArray result_data_list = new JSONObject(payload).getJSONArray(RESULT_DATA);
if (result_data_list != null) {
@@ -1333,4 +1537,17 @@ public class RestUtil {
return resourceLink;
}
+
+ private static boolean isValid ( String inputField) {
+ if (inputField == null) {
+ return false;
+ }
+ String localInputField = inputField.trim();
+
+ if (localInputField.equals("")) {
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
index f808ebe..5ded51f 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
@@ -47,6 +47,7 @@ import org.onap.pomba.common.datatypes.ModelContext;
import org.onap.pomba.common.datatypes.VNF;
import org.onap.pomba.common.datatypes.VFModule;
import org.onap.pomba.common.datatypes.VM;
+import org.onap.pomba.common.datatypes.Network;
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
@@ -282,4 +283,128 @@ public class RestUtilTest {
assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getName(), "bdc3cc2a-c73e-414f-7ddb-367de92801cb"); //interface-name
}
+ ///Verify the relationship serviceInstanceId -> l3network
+ @Test
+ public void testretrieveAAIModelDataFromAAI_L3_network_in_service_level () throws Exception {
+
+ String transactionId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
+ addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ // 2. simulate the response of AAI (1 vnf)
+ // note: match serviceInstanceId in (1)
+ addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "junit/aai-service-instance_set3.json", aaiEnricherRule);
+
+ // 3. simulate the rsp of l3-network
+ // note: match to network-id to the path of "l3network" in (2: aai-service-instance_set3)
+ addResponse(
+ "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1" + DEPTH,
+ "junit/l3-network-1.json", aaiEnricherRule);
+ addResponse(
+ "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-2" + DEPTH,
+ "junit/l3-network-2.json", aaiEnricherRule);
+
+
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+
+ // verify results
+ List<Network> networkList = modelCtx.getNetworkList();
+ assertEquals(networkList.size(), 2);
+ assertEquals(networkList.get(0).getUuid(), "01e8d84a-l3-network-1");
+ assertEquals(networkList.get(1).getUuid(), "01e8d84a-l3-network-2");
+ }
+
+ ///Verify the relationship serviceInstanceId -> vnf -> l3network
+ @Test
+ public void testretrieveAAIModelDataFromAAI_L3_network_in_VNF_level() throws Exception {
+
+ String transactionId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
+ addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ // 2. simulate the response of AAI (1 vnf)
+ // note: match serviceInstanceId in (1)
+ addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "junit/aai-service-instance_set2.json", aaiEnricherRule);
+
+ // 3. simulate the rsp of VNF (with 1 vserver)
+ // note: match vnf_id in (2)
+ addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
+ "junit/genericVnfInput_set3.json", aaiEnricherRule);
+
+ // 4. simulate the rsp of vserer
+ // note: match to vserver-id to the path of "vserver" in (3)
+ addResponse(
+ "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
+ + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a",
+ "junit/aai-vserver-set2.json", aaiEnricherRule);
+
+ // 5. simulate the rsp of l3-network
+ // note: match to network-id to the path of "l3network" in (3: genericVnfInput_set3)
+ addResponse(
+ "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1" + DEPTH,
+ "junit/l3-network-1.json", aaiEnricherRule);
+
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+
+ // verify results
+ List<VNF> vnfList = modelCtx.getVnfs();
+ assertEquals(vnfList.size(), 1);
+ List<Network> networkList = vnfList.get(0).getNetworks();
+ assertEquals(networkList.size(), 1);
+ assertEquals(networkList.get(0).getUuid(), "01e8d84a-l3-network-1");
+ }
+
+ @Test
+ public void testretrieveAAIModelDataFromAAI_L3_network_in_vModule_level() throws Exception {
+
+ String transactionId = UUID.randomUUID().toString();
+ String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
+ String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
+ // 1. simulate the response to obtainResourceLink based on ServiceInstanceId
+ addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
+ // 2. simulate the response of AAI (1 vnf)
+ // note: match serviceInstanceId in (1)
+ addResponse( "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "junit/aai-service-instance_set2.json", aaiEnricherRule);
+
+ // 3. simulate the rsp of VNF (with 1 vserver)
+ // note: match vnf_id in (2)
+ addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
+ "junit/genericVnfInput_set4.json", aaiEnricherRule);
+
+ // 4. simulate the rsp of vserer
+ // note: match to vserver-id to the path of "vserver" in (3)
+ addResponse(
+ "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
+ + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a",
+ "junit/aai-vserver-set2.json", aaiEnricherRule);
+
+ // 5. simulate the rsp of l3-network
+ // note: match to network-id to the path of "l3network" in (3: genericVnfInput_set4)
+ addResponse(
+ "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1" + DEPTH,
+ "junit/l3-network-1.json", aaiEnricherRule);
+ addResponse(
+ "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-2" + DEPTH,
+ "junit/l3-network-2.json", aaiEnricherRule);
+
+
+ ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
+
+ // verify results
+ List<VNF> vnfList = modelCtx.getVnfs();
+ assertEquals(vnfList.size(), 1);
+ List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
+ assertEquals(vfModuleList.size(), 1);
+
+ List<Network> networkList = vfModuleList.get(0).getNetworks();
+ assertEquals(networkList.size(), 2);
+ assertEquals(networkList.get(0).getUuid(), "01e8d84a-l3-network-1");
+ assertEquals(networkList.get(1).getUuid(), "01e8d84a-l3-network-2");
+ }
+
}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
index b79f8ca..77da591 100644
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
+++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
+import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance;
import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
@@ -53,7 +54,7 @@ public class VfModuleTest {
vfModule.setRelationshipList(relationshipList);
assertEquals("vfModuleId", vfModule.getVfModuleId());
- assertEquals("vfModuleName", vfModule.getVfMduleName());
+ assertEquals("vfModuleName", vfModule.getVfModuleName());
assertEquals("heatStackId", vfModule.getHeatStackId());
assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
assertTrue(vfModule.getIsBaseVfModule());
@@ -67,10 +68,10 @@ public class VfModuleTest {
@Test
public void testVfModuleWithParameters() {
- VfModule vfModule = new VfModule("vfModuleId", "vfModuleName", "heatStackId", "orchestrationStatus", true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", 1, new RelationshipList() );
+ VfModule vfModule = new VfModule("vfModuleId", "vfModuleName", "heatStackId", "orchestrationStatus", true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
assertEquals("vfModuleId", vfModule.getVfModuleId());
- assertEquals("vfModuleName", vfModule.getVfMduleName());
+ assertEquals("vfModuleName", vfModule.getVfModuleName());
assertEquals("heatStackId", vfModule.getHeatStackId());
assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
assertTrue(vfModule.getIsBaseVfModule());
@@ -87,9 +88,9 @@ public class VfModuleTest {
@Test
public void testVfModuleEquals() {
- VfModule vfModule1 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() );
- VfModule vfModule2 = new VfModule("vfModuleId2", "vfModuleName2", "heatStackId2", "orchestrationStatus2", true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", 1, new RelationshipList() );
- VfModule vfModule3 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() );
+ VfModule vfModule1 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
+ VfModule vfModule2 = new VfModule("vfModuleId2", "vfModuleName2", "heatStackId2", "orchestrationStatus2", true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
+ VfModule vfModule3 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
assertTrue(vfModule1.equals(vfModule1));
assertTrue(!vfModule1.equals(vfModule2));
diff --git a/src/test/resources/junit/aai-service-instance_set3.json b/src/test/resources/junit/aai-service-instance_set3.json
new file mode 100644
index 0000000..7700adf
--- /dev/null
+++ b/src/test/resources/junit/aai-service-instance_set3.json
@@ -0,0 +1,43 @@
+{
+ "service-instance-id": "adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "service-instance-name": "Firewall1",
+ "model-invariant-id": "0c5a20de-87ad-442c-9190-f38ab0a6bb7f",
+ "model-version-id": "d3d6cf83-d03a-43cc-99ff-206d40bb9a72",
+ "resource-version": "1527637758480",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1",
+ "relationship-data": [
+ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01e8d84a-l3-network-1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "l3-network.network-name",
+ "property-value": "NET_1106"
+ }
+ ]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-2",
+ "relationship-data": [
+ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01e8d84a-l3-network-2"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "l3-network.network-name",
+ "property-value": "NET_1108"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/src/test/resources/junit/aai-vserver-set2.json b/src/test/resources/junit/aai-vserver-set2.json
new file mode 100644
index 0000000..aff20f1
--- /dev/null
+++ b/src/test/resources/junit/aai-vserver-set2.json
@@ -0,0 +1,78 @@
+{
+ "vserver-id": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a",
+ "vserver-name": "Firewall-0",
+ "vserver-name2": "Firewall-0",
+ "prov-status": "ACTIVE",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/b49b830686654191bb1e952a74b014ad/servers/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1528481820321",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "generic-vnf",
+ "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "8a9ddb25-2e79-449c-a40d-5011bac0da39"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "Firewall-1"
+ }
+ ]
+ },
+ {
+ "related-to": "flavor",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "flavor.flavor-id",
+ "relationship-value": "764efb04-5a46-4806-a766-2bdd24559f39"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "flavor.flavor-name",
+ "property-value": "m1.medium"
+ }
+ ]
+ },
+ {
+ "related-to": "image",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "image.image-id",
+ "relationship-value": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "image.image-name",
+ "property-value": "unknown"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/src/test/resources/junit/aai-vserver.json b/src/test/resources/junit/aai-vserver.json
index 66f7639..c1bb18e 100644
--- a/src/test/resources/junit/aai-vserver.json
+++ b/src/test/resources/junit/aai-vserver.json
@@ -27,7 +27,7 @@
},
{
"related-to": "generic-vnf",
- "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39",
+ "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39",
"relationship-data": [
{
"relationship-key": "generic-vnf.vnf-id",
@@ -43,7 +43,7 @@
},
{
"related-to": "flavor",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39",
"relationship-data": [
{
"relationship-key": "cloud-region.cloud-owner",
@@ -67,7 +67,7 @@
},
{
"related-to": "image",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b",
"relationship-data": [
{
"relationship-key": "cloud-region.cloud-owner",
diff --git a/src/test/resources/junit/genericVnfInput.json b/src/test/resources/junit/genericVnfInput.json
index aac8bd6..6cbad88 100644
--- a/src/test/resources/junit/genericVnfInput.json
+++ b/src/test/resources/junit/genericVnfInput.json
@@ -19,7 +19,7 @@
"relationship": [
{
"related-to": "service-instance",
- "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "related-link": "/aai/v13/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
"relationship-data": [
{
"relationship-key": "customer.global-customer-id",
@@ -40,40 +40,6 @@
"property-value": "Firewall1"
}
]
- },
- {
- "related-to": "l3-network",
- "relationship-label": "org.onap.relationships.inventory.Uses",
- "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951870",
- "relationship-data": [
- {
- "relationship-key": "l3-network.network-id",
- "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951870"
- }
- ],
- "related-to-property": [
- {
- "property-key": "l3-network.network-name",
- "property-value": "HNPORTALOAM.OAM"
- }
- ]
- },
- {
- "related-to": "l3-network",
- "relationship-label": "org.onap.relationships.inventory.Uses",
- "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951872",
- "relationship-data": [
- {
- "relationship-key": "l3-network.network-id",
- "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951872"
- }
- ],
- "related-to-property": [
- {
- "property-key": "l3-network.network-name",
- "property-value": "HNPORTAL_SRIOV_2"
- }
- ]
}
]
},
diff --git a/src/test/resources/junit/genericVnfInput_set2.json b/src/test/resources/junit/genericVnfInput_set2.json
index dfdc0cc..0f511f8 100644
--- a/src/test/resources/junit/genericVnfInput_set2.json
+++ b/src/test/resources/junit/genericVnfInput_set2.json
@@ -41,7 +41,7 @@
},
{
"related-to": "service-instance",
- "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "related-link": "/aai/v13/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
"relationship-data": [
{
"relationship-key": "customer.global-customer-id",
@@ -62,40 +62,6 @@
"property-value": "Firewall1"
}
]
- },
- {
- "related-to": "l3-network",
- "relationship-label": "org.onap.relationships.inventory.Uses",
- "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951870",
- "relationship-data": [
- {
- "relationship-key": "l3-network.network-id",
- "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951870"
- }
- ],
- "related-to-property": [
- {
- "property-key": "l3-network.network-name",
- "property-value": "HNPORTALOAM.OAM"
- }
- ]
- },
- {
- "related-to": "l3-network",
- "relationship-label": "org.onap.relationships.inventory.Uses",
- "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951872",
- "relationship-data": [
- {
- "relationship-key": "l3-network.network-id",
- "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951872"
- }
- ],
- "related-to-property": [
- {
- "property-key": "l3-network.network-name",
- "property-value": "HNPORTAL_SRIOV_2"
- }
- ]
}
]
},
diff --git a/src/test/resources/junit/genericVnfInput_set3.json b/src/test/resources/junit/genericVnfInput_set3.json
new file mode 100644
index 0000000..45a5d83
--- /dev/null
+++ b/src/test/resources/junit/genericVnfInput_set3.json
@@ -0,0 +1,100 @@
+{
+ "vnf-id": "8a9ddb25-2e79-449c-a40d-5011bac0da39",
+ "vnf-name": "Firewall-1",
+ "vnf-type": "vFW-vSINK-service/vFWvSINK 0",
+ "service-id": "8ea56b0d-459d-4668-b363-c9567432d8b7",
+ "prov-status": "PREPROV",
+ "orchestration-status": "Created",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1527637940029",
+ "model-invariant-id": "59dd4d63-8f21-406c-98c0-3b057bb86820",
+ "model-version-id": "e2d52f32-a952-46f5-800c-c250903625d6",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "nf-type": "",
+ "nf-function": "",
+ "nf-role": "",
+ "nf-naming-code": "",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "b49b830686654191bb1e952a74b014ad"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"
+ }
+ ]
+ },
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v13/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "Demonstration"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "vFWCL"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "adc3cc2a-c73e-414f-8ddb-367de81300cb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "Firewall1"
+ }
+ ]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1",
+ "relationship-data": [
+ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01e8d84a-l3-network-1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "l3-network.network-name",
+ "property-value": "NET_1106"
+ }
+ ]
+ }
+ ]
+ },
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "1563b649-9e05-4288-b7d9-e3639a54ace6",
+ "vf-module-name": "vFW_SINC_Module-2",
+ "heat-stack-id": "vFW_SINC_Module-2/41c4533a-748d-4cf4-a8d3-eccdd0aeb0d4",
+ "orchestration-status": "active",
+ "is-base-vf-module": true,
+ "resource-version": "1527638439198",
+ "model-invariant-id": "74bc1518-282d-4148-860f-8892b6369456",
+ "model-version-id": "4e3d28cf-d654-41af-a47b-04b4bd0ac58e",
+ "model-customization-id": "cc51ab7d-9b03-4bd6-9104-09df0c7c7907",
+ "module-index": 0
+ }
+ ]
+ }
+}
diff --git a/src/test/resources/junit/genericVnfInput_set4.json b/src/test/resources/junit/genericVnfInput_set4.json
new file mode 100644
index 0000000..3d41e42
--- /dev/null
+++ b/src/test/resources/junit/genericVnfInput_set4.json
@@ -0,0 +1,120 @@
+{
+ "vnf-id": "8a9ddb25-2e79-449c-a40d-5011bac0da39",
+ "vnf-name": "Firewall-1",
+ "vnf-type": "vFW-vSINK-service/vFWvSINK 0",
+ "service-id": "8ea56b0d-459d-4668-b363-c9567432d8b7",
+ "prov-status": "PREPROV",
+ "orchestration-status": "Created",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1527637940029",
+ "model-invariant-id": "59dd4d63-8f21-406c-98c0-3b057bb86820",
+ "model-version-id": "e2d52f32-a952-46f5-800c-c250903625d6",
+ "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "nf-type": "",
+ "nf-function": "",
+ "nf-role": "",
+ "nf-naming-code": "",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "b49b830686654191bb1e952a74b014ad"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"
+ }
+ ]
+ },
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v13/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "Demonstration"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "vFWCL"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "adc3cc2a-c73e-414f-8ddb-367de81300cb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "Firewall1"
+ }
+ ]
+ }
+ ]
+ },
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "1563b649-9e05-4288-b7d9-e3639a54ace6",
+ "vf-module-name": "vFW_SINC_Module-2",
+ "heat-stack-id": "vFW_SINC_Module-2/41c4533a-748d-4cf4-a8d3-eccdd0aeb0d4",
+ "orchestration-status": "active",
+ "is-base-vf-module": true,
+ "resource-version": "1527638439198",
+ "model-invariant-id": "74bc1518-282d-4148-860f-8892b6369456",
+ "model-version-id": "4e3d28cf-d654-41af-a47b-04b4bd0ac58e",
+ "model-customization-id": "cc51ab7d-9b03-4bd6-9104-09df0c7c7907",
+ "module-index": 0,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1",
+ "relationship-data": [
+ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01e8d84a-l3-network-1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "l3-network.network-name",
+ "property-value": "NET_1106"
+ }
+ ]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-2",
+ "relationship-data": [
+ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "01e8d84a-l3-network-2"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "l3-network.network-name",
+ "property-value": "NET_1108"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
diff --git a/src/test/resources/junit/l3-network-1.json b/src/test/resources/junit/l3-network-1.json
new file mode 100644
index 0000000..2a1630c
--- /dev/null
+++ b/src/test/resources/junit/l3-network-1.json
@@ -0,0 +1,93 @@
+{
+ "network-id" : "01e8d84a-l3-network-1",
+ "network-name" : "NET_1106",
+ "network-type" : "Network_Type_1",
+ "network-role" : "Network_Role_1",
+ "network-technology" : "Network_Technology_1",
+ "physical-network-name" : "physical-network-name-1",
+ "resource-version" : "1547484061986-1",
+ "model-invariant-id" : "pomba-model-invariant-001",
+ "model-version-id" : "pomba-model-version-001",
+ "model-customization-id" : "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "is-provider-network" : false,
+ "is-shared-network" : true,
+ "is-external-network" : false,
+ "relationship-list" : {
+ "relationship" : [ {
+ "related-to" : "service-instance",
+ "related-link" : "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "relationship-data" : [ {
+ "relationship-key" : "service-instance.service-instance-id",
+ "relationship-value" : "adc3cc2a-c73e-414f-8ddb-367de81300cb"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "service-instance.service-instance-name",
+ "property-value" : "Firewall1"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_001-VNF-id-001-2",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_001-VNF-id-001-2"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-2"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-1"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002-2",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-2"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-2"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_001-VNF-id-001",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_001-VNF-id-001"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-1"
+ } ]
+ }, {
+ "related-to" : "vf-module",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002-2/vf-modules/vf-module/PombaDemoCust_002-VNF-id-002-VfModule002",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-2"
+ }, {
+ "relationship-key" : "vf-module.vf-module-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-VfModule002"
+ } ]
+ }, {
+ "related-to" : "vf-module",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002/vf-modules/vf-module/PombaDemoCust_002-VNF-id-002-VfModule002",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002"
+ }, {
+ "relationship-key" : "vf-module.vf-module-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-VfModule002"
+ } ]
+ } ]
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/junit/l3-network-2.json b/src/test/resources/junit/l3-network-2.json
new file mode 100644
index 0000000..bb4e634
--- /dev/null
+++ b/src/test/resources/junit/l3-network-2.json
@@ -0,0 +1,93 @@
+{
+ "network-id" : "01e8d84a-l3-network-2",
+ "network-name" : "NET_1108",
+ "network-type" : "Network_Type_2",
+ "network-role" : "Network_Role_2",
+ "network-technology" : "Network_Technology_2",
+ "physical-network-name" : "physical-network-name-2",
+ "resource-version" : "1547484061986-2",
+ "model-invariant-id" : "pomba-model-invariant-002",
+ "model-version-id" : "pomba-model-version-002",
+ "model-customization-id" : "3b822416-475d-4e1c-aac3-2544b0a0fdfc",
+ "is-provider-network" : false,
+ "is-shared-network" : true,
+ "is-external-network" : false,
+ "relationship-list" : {
+ "relationship" : [ {
+ "related-to" : "service-instance",
+ "related-link" : "/aai/v13/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb",
+ "relationship-data" : [ {
+ "relationship-key" : "service-instance.service-instance-id",
+ "relationship-value" : "adc3cc2a-c73e-414f-8ddb-367de81300cb"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "service-instance.service-instance-name",
+ "property-value" : "Firewall1"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_001-VNF-id-001-2",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_001-VNF-id-001-2"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-2"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-1"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002-2",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-2"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-2"
+ } ]
+ }, {
+ "related-to" : "generic-vnf",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_001-VNF-id-001",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_001-VNF-id-001"
+ } ],
+ "related-to-property" : [ {
+ "property-key" : "generic-vnf.vnf-name",
+ "property-value" : "Firewall-1"
+ } ]
+ }, {
+ "related-to" : "vf-module",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002-2/vf-modules/vf-module/PombaDemoCust_002-VNF-id-002-VfModule002",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-2"
+ }, {
+ "relationship-key" : "vf-module.vf-module-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-VfModule002"
+ } ]
+ }, {
+ "related-to" : "vf-module",
+ "related-link" : "/aai/v13/network/generic-vnfs/generic-vnf/PombaDemoCust_002-VNF-id-002/vf-modules/vf-module/PombaDemoCust_002-VNF-id-002-VfModule002",
+ "relationship-data" : [ {
+ "relationship-key" : "generic-vnf.vnf-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002"
+ }, {
+ "relationship-key" : "vf-module.vf-module-id",
+ "relationship-value" : "PombaDemoCust_002-VNF-id-002-VfModule002"
+ } ]
+ } ]
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/junit/queryNodeData-nullResourceLink.json b/src/test/resources/junit/queryNodeData-nullResourceLink.json
index 36eb667..5b7a272 100644
--- a/src/test/resources/junit/queryNodeData-nullResourceLink.json
+++ b/src/test/resources/junit/queryNodeData-nullResourceLink.json
@@ -2,7 +2,7 @@
"result-data": [
{
"resource-type": "service-instance",
- "related-link": "/aai/v11/network/vnfcs/vnfc/zrdm5aepdg01vmg003"
+ "related-link": "/aai/v13/network/vnfcs/vnfc/zrdm5aepdg01vmg003"
}
]
}