aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-02-27 13:31:33 -0500
committerLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-02-27 15:23:45 -0500
commitd20e0ddf4b8953ce539f1dc7bf7cb4dca30fd189 (patch)
tree721825ccdcce64ad85437742cb97c039fe5e0b8a /src/main/java/org
parent15c6cfa5faaa3445e7fdad2650d72c76dda1e0b9 (diff)
AaiCtxBuilder:Handle L-Interface & Logical-Link
Also remove resourceVersion and handle empty valude of any attribute (LOG-988) Issue-ID: LOG-988 Issue-ID: LOG-766 Issue-ID: LOG-767 Change-Id: I8b3eef61cebf93690aaa0291f8d0a7c1e3575088 Signed-off-by: Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstance.java29
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstanceList.java81
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LogicalLinkInstance.java351
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PInterfaceInstance.java42
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java1
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java23
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java35
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java423
8 files changed, 868 insertions, 117 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstance.java
index db992b1..fdac64e 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstance.java
@@ -23,6 +23,9 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -56,6 +59,18 @@ public class LInterfaceInstance {
@SerializedName("in-maint")
@Expose
private String inMaint;
+ @SerializedName("relationship-list")
+ @Expose
+ private RelationshipList relationshipList;
+
+ private List<LogicalLinkInstance> logicalLinkInstanceList;
+ public List<LogicalLinkInstance> getLogicalLinkInstanceList() {
+ return logicalLinkInstanceList;
+ }
+
+ public void setLogicalLinkInstanceList(List<LogicalLinkInstance> logicalLinkInstanceList) {
+ this.logicalLinkInstanceList = logicalLinkInstanceList;
+ }
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
@@ -127,6 +142,14 @@ public class LInterfaceInstance {
this.inMaint = inMaint;
}
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
public static LInterfaceInstance fromJson(String payload) throws AuditException {
try {
if (payload == null || payload.isEmpty()) {
@@ -159,7 +182,7 @@ public class LInterfaceInstance {
*/
public LInterfaceInstance(String interfaceId, String interfaceName, String interfaceRole,
String isPortMirrored, String adminStatus, String networkName,
- String macAddr,String inMaint
+ String macAddr,String inMaint, RelationshipList relationshipList
) {
super();
this.interfaceId = interfaceId;
@@ -170,6 +193,7 @@ public class LInterfaceInstance {
this.networkName = networkName;
this.macAddr = macAddr;
this.inMaint = inMaint;
+ this.relationshipList = relationshipList;
}
@@ -186,6 +210,7 @@ public class LInterfaceInstance {
.append("networkName", networkName)
.append("macAddr", macAddr)
.append("inMaint", inMaint)
+ .append("relationshipList", relationshipList)
.toString();
}
@@ -200,6 +225,7 @@ public class LInterfaceInstance {
.append(networkName)
.append(macAddr)
.append(inMaint)
+ .append(relationshipList)
.toHashCode();
}
@@ -221,6 +247,7 @@ public class LInterfaceInstance {
.append(networkName, rhs.networkName)
.append(macAddr, rhs.macAddr)
.append(inMaint, rhs.inMaint)
+ .append(relationshipList, rhs.relationshipList)
.isEquals();
}
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstanceList.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstanceList.java
new file mode 100644
index 0000000..20cd44d
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LInterfaceInstanceList.java
@@ -0,0 +1,81 @@
+/*
+ * ============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.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;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class LInterfaceInstanceList {
+
+ @SerializedName("l-interface")
+ @Expose
+ @Valid
+ private List<LInterfaceInstance> lInterfaceList = null;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public LInterfaceInstanceList() {
+ }
+
+ /**
+ *
+ * @param lInterfaceList
+ */
+ public LInterfaceInstanceList(List<LInterfaceInstance> lInterfaceList) {
+ super();
+ this.lInterfaceList = lInterfaceList;
+ }
+
+ public List<LInterfaceInstance> getLInterfaceList() {
+ return lInterfaceList;
+ }
+
+ public void setLInterfaceList(List<LInterfaceInstance> lInterfaceList) {
+ this.lInterfaceList = lInterfaceList;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("lInterfaceList", lInterfaceList).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(lInterfaceList).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof LInterfaceInstanceList)) {
+ return false;
+ }
+ LInterfaceInstanceList rhs = ((LInterfaceInstanceList) other);
+ return new EqualsBuilder().append(lInterfaceList, rhs.lInterfaceList).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LogicalLinkInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LogicalLinkInstance.java
new file mode 100644
index 0000000..718dfd3
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/LogicalLinkInstance.java
@@ -0,0 +1,351 @@
+/*
+ * ============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 LogicalLinkInstance {
+ @SerializedName("link-name")
+ @Expose
+ private String linkName;
+ @SerializedName("link-id")
+ @Expose
+ private String linkId;
+ @SerializedName("model-version-id")
+ @Expose
+ private String modelVersionId;
+ @SerializedName("model-invariant-id")
+ @Expose
+ private String modelInvariantId;
+ @SerializedName("in-maint")
+ @Expose
+ private String inMaint;
+ @SerializedName("link-type")
+ @Expose
+ private String linkType;
+ @SerializedName("routing-protocol")
+ @Expose
+ private String routingProtocol;
+ @SerializedName("speed-value")
+ @Expose
+ private String speedValue;
+ @SerializedName("speed-units")
+ @Expose
+ private String speedUnits;
+ @SerializedName("ip-version")
+ @Expose
+ private String ipVersion;
+ @SerializedName("prov-status")
+ @Expose
+ private String provStatus;
+ @SerializedName("link-role")
+ @Expose
+ private String linkRole;
+ @SerializedName("link-name2")
+ @Expose
+ private String linkName2;
+ @SerializedName("circuit-id")
+ @Expose
+ @Valid
+ private String circuitId;
+ @SerializedName("purpose")
+ @Expose
+ @Valid
+ private String purpose;
+
+
+ public String getLinkName() {
+ return linkName;
+ }
+
+
+ public void setLinkName(String linkName) {
+ this.linkName = linkName;
+ }
+
+
+ public String getLinkId() {
+ return linkId;
+ }
+
+
+ public void setLinkId(String linkId) {
+ this.linkId = linkId;
+ }
+
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+
+ public String getInMaint() {
+ return inMaint;
+ }
+
+
+ public void setInMaint(String inMaint) {
+ this.inMaint = inMaint;
+ }
+
+
+ public String getLinkType() {
+ return linkType;
+ }
+
+
+ public void setLinkType(String linkType) {
+ this.linkType = linkType;
+ }
+
+
+ public String getRoutingProtocol() {
+ return routingProtocol;
+ }
+
+
+ public void setRoutingProtocol(String routingProtocol) {
+ this.routingProtocol = routingProtocol;
+ }
+
+
+ public String getSpeedValue() {
+ return speedValue;
+ }
+
+
+ public void setSpeedValue(String speedValue) {
+ this.speedValue = speedValue;
+ }
+
+
+ public String getSpeedUnits() {
+ return speedUnits;
+ }
+
+
+ public void setSpeedUnits(String speedUnits) {
+ this.speedUnits = speedUnits;
+ }
+
+
+ public String getIpVersion() {
+ return ipVersion;
+ }
+
+
+ public void setIpVersion(String ipVersion) {
+ this.ipVersion = ipVersion;
+ }
+
+
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+
+
+ public String getLinkRole() {
+ return linkRole;
+ }
+
+
+ public void setLinkRole(String linkRole) {
+ this.linkRole = linkRole;
+ }
+
+
+ public String getLinkName2() {
+ return linkName2;
+ }
+
+
+ public void setLinkName2(String linkName2) {
+ this.linkName2 = linkName2;
+ }
+
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+
+ public String getPurpose() {
+ return purpose;
+ }
+
+
+ public void setPurpose(String purpose) {
+ this.purpose = purpose;
+ }
+
+ private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+
+ public String toJson() {
+ return gson.toJson(this);
+ }
+
+
+ public static LogicalLinkInstance fromJson(String payload) throws AuditException {
+ try {
+ if (payload == null || payload.isEmpty()) {
+ throw new AuditException("Empty Json response");
+ }
+ return gson.fromJson(payload, LogicalLinkInstance.class);
+ } catch (Exception ex) {
+ throw new AuditException(AuditError.JSON_READER_PARSE_ERROR, ex);
+ }
+ }
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public LogicalLinkInstance() {
+ }
+
+ /**
+ *
+ * @param linkName
+ * @param linkId
+ * @param modelVersionId
+ * @param modelInvariantId
+ * @param linkType
+ * @param routingProtocol
+ * @param speedValue
+ * @param speedUnits
+ * @param provStatus
+ * @param inMaint
+ * @param linkRole
+ * @param ipVersion
+ * @param linkName2
+ *
+ */
+ public LogicalLinkInstance(String linkName, String linkId, String modelVersionId,
+ String modelInvariantId, String linkType,String routingProtocol,
+ String speedValue,String speedUnits,String provStatus,
+ String inMaint, String linkRole, String ipVersion,
+ String linkName2, String circuitId, String purpose) {
+ super();
+ this.linkName = linkName;
+ this.linkId = linkId;
+ this.modelVersionId = modelVersionId;
+ this.modelInvariantId = modelInvariantId;
+ this.linkType = linkType;
+ this.routingProtocol = routingProtocol;
+ this.speedValue = speedValue;
+ this.speedUnits = speedUnits;
+ this.provStatus = provStatus;
+ this.inMaint = inMaint;
+ this.linkRole = linkRole;
+ this.ipVersion = ipVersion;
+ this.linkName2 = linkName2;
+ this.circuitId = circuitId;
+ this.purpose = purpose;
+ }
+
+
+
+ /////////// common functions //////////////////////
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("linkName", linkName)
+ .append("linkId", linkId)
+ .append("modelInvariantId", modelInvariantId)
+ .append("modelVersionId", modelVersionId)
+ .append("linkType", linkType)
+ .append("routingProtocol", routingProtocol)
+ .append("speedValue", speedValue)
+ .append("speedUnits", speedUnits)
+ .append("ipVersion", ipVersion)
+ .append("provStatus", provStatus)
+ .append("in-maint", inMaint)
+ .append("linkRole", linkRole)
+ .append("linkName2", linkName2)
+ .append("circuitId", circuitId)
+ .append("purpose", purpose)
+ .toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(linkName).append(ipVersion).append(speedUnits).append(speedValue).append(circuitId).append(purpose).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof LogicalLinkInstance)) {
+ return false;
+ }
+ LogicalLinkInstance rhs = ((LogicalLinkInstance) other);
+ return new EqualsBuilder()
+ .append(linkName, rhs.linkName)
+ .append(linkId, rhs.linkId)
+ .append(speedUnits, rhs.speedUnits)
+ .append(ipVersion, rhs.ipVersion)
+ .append(linkType, rhs.linkType)
+ .append(speedValue, rhs.speedValue)
+ .append(modelInvariantId, rhs.modelInvariantId)
+ .append(circuitId, rhs.circuitId)
+ .append(linkRole, rhs.linkRole)
+ .append(linkName2, rhs.linkName2)
+ .append(purpose, rhs.purpose)
+ .isEquals();
+ }
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PInterfaceInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PInterfaceInstance.java
index c343df6..db4b714 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PInterfaceInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PInterfaceInstance.java
@@ -21,6 +21,9 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -62,6 +65,21 @@ public class PInterfaceInstance {
@SerializedName("inv-status")
@Expose
private String invStatus;
+ @SerializedName("l-interfaces")
+ @Expose
+ private LInterfaceInstanceList lInterfaceInstanceList;
+ @SerializedName("relationship-list")
+ @Expose
+ private RelationshipList relationshipList;
+
+ private List<LogicalLinkInstance> logicalLinkInstanceList;
+ public List<LogicalLinkInstance> getLogicalLinkInstanceList() {
+ return logicalLinkInstanceList;
+ }
+
+ public void setLogicalLinkInstanceList(List<LogicalLinkInstance> logicalLinkInstanceList) {
+ this.logicalLinkInstanceList = logicalLinkInstanceList;
+ }
public String getInterfaceName() {
return interfaceName;
@@ -151,6 +169,22 @@ public class PInterfaceInstance {
this.invStatus = invStatus;
}
+ public LInterfaceInstanceList getLInterfaceInstanceList() {
+ return lInterfaceInstanceList;
+ }
+
+ public void setLInterfaceInstanceList(LInterfaceInstanceList lInterfaceInstanceList) {
+ this.lInterfaceInstanceList = lInterfaceInstanceList;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
/**
* No args constructor for use in serialization
*
@@ -174,7 +208,8 @@ public class PInterfaceInstance {
*/
public PInterfaceInstance(String interfaceName,String speedValue,String speedUnits,
String portDescription,String equipmentIdentifier,String interfaceRole,String interfaceType,
- String provStatus,String resourceVersion,String inMaint, String invStatus ) {
+ String provStatus,String resourceVersion,String inMaint, String invStatus, LInterfaceInstanceList lInterfaceInstanceList,
+ RelationshipList relationshipList) {
super();
this.interfaceName = interfaceName;
this.speedValue = speedValue;
@@ -187,6 +222,8 @@ public class PInterfaceInstance {
this.resourceVersion = resourceVersion;
this.inMaint = inMaint;
this.invStatus = invStatus;
+ this.lInterfaceInstanceList = lInterfaceInstanceList;
+ this.relationshipList = relationshipList;
}
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
@@ -211,7 +248,8 @@ public class PInterfaceInstance {
return new ToStringBuilder(this).append("interfaceName", interfaceName).append("speedValue", speedValue).append("speedUnits", speedUnits)
.append("portDescription", portDescription).append("equipmentIdentifier", equipmentIdentifier).append("interfaceRole", interfaceRole)
.append("interfaceType", interfaceType).append("provStatus", provStatus).append("resourceVersion", resourceVersion)
- .append("inMaint", inMaint).append("invStatus", invStatus)
+ .append("inMaint", inMaint).append("invStatus", invStatus).append("lInterfaceInstanceList", lInterfaceInstanceList)
+ .append("relationshipList", relationshipList)
.toString();
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java
index d8d6d39..5ca73c5 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/PserverInstance.java
@@ -75,7 +75,6 @@ public class PserverInstance {
private String purpose;
@SerializedName("p-interfaces")
@Expose
- @Valid
private PInterfaceInstanceList pInterfaceInstanceList;
public String getPserverId() {
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java
index 6346d3a..b0053b3 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/VnfInstance.java
@@ -113,8 +113,11 @@ public class VnfInstance {
@Expose
@Valid
private VfModules vfModules;
+ @SerializedName("l-interfaces")
+ @Expose
+ private LInterfaceInstanceList lInterfaceInstanceList;
- private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+ private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
public String toJson() {
return gson.toJson(this);
@@ -167,8 +170,9 @@ public class VnfInstance {
* @param isClosedLoopDisabled
* @param licenseKey
* @param managementV6Address
+ * @param lInterfaceInstanceList
*/
- public VnfInstance(String vnfId, String vnfName, String vnfName2, String vnfType, String serviceId, String provisionStatus, String licenseKey, String equipmentRole, String orchestrationStatus, String heatStackId, String msoCatalogKey, String ipv4OamAddress, String ipv4Loopback0Address, String nmLanV6Address, String managementV6Address, Boolean inMaintenance, Boolean isClosedLoopDisabled, String resourceVersion, String modelInvariantId, String modelVersionId, String modelCustomizationId, String nfType, String nfFunction, String nfRole, String nfNamingCode, RelationshipList relationshipList, VfModules vfModules) {
+ public VnfInstance(String vnfId, String vnfName, String vnfName2, String vnfType, String serviceId, String provisionStatus, String licenseKey, String equipmentRole, String orchestrationStatus, String heatStackId, String msoCatalogKey, String ipv4OamAddress, String ipv4Loopback0Address, String nmLanV6Address, String managementV6Address, Boolean inMaintenance, Boolean isClosedLoopDisabled, String resourceVersion, String modelInvariantId, String modelVersionId, String modelCustomizationId, String nfType, String nfFunction, String nfRole, String nfNamingCode, RelationshipList relationshipList, VfModules vfModules, LInterfaceInstanceList lInterfaceInstanceList) {
super();
this.vnfId = vnfId;
this.vnfName = vnfName;
@@ -197,6 +201,7 @@ public class VnfInstance {
this.nfNamingCode = nfNamingCode;
this.relationshipList = relationshipList;
this.vfModules = vfModules;
+ this.lInterfaceInstanceList = lInterfaceInstanceList;
}
public String getVnfId() {
@@ -415,14 +420,22 @@ public class VnfInstance {
this.vfModules = vfModules;
}
+ public LInterfaceInstanceList getLInterfaceInstanceList() {
+ return lInterfaceInstanceList;
+ }
+
+ public void setLInterfaceInstanceList(LInterfaceInstanceList lInterfaceInstanceList) {
+ this.lInterfaceInstanceList = lInterfaceInstanceList;
+ }
+
@Override
public String toString() {
- return new ToStringBuilder(this).append("vnfId", vnfId).append("vnfName", vnfName).append("vnfName2", vnfName2).append("vnfType", vnfType).append("serviceId", serviceId).append("provisionStatus", provisionStatus).append("licenseKey", licenseKey).append("equipmentRole", equipmentRole).append("orchestrationStatus", orchestrationStatus).append("heatStackId", heatStackId).append("msoCatalogKey", msoCatalogKey).append("ipv4OamAddress", ipv4OamAddress).append("ipv4Loopback0Address", ipv4Loopback0Address).append("nmLanV6Address", nmLanV6Address).append("managementV6Address", managementV6Address).append("inMaintenance", inMaintenance).append("isClosedLoopDisabled", isClosedLoopDisabled).append("resourceVersion", resourceVersion).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelCustomizationId", modelCustomizationId).append("nfType", nfType).append("nfFunction", nfFunction).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode).append("relationshipList", relationshipList).append("vfModules", vfModules).toString();
+ return new ToStringBuilder(this).append("vnfId", vnfId).append("vnfName", vnfName).append("vnfName2", vnfName2).append("vnfType", vnfType).append("serviceId", serviceId).append("provisionStatus", provisionStatus).append("licenseKey", licenseKey).append("equipmentRole", equipmentRole).append("orchestrationStatus", orchestrationStatus).append("heatStackId", heatStackId).append("msoCatalogKey", msoCatalogKey).append("ipv4OamAddress", ipv4OamAddress).append("ipv4Loopback0Address", ipv4Loopback0Address).append("nmLanV6Address", nmLanV6Address).append("managementV6Address", managementV6Address).append("inMaintenance", inMaintenance).append("isClosedLoopDisabled", isClosedLoopDisabled).append("resourceVersion", resourceVersion).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelCustomizationId", modelCustomizationId).append("nfType", nfType).append("nfFunction", nfFunction).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode).append("relationshipList", relationshipList).append("vfModules", vfModules).append("lInterfaceInstanceList", lInterfaceInstanceList).toString();
}
@Override
public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationId).append(serviceId).append(ipv4Loopback0Address).append(vnfType).append(nfFunction).append(modelInvariantId).append(resourceVersion).append(vnfName2).append(relationshipList).append(nmLanV6Address).append(nfRole).append(nfType).append(modelVersionId).append(ipv4OamAddress).append(vnfName).append(inMaintenance).append(msoCatalogKey).append(provisionStatus).append(vfModules).append(equipmentRole).append(vnfId).append(orchestrationStatus).append(nfNamingCode).append(isClosedLoopDisabled).append(heatStackId).append(licenseKey).append(managementV6Address).toHashCode();
+ return new HashCodeBuilder().append(modelCustomizationId).append(serviceId).append(ipv4Loopback0Address).append(vnfType).append(nfFunction).append(modelInvariantId).append(resourceVersion).append(vnfName2).append(relationshipList).append(nmLanV6Address).append(nfRole).append(nfType).append(modelVersionId).append(ipv4OamAddress).append(vnfName).append(inMaintenance).append(msoCatalogKey).append(provisionStatus).append(vfModules).append(equipmentRole).append(vnfId).append(orchestrationStatus).append(nfNamingCode).append(isClosedLoopDisabled).append(heatStackId).append(licenseKey).append(managementV6Address).append(lInterfaceInstanceList).toHashCode();
}
@Override
@@ -434,7 +447,7 @@ public class VnfInstance {
return false;
}
VnfInstance rhs = ((VnfInstance) other);
- return new EqualsBuilder().append(modelCustomizationId, rhs.modelCustomizationId).append(serviceId, rhs.serviceId).append(ipv4Loopback0Address, rhs.ipv4Loopback0Address).append(vnfType, rhs.vnfType).append(nfFunction, rhs.nfFunction).append(modelInvariantId, rhs.modelInvariantId).append(resourceVersion, rhs.resourceVersion).append(vnfName2, rhs.vnfName2).append(relationshipList, rhs.relationshipList).append(nmLanV6Address, rhs.nmLanV6Address).append(nfRole, rhs.nfRole).append(nfType, rhs.nfType).append(modelVersionId, rhs.modelVersionId).append(ipv4OamAddress, rhs.ipv4OamAddress).append(vnfName, rhs.vnfName).append(inMaintenance, rhs.inMaintenance).append(msoCatalogKey, rhs.msoCatalogKey).append(provisionStatus, rhs.provisionStatus).append(vfModules, rhs.vfModules).append(equipmentRole, rhs.equipmentRole).append(vnfId, rhs.vnfId).append(orchestrationStatus, rhs.orchestrationStatus).append(nfNamingCode, rhs.nfNamingCode).append(isClosedLoopDisabled, rhs.isClosedLoopDisabled).append(heatStackId, rhs.heatStackId).append(licenseKey, rhs.licenseKey).append(managementV6Address, rhs.managementV6Address).isEquals();
+ return new EqualsBuilder().append(modelCustomizationId, rhs.modelCustomizationId).append(serviceId, rhs.serviceId).append(ipv4Loopback0Address, rhs.ipv4Loopback0Address).append(vnfType, rhs.vnfType).append(nfFunction, rhs.nfFunction).append(modelInvariantId, rhs.modelInvariantId).append(resourceVersion, rhs.resourceVersion).append(vnfName2, rhs.vnfName2).append(relationshipList, rhs.relationshipList).append(nmLanV6Address, rhs.nmLanV6Address).append(nfRole, rhs.nfRole).append(nfType, rhs.nfType).append(modelVersionId, rhs.modelVersionId).append(ipv4OamAddress, rhs.ipv4OamAddress).append(vnfName, rhs.vnfName).append(inMaintenance, rhs.inMaintenance).append(msoCatalogKey, rhs.msoCatalogKey).append(provisionStatus, rhs.provisionStatus).append(vfModules, rhs.vfModules).append(equipmentRole, rhs.equipmentRole).append(vnfId, rhs.vnfId).append(orchestrationStatus, rhs.orchestrationStatus).append(nfNamingCode, rhs.nfNamingCode).append(isClosedLoopDisabled, rhs.isClosedLoopDisabled).append(heatStackId, rhs.heatStackId).append(licenseKey, rhs.licenseKey).append(managementV6Address, rhs.managementV6Address).append(lInterfaceInstanceList, rhs.lInterfaceInstanceList).isEquals();
}
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java
index 803e65d..948aaa7 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java
@@ -24,6 +24,8 @@ 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;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -56,13 +58,17 @@ public class Vserver {
@SerializedName("resource-version")
@Expose
private String resourceVersion;
-
@SerializedName("relationship-list")
@Expose
private RelationshipList relationshipList;
+ @SerializedName("l-interfaces")
+ @Expose
+ private LInterfaceInstanceList lInterfaceInstanceList;
+
+
private List<PserverInstance> pserverInstanceList;
- private List<LInterfaceInstance> lInterfaceInstanceList;
+
public List<PserverInstance> getPserverInstanceList() {
return pserverInstanceList;
}
@@ -71,14 +77,6 @@ public class Vserver {
this.pserverInstanceList = pserverInstanceList;
}
- public List<LInterfaceInstance> getlInterfaceInstanceList() {
- return lInterfaceInstanceList;
- }
-
- public void setlInterfaceInstanceList(List<LInterfaceInstance> lInterfaceInstanceList) {
- this.lInterfaceInstanceList = lInterfaceInstanceList;
- }
-
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
public String toJson() {
@@ -115,7 +113,7 @@ public class Vserver {
* @param vserverId
* @param isClosedLoopDisabled
*/
- public Vserver(String vserverId, String vserverName, String vserverName2, String provStatus, String vserverSelflink, Boolean inMaint, Boolean isClosedLoopDisabled, String resourceVersion, RelationshipList relationshipList) {
+ public Vserver(String vserverId, String vserverName, String vserverName2, String provStatus, String vserverSelflink, Boolean inMaint, Boolean isClosedLoopDisabled, String resourceVersion, RelationshipList relationshipList, LInterfaceInstanceList lInterfaceInstanceList) {
super();
this.vserverId = vserverId;
this.vserverName = vserverName;
@@ -126,6 +124,7 @@ public class Vserver {
this.isClosedLoopDisabled = isClosedLoopDisabled;
this.resourceVersion = resourceVersion;
this.relationshipList = relationshipList;
+ this.lInterfaceInstanceList = lInterfaceInstanceList;
}
public String getVserverId() {
@@ -200,14 +199,22 @@ public class Vserver {
this.relationshipList = relationshipList;
}
+ public LInterfaceInstanceList getLInterfaceInstanceList() {
+ return lInterfaceInstanceList;
+ }
+
+ public void setLInterfaceInstanceList(LInterfaceInstanceList lInterfaceInstanceList) {
+ this.lInterfaceInstanceList = lInterfaceInstanceList;
+ }
+
@Override
public String toString() {
- return new ToStringBuilder(this).append("vserverId", vserverId).append("vserverName", vserverName).append("vserverName2", vserverName2).append("provStatus", provStatus).append("vserverSelflink", vserverSelflink).append("inMaint", inMaint).append("isClosedLoopDisabled", isClosedLoopDisabled).append("resourceVersion", resourceVersion).append("relationshipList", relationshipList).toString();
+ return new ToStringBuilder(this).append("vserverId", vserverId).append("vserverName", vserverName).append("vserverName2", vserverName2).append("provStatus", provStatus).append("vserverSelflink", vserverSelflink).append("inMaint", inMaint).append("isClosedLoopDisabled", isClosedLoopDisabled).append("resourceVersion", resourceVersion).append("relationshipList", relationshipList).append("lInterfaceInstanceList", lInterfaceInstanceList).toString();
}
@Override
public int hashCode() {
- return new HashCodeBuilder().append(relationshipList).append(provStatus).append(inMaint).append(vserverName2).append(resourceVersion).append(vserverSelflink).append(vserverName).append(vserverId).append(isClosedLoopDisabled).toHashCode();
+ return new HashCodeBuilder().append(relationshipList).append(lInterfaceInstanceList).append(provStatus).append(inMaint).append(vserverName2).append(resourceVersion).append(vserverSelflink).append(vserverName).append(vserverId).append(isClosedLoopDisabled).toHashCode();
}
@Override
@@ -219,7 +226,7 @@ public class Vserver {
return false;
}
Vserver rhs = ((Vserver) other);
- return new EqualsBuilder().append(relationshipList, rhs.relationshipList).append(provStatus, rhs.provStatus).append(inMaint, rhs.inMaint).append(vserverName2, rhs.vserverName2).append(resourceVersion, rhs.resourceVersion).append(vserverSelflink, rhs.vserverSelflink).append(vserverName, rhs.vserverName).append(vserverId, rhs.vserverId).append(isClosedLoopDisabled, rhs.isClosedLoopDisabled).isEquals();
+ return new EqualsBuilder().append(relationshipList, rhs.relationshipList).append(lInterfaceInstanceList, rhs.lInterfaceInstanceList).append(provStatus, rhs.provStatus).append(inMaint, rhs.inMaint).append(vserverName2, rhs.vserverName2).append(resourceVersion, rhs.resourceVersion).append(vserverSelflink, rhs.vserverSelflink).append(vserverName, rhs.vserverName).append(vserverId, rhs.vserverId).append(isClosedLoopDisabled, rhs.isClosedLoopDisabled).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 fcf4589..9f3e953 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
@@ -54,6 +54,7 @@ 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.datatype.LInterfaceInstance;
+import org.onap.pomba.contextbuilder.aai.datatype.LogicalLinkInstance;
import org.onap.pomba.contextbuilder.aai.exception.AuditError;
import org.onap.pomba.contextbuilder.aai.exception.AuditException;
import org.slf4j.Logger;
@@ -65,6 +66,7 @@ import org.onap.pomba.common.datatypes.PInterface;
import com.bazaarvoice.jolt.JsonUtils;
import org.onap.pomba.common.datatypes.Pserver;
import org.onap.pomba.common.datatypes.LInterface;
+import org.onap.pomba.common.datatypes.LogicalLink;
public class RestUtil {
@@ -90,9 +92,8 @@ public class RestUtil {
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 CATALOG_LOGICAL_LINK = "logical-link";
private static final String CATALOG_PNF = "pnf";
- private static final String CATALOG_L_INTERFACE = "l-interface";
-
private static final String VF_MODULES = "vf-modules";
private static final String VF_MODULE = "vf-module";
@@ -119,7 +120,6 @@ public class RestUtil {
private static final String ATTRIBUTE_NF_ROLE = "nfRole";
private static final String ATTRIBUTE_NF_TYPE = "nfType";
private static final String ATTRIBUTE_NF_FUNCTION = "nfFunction";
- private static final String ATTRIBUTE_RESOURCE_VERSION = "resourceVersion";
private static final String ATTRIBUTE_NAME2 = "name2";
private static final String ATTRIBUTE_NAME2_SOURCE = "name2Source";
private static final String ATTRIBUTE_EQUIPMENT_TYPE = "equipType";
@@ -150,6 +150,12 @@ public class RestUtil {
private static final String ATTRIBUTE_ADMIN_STATUS = "adminStatus";
private static final String ATTRIBUTE_NFC_NAMING_CODE = "nfcNamingCode";
private static final String ATTRIBUTE_NF_NAMING_CODE = "nfNamingCode";
+ private static final String ATTRIBUTE_LINK_TYPE = "linkType";
+ private static final String ATTRIBUTE_ROUTING_PROTOCOL = "routingProtocol";
+ private static final String ATTRIBUTE_IP_VERSION = "ipVersion";
+ private static final String ATTRIBUTE_PROV_STATUS = "provStatus";
+ private static final String ATTRIBUTE_LINK_ROLE = "linkRole";
+ private static final String ATTRIBUTE_CIRCUIT_ID = "circuitId";
/**
@@ -275,6 +281,16 @@ public class RestUtil {
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);
+
+ //Obtain L-Interface level logical-link
+ if ((vnfInstance.getLInterfaceInstanceList() != null)
+ &&(!(vnfInstance.getLInterfaceInstanceList().getLInterfaceList().isEmpty()))) {
+ List<LInterfaceInstance> lInterfaceInstList_aai = vnfInstance.getLInterfaceInstanceList().getLInterfaceList();
+ for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
+ lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
+ transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ }
+ }
vnfLst.add(vnfInstance);
// Update VModule with l3-network list from aai, if any.
@@ -297,8 +313,12 @@ public class RestUtil {
//Obtain l3-network on service level
List<L3networkInstance> l3networkLstInService = retrieveAaiModelDataL3NetworkInServiceLevel (aaiClient, baseURL, transactionId, aaiBasicAuthorization, serviceInstancePayload) ;
+ //Obtain logical-link on service level
+ List<LogicalLinkInstance> logicalLinkInstanceLstInService = obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
+ transactionId, aaiBasicAuthorization, ServiceInstance.fromJson(serviceInstancePayload).getRelationshipList());
+
// Transform to common model and return
- return transform(ServiceInstance.fromJson(serviceInstancePayload), vnfLst, vnfcMap, l3networkMapInVnf, vnfVfmoduleVserverMap, pnfLst, l3networkLstInService);
+ return transform(ServiceInstance.fromJson(serviceInstancePayload), vnfLst, vnfcMap, l3networkMapInVnf, vnfVfmoduleVserverMap, pnfLst, l3networkLstInService, logicalLinkInstanceLstInService);
}
private static void buildVModuleWithL3NetworkInfo (VnfInstance vnfInstance,
@@ -323,7 +343,7 @@ public class RestUtil {
}
if (!(relatedLinkList.isEmpty())) {
- List<L3networkInstance> l3nwInsLst = queryAaiForL3networkInfo (aaiClient,baseURL,transactionId,aaiBasicAuthorization,relatedLinkList);
+ List<L3networkInstance> l3nwInsLst = queryAaiForL3networkInfo (aaiClient,baseURL,transactionId,aaiBasicAuthorization,relatedLinkList);
if ((l3nwInsLst != null) && (!l3nwInsLst.isEmpty())) {
t_vfModule.setL3NetworkList(l3nwInsLst);
@@ -363,12 +383,96 @@ public class RestUtil {
// Logic to Create the Generic VNF Instance POJO object
PnfInstance pnfInstance = PnfInstance.fromJson(genericPNFPayload);
pnfLst.add(pnfInstance);
+
+ //Obtain P-Interface level logical-link
+ if ((pnfInstance.getPInterfaceInstanceList() != null)
+ &&(!(pnfInstance.getPInterfaceInstanceList().getPInterfaceList().isEmpty()))) {
+ List<PInterfaceInstance> pInterfaceInstList_aai = pnfInstance.getPInterfaceInstanceList().getPInterfaceList();
+ for (PInterfaceInstance pInterfaceInst_aai : pInterfaceInstList_aai) {
+ pInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
+ transactionId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList()));
+
+ //Obtain L-Interface level logical-link
+ if ((pInterfaceInst_aai.getLInterfaceInstanceList() != null)
+ &&(!(pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList().isEmpty()))) {
+ List<LInterfaceInstance> lInterfaceInstList_aai = pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList();
+ for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
+ lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
+ transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ }
+ }
+ }
+ }
}
}
return pnfLst;
}
+ private static List<LogicalLinkInstance> obtainLogicalLinkInfoFromAai(RestClient aaiClient, String baseURL,
+ String transactionId, String aaiBasicAuthorization, RelationshipList logicalLinkRelateionShipList) throws AuditException {
+ if (logicalLinkRelateionShipList == null) {
+ return null;
+ }
+
+ List<Relationship> logicalLinkRelateionShipLocalList = logicalLinkRelateionShipList.getRelationship();
+ if ((logicalLinkRelateionShipLocalList == null) || (logicalLinkRelateionShipLocalList.size() < 1 )) {
+ return null;
+ }
+
+ List<String> relatedLinkList = new ArrayList<>();
+
+ for ( Relationship logicalLinkRelationShip : logicalLinkRelateionShipLocalList ) {
+ if (logicalLinkRelationShip.getRelatedTo().equals(CATALOG_LOGICAL_LINK)) {
+ String logicalLink_RelatedLink = logicalLinkRelationShip.getRelatedLink();
+ relatedLinkList.add(logicalLink_RelatedLink);
+ }
+ }
+
+ if (!(relatedLinkList.isEmpty())) {
+ List<LogicalLinkInstance> logicalLinkInsLst = queryAaiForLogicalLinkData (aaiClient,baseURL,transactionId,aaiBasicAuthorization,relatedLinkList);
+
+ if ((logicalLinkInsLst != null) && (!logicalLinkInsLst.isEmpty())) {
+
+ return logicalLinkInsLst;
+ }
+ }
+
+ return null;
+ }
+
+ private static List<LogicalLinkInstance> queryAaiForLogicalLinkData(RestClient aaiClient, String baseURL,
+ String transactionId, String aaiBasicAuthorization, List<String> genericRelatedLinkLst) throws AuditException {
+ if ( genericRelatedLinkLst.isEmpty()) {
+ return null;
+ }
+
+ log.info(LogMessages.NUMBER_OF_API_CALLS, "Logical-link", genericRelatedLinkLst.size());
+ log.info(LogMessages.API_CALL_LIST, "Logical-link", printOutAPIList(genericRelatedLinkLst));
+
+ String genericDataPayload = null;
+ List<LogicalLinkInstance> instanceLst = new ArrayList<>(); // List of the LogicalLinkInstance POJO object
+
+ for (String genericRelatedLink : genericRelatedLinkLst) {
+ String genericURL = baseURL + genericRelatedLink;
+ // Response from generic l3-network API call
+ genericDataPayload =
+ getResource(aaiClient, genericURL, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+
+ if (isEmptyJson(genericDataPayload)) {
+ log.info(LogMessages.NOT_FOUND, " url ", genericRelatedLink);
+ } else {
+ log.info("Message from AAI for logical-link %s ,message body: %s",genericRelatedLink, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(genericDataPayload)));
+
+ LogicalLinkInstance logicalLinkInstance = LogicalLinkInstance.fromJson(genericDataPayload);
+ instanceLst.add(logicalLinkInstance);
+
+ }
+ }
+
+ return instanceLst;
+ }
+
private static List<L3networkInstance> queryAaiForL3networkInfo(RestClient aaiClient, String baseURL,
String transactionId, String aaiBasicAuthorization, List<String> genericL3networkLinkLst) throws AuditException {
if ( genericL3networkLinkLst.isEmpty()) {
@@ -486,7 +590,7 @@ public class RestUtil {
List<Vserver> vserverLst = new ArrayList<>();
for (String vserverLink : vserverLinkLst) {
- String vserverURL = baseURL + vserverLink;
+ String vserverURL = baseURL + vserverLink + DEPTH;
vserverPayload = getResource(aaiClient, vserverURL, aaiBasicAuthorization, transactionId,
MediaType.valueOf(MediaType.APPLICATION_XML));
@@ -502,10 +606,14 @@ public class RestUtil {
vserver.setPserverInstanceList(pserverInstanceLst);
}
- // add L-interface List if any
- List<LInterfaceInstance> lInterfaceInstanceLst = getLInterfaceInstanceInfoFromAai(vserverPayload, aaiClient, baseURL, transactionId, aaiBasicAuthorization);
- if ((lInterfaceInstanceLst != null) && (!lInterfaceInstanceLst.isEmpty())) {
- vserver.setlInterfaceInstanceList(lInterfaceInstanceLst);
+ //Obtain l-Interface level logical-link
+ if ((vserver.getLInterfaceInstanceList() != null)
+ &&(!(vserver.getLInterfaceInstanceList().getLInterfaceList().isEmpty()))) {
+ List<LInterfaceInstance> lInterfaceInstList_aai = vserver.getLInterfaceInstanceList().getLInterfaceList();
+ for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
+ lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
+ transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ }
}
vserverLst.add(vserver);
@@ -548,48 +656,33 @@ public class RestUtil {
} else {
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);
+ PserverInstance pserverInst = PserverInstance.fromJson(pserverPayload);
+
+ if ((pserverInst.getPInterfaceInstanceList() != null)
+ &&(!(pserverInst.getPInterfaceInstanceList().getPInterfaceList().isEmpty()))) {
+ List<PInterfaceInstance> pInterfaceInstList_aai = pserverInst.getPInterfaceInstanceList().getPInterfaceList();
+ for (PInterfaceInstance pInterfaceInst_aai : pInterfaceInstList_aai) {
+ //Obtain P-Interface level logical-link
+ pInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
+ transactionId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList()));
+
+ List<LInterfaceInstance> lInterfaceInstList_aai = pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList();
+ for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) {
+ //Obtain L-Interface level logical-link
+ lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL,
+ transactionId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList()));
+ }
+
+ }
+ }
//update P-Interface if any.
- pserverLst.add(pserver);
+ pserverLst.add(pserverInst);
}
}
return pserverLst;
}
- private static List<LInterfaceInstance> getLInterfaceInstanceInfoFromAai (String vserverPayload, RestClient aaiClient, String baseURL, String transactionId, String aaiBasicAuthorization) throws AuditException {
- if (vserverPayload == null) {
- //already reported.
- return null;
- }
-
- //Obtain related L-Interface instance info
- List<String> lInterfaceRelatedLinkList = handleRelationshipGeneral (vserverPayload,CATALOG_L_INTERFACE );
- List<LInterfaceInstance> lInterfaceLst = null;
- if ((lInterfaceRelatedLinkList == null) || (lInterfaceRelatedLinkList.isEmpty())){
- // already reported
- return null;
- }
- lInterfaceLst = new ArrayList<>();
- for (String lInterfaceRelatedLink : lInterfaceRelatedLinkList) {
- String lInterfaceURL = baseURL + lInterfaceRelatedLink + DEPTH;;
- String lInterfacePayload = getResource(aaiClient, lInterfaceURL, aaiBasicAuthorization, transactionId,
- MediaType.valueOf(MediaType.APPLICATION_XML));
-
- if (isEmptyJson(lInterfacePayload)) {
- log.info(LogMessages.NOT_FOUND, "L-INTERFACE with url", lInterfaceURL);
- } else {
- log.info("Message from AAI for L-INTERFACE %s ,message body: %s", lInterfaceURL,lInterfacePayload);
- // Logic to Create the Pserver POJO object
- LInterfaceInstance lInterfaceInstance = LInterfaceInstance.fromJson(lInterfacePayload);
-
- //update P-Interface if any.
- lInterfaceLst.add(lInterfaceInstance);
- }
- }
- return lInterfaceLst;
- }
-
private static String getVnfId(String genericVNFPayload) throws AuditException {
VnfInstance vnfInstance = VnfInstance.fromJson(genericVNFPayload);
@@ -603,7 +696,8 @@ public class RestUtil {
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) {
+ List<L3networkInstance> l3networkLst_in_service,
+ List<LogicalLinkInstance> logicalLinkInstanceLstInService) {
ModelContext context = new ModelContext();
Service service = new Service();
service.setModelInvariantUUID(svcInstance.getModelInvariantId());
@@ -624,6 +718,18 @@ public class RestUtil {
vf.setAttributes(populateVnfAttributeList(vnf));
String key = vnf.getVnfId(); // generic vnf-id (top level of the key)
+ //Update Vnf level L-Interface here
+ if ((vnf.getLInterfaceInstanceList() != null) && (!(vnf.getLInterfaceInstanceList().getLInterfaceList().isEmpty()))) {
+ List<LInterfaceInstance> lInterfaceInstanceList = vnf.getLInterfaceInstanceList().getLInterfaceList();
+ List<LInterface> lInterfacelst = null;
+ if (lInterfaceInstanceList != null) {
+ lInterfacelst = getLInterfaceLstInfo (lInterfaceInstanceList);
+ }
+ if ((lInterfacelst != null) && (!lInterfacelst.isEmpty())) {
+ vf.setLInterfaceList(lInterfacelst);
+ }
+ }
+
// ---------------- Handle VNFC data
List<VNFC> vnfcLst = new ArrayList<>();
for (Map.Entry<String, List<VnfcInstance>> entry : vnfcMap.entrySet()) {
@@ -742,14 +848,16 @@ public class RestUtil {
}
vm.setPServer(pServer);
- //Update L-Interface here
- List<LInterfaceInstance> lInterfaceInstanceList = vserver.getlInterfaceInstanceList();
- List<LInterface> lInterfacelst = null;
- if (lInterfaceInstanceList != null) {
- lInterfacelst = getLInterfaceLstInfo (lInterfaceInstanceList);
- }
- if ((lInterfacelst != null) && (!lInterfacelst.isEmpty())) {
- vm.setLInterfaceList(lInterfacelst);
+ //Update VServer level L-Interface here
+ if ((vserver.getLInterfaceInstanceList() != null) && (!(vserver.getLInterfaceInstanceList().getLInterfaceList().isEmpty()))) {
+ List<LInterfaceInstance> lInterfaceInstanceList = vserver.getLInterfaceInstanceList().getLInterfaceList();
+ List<LInterface> lInterfacelst = null;
+ if (lInterfaceInstanceList != null) {
+ lInterfacelst = getLInterfaceLstInfo (lInterfaceInstanceList);
+ }
+ if ((lInterfacelst != null) && (!lInterfacelst.isEmpty())) {
+ vm.setLInterfaceList(lInterfacelst);
+ }
}
vmList.add(vm);
@@ -778,6 +886,9 @@ public class RestUtil {
context.setPnfs(transformPNF(pnfLst_fromAAi));
//Add service-level l3-network info
context.setNetworkList(transformL3Network (l3networkLst_in_service));
+ //Add service-level logical-link info
+ context.setLogicalLinkList(transformLogicalLink(logicalLinkInstanceLstInService));
+
log.info((String.format("ModelContext body: %s ", JsonUtils.toPrettyJsonString(context))));
return context;
}
@@ -954,14 +1065,7 @@ public class RestUtil {
att.setValue(String.valueOf(pserverInstance.getInMaint()));
attributeList.add(att);
}
- 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.name().equals(ATTRIBUTE_PURPOSE))
&& isValid(pserverInstance.getPurpose())){
Attribute att = new Attribute();
@@ -1064,6 +1168,9 @@ public class RestUtil {
if (!attributeList.isEmpty()) {
lInterface.setAttributes(attributeList);
}
+
+ // add Logical-link info
+ lInterface.setLogicalLinkList(transformLogicalLink(lInterfaceInstance.getLogicalLinkInstanceList()));
lInterfaceLst.add(lInterface);
}
@@ -1081,6 +1188,17 @@ public class RestUtil {
// pInterface.setUuid( ); // there is no mapping data for UUID from AAI data.
pInterface.setName(pInterfaceInst_aai.getInterfaceName());
pInterface.setDataQuality(DataQuality.ok());
+ //Update L-Interface here
+ if ((pInterfaceInst_aai.getLInterfaceInstanceList() != null) && (!(pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList().isEmpty()))) {
+ List<LInterfaceInstance> lInterfaceInstanceList = pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList();
+ List<LInterface> lInterfacelst = null;
+ if (lInterfaceInstanceList != null) {
+ lInterfacelst = getLInterfaceLstInfo (lInterfaceInstanceList);
+ }
+ if ((lInterfacelst != null) && (!lInterfacelst.isEmpty())) {
+ pInterface.setLInterfaceList(lInterfacelst);
+ }
+ }
List<Attribute> pInterface_attributeList = new ArrayList<>();
updatePInterfaceAttributeList (pInterfaceInst_aai, pInterface_attributeList) ;
@@ -1088,6 +1206,9 @@ public class RestUtil {
pInterface.setAttributes(pInterface_attributeList);
}
+ // add Logical-link info
+ pInterface.setLogicalLinkList(transformLogicalLink(pInterfaceInst_aai.getLogicalLinkInstanceList()));
+
pInterfaceList.add(pInterface);
}
@@ -1129,15 +1250,6 @@ public class RestUtil {
attributeList.add(att);
}
- 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( pnfFromAai.getResourceVersion()));
- attributeList.add(att);
- }
-
if ((name.name().equals(ATTRIBUTE_NAME2))
&& isValid(pnfFromAai.getPnfName2() )){
Attribute att = new Attribute();
@@ -1233,6 +1345,17 @@ public class RestUtil {
pInterface.setUuid(pInterfaceInst_aai.getEquipmentIdentifier() );
pInterface.setName(pInterfaceInst_aai.getInterfaceName());
pInterface.setDataQuality(DataQuality.ok());
+ //Update L-Interface here
+ if ((pInterfaceInst_aai.getLInterfaceInstanceList() != null) && (!(pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList().isEmpty()))) {
+ List<LInterfaceInstance> lInterfaceInstanceList = pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList();
+ List<LInterface> lInterfacelst = null;
+ if (lInterfaceInstanceList != null) {
+ lInterfacelst = getLInterfaceLstInfo (lInterfaceInstanceList);
+ }
+ if ((lInterfacelst != null) && (!lInterfacelst.isEmpty())) {
+ pInterface.setLInterfaceList(lInterfacelst);
+ }
+ }
List<Attribute> pInterface_attributeList = new ArrayList<>();
updatePInterfaceAttributeList (pInterfaceInst_aai, pInterface_attributeList) ;
@@ -1240,6 +1363,8 @@ public class RestUtil {
pInterface.setAttributes(pInterface_attributeList);
}
+ // add Logical-link info
+ pInterface.setLogicalLinkList(transformLogicalLink(pInterfaceInst_aai.getLogicalLinkInstanceList()));
pInterfaceList.add(pInterface);
}
@@ -1255,6 +1380,8 @@ public class RestUtil {
return pnfLst;
}
+
+
/*
* Transform AAI Representation to Common Model
*/
@@ -1303,15 +1430,6 @@ public class RestUtil {
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();
@@ -1342,6 +1460,137 @@ public class RestUtil {
return l3NetworkLst;
}
+ /*
+ * Transform AAI Representation to Common Model
+ */
+ public static List<LogicalLink> transformLogicalLink(List<LogicalLinkInstance> logicalLinkInstanceLstFromAAI) {
+ if ((logicalLinkInstanceLstFromAAI == null ) || (logicalLinkInstanceLstFromAAI.isEmpty())) {
+ log.info(LogMessages.API_CALL_LIST, "Nill logical-link instance list");
+ return null;
+ }
+ List<LogicalLink> logicalLinkLst = new ArrayList<>();
+
+ for (LogicalLinkInstance logicalLinkInstFromAai : logicalLinkInstanceLstFromAAI) {
+ LogicalLink logicalLink = new LogicalLink();
+ logicalLink.setUuid(logicalLinkInstFromAai.getLinkId());
+ logicalLink.setName(logicalLinkInstFromAai.getLinkName());
+ logicalLink.setModelVersionID(logicalLinkInstFromAai.getModelVersionId());
+ logicalLink.setModelInvariantUUID(logicalLinkInstFromAai.getModelInvariantId());
+ logicalLink.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_LOCKEDBOOLEAN ))
+ && isValid(logicalLinkInstFromAai.getInMaint())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.lockedBoolean);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getInMaint()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_LINK_TYPE ))
+ && isValid(logicalLinkInstFromAai.getLinkType())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.linkType);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getLinkType()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_ROUTING_PROTOCOL ))
+ && isValid(logicalLinkInstFromAai.getRoutingProtocol())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.routingProtocol);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getRoutingProtocol()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_SPEED_VALUE ))
+ && isValid(logicalLinkInstFromAai.getSpeedValue())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.speedValue);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getSpeedValue()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_SPEED_UNITS ))
+ && isValid(logicalLinkInstFromAai.getSpeedUnits())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.speedUnits);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getSpeedUnits()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_IP_VERSION ))
+ && isValid(logicalLinkInstFromAai.getIpVersion())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.ipVersion);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getIpVersion()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_PROV_STATUS ))
+ && isValid(logicalLinkInstFromAai.getProvStatus())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.provStatus);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getProvStatus()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_LINK_ROLE ))
+ && isValid(logicalLinkInstFromAai.getLinkRole())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.linkRole);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getLinkRole()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_NAME2 ))
+ && isValid(logicalLinkInstFromAai.getLinkName2())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.name2);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getLinkName2()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_CIRCUIT_ID ))
+ && isValid(logicalLinkInstFromAai.getCircuitId())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.circuitId);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getCircuitId()));
+ attributeList.add(att);
+ }
+
+ if ((name.name().equals(ATTRIBUTE_PURPOSE ))
+ && isValid(logicalLinkInstFromAai.getPurpose())){
+ Attribute att = new Attribute();
+ att.setDataQuality(DataQuality.ok());
+ att.setName(Attribute.Name.purpose);
+ att.setValue(String.valueOf( logicalLinkInstFromAai.getPurpose()));
+ attributeList.add(att);
+ }
+ }
+
+ if (!attributeList.isEmpty()) {
+ logicalLink.setAttributes(attributeList);
+ }
+
+ logicalLinkLst.add(logicalLink);
+ } // done the vnfInstance
+
+ return logicalLinkLst;
+ }
+
private static void updatePInterfaceAttributeList(PInterfaceInstance pInterfaceInstFromAai, List<Attribute> pInterfaceAttributeList ) {
// Iterate through the ENUM Attribute list
for (Attribute.Name name: Attribute.Name.values()) {
@@ -1399,15 +1648,6 @@ public class RestUtil {
pInterfaceAttributeList.add(att);
}
- 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( pInterfaceInstFromAai.getResourceVersion()));
- pInterfaceAttributeList.add(att);
- }
-
if ((name.name().equals( ATTRIBUTE_LOCKEDBOOLEAN ))
&& isValid(pInterfaceInstFromAai.getInMaint())){
Attribute att = new Attribute();
@@ -1773,11 +2013,6 @@ public class RestUtil {
if (inputField == null) {
return false;
}
- String localInputField = inputField.trim();
-
- if (localInputField.equals("")) {
- return false;
- }
return true;
}