diff options
author | Jim Hahn <jrh3@att.com> | 2018-08-24 14:00:30 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2018-08-24 14:36:49 -0400 |
commit | 57ac9eac8ac0f8236ddb52e5226f475368d4de33 (patch) | |
tree | 25bd93e9556becc78742c5bfeeb943de99f20d32 /controlloop/common/model-impl/aai/src/main | |
parent | 51e88a932274a3ff8a93996332bb4f1d55d4a773 (diff) |
use new vf-walk code in SO request
Methods were added to AaiNqResponseWrapper to extract VF modules
and generate the new VF module name. This step modifies the SO
code to use those methods. It was also determined that the SO
code needs the VF module container object, not just the VF module,
itself. As a result, AaiNqResponseWrapper was modified to return
a list of the containers instead of a list of the VF modules.
Also modified the AAI simulator to return two VF modules in the
response to the vserver named query. As part of that, a method
was added to the simulator so that JSON responses can be read from
files rather than having to convert them to Java Strings.
Modified simulator to work even if vnf-id is null.
Change-Id: I68fdf07ea80ee0daf9e16403e35b11710315a8a8
Issue-ID: POLICY-1037
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/model-impl/aai/src/main')
-rw-r--r-- | controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java index 9d10cfd26..be84fdfa8 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java @@ -68,7 +68,7 @@ public class AaiNqResponseWrapper implements Serializable { * @return the number of VF modules, or {@code 0} if there are none */ public int countVfModules() { - List<AaiNqVfModule> lst = getVfModules(false); + List<AaiNqInventoryResponseItem> lst = getVfModuleItems(false); return (lst == null ? 0 : lst.size()); } @@ -80,7 +80,7 @@ public class AaiNqResponseWrapper implements Serializable { * which to model it) */ public String genVfModuleName() { - List<AaiNqVfModule> lst = getVfModules(false); + List<AaiNqInventoryResponseItem> lst = getVfModuleItems(false); if (lst == null) { return null; } @@ -92,8 +92,8 @@ public class AaiNqResponseWrapper implements Serializable { String prefix = null; int maxSuffix = -1; - for (AaiNqVfModule vfmod : lst) { - String name = vfmod.getVfModuleName(); + for (AaiNqInventoryResponseItem item : lst) { + String name = item.getVfModule().getVfModuleName(); Matcher matcher = VF_MODULE_NAME_PAT.matcher(name); if (matcher.matches()) { int suffix = Integer.parseInt(matcher.group(2)); @@ -116,9 +116,9 @@ public class AaiNqResponseWrapper implements Serializable { * * @param wantBaseModule {@code true} if the the base VF module(s) is desired, * {@code false} otherwise - * @return the list of VF modules, or {@code null} if there are no VF modules + * @return the list of VF module items, or {@code null} if there are no VF modules */ - public List<AaiNqVfModule> getVfModules(boolean wantBaseModule) { + public List<AaiNqInventoryResponseItem> getVfModuleItems(boolean wantBaseModule) { // get the list of items List<AaiNqInventoryResponseItem> itemList; try { @@ -138,7 +138,7 @@ public class AaiNqResponseWrapper implements Serializable { * Walk the items looking for VF modules, allocating the list only when an item is * found. */ - List<AaiNqVfModule> vfModules = null; + List<AaiNqInventoryResponseItem> vfModuleItems = null; for (AaiNqInventoryResponseItem inventoryResponseItem : itemList) { AaiNqVfModule vfmod = inventoryResponseItem.getVfModule(); @@ -146,16 +146,16 @@ public class AaiNqResponseWrapper implements Serializable { continue; } - if (vfModules == null) { - vfModules = new ArrayList<>(itemList.size()); + if (vfModuleItems == null) { + vfModuleItems = new ArrayList<>(itemList.size()); } if (vfmod.getIsBaseVfModule() == wantBaseModule && (wantBaseModule || VF_MODULE_NAME_PAT.matcher(vfmod.getVfModuleName()).matches())) { - vfModules.add(vfmod); + vfModuleItems.add(inventoryResponseItem); } } - return vfModules; + return vfModuleItems; } } |