From 54dec15de7897cc737c2daa5c8f904483215ef2e Mon Sep 17 00:00:00 2001 From: "Tait,Trevor(rt0435)" Date: Tue, 28 Aug 2018 15:59:03 -0400 Subject: Adding Network and VM Issue-ID: LOG-614 Change-Id: I00b2f38ed0db1e1d8886732c1bbfd775704b60a4 Signed-off-by: Tait,Trevor(rt0435) --- .../org/onap/pomba/common/datatypes/Attribute.java | 14 ++-- .../onap/pomba/common/datatypes/DataQuality.java | 21 ++++++ .../onap/pomba/common/datatypes/ModelContext.java | 8 +- .../org/onap/pomba/common/datatypes/Network.java | 86 ++++++++++++++++++++++ .../org/onap/pomba/common/datatypes/Service.java | 4 +- .../java/org/onap/pomba/common/datatypes/VF.java | 16 ++-- .../org/onap/pomba/common/datatypes/VFModule.java | 28 ++++++- .../java/org/onap/pomba/common/datatypes/VM.java | 86 ++++++++++++++++++++++ .../java/org/onap/pomba/common/datatypes/VNFC.java | 4 +- 9 files changed, 242 insertions(+), 25 deletions(-) create mode 100644 src/main/java/org/onap/pomba/common/datatypes/Network.java create mode 100644 src/main/java/org/onap/pomba/common/datatypes/VM.java (limited to 'src/main/java') diff --git a/src/main/java/org/onap/pomba/common/datatypes/Attribute.java b/src/main/java/org/onap/pomba/common/datatypes/Attribute.java index d73435e..6a1f7b3 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/Attribute.java +++ b/src/main/java/org/onap/pomba/common/datatypes/Attribute.java @@ -24,15 +24,15 @@ import com.google.gson.annotations.SerializedName; public class Attribute { @Expose @SerializedName("name") - private String name; + private Name name; @Expose @SerializedName("value") - private Value value; + private String value; @Expose @SerializedName("dataQuality") private DataQuality dataQuality = new DataQuality(); - public enum Value { + public enum Name { adminState, ipAddress, hostName, @@ -45,16 +45,16 @@ public class Attribute { networkRole, routerExternalBoolean } - public String getName() { + public Name getName() { return name; } - public void setName(String name) { + public void setName(Name name) { this.name = name; } - public Value getValue() { + public String getValue() { return value; } - public void setValue(Value value) { + public void setValue(String value) { this.value = value; } public DataQuality getDataQuality() { diff --git a/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java b/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java index 111fd94..9c442e0 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java +++ b/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java @@ -49,4 +49,25 @@ public class DataQuality { public void setErrorText(String errorText) { this.errorText = errorText; } + + public static DataQuality ok() { + // as a non-mutable class, it is not safe to define a constant for this + DataQuality result = new DataQuality(); + result.setStatus(Status.ok); + return result; + } + + public static DataQuality error(String text) { + // as a non-mutable class, it is not safe to define a constant for this + DataQuality result = new DataQuality(); + result.setStatus(Status.error); + result.setErrorText(text); + return result; + } + + @Override + public String toString() { + return "DataQuality [status=" + this.status + ", errorText=" + this.errorText + "]"; + } + } diff --git a/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java b/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java index 523ed52..592d68a 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java +++ b/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java @@ -50,19 +50,19 @@ public class ModelContext { public void setDataQuality(DataQuality dataQuality) { this.dataQuality = dataQuality; } - public List getAttribute() { + public List getAttributes() { return attributeList; } - public void setAttribute(List attributeList) { + public void setAttributes(List attributeList) { this.attributeList = attributeList; } public void addAttribute(Attribute attribute) { this.attributeList.add(attribute); } - public List getVf() { + public List getVfs() { return vfList; } - public void setVf(List vfList) { + public void setVfs(List vfList) { this.vfList = vfList; } public void addVf(VF vf) { diff --git a/src/main/java/org/onap/pomba/common/datatypes/Network.java b/src/main/java/org/onap/pomba/common/datatypes/Network.java new file mode 100644 index 0000000..19c286c --- /dev/null +++ b/src/main/java/org/onap/pomba/common/datatypes/Network.java @@ -0,0 +1,86 @@ +/* + * ============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.common.datatypes; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; + +public class Network { + @Expose + @SerializedName("name") + private String name; + @Expose + @SerializedName("invariantUUID") + private String invariantUuid; + @Expose + @SerializedName("uuid") + private String uuid; + @Expose + @SerializedName("nfNamingCode") + private String nfcNamingCode; + @Expose + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + @Expose + @SerializedName("attributeList") + private List attributeList = new ArrayList<>(); + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getInvariantUuid() { + return invariantUuid; + } + public void setInvariantUuid(String invariantUuid) { + this.invariantUuid = invariantUuid; + } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getNfcNamingCode() { + return nfcNamingCode; + } + public void setNfcNamingCode(String nfcType) { + this.nfcNamingCode = nfcType; + } + public List getAttributes() { + return attributeList; + } + public void setAttributes(List attributeList) { + this.attributeList = attributeList; + } + public void addAttribute(Attribute attribute) { + this.attributeList.add(attribute); + } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } + +} diff --git a/src/main/java/org/onap/pomba/common/datatypes/Service.java b/src/main/java/org/onap/pomba/common/datatypes/Service.java index 1fde805..b225b6a 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/Service.java +++ b/src/main/java/org/onap/pomba/common/datatypes/Service.java @@ -65,10 +65,10 @@ public class Service { public void setDataQuality(DataQuality dataQuality) { this.dataQuality = dataQuality; } - public List getAttribute() { + public List getAttributes() { return attributeList; } - public void setAttribute(List attributeList) { + public void setAttributes(List attributeList) { this.attributeList = attributeList; } public void addAttribute(Attribute attribute) { diff --git a/src/main/java/org/onap/pomba/common/datatypes/VF.java b/src/main/java/org/onap/pomba/common/datatypes/VF.java index 05fb9ec..7bbb962 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/VF.java +++ b/src/main/java/org/onap/pomba/common/datatypes/VF.java @@ -52,7 +52,7 @@ public class VF { private List vfModules = new ArrayList<>(); @Expose @SerializedName("vnfcList") - private List vnfc = new ArrayList<>(); + private List vnfcs = new ArrayList<>(); public String getName() { return name; @@ -93,19 +93,19 @@ public class VF { public void addVfModule(VFModule vfModule) { this.vfModules.add(vfModule); } - public List getVnfc() { - return vnfc; + public List getVnfcs() { + return vnfcs; } - public void setVnfc(List vnfc) { - this.vnfc = vnfc; + public void setVnfcs(List vnfc) { + this.vnfcs = vnfc; } public void addVnfc(VNFC vnfc) { - this.vnfc.add(vnfc); + this.vnfcs.add(vnfc); } - public List getAttribute() { + public List getAttributes() { return attributeList; } - public void setAttribute(List attributeList) { + public void setAttributes(List attributeList) { this.attributeList = attributeList; } public void addAttribute(Attribute attribute) { diff --git a/src/main/java/org/onap/pomba/common/datatypes/VFModule.java b/src/main/java/org/onap/pomba/common/datatypes/VFModule.java index 1c82801..876f6b2 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/VFModule.java +++ b/src/main/java/org/onap/pomba/common/datatypes/VFModule.java @@ -49,6 +49,12 @@ public class VFModule { @Expose @SerializedName("attributeList") private List attributeList = new ArrayList<>(); + @Expose + @SerializedName("vmList") + private List vms = new ArrayList<>(); + @Expose + @SerializedName("networkList") + private List networks = new ArrayList<>(); public String getName() { @@ -87,10 +93,28 @@ public class VFModule { public void setMinInstances(int minInstances) { this.minInstances = minInstances; } - public List getAttribute() { + public List getVms() { + return vms; + } + public void setVms(List vms) { + this.vms = vms; + } + public void addVm(VM vm) { + this.vms.add(vm); + } + public List getNetworks() { + return networks; + } + public void setNetworks(List network) { + this.networks = network; + } + public void addNetwork(Network vnfc) { + this.networks.add(vnfc); + } + public List getAttributes() { return attributeList; } - public void setAttribute(List attributeList) { + public void setAttributes(List attributeList) { this.attributeList = attributeList; } public void addAttribute(Attribute attribute) { diff --git a/src/main/java/org/onap/pomba/common/datatypes/VM.java b/src/main/java/org/onap/pomba/common/datatypes/VM.java new file mode 100644 index 0000000..29f4c29 --- /dev/null +++ b/src/main/java/org/onap/pomba/common/datatypes/VM.java @@ -0,0 +1,86 @@ +/* + * ============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.common.datatypes; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; + +public class VM { + @Expose + @SerializedName("name") + private String name; + @Expose + @SerializedName("invariantUUID") + private String invariantUuid; + @Expose + @SerializedName("uuid") + private String uuid; + @Expose + @SerializedName("nfNamingCode") + private String nfcNamingCode; + @Expose + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + @Expose + @SerializedName("attributeList") + private List attributeList = new ArrayList<>(); + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getInvariantUuid() { + return invariantUuid; + } + public void setInvariantUuid(String invariantUuid) { + this.invariantUuid = invariantUuid; + } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getNfcNamingCode() { + return nfcNamingCode; + } + public void setNfcNamingCode(String nfcType) { + this.nfcNamingCode = nfcType; + } + public List getAttributes() { + return attributeList; + } + public void setAttributes(List attributeList) { + this.attributeList = attributeList; + } + public void addAttribute(Attribute attribute) { + this.attributeList.add(attribute); + } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } + +} diff --git a/src/main/java/org/onap/pomba/common/datatypes/VNFC.java b/src/main/java/org/onap/pomba/common/datatypes/VNFC.java index 1302b6f..66c852a 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/VNFC.java +++ b/src/main/java/org/onap/pomba/common/datatypes/VNFC.java @@ -68,10 +68,10 @@ public class VNFC { public void setNfcNamingCode(String nfcType) { this.nfcNamingCode = nfcType; } - public List getAttribute() { + public List getAttributes() { return attributeList; } - public void setAttribute(List attributeList) { + public void setAttributes(List attributeList) { this.attributeList = attributeList; } public void addAttribute(Attribute attribute) { -- cgit 1.2.3-korg