diff options
author | Shane Daniel <shane.daniel@amdocs.com> | 2018-10-03 16:08:08 -0400 |
---|---|---|
committer | Shane Daniel <shane.daniel@amdocs.com> | 2018-10-04 13:55:52 -0400 |
commit | 8bb7ec5694ec34ba79cef5ccdf8e7c6d6a8120a0 (patch) | |
tree | 349c872e3289aae27188b6379d756aac388c2559 | |
parent | 40e303b44f40704ece690f5f1fd87c5091e38b00 (diff) |
Fix missing vserver name attribute
Issue-ID: LOG-717
Change-Id: Ieb605efdd128251ed057942fff1239ad93c4fdf1
Signed-off-by: Shane Daniel <shane.daniel@amdocs.com>
-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 4d22a92..fc2b542 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"); } } } |