From 19ef8b24a98c09a349e6ae7309f535a0135463f6 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 21 Aug 2020 13:43:08 -0400 Subject: Make Actors event-agnostic Removed event and event-context code from the Actor code. Also removed the preprocessing steps from the Actor code, giving the application complete control over any preprocessing. Also fixed a bug wherein the APPC actor was treating the AAI_RESOURCE_VNF property as a String instead of as a GenericVnf. Issue-ID: POLICY-2746-actor Change-Id: Ibc05fe39ffedc0bc461abf10e6a960861ac70119 Signed-off-by: Jim Hahn --- .../actor/aai/AaiCustomQueryOperation.java | 75 +- .../controlloop/actor/aai/AaiGetOperation.java | 31 - .../actor/aai/AaiCustomQueryOperationTest.java | 129 +- .../controlloop/actor/aai/AaiGetOperationTest.java | 13 - .../actor/aai/AaiGetPnfOperationTest.java | 10 - .../actor/aai/AaiGetTenantOperationTest.java | 10 - .../controlloop/actor/appc/AppcOperation.java | 14 +- .../actor/appc/ModifyConfigOperation.java | 49 +- .../controlloop/actor/appc/AppcOperationTest.java | 33 +- .../controlloop/actor/appc/BasicAppcOperation.java | 28 +- .../actor/appc/ModifyConfigOperationTest.java | 100 +- .../actor/appclcm/AppcLcmOperation.java | 10 - .../actor/appclcm/AppcLcmOperationTest.java | 40 +- .../controlloop/actor/cds/GrpcOperation.java | 122 +- .../controlloop/actor/cds/GrpcOperationTest.java | 271 +- .../controlloop/actor/cds/GrpcOperatorTest.java | 8 +- .../actor/sdnc/BandwidthOnDemandOperation.java | 8 +- .../controlloop/actor/sdnc/RerouteOperation.java | 4 +- .../controlloop/actor/sdnc/SdncOperation.java | 25 - .../actor/sdnc/BandwidthOnDemandOperationTest.java | 34 - .../controlloop/actor/sdnc/BasicSdncOperation.java | 27 - .../actor/sdnc/RerouteOperationTest.java | 33 - .../controlloop/actor/sdnc/SdncOperationTest.java | 53 - .../controlloop/actor/sdnr/SdnrOperation.java | 22 +- .../controlloop/actor/sdnr/BasicSdnrOperation.java | 23 - .../controlloop/actor/sdnr/SdnrOperationTest.java | 61 +- .../policy/controlloop/actor/so/SoOperation.java | 139 +- .../controlloop/actor/so/VfModuleCreate.java | 46 +- .../controlloop/actor/so/VfModuleDelete.java | 42 +- .../controlloop/actor/so/BasicSoOperation.java | 7 - .../controlloop/actor/so/SoOperationTest.java | 200 - .../controlloop/actor/so/VfModuleCreateTest.java | 162 +- .../controlloop/actor/so/VfModuleDeleteTest.java | 159 +- .../actor/so/aai/AaiCqResponseFull.json | 3870 -------------------- .../actor/so/aai/AaiCqResponseMissing.json | 4 - .../actor/so/aai/AaiNqResponse-Full.json | 267 -- .../actor/so/aai/AaiNqResponse-NoBase.json | 230 -- .../actor/so/aai/AaiNqResponse-NoNonBase.json | 197 - .../controlloop/actor/test/BasicOperation.java | 83 +- .../test/BasicBidirectionalTopicOperationTest.java | 1 - .../actor/test/BasicHttpOperationTest.java | 1 - .../controlloop/actor/test/BasicOperationTest.java | 35 +- .../policy/controlloop/actor/vfc/VfcOperation.java | 37 +- .../policy/controlloop/actor/vfc/RestartTest.java | 39 +- .../controlloop/actor/vfc/VfcOperationTest.java | 40 - .../actorserviceprovider/OperationProperties.java | 2 +- .../controlloop/ControlLoopEventContext.java | 168 - .../impl/OperationPartial.java | 160 +- .../parameters/ControlLoopOperationParams.java | 48 +- .../controlloop/ControlLoopEventContextTest.java | 151 - .../impl/HttpOperationTest.java | 10 +- .../impl/HttpOperatorTest.java | 9 +- .../impl/OperationPartialTest.java | 173 +- .../parameters/ControlLoopOperationParamsTest.java | 71 +- 54 files changed, 212 insertions(+), 7372 deletions(-) delete mode 100644 models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseFull.json delete mode 100644 models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseMissing.json delete mode 100644 models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json delete mode 100644 models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json delete mode 100644 models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json delete mode 100644 models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContext.java delete mode 100644 models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContextTest.java diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java index 612fba98d..27dd56c60 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java @@ -29,20 +29,15 @@ import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.apache.commons.lang3.StringUtils; -import org.onap.policy.aai.AaiConstants; import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; -import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * A&AI Custom Query. Stores the {@link AaiCqResponse} in the context. In addition, if the @@ -51,8 +46,6 @@ import org.slf4j.LoggerFactory; * applies to the vserver, thus the target entity may be set to an empty string. */ public class AaiCustomQueryOperation extends HttpOperation { - private static final Logger logger = LoggerFactory.getLogger(AaiCustomQueryOperation.class); - public static final String NAME = AaiCqResponse.OPERATION; public static final String VSERVER_VSERVER_NAME = "vserver.vserver-name"; @@ -61,9 +54,6 @@ public class AaiCustomQueryOperation extends HttpOperation { private static final List PROPERTY_NAMES = List.of(OperationProperties.AAI_VSERVER_LINK); - // TODO make this configurable - private static final String PREFIX = "/aai/v16"; - /** * Constructs the object. * @@ -74,37 +64,6 @@ public class AaiCustomQueryOperation extends HttpOperation { super(params, config, String.class, PROPERTY_NAMES); } - /** - * Gets the vserver name from the enrichment data. - * - * @return the vserver name - */ - protected String getVserver() { - String vserver = this.params.getContext().getEnrichment().get(VSERVER_VSERVER_NAME); - if (StringUtils.isBlank(vserver)) { - throw new IllegalArgumentException("missing " + VSERVER_VSERVER_NAME + " in enrichment data"); - } - - return vserver; - } - - /** - * Queries the vserver, if necessary. - */ - @Override - protected CompletableFuture startPreprocessorAsync() { - if (params.isPreprocessed()) { - return null; - } - - String vserver = getVserver(); - ControlLoopOperationParams tenantParams = - params.toBuilder().actor(AaiConstants.ACTOR_NAME).operation(AaiGetTenantOperation.NAME) - .targetEntity(vserver).payload(null).retry(null).timeoutSec(null).build(); - - return params.getContext().obtain(AaiGetTenantOperation.getKey(vserver), tenantParams); - } - @Override public void generateSubRequestId(int attempt) { setSubRequestId(String.valueOf(attempt)); @@ -162,24 +121,7 @@ public class AaiCustomQueryOperation extends HttpOperation { * @return the vserver link */ protected String getVserverLink() { - String resourceLink = getProperty(OperationProperties.AAI_VSERVER_LINK); - if (resourceLink != null) { - return resourceLink; - } - - String vserver = getVserver(); - StandardCoderObject tenant = params.getContext().getProperty(AaiGetTenantOperation.getKey(vserver)); - if (tenant == null) { - throw new IllegalStateException("cannot perform custom query - cannot determine resource-link"); - } - - resourceLink = tenant.getString(RESULT_DATA, 0, RESOURCE_LINK); - if (resourceLink == null) { - throw new IllegalArgumentException("cannot perform custom query - no resource-link"); - } - - resourceLink = resourceLink.replace(PREFIX, ""); - return resourceLink; + return getRequiredProperty(OperationProperties.AAI_VSERVER_LINK, "vserver link"); } @Override @@ -199,19 +141,4 @@ public class AaiCustomQueryOperation extends HttpOperation { return outcome; } - - /** - * Injects the response into the context. - */ - @Override - protected CompletableFuture postProcessResponse(OperationOutcome outcome, String url, - Response rawResponse, String response) { - - if (params.getContext() != null) { - logger.info("{}: caching response for {}", getFullName(), params.getRequestId()); - params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, new AaiCqResponse(response)); - } - - return super.postProcessResponse(outcome, url, rawResponse, response); - } } diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java index 3fb978d88..a07722383 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java @@ -23,18 +23,13 @@ package org.onap.policy.controlloop.actor.aai; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.CompletableFuture; import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Response; import org.onap.policy.common.utils.coder.StandardCoderObject; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Superclass of A&AI operators that use "get" to perform their request and store their @@ -42,19 +37,10 @@ import org.slf4j.LoggerFactory; * which they are stored is ${actor}.${operation}.${targetEntity}. */ public class AaiGetOperation extends HttpOperation { - private static final Logger logger = LoggerFactory.getLogger(AaiGetOperation.class); - public static final int DEFAULT_RETRY = 3; private static final List PROPERTY_NAMES = List.of(OperationProperties.AAI_TARGET_ENTITY); - - /** - * Responses that are retrieved from A&AI are placed in the operation context under - * the name "${propertyPrefix}.${targetEntity}". - */ - private final String propertyPrefix; - /** * Constructs the object. * @@ -63,7 +49,6 @@ public class AaiGetOperation extends HttpOperation { */ public AaiGetOperation(ControlLoopOperationParams params, HttpConfig config) { super(params, config, StandardCoderObject.class, PROPERTY_NAMES); - this.propertyPrefix = getFullName() + "."; } @Override @@ -107,22 +92,6 @@ public class AaiGetOperation extends HttpOperation { return AaiUtil.makeHeaders(params); } - /** - * Injects the response into the context. - */ - @Override - protected CompletableFuture postProcessResponse(OperationOutcome outcome, String url, - Response rawResponse, StandardCoderObject response) { - - if (params.getContext() != null) { - String entity = getTargetEntity(); - logger.info("{}: caching response of {} for {}", getFullName(), entity, params.getRequestId()); - params.getContext().setProperty(propertyPrefix + entity, response); - } - - return super.postProcessResponse(outcome, url, rawResponse, response); - } - /** * Provides a default retry value, if none specified. */ diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java index 5a5e170dd..61155ce07 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java @@ -21,12 +21,9 @@ package org.onap.policy.controlloop.actor.aai; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; @@ -44,33 +41,20 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.mockito.Mock; import org.onap.policy.aai.AaiConstants; import org.onap.policy.aai.AaiCqResponse; -import org.onap.policy.common.endpoints.http.client.HttpClientFactory; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.Util; -import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; -import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator; -import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams; -import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; public class AaiCustomQueryOperationTest extends BasicAaiOperation { private static final StandardCoder coder = new StandardCoder(); private static final String MY_LINK = "my-link"; - private static final String MY_VSERVER = "my-vserver-name"; - private static final String SIM_VSERVER = "OzVServer"; - - @Mock - private Actor tenantActor; private AaiCustomQueryOperation oper; @@ -95,14 +79,8 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { public void setUp() throws Exception { super.setUpBasic(); - params.getContext().getEnrichment().put(AaiCustomQueryOperation.VSERVER_VSERVER_NAME, MY_VSERVER); - - MyTenantOperator tenantOperator = new MyTenantOperator(); - - when(service.getActor(AaiConstants.ACTOR_NAME)).thenReturn(tenantActor); - when(tenantActor.getOperator(AaiGetTenantOperation.NAME)).thenReturn(tenantOperator); - oper = new AaiCustomQueryOperation(params, config); + oper.setProperty(OperationProperties.AAI_VSERVER_LINK, MY_LINK); } /** @@ -115,7 +93,6 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build(); oper = new AaiCustomQueryOperation(params, config); - oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, SIM_VSERVER); oper.setProperty(OperationProperties.AAI_VSERVER_LINK, MY_LINK); @@ -131,16 +108,6 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { assertEquals(AaiCustomQueryOperation.NAME, oper.getName()); } - @Test - public void testGetVserver() { - assertEquals(MY_VSERVER, oper.getVserver()); - - // try without enrichment data - params.getContext().getEnrichment().remove(AaiCustomQueryOperation.VSERVER_VSERVER_NAME); - assertThatIllegalArgumentException().isThrownBy(() -> oper.getVserver()) - .withMessage("missing " + AaiCustomQueryOperation.VSERVER_VSERVER_NAME + " in enrichment data"); - } - @Test public void testGetPropertyNames() { assertThat(oper.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_VSERVER_LINK)); @@ -152,18 +119,9 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { assertEquals("3", oper.getSubRequestId()); } - /** - * Tests startPreprocessorAsync(), when preprocessing is disabled. - */ - @Test - public void testStartPreprocessorAsyncDisabled() { - params = params.toBuilder().preprocessed(true).build(); - assertNull(new AaiCustomQueryOperation(params, config).startPreprocessorAsync()); - } - @Test @SuppressWarnings("unchecked") - public void testStartOperationAsync_testStartPreprocessorAsync_testMakeRequest_testPostProcess() throws Exception { + public void testStartOperationAsync_testMakeRequest() throws Exception { // need two responses when(rawResponse.readEntity(String.class)).thenReturn(makeTenantReply()).thenReturn(makeCqReply()); when(webAsync.get(any(InvocationCallback.class))).thenAnswer(provideResponse(rawResponse)); @@ -173,41 +131,9 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { assertEquals(OperationResult.SUCCESS, getResult(future2)); - // tenant response should have been cached within the context - assertNotNull(context.getProperty(AaiGetTenantOperation.getKey(MY_VSERVER))); - - // custom query response should have been cached within the context - AaiCqResponse cqData = context.getProperty(AaiCqResponse.CONTEXT_KEY); - assertNotNull(cqData); - assertEquals("1", future2.get().getSubRequestId()); } - /** - * Tests when preprocessor step is not needed. - */ - @Test - @SuppressWarnings("unchecked") - public void testStartOperationAsync_testStartPreprocessorAsyncNotNeeded() throws Exception { - // pre-load the tenant data - final StandardCoderObject data = preloadTenantData(); - - // only need one response - when(rawResponse.readEntity(String.class)).thenReturn(makeCqReply()); - when(webAsync.put(any(), any(InvocationCallback.class))).thenAnswer(provideResponse(rawResponse, 1)); - - CompletableFuture future2 = oper.start(); - - assertEquals(OperationResult.SUCCESS, getResult(future2)); - - // should not have replaced tenant response - assertSame(data, context.getProperty(AaiGetTenantOperation.getKey(MY_VSERVER))); - - // custom query response should have been cached within the context - AaiCqResponse cqData = context.getProperty(AaiCqResponse.CONTEXT_KEY); - assertNotNull(cqData); - } - @Test public void testMakeHeaders() { verifyHeaders(oper.makeHeaders()); @@ -216,9 +142,6 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { @Test @SuppressWarnings("unchecked") public void testMakeRequest_testGetVserverLink() throws Exception { - // preload - preloadTenantData(); - when(rawResponse.readEntity(String.class)).thenReturn(makeCqReply()); when(webAsync.put(any(), any(InvocationCallback.class))).thenAnswer(provideResponse(rawResponse, 1)); @@ -237,26 +160,11 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { } @Test - public void testGetVserverLinkViaProperty() throws Exception { + public void testGetVserverLink() throws Exception { oper.setProperty(OperationProperties.AAI_VSERVER_LINK, MY_LINK); assertEquals(MY_LINK, oper.getVserverLink()); } - @Test - public void testGetVserverLinkNoTenantData() throws Exception { - assertThatIllegalStateException().isThrownBy(() -> oper.getVserverLink()) - .withMessage("cannot perform custom query - cannot determine resource-link"); - } - - @Test - public void testGetVserverLinkNoResourceLink() throws Exception { - // pre-load EMPTY tenant data - preloadTenantData(new StandardCoderObject()); - - assertThatIllegalArgumentException().isThrownBy(() -> oper.getVserverLink()) - .withMessage("cannot perform custom query - no resource-link"); - } - @Test public void testSetOutcome() { outcome = oper.setOutcome(params.makeOutcome(null), OperationResult.SUCCESS, null, null); @@ -278,16 +186,6 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { return "{}"; } - private StandardCoderObject preloadTenantData() throws Exception { - StandardCoderObject data = coder.decode(makeTenantReply(), StandardCoderObject.class); - preloadTenantData(data); - return data; - } - - private void preloadTenantData(StandardCoderObject data) { - context.setProperty(AaiGetTenantOperation.getKey(MY_VSERVER), data); - context.setProperty(AaiGetTenantOperation.getKey(SIM_VSERVER), data); - } private OperationResult getResult(CompletableFuture future2) throws InterruptedException, ExecutionException, TimeoutException { @@ -297,25 +195,4 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { return future2.get().getResult(); } - - protected class MyTenantOperator extends HttpOperator { - public MyTenantOperator() { - super(AaiConstants.ACTOR_NAME, AaiGetTenantOperation.NAME); - - HttpParams http = HttpParams.builder().clientName(MY_CLIENT).path(PATH).timeoutSec(1).build(); - - configure(Util.translateToMap(AaiGetTenantOperation.NAME, http)); - start(); - } - - @Override - public HttpOperation buildOperation(ControlLoopOperationParams params) { - return new AaiGetTenantOperation(params, getCurrentConfig()); - } - - @Override - protected HttpClientFactory getClientFactory() { - return factory; - } - } } diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java index df0dbff98..1cde4c860 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java @@ -29,7 +29,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.Map; -import java.util.concurrent.CompletableFuture; import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.client.WebTarget; import org.junit.AfterClass; @@ -37,14 +36,11 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.aai.AaiConstants; -import org.onap.policy.common.utils.coder.StandardCoderObject; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; public class AaiGetOperationTest extends BasicAaiOperation { private static final String MY_NAME = "my-operation-name"; private static final String PARAM_NAME = "my-param"; private static final String PARAM_VALUE = "my-value"; - private static final String MY_URL = "my-url"; private AaiGetOperation oper; @@ -104,15 +100,6 @@ public class AaiGetOperationTest extends BasicAaiOperation { verify(bldr).header("hdrB", "valB"); } - @Test - public void testPostProcessResponse() throws Exception { - StandardCoderObject resp = new StandardCoderObject(); - CompletableFuture future2 = oper.postProcessResponse(outcome, MY_URL, null, resp); - - assertSame(outcome, future2.get()); - assertSame(resp, context.getProperty("AAI.my-operation-name.my-target")); - } - @Test public void testGetRetry() { // use default if null retry diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java index 84f28210e..fb2b770db 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java @@ -23,8 +23,6 @@ package org.onap.policy.controlloop.actor.aai; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @@ -141,11 +139,6 @@ public class AaiGetPnfOperationTest extends BasicAaiOperation { assertEquals(OperationResult.SUCCESS, future2.get().getResult()); - // data should have been cached within the context - StandardCoderObject data = context.getProperty(AaiGetPnfOperation.getKey(TARGET_ENTITY)); - assertNotNull(data); - assertEquals(TEXT, data.getString(INPUT_FIELD)); - assertEquals("1", future2.get().getSubRequestId()); } @@ -168,9 +161,6 @@ public class AaiGetPnfOperationTest extends BasicAaiOperation { assertTrue(future2.isDone()); assertEquals(OperationResult.FAILURE, future2.get().getResult()); - - // data should NOT have been cached within the context - assertNull(context.getProperty(AaiGetPnfOperation.getKey(TARGET_ENTITY))); } @Test diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java index cf9a7a6a1..27495d8fc 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java @@ -23,8 +23,6 @@ package org.onap.policy.controlloop.actor.aai; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @@ -141,11 +139,6 @@ public class AaiGetTenantOperationTest extends BasicAaiOperation { assertEquals(OperationResult.SUCCESS, future2.get().getResult()); - // data should have been cached within the context - StandardCoderObject data = context.getProperty(AaiGetTenantOperation.getKey(TARGET_ENTITY)); - assertNotNull(data); - assertEquals(TEXT, data.getString(INPUT_FIELD)); - assertEquals("1", future2.get().getSubRequestId()); } @@ -168,9 +161,6 @@ public class AaiGetTenantOperationTest extends BasicAaiOperation { assertTrue(future2.isDone()); assertEquals(OperationResult.FAILURE, future2.get().getResult()); - - // data should NOT have been cached within the context - assertNull(context.getProperty(AaiGetTenantOperation.getKey(TARGET_ENTITY))); } @Test diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java index 70c70823c..89d5c4f2f 100644 --- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java +++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java @@ -23,7 +23,7 @@ package org.onap.policy.controlloop.actor.appc; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.CompletableFuture; +import org.onap.aai.domain.yang.GenericVnf; import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; @@ -70,14 +70,6 @@ public abstract class AppcOperation extends BidirectionalTopicOperation startPreprocessorAsync() { - return startGuardAsync(); - } - /** * Makes a request, given the target VNF. This is a support function for * {@link #makeRequest(int)}. @@ -86,7 +78,7 @@ public abstract class AppcOperation extends BidirectionalTopicOperation PROPERTY_NAMES = List.of(OperationProperties.AAI_RESOURCE_VNF); @@ -50,46 +41,8 @@ public class ModifyConfigOperation extends AppcOperation { super(params, config, PROPERTY_NAMES); } - /** - * Ensures that A&AI customer query has been performed, and then runs the guard query. - */ - @Override - @SuppressWarnings("unchecked") - protected CompletableFuture startPreprocessorAsync() { - if (params.isPreprocessed()) { - return null; - } - - ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) - .operation(AaiCqResponse.OPERATION).payload(null).retry(null).timeoutSec(null).build(); - - // run Custom Query and Guard, in parallel - return allOf(() -> params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams), this::startGuardAsync); - } - @Override protected Request makeRequest(int attempt) { - return makeRequest(attempt, getVnfId()); - } - - protected String getVnfId() { - GenericVnf vnf = this.getProperty(OperationProperties.AAI_RESOURCE_VNF); - if (vnf != null) { - return vnf.getVnfId(); - } - - AaiCqResponse cq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); - if (cq == null) { - throw new IllegalStateException("target vnf-id could not be determined"); - } - - GenericVnf genvnf = cq.getGenericVnfByModelInvariantId(params.getTargetEntityIds() - .get(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID)); - if (genvnf == null) { - logger.info("{}: target entity could not be found for {}", getFullName(), params.getRequestId()); - throw new IllegalArgumentException("target vnf-id could not be found"); - } - - return genvnf.getVnfId(); + return makeRequest(attempt, getRequiredProperty(OperationProperties.AAI_RESOURCE_VNF, "resource VNF")); } } diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java index db104b6bb..72e9065fc 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java @@ -23,7 +23,6 @@ package org.onap.policy.controlloop.actor.appc; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import java.util.Arrays; @@ -81,27 +80,13 @@ public class AppcOperationTest extends BasicAppcOperation { assertEquals(DEFAULT_OPERATION, oper.getName()); } - @Test - public void testStartPreprocessorAsync() { - assertNotNull(oper.startPreprocessorAsync()); - } - - /** - * Tests startPreprocessorAsync(), when preprocessing is disabled. - */ - @Test - public void testStartPreprocessorAsyncDisabled() { - params = params.toBuilder().preprocessed(true).build(); - assertNull(new MyOper(params, config).startPreprocessorAsync()); - } - @Test public void testMakeRequest() { oper.generateSubRequestId(2); String subreq = oper.getSubRequestId(); assertNotNull(subreq); - Request request = oper.makeRequest(2, MY_VNF); + Request request = oper.makeRequest(2, genvnf); assertEquals(DEFAULT_OPERATION, request.getAction()); assertNotNull(request.getPayload()); @@ -112,18 +97,18 @@ public class AppcOperationTest extends BasicAppcOperation { assertEquals(subreq, header.getSubRequestId()); - request = oper.makeRequest(2, MY_VNF); + request = oper.makeRequest(2, genvnf); assertEquals(subreq, request.getCommonHeader().getSubRequestId()); // repeat using a null payload params = params.toBuilder().payload(null).build(); oper = new MyOper(params, config); - assertEquals(Map.of(AppcOperation.VNF_ID_KEY, MY_VNF), oper.makeRequest(2, MY_VNF).getPayload()); + assertEquals(Map.of(AppcOperation.VNF_ID_KEY, MY_VNF), oper.makeRequest(2, genvnf).getPayload()); } @Test public void testConvertPayload() { - Request request = oper.makeRequest(2, MY_VNF); + Request request = oper.makeRequest(2, genvnf); // @formatter:off assertEquals( @@ -143,7 +128,7 @@ public class AppcOperationTest extends BasicAppcOperation { params = params.toBuilder().payload(payload).build(); oper = new MyOper(params, config); - request = oper.makeRequest(2, MY_VNF); + request = oper.makeRequest(2, genvnf); // @formatter:off assertEquals( @@ -164,7 +149,7 @@ public class AppcOperationTest extends BasicAppcOperation { params = params.toBuilder().payload(payload).build(); oper = new MyOper(params, config); - request = oper.makeRequest(2, MY_VNF); + request = oper.makeRequest(2, genvnf); payload.put(AppcOperation.VNF_ID_KEY, MY_VNF); payload.put(KEY1, "abc"); @@ -177,7 +162,7 @@ public class AppcOperationTest extends BasicAppcOperation { @Test public void testGetExpectedKeyValues() { oper.generateSubRequestId(2); - Request request = oper.makeRequest(2, MY_VNF); + Request request = oper.makeRequest(2, genvnf); assertEquals(Arrays.asList(request.getCommonHeader().getSubRequestId()), oper.getExpectedKeyValues(50, request)); } @@ -242,7 +227,7 @@ public class AppcOperationTest extends BasicAppcOperation { } } - private static class MyOper extends AppcOperation { + private class MyOper extends AppcOperation { public MyOper(ControlLoopOperationParams params, BidirectionalTopicConfig config) { super(params, config, Collections.emptyList()); @@ -250,7 +235,7 @@ public class AppcOperationTest extends BasicAppcOperation { @Override protected Request makeRequest(int attempt) { - return makeRequest(attempt, MY_VNF); + return makeRequest(attempt, genvnf); } } } diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java index 9d434cebf..aed2431e6 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java @@ -20,7 +20,6 @@ package org.onap.policy.controlloop.actor.appc; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -32,6 +31,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.function.BiConsumer; +import org.onap.aai.domain.yang.GenericVnf; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; import org.onap.policy.appc.ResponseCode; @@ -44,12 +44,9 @@ import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.Util; -import org.onap.policy.controlloop.actorserviceprovider.impl.OperationMaker; -import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.simulators.AppcLegacyTopicServer; import org.onap.policy.simulators.TopicServer; -import org.powermock.reflect.Whitebox; /** * Superclass for various operator tests. @@ -66,6 +63,7 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio protected static final String RESOURCE_ID = "my-resource"; protected Response response; + protected GenericVnf genvnf; /** * Constructs the object using a default actor and operation name. @@ -97,6 +95,9 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio response.setStatus(status); status.setCode(ResponseCode.SUCCESS.getValue()); status.setDescription(MY_DESCRIPTION); + + genvnf = new GenericVnf(); + genvnf.setVnfId(MY_VNF); } public void tearDown() { @@ -131,25 +132,6 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio assertEquals(MY_DESCRIPTION, outcome.getMessage()); } - /** - * Verifies that an exception is thrown if a field is missing from the enrichment - * data. - * - * @param fieldName name of the field to be removed from the enrichment data - * @param expectedText text expected in the exception message - */ - protected void verifyMissing(String fieldName, String expectedText, - OperationMaker maker) { - - makeContext(); - enrichment.remove(fieldName); - - AppcOperation oper = maker.apply(params, config); - - assertThatIllegalArgumentException().isThrownBy(() -> Whitebox.invokeMethod(oper, "makeRequest", 1)) - .withMessageContaining("missing").withMessageContaining(expectedText); - } - @Override protected void makeContext() { super.makeContext(); diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java index 749b6c86c..ee3ac0242 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java @@ -21,48 +21,26 @@ package org.onap.policy.controlloop.actor.appc; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import java.util.Arrays; import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.atomic.AtomicBoolean; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.mockito.Mock; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams; public class ModifyConfigOperationTest extends BasicAppcOperation { - @Mock - private GenericVnf genvnf; - @Mock - private AaiCqResponse cq; - private ModifyConfigOperation oper; @@ -85,8 +63,6 @@ public class ModifyConfigOperationTest extends BasicAppcOperation { @Override public void setUp() throws Exception { super.setUp(); - when(genvnf.getVnfId()).thenReturn(MY_VNF); - when(cq.getGenericVnfByModelInvariantId(any())).thenReturn(genvnf); oper = new ModifyConfigOperation(params, config); } @@ -106,16 +82,9 @@ public class ModifyConfigOperationTest extends BasicAppcOperation { BidirectionalTopicParams.builder().sinkTopic(MY_SINK).sourceTopic(MY_SINK).build(); config = new BidirectionalTopicConfig(blockingExecutor, opParams, topicMgr, AppcOperation.SELECTOR_KEYS); - params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, cq); - params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build(); - oper = new ModifyConfigOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - return null; - } - }; + oper = new ModifyConfigOperation(params, config); oper.setProperty(OperationProperties.AAI_RESOURCE_VNF, genvnf); @@ -135,45 +104,6 @@ public class ModifyConfigOperationTest extends BasicAppcOperation { assertThat(oper.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_RESOURCE_VNF)); } - @Test - public void testStartPreprocessorAsync() throws Exception { - CompletableFuture future2 = new CompletableFuture<>(); - context = mock(ControlLoopEventContext.class); - when(context.obtain(eq(AaiCqResponse.CONTEXT_KEY), any())).thenReturn(future2); - when(context.getEvent()).thenReturn(event); - params = params.toBuilder().context(context).build(); - - AtomicBoolean guardStarted = new AtomicBoolean(); - - oper = new ModifyConfigOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - guardStarted.set(true); - return super.startGuardAsync(); - } - }; - - CompletableFuture future3 = oper.startPreprocessorAsync(); - assertNotNull(future3); - assertFalse(future.isDone()); - assertTrue(guardStarted.get()); - verify(context).obtain(eq(AaiCqResponse.CONTEXT_KEY), any()); - - future2.complete(params.makeOutcome(null)); - assertTrue(executor.runAll(100)); - assertTrue(future3.isDone()); - assertEquals(OperationResult.SUCCESS, future3.get().getResult()); - } - - /** - * Tests startPreprocessorAsync(), when preprocessing is disabled. - */ - @Test - public void testStartPreprocessorAsyncDisabled() { - params = params.toBuilder().preprocessed(true).build(); - assertNull(new ModifyConfigOperation(params, config).startPreprocessorAsync()); - } - @Test public void testMakeRequest() throws CoderException { oper.setProperty(OperationProperties.AAI_RESOURCE_VNF, genvnf); @@ -185,32 +115,4 @@ public class ModifyConfigOperationTest extends BasicAppcOperation { verifyRequest("modifyConfig.json", request, IGNORE_FIELDS); } - - @Test - public void testGetVnfIdViaProperty() throws CoderException { - oper.setProperty(OperationProperties.AAI_RESOURCE_VNF, genvnf); - assertEquals(MY_VNF, oper.getVnfId()); - } - - @Test - public void testGetVnfId() throws CoderException { - // no CQ data - assertThatIllegalStateException().isThrownBy(() -> oper.getVnfId()) - .withMessage("target vnf-id could not be determined"); - - cq = new AaiCqResponse("{}"); - - // missing vnf-id - params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, cq); - assertThatIllegalArgumentException().isThrownBy(() -> oper.getVnfId()) - .withMessage("target vnf-id could not be found"); - - // populate the CQ data with a vnf-id - genvnf = new GenericVnf(); - genvnf.setVnfId(MY_VNF); - genvnf.setModelInvariantId(RESOURCE_ID); - cq.setInventoryResponseItems(Arrays.asList(genvnf)); - - assertEquals(MY_VNF, oper.getVnfId()); - } } diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java index 1d687cded..303067dde 100644 --- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java +++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java @@ -22,7 +22,6 @@ package org.onap.policy.controlloop.actor.appclcm; import java.util.List; import java.util.Map; -import java.util.concurrent.CompletableFuture; import org.onap.policy.appclcm.AppcLcmBody; import org.onap.policy.appclcm.AppcLcmCommonHeader; import org.onap.policy.appclcm.AppcLcmDmaapWrapper; @@ -66,15 +65,6 @@ public class AppcLcmOperation extends BidirectionalTopicOperation startPreprocessorAsync() { - return startGuardAsync(); - } - @Override protected AppcLcmDmaapWrapper makeRequest(int attempt) { String subRequestId = getSubRequestId(); diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java index e707ea942..650c5da99 100644 --- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java @@ -28,16 +28,12 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import org.junit.After; import org.junit.AfterClass; @@ -56,10 +52,8 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation.Status; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams; @@ -123,12 +117,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation startGuardAsync() { - return null; - } - }; + oper = new AppcLcmOperation(params, config); outcome = oper.start().get(); assertEquals(OperationResult.SUCCESS, outcome.getResult()); @@ -146,33 +135,6 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation startGuardAsync() { - guardStarted.set(true); - return super.startGuardAsync(); - } - }; - - CompletableFuture future2 = oper.startPreprocessorAsync(); - assertNotNull(future2); - assertFalse(future.isDone()); - assertTrue(guardStarted.get()); - - assertTrue(executor.runAll(100)); - assertTrue(future2.isDone()); - outcome = future2.get(); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); - } - @Test public void testMakeRequest() { oper.generateSubRequestId(2); diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java index c04453b7c..44d51813a 100644 --- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java +++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java @@ -40,12 +40,8 @@ import org.onap.aai.domain.yang.ServiceInstance; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; -import org.onap.policy.aai.AaiConstants; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.cds.client.CdsProcessorGrpcClient; import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.controlloop.actor.aai.AaiCustomQueryOperation; -import org.onap.policy.controlloop.actor.aai.AaiGetPnfOperation; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; import org.onap.policy.controlloop.actor.cds.request.CdsActionRequest; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -76,11 +72,6 @@ public class GrpcOperation extends OperationPartial { */ private final GrpcConfig config; - /** - * Function to request the A&AI data appropriate to the target type. - */ - private final Supplier> aaiRequestor; - /** * Function to convert the A&AI data associated with the target type. */ @@ -112,11 +103,9 @@ public class GrpcOperation extends OperationPartial { this.config = config; if (TargetType.PNF.equals(params.getTargetType())) { - aaiRequestor = this::getPnf; aaiConverter = this::convertPnfToAaiProperties; } else { - aaiRequestor = this::getCq; - aaiConverter = this::convertCqToAaiProperties; + aaiConverter = this::convertVnfToAaiProperties; } } @@ -133,44 +122,6 @@ public class GrpcOperation extends OperationPartial { return (timeoutSec == null || timeoutSec == 0 ? config.getTimeoutMs() : super.getTimeoutMs(timeoutSec)); } - /** - * Ensures that A&AI query has been performed, and runs the guard. - */ - @Override - @SuppressWarnings("unchecked") - protected CompletableFuture startPreprocessorAsync() { - if (params.isPreprocessed()) { - return null; - } - - // run A&AI Query and Guard, in parallel - return allOf(aaiRequestor, this::startGuardAsync); - } - - /** - * Requests the A&AI PNF data. - * - * @return a future to get the PNF data - */ - private CompletableFuture getPnf() { - ControlLoopOperationParams pnfParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) - .operation(AaiGetPnfOperation.NAME).payload(null).retry(null).timeoutSec(null).build(); - - return params.getContext().obtain(AaiGetPnfOperation.getKey(params.getTargetEntity()), pnfParams); - } - - /** - * Requests the A&AI Custom Query data. - * - * @return a future to get the custom query data - */ - private CompletableFuture getCq() { - ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) - .operation(AaiCustomQueryOperation.NAME).payload(null).retry(null).timeoutSec(null).build(); - - return params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams); - } - /** * Converts the A&AI PNF data to a map suitable for passing via the "aaiProperties" * field in the CDS request. @@ -178,13 +129,14 @@ public class GrpcOperation extends OperationPartial { * @return a map of the PNF data */ private Map convertPnfToAaiProperties() { - Map result = this.getProperty(OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES); + Map result = getProperty(OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES); if (result != null) { return result; } // convert PNF data to a Map - Map source = Util.translateToMap(getFullName(), getPnfData()); + Object pnfData = getRequiredProperty(OperationProperties.AAI_PNF, "PNF"); + Map source = Util.translateToMap(getFullName(), pnfData); result = new LinkedHashMap<>(); @@ -196,33 +148,13 @@ public class GrpcOperation extends OperationPartial { } /** - * Gets the PNF from the operation properties, if it exists, or from the context - * properties otherwise. - * - * @return the PNF item - */ - protected Object getPnfData() { - Object pnf = getProperty(OperationProperties.AAI_PNF); - if (pnf != null) { - return pnf; - } - - pnf = params.getContext().getProperty(AaiGetPnfOperation.getKey(params.getTargetEntity())); - if (pnf == null) { - throw new IllegalArgumentException("missing PNF data"); - } - - return pnf; - } - - /** - * Converts the A&AI Custom Query data to a map suitable for passing via the + * Converts the A&AI VNF data to a map suitable for passing via the * "aaiProperties" field in the CDS request. * - * @return a map of the custom query data + * @return a map of the VNF data */ - private Map convertCqToAaiProperties() { - Map result = this.getProperty(OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES); + private Map convertVnfToAaiProperties() { + Map result = getProperty(OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES); if (result != null) { return result; } @@ -236,35 +168,13 @@ public class GrpcOperation extends OperationPartial { } protected String getServiceInstanceId() { - ServiceInstance serviceInstance = getProperty(OperationProperties.AAI_SERVICE); - if (serviceInstance != null) { - return serviceInstance.getServiceInstanceId(); - } - - AaiCqResponse aaicq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); - - serviceInstance = aaicq.getServiceInstance(); - if (serviceInstance == null) { - throw new IllegalArgumentException("Target service instance could not be found"); - } - + ServiceInstance serviceInstance = + getRequiredProperty(OperationProperties.AAI_SERVICE, "Target service instance"); return serviceInstance.getServiceInstanceId(); } protected String getVnfId() { - GenericVnf genericVnf = getProperty(OperationProperties.AAI_RESOURCE_VNF); - if (genericVnf != null) { - return genericVnf.getVnfId(); - } - - AaiCqResponse aaicq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); - - genericVnf = aaicq.getGenericVnfByModelInvariantId(params.getTargetEntityIds() - .get(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID)); - if (genericVnf == null) { - throw new IllegalArgumentException("Target generic vnf could not be found"); - } - + GenericVnf genericVnf = getRequiredProperty(OperationProperties.AAI_RESOURCE_VNF, "Target generic vnf"); return genericVnf.getVnfId(); } @@ -345,7 +255,7 @@ public class GrpcOperation extends OperationPartial { request.setAaiProperties(aaiConverter.get()); // Inject any additional event parameters that may be present in the onset event - Map additionalParams = getAdditionalEventParams(); + Map additionalParams = getProperty(OperationProperties.EVENT_ADDITIONAL_PARAMS); if (additionalParams != null) { request.setAdditionalEventParams(additionalParams); } @@ -375,14 +285,6 @@ public class GrpcOperation extends OperationPartial { .setPayload(struct.build()).build(); } - protected Map getAdditionalEventParams() { - if (containsProperty(OperationProperties.EVENT_ADDITIONAL_PARAMS)) { - return getProperty(OperationProperties.EVENT_ADDITIONAL_PARAMS); - } - - return params.getContext().getEvent().getAdditionalEventParams(); - } - private Map convertPayloadMap(Map payload) { Map convertedPayload = new HashMap<>(); for (Entry entry : payload.entrySet()) { diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java index 709e179e6..da069d83e 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java @@ -23,13 +23,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.Collections; @@ -39,11 +35,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicBoolean; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -51,11 +43,9 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pnf; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.cds.client.CdsProcessorGrpcClient; import org.onap.policy.cds.properties.CdsServerProperties; import org.onap.policy.common.utils.coder.Coder; @@ -63,15 +53,12 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.common.utils.time.PseudoExecutor; -import org.onap.policy.controlloop.VirtualControlLoopEvent; -import org.onap.policy.controlloop.actor.aai.AaiGetPnfOperation; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; import org.onap.policy.controlloop.actorserviceprovider.ActorService; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.TargetType; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.simulators.CdsSimulator; import org.onap.policy.simulators.Util; @@ -96,16 +83,11 @@ public class GrpcOperationTest { @Mock private CdsProcessorGrpcClient cdsClient; - @Mock - private ControlLoopEventContext context; private CdsServerProperties cdsProps; - private VirtualControlLoopEvent onset; private PseudoExecutor executor; - private TargetType targetType; private Map targetEntityIds; private ControlLoopOperationParams params; private GrpcConfig config; - private CompletableFuture cqFuture; private GrpcOperation operation; @BeforeClass @@ -136,25 +118,15 @@ public class GrpcOperationTest { // Setup cdsClient when(cdsClient.sendRequest(any(ExecutionServiceInput.class))).thenReturn(mock(CountDownLatch.class)); - // Setup onset event - onset = new VirtualControlLoopEvent(); - onset.setRequestId(REQUEST_ID); - // Setup executor executor = new PseudoExecutor(); - targetType = TargetType.VM; targetEntityIds = new HashMap<>(); targetEntityIds.put(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID, RESOURCE_ID); - cqFuture = new CompletableFuture<>(); - when(context.obtain(eq(AaiCqResponse.CONTEXT_KEY), any())).thenReturn(cqFuture); - when(context.getEvent()).thenReturn(onset); - - params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR) - .operation(GrpcOperation.NAME).context(context).actorService(new ActorService()) - .targetEntity(TARGET_ENTITY).targetType(targetType).targetEntityIds(targetEntityIds) - .build(); + params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation(GrpcOperation.NAME) + .requestId(REQUEST_ID).actorService(new ActorService()).targetEntity(TARGET_ENTITY) + .build(); } /** @@ -162,49 +134,12 @@ public class GrpcOperationTest { */ @Test public void testSuccess() throws Exception { - ControlLoopEventContext context = new ControlLoopEventContext(onset); - loadCqData(context); - Map payload = Map.of("artifact_name", "my_artifact", "artifact_version", "1.0"); params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation("subscribe") - .context(context).actorService(new ActorService()).targetEntity(TARGET_ENTITY) - .targetType(targetType).targetEntityIds(targetEntityIds) - .retry(0).timeoutSec(5).executor(blockingExecutor).payload(payload).build(); - - cdsProps.setHost("localhost"); - cdsProps.setPort(sim.getPort()); - cdsProps.setTimeout(3); - - GrpcConfig config = new GrpcConfig(blockingExecutor, cdsProps); - - operation = new GrpcOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - // indicate that guard completed successfully - return CompletableFuture.completedFuture(params.makeOutcome(null)); - } - }; - - OperationOutcome outcome = operation.start().get(); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof ExecutionServiceOutput); - } - - /** - * Tests "success" case with simulator using properties. - */ - @Test - public void testSuccessViaProperties() throws Exception { - ControlLoopEventContext context = new ControlLoopEventContext(onset); - loadCqData(context); - - Map payload = Map.of("artifact_name", "my_artifact", "artifact_version", "1.0"); - - params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation("subscribe") - .context(context).actorService(new ActorService()).targetEntity(TARGET_ENTITY) - .targetType(targetType).targetEntityIds(targetEntityIds) - .retry(0).timeoutSec(5).executor(blockingExecutor).payload(payload).preprocessed(true).build(); + .requestId(REQUEST_ID).actorService(new ActorService()).targetEntity(TARGET_ENTITY) + .retry(0).timeoutSec(5).executor(blockingExecutor).payload(payload) + .preprocessed(true).build(); cdsProps.setHost("localhost"); cdsProps.setPort(sim.getPort()); @@ -254,137 +189,23 @@ public class GrpcOperationTest { // @formatter:on } - @Test - public void testGetPnf() { - ControlLoopEventContext context = new ControlLoopEventContext(onset); - params = params.toBuilder().context(context).build(); - operation = new GrpcOperation(params, config); - - // in neither property nor context - assertThatIllegalArgumentException().isThrownBy(() -> operation.getPnfData()).withMessage("missing PNF data"); - - // only in context - Pnf pnf = new Pnf(); - params.getContext().setProperty(AaiGetPnfOperation.getKey(params.getTargetEntity()), pnf); - assertSame(pnf, operation.getPnfData()); - - // both - should choose the property - Pnf pnf2 = new Pnf(); - operation.setProperty(OperationProperties.AAI_PNF, pnf2); - assertSame(pnf2, operation.getPnfData()); - } - @Test public void testGetServiceInstanceId() { - ControlLoopEventContext context = new ControlLoopEventContext(onset); - params = params.toBuilder().context(context).build(); operation = new GrpcOperation(params, config); - - // in neither property nor custom query - context.setProperty(AaiCqResponse.CONTEXT_KEY, mock(AaiCqResponse.class)); - assertThatIllegalArgumentException().isThrownBy(() -> operation.getServiceInstanceId()) - .withMessage("Target service instance could not be found"); - - // only in custom query - loadCqData(params.getContext()); + loadVnfData(); assertEquals(MY_SVC_ID, operation.getServiceInstanceId()); - - // both - should choose the property - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("another-service-id"); - operation.setProperty(OperationProperties.AAI_SERVICE, serviceInstance); - assertEquals("another-service-id", operation.getServiceInstanceId()); } @Test public void testGetVnfId() { - ControlLoopEventContext context = new ControlLoopEventContext(onset); - params = params.toBuilder().context(context).build(); operation = new GrpcOperation(params, config); - - // in neither property nor custom query - context.setProperty(AaiCqResponse.CONTEXT_KEY, mock(AaiCqResponse.class)); - assertThatIllegalArgumentException().isThrownBy(() -> operation.getVnfId()) - .withMessage("Target generic vnf could not be found"); - - // only in custom query - loadCqData(params.getContext()); + loadVnfData(); assertEquals(MY_VNF, operation.getVnfId()); - - // both - should choose the property - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("another-vnf-id"); - operation.setProperty(OperationProperties.AAI_RESOURCE_VNF, vnf); - assertEquals("another-vnf-id", operation.getVnfId()); - } - - @Test - public void testStartPreprocessorAsync() throws InterruptedException, ExecutionException, TimeoutException { - AtomicBoolean guardStarted = new AtomicBoolean(); - - operation = new GrpcOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - guardStarted.set(true); - return cqFuture; - } - }; - - CompletableFuture future3 = operation.startPreprocessorAsync(); - assertNotNull(future3); - assertTrue(guardStarted.get()); - verify(context).obtain(eq(AaiCqResponse.CONTEXT_KEY), any()); - - cqFuture.complete(params.makeOutcome(null)); - assertTrue(executor.runAll(100)); - assertEquals(OperationResult.SUCCESS, future3.get(2, TimeUnit.SECONDS).getResult()); - assertTrue(future3.isDone()); - } - - /** - * Tests startPreprocessorAsync() when the target type is PNF. - */ - @Test - public void testStartPreprocessorAsyncPnf() throws InterruptedException, ExecutionException, TimeoutException { - AtomicBoolean guardStarted = new AtomicBoolean(); - - params = params.toBuilder().targetType(TargetType.PNF).build(); - - operation = new GrpcOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - guardStarted.set(true); - return cqFuture; - } - }; - - CompletableFuture future3 = operation.startPreprocessorAsync(); - assertNotNull(future3); - assertTrue(guardStarted.get()); - verify(context).obtain(eq(AaiGetPnfOperation.getKey(TARGET_ENTITY)), any()); - - cqFuture.complete(params.makeOutcome(null)); - assertTrue(executor.runAll(100)); - assertEquals(OperationResult.SUCCESS, future3.get(2, TimeUnit.SECONDS).getResult()); - assertTrue(future3.isDone()); - } - - /** - * Tests startPreprocessorAsync(), when preprocessing is disabled. - */ - @Test - public void testStartPreprocessorAsyncDisabled() { - params = params.toBuilder().preprocessed(true).build(); - assertNull(new GrpcOperation(params, config).startPreprocessorAsync()); } @Test public void testStartOperationAsync() throws Exception { - - ControlLoopEventContext context = new ControlLoopEventContext(onset); - loadCqData(context); - - verifyOperation(context); + verifyOperation(TargetType.VNF, this::loadVnfData); } /** @@ -392,24 +213,7 @@ public class GrpcOperationTest { */ @Test public void testStartOperationAsyncPnf() throws Exception { - - targetType = TargetType.PNF; - - ControlLoopEventContext context = new ControlLoopEventContext(onset); - loadPnfData(context); - - verifyOperation(context); - } - - @Test - public void testStartOperationAsyncWithAdditionalParams() throws Exception { - - Map additionalParams = new HashMap<>(); - additionalParams.put("test", "additionalParams"); - onset.setAdditionalEventParams(additionalParams); - ControlLoopEventContext context = new ControlLoopEventContext(onset); - loadCqData(context); - verifyOperation(context); + verifyOperation(TargetType.PNF, this::loadPnfData); } @Test @@ -419,39 +223,15 @@ public class GrpcOperationTest { .isThrownBy(() -> operation.startOperationAsync(1, params.makeOutcome(null))); } - @Test - public void testGetAdditionalEventParams() { - operation = new GrpcOperation(params, config); - - // in neither property nor context - assertNull(operation.getAdditionalEventParams()); - - final Map eventParams = Collections.emptyMap(); - - // only in context - onset.setAdditionalEventParams(eventParams); - assertSame(eventParams, operation.getAdditionalEventParams()); - - // both - should choose the property, even if it's null - operation.setProperty(OperationProperties.EVENT_ADDITIONAL_PARAMS, null); - assertNull(operation.getAdditionalEventParams()); - - // both - should choose the property - final Map propParams = Collections.emptyMap(); - operation.setProperty(OperationProperties.EVENT_ADDITIONAL_PARAMS, propParams); - assertSame(propParams, operation.getAdditionalEventParams()); - } - - private void verifyOperation(ControlLoopEventContext context) { + private void verifyOperation(TargetType targetType, Runnable loader) { Map payloadMap = Map.of(CdsActorConstants.KEY_CBA_NAME, CDS_BLUEPRINT_NAME, CdsActorConstants.KEY_CBA_VERSION, CDS_BLUEPRINT_VERSION, "data", "{\"mapInfo\":{\"key\":\"val\"},\"arrayInfo\":[\"one\",\"two\"],\"paramInfo\":\"val\"}"); ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR) - .operation(GrpcOperation.NAME).context(context).actorService(new ActorService()) - .targetEntity(TARGET_ENTITY).targetType(targetType).targetEntityIds(targetEntityIds) - .payload(payloadMap).build(); + .operation(GrpcOperation.NAME).requestId(REQUEST_ID).actorService(new ActorService()) + .targetType(targetType).targetEntity(TARGET_ENTITY).payload(payloadMap).build(); GrpcConfig config = new GrpcConfig(executor, cdsProps); operation = new GrpcOperation(params, config); @@ -459,28 +239,31 @@ public class GrpcOperationTest { assertEquals(1000, operation.getTimeoutMs(0)); assertEquals(2000, operation.getTimeoutMs(2)); operation.generateSubRequestId(1); + + loader.run(); CompletableFuture future3 = operation.startOperationAsync(1, params.makeOutcome(null)); assertNotNull(future3); } - private void loadPnfData(ControlLoopEventContext context) throws CoderException { - String json = "{'dataA': 'valueA', 'dataB': 'valueB'}".replace('\'', '"'); - StandardCoderObject sco = coder.decode(json, StandardCoderObject.class); + private void loadPnfData() { + try { + String json = "{'dataA': 'valueA', 'dataB': 'valueB'}".replace('\'', '"'); + StandardCoderObject sco = coder.decode(json, StandardCoderObject.class); + + operation.setProperty(OperationProperties.AAI_PNF, sco); - context.setProperty(AaiGetPnfOperation.getKey(TARGET_ENTITY), sco); + } catch (CoderException e) { + throw new IllegalArgumentException("cannot decode PNF json", e); + } } - private void loadCqData(ControlLoopEventContext context) { + private void loadVnfData() { GenericVnf genvnf = new GenericVnf(); genvnf.setVnfId(MY_VNF); + operation.setProperty(OperationProperties.AAI_RESOURCE_VNF, genvnf); ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setServiceInstanceId(MY_SVC_ID); - - AaiCqResponse cq = mock(AaiCqResponse.class); - when(cq.getGenericVnfByModelInvariantId(any())).thenReturn(genvnf); - when(cq.getServiceInstance()).thenReturn(serviceInstance); - - context.setProperty(AaiCqResponse.CONTEXT_KEY, cq); + operation.setProperty(OperationProperties.AAI_SERVICE, serviceInstance); } } diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java index 11121c0b3..3e3b1f573 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperatorTest.java @@ -25,16 +25,14 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import java.util.Map; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.mockito.MockitoAnnotations; import org.onap.policy.cds.properties.CdsServerProperties; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; import org.onap.policy.controlloop.actorserviceprovider.Operation; -import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.Util; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.ParameterValidationRuntimeException; @@ -85,10 +83,8 @@ public class GrpcOperatorTest { @Test public void testBuildOperation() { - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - ControlLoopEventContext context = new ControlLoopEventContext(event); ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR) - .operation(GrpcOperation.NAME).context(context).targetType(TargetType.VM).build(); + .operation(GrpcOperation.NAME).requestId(UUID.randomUUID()).build(); // not configured yet assertThatIllegalStateException().isThrownBy(() -> operation.buildOperation(params)); diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java index d2a153641..2946a2055 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java @@ -66,18 +66,18 @@ public class BandwidthOnDemandOperation extends SdncOperation { @Override protected SdncRequest makeRequest(int attempt) { - String serviceInstance = getOptProperty(OperationProperties.ENRICHMENT_SERVICE_ID, SERVICE_ID_KEY); + String serviceInstance = getProperty(OperationProperties.ENRICHMENT_SERVICE_ID); if (StringUtils.isBlank(serviceInstance)) { throw new IllegalArgumentException("missing enrichment data, " + SERVICE_ID_KEY); } SdncHealVfModuleParameter bandwidth = new SdncHealVfModuleParameter(); bandwidth.setName(BANDWIDTH); - bandwidth.setValue(getOptProperty(OperationProperties.ENRICHMENT_BANDWIDTH, BANDWIDTH)); + bandwidth.setValue(getProperty(OperationProperties.ENRICHMENT_BANDWIDTH)); SdncHealVfModuleParameter timeStamp = new SdncHealVfModuleParameter(); timeStamp.setName(BANDWIDTH_CHANGE_TIME); - timeStamp.setValue(getOptProperty(OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME, BANDWIDTH_CHANGE_TIME)); + timeStamp.setValue(getProperty(OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME)); SdncHealVfModuleParametersInfo vfParametersInfo = new SdncHealVfModuleParametersInfo(); vfParametersInfo.addParameters(bandwidth); @@ -102,7 +102,7 @@ public class BandwidthOnDemandOperation extends SdncOperation { request.setUrl("/" + getPath()); SdncHealVnfInfo vnfInfo = new SdncHealVnfInfo(); - vnfInfo.setVnfId(getOptProperty(OperationProperties.ENRICHMENT_VNF_ID, VNF_ID)); + vnfInfo.setVnfId(getProperty(OperationProperties.ENRICHMENT_VNF_ID)); SdncHealVfModuleInfo vfModuleInfo = new SdncHealVfModuleInfo(); vfModuleInfo.setVfModuleId(""); diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java index 105a27601..02209bbd2 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java @@ -57,14 +57,14 @@ public class RerouteOperation extends SdncOperation { @Override protected SdncRequest makeRequest(int attempt) { - String serviceInstance = getOptProperty(OperationProperties.ENRICHMENT_SERVICE_ID, SERVICE_ID_KEY); + String serviceInstance = getProperty(OperationProperties.ENRICHMENT_SERVICE_ID); if (StringUtils.isBlank(serviceInstance)) { throw new IllegalArgumentException("missing enrichment data, " + SERVICE_ID_KEY); } SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo(); serviceInfo.setServiceInstanceId(serviceInstance); - String networkId = getOptProperty(OperationProperties.ENRICHMENT_NETWORK_ID, NETWORK_ID_KEY); + String networkId = getProperty(OperationProperties.ENRICHMENT_NETWORK_ID); if (StringUtils.isBlank(networkId)) { throw new IllegalArgumentException("missing enrichment data, " + NETWORK_ID_KEY); } diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java index defbcfbc9..d235fb2c8 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java @@ -51,14 +51,6 @@ public abstract class SdncOperation extends HttpOperation { super(params, config, SdncResponse.class, propertyNames); } - /** - * Starts the GUARD. - */ - @Override - protected CompletableFuture startPreprocessorAsync() { - return startGuardAsync(); - } - @Override protected CompletableFuture startOperationAsync(int attempt, OperationOutcome outcome) { @@ -96,21 +88,4 @@ public abstract class SdncOperation extends HttpOperation { protected boolean isSuccess(Response rawResponse, SdncResponse response) { return response.getResponseOutput() != null && "200".equals(response.getResponseOutput().getResponseCode()); } - - /** - * Gets an optional property, first checking the properties, then checking the - * enrichment data. - * - * @param propName property name - * @param enrichmentName property name within the enrichment data - * @return the property's value, or {@code null} if it is not found - */ - protected String getOptProperty(String propName, String enrichmentName) { - if (containsProperty(propName)) { - // return the value, even if it's null - return getProperty(propName); - } - - return params.getContext().getEnrichment().get(enrichmentName); - } } diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java index 5e71a6cd5..ba68534c4 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.List; -import java.util.Map; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -33,10 +32,8 @@ import org.junit.Test; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams; -import org.onap.policy.sdnc.SdncRequest; import org.onap.policy.sdnc.SdncResponse; public class BandwidthOnDemandOperationTest extends BasicSdncOperation { @@ -114,30 +111,6 @@ public class BandwidthOnDemandOperationTest extends BasicSdncOperation { @Test public void testMakeRequest() throws Exception { - oper.generateSubRequestId(1); - SdncRequest request = oper.makeRequest(1); - assertEquals(MY_SERVICE, request.getNsInstanceId()); - assertEquals(REQ_ID, request.getRequestId()); - assertEquals("/my-path/", request.getUrl()); - assertEquals(oper.getSubRequestId(), request.getHealRequest().getRequestHeaderInfo().getSvcRequestId()); - - verifyRequest("bod.json", request, IGNORE_FIELDS); - - verifyMissing(BandwidthOnDemandOperation.SERVICE_ID_KEY, "service", BandwidthOnDemandOperation::new); - - // perform the operation - makeContext(); - verifyRequest("bod.json", verifyOperation(oper), IGNORE_FIELDS); - } - - @Test - public void testMakeRequestViaProperties() throws Exception { - // clear the enrichment data and remake the operation - event.setAai(null); - context = new ControlLoopEventContext(event); - params = params.toBuilder().context(context).build(); - oper = new BandwidthOnDemandOperation(params, config); - oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE); oper.setProperty(OperationProperties.ENRICHMENT_BANDWIDTH, MY_BANDWIDTH); oper.setProperty(OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME, MY_CHANGE_TIME); @@ -145,11 +118,4 @@ public class BandwidthOnDemandOperationTest extends BasicSdncOperation { verifyRequest("bod.json", verifyOperation(oper), IGNORE_FIELDS); } - - @Override - protected Map makeEnrichment() { - return Map.of(BandwidthOnDemandOperation.SERVICE_ID_KEY, MY_SERVICE, BandwidthOnDemandOperation.BANDWIDTH, - MY_BANDWIDTH, BandwidthOnDemandOperation.BANDWIDTH_CHANGE_TIME, MY_CHANGE_TIME, - BandwidthOnDemandOperation.VNF_ID, MY_VNF); - } } diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java index a118ab124..f4b6141f8 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java @@ -20,7 +20,6 @@ package org.onap.policy.controlloop.actor.sdnc; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -29,7 +28,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; @@ -41,13 +39,10 @@ import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.impl.OperationMaker; -import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.sdnc.SdncRequest; import org.onap.policy.sdnc.SdncResponse; import org.onap.policy.sdnc.SdncResponseOutput; import org.onap.policy.simulators.Util; -import org.powermock.reflect.Whitebox; /** * Superclass for various operator tests. @@ -137,26 +132,4 @@ public abstract class BasicSdncOperation extends BasicHttpOperation { return coder.decode(reqText, SdncRequest.class); } - - /** - * Verifies that an exception is thrown if a field is missing from the enrichment - * data. - * - * @param fieldName name of the field to be removed from the enrichment data - * @param expectedText text expected in the exception message - */ - protected void verifyMissing(String fieldName, String expectedText, - OperationMaker maker) { - - makeContext(); - enrichment.remove(fieldName); - - SdncOperation oper = maker.apply(params, config); - - assertThatIllegalArgumentException().isThrownBy(() -> Whitebox.invokeMethod(oper, "makeRequest", 1)) - .withMessageContaining("missing").withMessageContaining(expectedText); - } - - @Override - protected abstract Map makeEnrichment(); } diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java index e41ef3fec..3f087844b 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.List; -import java.util.Map; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -33,10 +32,8 @@ import org.junit.Test; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams; -import org.onap.policy.sdnc.SdncRequest; import org.onap.policy.sdnc.SdncResponse; public class RerouteOperationTest extends BasicSdncOperation { @@ -107,39 +104,9 @@ public class RerouteOperationTest extends BasicSdncOperation { @Test public void testMakeRequest() throws Exception { - oper.generateSubRequestId(1); - SdncRequest request = oper.makeRequest(1); - assertEquals(MY_SERVICE, request.getNsInstanceId()); - assertEquals(REQ_ID, request.getRequestId()); - assertEquals("/my-path/", request.getUrl()); - assertEquals(oper.getSubRequestId(), request.getHealRequest().getRequestHeaderInfo().getSvcRequestId()); - - verifyRequest("reroute.json", request, IGNORE_FIELDS); - - verifyMissing(RerouteOperation.SERVICE_ID_KEY, "service", RerouteOperation::new); - verifyMissing(RerouteOperation.NETWORK_ID_KEY, "network", RerouteOperation::new); - - // perform the operation - makeContext(); - verifyRequest("reroute.json", verifyOperation(oper), IGNORE_FIELDS); - } - - @Test - public void testMakeRequestViaProperties() throws Exception { - // clear the enrichment data and remake the operation - event.setAai(null); - context = new ControlLoopEventContext(event); - params = params.toBuilder().context(context).build(); - oper = new RerouteOperation(params, config); - oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE); oper.setProperty(OperationProperties.ENRICHMENT_NETWORK_ID, MY_NETWORK); verifyRequest("reroute.json", verifyOperation(oper), IGNORE_FIELDS); } - - @Override - protected Map makeEnrichment() { - return Map.of(RerouteOperation.SERVICE_ID_KEY, MY_SERVICE, RerouteOperation.NETWORK_ID_KEY, MY_NETWORK); - } } diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java index 4ba12c6ca..9055715b4 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java @@ -22,16 +22,11 @@ package org.onap.policy.controlloop.actor.sdnc; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.Collections; -import java.util.Map; -import java.util.TreeMap; import org.junit.Before; import org.junit.Test; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.sdnc.SdncHealRequest; import org.onap.policy.sdnc.SdncHealRequestHeaderInfo; import org.onap.policy.sdnc.SdncRequest; @@ -74,11 +69,6 @@ public class SdncOperationTest extends BasicSdncOperation { assertEquals(DEFAULT_OPERATION, oper.getName()); } - @Test - public void testStartPreprocessorAsync() { - assertNotNull(oper.startPreprocessorAsync()); - } - @Test public void testStartOperationAsync_testStartRequestAsync() throws Exception { verifyOperation(oper); @@ -102,47 +92,4 @@ public class SdncOperationTest extends BasicSdncOperation { response.setResponseOutput(null); assertFalse(oper.isSuccess(null, response)); } - - @Test - public void testGetOptProperty() { - // in neither property nor enrichment - assertNull(oper.getOptProperty("propA", "propA2")); - - // both - should choose the property - remakeOper(Map.of("propB2", "valueB2")); - oper.setProperty("propB", "valueB"); - assertEquals("valueB", oper.getOptProperty("propB", "propB2")); - - // both - should choose the property, even if it's null - remakeOper(Map.of("propC2", "valueC2")); - oper.setProperty("propC", null); - assertNull(oper.getOptProperty("propC", "propC2")); - - // only in enrichment data - remakeOper(Map.of("propD2", "valueD2")); - assertEquals("valueD2", oper.getOptProperty("propD", "propD2")); - } - - /** - * Remakes the operation, with the specified A&AI enrichment data. - * - * @param aai A&AI enrichment data - */ - private void remakeOper(Map aai) { - event.setAai(aai); - context = new ControlLoopEventContext(event); - params = params.toBuilder().context(context).build(); - - oper = new SdncOperation(params, config, Collections.emptyList()) { - @Override - protected SdncRequest makeRequest(int attempt) { - return request; - } - }; - } - - @Override - protected Map makeEnrichment() { - return new TreeMap<>(); - } } diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java index 308ddd9bd..14f77a687 100644 --- a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java +++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java @@ -21,7 +21,6 @@ package org.onap.policy.controlloop.actor.sdnr; import java.util.List; -import java.util.concurrent.CompletableFuture; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; @@ -70,11 +69,6 @@ public class SdnrOperation extends BidirectionalTopicOperation startPreprocessorAsync() { - return startGuardAsync(); - } - /* * NOTE: This should avoid throwing exceptions, so that a ControlLoopResponse can be * added to the outcome. Consequently, it returns FAILURE if a required field is @@ -156,7 +150,7 @@ public class SdnrOperation extends BidirectionalTopicOperation { @@ -121,25 +117,6 @@ public abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperatio assertEquals(OperationResult.SUCCESS, outcome.getResult()); } - /** - * Verifies that an exception is thrown if a field is missing from the enrichment - * data. - * - * @param fieldName name of the field to be removed from the enrichment data - * @param expectedText text expected in the exception message - */ - protected void verifyMissing(String fieldName, String expectedText, - OperationMaker maker) { - - makeContext(); - enrichment.remove(fieldName); - - SdnrOperation oper = maker.apply(params, config); - - assertThatIllegalArgumentException().isThrownBy(() -> Whitebox.invokeMethod(oper, "makeRequest", 1)) - .withMessageContaining("missing").withMessageContaining(expectedText); - } - /** * Provides a response to the listener. * diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java index 90452a9af..3a8f0b7e1 100644 --- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java @@ -22,28 +22,20 @@ package org.onap.policy.controlloop.actor.sdnr; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.atomic.AtomicBoolean; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation.Status; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams; @@ -134,46 +126,13 @@ public class SdnrOperationTest extends BasicSdnrOperation { params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build(); - operation = new SdnrOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - return null; - } - }; + operation = new SdnrOperation(params, config); outcome = operation.start().get(); assertEquals(OperationResult.SUCCESS, outcome.getResult()); assertTrue(outcome.getResponse() instanceof PciMessage); } - @Test - public void testStartPreprocessorAsync() throws Exception { - final CompletableFuture future2 = new CompletableFuture<>(); - context = mock(ControlLoopEventContext.class); - when(context.getEvent()).thenReturn(event); - params = params.toBuilder().context(context).build(); - - AtomicBoolean guardStarted = new AtomicBoolean(); - - operation = new SdnrOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - guardStarted.set(true); - return super.startGuardAsync(); - } - }; - CompletableFuture future3 = operation.startPreprocessorAsync(); - - assertNotNull(future3); - assertFalse(future.isDone()); - assertTrue(guardStarted.get()); - - future2.complete(params.makeOutcome(null)); - assertTrue(executor.runAll(100)); - assertTrue(future3.isDone()); - assertEquals(OperationResult.SUCCESS, future3.get().getResult()); - } - @Test public void testDetmStatusStringResponse() { final org.onap.policy.sdnr.Status status = response.getBody().getOutput().getStatus(); @@ -236,24 +195,6 @@ public class SdnrOperationTest extends BasicSdnrOperation { checkOutcome(); } - @Test - public void testGetEventPayload() { - // in neither property nor event - assertNull(operation.getEventPayload()); - - // only in event - event.setPayload("valueA2"); - assertEquals("valueA2", operation.getEventPayload()); - - // both - should choose the property - operation.setProperty(OperationProperties.EVENT_PAYLOAD, "valueB"); - assertEquals("valueB", operation.getEventPayload()); - - // both - should choose the property, even if it's null - operation.setProperty(OperationProperties.EVENT_PAYLOAD, null); - assertNull(operation.getEventPayload()); - } - protected void checkOutcome() { assertSame(outcome, operation.setOutcome(outcome, OperationResult.SUCCESS, response)); assertEquals(OperationResult.SUCCESS, outcome.getResult()); diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java index ac25c841e..9020c0b35 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java @@ -29,8 +29,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.onap.aai.domain.yang.CloudRegion; @@ -38,8 +36,6 @@ import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ModelVer; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.Tenant; -import org.onap.policy.aai.AaiConstants; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.gson.GsonMessageBodyHandler; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; @@ -67,7 +63,6 @@ import org.onap.policy.so.util.SoLocalDateTimeTypeAdapter; public abstract class SoOperation extends HttpOperation { private static final Coder coder = new SoCoder(); - public static final String PAYLOAD_KEY_VF_COUNT = "vfCount"; public static final String FAILED = "FAILED"; public static final String COMPLETE = "COMPLETE"; public static final int SO_RESPONSE_CODE = 999; @@ -86,8 +81,6 @@ public abstract class SoOperation extends HttpOperation { private final String modelVersion; - private final String vfCountKey; - /** * Constructs the object. @@ -104,7 +97,6 @@ public abstract class SoOperation extends HttpOperation { this.modelVersionId = null; this.modelVersion = null; this.modelName = null; - this.vfCountKey = null; verifyNotNull("Target information", params.getTargetType()); } @@ -134,9 +126,6 @@ public abstract class SoOperation extends HttpOperation { this.modelName = targetEntityIds .get(ControlLoopOperationParams.PARAMS_ENTITY_MODEL_NAME); - this.vfCountKey = SoConstants.VF_COUNT_PREFIX + "[" + modelCustomizationId + "][" + modelInvariantId + "][" - + modelVersionId + "]"; - verifyNotNull("Target information", params.getTargetType()); } @@ -147,8 +136,8 @@ public abstract class SoOperation extends HttpOperation { } /** - * Validates that the parameters contain the required target information to extract - * the VF count from the custom query. + * Validates that the parameters contain the required target information to construct + * the request. */ protected void validateTarget() { verifyNotNull(ControlLoopOperationParams.PARAMS_ENTITY_MODEL_CUSTOMIZATION_ID, modelCustomizationId); @@ -158,69 +147,16 @@ public abstract class SoOperation extends HttpOperation { private void verifyNotNull(String type, Object value) { if (value == null) { - throw new IllegalArgumentException("missing " + type + " for guard payload"); + throw new IllegalArgumentException("missing Target." + type); } } - /** - * Starts the GUARD. - */ - @Override - protected CompletableFuture startPreprocessorAsync() { - return startGuardAsync(); - } - - /** - * Gets the VF Count. - * - * @return a future to cancel or await the VF Count - */ - @SuppressWarnings("unchecked") - protected CompletableFuture obtainVfCount() { - if (params.getContext().contains(vfCountKey)) { - // already have the VF count - return null; - } - - // need custom query from which to extract the VF count - ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) - .operation(AaiCqResponse.OPERATION).payload(null).retry(null).timeoutSec(null).build(); - - // run Custom Query and then extract the VF count - return sequence(() -> params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams), this::storeVfCount); - } - - /** - * Stores the VF count. - * - * @return {@code null} - */ - private CompletableFuture storeVfCount() { - if (!params.getContext().contains(vfCountKey)) { - AaiCqResponse cq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); - int vfcount = cq.getVfModuleCount(modelCustomizationId, modelInvariantId, modelVersionId); - - params.getContext().setProperty(vfCountKey, vfcount); - } - - return null; - } - protected int getVfCount() { - if (containsProperty(OperationProperties.DATA_VF_COUNT)) { - return getProperty(OperationProperties.DATA_VF_COUNT); - } - - return params.getContext().getProperty(vfCountKey); + return getRequiredProperty(OperationProperties.DATA_VF_COUNT, "VF Count"); } protected void setVfCount(int vfCount) { - if (containsProperty(OperationProperties.DATA_VF_COUNT)) { - setProperty(OperationProperties.DATA_VF_COUNT, vfCount); - return; - } - - params.getContext().setProperty(vfCountKey, vfCount); + setProperty(OperationProperties.DATA_VF_COUNT, vfCount); } @Override @@ -381,13 +317,12 @@ public abstract class SoOperation extends HttpOperation { } /** - * Construct cloudConfiguration for the SO requestDetails. Overridden for custom - * query. + * Construct cloudConfiguration for the SO requestDetails. * * @param tenantItem tenant item from A&AI named-query response * @return SO cloud configuration */ - protected SoCloudConfiguration constructCloudConfigurationCq(Tenant tenantItem, CloudRegion cloudRegionItem) { + protected SoCloudConfiguration constructCloudConfiguration(Tenant tenantItem, CloudRegion cloudRegionItem) { SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration(); cloudConfiguration.setTenantId(tenantItem.getTenantId()); cloudConfiguration.setLcpCloudRegionId(cloudRegionItem.getCloudRegionId()); @@ -405,77 +340,33 @@ public abstract class SoOperation extends HttpOperation { return headers; } - /** - * Gets an item from a property. If the property is not found, then it invokes the - * given function to retrieve it from the custom query data. If that fails as well, - * then an exception is thrown. - * - * @param propName property name - * @param getter method to extract the value from the custom query data - * @param errmsg error message to include in any exception - * @return the retrieved item - */ - protected T getItem(String propName, Function getter, String errmsg) { - if (containsProperty(propName)) { - return getProperty(propName); - } - - final AaiCqResponse aaiCqResponse = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); - T item = getter.apply(aaiCqResponse); - if (item == null) { - throw new IllegalArgumentException(errmsg); - } - - return item; - } - /* * These methods extract data from the Custom Query and throw an * IllegalArgumentException if the desired data item is not found. */ protected GenericVnf getVnfItem(SoModelInfo soModelInfo) { - // @formatter:off - return getItem(OperationProperties.AAI_VNF, - cq -> cq.getGenericVnfByVfModuleModelInvariantId(soModelInfo.getModelInvariantId()), - "missing generic VNF"); - // @formatter:on + return getRequiredProperty(OperationProperties.AAI_VNF, "generic VNF"); } protected ServiceInstance getServiceInstance() { - return getItem(OperationProperties.AAI_SERVICE, AaiCqResponse::getServiceInstance, "missing VNF Service Item"); + return getRequiredProperty(OperationProperties.AAI_SERVICE, "VNF Service Item"); } protected Tenant getDefaultTenant() { - // @formatter:off - return getItem(OperationProperties.AAI_DEFAULT_TENANT, - AaiCqResponse::getDefaultTenant, - "missing Default Tenant Item"); - // @formatter:on + return getRequiredProperty(OperationProperties.AAI_DEFAULT_TENANT, "Default Tenant Item"); } protected CloudRegion getDefaultCloudRegion() { - // @formatter:off - return getItem(OperationProperties.AAI_DEFAULT_CLOUD_REGION, - AaiCqResponse::getDefaultCloudRegion, - "missing Default Cloud Region"); - // @formatter:on + return getRequiredProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, "Default Cloud Region"); } - protected ModelVer getVnfModel(GenericVnf vnfItem) { - // @formatter:off - return getItem(OperationProperties.AAI_VNF_MODEL, - cq -> cq.getModelVerByVersionId(vnfItem.getModelVersionId()), - "missing generic VNF Model"); - // @formatter:on + protected ModelVer getVnfModel() { + return getRequiredProperty(OperationProperties.AAI_VNF_MODEL, "generic VNF Model"); } - protected ModelVer getServiceModel(ServiceInstance vnfServiceItem) { - // @formatter:off - return getItem(OperationProperties.AAI_SERVICE_MODEL, - cq -> cq.getModelVerByVersionId(vnfServiceItem.getModelVersionId()), - "missing Service Model"); - // @formatter:on + protected ModelVer getServiceModel() { + return getRequiredProperty(OperationProperties.AAI_SERVICE_MODEL, "Service Model"); } // these may be overridden by junit tests diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java index af06c9184..f5c860e11 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java @@ -33,8 +33,6 @@ import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ModelVer; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.Tenant; -import org.onap.policy.aai.AaiConstants; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -51,10 +49,8 @@ import org.onap.policy.so.SoRequestParameters; import org.onap.policy.so.SoResponse; /** - * Operation to create a VF Module. This gets the VF count from the A&AI Custom Query - * response and stores it in the context. It also passes the count+1 to the guard. Once - * the "create" completes successfully, it bumps the VF count that's stored in the - * context. + * Operation to create a VF Module. When this completes successfully, it increments its VF + * Count property. */ public class VfModuleCreate extends SoOperation { public static final String NAME = "VF Module Create"; @@ -86,38 +82,6 @@ public class VfModuleCreate extends SoOperation { validateTarget(); } - /** - * Ensures that A&AI custom query has been performed, and then runs the guard. - */ - @Override - @SuppressWarnings("unchecked") - protected CompletableFuture startPreprocessorAsync() { - if (params.isPreprocessed()) { - return null; - } - - // need the VF count - ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) - .operation(AaiCqResponse.OPERATION).payload(null).retry(null).timeoutSec(null).build(); - - // run Custom Query, extract the VF count, and then run the Guard - - // @formatter:off - return sequence(() -> params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams), - this::obtainVfCount, this::startGuardAsync); - // @formatter:on - } - - @Override - protected Map makeGuardPayload() { - Map payload = super.makeGuardPayload(); - - // run guard with the proposed vf count - payload.put(PAYLOAD_KEY_VF_COUNT, getVfCount() + 1); - - return payload; - } - @Override protected CompletableFuture startOperationAsync(int attempt, OperationOutcome outcome) { @@ -166,8 +130,8 @@ public class VfModuleCreate extends SoOperation { final ServiceInstance vnfServiceItem = getServiceInstance(); final Tenant tenantItem = getDefaultTenant(); final CloudRegion cloudRegionItem = getDefaultCloudRegion(); - final ModelVer vnfModel = getVnfModel(vnfItem); - final ModelVer vnfServiceModel = getServiceModel(vnfServiceItem); + final ModelVer vnfModel = getVnfModel(); + final ModelVer vnfServiceModel = getServiceModel(); SoRequest request = new SoRequest(); request.setOperationType(SoOperationType.SCALE_OUT); @@ -181,7 +145,7 @@ public class VfModuleCreate extends SoOperation { request.getRequestDetails().getRequestParameters().setUserParams(null); // cloudConfiguration - request.getRequestDetails().setCloudConfiguration(constructCloudConfigurationCq(tenantItem, cloudRegionItem)); + request.getRequestDetails().setCloudConfiguration(constructCloudConfiguration(tenantItem, cloudRegionItem)); // modelInfo request.getRequestDetails().setModelInfo(soModelInfo); diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java index f35cdb4e1..9adb62c83 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java @@ -42,8 +42,6 @@ import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.Tenant; -import org.onap.policy.aai.AaiConstants; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; @@ -59,10 +57,8 @@ import org.onap.policy.so.SoRequestDetails; import org.onap.policy.so.SoResponse; /** - * Operation to delete a VF Module. This gets the VF count from the A&AI Custom Query - * response and stores it in the context. It also passes the count-1 to the guard. Once - * the "delete" completes successfully, it decrements the VF count that's stored in the - * context. + * Operation to delete a VF Module. When this completes successfully, it decrements its VF + * Count property. */ public class VfModuleDelete extends SoOperation { public static final String NAME = "VF Module Delete"; @@ -93,38 +89,6 @@ public class VfModuleDelete extends SoOperation { validateTarget(); } - /** - * Ensures that A&AI custom query has been performed, and then runs the guard. - */ - @Override - @SuppressWarnings("unchecked") - protected CompletableFuture startPreprocessorAsync() { - if (params.isPreprocessed()) { - return null; - } - - // need the VF count - ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) - .operation(AaiCqResponse.OPERATION).payload(null).retry(null).timeoutSec(null).build(); - - // run Custom Query, extract the VF count, and then run the Guard - - // @formatter:off - return sequence(() -> params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams), - this::obtainVfCount, this::startGuardAsync); - // @formatter:on - } - - @Override - protected Map makeGuardPayload() { - Map payload = super.makeGuardPayload(); - - // run guard with the proposed vf count - payload.put(PAYLOAD_KEY_VF_COUNT, getVfCount() - 1); - - return payload; - } - @Override protected CompletableFuture startOperationAsync(int attempt, OperationOutcome outcome) { @@ -261,7 +225,7 @@ public class VfModuleDelete extends SoOperation { details.setConfigurationParameters(null); // cloudConfiguration - details.setCloudConfiguration(constructCloudConfigurationCq(tenantItem, cloudRegionItem)); + details.setCloudConfiguration(constructCloudConfiguration(tenantItem, cloudRegionItem)); // modelInfo details.setModelInfo(soModelInfo); diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java index d2e2872d5..4b05daa23 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java @@ -20,7 +20,6 @@ package org.onap.policy.controlloop.actor.so; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.util.Collections; @@ -29,7 +28,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import org.mockito.Mock; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; @@ -174,9 +172,4 @@ public abstract class BasicSoOperation extends BasicHttpOperation { return payload; } - - protected AaiCqResponse makeCqResponse() { - when(cqResponse.getVfModuleCount(any(), any(), any())).thenReturn(VF_COUNT); - return cqResponse; - } } diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java index e9a49545e..6f4ac0ed3 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java @@ -24,12 +24,10 @@ package org.onap.policy.controlloop.actor.so; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.time.LocalDateTime; @@ -37,22 +35,11 @@ import java.time.Month; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.function.BiConsumer; -import java.util.function.Supplier; import org.junit.Before; import org.junit.Test; -import org.onap.aai.domain.yang.CloudRegion; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.ModelVer; -import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.aai.domain.yang.Tenant; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.ControlLoopOperation; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; -import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.so.SoModelInfo; @@ -63,13 +50,8 @@ import org.onap.policy.so.SoResponse; public class SoOperationTest extends BasicSoOperation { - private static final String VF_COUNT_KEY = SoConstants.VF_COUNT_PREFIX - + "[my-model-customization-id][my-model-invariant-id][my-model-version-id]"; - private static final List PROP_NAMES = Collections.emptyList(); - private static final String VERSION_ID = "1.2.3"; - private SoOperation oper; /** @@ -119,77 +101,6 @@ public class SoOperationTest extends BasicSoOperation { targetEntities.put(expectedText, originalValue); } - @Test - public void testStartPreprocessorAsync() { - assertNotNull(oper.startPreprocessorAsync()); - } - - @Test - public void testObtainVfCount_testGetVfCount_testSetVfCount() throws Exception { - // insert CQ data so it's there for the check - context.setProperty(AaiCqResponse.CONTEXT_KEY, makeCqResponse()); - - // shouldn't actually need to do anything - assertNull(oper.obtainVfCount()); - - // verify that the count was stored - Integer vfcount = context.getProperty(VF_COUNT_KEY); - assertEquals(VF_COUNT, vfcount); - assertEquals(VF_COUNT.intValue(), oper.getVfCount()); - - // change the count and then verify that it isn't overwritten by another call - oper.setVfCount(VF_COUNT + 1); - - assertNull(oper.obtainVfCount()); - vfcount = context.getProperty(VF_COUNT_KEY); - assertEquals(VF_COUNT + 1, vfcount.intValue()); - assertEquals(VF_COUNT + 1, oper.getVfCount()); - } - - /** - * Tests the VF Count methods when properties are being used. - * @throws Exception if an error occurs - */ - @Test - public void testGetVfCount_testSetVfCount_ViaProperties() throws Exception { - oper.setProperty(OperationProperties.DATA_VF_COUNT, VF_COUNT); - - // verify that the count was stored - assertEquals(VF_COUNT.intValue(), oper.getVfCount()); - - oper.setVfCount(VF_COUNT + 1); - - int count = oper.getProperty(OperationProperties.DATA_VF_COUNT); - assertEquals(VF_COUNT + 1, count); - assertEquals(VF_COUNT + 1, oper.getVfCount()); - } - - /** - * Tests obtainVfCount() when it actually has to query. - */ - @Test - public void testObtainVfCountQuery() throws Exception { - CompletableFuture future2 = oper.obtainVfCount(); - assertNotNull(future2); - assertTrue(executor.runAll(100)); - - // not done yet - assertFalse(future2.isDone()); - - provideCqResponse(makeCqResponse()); - - assertTrue(executor.runAll(100)); - assertTrue(future2.isDone()); - assertEquals(OperationResult.SUCCESS, future2.get().getResult()); - - // verify that the count was stored - Integer vfcount = context.getProperty(VF_COUNT_KEY); - assertEquals(VF_COUNT, vfcount); - - // repeat - shouldn't need to do anything now - assertNull(oper.obtainVfCount()); - } - @Test public void testGetRequestState() { SoResponse resp = new SoResponse(); @@ -294,117 +205,6 @@ public class SoOperationTest extends BasicSoOperation { assertTrue(oper.buildConfigurationParameters().isEmpty()); } - @Test - public void testGetItem() { - AaiCqResponse cq = mock(AaiCqResponse.class); - params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, cq); - - // in neither property nor custom query - assertThatIllegalArgumentException().isThrownBy(() -> oper.getItem("propA", cq2 -> null, "not found")) - .withMessage("not found"); - - // only in custom query - assertEquals("valueB", oper.getItem("propB", cq2 -> "valueB", "failureB")); - - // both - should choose the property - oper.setProperty("propC", "valueC"); - assertEquals("valueC", oper.getItem("propC", cq2 -> "valueC2", "failureC")); - - // both - should choose the property, even if it's null - oper.setProperty("propD", null); - assertNull(oper.getItem("propD", cq2 -> "valueD2", "failureD")); - } - - @Test - public void testGetVnfItem() { - // @formatter:off - verifyItems(OperationProperties.AAI_VNF, GenericVnf::new, - (cq, instance) -> when(cq.getGenericVnfByVfModuleModelInvariantId(MODEL_INVAR_ID)).thenReturn(instance), - () -> oper.getVnfItem(oper.prepareSoModelInfo()), - "missing generic VNF"); - // @formatter:on - } - - @Test - public void testGetServiceInstance() { - // @formatter:off - verifyItems(OperationProperties.AAI_SERVICE, ServiceInstance::new, - (cq, instance) -> when(cq.getServiceInstance()).thenReturn(instance), - () -> oper.getServiceInstance(), - "missing VNF Service Item"); - // @formatter:on - } - - @Test - public void testGetDefaultTenant() { - // @formatter:off - verifyItems(OperationProperties.AAI_DEFAULT_TENANT, Tenant::new, - (cq, tenant) -> when(cq.getDefaultTenant()).thenReturn(tenant), - () -> oper.getDefaultTenant(), - "missing Default Tenant Item"); - // @formatter:on - } - - @Test - public void testGetVnfModel() { - GenericVnf vnf = new GenericVnf(); - vnf.setModelVersionId(VERSION_ID); - - // @formatter:off - verifyItems(OperationProperties.AAI_VNF_MODEL, ModelVer::new, - (cq, model) -> when(cq.getModelVerByVersionId(VERSION_ID)).thenReturn(model), - () -> oper.getVnfModel(vnf), - "missing generic VNF Model"); - // @formatter:on - } - - @Test - public void testGetServiceModel() { - ServiceInstance service = new ServiceInstance(); - service.setModelVersionId(VERSION_ID); - - // @formatter:off - verifyItems(OperationProperties.AAI_SERVICE_MODEL, ModelVer::new, - (cq, model) -> when(cq.getModelVerByVersionId(VERSION_ID)).thenReturn(model), - () -> oper.getServiceModel(service), - "missing Service Model"); - // @formatter:on - } - - @Test - public void testGetDefaultCloudRegion() { - // @formatter:off - verifyItems(OperationProperties.AAI_DEFAULT_CLOUD_REGION, CloudRegion::new, - (cq, region) -> when(cq.getDefaultCloudRegion()).thenReturn(region), - () -> oper.getDefaultCloudRegion(), - "missing Default Cloud Region"); - // @formatter:on - } - - private void verifyItems(String propName, Supplier maker, BiConsumer setter, - Supplier getter, String errmsg) { - - AaiCqResponse cq = mock(AaiCqResponse.class); - params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, cq); - - // in neither property nor custom query - assertThatIllegalArgumentException().isThrownBy(getter::get).withMessage(errmsg); - - // only in custom query - final T item1 = maker.get(); - setter.accept(cq, item1); - assertSame(item1, getter.get()); - - // both - should choose the property - final T item2 = maker.get(); - oper.setProperty(propName, item2); - assertSame(item2, getter.get()); - - // both - should choose the property, even if it's null - oper.setProperty(propName, null); - assertNull(getter.get()); - } - @Test public void testGetCoder() throws CoderException { Coder opcoder = oper.getCoder(); diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java index 9d4d00908..8dca7c844 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java @@ -24,39 +24,30 @@ package org.onap.policy.controlloop.actor.so; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.List; -import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.lang3.tuple.Pair; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.mockito.ArgumentCaptor; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ModelVer; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.Tenant; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams; import org.onap.policy.so.SoRequest; @@ -86,11 +77,15 @@ public class VfModuleCreateTest extends BasicSoOperation { destroyAfterClass(); } - @Override + /** + * Sets up. + */ @Before + @Override public void setUp() throws Exception { super.setUp(); oper = new VfModuleCreate(params, config); + loadProperties(); } /** @@ -103,50 +98,11 @@ public class VfModuleCreateTest extends BasicSoOperation { .maxPolls(2).build(); config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); - params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build(); - - oper = new VfModuleCreate(params, config); - - outcome = oper.start().get(); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof SoResponse); - } - - /** - * Tests "success" case with simulator, using properties instead of custom query data. - */ - @Test - public void testSuccessViaProperties() throws Exception { - HttpPollingParams opParams = HttpPollingParams.builder().clientName(MY_CLIENT) - .path("serviceInstantiation/v7/serviceInstances").pollPath("orchestrationRequests/v5/") - .maxPolls(2).build(); - config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); - params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build(); - params.getContext().removeProperty(AaiCqResponse.CONTEXT_KEY); oper = new VfModuleCreate(params, config); - // set the properties - ServiceInstance instance = new ServiceInstance(); - instance.setServiceInstanceId(SVC_INSTANCE_ID); - oper.setProperty(OperationProperties.AAI_SERVICE, instance); - - ModelVer modelVers = new ModelVer(); - modelVers.setModelName(MODEL_NAME2); - modelVers.setModelVersion(MODEL_VERS2); - - oper.setProperty(OperationProperties.AAI_SERVICE_MODEL, modelVers); - oper.setProperty(OperationProperties.AAI_VNF_MODEL, modelVers); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId(VNF_ID); - oper.setProperty(OperationProperties.AAI_VNF, vnf); - - oper.setProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, new CloudRegion()); - oper.setProperty(OperationProperties.AAI_DEFAULT_TENANT, new Tenant()); - - oper.setProperty(OperationProperties.DATA_VF_COUNT, VF_COUNT); + loadProperties(); // run the operation outcome = oper.start().get(); @@ -184,76 +140,8 @@ public class VfModuleCreateTest extends BasicSoOperation { // @formatter:on } - @Test - public void testStartPreprocessorAsync() throws Exception { - // insert CQ data so it's there for the check - context.setProperty(AaiCqResponse.CONTEXT_KEY, makeCqResponse()); - - AtomicBoolean guardStarted = new AtomicBoolean(); - - oper = new VfModuleCreate(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - guardStarted.set(true); - return super.startGuardAsync(); - } - }; - - CompletableFuture future3 = oper.startPreprocessorAsync(); - assertNotNull(future3); - assertTrue(guardStarted.get()); - } - - /** - * Tests startPreprocessorAsync(), when preprocessing is disabled. - */ - @Test - public void testStartPreprocessorAsyncDisabled() { - params = params.toBuilder().preprocessed(true).build(); - assertNull(new VfModuleCreate(params, config).startPreprocessorAsync()); - } - - @Test - public void testStartGuardAsync() throws Exception { - // remove CQ data so it's forced to query - context.removeProperty(AaiCqResponse.CONTEXT_KEY); - - CompletableFuture future2 = oper.startPreprocessorAsync(); - assertTrue(executor.runAll(100)); - assertFalse(future2.isDone()); - - provideCqResponse(makeCqResponse()); - assertTrue(executor.runAll(100)); - assertTrue(future2.isDone()); - assertEquals(OperationResult.SUCCESS, future2.get().getResult()); - } - - @Test - public void testMakeGuardPayload() { - final int origCount = 30; - oper.setVfCount(origCount); - - CompletableFuture future2 = oper.startPreprocessorAsync(); - assertTrue(executor.runAll(100)); - assertTrue(future2.isDone()); - - // get the payload from the request - ArgumentCaptor captor = ArgumentCaptor.forClass(ControlLoopOperationParams.class); - verify(guardOperator).buildOperation(captor.capture()); - - Map payload = captor.getValue().getPayload(); - assertNotNull(payload); - - Integer newCount = (Integer) payload.get(VfModuleCreate.PAYLOAD_KEY_VF_COUNT); - assertNotNull(newCount); - assertEquals(origCount + 1, newCount.intValue()); - } - @Test public void testStartOperationAsync_testSuccessfulCompletion() throws Exception { - final int origCount = 30; - oper.setVfCount(origCount); - when(client.post(any(), any(), any(), any())).thenAnswer(provideResponse(rawResponse)); // use a real executor @@ -266,6 +154,11 @@ public class VfModuleCreateTest extends BasicSoOperation { } }; + loadProperties(); + + final int origCount = 30; + oper.setVfCount(origCount); + CompletableFuture future2 = oper.start(); outcome = future2.get(5, TimeUnit.SECONDS); @@ -298,6 +191,8 @@ public class VfModuleCreateTest extends BasicSoOperation { } }; + loadProperties(); + CompletableFuture future2 = oper.start(); outcome = future2.get(5, TimeUnit.SECONDS); @@ -317,29 +212,26 @@ public class VfModuleCreateTest extends BasicSoOperation { verifyRequest("vfModuleCreate.json", pair.getRight()); } - - @Override - protected void makeContext() { - super.makeContext(); - - AaiCqResponse cq = mock(AaiCqResponse.class); - - GenericVnf vnf = new GenericVnf(); - when(cq.getGenericVnfByVfModuleModelInvariantId(MODEL_INVAR_ID)).thenReturn(vnf); - vnf.setVnfId(VNF_ID); - + private void loadProperties() { + // set the properties ServiceInstance instance = new ServiceInstance(); - when(cq.getServiceInstance()).thenReturn(instance); instance.setServiceInstanceId(SVC_INSTANCE_ID); - - when(cq.getDefaultTenant()).thenReturn(new Tenant()); - when(cq.getDefaultCloudRegion()).thenReturn(new CloudRegion()); + oper.setProperty(OperationProperties.AAI_SERVICE, instance); ModelVer modelVers = new ModelVer(); - when(cq.getModelVerByVersionId(any())).thenReturn(modelVers); modelVers.setModelName(MODEL_NAME2); modelVers.setModelVersion(MODEL_VERS2); - params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, cq); + oper.setProperty(OperationProperties.AAI_SERVICE_MODEL, modelVers); + oper.setProperty(OperationProperties.AAI_VNF_MODEL, modelVers); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId(VNF_ID); + oper.setProperty(OperationProperties.AAI_VNF, vnf); + + oper.setProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, new CloudRegion()); + oper.setProperty(OperationProperties.AAI_DEFAULT_TENANT, new Tenant()); + + oper.setProperty(OperationProperties.DATA_VF_COUNT, VF_COUNT); } } diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java index 300d73b53..3bce9b0f8 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java @@ -24,9 +24,7 @@ package org.onap.policy.controlloop.actor.so; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; @@ -47,7 +45,6 @@ import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import javax.ws.rs.client.InvocationCallback; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -60,10 +57,8 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.ModelVer; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.Tenant; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -77,8 +72,6 @@ import org.onap.policy.so.SoResponse; public class VfModuleDeleteTest extends BasicSoOperation { private static final String EXPECTED_EXCEPTION = "expected exception"; - private static final String MODEL_NAME2 = "my-model-name-B"; - private static final String MODEL_VERS2 = "my-model-version-B"; private static final String SVC_INSTANCE_ID = "my-service-instance-id"; private static final String VNF_ID = "my-vnf-id"; @@ -119,6 +112,8 @@ public class VfModuleDeleteTest extends BasicSoOperation { configureResponse(coder.encode(response)); oper = new MyOperation(params, config); + + loadProperties(); } /** @@ -130,42 +125,11 @@ public class VfModuleDeleteTest extends BasicSoOperation { .pollPath("orchestrationRequests/v5/").maxPolls(2).build(); config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); - params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build(); - - oper = new VfModuleDelete(params, config); - - outcome = oper.start().get(); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof SoResponse); - } - - /** - * Tests "success" case with simulator, using properties instead of custom query data. - */ - @Test - public void testSuccessViaProperties() throws Exception { - HttpPollingParams opParams = HttpPollingParams.builder().clientName(MY_CLIENT).path("serviceInstances/v7") - .pollPath("orchestrationRequests/v5/").maxPolls(2).build(); - config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); - params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build(); - params.getContext().removeProperty(AaiCqResponse.CONTEXT_KEY); oper = new VfModuleDelete(params, config); - // set the properties - ServiceInstance instance = new ServiceInstance(); - instance.setServiceInstanceId(SVC_INSTANCE_ID); - oper.setProperty(OperationProperties.AAI_SERVICE, instance); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId(VNF_ID); - oper.setProperty(OperationProperties.AAI_VNF, vnf); - - oper.setProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, new CloudRegion()); - oper.setProperty(OperationProperties.AAI_DEFAULT_TENANT, new Tenant()); - - oper.setProperty(OperationProperties.DATA_VF_COUNT, VF_COUNT); + loadProperties(); // run the operation outcome = oper.start().get(); @@ -201,76 +165,8 @@ public class VfModuleDeleteTest extends BasicSoOperation { // @formatter:on } - @Test - public void testStartPreprocessorAsync() throws Exception { - // insert CQ data so it's there for the check - context.setProperty(AaiCqResponse.CONTEXT_KEY, makeCqResponse()); - - AtomicBoolean guardStarted = new AtomicBoolean(); - - oper = new MyOperation(params, config) { - @Override - protected CompletableFuture startGuardAsync() { - guardStarted.set(true); - return super.startGuardAsync(); - } - }; - - CompletableFuture future3 = oper.startPreprocessorAsync(); - assertNotNull(future3); - assertTrue(guardStarted.get()); - } - - /** - * Tests startPreprocessorAsync(), when preprocessing is disabled. - */ - @Test - public void testStartPreprocessorAsyncDisabled() { - params = params.toBuilder().preprocessed(true).build(); - assertNull(new MyOperation(params, config).startPreprocessorAsync()); - } - - @Test - public void testStartGuardAsync() throws Exception { - // remove CQ data so it's forced to query - context.removeProperty(AaiCqResponse.CONTEXT_KEY); - - CompletableFuture future2 = oper.startPreprocessorAsync(); - assertTrue(executor.runAll(100)); - assertFalse(future2.isDone()); - - provideCqResponse(makeCqResponse()); - assertTrue(executor.runAll(100)); - assertTrue(future2.isDone()); - assertEquals(OperationResult.SUCCESS, future2.get().getResult()); - } - - @Test - public void testMakeGuardPayload() { - final int origCount = 30; - oper.setVfCount(origCount); - - CompletableFuture future2 = oper.startPreprocessorAsync(); - assertTrue(executor.runAll(100)); - assertTrue(future2.isDone()); - - // get the payload from the request - ArgumentCaptor captor = ArgumentCaptor.forClass(ControlLoopOperationParams.class); - verify(guardOperator).buildOperation(captor.capture()); - - Map payload = captor.getValue().getPayload(); - assertNotNull(payload); - - Integer newCount = (Integer) payload.get(VfModuleDelete.PAYLOAD_KEY_VF_COUNT); - assertNotNull(newCount); - assertEquals(origCount - 1, newCount.intValue()); - } - @Test public void testStartOperationAsync_testSuccessfulCompletion() throws Exception { - final int origCount = 30; - oper.setVfCount(origCount); - // use a real executor params = params.toBuilder().executor(ForkJoinPool.commonPool()).build(); @@ -281,6 +177,11 @@ public class VfModuleDeleteTest extends BasicSoOperation { } }; + loadProperties(); + + final int origCount = 30; + oper.setVfCount(origCount); + CompletableFuture future2 = oper.start(); outcome = future2.get(5, TimeUnit.SECONDS); @@ -315,6 +216,8 @@ public class VfModuleDeleteTest extends BasicSoOperation { } }; + loadProperties(); + CompletableFuture future2 = oper.start(); outcome = future2.get(5, TimeUnit.SECONDS); @@ -454,32 +357,6 @@ public class VfModuleDeleteTest extends BasicSoOperation { assertNotNull(new MyOperation(params, config).makeHttpClient()); } - - @Override - protected void makeContext() { - super.makeContext(); - - AaiCqResponse cq = mock(AaiCqResponse.class); - - GenericVnf vnf = new GenericVnf(); - when(cq.getGenericVnfByVfModuleModelInvariantId(MODEL_INVAR_ID)).thenReturn(vnf); - vnf.setVnfId(VNF_ID); - - ServiceInstance instance = new ServiceInstance(); - when(cq.getServiceInstance()).thenReturn(instance); - instance.setServiceInstanceId(SVC_INSTANCE_ID); - - when(cq.getDefaultTenant()).thenReturn(new Tenant()); - when(cq.getDefaultCloudRegion()).thenReturn(new CloudRegion()); - - ModelVer modelVers = new ModelVer(); - when(cq.getModelVerByVersionId(any())).thenReturn(modelVers); - modelVers.setModelName(MODEL_NAME2); - modelVers.setModelVersion(MODEL_VERS2); - - params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, cq); - } - private void initHostPort() { when(client.getBaseUrl()).thenReturn("http://my-host:6969/"); } @@ -505,4 +382,20 @@ public class VfModuleDeleteTest extends BasicSoOperation { return javaClient; } } + + private void loadProperties() { + // set the properties + ServiceInstance instance = new ServiceInstance(); + instance.setServiceInstanceId(SVC_INSTANCE_ID); + oper.setProperty(OperationProperties.AAI_SERVICE, instance); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId(VNF_ID); + oper.setProperty(OperationProperties.AAI_VNF, vnf); + + oper.setProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, new CloudRegion()); + oper.setProperty(OperationProperties.AAI_DEFAULT_TENANT, new Tenant()); + + oper.setProperty(OperationProperties.DATA_VF_COUNT, VF_COUNT); + } } diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseFull.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseFull.json deleted file mode 100644 index 1aa914422..000000000 --- a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseFull.json +++ /dev/null @@ -1,3870 +0,0 @@ -{ - "results": [ - { - "vserver": { - "vserver-id": "f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "vserver-name": "Ete_vFWCLvFWSNK_7ba1fbde_0", - "vserver-name2": "Ete_vFWCLvFWSNK_7ba1fbde_0", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556725250281", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/Ete_vFWCLvFWSNK_7ba1fbde_0", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/f17face5-69cb-4c88-9e0b-7426db7edddd", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "f17face5-69cb-4c88-9e0b-7426db7edddd" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/f17face5-69cb-4c88-9e0b-7426db7edddd/vf-modules/vf-module/a6936a82-e340-4fe2-8e3e-b0a10a0001e2", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "f17face5-69cb-4c88-9e0b-7426db7edddd" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "a6936a82-e340-4fe2-8e3e-b0a10a0001e2" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - }, - "l-interfaces": { - "l-interface": [ - { - "interface-name": "Vfmodule_Ete_vFWCLvFWSNK_7ba1fbde_0-vfw_0_int_unprotected_private_port_0-u2lkra6bpz7l", - "interface-id": "bd621b3f-da40-4a8a-a703-3db290295cd9", - "macaddr": "fa:16:3e:0c:27:e4", - "network-name": "4e291560-92f8-4822-9dcf-dd75c04c9617", - "is-port-mirrored": false, - "resource-version": "1556725250653", - "in-maint": false, - "is-ip-unnumbered": false - }, - { - "interface-name": "Vfmodule_Ete_vFWCLvFWSNK_7ba1fbde_0-vfw_0_onap_private_port_0-nfvykwarrnxr", - "interface-id": "86bbce7d-51ba-4ad2-a34a-aa2742f9789f", - "macaddr": "fa:16:3e:39:d9:27", - "network-name": "3ef9d123-0d09-4400-8ed0-c0fd5c76aa2b", - "is-port-mirrored": false, - "resource-version": "1556725250531", - "in-maint": false, - "is-ip-unnumbered": false - }, - { - "interface-name": "Vfmodule_Ete_vFWCLvFWSNK_7ba1fbde_0-vfw_0_int_protected_private_port_0-bz3hsoxjcgyw", - "interface-id": "b1a8a573-d70d-4b32-b717-21fd6bb549a6", - "macaddr": "fa:16:3e:95:1d:e9", - "network-name": "47cae58a-b052-4f73-8f42-e154c260d5df", - "is-port-mirrored": false, - "resource-version": "1556725250584", - "in-maint": false, - "is-ip-unnumbered": false - } - ] - } - } - }, - { - "generic-vnf": { - "vnf-id": "f17face5-69cb-4c88-9e0b-7426db7edddd", - "vnf-name": "Ete_vFWCLvFWSNK_7ba1fbde_0", - "vnf-type": "vFWCL 2019-05-01 15:30:/vFWCL_vFWSNK bbefb8ce-2bde 0", - "service-id": "e591441a-e649-4490-82e0-07dac05d674b", - "prov-status": "ACTIVE", - "orchestration-status": "Active", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556725242259", - "model-invariant-id": "bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38", - "model-version-id": "189a5070-3bd5-45ac-8a1d-c84ca40b277b", - "model-customization-id": "f3733725-19a1-41a0-ba2d-540bf03862a8", - "relationship-list": { - "relationship": [ - { - "related-to": "service-instance", - "relationship-label": "org.onap.relationships.inventory.ComposedOf", - "related-link": "/aai/v15/business/customers/customer/DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/7be584e2-0bb2-4126-adaf-ced2c77ca0b3", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - }, - { - "relationship-key": "service-instance.service-instance-id", - "relationship-value": "7be584e2-0bb2-4126-adaf-ced2c77ca0b3" - } - ], - "related-to-property": [ - { - "property-key": "service-instance.service-instance-name", - "property-value": "Service_Ete_Name7ba1fbde-6187-464a-a62d-d9dd25bdf4e8" - } - ] - }, - { - "related-to": "platform", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/platforms/platform/Platform-Demonstration", - "relationship-data": [ - { - "relationship-key": "platform.platform-name", - "relationship-value": "Platform-Demonstration" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/b75ccb62-131b-4e76-adad-28636fc60fb8", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "b75ccb62-131b-4e76-adad-28636fc60fb8" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01snkfbde" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "f953c499-4b1e-426b-8c6d-e9e9f1fc730f" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - } - ] - }, - "vf-modules": { - "vf-module": [ - { - "vf-module-id": "a6936a82-e340-4fe2-8e3e-b0a10a0001e2", - "vf-module-name": "Vfmodule_Ete_vFWCLvFWSNK_7ba1fbde_0", - "heat-stack-id": "Vfmodule_Ete_vFWCLvFWSNK_7ba1fbde_0/6769f192-0579-4dab-b4e7-170d334c37dd", - "orchestration-status": "active", - "is-base-vf-module": true, - "automated-assignment": false, - "resource-version": "1556725224323", - "model-invariant-id": "e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e", - "model-version-id": "94b18b1d-cc91-4f43-911a-e6348665f292", - "model-customization-id": "47958575-138f-452a-8c8d-d89b595f8164", - "module-index": 0, - "relationship-list": { - "relationship": [ - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/b75ccb62-131b-4e76-adad-28636fc60fb8", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "b75ccb62-131b-4e76-adad-28636fc60fb8" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01snkfbde" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "f953c499-4b1e-426b-8c6d-e9e9f1fc730f" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - } - ] - } - } - ] - } - } - }, - { - "model-ver": { - "model-version-id": "189a5070-3bd5-45ac-8a1d-c84ca40b277b", - "model-name": "vFWCL_vFWSNK bbefb8ce-2bde", - "model-version": "2.0", - "model-description": "vendor software product", - "resource-version": "1556724755172", - "model-elements": { - "model-element": [ - { - "model-element-uuid": "d4dd3710-eb91-4b15-98d7-a8a90fa28f1b", - "new-data-del-flag": "T", - "cardinality": "unbounded", - "resource-version": "1556724755172", - "relationship-list": { - "relationship": [ - { - "related-to": "model-ver", - "relationship-label": "org.onap.relationships.inventory.IsA", - "related-link": "/aai/v15/service-design-and-creation/models/model/acc6edd8-a8d4-4b93-afaa-0994068be14c/model-vers/model-ver/93a6166f-b3d5-4f06-b4ba-aed48d009ad9", - "relationship-data": [ - { - "relationship-key": "model.model-invariant-id", - "relationship-value": "acc6edd8-a8d4-4b93-afaa-0994068be14c" - }, - { - "relationship-key": "model-ver.model-version-id", - "relationship-value": "93a6166f-b3d5-4f06-b4ba-aed48d009ad9" - } - ], - "related-to-property": [ - { - "property-key": "model-ver.model-name", - "property-value": "generic-vnf" - } - ] - } - ] - } - } - ] - }, - "relationship-list": { - "relationship": [ - { - "related-to": "model-element", - "relationship-label": "org.onap.relationships.inventory.IsA", - "related-link": "/aai/v15/service-design-and-creation/models/model/f6937c86-584c-47ae-ad29-8d41d6f0cc7c/model-vers/model-ver/a03b1102-ac3b-44dd-8862-9b94f1951040/model-elements/model-element/aa23fd76-27cf-4dbe-85c7-dca15bec5ca6/model-elements/model-element/f837e297-a5e8-45d8-9ee8-2a1b436dbddb", - "relationship-data": [ - { - "relationship-key": "model.model-invariant-id", - "relationship-value": "f6937c86-584c-47ae-ad29-8d41d6f0cc7c" - }, - { - "relationship-key": "model-ver.model-version-id", - "relationship-value": "a03b1102-ac3b-44dd-8862-9b94f1951040" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "aa23fd76-27cf-4dbe-85c7-dca15bec5ca6" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "f837e297-a5e8-45d8-9ee8-2a1b436dbddb" - } - ] - } - ] - } - } - }, - { - "model": { - "model-invariant-id": "bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38", - "model-type": "resource", - "resource-version": "1556724755172", - "model-vers": { - "model-ver": [ - { - "model-version-id": "189a5070-3bd5-45ac-8a1d-c84ca40b277b", - "model-name": "vFWCL_vFWSNK bbefb8ce-2bde", - "model-version": "1.0", - "model-description": "vendor software product", - "resource-version": "1556724755172", - "relationship-list": { - "relationship": [ - { - "related-to": "model-element", - "relationship-label": "org.onap.relationships.inventory.IsA", - "related-link": "/aai/v15/service-design-and-creation/models/model/f6937c86-584c-47ae-ad29-8d41d6f0cc7c/model-vers/model-ver/a03b1102-ac3b-44dd-8862-9b94f1951040/model-elements/model-element/aa23fd76-27cf-4dbe-85c7-dca15bec5ca6/model-elements/model-element/f837e297-a5e8-45d8-9ee8-2a1b436dbddb", - "relationship-data": [ - { - "relationship-key": "model.model-invariant-id", - "relationship-value": "f6937c86-584c-47ae-ad29-8d41d6f0cc7c" - }, - { - "relationship-key": "model-ver.model-version-id", - "relationship-value": "a03b1102-ac3b-44dd-8862-9b94f1951040" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "aa23fd76-27cf-4dbe-85c7-dca15bec5ca6" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "f837e297-a5e8-45d8-9ee8-2a1b436dbddb" - } - ] - } - ] - } - } - ] - } - } - }, - { - "service-instance": { - "service-instance-id": "7be584e2-0bb2-4126-adaf-ced2c77ca0b3", - "service-instance-name": "Service_Ete_Name7ba1fbde-6187-464a-a62d-d9dd25bdf4e8", - "environment-context": "General_Revenue-Bearing", - "workload-context": "Production", - "model-invariant-id": "f6937c86-584c-47ae-ad29-8d41d6f0cc7c", - "model-version-id": "a03b1102-ac3b-44dd-8862-9b94f1951040", - "resource-version": "1556725033469", - "orchestration-status": "Active", - "relationship-list": { - "relationship": [ - { - "related-to": "project", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/projects/project/Project-Demonstration", - "relationship-data": [ - { - "relationship-key": "project.project-name", - "relationship-value": "Project-Demonstration" - } - ] - }, - { - "related-to": "owning-entity", - "relationship-label": "org.onap.relationships.inventory.BelongsTo", - "related-link": "/aai/v15/business/owning-entities/owning-entity/fcc64127-06ba-4761-b325-c681f636ad07", - "relationship-data": [ - { - "relationship-key": "owning-entity.owning-entity-id", - "relationship-value": "fcc64127-06ba-4761-b325-c681f636ad07" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "org.onap.relationships.inventory.ComposedOf", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9cd7da50-723c-418c-a91d-af2866844a5d", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9cd7da50-723c-418c-a91d-af2866844a5d" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvPKG_7ba1fbde_1" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "org.onap.relationships.inventory.ComposedOf", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/f17face5-69cb-4c88-9e0b-7426db7edddd", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "f17face5-69cb-4c88-9e0b-7426db7edddd" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - } - ] - } - } - }, - { - "model-ver": { - "model-version-id": "a03b1102-ac3b-44dd-8862-9b94f1951040", - "model-name": "vFWCL 2019-05-01 15:30:", - "model-version": "1.0", - "distribution-status": "DISTRIBUTION_COMPLETE_OK", - "model-description": "catalog service description", - "resource-version": "1556724849102", - "model-elements": { - "model-element": [ - { - "model-element-uuid": "aa23fd76-27cf-4dbe-85c7-dca15bec5ca6", - "new-data-del-flag": "T", - "cardinality": "unbounded", - "resource-version": "1556724755319", - "relationship-list": { - "relationship": [ - { - "related-to": "model-ver", - "relationship-label": "org.onap.relationships.inventory.IsA", - "related-link": "/aai/v15/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9", - "relationship-data": [ - { - "relationship-key": "model.model-invariant-id", - "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4" - }, - { - "relationship-key": "model-ver.model-version-id", - "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9" - } - ], - "related-to-property": [ - { - "property-key": "model-ver.model-name", - "property-value": "service-instance" - } - ] - } - ] - } - } - ] - } - } - }, - { - "model": { - "model-invariant-id": "f6937c86-584c-47ae-ad29-8d41d6f0cc7c", - "model-type": "service", - "resource-version": "1556724755319", - "model-vers": { - "model-ver": [ - { - "model-version-id": "a03b1102-ac3b-44dd-8862-9b94f1951040", - "model-name": "vFWCL 2019-05-01 15:30:", - "model-version": "1.0", - "distribution-status": "DISTRIBUTION_COMPLETE_OK", - "model-description": "catalog service description", - "resource-version": "1556724849102" - } - ] - } - } - }, - { - "generic-vnf": { - "vnf-id": "9cd7da50-723c-418c-a91d-af2866844a5d", - "vnf-name": "Ete_vFWCLvPKG_7ba1fbde_1", - "vnf-type": "vFWCL 2019-05-01 15:30:/vFWCL_vPKG 5101f6c6-8df3 0", - "service-id": "e591441a-e649-4490-82e0-07dac05d674b", - "prov-status": "ACTIVE", - "orchestration-status": "Active", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556725432402", - "model-invariant-id": "9a243c47-fd5f-43d1-bd2a-f17bd12a61f2", - "model-version-id": "8f79aa0f-da58-4381-9abf-0d6d1926a1eb", - "model-customization-id": "82dd9d05-e056-4c3e-a9b4-8a3d6bd54226", - "relationship-list": { - "relationship": [ - { - "related-to": "service-instance", - "relationship-label": "org.onap.relationships.inventory.ComposedOf", - "related-link": "/aai/v15/business/customers/customer/DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/7be584e2-0bb2-4126-adaf-ced2c77ca0b3", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - }, - { - "relationship-key": "service-instance.service-instance-id", - "relationship-value": "7be584e2-0bb2-4126-adaf-ced2c77ca0b3" - } - ], - "related-to-property": [ - { - "property-key": "service-instance.service-instance-name", - "property-value": "Service_Ete_Name7ba1fbde-6187-464a-a62d-d9dd25bdf4e8" - } - ] - }, - { - "related-to": "platform", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/platforms/platform/Platform-Demonstration", - "relationship-data": [ - { - "relationship-key": "platform.platform-name", - "relationship-value": "Platform-Demonstration" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/80465c73-3481-4d9d-9d3b-ab4016dfffe7", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "80465c73-3481-4d9d-9d3b-ab4016dfffe7" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01pgnfbde" - } - ] - } - ] - }, - "vf-modules": { - "vf-module": [ - { - "vf-module-id": "04bcd430-e1ef-4da5-a67e-3dd80463a725", - "vf-module-name": "Vfmodule_Ete_vFWCLvPKG_7ba1fbde_1", - "heat-stack-id": "Vfmodule_Ete_vFWCLvPKG_7ba1fbde_1/6f9827e8-68fb-45e9-a19e-e2246a43df14", - "orchestration-status": "active", - "is-base-vf-module": true, - "automated-assignment": false, - "resource-version": "1556725420287", - "model-invariant-id": "4eb0297d-1256-4ba7-9ed4-7bc44b6a0031", - "model-version-id": "bb755929-a025-48cd-b987-59cb4734c059", - "model-customization-id": "bfcebc88-8d57-449d-906c-f508b5bd0fe0", - "module-index": 0, - "relationship-list": { - "relationship": [ - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/80465c73-3481-4d9d-9d3b-ab4016dfffe7", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "80465c73-3481-4d9d-9d3b-ab4016dfffe7" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01pgnfbde" - } - ] - } - ] - } - } - ] - } - } - }, - { - "vf-module": { - "vf-module-id": "a6936a82-e340-4fe2-8e3e-b0a10a0001e2", - "vf-module-name": "Vfmodule_Ete_vFWCLvFWSNK_7ba1fbde_0", - "heat-stack-id": "Vfmodule_Ete_vFWCLvFWSNK_7ba1fbde_0/6769f192-0579-4dab-b4e7-170d334c37dd", - "orchestration-status": "active", - "is-base-vf-module": true, - "automated-assignment": false, - "resource-version": "1556725224323", - "model-invariant-id": "e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e", - "model-version-id": "94b18b1d-cc91-4f43-911a-e6348665f292", - "model-customization-id": "47958575-138f-452a-8c8d-d89b595f8164", - "module-index": 0, - "relationship-list": { - "relationship": [ - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/b75ccb62-131b-4e76-adad-28636fc60fb8", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "b75ccb62-131b-4e76-adad-28636fc60fb8" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01snkfbde" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "f953c499-4b1e-426b-8c6d-e9e9f1fc730f" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - } - ] - } - } - }, - { - "model-ver": { - "model-version-id": "94b18b1d-cc91-4f43-911a-e6348665f292", - "model-name": "VfwclVfwsnkBbefb8ce2bde..base_vfw..module-0", - "model-version": "1", - "resource-version": "1556724754936", - "model-elements": { - "model-element": [ - { - "model-element-uuid": "acdee717-9602-4c9c-acf4-8522b65c7161", - "new-data-del-flag": "T", - "cardinality": "unbounded", - "resource-version": "1556724754936", - "relationship-list": { - "relationship": [ - { - "related-to": "model-ver", - "relationship-label": "org.onap.relationships.inventory.IsA", - "related-link": "/aai/v15/service-design-and-creation/models/model/ef86f9c5-2165-44f3-8fc3-96018b609ea5/model-vers/model-ver/c00563ae-812b-4e62-8330-7c4d0f47088a", - "relationship-data": [ - { - "relationship-key": "model.model-invariant-id", - "relationship-value": "ef86f9c5-2165-44f3-8fc3-96018b609ea5" - }, - { - "relationship-key": "model-ver.model-version-id", - "relationship-value": "c00563ae-812b-4e62-8330-7c4d0f47088a" - } - ], - "related-to-property": [ - { - "property-key": "model-ver.model-name", - "property-value": "vf-module" - } - ] - } - ] - } - } - ] - }, - "relationship-list": { - "relationship": [ - { - "related-to": "model-element", - "relationship-label": "org.onap.relationships.inventory.IsA", - "related-link": "/aai/v15/service-design-and-creation/models/model/bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38/model-vers/model-ver/189a5070-3bd5-45ac-8a1d-c84ca40b277b/model-elements/model-element/d4dd3710-eb91-4b15-98d7-a8a90fa28f1b/model-elements/model-element/d272cfdd-0700-43a9-8cab-b2fcd80c803a", - "relationship-data": [ - { - "relationship-key": "model.model-invariant-id", - "relationship-value": "bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38" - }, - { - "relationship-key": "model-ver.model-version-id", - "relationship-value": "189a5070-3bd5-45ac-8a1d-c84ca40b277b" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "d4dd3710-eb91-4b15-98d7-a8a90fa28f1b" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "d272cfdd-0700-43a9-8cab-b2fcd80c803a" - } - ] - } - ] - } - } - }, - { - "model": { - "model-invariant-id": "e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e", - "model-type": "resource", - "resource-version": "1556724754936", - "model-vers": { - "model-ver": [ - { - "model-version-id": "94b18b1d-cc91-4f43-911a-e6348665f292", - "model-name": "VfwclVfwsnkBbefb8ce2bde..base_vfw..module-0", - "model-version": "1", - "resource-version": "1556724754936", - "relationship-list": { - "relationship": [ - { - "related-to": "model-element", - "relationship-label": "org.onap.relationships.inventory.IsA", - "related-link": "/aai/v15/service-design-and-creation/models/model/bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38/model-vers/model-ver/189a5070-3bd5-45ac-8a1d-c84ca40b277b/model-elements/model-element/d4dd3710-eb91-4b15-98d7-a8a90fa28f1b/model-elements/model-element/d272cfdd-0700-43a9-8cab-b2fcd80c803a", - "relationship-data": [ - { - "relationship-key": "model.model-invariant-id", - "relationship-value": "bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38" - }, - { - "relationship-key": "model-ver.model-version-id", - "relationship-value": "189a5070-3bd5-45ac-8a1d-c84ca40b277b" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "d4dd3710-eb91-4b15-98d7-a8a90fa28f1b" - }, - { - "relationship-key": "model-element.model-element-uuid", - "relationship-value": "d272cfdd-0700-43a9-8cab-b2fcd80c803a" - } - ] - } - ] - } - } - ] - } - } - }, - { - "tenant": { - "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", - "tenant-name": "Integration-SB-00", - "resource-version": "1556561749631", - "vservers": { - "vserver": [ - { - "vserver-id": "f7807a27-1c45-4e79-9e61-6fb33ee4b7e7", - "vserver-name": "Ete_vFWCLvFWSNK_38fbaf46_0", - "vserver-name2": "Ete_vFWCLvFWSNK_38fbaf46_0", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/f7807a27-1c45-4e79-9e61-6fb33ee4b7e7", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556564836725", - "relationship-list": { - "relationship": [ - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/0b34a0bb-84ea-424a-a0ce-a2041e115025", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "0b34a0bb-84ea-424a-a0ce-a2041e115025" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvFWSNK_38fbaf46_0" - } - ] - }, - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/Ete_vFWCLvFWSNK_38fbaf46_0", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "Ete_vFWCLvFWSNK_38fbaf46_0" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/0b34a0bb-84ea-424a-a0ce-a2041e115025/vf-modules/vf-module/32a2a6e2-27a4-4995-8e3d-50a65e8bfeb6", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "0b34a0bb-84ea-424a-a0ce-a2041e115025" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "32a2a6e2-27a4-4995-8e3d-50a65e8bfeb6" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "900dc2db-1d65-41ef-8b13-9b9b605cb0bd", - "vserver-name": "vofwl01snkf0ef", - "vserver-name2": "vofwl01snkf0ef", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/900dc2db-1d65-41ef-8b13-9b9b605cb0bd", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556567725997", - "relationship-list": { - "relationship": [ - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9a216ccb-6536-4dc3-a789-0634591342d3", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9a216ccb-6536-4dc3-a789-0634591342d3" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvFWSNK_8edbf0ef_1" - } - ] - }, - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01snkf0ef", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01snkf0ef" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9a216ccb-6536-4dc3-a789-0634591342d3/vf-modules/vf-module/3ecc64d4-3861-4024-8fd2-d81d2d6e539c", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9a216ccb-6536-4dc3-a789-0634591342d3" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "3ecc64d4-3861-4024-8fd2-d81d2d6e539c" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "cc93aa76-e88d-43a6-8e3b-331918dd3eab", - "vserver-name": "demofwl01pgnaf46", - "vserver-name2": "demofwl01pgnaf46", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/cc93aa76-e88d-43a6-8e3b-331918dd3eab", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556565009305", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/demofwl01pgnaf46", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "demofwl01pgnaf46" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9fdccaed-6809-457d-9178-9f2187b54e15", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9fdccaed-6809-457d-9178-9f2187b54e15" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvPKG_38fbaf46_1" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9fdccaed-6809-457d-9178-9f2187b54e15/vf-modules/vf-module/475496f6-38d1-43df-a995-64a387f6c788", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9fdccaed-6809-457d-9178-9f2187b54e15" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "475496f6-38d1-43df-a995-64a387f6c788" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "ab342d19-f3e6-420b-8481-ed7f16c43dfa", - "vserver-name": "demofwl01snkaf46", - "vserver-name2": "demofwl01snkaf46", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/ab342d19-f3e6-420b-8481-ed7f16c43dfa", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556564837108", - "relationship-list": { - "relationship": [ - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/0b34a0bb-84ea-424a-a0ce-a2041e115025", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "0b34a0bb-84ea-424a-a0ce-a2041e115025" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvFWSNK_38fbaf46_0" - } - ] - }, - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/demofwl01snkaf46", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "demofwl01snkaf46" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/0b34a0bb-84ea-424a-a0ce-a2041e115025/vf-modules/vf-module/32a2a6e2-27a4-4995-8e3d-50a65e8bfeb6", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "0b34a0bb-84ea-424a-a0ce-a2041e115025" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "32a2a6e2-27a4-4995-8e3d-50a65e8bfeb6" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "2a9ce7fd-ecae-4301-b2eb-0b3f42df2eb8", - "vserver-name": "vofwl01vfw8ab3", - "vserver-name2": "vofwl01vfw8ab3", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/2a9ce7fd-ecae-4301-b2eb-0b3f42df2eb8", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556573557549", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01vfw8ab3", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01vfw8ab3" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/b2d0096d-8d50-4f05-b603-dfe95b07f1ea", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "b2d0096d-8d50-4f05-b603-dfe95b07f1ea" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvFWSNK_8b908ab3_1" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/b2d0096d-8d50-4f05-b603-dfe95b07f1ea/vf-modules/vf-module/acc2eaad-1127-483a-80d2-ac5de1ec942a", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "b2d0096d-8d50-4f05-b603-dfe95b07f1ea" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "acc2eaad-1127-483a-80d2-ac5de1ec942a" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "91277106-90d3-450d-8a10-9aa9a8727d6e", - "vserver-name": "vofwl01pgnf0ef", - "vserver-name2": "vofwl01pgnf0ef", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/91277106-90d3-450d-8a10-9aa9a8727d6e", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556567540588", - "relationship-list": { - "relationship": [ - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9e34e80d-3995-479c-8c53-54e621840ae0", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9e34e80d-3995-479c-8c53-54e621840ae0" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvPKG_8edbf0ef_0" - } - ] - }, - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01pgnf0ef", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01pgnf0ef" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9e34e80d-3995-479c-8c53-54e621840ae0/vf-modules/vf-module/02e31bf2-8a33-418f-85f4-6b1d2903b3b7", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9e34e80d-3995-479c-8c53-54e621840ae0" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "02e31bf2-8a33-418f-85f4-6b1d2903b3b7" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "801da076-918a-4911-b87c-b44ce62822a9", - "vserver-name": "vofwl01pgn8ab3", - "vserver-name2": "vofwl01pgn8ab3", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/801da076-918a-4911-b87c-b44ce62822a9", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556573356532", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01pgn8ab3", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01pgn8ab3" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/7f0cccbf-408d-466c-8045-a7fd677bb24f", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "7f0cccbf-408d-466c-8045-a7fd677bb24f" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvPKG_8b908ab3_0" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/7f0cccbf-408d-466c-8045-a7fd677bb24f/vf-modules/vf-module/1e130341-7ccd-46bc-bf83-3453c1ba5fe3", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "7f0cccbf-408d-466c-8045-a7fd677bb24f" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "1e130341-7ccd-46bc-bf83-3453c1ba5fe3" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "8a503052-a89c-4035-94ec-b3ab1e157b49", - "vserver-name": "vofwl01vfwf0ef", - "vserver-name2": "vofwl01vfwf0ef", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/8a503052-a89c-4035-94ec-b3ab1e157b49", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556567726399", - "relationship-list": { - "relationship": [ - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9a216ccb-6536-4dc3-a789-0634591342d3", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9a216ccb-6536-4dc3-a789-0634591342d3" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvFWSNK_8edbf0ef_1" - } - ] - }, - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01vfwf0ef", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01vfwf0ef" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9a216ccb-6536-4dc3-a789-0634591342d3/vf-modules/vf-module/3ecc64d4-3861-4024-8fd2-d81d2d6e539c", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9a216ccb-6536-4dc3-a789-0634591342d3" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "3ecc64d4-3861-4024-8fd2-d81d2d6e539c" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "39a77e27-ced1-444c-a5b6-f73135e09225", - "vserver-name": "vofwl01snk8ab3", - "vserver-name2": "vofwl01snk8ab3", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/39a77e27-ced1-444c-a5b6-f73135e09225", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556573557017", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01snk8ab3", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01snk8ab3" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/b2d0096d-8d50-4f05-b603-dfe95b07f1ea", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "b2d0096d-8d50-4f05-b603-dfe95b07f1ea" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvFWSNK_8b908ab3_1" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/b2d0096d-8d50-4f05-b603-dfe95b07f1ea/vf-modules/vf-module/acc2eaad-1127-483a-80d2-ac5de1ec942a", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "b2d0096d-8d50-4f05-b603-dfe95b07f1ea" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "acc2eaad-1127-483a-80d2-ac5de1ec942a" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "0e581a27-5184-48b1-88b1-e81c5b5a450c", - "vserver-name": "vofwl01snk8ab3", - "vserver-name2": "vofwl01snk8ab3", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/0e581a27-5184-48b1-88b1-e81c5b5a450c", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556573767443", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01snk8ab3", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01snk8ab3" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvFWSNK_8b908ab3_2" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073/vf-modules/vf-module/06a08cc1-37a5-4ec6-bb85-e5ee4d69d0f0", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "06a08cc1-37a5-4ec6-bb85-e5ee4d69d0f0" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "c103ce57-6662-49e0-a589-ebfd91f05c79", - "vserver-name": "vofwl01vfw8ab3", - "vserver-name2": "vofwl01vfw8ab3", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/c103ce57-6662-49e0-a589-ebfd91f05c79", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556573767717", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/vofwl01vfw8ab3", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "vofwl01vfw8ab3" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWDTvFWSNK_8b908ab3_2" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073/vf-modules/vf-module/06a08cc1-37a5-4ec6-bb85-e5ee4d69d0f0", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "7d4ae51b-4d2e-45f7-a0a5-6fd42dc8a073" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "06a08cc1-37a5-4ec6-bb85-e5ee4d69d0f0" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "b75ccb62-131b-4e76-adad-28636fc60fb8", - "vserver-name": "demofwl01snkfbde", - "vserver-name2": "demofwl01snkfbde", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/b75ccb62-131b-4e76-adad-28636fc60fb8", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556725250327", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/demofwl01snkfbde", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "demofwl01snkfbde" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/f17face5-69cb-4c88-9e0b-7426db7edddd", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "f17face5-69cb-4c88-9e0b-7426db7edddd" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/f17face5-69cb-4c88-9e0b-7426db7edddd/vf-modules/vf-module/a6936a82-e340-4fe2-8e3e-b0a10a0001e2", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "f17face5-69cb-4c88-9e0b-7426db7edddd" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "a6936a82-e340-4fe2-8e3e-b0a10a0001e2" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "vserver-name": "Ete_vFWCLvFWSNK_7ba1fbde_0", - "vserver-name2": "Ete_vFWCLvFWSNK_7ba1fbde_0", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556725250281", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/Ete_vFWCLvFWSNK_7ba1fbde_0", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/f17face5-69cb-4c88-9e0b-7426db7edddd", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "f17face5-69cb-4c88-9e0b-7426db7edddd" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/f17face5-69cb-4c88-9e0b-7426db7edddd/vf-modules/vf-module/a6936a82-e340-4fe2-8e3e-b0a10a0001e2", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "f17face5-69cb-4c88-9e0b-7426db7edddd" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "a6936a82-e340-4fe2-8e3e-b0a10a0001e2" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - }, - { - "vserver-id": "80465c73-3481-4d9d-9d3b-ab4016dfffe7", - "vserver-name": "demofwl01pgnfbde", - "vserver-name2": "demofwl01pgnfbde", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/80465c73-3481-4d9d-9d3b-ab4016dfffe7", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1556725436997", - "relationship-list": { - "relationship": [ - { - "related-to": "vnfc", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/vnfcs/vnfc/demofwl01pgnfbde", - "relationship-data": [ - { - "relationship-key": "vnfc.vnfc-name", - "relationship-value": "demofwl01pgnfbde" - } - ] - }, - { - "related-to": "generic-vnf", - "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9cd7da50-723c-418c-a91d-af2866844a5d", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9cd7da50-723c-418c-a91d-af2866844a5d" - } - ], - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "Ete_vFWCLvPKG_7ba1fbde_1" - } - ] - }, - { - "related-to": "vf-module", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/9cd7da50-723c-418c-a91d-af2866844a5d/vf-modules/vf-module/04bcd430-e1ef-4da5-a67e-3dd80463a725", - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "9cd7da50-723c-418c-a91d-af2866844a5d" - }, - { - "relationship-key": "vf-module.vf-module-id", - "relationship-value": "04bcd430-e1ef-4da5-a67e-3dd80463a725" - } - ] - }, - { - "related-to": "image", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "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": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" - } - ], - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ] - }, - { - "related-to": "flavor", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "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": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ], - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ] - } - ] - } - } - ] - }, - "relationship-list": { - "relationship": [ - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vLB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vLB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vIMS", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vIMS" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vCPE", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vCPE" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vFW", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFW" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/gNB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "gNB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vIMS", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vIMS" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/gNB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "gNB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFW" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vLB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vLB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_8568f3da-8821-4600-b95f-6224f15943f7/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_8568f3da-8821-4600-b95f-6224f15943f7" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_38fbaf46-8ae5-4b08-ad4d-2cb552ca2eb0/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_38fbaf46-8ae5-4b08-ad4d-2cb552ca2eb0" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_8edbf0ef-8460-4965-9e56-7e4637c31a41/service-subscriptions/service-subscription/vFWDT", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_8edbf0ef-8460-4965-9e56-7e4637c31a41" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWDT" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vCPE", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vCPE" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_5dbd369e-2174-430a-9c15-b9a090b99591/service-subscriptions/service-subscription/vFWDT", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_5dbd369e-2174-430a-9c15-b9a090b99591" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWDT" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_8b908ab3-b9e6-41a9-a4e2-31cc9c5114a2/service-subscriptions/service-subscription/vFWDT", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_8b908ab3-b9e6-41a9-a4e2-31cc9c5114a2" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWDT" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - } - ] - } - } - }, - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-type": "SharedNode", - "owner-defined-type": "OwnerType", - "cloud-region-version": "v1", - "cloud-zone": "CloudZone", - "resource-version": "1556561749631", - "tenants": { - "tenant": [ - { - "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", - "tenant-name": "Integration-SB-00", - "resource-version": "1556561749631", - "relationship-list": { - "relationship": [ - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vLB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vLB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vIMS", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vIMS" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vCPE", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vCPE" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vFW", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFW" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/gNB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "gNB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vIMS", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vIMS" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/gNB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "gNB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFW" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vLB", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vLB" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_8568f3da-8821-4600-b95f-6224f15943f7/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_8568f3da-8821-4600-b95f-6224f15943f7" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_38fbaf46-8ae5-4b08-ad4d-2cb552ca2eb0/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_38fbaf46-8ae5-4b08-ad4d-2cb552ca2eb0" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_8edbf0ef-8460-4965-9e56-7e4637c31a41/service-subscriptions/service-subscription/vFWDT", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_8edbf0ef-8460-4965-9e56-7e4637c31a41" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWDT" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vCPE", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "SDN-ETHERNET-INTERNET" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vCPE" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_5dbd369e-2174-430a-9c15-b9a090b99591/service-subscriptions/service-subscription/vFWDT", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_5dbd369e-2174-430a-9c15-b9a090b99591" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWDT" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_8b908ab3-b9e6-41a9-a4e2-31cc9c5114a2/service-subscriptions/service-subscription/vFWDT", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_8b908ab3-b9e6-41a9-a4e2-31cc9c5114a2" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWDT" - } - ] - }, - { - "related-to": "service-subscription", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/business/customers/customer/DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8/service-subscriptions/service-subscription/vFWCL", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "DemoCust_7ba1fbde-6187-464a-a62d-d9dd25bdf4e8" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vFWCL" - } - ] - } - ] - } - } - ] - }, - "flavors": { - "flavor": [ - { - "flavor-id": "764efb04-5a46-4806-a766-2bdd24559f39", - "flavor-name": "m1.medium", - "flavor-vcpus": 2, - "flavor-ram": 4096, - "flavor-disk": 40, - "flavor-ephemeral": 0, - "flavor-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/flavors/764efb04-5a46-4806-a766-2bdd24559f39", - "resource-version": "1556564836050", - "relationship-list": { - "relationship": [ - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/f7807a27-1c45-4e79-9e61-6fb33ee4b7e7", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "f7807a27-1c45-4e79-9e61-6fb33ee4b7e7" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "Ete_vFWCLvFWSNK_38fbaf46_0" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/900dc2db-1d65-41ef-8b13-9b9b605cb0bd", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "900dc2db-1d65-41ef-8b13-9b9b605cb0bd" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01snkf0ef" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/cc93aa76-e88d-43a6-8e3b-331918dd3eab", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "cc93aa76-e88d-43a6-8e3b-331918dd3eab" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01pgnaf46" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/ab342d19-f3e6-420b-8481-ed7f16c43dfa", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "ab342d19-f3e6-420b-8481-ed7f16c43dfa" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01snkaf46" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/2a9ce7fd-ecae-4301-b2eb-0b3f42df2eb8", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "2a9ce7fd-ecae-4301-b2eb-0b3f42df2eb8" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01vfw8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/91277106-90d3-450d-8a10-9aa9a8727d6e", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "91277106-90d3-450d-8a10-9aa9a8727d6e" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01pgnf0ef" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/801da076-918a-4911-b87c-b44ce62822a9", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "801da076-918a-4911-b87c-b44ce62822a9" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01pgn8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/8a503052-a89c-4035-94ec-b3ab1e157b49", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "8a503052-a89c-4035-94ec-b3ab1e157b49" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01vfwf0ef" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/39a77e27-ced1-444c-a5b6-f73135e09225", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "39a77e27-ced1-444c-a5b6-f73135e09225" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01snk8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/0e581a27-5184-48b1-88b1-e81c5b5a450c", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "0e581a27-5184-48b1-88b1-e81c5b5a450c" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01snk8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/c103ce57-6662-49e0-a589-ebfd91f05c79", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "c103ce57-6662-49e0-a589-ebfd91f05c79" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01vfw8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/b75ccb62-131b-4e76-adad-28636fc60fb8", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "b75ccb62-131b-4e76-adad-28636fc60fb8" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01snkfbde" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "f953c499-4b1e-426b-8c6d-e9e9f1fc730f" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/80465c73-3481-4d9d-9d3b-ab4016dfffe7", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "80465c73-3481-4d9d-9d3b-ab4016dfffe7" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01pgnfbde" - } - ] - } - ] - } - } - ] - }, - "images": { - "image": [ - { - "image-id": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "image-name": "unknown", - "image-architecture": "unknown", - "image-os-distro": "unknown", - "image-os-version": "unknown", - "application": "unknown", - "application-vendor": "unknown", - "application-version": "unknown", - "image-selflink": "http://10.12.25.2:8774/41d6d38489bd40b09ea8a6b6b852dcbd/images/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", - "resource-version": "1556564834957", - "relationship-list": { - "relationship": [ - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/f7807a27-1c45-4e79-9e61-6fb33ee4b7e7", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "f7807a27-1c45-4e79-9e61-6fb33ee4b7e7" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "Ete_vFWCLvFWSNK_38fbaf46_0" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/900dc2db-1d65-41ef-8b13-9b9b605cb0bd", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "900dc2db-1d65-41ef-8b13-9b9b605cb0bd" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01snkf0ef" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/cc93aa76-e88d-43a6-8e3b-331918dd3eab", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "cc93aa76-e88d-43a6-8e3b-331918dd3eab" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01pgnaf46" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/ab342d19-f3e6-420b-8481-ed7f16c43dfa", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "ab342d19-f3e6-420b-8481-ed7f16c43dfa" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01snkaf46" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/2a9ce7fd-ecae-4301-b2eb-0b3f42df2eb8", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "2a9ce7fd-ecae-4301-b2eb-0b3f42df2eb8" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01vfw8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/91277106-90d3-450d-8a10-9aa9a8727d6e", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "91277106-90d3-450d-8a10-9aa9a8727d6e" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01pgnf0ef" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/801da076-918a-4911-b87c-b44ce62822a9", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "801da076-918a-4911-b87c-b44ce62822a9" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01pgn8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/8a503052-a89c-4035-94ec-b3ab1e157b49", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "8a503052-a89c-4035-94ec-b3ab1e157b49" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01vfwf0ef" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/39a77e27-ced1-444c-a5b6-f73135e09225", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "39a77e27-ced1-444c-a5b6-f73135e09225" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01snk8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/0e581a27-5184-48b1-88b1-e81c5b5a450c", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "0e581a27-5184-48b1-88b1-e81c5b5a450c" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01snk8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/c103ce57-6662-49e0-a589-ebfd91f05c79", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "c103ce57-6662-49e0-a589-ebfd91f05c79" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vofwl01vfw8ab3" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/b75ccb62-131b-4e76-adad-28636fc60fb8", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "b75ccb62-131b-4e76-adad-28636fc60fb8" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01snkfbde" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/f953c499-4b1e-426b-8c6d-e9e9f1fc730f", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "f953c499-4b1e-426b-8c6d-e9e9f1fc730f" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "Ete_vFWCLvFWSNK_7ba1fbde_0" - } - ] - }, - { - "related-to": "vserver", - "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/41d6d38489bd40b09ea8a6b6b852dcbd/vservers/vserver/80465c73-3481-4d9d-9d3b-ab4016dfffe7", - "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": "41d6d38489bd40b09ea8a6b6b852dcbd" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "80465c73-3481-4d9d-9d3b-ab4016dfffe7" - } - ], - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "demofwl01pgnfbde" - } - ] - } - ] - } - } - ] - }, - "availability-zones": { - "availability-zone": [ - { - "availability-zone-name": "nova", - "hypervisor-type": "KVM", - "operational-status": "Active", - "resource-version": "1556561761360" - } - ] - }, - "relationship-list": { - "relationship": [ - { - "related-to": "complex", - "relationship-label": "org.onap.relationships.inventory.LocatedIn", - "related-link": "/aai/v15/cloud-infrastructure/complexes/complex/clli1", - "relationship-data": [ - { - "relationship-key": "complex.physical-location-id", - "relationship-value": "clli1" - } - ] - } - ] - } - } - } - ] -} diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseMissing.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseMissing.json deleted file mode 100644 index 29f1cdd8f..000000000 --- a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiCqResponseMissing.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "results": [ - ] -} diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json deleted file mode 100644 index af40be948..000000000 --- a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json +++ /dev/null @@ -1,267 +0,0 @@ -{ - "inventory-response-item": [ - { - "vserver": { - "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", - "vserver-name": "zdfw1lb01lb02", - "vserver-name2": "zdfw1lb01lb02", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1510606403522" - }, - "extra-properties": { - "extra-property": [] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancer", - "generic-vnf": { - "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vnf-name": "Vfmodule_vLB1113", - "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", - "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", - "prov-status": "PREPROV", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1510604011851", - "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", - "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancer" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancer-1106", - "service-instance": { - "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", - "service-instance-name": "vLoadBalancer-1113", - "resource-version": "1510603936425", - "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", - "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancer-1106" - }, - { - "property-name": "model.model-type", - "property-value": "service" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - } - }, - { - "model-name": "Vloadbalancer..base_vlb..module-0", - "vf-module": { - "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12", - "vf-module-name": "Vfmodule_vLB1113-1", - "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db", - "orchestration-status": "active", - "is-base-vf-module": true, - "resource-version": "1510604612557", - "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2", - "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..base_vlb..module-0" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - }, - { - "model-name": "Vloadbalancer..dnsscaling..module-1", - "vf-module": { - "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "is-base-vf-module": false, - "resource-version": "1510610079687", - "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", - "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..dnsscaling..module-1" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - }, - { - "model-name": "Vloadbalancer..dnsscaling..module-1", - "vf-module": { - "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vf-module-name": "my_module_1", - "is-base-vf-module": false, - "resource-version": "1510610079687", - "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", - "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..dnsscaling..module-1" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - }, - { - "model-name": "Vloadbalancer..dnsscaling..module-1", - "vf-module": { - "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vf-module-name": "my_module_2", - "is-base-vf-module": false, - "resource-version": "1510610079687", - "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", - "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..dnsscaling..module-1" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - } - ] - } - }, - { - "tenant": { - "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", - "tenant-name": "Integration-SB-00", - "resource-version": "1509587770200" - }, - "extra-properties": { - "extra-property": [] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-region-version": "v1", - "resource-version": "1509587770092" - }, - "extra-properties": { - "extra-property": [] - } - } - ] - } - } - ] - } - } - ] -} diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json deleted file mode 100644 index 7101f60f2..000000000 --- a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json +++ /dev/null @@ -1,230 +0,0 @@ -{ - "inventory-response-item": [ - { - "vserver": { - "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", - "vserver-name": "zdfw1lb01lb02", - "vserver-name2": "zdfw1lb01lb02", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1510606403522" - }, - "extra-properties": { - "extra-property": [] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancer", - "generic-vnf": { - "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vnf-name": "Vfmodule_vLB1113", - "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", - "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", - "prov-status": "PREPROV", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1510604011851", - "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", - "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancer" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancer-1106", - "service-instance": { - "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", - "service-instance-name": "vLoadBalancer-1113", - "resource-version": "1510603936425", - "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", - "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancer-1106" - }, - { - "property-name": "model.model-type", - "property-value": "service" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - } - }, - { - "model-name": "Vloadbalancer..dnsscaling..module-1", - "vf-module": { - "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "is-base-vf-module": false, - "resource-version": "1510610079687", - "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", - "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..dnsscaling..module-1" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - }, - { - "model-name": "Vloadbalancer..dnsscaling..module-1", - "vf-module": { - "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vf-module-name": "my_module_1", - "is-base-vf-module": false, - "resource-version": "1510610079687", - "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", - "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..dnsscaling..module-1" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - }, - { - "model-name": "Vloadbalancer..dnsscaling..module-1", - "vf-module": { - "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vf-module-name": "my_module_2", - "is-base-vf-module": false, - "resource-version": "1510610079687", - "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", - "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..dnsscaling..module-1" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - } - ] - } - }, - { - "tenant": { - "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", - "tenant-name": "Integration-SB-00", - "resource-version": "1509587770200" - }, - "extra-properties": { - "extra-property": [] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-region-version": "v1", - "resource-version": "1509587770092" - }, - "extra-properties": { - "extra-property": [] - } - } - ] - } - } - ] - } - } - ] -} diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json deleted file mode 100644 index a58100bc5..000000000 --- a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "inventory-response-item": [ - { - "vserver": { - "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", - "vserver-name": "zdfw1lb01lb02", - "vserver-name2": "zdfw1lb01lb02", - "prov-status": "ACTIVE", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1510606403522" - }, - "extra-properties": { - "extra-property": [] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancer", - "generic-vnf": { - "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vnf-name": "Vfmodule_vLB1113", - "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", - "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", - "prov-status": "PREPROV", - "in-maint": false, - "is-closed-loop-disabled": false, - "resource-version": "1510604011851", - "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", - "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancer" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancer-1106", - "service-instance": { - "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", - "service-instance-name": "vLoadBalancer-1113", - "resource-version": "1510603936425", - "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", - "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancer-1106" - }, - { - "property-name": "model.model-type", - "property-value": "service" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - } - }, - { - "model-name": "Vloadbalancer..base_vlb..module-0", - "vf-module": { - "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12", - "vf-module-name": "Vfmodule_vLB1113-1", - "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db", - "orchestration-status": "active", - "is-base-vf-module": true, - "resource-version": "1510604612557", - "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2", - "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..base_vlb..module-0" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - }, - { - "model-name": "Vloadbalancer..dnsscaling..module-1", - "vf-module": { - "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", - "is-base-vf-module": false, - "resource-version": "1510610079687", - "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", - "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" - }, - { - "property-name": "model-ver.model-name", - "property-value": "Vloadbalancer..dnsscaling..module-1" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1" - } - ] - } - } - ] - } - }, - { - "tenant": { - "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", - "tenant-name": "Integration-SB-00", - "resource-version": "1509587770200" - }, - "extra-properties": { - "extra-property": [] - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-region-version": "v1", - "resource-version": "1509587770092" - }, - "extra-properties": { - "extra-property": [] - } - } - ] - } - } - ] - } - } - ] -} diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java index cdedbf401..bb7f34b61 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java @@ -21,34 +21,22 @@ package org.onap.policy.controlloop.actor.test; import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; import java.util.Map; -import java.util.TreeMap; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import javax.ws.rs.core.Response; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.onap.policy.aai.AaiConstants; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.common.utils.time.PseudoExecutor; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.ActorService; -import org.onap.policy.controlloop.actorserviceprovider.Operation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; -import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.Operator; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; -import org.onap.policy.controlloop.actorserviceprovider.impl.OperationPartial; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; -import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; /** * Superclass for various Operation tests. @@ -76,27 +64,9 @@ public class BasicOperation { @Mock protected ActorService service; - @Mock - protected Actor guardActor; - @Mock - protected Operator guardOperator; - @Mock - protected Operation guardOperation; - @Mock - protected Actor cqActor; - @Mock - protected Operator cqOperator; - @Mock - protected Operation cqOperation; - @Mock - protected AaiCqResponse cqResponse; - protected CompletableFuture cqFuture; protected CompletableFuture future; protected ControlLoopOperationParams params; - protected Map enrichment; - protected VirtualControlLoopEvent event; - protected ControlLoopEventContext context; protected OperationOutcome outcome; protected PseudoExecutor executor; @@ -125,64 +95,27 @@ public class BasicOperation { public void setUpBasic() { MockitoAnnotations.initMocks(this); - cqFuture = new CompletableFuture<>(); future = new CompletableFuture<>(); executor = new PseudoExecutor(); makeContext(); - when(service.getActor(OperationPartial.GUARD_ACTOR_NAME)).thenReturn(guardActor); - when(guardActor.getOperator(OperationPartial.GUARD_OPERATION_NAME)).thenReturn(guardOperator); - when(guardOperator.buildOperation(any())).thenReturn(guardOperation); - - outcome = params.makeOutcome(TARGET_ENTITY); - outcome.setResult(OperationResult.SUCCESS); - when(guardOperation.start()).thenReturn(CompletableFuture.completedFuture(outcome)); - - when(service.getActor(AaiConstants.ACTOR_NAME)).thenReturn(cqActor); - when(cqActor.getOperator("CustomQuery")).thenReturn(cqOperator); - when(cqOperator.buildOperation(any())).thenReturn(cqOperation); - - when(cqOperation.start()).thenReturn(cqFuture); - // get a fresh outcome outcome = params.makeOutcome(TARGET_ENTITY); } /** - * Reinitializes {@link #enrichment}, {@link #event}, {@link #context}, and - * {@link #params}. + * Reinitializes {@link #params}. *

* Note: {@link #params} is configured to use {@link #executor}. */ protected void makeContext() { - enrichment = new TreeMap<>(makeEnrichment()); - - event = new VirtualControlLoopEvent(); - event.setRequestId(REQ_ID); - event.setAai(enrichment); - event.setClosedLoopControlName(CL_NAME); - event.setPolicyName(EVENT_POLICY_NAME); - event.setPolicyVersion(EVENT_POLICY_VERSION); - event.setVersion(EVENT_VERSION); - - context = new ControlLoopEventContext(event); - - params = ControlLoopOperationParams.builder().executor(executor).context(context).actorService(service) + params = ControlLoopOperationParams.builder().executor(executor).requestId(REQ_ID).actorService(service) .actor(actorName).operation(operationName).targetEntity(TARGET_ENTITY).payload(makePayload()) .build(); } - /** - * Makes enrichment data. - * - * @return enrichment data - */ - protected Map makeEnrichment() { - return new TreeMap<>(); - } - /** * Makes payload data. @@ -218,16 +151,4 @@ public class BasicOperation { assertEquals(expected, json); } - - /** - * Provides a response to a custom query. - * - * @param cq response to provide - */ - protected void provideCqResponse(AaiCqResponse cq) { - context.setProperty(AaiCqResponse.CONTEXT_KEY, cq); - OperationOutcome outcome2 = params.makeOutcome(TARGET_ENTITY); - outcome2.setResult(OperationResult.SUCCESS); - cqFuture.complete(outcome2); - } } diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java index 17ddb391a..6cccc5cb7 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java @@ -103,7 +103,6 @@ public class BasicBidirectionalTopicOperationTest { @Test public void testSetUp() { assertNotNull(oper.config); - assertNotNull(oper.context); assertNotNull(oper.outcome); assertNotNull(oper.executor); } diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java index 2327fec00..62c19b80a 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java @@ -64,7 +64,6 @@ public class BasicHttpOperationTest { assertEquals(200, oper.rawResponse.getStatus()); assertNotNull(oper.future); assertEquals(BasicHttpOperation.BASE_URI, oper.client.getBaseUrl()); - assertNotNull(oper.context); assertNotNull(oper.outcome); assertNotNull(oper.executor); } diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java index 60d3ddd31..fe06ad52f 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java @@ -24,19 +24,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; import java.util.Map; -import java.util.concurrent.CompletableFuture; import org.junit.Before; import org.junit.Test; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.resources.ResourceUtils; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; -import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.Util; -import org.onap.policy.controlloop.actorserviceprovider.impl.OperationPartial; public class BasicOperationTest { private static final String ACTOR = "my-actor"; @@ -67,39 +61,24 @@ public class BasicOperationTest { @Test public void testSetUp() throws Exception { assertNotNull(oper.future); - assertNotNull(oper.context); assertNotNull(oper.outcome); assertNotNull(oper.executor); - assertNotNull(oper.guardOperation); - - CompletableFuture future = oper.service.getActor(OperationPartial.GUARD_ACTOR_NAME) - .getOperator(OperationPartial.GUARD_OPERATION_NAME).buildOperation(null).start(); - assertTrue(future.isDone()); - assertEquals(OperationResult.SUCCESS, future.get().getResult()); } @Test public void testMakeContext() { oper.makeContext(); - assertTrue(oper.enrichment.isEmpty()); - - assertSame(BasicHttpOperation.REQ_ID, oper.event.getRequestId()); - assertSame(oper.enrichment, oper.event.getAai()); - - assertSame(oper.event, oper.context.getEvent()); - - assertSame(oper.context, oper.params.getContext()); assertSame(oper.service, oper.params.getActorService()); assertSame(oper.executor, oper.params.getExecutor()); assertEquals(ACTOR, oper.params.getActor()); assertEquals(OPERATION, oper.params.getOperation()); + assertSame(BasicHttpOperation.REQ_ID, oper.params.getRequestId()); assertEquals(BasicHttpOperation.TARGET_ENTITY, oper.params.getTargetEntity()); } @Test - public void testMakeEnrichment_testMakePayload() { - assertTrue(oper.makeEnrichment().isEmpty()); + public void testMakePayload() { assertNull(oper.makePayload()); } @@ -108,14 +87,4 @@ public class BasicOperationTest { Map map = Util.translateToMap("", ResourceUtils.getResourceAsString("actual.json")); oper.verifyRequest("expected.json", map, "svc-request-id", "vnf-id"); } - - @Test - public void testProvideCqResponse() throws Exception { - AaiCqResponse cq = new AaiCqResponse("{}"); - oper.provideCqResponse(cq); - - assertSame(cq, oper.context.getProperty(AaiCqResponse.CONTEXT_KEY)); - assertTrue(oper.cqFuture.isDone()); - assertEquals(OperationResult.SUCCESS, oper.cqFuture.get().getResult()); - } } diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java index 0a1136d2f..65c7318ff 100644 --- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java +++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java @@ -21,7 +21,6 @@ package org.onap.policy.controlloop.actor.vfc; import java.util.List; -import java.util.concurrent.CompletableFuture; import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -82,14 +81,6 @@ public abstract class VfcOperation extends HttpOperation { return super.getPollingPath() + jobId; } - /** - * Starts the GUARD. - */ - @Override - protected CompletableFuture startPreprocessorAsync() { - return startGuardAsync(); - } - @Override protected Status detmStatus(Response rawResponse, VfcResponse response) { if (rawResponse.getStatus() == 200) { @@ -170,16 +161,15 @@ public abstract class VfcOperation extends HttpOperation { * @return request */ protected VfcRequest constructVfcRequest() { - final String serviceInstance = getOptProperty(OperationProperties.ENRICHMENT_SERVICE_ID, - "service-instance.service-instance-id"); - final String vmId = getOptProperty(OperationProperties.ENRICHMENT_VSERVER_ID, "vserver.vserver-id"); - final String vmName = getOptProperty(OperationProperties.ENRICHMENT_VSERVER_NAME, "vserver.vserver-name"); - final String vnfId = getOptProperty(OperationProperties.ENRICHMENT_GENERIC_VNF_ID, GENERIC_VNF_ID); + final String serviceInstance = getProperty(OperationProperties.ENRICHMENT_SERVICE_ID); + final String vmId = getProperty(OperationProperties.ENRICHMENT_VSERVER_ID); + final String vmName = getProperty(OperationProperties.ENRICHMENT_VSERVER_NAME); + final String vnfId = getProperty(OperationProperties.ENRICHMENT_GENERIC_VNF_ID); if (StringUtils.isBlank(serviceInstance) || StringUtils.isBlank(vmId) || StringUtils.isBlank(vmName)) { // original code did not check the VNF id, so we won't check it either throw new IllegalArgumentException( - "Cannot extract enrichment data for service instance, server id, or server name."); + "Missing enrichment data for service instance, server id, or server name."); } VfcHealActionVmInfo vmActionInfo = new VfcHealActionVmInfo(); @@ -202,21 +192,4 @@ public abstract class VfcOperation extends HttpOperation { return request; } - - /** - * Gets an optional property, first checking the properties, then checking the - * enrichment data. - * - * @param propName property name - * @param enrichmentName property name within the enrichment data - * @return the property's value, or {@code null} if it is not found - */ - protected String getOptProperty(String propName, String enrichmentName) { - if (containsProperty(propName)) { - // return the value, even if it's null - return getProperty(propName); - } - - return params.getContext().getEnrichment().get(enrichmentName); - } } diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java index 9a4677d79..fab7636ba 100644 --- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java @@ -32,7 +32,6 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; @@ -67,49 +66,26 @@ public class RestartTest extends BasicVfcOperation { @Before public void setup() throws Exception { super.setUp(); - params.getContext().getEnrichment().put("service-instance.service-instance-id", TEST_SERVICE_INSTANCE_ID); - params.getContext().getEnrichment().put("vserver.vserver-id", TEST_VSERVER_ID); - params.getContext().getEnrichment().put("vserver.vserver-name", TEST_VSERVER_NAME); - restartOper = new Restart(params, config); - } - - /** - * Tests "success" case with simulator. - */ - @Test - public void testSuccess() throws Exception { - HttpPollingParams opParams = HttpPollingParams.builder().clientName(MY_CLIENT).path("ns").pollPath("jobs") - .maxPolls(1).build(); - config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); - - params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build(); restartOper = new Restart(params, config); - outcome = restartOper.start().get(); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof VfcResponse); + loadProperties(); } /** - * Tests "success" case with simulator, using properties instead of custom query data. + * Tests "success" case with simulator. */ @Test - public void testSuccessViaProperties() throws Exception { + public void testSuccess() throws Exception { HttpPollingParams opParams = HttpPollingParams.builder().clientName(MY_CLIENT).path("ns").pollPath("jobs") .maxPolls(1).build(); config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build(); - params.getContext().removeProperty(AaiCqResponse.CONTEXT_KEY); restartOper = new Restart(params, config); - // set the properties - restartOper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, TEST_SERVICE_INSTANCE_ID); - restartOper.setProperty(OperationProperties.ENRICHMENT_VSERVER_ID, TEST_VSERVER_ID); - restartOper.setProperty(OperationProperties.ENRICHMENT_VSERVER_NAME, TEST_VSERVER_NAME); - restartOper.setProperty(OperationProperties.ENRICHMENT_GENERIC_VNF_ID, TEST_GENERIC_VNF_ID); + loadProperties(); // run the operation outcome = restartOper.start().get(); @@ -142,4 +118,11 @@ public class RestartTest extends BasicVfcOperation { assertNotNull(resultPair.getLeft()); assertNotNull(resultPair.getRight()); } + + private void loadProperties() { + restartOper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, TEST_SERVICE_INSTANCE_ID); + restartOper.setProperty(OperationProperties.ENRICHMENT_VSERVER_ID, TEST_VSERVER_ID); + restartOper.setProperty(OperationProperties.ENRICHMENT_VSERVER_NAME, TEST_VSERVER_NAME); + restartOper.setProperty(OperationProperties.ENRICHMENT_GENERIC_VNF_ID, TEST_GENERIC_VNF_ID); + } } diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java index 6f8956f6f..4f20c12d4 100644 --- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java @@ -26,11 +26,9 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import java.util.Map; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcResponseDescriptor; @@ -59,11 +57,6 @@ public class VfcOperationTest extends BasicVfcOperation { assertTrue(oper.isUsePolling()); } - @Test - public void testStartPreprocessorAsync() { - assertNotNull(oper.startPreprocessorAsync()); - } - @Test public void testResetPollCount() { oper.resetPollCount(); @@ -88,37 +81,4 @@ public class VfcOperationTest extends BasicVfcOperation { public void testIsSuccess() { assertTrue(oper.isSuccess(rawResponse, response)); } - - @Test - public void testGetOptProperty() { - // in neither property nor enrichment - assertNull(oper.getOptProperty("propA", "propA2")); - - // both - should choose the property - remakeOper(Map.of("propB2", "valueB2")); - oper.setProperty("propB", "valueB"); - assertEquals("valueB", oper.getOptProperty("propB", "propB2")); - - // both - should choose the property, even if it's null - remakeOper(Map.of("propC2", "valueC2")); - oper.setProperty("propC", null); - assertNull(oper.getOptProperty("propC", "propC2")); - - // only in enrichment data - remakeOper(Map.of("propD2", "valueD2")); - assertEquals("valueD2", oper.getOptProperty("propD", "propD2")); - } - - /** - * Remakes the operation, with the specified A&AI enrichment data. - * - * @param aai A&AI enrichment data - */ - private void remakeOper(Map aai) { - event.setAai(aai); - context = new ControlLoopEventContext(event); - params = params.toBuilder().context(context).build(); - - oper = new VfcOperation(params, config) {}; - } } diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java index 718daedb1..d4dea7c48 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java @@ -54,7 +54,7 @@ public class OperationProperties { public static final String AAI_PNF = "AAI/pnf"; /** - * A&AI VNF id for the target resource ID. Obtained as follows: + * A&AI [Generic] VNF for the target resource ID. Obtained as follows: *

    *
  1. using the target resource ID, invoke the custom query * getGenericVnfByModelInvariantId() method to get the generic VNF
  2. diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContext.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContext.java deleted file mode 100644 index f7b58c11e..000000000 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContext.java +++ /dev/null @@ -1,168 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop.actorserviceprovider.controlloop; - -import java.io.Serializable; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; -import org.onap.policy.controlloop.VirtualControlLoopEvent; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; -import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; - -/** - * Context associated with a control loop event. - */ -@Getter -@Setter -public class ControlLoopEventContext implements Serializable { - private static final long serialVersionUID = 1L; - - - private final VirtualControlLoopEvent event; - - /** - * Enrichment data extracted from the event. Never {@code null}, though it may be - * immutable. - */ - private final Map enrichment; - - /** - * Set of properties that have been stored in the context. - */ - @Getter(AccessLevel.NONE) - @Setter(AccessLevel.NONE) - private Map properties = new ConcurrentHashMap<>(); - - /** - * When {@link #obtain(String, ControlLoopOperationParams)} is invoked and the - * specified property is not found in {@link #properties}, it is retrieved. This holds - * the futures for the operations retrieving the properties. - */ - @Getter(AccessLevel.NONE) - @Setter(AccessLevel.NONE) - private transient Map> retrievers = new ConcurrentHashMap<>(); - - /** - * Request ID extracted from the event, or a generated value if the event has no - * request id; never {@code null}. - */ - private final UUID requestId; - - - /** - * Constructs the object. - * - * @param event event with which this is associated - */ - public ControlLoopEventContext(@NonNull VirtualControlLoopEvent event) { - this.event = event; - this.requestId = (event.getRequestId() != null ? event.getRequestId() : UUID.randomUUID()); - this.enrichment = (event.getAai() != null ? event.getAai() : Map.of()); - } - - /** - * Determines if the context contains a property. - * - * @param name name of the property of interest - * @return {@code true} if the context contains the property, {@code false} otherwise - */ - public boolean contains(String name) { - return properties.containsKey(name); - } - - /** - * Gets a property, casting it to the desired type. - * - * @param desired type - * @param name name of the property whose value is to be retrieved - * @return the property's value, or {@code null} if it does not yet have a value - */ - @SuppressWarnings("unchecked") - public T getProperty(String name) { - return (T) properties.get(name); - } - - /** - * Sets a property's value. - * - * @param name property name - * @param value new property value - */ - public void setProperty(String name, Serializable value) { - properties.put(name, value); - } - - /** - * Removes a property. - * @param name property name - */ - public void removeProperty(String name) { - properties.remove(name); - } - - /** - * Obtains the given property. - * - * @param name name of the desired property - * @param params parameters needed to perform the operation to retrieve the desired - * property - * @return a future for retrieving the property, {@code null} if the property has - * already been retrieved - */ - public CompletableFuture obtain(String name, ControlLoopOperationParams params) { - if (properties.containsKey(name)) { - return null; - } - - /* - * Return any existing future, if it wasn't canceled. Otherwise, start a new - * request. - */ - - // @formatter:off - CompletableFuture oldFuture = - retrievers.computeIfPresent(name, (key, future) -> future.isCancelled() ? null : future); - // @formatter:on - - if (oldFuture != null) { - return oldFuture; - } - - /* - * Note: must NOT invoke params.start() within retrievers.compute(), as start() - * may invoke obtain() which would cause a recursive update to the retrievers map. - */ - CompletableFuture future = params.start(); - - if ((oldFuture = retrievers.putIfAbsent(name, future)) != null) { - future.cancel(false); - return oldFuture; - } - - return future; - } -} diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java index c81575f62..e9f6b024c 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java @@ -24,7 +24,6 @@ import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -65,9 +64,7 @@ import org.slf4j.LoggerFactory; * Partial implementation of an operator. In general, it's preferable that subclasses * would override {@link #startOperationAsync(int, OperationOutcome) * startOperationAsync()}. However, if that proves to be too difficult, then they can - * simply override {@link #doOperation(int, OperationOutcome) doOperation()}. In addition, - * if the operation requires any preprocessor steps, the subclass may choose to override - * {@link #startPreprocessorAsync()}. + * simply override {@link #doOperation(int, OperationOutcome) doOperation()}. *

    * The futures returned by the methods within this class can be canceled, and will * propagate the cancellation to any subtasks. Thus it is also expected that any futures @@ -159,153 +156,36 @@ public abstract class OperationPartial implements Operation { return (T) properties.get(name); } - @Override - public CompletableFuture start() { - // allocate a controller for the entire operation - final PipelineControllerFuture controller = new PipelineControllerFuture<>(); - - CompletableFuture preproc = startPreprocessorAsync(); - if (preproc == null) { - // no preprocessor required - just start the operation - return startOperationAttempt(controller, 1); - } - - /* - * Do preprocessor first and then, if successful, start the operation. Note: - * operations create their own outcome, ignoring the outcome from any previous - * steps. - * - * Wrap the preprocessor to ensure "stop" is propagated to it. - */ - // @formatter:off - controller.wrap(preproc) - .exceptionally(fromException("preprocessor of operation")) - .thenCompose(handlePreprocessorFailure(controller)) - .thenCompose(unusedOutcome -> startOperationAttempt(controller, 1)) - .whenCompleteAsync(controller.delayedComplete(), params.getExecutor()); - // @formatter:on - - return controller; - } - /** - * Handles a failure in the preprocessor pipeline. If a failure occurred, then it - * invokes the call-backs, marks the controller complete, and returns an incomplete - * future, effectively halting the pipeline. Otherwise, it returns the outcome that it - * received. - *

    - * Assumes that no callbacks have been invoked yet. + * Gets a property value, throwing an exception if it's missing. * - * @param controller pipeline controller - * @return a function that checks the outcome status and continues, if successful, or - * indicates a failure otherwise + * @param name property name + * @param propertyType property type, used in an error message if the property value + * is {@code null} + * @return the property value */ - private Function> handlePreprocessorFailure( - PipelineControllerFuture controller) { - - return outcome -> { - - if (isSuccess(outcome)) { - logger.info("{}: preprocessor succeeded for {}", getFullName(), params.getRequestId()); - return CompletableFuture.completedFuture(outcome); - } - - logger.warn("preprocessor failed, discontinuing operation {} for {}", getFullName(), params.getRequestId()); - - final Executor executor = params.getExecutor(); - final CallbackManager callbacks = new CallbackManager(); - - // propagate "stop" to the callbacks - controller.add(callbacks); - - final OperationOutcome outcome2 = params.makeOutcome(getTargetEntity()); - - // TODO need a FAILURE_MISSING_DATA (e.g., A&AI) - - outcome2.setFinalOutcome(true); - outcome2.setResult(OperationResult.FAILURE_GUARD); - outcome2.setMessage(outcome != null ? outcome.getMessage() : null); - - // @formatter:off - CompletableFuture.completedFuture(outcome2) - .whenCompleteAsync(callbackStarted(callbacks), executor) - .whenCompleteAsync(callbackCompleted(callbacks), executor) - .whenCompleteAsync(controller.delayedComplete(), executor); - // @formatter:on - - return new CompletableFuture<>(); - }; - } - - /** - * Invokes the operation's preprocessor step(s) as a "future". This method simply - * returns {@code null}. - *

    - * This method assumes the following: - *

      - *
    • the operator is alive
    • - *
    • exceptions generated within the pipeline will be handled by the invoker
    • - *
    - * - * @return a function that will start the preprocessor and returns its outcome, or - * {@code null} if this operation needs no preprocessor - */ - protected CompletableFuture startPreprocessorAsync() { - return null; - } - - /** - * Invokes the operation's guard step(s) as a "future". - *

    - * This method assumes the following: - *

      - *
    • the operator is alive
    • - *
    • exceptions generated within the pipeline will be handled by the invoker
    • - *
    - * - * @return a function that will start the guard checks and returns its outcome, or - * {@code null} if this operation has no guard - */ - protected CompletableFuture startGuardAsync() { - if (params.isPreprocessed()) { - return null; + @SuppressWarnings("unchecked") + protected T getRequiredProperty(String name, String propertyType) { + T value = (T) properties.get(name); + if (value == null) { + throw new IllegalStateException("missing " + propertyType); } - // get the guard payload - Map payload = makeGuardPayload(); - - /* - * Note: can't use constants from actor.guard, because that would create a - * circular dependency. - */ - return params.toBuilder().actor(GUARD_ACTOR_NAME).operation(GUARD_OPERATION_NAME).retry(null).timeoutSec(null) - .payload(payload).build().start(); + return value; } - /** - * Creates a payload to execute a guard operation. - * - * @return a new guard payload - */ - protected Map makeGuardPayload() { - // TODO delete this once preprocessing is done by the application - Map guard = new LinkedHashMap<>(); - guard.put("actor", params.getActor()); - guard.put("operation", params.getOperation()); - guard.put("target", getTargetEntity()); - guard.put("requestId", params.getRequestId()); - - String clname = params.getContext().getEvent().getClosedLoopControlName(); - if (clname != null) { - guard.put("clname", clname); - } + @Override + public CompletableFuture start() { + // allocate a controller for the entire operation + final PipelineControllerFuture controller = new PipelineControllerFuture<>(); - return guard; + // start attempt #1 + return startOperationAttempt(controller, 1); } /** - * Starts the operation attempt, with no preprocessor. When all retries complete, it - * will complete the controller. + * Starts the operation attempt. When all retries complete, it will complete the + * controller. * * @param controller controller for all operation attempts * @param attempt attempt number, typically starting with 1 diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java index 0e4f09b66..67f68036b 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java @@ -33,13 +33,11 @@ import lombok.Getter; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.BeanValidator; import org.onap.policy.common.parameters.annotations.NotNull; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.ActorService; import org.onap.policy.controlloop.actorserviceprovider.Operation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.Util; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,14 +72,10 @@ public class ControlLoopOperationParams { private ActorService actorService; /** - * Event for which the operation applies. - */ - // TODO to be removed - private ControlLoopEventContext context; - - /** - * If {@code null}, this value is extracted from the context. + * Request ID with which all actor operations are associated. Used to track requests + * across various components/servers. */ + @NotNull private UUID requestId; /** @@ -106,6 +100,7 @@ public class ControlLoopOperationParams { * {@code True} if the preprocessing steps have already been executed, {@code false} * otherwise. */ + // TODO remove this once the rules no longer reference it private boolean preprocessed; /** @@ -194,11 +189,6 @@ public class ControlLoopOperationParams { * @return the event's request ID, or {@code null} if no request ID is available */ public UUID getRequestId() { - if (requestId == null && context != null && context.getEvent() != null) { - // cache the request ID - requestId = context.getEvent().getRequestId(); - } - return requestId; } @@ -266,34 +256,6 @@ public class ControlLoopOperationParams { * @return the validation result */ public BeanValidationResult validate() { - BeanValidationResult result = - new BeanValidator().validateTop(ControlLoopOperationParams.class.getSimpleName(), this); - - // validate that we have a request ID, or that we can get it from the context's - // event - - if (context == null) { - // no context specified - invoker must provide a request ID then - result.validateNotNull("requestId", requestId); - - } else if (requestId == null) { - // have a context, but no request ID - check the context's event for the - // request ID - BeanValidationResult contextResult = new BeanValidationResult("context", context); - VirtualControlLoopEvent event = context.getEvent(); - contextResult.validateNotNull("event", event); - - if (event != null) { - // cache the request id for later use - BeanValidationResult eventResult = new BeanValidationResult("event", event); - eventResult.validateNotNull("requestId", event.getRequestId()); - - contextResult.addResult(eventResult); - } - - result.addResult(contextResult); - } - - return result; + return new BeanValidator().validateTop(ControlLoopOperationParams.class.getSimpleName(), this); } } diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContextTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContextTest.java deleted file mode 100644 index 0f44f4f36..000000000 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/controlloop/ControlLoopEventContextTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop.actorserviceprovider.controlloop; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import org.junit.Before; -import org.junit.Test; -import org.onap.policy.controlloop.VirtualControlLoopEvent; -import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; -import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; - -public class ControlLoopEventContextTest { - private static final String MY_KEY = "def"; - private static final UUID REQ_ID = UUID.randomUUID(); - private static final String ITEM_KEY = "obtain-C"; - - private Map enrichment; - private VirtualControlLoopEvent event; - private ControlLoopEventContext context; - - /** - * Initializes data, including {@link #context}. - */ - @Before - public void setUp() { - enrichment = Map.of("abc", "one", MY_KEY, "two"); - - event = new VirtualControlLoopEvent(); - event.setRequestId(REQ_ID); - event.setAai(enrichment); - - context = new ControlLoopEventContext(event); - } - - @Test - public void testControlLoopEventContext() { - assertSame(event, context.getEvent()); - assertSame(REQ_ID, context.getRequestId()); - assertEquals(enrichment, context.getEnrichment()); - - // null event - assertThatThrownBy(() -> new ControlLoopEventContext(null)); - - // no request id, no enrichment data - event.setRequestId(null); - event.setAai(null); - context = new ControlLoopEventContext(event); - assertSame(event, context.getEvent()); - assertNotNull(context.getRequestId()); - assertEquals(Map.of(), context.getEnrichment()); - } - - @Test - public void testContains_testGetProperty_testSetProperty_testRemoveProperty() { - context.setProperty("abc", "a string"); - context.setProperty(MY_KEY, 100); - - assertTrue(context.contains(MY_KEY)); - assertFalse(context.contains("ghi")); - - String strValue = context.getProperty("abc"); - assertEquals("a string", strValue); - - int intValue = context.getProperty(MY_KEY); - assertEquals(100, intValue); - - context.removeProperty(MY_KEY); - assertFalse(context.contains(MY_KEY)); - } - - @Test - public void testObtain() { - final ControlLoopOperationParams params = mock(ControlLoopOperationParams.class); - - // property is already loaded - context.setProperty("obtain-A", "value-A"); - assertNull(context.obtain("obtain-A", params)); - - // new property - should retrieve - CompletableFuture future = new CompletableFuture<>(); - when(params.start()).thenReturn(future); - assertSame(future, context.obtain("obtain-B", params)); - - // repeat - should get the same future, without invoking start() again - assertSame(future, context.obtain("obtain-B", params)); - verify(params).start(); - - // arrange for another invoker to start while this one is starting - CompletableFuture future2 = new CompletableFuture<>(); - - when(params.start()).thenAnswer(args -> { - - ControlLoopOperationParams params2 = mock(ControlLoopOperationParams.class); - when(params2.start()).thenReturn(future2); - - assertSame(future2, context.obtain(ITEM_KEY, params2)); - return future; - }); - - assertSame(future2, context.obtain(ITEM_KEY, params)); - - // should have canceled the interrupted future - assertTrue(future.isCancelled()); - - // return a new future next time start() is called - CompletableFuture future3 = new CompletableFuture<>(); - when(params.start()).thenReturn(future3); - - // repeat - should get the same future - assertSame(future2, context.obtain(ITEM_KEY, params)); - assertSame(future2, context.obtain(ITEM_KEY, params)); - - // future2 should still be active - assertFalse(future2.isCancelled()); - - // cancel it - now we should get the new future - future2.cancel(false); - assertSame(future3, context.obtain(ITEM_KEY, params)); - } -} diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java index 453592d2b..587313a46 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java @@ -77,10 +77,8 @@ import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.onap.policy.common.gson.GsonMessageBodyHandler; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.network.NetworkUtil; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams; @@ -118,8 +116,6 @@ public class HttpOperationTest { @Mock private Executor executor; - private VirtualControlLoopEvent event; - private ControlLoopEventContext context; private ControlLoopOperationParams params; private OperationOutcome outcome; private AtomicReference> callback; @@ -184,11 +180,7 @@ public class HttpOperationTest { when(response.readEntity(String.class)).thenReturn(TEXT); when(response.getStatus()).thenReturn(200); - event = new VirtualControlLoopEvent(); - event.setRequestId(REQ_ID); - - context = new ControlLoopEventContext(event); - params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).context(context).build(); + params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).requestId(REQ_ID).build(); outcome = params.makeOutcome(null); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java index 5ae804aea..af8f1aaab 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java @@ -30,6 +30,7 @@ import static org.mockito.Mockito.when; import java.util.Collections; import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import org.junit.Before; import org.junit.Test; @@ -37,11 +38,9 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactory; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.Operation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.Util; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams; @@ -112,10 +111,8 @@ public class HttpOperatorTest { assertNotNull(oper2); assertNotNull(oper2.getClientFactory()); - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - ControlLoopEventContext context = new ControlLoopEventContext(event); - ControlLoopOperationParams params = - ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).context(context).build(); + ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION) + .requestId(UUID.randomUUID()).build(); // configure and start it HttpParams params2 = HttpParams.builder().clientName(HTTP_CLIENT).path(PATH).timeoutSec(TIMEOUT).build(); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java index 455393c93..b7a6a1d3b 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java @@ -29,7 +29,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import ch.qos.logback.classic.Logger; @@ -60,7 +59,6 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; @@ -71,14 +69,12 @@ import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.test.log.logback.ExtractAppender; import org.onap.policy.common.utils.time.PseudoExecutor; import org.onap.policy.controlloop.ControlLoopOperation; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.ActorService; import org.onap.policy.controlloop.actorserviceprovider.Operation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.Operator; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.OperatorConfig; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; @@ -119,8 +115,6 @@ public class OperationPartialTest { @Mock private Operation guardOperation; - private VirtualControlLoopEvent event; - private ControlLoopEventContext context; private PseudoExecutor executor; private ControlLoopOperationParams params; @@ -167,14 +161,9 @@ public class OperationPartialTest { @Before public void setUp() { MockitoAnnotations.initMocks(this); - - event = new VirtualControlLoopEvent(); - event.setRequestId(REQ_ID); - - context = new ControlLoopEventContext(event); executor = new PseudoExecutor(); - params = ControlLoopOperationParams.builder().completeCallback(this::completer).context(context) + params = ControlLoopOperationParams.builder().completeCallback(this::completer).requestId(REQ_ID) .executor(executor).actorService(service).actor(ACTOR).operation(OPERATION).timeoutSec(TIMEOUT) .startCallback(this::starter).targetEntity(MY_TARGET_ENTITY).build(); @@ -226,14 +215,20 @@ public class OperationPartialTest { } @Test - public void testGetProperty_testSetProperty() { + public void testGetProperty_testSetProperty_testGetRequiredProperty() { oper.setProperty("propertyA", "valueA"); oper.setProperty("propertyB", "valueB"); oper.setProperty("propertyC", 20); + oper.setProperty("propertyD", "valueD"); assertEquals("valueA", oper.getProperty("propertyA")); assertEquals("valueB", oper.getProperty("propertyB")); assertEquals(Integer.valueOf(20), oper.getProperty("propertyC")); + + assertEquals("valueD", oper.getRequiredProperty("propertyD", "typeD")); + + assertThatIllegalStateException().isThrownBy(() -> oper.getRequiredProperty("propertyUnknown", "some type")) + .withMessage("missing some type"); } @Test @@ -261,118 +256,6 @@ public class OperationPartialTest { assertEquals(MAX_PARALLEL, numEnd); } - /** - * Tests startPreprocessor() when the preprocessor returns a failure. - */ - @Test - public void testStartPreprocessorFailure() { - oper.setPreProc(CompletableFuture.completedFuture(makeFailure())); - - verifyRun("testStartPreprocessorFailure", 1, 0, OperationResult.FAILURE_GUARD); - } - - /** - * Tests startPreprocessor() when the preprocessor throws an exception. - */ - @Test - public void testStartPreprocessorException() { - // arrange for the preprocessor to throw an exception - oper.setPreProc(CompletableFuture.failedFuture(new IllegalStateException(EXPECTED_EXCEPTION))); - - verifyRun("testStartPreprocessorException", 1, 0, OperationResult.FAILURE_GUARD); - } - - /** - * Tests startPreprocessor() when the pipeline is not running. - */ - @Test - public void testStartPreprocessorNotRunning() { - // arrange for the preprocessor to return success, which will be ignored - // oper.setGuard(CompletableFuture.completedFuture(makeSuccess())); - - oper.start().cancel(false); - assertTrue(executor.runAll(MAX_REQUESTS)); - - assertNull(opstart); - assertNull(opend); - - assertEquals(0, numStart); - assertEquals(0, oper.getCount()); - assertEquals(0, numEnd); - } - - /** - * Tests startPreprocessor() when the preprocessor builder throws an exception. - */ - @Test - public void testStartPreprocessorBuilderException() { - oper = new MyOper() { - @Override - protected CompletableFuture startPreprocessorAsync() { - throw new IllegalStateException(EXPECTED_EXCEPTION); - } - }; - - assertThatIllegalStateException().isThrownBy(() -> oper.start()); - - // should be nothing in the queue - assertEquals(0, executor.getQueueLength()); - } - - @Test - public void testStartPreprocessorAsync() { - assertNull(oper.startPreprocessorAsync()); - } - - @Test - public void testStartGuardAsync() throws Exception { - CompletableFuture future = oper.startGuardAsync(); - assertTrue(future.isDone()); - assertEquals(OperationResult.SUCCESS, future.get().getResult()); - - // verify the parameters that were passed - ArgumentCaptor paramsCaptor = - ArgumentCaptor.forClass(ControlLoopOperationParams.class); - verify(guardOperator).buildOperation(paramsCaptor.capture()); - - params = paramsCaptor.getValue(); - assertEquals(OperationPartial.GUARD_ACTOR_NAME, params.getActor()); - assertEquals(OperationPartial.GUARD_OPERATION_NAME, params.getOperation()); - assertNull(params.getRetry()); - assertNull(params.getTimeoutSec()); - - Map payload = params.getPayload(); - assertNotNull(payload); - - assertEquals(oper.makeGuardPayload(), payload); - } - - /** - * Tests startGuardAsync() when preprocessing is disabled. - */ - @Test - public void testStartGuardAsyncDisabled() { - params = params.toBuilder().preprocessed(true).build(); - assertNull(new MyOper().startGuardAsync()); - } - - @Test - public void testMakeGuardPayload() { - Map payload = oper.makeGuardPayload(); - assertSame(REQ_ID, payload.get("requestId")); - - // request id changes, so remove it - payload.remove("requestId"); - - assertEquals("{actor=my-actor, operation=my-operation, target=my-entity}", payload.toString()); - - // repeat, but with closed loop name - event.setClosedLoopControlName("my-loop"); - payload = oper.makeGuardPayload(); - payload.remove("requestId"); - assertEquals("{actor=my-actor, operation=my-operation, target=my-entity, clname=my-loop}", payload.toString()); - } - @Test public void testStartOperationAsync() { oper.start(); @@ -616,34 +499,6 @@ public class OperationPartialTest { assertTrue(oper.isSameOperation(outcome)); } - /** - * Tests handleFailure() when the outcome is a success. - */ - @Test - public void testHandlePreprocessorFailureSuccess() { - oper.setPreProc(CompletableFuture.completedFuture(makeSuccess())); - verifyRun("testHandlePreprocessorFailureTrue", 1, 1, OperationResult.SUCCESS); - } - - /** - * Tests handleFailure() when the outcome is not a success. - */ - @Test - public void testHandlePreprocessorFailureFailed() throws Exception { - oper.setPreProc(CompletableFuture.completedFuture(makeFailure())); - verifyRun("testHandlePreprocessorFailureFalse", 1, 0, OperationResult.FAILURE_GUARD); - } - - /** - * Tests handleFailure() when the outcome is {@code null}. - */ - @Test - public void testHandlePreprocessorFailureNull() throws Exception { - // arrange to return a null outcome from the preprocessor - oper.setPreProc(CompletableFuture.completedFuture(null)); - verifyRun("testHandlePreprocessorFailureNull", 1, 0, OperationResult.FAILURE_GUARD); - } - @Test public void testFromException() { // arrange to generate an exception when operation runs @@ -1204,13 +1059,6 @@ public class OperationPartialTest { return outcome; } - private OperationOutcome makeFailure() { - OperationOutcome outcome = params.makeOutcome(null); - outcome.setResult(OperationResult.FAILURE); - - return outcome; - } - /** * Verifies a run. * @@ -1358,10 +1206,5 @@ public class OperationPartialTest { */ return 0L; } - - @Override - protected CompletableFuture startPreprocessorAsync() { - return (preProc != null ? preProc : super.startPreprocessorAsync()); - } } } diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java index caa840891..b6bd50c7e 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java @@ -49,18 +49,15 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.policy.common.parameters.BeanValidationResult; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.ActorService; import org.onap.policy.controlloop.actorserviceprovider.Operation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.Operator; -import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams.ControlLoopOperationParamsBuilder; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; public class ControlLoopOperationParamsTest { private static final String NULL_MSG = "null"; - private static final String REQUEST_ID_NAME = "requestId"; private static final String EXPECTED_EXCEPTION = "expected exception"; private static final String ACTOR = "my-actor"; private static final String OPERATION = "my-operation"; @@ -68,7 +65,6 @@ public class ControlLoopOperationParamsTest { private static final Integer RETRY = 3; private static final Integer TIMEOUT = 100; private static final UUID REQ_ID = UUID.randomUUID(); - private static final UUID REQ_ID2 = UUID.randomUUID(); @Mock private Actor actor; @@ -79,12 +75,6 @@ public class ControlLoopOperationParamsTest { @Mock private Consumer completer; - @Mock - private ControlLoopEventContext context; - - @Mock - private VirtualControlLoopEvent event; - @Mock private Executor executor; @@ -118,14 +108,10 @@ public class ControlLoopOperationParamsTest { when(operator.buildOperation(any())).thenReturn(operation); when(operation.start()).thenReturn(operFuture); - when(event.getRequestId()).thenReturn(REQ_ID); - - when(context.getEvent()).thenReturn(event); - payload = new TreeMap<>(); params = ControlLoopOperationParams.builder().actorService(actorService).completeCallback(completer) - .context(context).executor(executor).actor(ACTOR).operation(OPERATION).payload(payload) + .requestId(REQ_ID).executor(executor).actor(ACTOR).operation(OPERATION).payload(payload) .retry(RETRY).targetEntity(TARGET_ENTITY).timeoutSec(TIMEOUT) .startCallback(starter).preprocessed(true).build(); @@ -134,14 +120,14 @@ public class ControlLoopOperationParamsTest { @Test public void testStart() { - assertThatIllegalArgumentException().isThrownBy(() -> params.toBuilder().context(null).build().start()); + assertThatIllegalArgumentException().isThrownBy(() -> params.toBuilder().requestId(null).build().start()); assertSame(operFuture, params.start()); } @Test public void testBuild() { - assertThatIllegalArgumentException().isThrownBy(() -> params.toBuilder().context(null).build().build()); + assertThatIllegalArgumentException().isThrownBy(() -> params.toBuilder().requestId(null).build().build()); assertSame(operation, params.build()); } @@ -149,26 +135,6 @@ public class ControlLoopOperationParamsTest { @Test public void testGetRequestId() { assertSame(REQ_ID, params.getRequestId()); - - // when both request ID and event request ID are set - should use request ID - // parameter - assertSame(REQ_ID2, params.toBuilder().requestId(REQ_ID2).build().getRequestId()); - } - - /** - * Tests getRequestId() when the request ID is not available in the context. - */ - @Test - public void testGetRequestIdNotFromContext() { - // try with null context - assertNull(params.toBuilder().context(null).build().getRequestId()); - - // try with null event - when(context.getEvent()).thenReturn(null); - assertNull(params.getRequestId()); - - // set request ID directly - assertSame(REQ_ID2, params.toBuilder().requestId(REQ_ID2).build().getRequestId()); } @Test @@ -243,14 +209,12 @@ public class ControlLoopOperationParamsTest { testValidate("actorService", NULL_MSG, bldr -> bldr.actorService(null)); testValidate("executor", NULL_MSG, bldr -> bldr.executor(null)); testValidate("operation", NULL_MSG, bldr -> bldr.operation(null)); + testValidate("requestId", NULL_MSG, bldr -> bldr.requestId(null)); // has no target entity BeanValidationResult result = params.toBuilder().targetEntity(null).build().validate(); assertTrue(result.isValid()); - // note: if context is null, then it will ACTUALLY complain about the request ID - testValidate(REQUEST_ID_NAME, NULL_MSG, bldr -> bldr.context(null)); - // check edge cases assertTrue(params.toBuilder().build().validate().isValid()); @@ -259,28 +223,8 @@ public class ControlLoopOperationParamsTest { .completeCallback(null).build().validate().isValid()); // test with minimal fields - assertTrue(ControlLoopOperationParams.builder().actorService(actorService).context(context).actor(ACTOR) + assertTrue(ControlLoopOperationParams.builder().actorService(actorService).requestId(REQ_ID).actor(ACTOR) .operation(OPERATION).targetEntity(TARGET_ENTITY).build().validate().isValid()); - - // test when event has no request ID - when(event.getRequestId()).thenReturn(null); - result = params.validate(); - assertFalse(result.isValid()); - assertThat(result.getResult()).contains("event").contains(REQUEST_ID_NAME).contains(NULL_MSG); - - // try when context has no event - when(context.getEvent()).thenReturn(null); - result = params.validate(); - assertFalse(result.isValid()); - assertThat(result.getResult()).contains("event").doesNotContain(REQUEST_ID_NAME).contains(NULL_MSG); - - // has both request ID and context, but no event - result = params.toBuilder().requestId(REQ_ID2).build().validate(); - assertTrue(result.isValid()); - - // has request ID, but not context - result = params.toBuilder().requestId(REQ_ID2).context(null).build().validate(); - assertTrue(result.isValid()); } private void testValidate(String fieldName, String expected, @@ -311,11 +255,6 @@ public class ControlLoopOperationParamsTest { assertSame(actorService, params.getActorService()); } - @Test - public void testGetContext() { - assertSame(context, params.getContext()); - } - @Test public void testGetExecutor() { assertSame(executor, params.getExecutor()); -- cgit 1.2.3-korg