summaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/model-impl/aai/pom.xml41
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java115
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java110
-rw-r--r--controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json96
-rw-r--r--controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json133
-rw-r--r--controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json133
-rw-r--r--controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json157
7 files changed, 732 insertions, 53 deletions
diff --git a/controlloop/common/model-impl/aai/pom.xml b/controlloop/common/model-impl/aai/pom.xml
index 2a885ec2f..aea643525 100644
--- a/controlloop/common/model-impl/aai/pom.xml
+++ b/controlloop/common/model-impl/aai/pom.xml
@@ -67,45 +67,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>onap-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <!-- Use Google Java Style Guide:
- https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
- with minor changes -->
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
- <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <excludes>
- </excludes>
- <consoleOutput>true</consoleOutput>
- <failOnViolation>true</failOnViolation>
- <violationSeverity>warning</violationSeverity>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>0.1.1</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
</project>
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 a04d6768a..9d10cfd26 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
@@ -7,9 +7,9 @@
* 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.
@@ -20,9 +20,21 @@
package org.onap.policy.aai;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public class AaiNqResponseWrapper {
+public class AaiNqResponseWrapper implements Serializable {
+ private static final long serialVersionUID = 8411407444051746101L;
+
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapper.class);
+
+ private static final Pattern VF_MODULE_NAME_PAT = Pattern.compile("(.*_)(\\d+)");
private UUID requestId;
private AaiNqResponse aaiNqResponse;
@@ -49,4 +61,101 @@ public class AaiNqResponseWrapper {
public void setAaiNqResponse(AaiNqResponse aaiNqResponse) {
this.aaiNqResponse = aaiNqResponse;
}
+
+ /**
+ * Counts the number of VF modules, if any, in the response.
+ *
+ * @return the number of VF modules, or {@code 0} if there are none
+ */
+ public int countVfModules() {
+ List<AaiNqVfModule> lst = getVfModules(false);
+ return (lst == null ? 0 : lst.size());
+ }
+
+ /**
+ * Generates the name for the next VF module.
+ *
+ * @return the name of the next VF module, or {@code null} if the name could not be
+ * generated (i.e., because the response has no matching VF module names on
+ * which to model it)
+ */
+ public String genVfModuleName() {
+ List<AaiNqVfModule> lst = getVfModules(false);
+ if (lst == null) {
+ return null;
+ }
+
+ /*
+ * Loop through the VF modules, extracting the name prefix and the largest number
+ * suffix
+ */
+ String prefix = null;
+ int maxSuffix = -1;
+
+ for (AaiNqVfModule vfmod : lst) {
+ String name = vfmod.getVfModuleName();
+ Matcher matcher = VF_MODULE_NAME_PAT.matcher(name);
+ if (matcher.matches()) {
+ int suffix = Integer.parseInt(matcher.group(2));
+ if (suffix > maxSuffix) {
+ maxSuffix = suffix;
+ prefix = matcher.group(1);
+ }
+ }
+ }
+
+ ++maxSuffix;
+
+ return (prefix == null ? null : prefix + maxSuffix);
+ }
+
+ /**
+ * Gets a list of VF modules. If the non-base VF modules are requested, then only
+ * those whose names match the name pattern, {@link #VF_MODULE_NAME_PAT}, are
+ * returned.
+ *
+ * @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
+ */
+ public List<AaiNqVfModule> getVfModules(boolean wantBaseModule) {
+ // get the list of items
+ List<AaiNqInventoryResponseItem> itemList;
+ try {
+ itemList = aaiNqResponse.getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0)
+ .getItems().getInventoryResponseItems();
+
+ } catch (NullPointerException | IndexOutOfBoundsException e) {
+ logger.debug("no VF modules in AAI response", e);
+ return null;
+ }
+
+ if (itemList == null) {
+ return null;
+ }
+
+ /*
+ * Walk the items looking for VF modules, allocating the list only when an item is
+ * found.
+ */
+ List<AaiNqVfModule> vfModules = null;
+
+ for (AaiNqInventoryResponseItem inventoryResponseItem : itemList) {
+ AaiNqVfModule vfmod = inventoryResponseItem.getVfModule();
+ if (vfmod == null) {
+ continue;
+ }
+
+ if (vfModules == null) {
+ vfModules = new ArrayList<>(itemList.size());
+ }
+
+ if (vfmod.getIsBaseVfModule() == wantBaseModule
+ && (wantBaseModule || VF_MODULE_NAME_PAT.matcher(vfmod.getVfModuleName()).matches())) {
+ vfModules.add(vfmod);
+ }
+ }
+
+ return vfModules;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java
index 0d6a49361..3c5502802 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java
@@ -20,13 +20,16 @@
package org.onap.policy.aai;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
+import java.util.List;
import java.util.UUID;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.onap.policy.aai.util.Serialization;
import org.slf4j.Logger;
@@ -35,12 +38,6 @@ import org.slf4j.LoggerFactory;
public class AaiNqResponseWrapperTest {
private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapperTest.class);
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {}
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {}
-
@Test
public void test() {
AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem();
@@ -169,4 +166,99 @@ public class AaiNqResponseWrapperTest {
assertNotNull(aaiNqResponseWarapper2.getAaiNqResponse());
logger.info(Serialization.gsonPretty.toJson(aaiNqResponseWarapper2));
}
+
+ @Test
+ public void testCountVfModules() throws Exception {
+ AaiNqResponseWrapper resp;
+
+ // null item
+ resp = new AaiNqResponseWrapper();
+ assertEquals(0, resp.countVfModules());
+
+ // no names
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoNames.json"));
+ assertEquals(0, resp.countVfModules());
+
+ // has VF modules
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json"));
+ assertEquals(3, resp.countVfModules());
+ }
+
+ @Test
+ public void testGenVfModuleName() throws Exception {
+ AaiNqResponseWrapper resp;
+
+ // null item
+ resp = new AaiNqResponseWrapper();
+ assertEquals(null, resp.genVfModuleName());
+
+ // no names
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoNames.json"));
+ assertEquals(null, resp.genVfModuleName());
+
+ // has VF modules
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json"));
+ assertEquals("my-module-abc_124", resp.genVfModuleName());
+ }
+
+ @Test
+ public void testGetVfModules() throws Exception {
+ AaiNqResponseWrapper resp;
+
+ // null item
+ resp = new AaiNqResponseWrapper();
+ assertNull(resp.getVfModules(true));
+
+ // missing item
+ resp = new AaiNqResponseWrapper();
+ resp.setAaiNqResponse(new AaiNqResponse());
+ assertNull(resp.getVfModules(false));
+
+ // null item list
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoItems.json"));
+ resp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0)
+ .getItems().setInventoryResponseItems(null);
+ assertNull(resp.getVfModules(false));
+
+ // no modules
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoModules.json"));
+ assertNull(resp.getVfModules(false));
+
+ // no names
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoNames.json"));
+ List<AaiNqVfModule> lst;
+ lst = resp.getVfModules(false);
+ assertNotNull(lst);
+ assertEquals(0, lst.size());
+
+ // base VF modules
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json"));
+ lst = resp.getVfModules(true);
+ assertNotNull(lst);
+ assertEquals(1, lst.size());
+ assertEquals("Vfmodule_vLBMS-0809-1", lst.get(0).getVfModuleName());
+
+ // non base VF modules
+ resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json"));
+ lst = resp.getVfModules(false);
+ assertNotNull(lst);
+ assertEquals(3, lst.size());
+ int index;
+ index = 0;
+ assertEquals("my-module-abc_1", lst.get(index++).getVfModuleName());
+ assertEquals("my-module-abc_123", lst.get(index++).getVfModuleName());
+ assertEquals("my-module-abc_34", lst.get(index++).getVfModuleName());
+ }
+
+ /**
+ * Loads a response from a JSON file.
+ *
+ * @param fileName name of the file containing the JSON response
+ * @return the response
+ * @throws IOException if the file cannot be read
+ */
+ private AaiNqResponse load(String fileName) throws IOException {
+ String json = IOUtils.toString(getClass().getResource(fileName), StandardCharsets.UTF_8);
+ return Serialization.gsonPretty.fromJson(json, AaiNqResponse.class);
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json
new file mode 100644
index 000000000..996692402
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json
@@ -0,0 +1,96 @@
+{
+ "inventory-response-item": [
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "vLoadBalancerMS"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "resource"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "53638a85-361a-437d-8830-4b0d5329225e"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ },
+ "generic-vnf": {
+ "in-maint": false,
+ "ipv4-oam-address": "10.0.150.1",
+ "is-closed-loop-disabled": false,
+ "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671",
+ "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e",
+ "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c",
+ "nf-function": "",
+ "nf-naming-code": "",
+ "nf-role": "vLB",
+ "nf-type": "",
+ "orchestration-status": "Active",
+ "prov-status": "PROV",
+ "resource-version": "1533850960381",
+ "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8",
+ "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d",
+ "vnf-name": "vLoadBalancerMS-Vnf-0809-2",
+ "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0"
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ ]
+ },
+ "model-name": "vLoadBalancerMS"
+ },
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "CloudOwner",
+ "cloud-region-id": "RegionOne",
+ "cloud-region-version": "v2.5",
+ "cloud-type": "openstack",
+ "cloud-zone": "zone-1",
+ "owner-defined-type": "owner type",
+ "resource-version": "1533652058185",
+ "sriov-automation": false
+ },
+ "extra-properties": {}
+ }
+ ]
+ },
+ "tenant": {
+ "resource-version": "1533652058206",
+ "tenant-id": "4086f396c5e04caf9502c5fdeca575c4",
+ "tenant-name": "PFPP"
+ }
+ }
+ ]
+ },
+ "vserver": {
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "prov-status": "ACTIVE",
+ "resource-version": "1533850964910",
+ "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774",
+ "vserver-name": "vlb-ms-0809-1",
+ "vserver-name2": "vlb-ms-0809-1",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774"
+ }
+ }
+ ]
+}
diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json
new file mode 100644
index 000000000..2dd6090c7
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json
@@ -0,0 +1,133 @@
+{
+ "inventory-response-item": [
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "vLoadBalancerMS"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "resource"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "53638a85-361a-437d-8830-4b0d5329225e"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ },
+ "generic-vnf": {
+ "in-maint": false,
+ "ipv4-oam-address": "10.0.150.1",
+ "is-closed-loop-disabled": false,
+ "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671",
+ "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e",
+ "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c",
+ "nf-function": "",
+ "nf-naming-code": "",
+ "nf-role": "vLB",
+ "nf-type": "",
+ "orchestration-status": "Active",
+ "prov-status": "PROV",
+ "resource-version": "1533850960381",
+ "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8",
+ "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d",
+ "vnf-name": "vLoadBalancerMS-Vnf-0809-2",
+ "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0"
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "4feb459d-d8ef-4cde-a714-235c79787962"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "vLoadBalancerMS"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "service"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "b5477216-9b7d-4e75-8777-5b632d406759"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ },
+ "model-name": "vLoadBalancerMS",
+ "service-instance": {
+ "environment-context": "General_Revenue-Bearing",
+ "model-invariant-id": "b5477216-9b7d-4e75-8777-5b632d406759",
+ "model-version-id": "4feb459d-d8ef-4cde-a714-235c79787962",
+ "orchestration-status": "Active",
+ "resource-version": "1533848425145",
+ "service-instance-id": "b66d24cc-feca-4fdc-8090-2e9539a8bbac",
+ "service-instance-name": "vLoadBalancerMS-Service-0809-1",
+ "workload-context": "Production"
+ }
+ }
+ ]
+ },
+ "model-name": "vLoadBalancerMS"
+ },
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "CloudOwner",
+ "cloud-region-id": "RegionOne",
+ "cloud-region-version": "v2.5",
+ "cloud-type": "openstack",
+ "cloud-zone": "zone-1",
+ "owner-defined-type": "owner type",
+ "resource-version": "1533652058185",
+ "sriov-automation": false
+ },
+ "extra-properties": {}
+ }
+ ]
+ },
+ "tenant": {
+ "resource-version": "1533652058206",
+ "tenant-id": "4086f396c5e04caf9502c5fdeca575c4",
+ "tenant-name": "PFPP"
+ }
+ }
+ ]
+ },
+ "vserver": {
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "prov-status": "ACTIVE",
+ "resource-version": "1533850964910",
+ "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774",
+ "vserver-name": "vlb-ms-0809-1",
+ "vserver-name2": "vlb-ms-0809-1",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774"
+ }
+ }
+ ]
+}
diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json
new file mode 100644
index 000000000..9c1a9bc5d
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json
@@ -0,0 +1,133 @@
+{
+ "inventory-response-item": [
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "vLoadBalancerMS"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "resource"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "53638a85-361a-437d-8830-4b0d5329225e"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ },
+ "generic-vnf": {
+ "in-maint": false,
+ "ipv4-oam-address": "10.0.150.1",
+ "is-closed-loop-disabled": false,
+ "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671",
+ "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e",
+ "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c",
+ "nf-function": "",
+ "nf-naming-code": "",
+ "nf-role": "vLB",
+ "nf-type": "",
+ "orchestration-status": "Active",
+ "prov-status": "PROV",
+ "resource-version": "1533850960381",
+ "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8",
+ "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d",
+ "vnf-name": "vLoadBalancerMS-Vnf-0809-2",
+ "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0"
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "model-name": "vLoadBalancerMS",
+ "service-instance": {
+ "environment-context": "General_Revenue-Bearing",
+ "model-invariant-id": "b5477216-9b7d-4e75-8777-5b632d406759",
+ "model-version-id": "4feb459d-d8ef-4cde-a714-235c79787962",
+ "orchestration-status": "Active",
+ "resource-version": "1533848425145",
+ "service-instance-id": "b66d24cc-feca-4fdc-8090-2e9539a8bbac",
+ "service-instance-name": "vLoadBalancerMS-Service-0809-1",
+ "workload-context": "Production"
+ }
+ },
+ {
+ "vf-module": {
+ "is-base-vf-module": false,
+ "model-invariant-id": "6d01b7f1-769a-4080-b8ea-57fd03ef1572",
+ "model-version-id": "3302088a-457e-496c-9282-2eb3d5b8dd24",
+ "resource-version": "1534270663202",
+ "vf-module-id": "dummy_807a3f02-f878-436b-870c-f0e91e81570d",
+ "vf-module-name": "dummy_807a3f02-f878-436b-870c-f0e91e81570d"
+ }
+ },
+ {
+ "vf-module": {
+ "heat-stack-id": "Vfmodule_vLBMS-0809-1/83ab2394-2b22-40f9-8ba2-383698dd2958",
+ "is-base-vf-module": true,
+ "model-customization-id": "5198f732-8f22-48f9-98f8-d6b8b50118be",
+ "model-invariant-id": "1f566a81-58ba-4762-81f9-d2259509429a",
+ "model-version-id": "94827d25-4ac3-4850-abfc-7b6e3c531db4",
+ "module-index": 0,
+ "orchestration-status": "active",
+ "resource-version": "1533850416834",
+ "vf-module-id": "b861467d-d3a7-4b21-81b3-94d928a7e8b7",
+ "vf-module-name": "Vfmodule_vLBMS-0809-1"
+ }
+ }
+ ]
+ },
+ "model-name": "vLoadBalancerMS"
+ },
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "CloudOwner",
+ "cloud-region-id": "RegionOne",
+ "cloud-region-version": "v2.5",
+ "cloud-type": "openstack",
+ "cloud-zone": "zone-1",
+ "owner-defined-type": "owner type",
+ "resource-version": "1533652058185",
+ "sriov-automation": false
+ },
+ "extra-properties": {}
+ }
+ ]
+ },
+ "tenant": {
+ "resource-version": "1533652058206",
+ "tenant-id": "4086f396c5e04caf9502c5fdeca575c4",
+ "tenant-name": "PFPP"
+ }
+ }
+ ]
+ },
+ "vserver": {
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "prov-status": "ACTIVE",
+ "resource-version": "1533850964910",
+ "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774",
+ "vserver-name": "vlb-ms-0809-1",
+ "vserver-name2": "vlb-ms-0809-1",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774"
+ }
+ }
+ ]
+}
diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json
new file mode 100644
index 000000000..fb341dc65
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json
@@ -0,0 +1,157 @@
+{
+ "inventory-response-item": [
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "vLoadBalancerMS"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "resource"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "53638a85-361a-437d-8830-4b0d5329225e"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ },
+ "generic-vnf": {
+ "in-maint": false,
+ "ipv4-oam-address": "10.0.150.1",
+ "is-closed-loop-disabled": false,
+ "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671",
+ "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e",
+ "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c",
+ "nf-function": "",
+ "nf-naming-code": "",
+ "nf-role": "vLB",
+ "nf-type": "",
+ "orchestration-status": "Active",
+ "prov-status": "PROV",
+ "resource-version": "1533850960381",
+ "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8",
+ "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d",
+ "vnf-name": "vLoadBalancerMS-Vnf-0809-2",
+ "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0"
+ },
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "model-name": "vLoadBalancerMS",
+ "service-instance": {
+ "environment-context": "General_Revenue-Bearing",
+ "model-invariant-id": "b5477216-9b7d-4e75-8777-5b632d406759",
+ "model-version-id": "4feb459d-d8ef-4cde-a714-235c79787962",
+ "orchestration-status": "Active",
+ "resource-version": "1533848425145",
+ "service-instance-id": "b66d24cc-feca-4fdc-8090-2e9539a8bbac",
+ "service-instance-name": "vLoadBalancerMS-Service-0809-1",
+ "workload-context": "Production"
+ }
+ },
+ {
+ "vf-module": {
+ "is-base-vf-module": false,
+ "model-invariant-id": "6d01b7f1-769a-4080-b8ea-57fd03ef1572",
+ "model-version-id": "3302088a-457e-496c-9282-2eb3d5b8dd24",
+ "resource-version": "1534270663202",
+ "vf-module-id": "dummy_807a3f02-f878-436b-870c-f0e91e81570d",
+ "vf-module-name": "dummy_807a3f02-f878-436b-870c-f0e91e81570d"
+ }
+ },
+ {
+ "vf-module": {
+ "is-base-vf-module": false,
+ "vf-module-name": "my-module-abc_1"
+ }
+ },
+ {
+ "vf-module": {
+ "heat-stack-id": "Vfmodule_vLBMS-0809-1/83ab2394-2b22-40f9-8ba2-383698dd2958",
+ "is-base-vf-module": true,
+ "model-customization-id": "5198f732-8f22-48f9-98f8-d6b8b50118be",
+ "model-invariant-id": "1f566a81-58ba-4762-81f9-d2259509429a",
+ "model-version-id": "94827d25-4ac3-4850-abfc-7b6e3c531db4",
+ "module-index": 0,
+ "orchestration-status": "active",
+ "resource-version": "1533850416834",
+ "vf-module-id": "b861467d-d3a7-4b21-81b3-94d928a7e8b7",
+ "vf-module-name": "Vfmodule_vLBMS-0809-1"
+ }
+ },
+ {
+ "vf-module": {
+ "is-base-vf-module": false,
+ "vf-module-name": "my-module-abc_123"
+ }
+ },
+ {
+ "vf-module": {
+ "is-base-vf-module": false,
+ "vf-module-name": "no-underscore-number-9999"
+ }
+ },
+ {
+ "vf-module": {
+ "is-base-vf-module": false,
+ "vf-module-name": "my-module-abc_34"
+ }
+ }
+ ]
+ },
+ "model-name": "vLoadBalancerMS"
+ },
+ {
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item": [
+ {
+ "cloud-region": {
+ "cloud-owner": "CloudOwner",
+ "cloud-region-id": "RegionOne",
+ "cloud-region-version": "v2.5",
+ "cloud-type": "openstack",
+ "cloud-zone": "zone-1",
+ "owner-defined-type": "owner type",
+ "resource-version": "1533652058185",
+ "sriov-automation": false
+ },
+ "extra-properties": {}
+ }
+ ]
+ },
+ "tenant": {
+ "resource-version": "1533652058206",
+ "tenant-id": "4086f396c5e04caf9502c5fdeca575c4",
+ "tenant-name": "PFPP"
+ }
+ }
+ ]
+ },
+ "vserver": {
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "prov-status": "ACTIVE",
+ "resource-version": "1533850964910",
+ "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774",
+ "vserver-name": "vlb-ms-0809-1",
+ "vserver-name2": "vlb-ms-0809-1",
+ "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774"
+ }
+ }
+ ]
+}