aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-04-11 17:48:54 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-11 17:48:54 +0000
commit84286faf575e4311720829c1df101614a769a240 (patch)
tree0b80804b01ed1c71a567005893ae8e414022b11e /controlloop/common/eventmanager
parenta7a144ba512654bd93b0856b1e9eb5c886060c21 (diff)
parent080dd34e7f506027c2dc1a87ddc4c9aa347a9c59 (diff)
Merge "Drools-App changes to support CQ"
Diffstat (limited to 'controlloop/common/eventmanager')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java90
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java91
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java27
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java44
-rw-r--r--controlloop/common/eventmanager/src/test/resources/AaiCqResponse.json673
5 files changed, 845 insertions, 80 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index bfb8c13fe..edee4c2f0 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -31,7 +31,7 @@ import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.UUID;
-
+import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.aai.AaiGetVnfResponse;
import org.onap.policy.aai.AaiGetVserverResponse;
import org.onap.policy.aai.AaiManager;
@@ -82,8 +82,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
private static final String QUERY_AAI_ERROR_MSG = "Exception from queryAai: ";
/**
- * Additional time, in seconds, to add to a "lock" request. This ensures that the lock
- * won't expire right before an operation completes.
+ * Additional time, in seconds, to add to a "lock" request. This ensures that the lock won't expire right before an
+ * operation completes.
*/
private static final int ADDITIONAL_LOCK_SEC = 60;
@@ -111,8 +111,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
private boolean useTargetLock = true;
/**
- * Wrapper for AAI vserver named-query response. This is initialized in a lazy
- * fashion.
+ * Wrapper for AAI vserver named-query response. This is initialized in a lazy fashion.
*/
private AaiNqResponseWrapper nqVserverResponse = null;
@@ -305,8 +304,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
/**
* Check if the control loop is final.
*
- * @return a VirtualControlLoopNotification if the control loop is final, otherwise
- * <code>null</code> is returned
+ * @return a VirtualControlLoopNotification if the control loop is final, otherwise <code>null</code> is returned
* @throws ControlLoopException if an error occurs
*/
public VirtualControlLoopNotification isControlLoopFinal() throws ControlLoopException {
@@ -496,8 +494,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
//
if (!this.useTargetLock) {
TargetLock lock = PolicyGuard.createTargetLock(this.currentOperation.policy.getTarget().getType(),
- this.currentOperation.getTargetEntity(),
- this.onset.getRequestId(), this);
+ this.currentOperation.getTargetEntity(), this.onset.getRequestId(), this);
this.targetLock = lock;
return LockResult.createLockResult(GuardResult.LOCK_ACQUIRED, lock);
}
@@ -510,16 +507,15 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
// Currently, it should be. But in the future it may not.
//
GuardResult result = PolicyGuard.lockTarget(targetLock,
- this.currentOperation.getOperationTimeout() + ADDITIONAL_LOCK_SEC);
+ this.currentOperation.getOperationTimeout() + ADDITIONAL_LOCK_SEC);
return new LockResult<>(result, this.targetLock);
} else {
//
// Ask the Guard
//
- LockResult<GuardResult, TargetLock> lockResult =
- PolicyGuard.lockTarget(this.currentOperation.policy.getTarget().getType(),
- this.currentOperation.getTargetEntity(), this.onset.getRequestId(), this,
- this.currentOperation.getOperationTimeout() + ADDITIONAL_LOCK_SEC);
+ LockResult<GuardResult, TargetLock> lockResult = PolicyGuard.lockTarget(
+ this.currentOperation.policy.getTarget().getType(), this.currentOperation.getTargetEntity(),
+ this.onset.getRequestId(), this, this.currentOperation.getOperationTimeout() + ADDITIONAL_LOCK_SEC);
//
// Was it acquired?
//
@@ -637,13 +633,13 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
return;
}
try {
- this.lastOperationManager.commitAbatement(message,outcome);
+ this.lastOperationManager.commitAbatement(message, outcome);
} catch (NoSuchElementException e) {
logger.error("{}: commitAbatement threw an exception ", this, e);
}
}
-
+
/**
* Set the control loop time out.
*
@@ -775,8 +771,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
* Process a response from A&AI for a VNF.
*
* @param aaiResponse the response from A&AI
- * @param queryByVnfId <code>true</code> if the query was based on vnf-id,
- * <code>false</code> if the query was based on vnf-name
+ * @param queryByVnfId <code>true</code> if the query was based on vnf-id, <code>false</code> if the query was based
+ * on vnf-name
* @throws AaiException if an error occurs processing the response
*/
private static void processVnfResponse(AaiGetVnfResponse aaiResponse, boolean queryByVnfId) throws AaiException {
@@ -831,38 +827,35 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
* Is closed loop disabled for an event.
*
* @param event the event
- * @return <code>true</code> if the control loop is disabled, <code>false</code>
- * otherwise
+ * @return <code>true</code> if the control loop is disabled, <code>false</code> otherwise
*/
public static boolean isClosedLoopDisabled(VirtualControlLoopEvent event) {
Map<String, String> aai = event.getAai();
return (isAaiTrue(aai.get(VSERVER_IS_CLOSED_LOOP_DISABLED))
- || isAaiTrue(aai.get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED)));
+ || isAaiTrue(aai.get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED)));
}
/**
* Does provisioning status, for an event, have a value other than ACTIVE.
*
* @param event the event
- * @return {@code true} if the provisioning status is neither ACTIVE nor {@code null},
- * {@code false} otherwise
+ * @return {@code true} if the provisioning status is neither ACTIVE nor {@code null}, {@code false} otherwise
*/
protected static boolean isProvStatusInactive(VirtualControlLoopEvent event) {
Map<String, String> aai = event.getAai();
return (!PROV_STATUS_ACTIVE.equals(aai.getOrDefault(VSERVER_PROV_STATUS, PROV_STATUS_ACTIVE))
- || !PROV_STATUS_ACTIVE.equals(aai.getOrDefault(GENERIC_VNF_PROV_STATUS, PROV_STATUS_ACTIVE)));
+ || !PROV_STATUS_ACTIVE.equals(aai.getOrDefault(GENERIC_VNF_PROV_STATUS, PROV_STATUS_ACTIVE)));
}
/**
* Determines the boolean value represented by the given AAI field value.
*
* @param aaiValue value to be examined
- * @return the boolean value represented by the field value, or {@code false} if the
- * value is {@code null}
+ * @return the boolean value represented by the field value, or {@code false} if the value is {@code null}
*/
protected static boolean isAaiTrue(String aaiValue) {
return ("true".equalsIgnoreCase(aaiValue) || "T".equalsIgnoreCase(aaiValue) || "yes".equalsIgnoreCase(aaiValue)
- || "Y".equalsIgnoreCase(aaiValue));
+ || "Y".equalsIgnoreCase(aaiValue));
}
/**
@@ -937,6 +930,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
/**
* Gets the output from the AAI vserver named-query, using the cache, if appropriate.
+ *
* @return output from the AAI vserver named-query
*/
public AaiNqResponseWrapper getNqVserverFromAai() {
@@ -976,7 +970,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
AaiNqResponse aaiNqResponse = new AaiManager(new RestManager()).postQuery(getPeManagerEnvProperty(AAI_URL),
- getPeManagerEnvProperty(AAI_USERNAME_PROPERTY), getPeManagerEnvProperty(AAI_PASS_PROPERTY),
+ getPeManagerEnvProperty(AAI_USERNAME_PROPERTY), getPeManagerEnvProperty(AAI_PASS_PROPERTY),
aaiNqRequest, onset.getRequestId());
// Check AAI response
@@ -997,8 +991,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
/**
- * This method reads and validates environmental properties coming from the policy engine. Null
- * properties cause an {@link IllegalArgumentException} runtime exception to be thrown
+ * This method reads and validates environmental properties coming from the policy engine. Null properties cause an
+ * {@link IllegalArgumentException} runtime exception to be thrown
*
* @param enginePropertyName the name of the parameter to retrieve
* @return the property value
@@ -1032,4 +1026,40 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
+ ", currentOperation=" + currentOperation + ", targetLock=" + targetLock + "]";
}
+ /**
+ * This function calls Aai Custom Query and responds with the AaiCqResponse.
+ *
+ * @param event input event
+ * @return AaiCqResponse Response from Aai for custom query
+ * @throws AaiException if error occurs
+ */
+ public AaiCqResponse getCqResponse(VirtualControlLoopEvent event) throws AaiException {
+
+ Map<String, String> aai = event.getAai();
+
+ if (aai.containsKey(VSERVER_IS_CLOSED_LOOP_DISABLED) || aai.containsKey(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED)) {
+
+ if (isClosedLoopDisabled(event)) {
+ throw new AaiException("is-closed-loop-disabled is set to true on VServer or VNF");
+ }
+
+ if (isProvStatusInactive(event)) {
+ throw new AaiException("prov-status is not ACTIVE on VServer or VNF");
+ }
+ }
+
+ UUID reqId = event.getRequestId();
+ AaiCqResponse response = null;
+ String vserverId = event.getAai().get(VSERVER_VSERVER_NAME);
+
+ String aaiHostUrl = PolicyEngine.manager.getEnvironmentProperty(AAI_URL);
+ String aaiUser = PolicyEngine.manager.getEnvironmentProperty(AAI_USERNAME_PROPERTY);
+ String aaiPassword = PolicyEngine.manager.getEnvironmentProperty(AAI_PASS_PROPERTY);
+
+ response = new AaiManager(new RestManager()).getCustomQueryResponse(aaiHostUrl, aaiUser, aaiPassword, reqId,
+ vserverId);
+ return response;
+
+ }
+
}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index dfd2a1af9..3ff5c260e 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -33,6 +33,7 @@ import java.util.Properties;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.onap.aai.domain.yang.GenericVnf;
import org.onap.policy.aai.util.AaiException;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
@@ -111,14 +112,25 @@ public class ControlLoopOperationManager implements Serializable {
case "APPC":
if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) {
/*
- * The target vnf-id may not be the same as the source vnf-id specified in the
- * yaml, the target vnf-id is retrieved by a named query to A&AI.
+ * The target vnf-id may not be the same as the source vnf-id specified in the yaml, the target
+ * vnf-id is retrieved by a named query to A&AI.
*/
- String targetVnf = AppcLcmActorServiceProvider.vnfNamedQuery(policy.getTarget().getResourceID(),
- this.targetEntity, PolicyEngine.manager.getEnvironmentProperty("aai.url"),
- PolicyEngine.manager.getEnvironmentProperty("aai.username"),
- PolicyEngine.manager.getEnvironmentProperty("aai.password"));
- this.targetEntity = targetVnf;
+ if (Boolean.valueOf(PolicyEngine.manager.getEnvironmentProperty("aai.customQuery"))) {
+ GenericVnf genvnf = this.eventManager.getCqResponse((VirtualControlLoopEvent) onset)
+ .getGenericVnfByModelInvariantId(policy.getTarget().getResourceID());
+ if (genvnf == null) {
+ logger.info("Target entity could not be found");
+ throw new AaiException("Target vnf-id could not be found");
+ }
+ this.targetEntity = genvnf.getVnfId();
+
+ } else {
+ this.targetEntity =
+ AppcLcmActorServiceProvider.vnfNamedQuery(policy.getTarget().getResourceID(),
+ this.targetEntity, PolicyEngine.manager.getEnvironmentProperty("aai.url"),
+ PolicyEngine.manager.getEnvironmentProperty("aai.username"),
+ PolicyEngine.manager.getEnvironmentProperty("aai.password"));
+ }
}
break;
case "SO":
@@ -134,6 +146,7 @@ public class ControlLoopOperationManager implements Serializable {
}
}
+
public ControlLoopEventManager getEventManager() {
return eventManager;
}
@@ -219,10 +232,16 @@ public class ControlLoopOperationManager implements Serializable {
}
/*
- * If the vnf-name was retrieved from the onset then the vnf-id must be obtained
- * from the event manager's A&AI GET query
+ * If the vnf-name was retrieved from the onset then the vnf-id must be obtained from the event
+ * manager's A&AI GET query
*/
- String vnfId = this.eventManager.getVnfResponse().getVnfId();
+ String vnfId;
+ if (Boolean.valueOf(PolicyEngine.manager.getEnvironmentProperty("aai.customQuery"))) {
+ vnfId = this.eventManager.getCqResponse((VirtualControlLoopEvent) onset).getDefaultGenericVnf()
+ .getVnfId();
+ } else {
+ vnfId = this.eventManager.getVnfResponse().getVnfId();
+ }
if (vnfId == null) {
throw new AaiException("No vnf-id found");
}
@@ -244,10 +263,16 @@ public class ControlLoopOperationManager implements Serializable {
}
/*
- * If the vnf-name was retrieved from the onset then the vnf-id must be obtained
- * from the event manager's A&AI GET query
+ * If the vnf-name was retrieved from the onset then the vnf-id must be obtained from the event
+ * manager's A&AI GET query
*/
- String vnfId = this.eventManager.getVnfResponse().getVnfId();
+ String vnfId;
+ if (Boolean.valueOf(PolicyEngine.manager.getEnvironmentProperty("aai.customQuery"))) {
+ vnfId = this.eventManager.getCqResponse((VirtualControlLoopEvent) onset).getDefaultGenericVnf()
+ .getVnfId();
+ } else {
+ vnfId = this.eventManager.getVnfResponse().getVnfId();
+ }
if (vnfId == null) {
throw new AaiException("No vnf-id found");
}
@@ -265,8 +290,10 @@ public class ControlLoopOperationManager implements Serializable {
* @param onset the onset event
* @return the operation request
* @throws ControlLoopException if an error occurs
+ * @throws AaiException if error occurs
*/
- public Object startOperation(/* VirtualControlLoopEvent */ControlLoopEvent onset) throws ControlLoopException {
+ public Object startOperation(/* VirtualControlLoopEvent */ControlLoopEvent onset)
+ throws ControlLoopException, AaiException {
verifyOperatonCanRun();
//
@@ -285,8 +312,8 @@ public class ControlLoopOperationManager implements Serializable {
switch (policy.getActor()) {
case "APPC":
/*
- * If the recipe is ModifyConfig, a legacy APPC request is constructed. Otherwise an
- * LCMRequest is constructed.
+ * If the recipe is ModifyConfig, a legacy APPC request is constructed. Otherwise an LCMRequest is
+ * constructed.
*/
this.currentOperation = operation;
if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) {
@@ -303,8 +330,14 @@ public class ControlLoopOperationManager implements Serializable {
return operationRequest;
case "SO":
SoActorServiceProvider soActorSp = new SoActorServiceProvider();
- this.operationRequest = soActorSp.constructRequest((VirtualControlLoopEvent) onset,
- operation.clOperation, this.policy, eventManager.getNqVserverFromAai());
+ if (Boolean.valueOf(PolicyEngine.manager.getEnvironmentProperty("aai.customQuery"))) {
+ this.operationRequest =
+ soActorSp.constructRequestCq((VirtualControlLoopEvent) onset, operation.clOperation,
+ this.policy, eventManager.getCqResponse((VirtualControlLoopEvent) onset));
+ } else {
+ this.operationRequest = soActorSp.constructRequest((VirtualControlLoopEvent) onset,
+ operation.clOperation, this.policy, eventManager.getNqVserverFromAai());
+ }
// Save the operation
this.currentOperation = operation;
@@ -315,11 +348,17 @@ public class ControlLoopOperationManager implements Serializable {
return operationRequest;
case "VFC":
- this.operationRequest = VfcActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
- operation.clOperation, this.policy, this.eventManager.getVnfResponse(),
- PolicyEngine.manager.getEnvironmentProperty("vfc.url"),
- PolicyEngine.manager.getEnvironmentProperty("vfc.username"),
- PolicyEngine.manager.getEnvironmentProperty("vfc.password"));
+ if (Boolean.valueOf(PolicyEngine.manager.getEnvironmentProperty("aai.customQuery"))) {
+ this.operationRequest = VfcActorServiceProvider.constructRequestCq((VirtualControlLoopEvent) onset,
+ operation.clOperation, this.policy,
+ eventManager.getCqResponse((VirtualControlLoopEvent) onset));
+ } else {
+ this.operationRequest = VfcActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
+ operation.clOperation, this.policy, this.eventManager.getVnfResponse(),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.username"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.password"));
+ }
this.currentOperation = operation;
if (this.operationRequest == null) {
this.policyResult = PolicyResult.FAILURE;
@@ -331,7 +370,7 @@ public class ControlLoopOperationManager implements Serializable {
*/
this.currentOperation = operation;
this.operationRequest = SdnrActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
- operation.clOperation, this.policy);
+ operation.clOperation, this.policy);
//
// Save the operation
//
@@ -342,8 +381,8 @@ public class ControlLoopOperationManager implements Serializable {
return operationRequest;
case "SDNC":
SdncActorServiceProvider provider = new SdncActorServiceProvider();
- this.operationRequest = provider.constructRequest((VirtualControlLoopEvent) onset,
- operation.clOperation, this.policy);
+ this.operationRequest =
+ provider.constructRequest((VirtualControlLoopEvent) onset, operation.clOperation, this.policy);
this.currentOperation = operation;
if (this.operationRequest == null) {
this.policyResult = PolicyResult.FAILURE;
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index 7c3a38b38..bce96b2f0 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -43,6 +43,7 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.aai.AaiGetVnfResponse;
import org.onap.policy.aai.AaiGetVserverResponse;
import org.onap.policy.aai.AaiNqRequestError;
@@ -80,6 +81,7 @@ public class ControlLoopEventManagerTest {
private static final Logger logger = LoggerFactory.getLogger(ControlLoopEventManagerTest.class);
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -558,7 +560,7 @@ public class ControlLoopEventManagerTest {
VirtualControlLoopNotification clfNotification = manager.isControlLoopFinal();
assertNull(clfNotification);
-
+
// serialize and de-serialize manager
manager = Serializer.roundTrip(manager);
@@ -632,7 +634,7 @@ public class ControlLoopEventManagerTest {
ControlLoopOperationManager clom = manager.processControlLoop();
assertNotNull(clom);
assertNull(clom.getOperationResult());
-
+
// serialize and de-serialize manager
manager = Serializer.roundTrip(manager);
@@ -724,7 +726,7 @@ public class ControlLoopEventManagerTest {
}
assertNull(manager.unlockCurrentOperation());
-
+
// serialize and de-serialize manager
manager = Serializer.roundTrip(manager);
@@ -917,7 +919,7 @@ public class ControlLoopEventManagerTest {
try {
onset.getAai().put(ControlLoopEventManager.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, Boolean.TRUE.toString());
onset.getAai().put(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS,
- ControlLoopEventManager.PROV_STATUS_ACTIVE);
+ ControlLoopEventManager.PROV_STATUS_ACTIVE);
mgr = makeManager(onset);
mgr.queryAai(onset);
@@ -1290,6 +1292,23 @@ public class ControlLoopEventManagerTest {
assertNull(manager.getNqVserverFromAai());
}
+ @Test
+ public void testGetCqResponse() {
+ try {
+ ControlLoopEventManager mgr = null;
+ mgr = makeManager(onset);
+ mgr.queryAai(onset);
+ AaiCqResponse aaiCqResponse = mgr.getCqResponse(onset);
+ assertNotNull(aaiCqResponse);
+
+
+ } catch (Exception e) {
+ logger.error("testGetCqResponse Exception: ", e);
+ fail(e.getMessage());
+ }
+ }
+
+
private ControlLoopEventManager makeManager(VirtualControlLoopEvent event) {
return new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId());
}
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
index d8533c7e7..568f8bcd4 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.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.
@@ -119,7 +119,7 @@ public class ControlLoopOperationManagerTest {
return numEvents;
}
-
+
/**
* Set up test class.
*/
@@ -131,7 +131,7 @@ public class ControlLoopOperationManagerTest {
} catch (Exception e) {
fail(e.getMessage());
}
-
+
// Set PU
System.setProperty("OperationsHistoryPU", "OperationsHistoryPUTest");
@@ -155,7 +155,7 @@ public class ControlLoopOperationManagerTest {
emf.close();
HttpServletServer.factory.destroy();
}
-
+
@Test
public void testRetriesFail() {
//
@@ -479,8 +479,11 @@ public class ControlLoopOperationManagerTest {
onsetEvent.getAai().remove("generic-vnf.vnf-id");
manager.getVnfResponse();
- clom.getEventManager().getVnfResponse().setVnfId("generic-vnf.vnf-id");
- assertEquals("generic-vnf.vnf-id", clom.getTarget(policy));
+ if (!Boolean.valueOf(PolicyEngine.manager.getEnvironmentProperty("aai.customQuery"))) {
+ clom.getEventManager().getVnfResponse().setVnfId("generic-vnf.vnf-id");
+ assertEquals("generic-vnf.vnf-id", clom.getTarget(policy));
+ }
+
policy.getTarget().setType(TargetType.VFC);
try {
@@ -550,6 +553,7 @@ public class ControlLoopOperationManagerTest {
clom = new ControlLoopOperationManager(onsetEvent, policy, manager);
assertNotNull(clom);
+
policy.setActor("SO");
clom = new ControlLoopOperationManager(onsetEvent, policy, manager);
assertNotNull(clom);
@@ -804,13 +808,13 @@ public class ControlLoopOperationManagerTest {
System.setProperty("OperationsHistoryPU", "OperationsHistoryPUTest");
assertEquals(PolicyResult.FAILURE, clom.onResponse(soRw));
- }
+ }
@Test
public void testCommitAbatement() throws ControlLoopException, AaiException, IOException {
String yamlString = null;
- try ( InputStream is = new FileInputStream(new File("src/test/resources/test.yaml")) ) {
+ try (InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"))) {
yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
} catch (Exception e) {
fail(e.getMessage());
@@ -835,19 +839,19 @@ public class ControlLoopOperationManagerTest {
Policy policy = manager.getProcessor().getCurrentPolicy();
ControlLoopOperationManager clom = new ControlLoopOperationManager(onsetEvent, policy, manager);
assertNotNull(clom);
-
+
clom.startOperation(onsetEvent);
int numEventsBefore = getCount();
- logger.info("numEventsBefore={}", numEventsBefore);
-
- clom.commitAbatement("Test message","TEST_RESULT");
+ logger.info("numEventsBefore={}", numEventsBefore);
+
+ clom.commitAbatement("Test message", "TEST_RESULT");
int numEventsAfter = getCount();
- logger.info("numEventsAfter={}", numEventsAfter);
-
- assertEquals(1, numEventsAfter - numEventsBefore);
- }
+ logger.info("numEventsAfter={}", numEventsAfter);
+
+ assertEquals(1, numEventsAfter - numEventsBefore);
+ }
@Test
public void testSerialization() throws Exception {
@@ -876,7 +880,7 @@ public class ControlLoopOperationManagerTest {
clom.startOperation(onsetEvent);
assertTrue(clom.isOperationRunning());
-
+
clom = Serializer.roundTrip(clom);
assertNotNull(clom);
assertTrue(clom.isOperationRunning());
@@ -893,7 +897,7 @@ public class ControlLoopOperationManagerTest {
assertEquals(PolicyResult.FAILURE, clom.onResponse(soRw));
assertFalse(clom.isOperationRunning());
assertEquals(1, clom.getHistory().size());
-
+
clom = Serializer.roundTrip(clom);
assertNotNull(clom);
assertFalse(clom.isOperationRunning());
@@ -901,7 +905,7 @@ public class ControlLoopOperationManagerTest {
System.setProperty("OperationsHistoryPU", "OperationsHistoryPUTest");
assertEquals(PolicyResult.FAILURE, clom.onResponse(soRw));
-
+
clom = Serializer.roundTrip(clom);
assertNotNull(clom);
assertFalse(clom.isOperationRunning());
diff --git a/controlloop/common/eventmanager/src/test/resources/AaiCqResponse.json b/controlloop/common/eventmanager/src/test/resources/AaiCqResponse.json
new file mode 100644
index 000000000..63d6f79ac
--- /dev/null
+++ b/controlloop/common/eventmanager/src/test/resources/AaiCqResponse.json
@@ -0,0 +1,673 @@
+{
+ "results": [
+ {
+ "vserver": {
+ "vserver-id": "e7f1db09-ff78-44fc-b256-69095c5556fb",
+ "vserver-name": "vfw-vm-0201-2",
+ "vserver-name2": "vfw-vm-0201-2",
+ "prov-status": "ACTIVE",
+ "vserver-selflink": "http://ecompctl1.research.att.com:8774/v2/3f2aaef74ecb4b19b35e26d0849fe9a2/servers/e7f1db09-ff78-44fc-b256-69095c5556fb",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1549553422524",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "generic-vnf",
+ "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "17044ef4-e7f3-46a1-af03-e2aa562f23ac"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "TestVM-Vnf-0201-1"
+ }
+ ]
+ },
+ {
+ "related-to": "vnfc",
+ "related-link": "/aai/v11/network/vnfcs/vnfc/vfw",
+ "relationship-data": [
+ {
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "vfw"
+ }
+ ]
+ },
+ {
+ "related-to": "vf-module",
+ "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vf-modules/vf-module/33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "17044ef4-e7f3-46a1-af03-e2aa562f23ac"
+ },
+ {
+ "relationship-key": "vf-module.vf-module-id",
+ "relationship-value": "33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2"
+ }
+ ]
+ },
+ {
+ "related-to": "flavor",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/2",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "flavor.flavor-id",
+ "relationship-value": "2"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "flavor.flavor-name",
+ "property-value": "m1.small"
+ }
+ ]
+ },
+ {
+ "related-to": "image",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/84be7136-301f-4f47-9585-3a2e0f9534af",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "image.image-id",
+ "relationship-value": "84be7136-301f-4f47-9585-3a2e0f9534af"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "image.image-name",
+ "property-value": "unknown"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "generic-vnf": {
+ "vnf-id": "7b202620-2936-4b0d-b09c-60b411f10f64",
+ "vnf-name": "vLoadBalancerMS-Vnf-0211-1",
+ "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0",
+ "prov-status": "ACTIVE",
+ "equipment-role": "vLB",
+ "orchestration-status": "Active",
+ "ipv4-oam-address": "10.0.150.1",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1552311656338",
+ "model-invariant-id": "724ab1cf-6120-49e8-b909-849963bed1d6",
+ "model-version-id": "9d5944d8-2267-4799-824a-0f824e9a978d",
+ "model-customization-id": "efcd576d-a05e-4798-bb68-79e7d9c80f4c",
+ "nf-type": "ONAP-LOADBALANCER",
+ "nf-function": "LOADBALANCER",
+ "nf-role": "vLB",
+ "nf-naming-code": "vlb",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/101b8fc1-1796-4db1-a4e7-fe39c6a51558/service-data/vnfs/vnf/7b202620-2936-4b0d-b09c-60b411f10f64/vnf-data/vnf-topology/",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vLB/service-instances/service-instance/101b8fc1-1796-4db1-a4e7-fe39c6a51558",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "Demonstration"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "vLB"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "101b8fc1-1796-4db1-a4e7-fe39c6a51558"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "vLoadBalancerMS-0211-1"
+ }
+ ]
+ },
+ {
+ "related-to": "platform",
+ "related-link": "/aai/v11/business/platforms/platform/Test-Platform",
+ "relationship-data": [
+ {
+ "relationship-key": "platform.platform-name",
+ "relationship-value": "Test-Platform"
+ }
+ ]
+ },
+ {
+ "related-to": "line-of-business",
+ "related-link": "/aai/v11/business/lines-of-business/line-of-business/Test-Business",
+ "relationship-data": [
+ {
+ "relationship-key": "line-of-business.line-of-business-name",
+ "relationship-value": "Test-Business"
+ }
+ ]
+ },
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/58ca8df0-17b8-4aa2-8766-9c6c1a12cec8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "58ca8df0-17b8-4aa2-8766-9c6c1a12cec8"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "vdns-ms-0211-1"
+ }
+ ]
+ },
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/6c3b3714-e36c-45af-9f16-7d3a73d99497",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "6c3b3714-e36c-45af-9f16-7d3a73d99497"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "vlb-ms-0211-1"
+ }
+ ]
+ },
+ {
+ "related-to": "availability-zone",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/nova",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "availability-zone.availability-zone-name",
+ "relationship-value": "nova"
+ }
+ ]
+ }
+ ]
+ },
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "e46c6636-9ce5-4b77-bb1b-455ce9edc892",
+ "vf-module-name": "vLoadBalancerMS-0211-1",
+ "heat-stack-id": "vLoadBalancerMS-0211-1/73360253-2dfe-46f6-bcd6-8662a81238ea",
+ "orchestration-status": "Active",
+ "is-base-vf-module": true,
+ "resource-version": "1552311559802",
+ "model-invariant-id": "d263fc6d-cfce-4e20-8337-e06f48b474e6",
+ "model-version-id": "24c0aa10-3979-402c-ad98-20124751b551",
+ "model-customization-id": "65382eb1-db84-466c-b9d7-4e0f1ba7105f",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/101b8fc1-1796-4db1-a4e7-fe39c6a51558/service-data/vnfs/vnf/7b202620-2936-4b0d-b09c-60b411f10f64/vnf-data/vf-modules/vf-module/e46c6636-9ce5-4b77-bb1b-455ce9edc892/vf-module-data/vf-module-topology/",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/58ca8df0-17b8-4aa2-8766-9c6c1a12cec8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "58ca8df0-17b8-4aa2-8766-9c6c1a12cec8"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "vdns-ms-0211-1"
+ }
+ ]
+ },
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/6c3b3714-e36c-45af-9f16-7d3a73d99497",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "6c3b3714-e36c-45af-9f16-7d3a73d99497"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "vlb-ms-0211-1"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "service-instance": {
+ "service-instance-id": "101b8fc1-1796-4db1-a4e7-fe39c6a51558",
+ "service-instance-name": "vLoadBalancerMS-0211-1",
+ "environment-context": "General_Revenue-Bearing",
+ "workload-context": "Production",
+ "model-invariant-id": "1008a768-1b67-407e-88c6-58c82b34ef42",
+ "model-version-id": "81f8c1cd-f664-4450-b3a4-be645613ab32",
+ "resource-version": "1552311350334",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/101b8fc1-1796-4db1-a4e7-fe39c6a51558/service-data/service-topology/",
+ "orchestration-status": "Active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "project",
+ "related-link": "/aai/v11/business/projects/project/Test-Project",
+ "relationship-data": [
+ {
+ "relationship-key": "project.project-name",
+ "relationship-value": "Test-Project"
+ }
+ ]
+ },
+ {
+ "related-to": "generic-vnf",
+ "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/7b202620-2936-4b0d-b09c-60b411f10f64",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "7b202620-2936-4b0d-b09c-60b411f10f64"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "vLoadBalancerMS-Vnf-0211-1"
+ }
+ ]
+ },
+ {
+ "related-to": "owning-entity",
+ "related-link": "/aai/v11/business/owning-entities/owning-entity/bb94a687-4f3b-40a3-914e-e98037d5ebd2",
+ "relationship-data": [
+ {
+ "relationship-key": "owning-entity.owning-entity-id",
+ "relationship-value": "bb94a687-4f3b-40a3-914e-e98037d5ebd2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "generic-vnf": {
+ "vnf-id": "17044ef4-e7f3-46a1-af03-e2aa562f23ac",
+ "vnf-name": "TestVM-Vnf-0201-1",
+ "vnf-type": "TestVM/TestVM 0",
+ "prov-status": "ACTIVE",
+ "equipment-role": "",
+ "orchestration-status": "Active",
+ "ipv4-oam-address": "10.0.70.1",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1549041636264",
+ "model-invariant-id": "6a4d7971-0778-4655-9eab-9d6031c7ad57",
+ "model-version-id": "fb6c673c-e5b6-4e0a-9baf-5e0089784de9",
+ "model-customization-id": "706a3100-dbe5-442e-86c3-c7b823abbec2",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vnf-topology/",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/d41f8217-d464-4458-bf0a-fba33a0f1b31",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "Demonstration"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "vFW"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "d41f8217-d464-4458-bf0a-fba33a0f1b31"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "TestVM-Service-0201-1"
+ }
+ ]
+ },
+ {
+ "related-to": "platform",
+ "related-link": "/aai/v11/business/platforms/platform/Test-Platform",
+ "relationship-data": [
+ {
+ "relationship-key": "platform.platform-name",
+ "relationship-value": "Test-Platform"
+ }
+ ]
+ },
+ {
+ "related-to": "line-of-business",
+ "related-link": "/aai/v11/business/lines-of-business/line-of-business/Test-Business",
+ "relationship-data": [
+ {
+ "relationship-key": "line-of-business.line-of-business-name",
+ "relationship-value": "Test-Business"
+ }
+ ]
+ },
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/e7f1db09-ff78-44fc-b256-69095c5556fb",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "e7f1db09-ff78-44fc-b256-69095c5556fb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "vfw-vm-0201-2"
+ }
+ ]
+ },
+ {
+ "related-to": "availability-zone",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionTwo/availability-zones/availability-zone/zone-1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionTwo"
+ },
+ {
+ "relationship-key": "availability-zone.availability-zone-name",
+ "relationship-value": "zone-1"
+ }
+ ]
+ }
+ ]
+ },
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "0afde97a-3e3f-4597-aec3-e5488c0f20b7",
+ "vf-module-name": "TestVM-0201-1",
+ "heat-stack-id": "TestVM-0201-1/aee4d7e5-b4a0-4261-b3cf-bb23348a3d99",
+ "orchestration-status": "Active",
+ "is-base-vf-module": true,
+ "resource-version": "1549039401119",
+ "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
+ "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
+ "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/0afde97a-3e3f-4597-aec3-e5488c0f20b7/vf-module-data/vf-module-topology/"
+ },
+ {
+ "vf-module-id": "33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2",
+ "vf-module-name": "TestVM-0201-2",
+ "heat-stack-id": "TestVM-0201-2/1b9db6b8-620b-46f1-935a-8a61c294a98b",
+ "orchestration-status": "Active",
+ "is-base-vf-module": true,
+ "resource-version": "1549041447373",
+ "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
+ "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
+ "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2/vf-module-data/vf-module-topology/",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/e7f1db09-ff78-44fc-b256-69095c5556fb",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "e7f1db09-ff78-44fc-b256-69095c5556fb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "vfw-vm-0201-2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "vf-module": {
+ "vf-module-id": "0afde97a-3e3f-4597-aec3-e5488c0f20b7",
+ "vf-module-name": "TestVM-0201-1",
+ "heat-stack-id": "TestVM-0201-1/aee4d7e5-b4a0-4261-b3cf-bb23348a3d99",
+ "orchestration-status": "Active",
+ "is-base-vf-module": true,
+ "resource-version": "1549039401119",
+ "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
+ "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
+ "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/0afde97a-3e3f-4597-aec3-e5488c0f20b7/vf-module-data/vf-module-topology/"
+ }
+ },
+ {
+ "vf-module": {
+ "vf-module-id": "33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2",
+ "vf-module-name": "TestVM-0201-2",
+ "heat-stack-id": "TestVM-0201-2/1b9db6b8-620b-46f1-935a-8a61c294a98b",
+ "orchestration-status": "Active",
+ "is-base-vf-module": true,
+ "resource-version": "1549041447373",
+ "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
+ "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
+ "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2/vf-module-data/vf-module-topology/",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/e7f1db09-ff78-44fc-b256-69095c5556fb",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "e7f1db09-ff78-44fc-b256-69095c5556fb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "vfw-vm-0201-2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "tenant": {
+ "tenant-id": "tenant1-16197-as988q",
+ "tenant-name": "tenant-name-16197-as988q",
+ "resource-version": "1550769793637",
+ "vservers": {
+ "vserver": [
+ {
+ "vserver-id": "vserver1-16197-as988q",
+ "vserver-name": "vserverName",
+ "vserver-name2": "vserverTE-name2-as988q",
+ "prov-status": "ACTIVE",
+ "vserver-selflink": "TRINITY vserverLink",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1550769794551",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "generic-vnf",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v16/network/generic-vnfs/generic-vnf/VNF1-16197-as988q",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "VNF1-16197-as988q"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "vnf1Name"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "cloud-region": {
+ "cloud-owner": "co-16197-01-as988q",
+ "cloud-region-id": "cr-16197-01-as988q",
+ "resource-version": "1550769792672",
+ "orchestration-disabled": false,
+ "in-maint": false,
+ "tenants": {
+ "tenant": [
+ {
+ "tenant-id": "tenant1-16197-as988q",
+ "tenant-name": "tenant-name-16197-as988q",
+ "resource-version": "1550769793637"
+ }
+ ]
+ }
+ }
+ }
+ ]
+}