diff options
author | Prudence Au <prudence.au@amdocs.com> | 2018-10-04 18:30:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-04 18:30:45 +0000 |
commit | 7e2999c73624ee203e332a51c464dc1df8625bb2 (patch) | |
tree | 1105ba2982d6530bd18b221bfbf2a333da8d32d9 | |
parent | 37b70abf0c61f990b5f4c119f3c0f2bce8eb56f6 (diff) | |
parent | 8bb7ec5694ec34ba79cef5ccdf8e7c6d6a8120a0 (diff) |
Merge "Fix missing vserver name attribute"
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java index 2fc4d33..d6010c4 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java +++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/service/SpringServiceImpl.java @@ -391,16 +391,21 @@ public class SpringServiceImpl implements SpringService { if (null != resource.getAttributeList()) { for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource.getAttributeList()) { try { - Attribute attribute = new Attribute(); - attribute.setName(Attribute.Name.valueOf(ndattribute.getName())); - attribute.setValue(ndattribute.getValue()); - attribute.setDataQuality(ndattribute.getDataQuality()); - vm.addAttribute(attribute); + String ndattributeName = ndattribute.getName(); + if (ndattributeName.equals("name")) { + vm.setName(ndattribute.getValue()); + } + else { + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.valueOf(ndattributeName)); + attribute.setValue(ndattribute.getValue()); + attribute.setDataQuality(ndattribute.getDataQuality()); + vm.addAttribute(attribute); + } } catch (IllegalArgumentException ex) { // The attribute Name passed back from Network Discovery is not in our enum - log.info("Atribute Name: " + ndattribute.getName() + " for Resource:" + resource.getName() + " Id:" +resource.getId() + " is invalid"); + log.info("Attribute Name: " + ndattribute.getName() + " for Resource:" + resource.getName() + " Id:" +resource.getId() + " is invalid"); } - } } } @@ -411,13 +416,19 @@ public class SpringServiceImpl implements SpringService { if (null != resource.getAttributeList()) { for (org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.Attribute ndattribute : resource.getAttributeList()) { try { - Attribute attribute = new Attribute(); - attribute.setName(Attribute.Name.valueOf(ndattribute.getName())); - attribute.setValue(ndattribute.getValue()); - network.addAttribute(attribute); + String ndattributeName = ndattribute.getName(); + if (ndattributeName.equals("name")) { + network.setName(ndattribute.getValue()); + } + else { + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.valueOf(ndattributeName)); + attribute.setValue(ndattribute.getValue()); + network.addAttribute(attribute); + } } catch (IllegalArgumentException ex) { // The attribute Name passed back from Network Discovery is not in our enum - log.info("Atribute Name: " + ndattribute.getName() + " for Resource:" + resource.getName() + " Id:" + resource.getId() + " is invalid"); + log.info("Attribute Name: " + ndattribute.getName() + " for Resource:" + resource.getName() + " Id:" + resource.getId() + " is invalid"); } } } |