From ef2ccf9b828b4cd09cdb35d8056dc3aa74cf7e8a Mon Sep 17 00:00:00 2001 From: "Leigh, Phillip (pl876u)" Date: Thu, 24 Jan 2019 12:15:39 -0500 Subject: BugFix:Correct Pserver EquipModel in AaiCtxBdr Issue-ID: LOG-762 Issue-ID: LOG-765 Change-Id: I167285512f722fdb8d1640b36ea2255e1decec3b Signed-off-by: Leigh, Phillip (pl876u) --- .../pomba/contextbuilder/aai/util/RestUtil.java | 239 ++++++++------------- 1 file changed, 87 insertions(+), 152 deletions(-) (limited to 'src/main/java/org') 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 b4d89f2..7c4f6bd 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 @@ -636,11 +636,11 @@ public class RestUtil { attributeList.add(att); } if ((name.toString().equals( ATTRIBUTE_EQUIPMENT_MODEL )) - &&(pserverInstance.getEquipVendor() != null)){ + &&(pserverInstance.getEquipModel() != null)){ Attribute att = new Attribute(); att.setDataQuality(DataQuality.ok()); att.setName(Attribute.Name.equipModel); - att.setValue(String.valueOf(pserverInstance.getEquipVendor())); + att.setValue(String.valueOf(pserverInstance.getEquipModel())); attributeList.add(att); } if ((name.toString().equals( ATTRIBUTE_FQDN )) @@ -721,81 +721,9 @@ public class RestUtil { pInterface.setDataQuality(DataQuality.ok()); List pInterface_attributeList = new ArrayList(); - pInterface.setAttributes(pInterface_attributeList); - - // Iterate through the ENUM Attribute list - for (Attribute.Name name: Attribute.Name.values()) { - if ((name.toString().equals(ATTRIBUTE_SPEED_VALUE )) - &&(pInterfaceInst_aai.getSpeedValue() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.speedValue); - att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedValue())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_SPEED_UNITS )) - &&(pInterfaceInst_aai.getSpeedUnits() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.speedUnits); - att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedUnits())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_PORT_DESCRIPTION )) - &&(pInterfaceInst_aai.getPortDescription() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.description); - att.setValue(String.valueOf( pInterfaceInst_aai.getPortDescription())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_EQUIPTMENT_ID )) - &&(pInterfaceInst_aai.getEquipmentIdentifier() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.equipmentID); - att.setValue(String.valueOf( pInterfaceInst_aai.getEquipmentIdentifier())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_INTERFACE_ROLE )) - &&(pInterfaceInst_aai.getInterfaceRole() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.interfaceRole); - att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceRole())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_INTERFACE_TYPE )) - &&(pInterfaceInst_aai.getInterfaceType() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.interfaceType); - att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceType())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals( ATTRIBUTE_RESOURCE_VERSION )) - &&(pInterfaceInst_aai.getResourceVersion() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.resourceVersion); - att.setValue(String.valueOf( pInterfaceInst_aai.getResourceVersion())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals( ATTRIBUTE_LOCKEDBOOLEAN )) - &&(pInterfaceInst_aai.getInMaint() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.lockedBoolean); - att.setValue(String.valueOf( pInterfaceInst_aai.getInMaint())); - pInterface_attributeList.add(att); - } + updatePInterfaceAttributeList (pInterfaceInst_aai, pInterface_attributeList) ; + if (pInterface_attributeList.size() > 0) { + pInterface.setAttributes(pInterface_attributeList); } if (pInterface_attributeList.size() > 0) { @@ -958,82 +886,11 @@ public class RestUtil { pInterface.setDataQuality(DataQuality.ok()); List pInterface_attributeList = new ArrayList(); - pInterface.setAttributes(pInterface_attributeList); - - // Iterate through the ENUM Attribute list - for (Attribute.Name name: Attribute.Name.values()) { - if ((name.toString().equals(ATTRIBUTE_SPEED_VALUE )) - &&(pInterfaceInst_aai.getSpeedValue() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.speedValue); - att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedValue())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_SPEED_UNITS )) - &&(pInterfaceInst_aai.getSpeedUnits() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.speedUnits); - att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedUnits())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_PORT_DESCRIPTION )) - &&(pInterfaceInst_aai.getPortDescription() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.description); - att.setValue(String.valueOf( pInterfaceInst_aai.getPortDescription())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_EQUIPTMENT_ID )) - &&(pInterfaceInst_aai.getEquipmentIdentifier() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.equipmentID); - att.setValue(String.valueOf( pInterfaceInst_aai.getEquipmentIdentifier())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_INTERFACE_ROLE )) - &&(pInterfaceInst_aai.getInterfaceRole() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.interfaceRole); - att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceRole())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals(ATTRIBUTE_INTERFACE_TYPE )) - &&(pInterfaceInst_aai.getInterfaceType() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.interfaceType); - att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceType())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals( ATTRIBUTE_RESOURCE_VERSION )) - &&(pInterfaceInst_aai.getResourceVersion() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.resourceVersion); - att.setValue(String.valueOf( pInterfaceInst_aai.getResourceVersion())); - pInterface_attributeList.add(att); - } - - if ((name.toString().equals( ATTRIBUTE_LOCKEDBOOLEAN )) - &&(pInterfaceInst_aai.getInMaint() != null)){ - Attribute att = new Attribute(); - att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.lockedBoolean); - att.setValue(String.valueOf( pInterfaceInst_aai.getInMaint())); - pInterface_attributeList.add(att); - } + updatePInterfaceAttributeList (pInterfaceInst_aai, pInterface_attributeList) ; + if (pInterface_attributeList.size() > 0) { + pInterface.setAttributes(pInterface_attributeList); } + pInterfaceList.add(pInterface); } @@ -1049,6 +906,84 @@ public class RestUtil { return pnfLst; } + private static void updatePInterfaceAttributeList(PInterfaceInstance pInterfaceInst_aai, List pInterface_attributeList ) { + // Iterate through the ENUM Attribute list + for (Attribute.Name name: Attribute.Name.values()) { + if ((name.toString().equals(ATTRIBUTE_SPEED_VALUE )) + &&(pInterfaceInst_aai.getSpeedValue() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.speedValue); + att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedValue())); + pInterface_attributeList.add(att); + } + + if ((name.toString().equals(ATTRIBUTE_SPEED_UNITS )) + &&(pInterfaceInst_aai.getSpeedUnits() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.speedUnits); + att.setValue(String.valueOf( pInterfaceInst_aai.getSpeedUnits())); + pInterface_attributeList.add(att); + } + + if ((name.toString().equals(ATTRIBUTE_PORT_DESCRIPTION )) + &&(pInterfaceInst_aai.getPortDescription() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.description); + att.setValue(String.valueOf( pInterfaceInst_aai.getPortDescription())); + pInterface_attributeList.add(att); + } + + if ((name.toString().equals(ATTRIBUTE_EQUIPTMENT_ID )) + &&(pInterfaceInst_aai.getEquipmentIdentifier() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.equipmentID); + att.setValue(String.valueOf( pInterfaceInst_aai.getEquipmentIdentifier())); + pInterface_attributeList.add(att); + } + + if ((name.toString().equals(ATTRIBUTE_INTERFACE_ROLE )) + &&(pInterfaceInst_aai.getInterfaceRole() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.interfaceRole); + att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceRole())); + pInterface_attributeList.add(att); + } + + if ((name.toString().equals(ATTRIBUTE_INTERFACE_TYPE )) + &&(pInterfaceInst_aai.getInterfaceType() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.interfaceType); + att.setValue(String.valueOf( pInterfaceInst_aai.getInterfaceType())); + pInterface_attributeList.add(att); + } + + if ((name.toString().equals( ATTRIBUTE_RESOURCE_VERSION )) + &&(pInterfaceInst_aai.getResourceVersion() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.resourceVersion); + att.setValue(String.valueOf( pInterfaceInst_aai.getResourceVersion())); + pInterface_attributeList.add(att); + } + + if ((name.toString().equals( ATTRIBUTE_LOCKEDBOOLEAN )) + &&(pInterfaceInst_aai.getInMaint() != null)){ + Attribute att = new Attribute(); + att.setDataQuality(DataQuality.ok()); + att.setName(Attribute.Name.lockedBoolean); + att.setValue(String.valueOf( pInterfaceInst_aai.getInMaint())); + pInterface_attributeList.add(att); + } + } + return; + + } /* * Return the Vserver Attribute value by looking through the relationship. i.e. if "related-to" is "pserver", we will get -- cgit 1.2.3-korg