diff options
Diffstat (limited to 'prh-commons/src')
7 files changed, 319 insertions, 425 deletions
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiPnfResultModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiPnfResultModel.java index 96d28af7..e6d813f7 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiPnfResultModel.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiPnfResultModel.java @@ -22,8 +22,6 @@ package org.onap.dcaegen2.services.prh.model; import com.google.gson.annotations.SerializedName; -import java.util.Objects; - /** * PNF represents a physical network function. typically equipment used in the D1 world. in 1607, this will be populated by SDN-C to represent a premises router that a uCPE connects to. But this can be used to represent any physical device that is not an AIC node or uCPE. ###### Related Nodes - TO complex( pnf LocatedIn complex, MANY2ONE) - TO instance-group( pnf MemberOf instance-group, MANY2MANY) - TO zone( pnf LocatedIn zone, MANY2ONE) - FROM configuration( configuration AppliesTo pnf, ONE2MANY) - FROM esr-thirdparty-sdnc( esr-thirdparty-sdnc AppliesTo pnf, ONE2MANY) - FROM generic-vnf( generic-vnf HostedOn pnf, MANY2MANY) - FROM lag-interface (CHILD of pnf, lag-interface BindsTo pnf, MANY2ONE)(1) - FROM logical-link( logical-link BridgedTo pnf, MANY2MANY) - FROM p-interface (CHILD of pnf, p-interface BindsTo pnf, MANY2ONE)(1) - FROM service-instance( service-instance ComposedOf pnf, ONE2MANY) -(1) IF this PNF node is deleted, this FROM node is DELETED also */ @@ -101,11 +99,6 @@ public class AaiPnfResultModel { @SerializedName("relationship-list") private Relationship relationshipList = null; - public AaiPnfResultModel pnfName(String pnfName) { - this.pnfName = pnfName; - return this; - } - /** * unique name of Physical Network Function. * @@ -119,11 +112,6 @@ public class AaiPnfResultModel { this.pnfName = pnfName; } - public AaiPnfResultModel pnfName2(String pnfName2) { - this.pnfName2 = pnfName2; - return this; - } - /** * name of Physical Network Function. * @@ -137,11 +125,6 @@ public class AaiPnfResultModel { this.pnfName2 = pnfName2; } - public AaiPnfResultModel selflink(String selflink) { - this.selflink = selflink; - return this; - } - /** * URL to endpoint where AAI can get more details. * @@ -155,11 +138,6 @@ public class AaiPnfResultModel { this.selflink = selflink; } - public AaiPnfResultModel pnfName2Source(String pnfName2Source) { - this.pnfName2Source = pnfName2Source; - return this; - } - /** * source of name2 * @@ -173,11 +151,6 @@ public class AaiPnfResultModel { this.pnfName2Source = pnfName2Source; } - public AaiPnfResultModel pnfId(String pnfId) { - this.pnfId = pnfId; - return this; - } - /** * id of pnf * @@ -191,11 +164,6 @@ public class AaiPnfResultModel { this.pnfId = pnfId; } - public AaiPnfResultModel equipType(String equipType) { - this.equipType = equipType; - return this; - } - /** * Equipment type. Source of truth should define valid values. * @@ -209,11 +177,6 @@ public class AaiPnfResultModel { this.equipType = equipType; } - public AaiPnfResultModel equipVendor(String equipVendor) { - this.equipVendor = equipVendor; - return this; - } - /** * Equipment vendor. Source of truth should define valid values. * @@ -227,11 +190,6 @@ public class AaiPnfResultModel { this.equipVendor = equipVendor; } - public AaiPnfResultModel equipModel(String equipModel) { - this.equipModel = equipModel; - return this; - } - /** * Equipment model. Source of truth should define valid values. * @@ -245,11 +203,6 @@ public class AaiPnfResultModel { this.equipModel = equipModel; } - public AaiPnfResultModel managementOption(String managementOption) { - this.managementOption = managementOption; - return this; - } - /** * identifier of managed by ATT or customer * @@ -263,11 +216,6 @@ public class AaiPnfResultModel { this.managementOption = managementOption; } - public AaiPnfResultModel ipaddressV4Oam(String ipaddressV4Oam) { - this.ipaddressV4Oam = ipaddressV4Oam; - return this; - } - /** * ipv4-oam-address with new naming convention for IP addresses * @@ -281,11 +229,6 @@ public class AaiPnfResultModel { this.ipaddressV4Oam = ipaddressV4Oam; } - public AaiPnfResultModel swVersion(String swVersion) { - this.swVersion = swVersion; - return this; - } - /** * sw-version is the version of SW for the hosted application on the PNF. * @@ -299,11 +242,6 @@ public class AaiPnfResultModel { this.swVersion = swVersion; } - public AaiPnfResultModel inMaint(Boolean inMaint) { - this.inMaint = inMaint; - return this; - } - /** * Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs. * @@ -317,11 +255,6 @@ public class AaiPnfResultModel { this.inMaint = inMaint; } - public AaiPnfResultModel frameId(String frameId) { - this.frameId = frameId; - return this; - } - /** * ID of the physical frame (relay rack) where pnf is installed. * @@ -335,11 +268,6 @@ public class AaiPnfResultModel { this.frameId = frameId; } - public AaiPnfResultModel serialNumber(String serialNumber) { - this.serialNumber = serialNumber; - return this; - } - /** * Serial number of the device * @@ -353,11 +281,6 @@ public class AaiPnfResultModel { this.serialNumber = serialNumber; } - public AaiPnfResultModel ipaddressV4Loopback0(String ipaddressV4Loopback0) { - this.ipaddressV4Loopback0 = ipaddressV4Loopback0; - return this; - } - /** * IPV4 Loopback 0 address * @@ -371,11 +294,6 @@ public class AaiPnfResultModel { this.ipaddressV4Loopback0 = ipaddressV4Loopback0; } - public AaiPnfResultModel ipaddressV6Loopback0(String ipaddressV6Loopback0) { - this.ipaddressV6Loopback0 = ipaddressV6Loopback0; - return this; - } - /** * IPV6 Loopback 0 address * @@ -389,11 +307,6 @@ public class AaiPnfResultModel { this.ipaddressV6Loopback0 = ipaddressV6Loopback0; } - public AaiPnfResultModel ipaddressV4Aim(String ipaddressV4Aim) { - this.ipaddressV4Aim = ipaddressV4Aim; - return this; - } - /** * IPV4 AIM address * @@ -407,11 +320,6 @@ public class AaiPnfResultModel { this.ipaddressV4Aim = ipaddressV4Aim; } - public AaiPnfResultModel ipaddressV6Aim(String ipaddressV6Aim) { - this.ipaddressV6Aim = ipaddressV6Aim; - return this; - } - /** * IPV6 AIM address * @@ -425,11 +333,6 @@ public class AaiPnfResultModel { this.ipaddressV6Aim = ipaddressV6Aim; } - public AaiPnfResultModel ipaddressV6Oam(String ipaddressV6Oam) { - this.ipaddressV6Oam = ipaddressV6Oam; - return this; - } - /** * IPV6 OAM address * @@ -443,11 +346,6 @@ public class AaiPnfResultModel { this.ipaddressV6Oam = ipaddressV6Oam; } - public AaiPnfResultModel invStatus(String invStatus) { - this.invStatus = invStatus; - return this; - } - /** * CANOPI's inventory status. Only set with values exactly as defined by CANOPI. * @@ -461,11 +359,6 @@ public class AaiPnfResultModel { this.invStatus = invStatus; } - public AaiPnfResultModel resourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - return this; - } - /** * Used for optimistic concurrency. Must be empty on create, valid on update and delete. * @@ -479,11 +372,6 @@ public class AaiPnfResultModel { this.resourceVersion = resourceVersion; } - public AaiPnfResultModel provStatus(String provStatus) { - this.provStatus = provStatus; - return this; - } - /** * Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV] * @@ -497,11 +385,6 @@ public class AaiPnfResultModel { this.provStatus = provStatus; } - public AaiPnfResultModel nfRole(String nfRole) { - this.nfRole = nfRole; - return this; - } - /** * Nf Role is the role performed by this instance in the network. * @@ -515,11 +398,6 @@ public class AaiPnfResultModel { this.nfRole = nfRole; } - public AaiPnfResultModel relationshipList(Relationship relationshipList) { - this.relationshipList = relationshipList; - return this; - } - /** * Get relationshipList * @@ -534,47 +412,6 @@ public class AaiPnfResultModel { } @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AaiPnfResultModel pnf = (AaiPnfResultModel) o; - return Objects.equals(this.pnfName, pnf.pnfName) && - Objects.equals(this.pnfName2, pnf.pnfName2) && - Objects.equals(this.selflink, pnf.selflink) && - Objects.equals(this.pnfName2Source, pnf.pnfName2Source) && - Objects.equals(this.pnfId, pnf.pnfId) && - Objects.equals(this.equipType, pnf.equipType) && - Objects.equals(this.equipVendor, pnf.equipVendor) && - Objects.equals(this.equipModel, pnf.equipModel) && - Objects.equals(this.managementOption, pnf.managementOption) && - Objects.equals(this.ipaddressV4Oam, pnf.ipaddressV4Oam) && - Objects.equals(this.swVersion, pnf.swVersion) && - Objects.equals(this.inMaint, pnf.inMaint) && - Objects.equals(this.frameId, pnf.frameId) && - Objects.equals(this.serialNumber, pnf.serialNumber) && - Objects.equals(this.ipaddressV4Loopback0, pnf.ipaddressV4Loopback0) && - Objects.equals(this.ipaddressV6Loopback0, pnf.ipaddressV6Loopback0) && - Objects.equals(this.ipaddressV4Aim, pnf.ipaddressV4Aim) && - Objects.equals(this.ipaddressV6Aim, pnf.ipaddressV6Aim) && - Objects.equals(this.ipaddressV6Oam, pnf.ipaddressV6Oam) && - Objects.equals(this.invStatus, pnf.invStatus) && - Objects.equals(this.resourceVersion, pnf.resourceVersion) && - Objects.equals(this.provStatus, pnf.provStatus) && - Objects.equals(this.nfRole, pnf.nfRole) && - Objects.equals(this.relationshipList, pnf.relationshipList); - } - - @Override - public int hashCode() { - return Objects.hash(pnfName, pnfName2, selflink, pnfName2Source, pnfId, equipType, equipVendor, equipModel, managementOption, ipaddressV4Oam, swVersion, inMaint, frameId, serialNumber, ipaddressV4Loopback0, ipaddressV6Loopback0, ipaddressV4Aim, ipaddressV6Aim, ipaddressV6Oam, invStatus, resourceVersion, provStatus, nfRole, relationshipList); - } - - - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AaiPnfResultModel {\n"); diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiServiceInstanceResultModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiServiceInstanceResultModel.java index bb839c3c..7bf8e2e4 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiServiceInstanceResultModel.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/AaiServiceInstanceResultModel.java @@ -22,8 +22,6 @@ package org.onap.dcaegen2.services.prh.model; import com.google.gson.annotations.SerializedName; -import java.util.Objects; - public class AaiServiceInstanceResultModel { @SerializedName("service-instance-id") private String serviceInstanceId = null; @@ -100,11 +98,6 @@ public class AaiServiceInstanceResultModel { @SerializedName("relationship-list") private Relationship relationshipList = null; - public AaiServiceInstanceResultModel serviceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - return this; - } - /** * Uniquely identifies this instance of a service * @@ -118,11 +111,6 @@ public class AaiServiceInstanceResultModel { this.serviceInstanceId = serviceInstanceId; } - public AaiServiceInstanceResultModel serviceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - return this; - } - /** * This field will store a name assigned to the service-instance. * @@ -136,11 +124,6 @@ public class AaiServiceInstanceResultModel { this.serviceInstanceName = serviceInstanceName; } - public AaiServiceInstanceResultModel serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - /** * String capturing type of service. * @@ -154,11 +137,6 @@ public class AaiServiceInstanceResultModel { this.serviceType = serviceType; } - public AaiServiceInstanceResultModel serviceRole(String serviceRole) { - this.serviceRole = serviceRole; - return this; - } - /** * String capturing the service role. * @@ -172,11 +150,6 @@ public class AaiServiceInstanceResultModel { this.serviceRole = serviceRole; } - public AaiServiceInstanceResultModel environmentContext(String environmentContext) { - this.environmentContext = environmentContext; - return this; - } - /** * This field will store the environment context assigned to the service-instance. * @@ -190,11 +163,6 @@ public class AaiServiceInstanceResultModel { this.environmentContext = environmentContext; } - public AaiServiceInstanceResultModel workloadContext(String workloadContext) { - this.workloadContext = workloadContext; - return this; - } - /** * This field will store the workload context assigned to the service-instance. * @@ -208,11 +176,6 @@ public class AaiServiceInstanceResultModel { this.workloadContext = workloadContext; } - public AaiServiceInstanceResultModel createdAt(String createdAt) { - this.createdAt = createdAt; - return this; - } - /** * create time of Network Service. * @@ -226,11 +189,6 @@ public class AaiServiceInstanceResultModel { this.createdAt = createdAt; } - public AaiServiceInstanceResultModel updatedAt(String updatedAt) { - this.updatedAt = updatedAt; - return this; - } - /** * last update of Network Service. * @@ -244,11 +202,6 @@ public class AaiServiceInstanceResultModel { this.updatedAt = updatedAt; } - public AaiServiceInstanceResultModel description(String description) { - this.description = description; - return this; - } - /** * short description for service-instance. * @@ -262,11 +215,6 @@ public class AaiServiceInstanceResultModel { this.description = description; } - public AaiServiceInstanceResultModel modelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - return this; - } - /** * the ASDC model id for this resource or service model. * @@ -280,11 +228,6 @@ public class AaiServiceInstanceResultModel { this.modelInvariantId = modelInvariantId; } - public AaiServiceInstanceResultModel modelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - return this; - } - /** * the ASDC model version for this resource or service model. * @@ -298,11 +241,6 @@ public class AaiServiceInstanceResultModel { this.modelVersionId = modelVersionId; } - public AaiServiceInstanceResultModel personaModelVersion(String personaModelVersion) { - this.personaModelVersion = personaModelVersion; - return this; - } - /** * the ASDC model version for this resource or service model. * @@ -316,11 +254,6 @@ public class AaiServiceInstanceResultModel { this.personaModelVersion = personaModelVersion; } - public AaiServiceInstanceResultModel widgetModelId(String widgetModelId) { - this.widgetModelId = widgetModelId; - return this; - } - /** * the ASDC data dictionary widget model. This maps directly to the A&AI widget. * @@ -334,11 +267,6 @@ public class AaiServiceInstanceResultModel { this.widgetModelId = widgetModelId; } - public AaiServiceInstanceResultModel widgetModelVersion(String widgetModelVersion) { - this.widgetModelVersion = widgetModelVersion; - return this; - } - /** * the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget. * @@ -352,11 +280,6 @@ public class AaiServiceInstanceResultModel { this.widgetModelVersion = widgetModelVersion; } - public AaiServiceInstanceResultModel bandwidthTotal(String bandwidthTotal) { - this.bandwidthTotal = bandwidthTotal; - return this; - } - /** * Indicates the total bandwidth to be used for this service. * @@ -370,11 +293,6 @@ public class AaiServiceInstanceResultModel { this.bandwidthTotal = bandwidthTotal; } - public AaiServiceInstanceResultModel bandwidthUpWan1(String bandwidthUpWan1) { - this.bandwidthUpWan1 = bandwidthUpWan1; - return this; - } - /** * indicates the upstream bandwidth this service will use on the WAN1 port of the physical device. * @@ -388,11 +306,6 @@ public class AaiServiceInstanceResultModel { this.bandwidthUpWan1 = bandwidthUpWan1; } - public AaiServiceInstanceResultModel bandwidthDownWan1(String bandwidthDownWan1) { - this.bandwidthDownWan1 = bandwidthDownWan1; - return this; - } - /** * indicates the downstream bandwidth this service will use on the WAN1 port of the physical device. * @@ -406,11 +319,6 @@ public class AaiServiceInstanceResultModel { this.bandwidthDownWan1 = bandwidthDownWan1; } - public AaiServiceInstanceResultModel bandwidthUpWan2(String bandwidthUpWan2) { - this.bandwidthUpWan2 = bandwidthUpWan2; - return this; - } - /** * indicates the upstream bandwidth this service will use on the WAN2 port of the physical device. * @@ -424,11 +332,6 @@ public class AaiServiceInstanceResultModel { this.bandwidthUpWan2 = bandwidthUpWan2; } - public AaiServiceInstanceResultModel bandwidthDownWan2(String bandwidthDownWan2) { - this.bandwidthDownWan2 = bandwidthDownWan2; - return this; - } - /** * indicates the downstream bandwidth this service will use on the WAN2 port of the physical device. * @@ -442,11 +345,6 @@ public class AaiServiceInstanceResultModel { this.bandwidthDownWan2 = bandwidthDownWan2; } - public AaiServiceInstanceResultModel vhnPortalUrl(String vhnPortalUrl) { - this.vhnPortalUrl = vhnPortalUrl; - return this; - } - /** * URL customers will use to access the vHN Portal. * @@ -460,11 +358,6 @@ public class AaiServiceInstanceResultModel { this.vhnPortalUrl = vhnPortalUrl; } - public AaiServiceInstanceResultModel serviceInstanceLocationId(String serviceInstanceLocationId) { - this.serviceInstanceLocationId = serviceInstanceLocationId; - return this; - } - /** * An identifier that customers assign to the location where this service is being used. * @@ -478,11 +371,6 @@ public class AaiServiceInstanceResultModel { this.serviceInstanceLocationId = serviceInstanceLocationId; } - public AaiServiceInstanceResultModel resourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - return this; - } - /** * Used for optimistic concurrency. Must be empty on create, valid on update and delete. * @@ -496,11 +384,6 @@ public class AaiServiceInstanceResultModel { this.resourceVersion = resourceVersion; } - public AaiServiceInstanceResultModel selflink(String selflink) { - this.selflink = selflink; - return this; - } - /** * Path to the controller object. * @@ -514,11 +397,6 @@ public class AaiServiceInstanceResultModel { this.selflink = selflink; } - public AaiServiceInstanceResultModel orchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - return this; - } - /** * Orchestration status of this service. * @@ -532,10 +410,6 @@ public class AaiServiceInstanceResultModel { this.orchestrationStatus = orchestrationStatus; } - public AaiServiceInstanceResultModel relationshipList(Relationship relationshipList) { - this.relationshipList = relationshipList; - return this; - } /** * Get relationshipList @@ -551,48 +425,6 @@ public class AaiServiceInstanceResultModel { } @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AaiServiceInstanceResultModel serviceInstance = (AaiServiceInstanceResultModel) o; - return Objects.equals(this.serviceInstanceId, serviceInstance.serviceInstanceId) && - Objects.equals(this.serviceInstanceName, serviceInstance.serviceInstanceName) && - Objects.equals(this.serviceType, serviceInstance.serviceType) && - Objects.equals(this.serviceRole, serviceInstance.serviceRole) && - Objects.equals(this.environmentContext, serviceInstance.environmentContext) && - Objects.equals(this.workloadContext, serviceInstance.workloadContext) && - Objects.equals(this.createdAt, serviceInstance.createdAt) && - Objects.equals(this.updatedAt, serviceInstance.updatedAt) && - Objects.equals(this.description, serviceInstance.description) && - Objects.equals(this.modelInvariantId, serviceInstance.modelInvariantId) && - Objects.equals(this.modelVersionId, serviceInstance.modelVersionId) && - Objects.equals(this.personaModelVersion, serviceInstance.personaModelVersion) && - Objects.equals(this.widgetModelId, serviceInstance.widgetModelId) && - Objects.equals(this.widgetModelVersion, serviceInstance.widgetModelVersion) && - Objects.equals(this.bandwidthTotal, serviceInstance.bandwidthTotal) && - Objects.equals(this.bandwidthUpWan1, serviceInstance.bandwidthUpWan1) && - Objects.equals(this.bandwidthDownWan1, serviceInstance.bandwidthDownWan1) && - Objects.equals(this.bandwidthUpWan2, serviceInstance.bandwidthUpWan2) && - Objects.equals(this.bandwidthDownWan2, serviceInstance.bandwidthDownWan2) && - Objects.equals(this.vhnPortalUrl, serviceInstance.vhnPortalUrl) && - Objects.equals(this.serviceInstanceLocationId, serviceInstance.serviceInstanceLocationId) && - Objects.equals(this.resourceVersion, serviceInstance.resourceVersion) && - Objects.equals(this.selflink, serviceInstance.selflink) && - Objects.equals(this.orchestrationStatus, serviceInstance.orchestrationStatus) && - Objects.equals(this.relationshipList, serviceInstance.relationshipList); - } - - @Override - public int hashCode() { - return Objects.hash(serviceInstanceId, serviceInstanceName, serviceType, serviceRole, environmentContext, workloadContext, createdAt, updatedAt, description, modelInvariantId, modelVersionId, personaModelVersion, widgetModelId, widgetModelVersion, bandwidthTotal, bandwidthUpWan1, bandwidthDownWan1, bandwidthUpWan2, bandwidthDownWan2, vhnPortalUrl, serviceInstanceLocationId, resourceVersion, selflink, orchestrationStatus, relationshipList); - } - - - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AaiServiceInstanceResultModel {\n"); diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/Relationship.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/Relationship.java index 814cc641..094e1a62 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/Relationship.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/Relationship.java @@ -24,7 +24,6 @@ import com.google.gson.annotations.SerializedName; import java.util.ArrayList; import java.util.List; -import java.util.Objects; /** * dictionary of relationship @@ -40,7 +39,7 @@ public class Relationship { public Relationship addRelationshipItem(RelationshipDict relationshipItem) { if (this.relationship == null) { - this.relationship = new ArrayList<RelationshipDict>(); + this.relationship = new ArrayList<>(); } this.relationship.add(relationshipItem); return this; @@ -59,25 +58,6 @@ public class Relationship { this.relationship = relationship; } - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Relationship relationship = (Relationship) o; - return Objects.equals(this.relationship, relationship.relationship); - } - - @Override - public int hashCode() { - return Objects.hash(relationship); - } - - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipData.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipData.java index e5108ad6..8b33b650 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipData.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipData.java @@ -22,8 +22,6 @@ package org.onap.dcaegen2.services.prh.model; import com.google.gson.annotations.SerializedName; -import java.util.Objects; - /** * RelationshipData */ @@ -34,11 +32,6 @@ public class RelationshipData { @SerializedName("relationship-value") private String relationshipValue = null; - public RelationshipData relationshipKey(String relationshipKey) { - this.relationshipKey = relationshipKey; - return this; - } - /** * A keyword provided by A&AI to indicate an attribute. * @@ -52,11 +45,6 @@ public class RelationshipData { this.relationshipKey = relationshipKey; } - public RelationshipData relationshipValue(String relationshipValue) { - this.relationshipValue = relationshipValue; - return this; - } - /** * Value of the attribute. * @@ -72,25 +60,6 @@ public class RelationshipData { @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RelationshipData relationshipData = (RelationshipData) o; - return Objects.equals(this.relationshipKey, relationshipData.relationshipKey) && - Objects.equals(this.relationshipValue, relationshipData.relationshipValue); - } - - @Override - public int hashCode() { - return Objects.hash(relationshipKey, relationshipValue); - } - - - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RelationshipData {\n"); diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipDict.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipDict.java index 5db99dc7..0a7a9459 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipDict.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/RelationshipDict.java @@ -24,7 +24,6 @@ import com.google.gson.annotations.SerializedName; import java.util.ArrayList; import java.util.List; -import java.util.Objects; /** * RelationshipDict @@ -42,11 +41,6 @@ public class RelationshipDict { @SerializedName("relationship-data") private List<RelationshipData> relationshipData = null; - public RelationshipDict relatedTo(String relatedTo) { - this.relatedTo = relatedTo; - return this; - } - /** * A keyword provided by A&AI to indicate type of node. * @@ -60,11 +54,6 @@ public class RelationshipDict { this.relatedTo = relatedTo; } - public RelationshipDict relationshipLabel(String relationshipLabel) { - this.relationshipLabel = relationshipLabel; - return this; - } - /** * The edge label for this relationship. * @@ -78,11 +67,6 @@ public class RelationshipDict { this.relationshipLabel = relationshipLabel; } - public RelationshipDict relatedLink(String relatedLink) { - this.relatedLink = relatedLink; - return this; - } - /** * URL to the object in A&AI. * @@ -96,11 +80,6 @@ public class RelationshipDict { this.relatedLink = relatedLink; } - public RelationshipDict relationshipData(List<RelationshipData> relationshipData) { - this.relationshipData = relationshipData; - return this; - } - public RelationshipDict addRelationshipDataItem(RelationshipData relationshipDataItem) { if (this.relationshipData == null) { this.relationshipData = new ArrayList<RelationshipData>(); @@ -124,27 +103,6 @@ public class RelationshipDict { @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RelationshipDict relationshipDict = (RelationshipDict) o; - return Objects.equals(this.relatedTo, relationshipDict.relatedTo) && - Objects.equals(this.relationshipLabel, relationshipDict.relationshipLabel) && - Objects.equals(this.relatedLink, relationshipDict.relatedLink) && - Objects.equals(this.relationshipData, relationshipDict.relationshipData); - } - - @Override - public int hashCode() { - return Objects.hash(relatedTo, relationshipLabel, relatedLink, relationshipData); - } - - - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RelationshipDict {\n"); diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiPnfResultModelTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiPnfResultModelTest.java new file mode 100644 index 00000000..4bafd90e --- /dev/null +++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiPnfResultModelTest.java @@ -0,0 +1,158 @@ +/* + * ============LICENSE_START======================================================= + * PNF-REGISTRATION-HANDLER + * ================================================================================ + * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved. + * ================================================================================ + * 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.dcaegen2.services.prh.model; + +import com.google.gson.GsonBuilder; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +class AaiPnfResultModelTest { + + private static final String SOME_AAI_PNF_JSON = "{" + + "\"pnf-name\":\"some pnfName\"," + + "\"pnf-name2\":\"some pnfName2\"," + + "\"selflink\":\"some selflink\"," + + "\"pnf-name2-source\":\"some pnfName2Source\"," + + "\"pnf-id\":\"some pnfId\"," + + "\"equip-type\":\"some equipType\"," + + "\"equip-vendor\":\"some equipVendor\"," + + "\"equip-model\":\"some equipModel\"," + + "\"management-option\":\"some managementOption\"," + + "\"ipaddress-v4-oam\":\"some ipaddressV4Oam\"," + + "\"sw-version\":\"some swVersion\"," + + "\"in-maint\":false," + + "\"frame-id\":\"some frameId\"," + + "\"serial-number\":\"some serialNumber\"," + + "\"ipaddress-v4-loopback-0\":\"some ipaddressV4Loopback0\"," + + "\"ipaddress-v6-loopback-0\":\"some ipaddressV6Loopback0\"," + + "\"ipaddress-v4-aim\":\"some ipaddressV4Aim\"," + + "\"ipaddress-v6-aim\":\"some ipaddressV6Aim\"," + + "\"ipaddress-v6-oam\":\"some ipaddressV6Oam\"," + + "\"inv-status\":\"some invStatus\"," + + "\"resource-version\":\"some resourceVersion\"," + + "\"prov-status\":\"some provStatus\"," + + "\"nf-role\":\"some nfRole\"," + + "\"relationship-list\":{\"relationship\":[{}]}" + + "}"; + + private static AaiPnfResultModel getAaiPnfResultModel() { + AaiPnfResultModel aaiPnf = new AaiPnfResultModel(); + aaiPnf.setPnfName("some pnfName"); + aaiPnf.setPnfName2("some pnfName2"); + aaiPnf.setSelflink("some selflink"); + aaiPnf.setPnfName2Source("some pnfName2Source"); + aaiPnf.setPnfId("some pnfId"); + aaiPnf.setEquipType("some equipType"); + aaiPnf.setEquipVendor("some equipVendor"); + aaiPnf.setEquipModel("some equipModel"); + aaiPnf.setManagementOption("some managementOption"); + aaiPnf.setIpaddressV4Oam("some ipaddressV4Oam"); + aaiPnf.setSwVersion("some swVersion"); + aaiPnf.setInMaint(false); + aaiPnf.setFrameId("some frameId"); + aaiPnf.setSerialNumber("some serialNumber"); + aaiPnf.setIpaddressV4Loopback0("some ipaddressV4Loopback0"); + aaiPnf.setIpaddressV6Loopback0("some ipaddressV6Loopback0"); + aaiPnf.setIpaddressV4Aim("some ipaddressV4Aim"); + aaiPnf.setIpaddressV6Aim("some ipaddressV6Aim"); + aaiPnf.setIpaddressV6Oam("some ipaddressV6Oam"); + aaiPnf.setInvStatus("some invStatus"); + aaiPnf.setResourceVersion("some resourceVersion"); + aaiPnf.setProvStatus("some provStatus"); + aaiPnf.setNfRole("some nfRole"); + aaiPnf.setRelationshipList(getSomeRelationshipList()); + return aaiPnf; + } + + private static Relationship getSomeRelationshipList() { + return new Relationship().addRelationshipItem( + new RelationshipDict()); + } + + @Test + void shouldSerializeAaiPnf() { + String json = new GsonBuilder().create().toJson(getAaiPnfResultModel()); + + assertEquals(SOME_AAI_PNF_JSON, json); + } + + @Test + void shouldParseAaiPnf() { + AaiPnfResultModel pnf = new GsonBuilder().create().fromJson(SOME_AAI_PNF_JSON, AaiPnfResultModel.class); + + assertEquals("some pnfName", pnf.getPnfName()); + assertEquals("some pnfName2", pnf.getPnfName2()); + assertEquals("some selflink", pnf.getSelflink()); + assertEquals("some pnfName2Source", pnf.getPnfName2Source()); + assertEquals("some pnfId", pnf.getPnfId()); + assertEquals("some equipType", pnf.getEquipType()); + assertEquals("some equipVendor", pnf.getEquipVendor()); + assertEquals("some equipModel", pnf.getEquipModel()); + assertEquals("some managementOption", pnf.getManagementOption()); + assertEquals("some ipaddressV4Oam", pnf.getIpaddressV4Oam()); + assertEquals("some swVersion", pnf.getSwVersion()); + assertEquals(false, pnf.isInMaint()); + assertEquals("some frameId", pnf.getFrameId()); + assertEquals("some serialNumber", pnf.getSerialNumber()); + assertEquals("some ipaddressV4Loopback0", pnf.getIpaddressV4Loopback0()); + assertEquals("some ipaddressV6Loopback0", pnf.getIpaddressV6Loopback0()); + assertEquals("some ipaddressV4Aim", pnf.getIpaddressV4Aim()); + assertEquals("some ipaddressV6Aim", pnf.getIpaddressV6Aim()); + assertEquals("some ipaddressV6Oam", pnf.getIpaddressV6Oam()); + assertEquals("some invStatus", pnf.getInvStatus()); + assertEquals("some resourceVersion", pnf.getResourceVersion()); + assertEquals("some provStatus", pnf.getProvStatus()); + assertEquals("some nfRole", pnf.getNfRole()); + assertEquals(1, pnf.getRelationshipList().getRelationship().size()); + } + + @Test + void shouldBePrintable() { + String s = getAaiPnfResultModel().toString(); + assertThat(s).contains("some pnfName"); + assertThat(s).contains("some pnfName2"); + assertThat(s).contains("some selflink"); + assertThat(s).contains("some pnfName2Source"); + assertThat(s).contains("some pnfId"); + assertThat(s).contains("some equipType"); + assertThat(s).contains("some equipVendor"); + assertThat(s).contains("some equipModel"); + assertThat(s).contains("some managementOption"); + assertThat(s).contains("some ipaddressV4Oam"); + assertThat(s).contains("some swVersion"); + assertThat(s).contains("false"); + assertThat(s).contains("some frameId"); + assertThat(s).contains("some serialNumber"); + assertThat(s).contains("some ipaddressV4Loopback0"); + assertThat(s).contains("some ipaddressV6Loopback0"); + assertThat(s).contains("some ipaddressV4Aim"); + assertThat(s).contains("some ipaddressV6Aim"); + assertThat(s).contains("some ipaddressV6Oam"); + assertThat(s).contains("some invStatus"); + assertThat(s).contains("some resourceVersion"); + assertThat(s).contains("some provStatus"); + assertThat(s).contains("some nfRole"); + } + + +}
\ No newline at end of file diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiServiceInstanceResultModelTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiServiceInstanceResultModelTest.java new file mode 100644 index 00000000..2b02436b --- /dev/null +++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/AaiServiceInstanceResultModelTest.java @@ -0,0 +1,160 @@ +/* + * ============LICENSE_START======================================================= + * PNF-REGISTRATION-HANDLER + * ================================================================================ + * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved. + * ================================================================================ + * 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.dcaegen2.services.prh.model; + +import com.google.gson.GsonBuilder; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +class AaiServiceInstanceResultModelTest { + + private static final String SOME_AAI_SERVICE_INSTANCE_JSON = "{" + + "\"service-instance-id\":\"some serviceInstanceId\"," + + "\"service-instance-name\":\"some serviceInstanceName\"," + + "\"service-type\":\"some serviceType\"," + + "\"service-role\":\"some serviceRole\"," + + "\"environment-context\":\"some environmentContext\"," + + "\"workload-context\":\"some workloadContext\"," + + "\"created-at\":\"some createdAt\"," + + "\"updated-at\":\"some updatedAt\"," + + "\"description\":\"some description\"," + + "\"model-invariant-id\":\"some modelInvariantId\"," + + "\"model-version-id\":\"some modelVersionId\"," + + "\"persona-model-version\":\"some personaModelVersion\"," + + "\"widget-model-id\":\"some widgetModelId\"," + + "\"widget-model-version\":\"some widgetModelVersion\"," + + "\"bandwidth-total\":\"some bandwidthTotal\"," + + "\"bandwidth-up-wan1\":\"some bandwidthUpWan1\"," + + "\"bandwidth-down-wan1\":\"some bandwidthDownWan1\"," + + "\"bandwidth-up-wan2\":\"some bandwidthUpWan2\"," + + "\"bandwidth-down-wan2\":\"some bandwidthDownWan2\"," + + "\"vhn-portal-url\":\"some vhnPortalUrl\"," + + "\"service-instance-location-id\":\"some serviceInstanceLocationId\"," + + "\"resource-version\":\"some resourceVersion\"," + + "\"selflink\":\"some selflink\"," + + "\"orchestration-status\":\"some orchestrationStatus\"," + + "\"relationship-list\":{\"relationship\":[{}]}" + + "}"; + + private static AaiServiceInstanceResultModel getSomeAaiServiceInstance() { + AaiServiceInstanceResultModel serviceInstance = new AaiServiceInstanceResultModel(); + serviceInstance.setServiceInstanceId("some serviceInstanceId"); + serviceInstance.setServiceInstanceName("some serviceInstanceName"); + serviceInstance.setServiceType("some serviceType"); + serviceInstance.setServiceRole("some serviceRole"); + serviceInstance.setEnvironmentContext("some environmentContext"); + serviceInstance.setWorkloadContext("some workloadContext"); + serviceInstance.setCreatedAt("some createdAt"); + serviceInstance.setUpdatedAt("some updatedAt"); + serviceInstance.setDescription("some description"); + serviceInstance.setModelInvariantId("some modelInvariantId"); + serviceInstance.setModelVersionId("some modelVersionId"); + serviceInstance.setPersonaModelVersion("some personaModelVersion"); + serviceInstance.setWidgetModelId("some widgetModelId"); + serviceInstance.setWidgetModelVersion("some widgetModelVersion"); + serviceInstance.setBandwidthTotal("some bandwidthTotal"); + serviceInstance.setBandwidthUpWan1("some bandwidthUpWan1"); + serviceInstance.setBandwidthDownWan1("some bandwidthDownWan1"); + serviceInstance.setBandwidthUpWan2("some bandwidthUpWan2"); + serviceInstance.setBandwidthDownWan2("some bandwidthDownWan2"); + serviceInstance.setVhnPortalUrl("some vhnPortalUrl"); + serviceInstance.setServiceInstanceLocationId("some serviceInstanceLocationId"); + serviceInstance.setResourceVersion("some resourceVersion"); + serviceInstance.setSelflink("some selflink"); + serviceInstance.setOrchestrationStatus("some orchestrationStatus"); + serviceInstance.setRelationshipList(getSomeRelationshipList()); + return serviceInstance; + } + + private static Relationship getSomeRelationshipList() { + return new Relationship().addRelationshipItem( + new RelationshipDict()); + } + + @Test + void shouldSerializeAaiServiceInstance() { + String json = new GsonBuilder().create().toJson(getSomeAaiServiceInstance()); + assertEquals(SOME_AAI_SERVICE_INSTANCE_JSON, json); + } + + @Test + void shouldParseAaiServiceInstance() { + AaiServiceInstanceResultModel serviceInstance = new GsonBuilder().create() + .fromJson(SOME_AAI_SERVICE_INSTANCE_JSON, AaiServiceInstanceResultModel.class); + + assertEquals("some serviceInstanceId", serviceInstance.getServiceInstanceId()); + assertEquals("some serviceInstanceName", serviceInstance.getServiceInstanceName()); + assertEquals("some serviceType", serviceInstance.getServiceType()); + assertEquals("some serviceRole", serviceInstance.getServiceRole()); + assertEquals("some environmentContext", serviceInstance.getEnvironmentContext()); + assertEquals("some workloadContext", serviceInstance.getWorkloadContext()); + assertEquals("some createdAt", serviceInstance.getCreatedAt()); + assertEquals("some updatedAt", serviceInstance.getUpdatedAt()); + assertEquals("some description", serviceInstance.getDescription()); + assertEquals("some modelInvariantId", serviceInstance.getModelInvariantId()); + assertEquals("some modelVersionId", serviceInstance.getModelVersionId()); + assertEquals("some personaModelVersion", serviceInstance.getPersonaModelVersion()); + assertEquals("some widgetModelId", serviceInstance.getWidgetModelId()); + assertEquals("some widgetModelVersion", serviceInstance.getWidgetModelVersion()); + assertEquals("some bandwidthTotal", serviceInstance.getBandwidthTotal()); + assertEquals("some bandwidthUpWan1", serviceInstance.getBandwidthUpWan1()); + assertEquals("some bandwidthDownWan1", serviceInstance.getBandwidthDownWan1()); + assertEquals("some bandwidthUpWan2", serviceInstance.getBandwidthUpWan2()); + assertEquals("some bandwidthDownWan2", serviceInstance.getBandwidthDownWan2()); + assertEquals("some vhnPortalUrl", serviceInstance.getVhnPortalUrl()); + assertEquals("some serviceInstanceLocationId", serviceInstance.getServiceInstanceLocationId()); + assertEquals("some resourceVersion", serviceInstance.getResourceVersion()); + assertEquals("some selflink", serviceInstance.getSelflink()); + assertEquals("some orchestrationStatus", serviceInstance.getOrchestrationStatus()); + assertEquals(1, serviceInstance.getRelationshipList().getRelationship().size()); + } + + @Test + void shouldBePrintable() { + String s = getSomeAaiServiceInstance().toString(); + assertThat(s).contains("some serviceInstanceId"); + assertThat(s).contains("some serviceInstanceName"); + assertThat(s).contains("some serviceType"); + assertThat(s).contains("some serviceRole"); + assertThat(s).contains("some environmentContext"); + assertThat(s).contains("some workloadContext"); + assertThat(s).contains("some createdAt"); + assertThat(s).contains("some updatedAt"); + assertThat(s).contains("some description"); + assertThat(s).contains("some modelInvariantId"); + assertThat(s).contains("some modelVersionId"); + assertThat(s).contains("some personaModelVersion"); + assertThat(s).contains("some widgetModelId"); + assertThat(s).contains("some widgetModelVersion"); + assertThat(s).contains("some bandwidthTotal"); + assertThat(s).contains("some bandwidthUpWan1"); + assertThat(s).contains("some bandwidthDownWan1"); + assertThat(s).contains("some bandwidthUpWan2"); + assertThat(s).contains("some bandwidthDownWan2"); + assertThat(s).contains("some vhnPortalUrl"); + assertThat(s).contains("some serviceInstanceLocationId"); + assertThat(s).contains("some resourceVersion"); + assertThat(s).contains("some selflink"); + assertThat(s).contains("some orchestrationStatus"); + } +}
\ No newline at end of file |