aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/actors
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-05-08 14:33:57 -0400
committerJim Hahn <jrh3@att.com>2019-05-08 16:24:35 -0400
commit10b21aae2bde224ab7f91f4b5ab1b89369c8fd1c (patch)
tree0417099e379e8be69f90221e8fd066fc40def62b /controlloop/common/actors
parent01841878936986bc80a974977ccdeaceaf7f9a78 (diff)
Add payload to vFW policy yaml
Added new "streams" payload to vFW policy yaml files. Removed references to pg-streams. Also deleted directories that were moved to policy/models. Also removed references to trafficgenerator. Updated licenses. Removed some trailing whitespace. Change-Id: I6becaa573628eee677f0959fadf86f9a9f032f88 Issue-ID: POLICY-1752 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/actors')
-rw-r--r--controlloop/common/actors/actor.appc/pom.xml87
-rw-r--r--controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java126
-rw-r--r--controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java178
-rw-r--r--controlloop/common/actors/actor.appclcm/pom.xml87
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java359
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java47
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java442
-rw-r--r--controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java98
-rw-r--r--controlloop/common/actors/actor.sdnc/pom.xml82
-rw-r--r--controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java199
-rw-r--r--controlloop/common/actors/actor.sdnc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java115
-rw-r--r--controlloop/common/actors/actor.sdnr/pom.xml81
-rw-r--r--controlloop/common/actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java290
-rw-r--r--controlloop/common/actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java169
-rw-r--r--controlloop/common/actors/actor.so/pom.xml93
-rw-r--r--controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java457
-rw-r--r--controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java230
-rw-r--r--controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json267
-rw-r--r--controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json230
-rw-r--r--controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json197
-rw-r--r--controlloop/common/actors/actor.test/pom.xml84
-rw-r--r--controlloop/common/actors/actor.vfc/pom.xml82
-rw-r--r--controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java151
-rw-r--r--controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java118
-rw-r--r--controlloop/common/actors/actorServiceProvider/pom.xml40
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java72
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java35
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java53
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/DummyActor.java60
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/test/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor1
-rw-r--r--controlloop/common/actors/pom.xml55
37 files changed, 0 insertions, 4591 deletions
diff --git a/controlloop/common/actors/actor.appc/pom.xml b/controlloop/common/actors/actor.appc/pom.xml
deleted file mode 100644
index a7f1f5ada..000000000
--- a/controlloop/common/actors/actor.appc/pom.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2017-2018 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.appc</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>appc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>trafficgenerator</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${version.policy.common}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${version.policy.drools-pdp}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java
deleted file mode 100644
index 264498637..000000000
--- a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * APPCActorServiceProvider
- * ================================================================================
- * Copyright (C) 2017-2019 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.actor.appc;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.onap.policy.appc.CommonHeader;
-import org.onap.policy.appc.Request;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.vnf.trafficgenerator.PgRequest;
-import org.onap.policy.vnf.trafficgenerator.PgStream;
-import org.onap.policy.vnf.trafficgenerator.PgStreams;
-
-
-public class AppcActorServiceProvider implements Actor {
- // Strings for targets
- private static final String TARGET_VM = "VM";
- private static final String TARGET_VNF = "VNF";
-
- // Strings for recipes
- private static final String RECIPE_RESTART = "Restart";
- private static final String RECIPE_REBUILD = "Rebuild";
- private static final String RECIPE_MIGRATE = "Migrate";
- private static final String RECIPE_MODIFY = "ModifyConfig";
-
- private static final ImmutableList<String> recipes =
- ImmutableList.of(RECIPE_RESTART, RECIPE_REBUILD, RECIPE_MIGRATE, RECIPE_MODIFY);
- private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>()
- .put(RECIPE_RESTART, ImmutableList.of(TARGET_VM)).put(RECIPE_REBUILD, ImmutableList.of(TARGET_VM))
- .put(RECIPE_MIGRATE, ImmutableList.of(TARGET_VM)).put(RECIPE_MODIFY, ImmutableList.of(TARGET_VNF)).build();
- private static final ImmutableMap<String, List<String>> payloads = new ImmutableMap.Builder<String, List<String>>()
- .put(RECIPE_MODIFY, ImmutableList.of("generic-vnf.vnf-id")).build();
-
- @Override
- public String actor() {
- return "APPC";
- }
-
- @Override
- public List<String> recipes() {
- return ImmutableList.copyOf(recipes);
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList()));
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- return ImmutableList.copyOf(payloads.getOrDefault(recipe, Collections.emptyList()));
- }
-
- /**
- * Constructs an APPC request conforming to the legacy API. The legacy API will be deprecated in
- * future releases as all legacy functionality is moved into the LCM API.
- *
- * @param onset the event that is reporting the alert for policy to perform an action
- * @param operation the control loop operation specifying the actor, operation, target, etc.
- * @param policy the policy the was specified from the yaml generated by CLAMP or through the
- * Policy GUI/API
- * @return an APPC request conforming to the legacy API
- */
- public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy,
- String targetVnf) {
- /*
- * Construct an APPC request
- */
- Request request = new Request();
- request.setCommonHeader(new CommonHeader());
- request.getCommonHeader().setRequestId(onset.getRequestId());
- request.getCommonHeader().setSubRequestId(operation.getSubRequestId());
- request.setAction(policy.getRecipe().substring(0, 1).toUpperCase() + policy.getRecipe().substring(1));
-
- /*
- * For now Policy generates the PG Streams as a demo, in the future the payload can be
- * provided by CLAMP
- */
- request.getPayload().put("generic-vnf.vnf-id", targetVnf);
-
- PgRequest pgRequest = new PgRequest();
- pgRequest.pgStreams = new PgStreams();
-
- PgStream pgStream;
- for (int i = 0; i < 5; i++) {
- pgStream = new PgStream();
- pgStream.streamId = "fw_udp" + (i + 1);
- pgStream.isEnabled = "true";
- pgRequest.pgStreams.pgStream.add(pgStream);
- }
- request.getPayload().put("pg-streams", pgRequest.pgStreams);
-
- /*
- * Return the request
- */
-
- return request;
- }
-
-
-}
diff --git a/controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
deleted file mode 100644
index f1002a301..000000000
--- a/controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actor.appc.AppcActorServiceProvider \ No newline at end of file
diff --git a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
deleted file mode 100644
index 9f8528fe0..000000000
--- a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * AppcServiceProviderTest
- * ================================================================================
- * Copyright (C) 2017-2018 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.actor.appc;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.time.Instant;
-import java.util.HashMap;
-import java.util.UUID;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.appc.Request;
-import org.onap.policy.appc.Response;
-import org.onap.policy.appc.ResponseCode;
-import org.onap.policy.appc.util.Serialization;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.controlloop.ControlLoopEventStatus;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopTargetType;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.Target;
-import org.onap.policy.controlloop.policy.TargetType;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.simulators.Util;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AppcServiceProviderTest {
-
- private static final Logger logger = LoggerFactory.getLogger(AppcServiceProviderTest.class);
-
- private static final VirtualControlLoopEvent onsetEvent;
- private static final ControlLoopOperation operation;
- private static final Policy policy;
-
- static {
- /*
- * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of
- * VM.
- */
- onsetEvent = new VirtualControlLoopEvent();
- onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
- onsetEvent.setRequestId(UUID.randomUUID());
- onsetEvent.setClosedLoopEventClient("tca.instance00001");
- onsetEvent.setTargetType(ControlLoopTargetType.VNF);
- onsetEvent.setTarget("generic-vnf.vnf-name");
- onsetEvent.setFrom("DCAE");
- onsetEvent.setClosedLoopAlarmStart(Instant.now());
- onsetEvent.setAai(new HashMap<>());
- onsetEvent.getAai().put("generic-vnf.vnf-name", "fw0001vm001fw001");
- onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
-
- /* Construct an operation with an APPC actor and ModifyConfig operation. */
- operation = new ControlLoopOperation();
- operation.setActor("APPC");
- operation.setOperation("ModifyConfig");
- operation.setTarget("VNF");
- operation.setEnd(Instant.now());
- operation.setSubRequestId("1");
-
- /* Construct a policy specifying to modify configuration. */
- policy = new Policy();
- policy.setName("Modify Packet Generation Config");
- policy.setDescription("Upon getting the trigger event, modify packet gen config");
- policy.setActor("APPC");
- policy.setTarget(new Target(TargetType.VNF));
- policy.getTarget().setResourceID("Eace933104d443b496b8.nodes.heat.vpg");
- policy.setRecipe("ModifyConfig");
- policy.setPayload(null);
- policy.setRetry(2);
- policy.setTimeout(300);
-
- /* Set environment properties */
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
-
- }
-
- /**
- * Set up before test class.
- */
- @BeforeClass
- public static void setUpSimulator() {
- try {
- Util.buildAaiSim();
- } catch (Exception e) {
- fail(e.getMessage());
- }
- }
-
- /**
- * Tear down after test class.
- */
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
-
- @Test
- public void constructModifyConfigRequestTest() {
-
- Request appcRequest;
- appcRequest = AppcActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01");
-
- /* The service provider must return a non null APPC request */
- assertNotNull(appcRequest);
-
- /* A common header is required and cannot be null */
- assertNotNull(appcRequest.getCommonHeader());
- assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestId());
-
- /* An action is required and cannot be null */
- assertNotNull(appcRequest.getAction());
- assertEquals("ModifyConfig", appcRequest.getAction());
-
- /* A payload is required and cannot be null */
- assertNotNull(appcRequest.getPayload());
- assertTrue(appcRequest.getPayload().containsKey("generic-vnf.vnf-id"));
- assertNotNull(appcRequest.getPayload().get("generic-vnf.vnf-id"));
- assertTrue(appcRequest.getPayload().containsKey("pg-streams"));
-
- logger.debug("APPC Request: \n" + appcRequest.toString());
-
- /* Print out request as json to make sure serialization works */
- String jsonRequest = Serialization.gsonPretty.toJson(appcRequest);
- logger.debug("JSON Output: \n" + jsonRequest);
-
- /* The JSON string must contain the following fields */
- assertTrue(jsonRequest.contains("CommonHeader"));
- assertTrue(jsonRequest.contains("Action"));
- assertTrue(jsonRequest.contains("ModifyConfig"));
- assertTrue(jsonRequest.contains("Payload"));
- assertTrue(jsonRequest.contains("generic-vnf.vnf-id"));
- assertTrue(jsonRequest.contains("pg-streams"));
-
- Response appcResponse = new Response(appcRequest);
- appcResponse.getStatus().setCode(ResponseCode.SUCCESS.getValue());
- appcResponse.getStatus().setDescription("AppC success");
- /* Print out request as json to make sure serialization works */
- String jsonResponse = Serialization.gsonPretty.toJson(appcResponse);
- logger.debug("JSON Output: \n" + jsonResponse);
- }
-
- @Test
- public void testMethods() {
- AppcActorServiceProvider sp = new AppcActorServiceProvider();
-
- assertEquals("APPC", sp.actor());
- assertEquals(4, sp.recipes().size());
- assertEquals("VM", sp.recipeTargets("Restart").get(0));
- assertEquals(0, sp.recipePayloads("Restart").size());
- }
-}
diff --git a/controlloop/common/actors/actor.appclcm/pom.xml b/controlloop/common/actors/actor.appclcm/pom.xml
deleted file mode 100644
index 28f9c1c60..000000000
--- a/controlloop/common/actors/actor.appclcm/pom.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2017-2018 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.appclcm</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>appclcm</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${version.policy.common}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${version.policy.drools-pdp}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
deleted file mode 100644
index 5c82a9500..000000000
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * AppcLcmActorServiceProvider
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications copyright (c) 2018 Nokia
- * ================================================================================
- * 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.actor.appclcm;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import java.util.AbstractMap;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.onap.policy.aai.AaiManager;
-import org.onap.policy.aai.AaiNqInstanceFilters;
-import org.onap.policy.aai.AaiNqInventoryResponseItem;
-import org.onap.policy.aai.AaiNqNamedQuery;
-import org.onap.policy.aai.AaiNqQueryParameters;
-import org.onap.policy.aai.AaiNqRequest;
-import org.onap.policy.aai.AaiNqResponse;
-import org.onap.policy.aai.util.AaiException;
-import org.onap.policy.appclcm.LcmCommonHeader;
-import org.onap.policy.appclcm.LcmRequest;
-import org.onap.policy.appclcm.LcmRequestWrapper;
-import org.onap.policy.appclcm.LcmResponse;
-import org.onap.policy.appclcm.LcmResponseCode;
-import org.onap.policy.appclcm.LcmResponseWrapper;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.rest.RestManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AppcLcmActorServiceProvider implements Actor {
-
- private static final Logger logger = LoggerFactory.getLogger(AppcLcmActorServiceProvider.class);
-
- /* To be used in future releases to restart a single vm */
- private static final String APPC_VM_ID = "vm-id";
-
- // Strings for targets
- private static final String TARGET_VM = "VM";
- private static final String TARGET_VNF = "VNF";
-
- // Strings for recipes
- private static final String RECIPE_RESTART = "Restart";
- private static final String RECIPE_REBUILD = "Rebuild";
- private static final String RECIPE_MIGRATE = "Migrate";
- private static final String RECIPE_MODIFY = "ConfigModify";
-
- /* To be used in future releases when LCM ConfigModify is used */
- private static final String APPC_REQUEST_PARAMS = "request-parameters";
- private static final String APPC_CONFIG_PARAMS = "configuration-parameters";
-
- private static final ImmutableList<String> recipes =
- ImmutableList.of(RECIPE_RESTART, RECIPE_REBUILD, RECIPE_MIGRATE, RECIPE_MODIFY);
- private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>()
- .put(RECIPE_RESTART, ImmutableList.of(TARGET_VM)).put(RECIPE_REBUILD, ImmutableList.of(TARGET_VM))
- .put(RECIPE_MIGRATE, ImmutableList.of(TARGET_VM)).put(RECIPE_MODIFY, ImmutableList.of(TARGET_VNF)).build();
- private static final ImmutableMap<String, List<String>> payloads =
- new ImmutableMap.Builder<String, List<String>>().put(RECIPE_RESTART, ImmutableList.of(APPC_VM_ID))
- .put(RECIPE_MODIFY, ImmutableList.of(APPC_REQUEST_PARAMS, APPC_CONFIG_PARAMS)).build();
-
- @Override
- public String actor() {
- return "APPC";
- }
-
- @Override
- public List<String> recipes() {
- return ImmutableList.copyOf(recipes);
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList()));
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- return ImmutableList.copyOf(payloads.getOrDefault(recipe, Collections.emptyList()));
- }
-
- /**
- * This method recursively traverses the A&AI named query response to find the generic-vnf
- * object that contains a model-invariant-id that matches the resourceId of the policy. Once
- * this match is found the generic-vnf object's vnf-id is returned.
- *
- * @param items the list of items related to the vnf returned by A&AI
- * @param resourceId the id of the target from the sdc catalog
- *
- * @return the vnf-id of the target vnf to act upon or null if not found
- */
- private static String parseAaiResponse(List<AaiNqInventoryResponseItem> items, String resourceId) {
- String vnfId = null;
- for (AaiNqInventoryResponseItem item : items) {
- if ((item.getGenericVnf() != null) && (item.getGenericVnf().getModelInvariantId() != null)
- && (resourceId.equals(item.getGenericVnf().getModelInvariantId()))) {
- vnfId = item.getGenericVnf().getVnfId();
- break;
- } else {
- if ((item.getItems() != null) && (item.getItems().getInventoryResponseItems() != null)) {
- vnfId = parseAaiResponse(item.getItems().getInventoryResponseItems(), resourceId);
- }
- }
- }
- return vnfId;
- }
-
- /**
- * Constructs an A&AI Named Query using a source vnf-id to determine the vnf-id of the target
- * entity specified in the policy to act upon.
- *
- * @param resourceId the id of the target from the sdc catalog
- *
- * @param sourceVnfId the vnf id of the source entity reporting the alert
- *
- * @return the target entities vnf id to act upon
- * @throws AaiException it an error occurs
- */
- public static String vnfNamedQuery(String resourceId, String sourceVnfId) throws AaiException {
-
- // TODO: This request id should not be hard coded in future releases
- UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087");
-
- AaiNqRequest aaiRequest = new AaiNqRequest();
- aaiRequest.setQueryParameters(new AaiNqQueryParameters());
- aaiRequest.getQueryParameters().setNamedQuery(new AaiNqNamedQuery());
- aaiRequest.getQueryParameters().getNamedQuery().setNamedQueryUuid(requestId);
-
- Map<String, Map<String, String>> filter = new HashMap<>();
- Map<String, String> filterItem = new HashMap<>();
-
- filterItem.put("vnf-id", sourceVnfId);
- filter.put("generic-vnf", filterItem);
-
- aaiRequest.setInstanceFilters(new AaiNqInstanceFilters());
- aaiRequest.getInstanceFilters().getInstanceFilter().add(filter);
-
- AaiNqResponse aaiResponse = new AaiManager(new RestManager()).postQuery(getPeManagerEnvProperty("aai.url"),
- getPeManagerEnvProperty("aai.username"), getPeManagerEnvProperty("aai.password"), aaiRequest,
- requestId);
-
- if (aaiResponse == null) {
- throw new AaiException("The named query response was null");
- }
-
- String targetVnfId = parseAaiResponse(aaiResponse.getInventoryResponseItems(), resourceId);
- if (targetVnfId == null) {
- throw new AaiException("Target vnf-id could not be found");
- }
-
- return targetVnfId;
- }
-
- /**
- * Constructs an APPC request conforming to the lcm API. The actual request is constructed and
- * then placed in a wrapper object used to send through DMAAP.
- *
- * @param onset the event that is reporting the alert for policy to perform an action
- * @param operation the control loop operation specifying the actor, operation, target, etc.
- * @param policy the policy the was specified from the yaml generated by CLAMP or through the
- * Policy GUI/API
- * @return an APPC request conforming to the lcm API using the DMAAP wrapper
- */
- public static LcmRequestWrapper constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
- Policy policy, String targetVnf) {
-
- /* Construct an APPC request using LCM Model */
-
- /*
- * The actual LCM request is placed in a wrapper used to send through dmaap. The current
- * version is 2.0 as of R1.
- */
- AppcLcmRecipeFormatter lcmRecipeFormatter = new AppcLcmRecipeFormatter(policy.getRecipe());
-
- LcmRequestWrapper dmaapRequest = new LcmRequestWrapper();
- dmaapRequest.setVersion("2.0");
- dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + operation.getSubRequestId());
- dmaapRequest.setRpcName(lcmRecipeFormatter.getUrlRecipe());
- dmaapRequest.setType("request");
-
- /* This is the actual request that is placed in the dmaap wrapper. */
- final LcmRequest appcRequest = new LcmRequest();
-
- /* The common header is a required field for all APPC requests. */
- LcmCommonHeader requestCommonHeader = new LcmCommonHeader();
- requestCommonHeader.setOriginatorId(onset.getRequestId().toString());
- requestCommonHeader.setRequestId(onset.getRequestId());
- requestCommonHeader.setSubRequestId(operation.getSubRequestId());
-
- appcRequest.setCommonHeader(requestCommonHeader);
-
- /*
- * Action Identifiers are required for APPC LCM requests. For R1, the recipes supported by
- * Policy only require a vnf-id.
- */
- HashMap<String, String> requestActionIdentifiers = new HashMap<>();
- requestActionIdentifiers.put("vnf-id", targetVnf);
-
- appcRequest.setActionIdentifiers(requestActionIdentifiers);
-
- /*
- * An action is required for all APPC requests, this will be the recipe specified in the
- * policy.
- */
- appcRequest.setAction(lcmRecipeFormatter.getBodyRecipe());
-
- /*
- * For R1, the payloads will not be required for the Restart, Rebuild, or Migrate recipes.
- * APPC will populate the payload based on A&AI look up of the vnd-id provided in the action
- * identifiers.
- */
- if (recipeSupportsPayload(policy.getRecipe()) && payloadSupplied(policy.getPayload())) {
- appcRequest.setPayload(parsePayload(policy.getPayload()));
- } else {
- appcRequest.setPayload(null);
- }
-
- /*
- * Once the LCM request is constructed, add it into the body of the dmaap wrapper.
- */
- dmaapRequest.setBody(appcRequest);
-
- /* Return the request to be sent through dmaap. */
- return dmaapRequest;
- }
-
- private static boolean payloadSupplied(Map<String, String> payload) {
- return payload != null && !payload.isEmpty();
- }
-
- private static boolean recipeSupportsPayload(String recipe) {
- return !RECIPE_RESTART.equalsIgnoreCase(recipe) && !RECIPE_REBUILD.equalsIgnoreCase(recipe)
- && !RECIPE_MIGRATE.equalsIgnoreCase(recipe);
- }
-
- private static String parsePayload(Map<String, String> payload) {
- StringBuilder payloadString = new StringBuilder("{");
- payload
- .forEach((key, value) -> payloadString.append("\"").append(key).append("\": ").append(value).append(","));
- return payloadString.substring(0, payloadString.length() - 1) + "}";
- }
-
- /**
- * Parses the operation attempt using the subRequestId of APPC response.
- *
- * @param subRequestId the sub id used to send to APPC, Policy sets this using the operation
- * attempt
- *
- * @return the current operation attempt
- */
- public static Integer parseOperationAttempt(String subRequestId) {
- Integer operationAttempt;
- try {
- operationAttempt = Integer.parseInt(subRequestId);
- } catch (NumberFormatException e) {
- logger.debug("A NumberFormatException was thrown due to error in parsing the operation attempt");
- return null;
- }
- return operationAttempt;
- }
-
- /**
- * Processes the APPC LCM response sent from APPC. Determines if the APPC operation was
- * successful/unsuccessful and maps this to the corresponding Policy result.
- *
- * @param dmaapResponse the dmaap wrapper message that contains the actual APPC reponse inside
- * the body field
- *
- * @return an key-value pair that contains the Policy result and APPC response message
- */
- public static SimpleEntry<PolicyResult, String> processResponse(LcmResponseWrapper dmaapResponse) {
- /* The actual APPC response is inside the wrapper's body field. */
- LcmResponse appcResponse = dmaapResponse.getBody();
-
- /* The message returned in the APPC response. */
- String message;
-
- /* The Policy result determined from the APPC Response. */
- PolicyResult result;
-
- /* If there is no status, Policy cannot determine if the request was successful. */
- if (appcResponse.getStatus() == null) {
- message = "Policy was unable to parse APP-C response status field (it was null).";
- return new AbstractMap.SimpleEntry<>(PolicyResult.FAILURE_EXCEPTION, message);
- }
-
- /* If there is no code, Policy cannot determine if the request was successful. */
- String responseValue = LcmResponseCode.toResponseValue(appcResponse.getStatus().getCode());
- if (responseValue == null) {
- message = "Policy was unable to parse APP-C response status code field.";
- return new AbstractMap.SimpleEntry<>(PolicyResult.FAILURE_EXCEPTION, message);
- }
-
- /* Save the APPC response's message for Policy notification message. */
- message = appcResponse.getStatus().getMessage();
-
- /* Maps the APPC response result to a Policy result. */
- switch (responseValue) {
- case LcmResponseCode.ACCEPTED:
- /* Nothing to do if code is accept, continue processing */
- result = null;
- break;
- case LcmResponseCode.SUCCESS:
- result = PolicyResult.SUCCESS;
- break;
- case LcmResponseCode.FAILURE:
- result = PolicyResult.FAILURE;
- break;
- case LcmResponseCode.REJECT:
- case LcmResponseCode.ERROR:
- default:
- result = PolicyResult.FAILURE_EXCEPTION;
- }
- return new AbstractMap.SimpleEntry<>(result, message);
- }
-
- /**
- * This method reads and validates environmental properties coming from the policy engine. Null
- * properties cause an {@link IllegalArgumentException} runtime exception to be thrown
- *
- * @param enginePropertyName the name of the parameter to retrieve
- * @return the property value
- */
- private static String getPeManagerEnvProperty(String enginePropertyName) {
- String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName);
- if (enginePropertyValue == null) {
- throw new IllegalArgumentException("The value of policy engine manager environment property \""
- + enginePropertyName + "\" may not be null");
- }
- return enginePropertyValue;
- }
-}
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java
deleted file mode 100644
index 12fad9e84..000000000
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- *
- * ================================================================================
- * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2018 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.actor.appclcm;
-
-import com.google.common.collect.Lists;
-import java.util.stream.Collectors;
-import org.apache.commons.lang.StringUtils;
-
-class AppcLcmRecipeFormatter {
-
- private final String dashCasedRecipe;
-
- AppcLcmRecipeFormatter(String dashCasedRecipe) {
- this.dashCasedRecipe = dashCasedRecipe;
- }
-
- String getUrlRecipe() {
- return dashCasedRecipe.toLowerCase();
- }
-
- String getBodyRecipe() {
- return Lists.newArrayList(dashCasedRecipe.split("-"))
- .stream()
- .map(String::toLowerCase)
- .map(StringUtils::capitalize)
- .collect(Collectors.joining(""));
- }
-}
diff --git a/controlloop/common/actors/actor.appclcm/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.appclcm/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
deleted file mode 100644
index 403ad9859..000000000
--- a/controlloop/common/actors/actor.appclcm/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider \ No newline at end of file
diff --git a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
deleted file mode 100644
index 79bcf153f..000000000
--- a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * AppcServiceProviderTest
- * ================================================================================
- * Copyright (C) 2017-2018 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.actor.appclcm;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import java.time.Instant;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.UUID;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.AaiException;
-import org.onap.policy.appclcm.LcmCommonHeader;
-import org.onap.policy.appclcm.LcmRequest;
-import org.onap.policy.appclcm.LcmRequestWrapper;
-import org.onap.policy.appclcm.LcmResponse;
-import org.onap.policy.appclcm.LcmResponseWrapper;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.controlloop.ControlLoopEventStatus;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopTargetType;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.controlloop.policy.Target;
-import org.onap.policy.controlloop.policy.TargetType;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.simulators.Util;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class AppcLcmActorServiceProviderTest {
-
- private static final Logger logger = LoggerFactory.getLogger(AppcLcmActorServiceProviderTest.class);
-
- private static final VirtualControlLoopEvent onsetEvent;
- private static final ControlLoopOperation operation;
- private static final Policy policy;
- private static final LcmResponseWrapper dmaapResponse;
-
- private static final String RECIPE_RESTART = "Restart";
- private static final String RECIPE_REBUILD = "Rebuild";
- private static final String RECIPE_MIGRATE = "Migrate";
-
- static {
- /*
- * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of
- * VM.
- */
- onsetEvent = new VirtualControlLoopEvent();
- onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
- onsetEvent.setRequestId(UUID.randomUUID());
- onsetEvent.setClosedLoopEventClient("tca.instance00001");
- onsetEvent.setTargetType(ControlLoopTargetType.VM);
- onsetEvent.setTarget("generic-vnf.vnf-name");
- onsetEvent.setFrom("DCAE");
- onsetEvent.setClosedLoopAlarmStart(Instant.now());
- onsetEvent.setAai(new HashMap<>());
- onsetEvent.getAai().put("generic-vnf.vnf-name", "fw0001vm001fw001");
- onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
-
- /* Construct an operation with an APPC actor and restart operation. */
- operation = new ControlLoopOperation();
- operation.setActor("APPC");
- operation.setOperation("Restart");
- operation.setTarget("VM");
- operation.setEnd(Instant.now());
- operation.setSubRequestId("1");
-
- /* Construct a policy specifying to restart vm. */
- policy = new Policy();
- policy.setName("Restart the VM");
- policy.setDescription("Upon getting the trigger event, restart the VM");
- policy.setActor("APPC");
- policy.setTarget(new Target(TargetType.VNF));
- policy.setRecipe("Restart");
- policy.setPayload(null);
- policy.setRetry(2);
- policy.setTimeout(300);
-
- /* A sample DMAAP request wrapper. */
- LcmRequestWrapper dmaapRequest = new LcmRequestWrapper();
- dmaapRequest.setCorrelationId(onsetEvent.getRequestId().toString() + "-" + "1");
- dmaapRequest.setRpcName(policy.getRecipe().toLowerCase());
- dmaapRequest.setType("request");
-
- /* A sample DMAAP response wrapper */
- dmaapResponse = new LcmResponseWrapper();
- dmaapResponse.setCorrelationId(onsetEvent.getRequestId().toString() + "-" + "1");
- dmaapResponse.setRpcName(policy.getRecipe().toLowerCase());
- dmaapResponse.setType("response");
-
- /* Set environment properties */
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
-
- /* A sample APPC LCM request. */
- LcmRequest appcRequest = new LcmRequest();
-
- /* The following code constructs a sample APPC LCM Request */
- appcRequest.setAction("restart");
-
- HashMap<String, String> actionIdentifiers = new HashMap<>();
- actionIdentifiers.put("vnf-id", "trial-vnf-003");
-
- appcRequest.setActionIdentifiers(actionIdentifiers);
-
- LcmCommonHeader commonHeader = new LcmCommonHeader();
- commonHeader.setRequestId(onsetEvent.getRequestId());
- commonHeader.setSubRequestId("1");
- commonHeader.setOriginatorId(onsetEvent.getRequestId().toString());
-
- appcRequest.setCommonHeader(commonHeader);
-
- appcRequest.setPayload(null);
-
- dmaapRequest.setBody(appcRequest);
-
- /* The following code constructs a sample APPC LCM Response */
- LcmResponse appcResponse = new LcmResponse(appcRequest);
- appcResponse.getStatus().setCode(400);
- appcResponse.getStatus().setMessage("Restart Successful");
-
- dmaapResponse.setBody(appcResponse);
- }
-
- /**
- * Set up before test class.
- */
- @BeforeClass
- public static void setUpSimulator() {
- try {
- Util.buildAaiSim();
- } catch (Exception e) {
- fail(e.getMessage());
- }
- }
-
- /**
- * Tear down after test class.
- */
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
-
- /**
- * A test to construct an APPC LCM restart request.
- */
- @Test
- public void constructRestartRequestTest() {
-
- LcmRequestWrapper dmaapRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01");
-
- /* The service provider must return a non null DMAAP request wrapper */
- assertNotNull(dmaapRequest);
-
- /* The DMAAP wrapper's type field must be request */
- assertEquals("request", dmaapRequest.getType());
-
- /* The DMAAP wrapper's body field cannot be null */
- assertNotNull(dmaapRequest.getBody());
-
- LcmRequest appcRequest = dmaapRequest.getBody();
-
- /* A common header is required and cannot be null */
- assertNotNull(appcRequest.getCommonHeader());
- assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestId());
-
- /* An action is required and cannot be null */
- assertNotNull(appcRequest.getAction());
- assertEquals("Restart", appcRequest.getAction());
-
- /* Action Identifiers are required and cannot be null */
- assertNotNull(appcRequest.getActionIdentifiers());
- assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id"));
- assertEquals("vnf01", appcRequest.getActionIdentifiers().get("vnf-id"));
-
- logger.debug("APPC Request: \n" + appcRequest.toString());
- }
-
- /**
- * A test to process a successful APPC restart response.
- */
- @Test
- public void processRestartResponseSuccessTest() {
- AbstractMap.SimpleEntry<PolicyResult, String> result =
- AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.SUCCESS, result.getKey());
- assertEquals("Restart Successful", result.getValue());
- }
-
- /**
- * A test to map APPC response results to corresponding Policy results.
- */
- @Test
- public void appcToPolicyResultTest() {
-
- AbstractMap.SimpleEntry<PolicyResult, String> result;
-
- /* If APPC accepts, PolicyResult is null */
- dmaapResponse.getBody().getStatus().setCode(100);
- dmaapResponse.getBody().getStatus().setMessage("ACCEPTED");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertNull(result.getKey());
-
- /* If APPC is successful, PolicyResult is success */
- dmaapResponse.getBody().getStatus().setCode(400);
- dmaapResponse.getBody().getStatus().setMessage("SUCCESS");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.SUCCESS, result.getKey());
-
- /* If APPC returns an error, PolicyResult is failure exception */
- dmaapResponse.getBody().getStatus().setCode(200);
- dmaapResponse.getBody().getStatus().setMessage("ERROR");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- /* If APPC rejects, PolicyResult is failure exception */
- dmaapResponse.getBody().getStatus().setCode(300);
- dmaapResponse.getBody().getStatus().setMessage("REJECT");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- /* Test multiple reject codes */
- dmaapResponse.getBody().getStatus().setCode(306);
- dmaapResponse.getBody().getStatus().setMessage("REJECT");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- dmaapResponse.getBody().getStatus().setCode(313);
- dmaapResponse.getBody().getStatus().setMessage("REJECT");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- /* If APPC returns failure, PolicyResult is failure */
- dmaapResponse.getBody().getStatus().setCode(401);
- dmaapResponse.getBody().getStatus().setMessage("FAILURE");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE, result.getKey());
-
- /* Test multiple failure codes */
- dmaapResponse.getBody().getStatus().setCode(406);
- dmaapResponse.getBody().getStatus().setMessage("FAILURE");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE, result.getKey());
-
- dmaapResponse.getBody().getStatus().setCode(450);
- dmaapResponse.getBody().getStatus().setMessage("FAILURE");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE, result.getKey());
-
- /* If APPC returns partial success, PolicyResult is failure exception */
- dmaapResponse.getBody().getStatus().setCode(500);
- dmaapResponse.getBody().getStatus().setMessage("PARTIAL SUCCESS");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- /* If APPC returns partial failure, PolicyResult is failure exception */
- dmaapResponse.getBody().getStatus().setCode(501);
- dmaapResponse.getBody().getStatus().setMessage("PARTIAL FAILURE");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- /* Test multiple partial failure codes */
- dmaapResponse.getBody().getStatus().setCode(599);
- dmaapResponse.getBody().getStatus().setMessage("PARTIAL FAILURE");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- dmaapResponse.getBody().getStatus().setCode(550);
- dmaapResponse.getBody().getStatus().setMessage("PARTIAL FAILURE");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
-
- /* If APPC code is unknown to Policy, PolicyResult is failure exception */
- dmaapResponse.getBody().getStatus().setCode(700);
- dmaapResponse.getBody().getStatus().setMessage("UNKNOWN");
- result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey());
- }
-
- /**
- * This test ensures that that if the the source entity is also the target entity, the source
- * will be used for the APPC request.
- */
- @Test
- public void sourceIsTargetTest() {
- String resourceId = "82194af1-3c2c-485a-8f44-420e22a9eaa4";
- String targetVnfId = null;
- try {
- targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, "vnf01");
- } catch (AaiException e) {
- logger.warn(e.toString());
- fail("no vnf-id found");
- }
- assertNotNull(targetVnfId);
- assertEquals("vnf01", targetVnfId);
- }
-
- /**
- * THis test exercises getters not exercised in other tests.
- */
- @Test
- public void testMethods() {
- AppcLcmActorServiceProvider sp = new AppcLcmActorServiceProvider();
-
- assertEquals("APPC", sp.actor());
- assertEquals(4, sp.recipes().size());
- assertEquals("VM", sp.recipeTargets("Restart").get(0));
- assertEquals("vm-id", sp.recipePayloads("Restart").get(0));
- }
-
- @Test
- public void payloadNotPassedWhenNotSupportedByRecipe() {
- //given
- Policy migratePolicy = constructPolicyWithRecipe(RECIPE_MIGRATE);
- Policy rebuildPolicy = constructPolicyWithRecipe(RECIPE_REBUILD);
- Policy restartPolicy = constructPolicyWithRecipe(RECIPE_RESTART);
-
- // when
- LcmRequestWrapper migrateRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, migratePolicy, "vnf01");
- LcmRequestWrapper rebuildRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, rebuildPolicy, "vnf01");
- LcmRequestWrapper restartRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, restartPolicy, "vnf01");
-
- // then
- assertNull(migrateRequest.getBody().getPayload());
- assertNull(rebuildRequest.getBody().getPayload());
- assertNull(restartRequest.getBody().getPayload());
- }
-
- @Test
- public void payloadNotPassedWhenNotSuppliedOrEmpty() {
- //given
- Policy noPayloadPolicy = constructHealthCheckPolicyWithPayload(null);
- Policy emptyPayloadPolicy = constructHealthCheckPolicyWithPayload(new HashMap<>());
-
- // when
- LcmRequestWrapper noPayloadRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, noPayloadPolicy, "vnf01");
- LcmRequestWrapper emptyPayloadRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, emptyPayloadPolicy, "vnf01");
-
-
- // then
- assertNull(noPayloadRequest.getBody().getPayload());
- assertNull(emptyPayloadRequest.getBody().getPayload());
- }
-
- @Test
- public void payloadParsedProperlyForSinglePayloadParameter() {
- // given
- HashMap<String, String> payload = new HashMap<>();
- payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}");
- Policy otherPolicy = constructHealthCheckPolicyWithPayload(payload);
-
- // when
- LcmRequestWrapper dmaapRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, "vnf01");
-
- // then
- assertEquals(dmaapRequest.getBody().getPayload(),
- "{\"requestParameters\": {\"host-ip-address\":\"10.183.37.25\"}}");
- }
-
-
- @Test
- public void payloadParsedProperlyForMultiplePayloadParameters() {
- // given
- HashMap<String, String> payload = new HashMap<>();
- payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}");
- payload.put("configurationParameters", "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\","
- + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\","
- + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]");
- Policy otherPolicy = constructHealthCheckPolicyWithPayload(payload);
-
- // when
- LcmRequestWrapper dmaapRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, "vnf01");
-
- // then
- assertEquals(dmaapRequest.getBody().getPayload(),
- "{\"requestParameters\": "
- + "{\"host-ip-address\":\"10.183.37.25\"},"
- + "\"configurationParameters\": "
- + "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\","
- + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\","
- + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]"
- + "}");
- }
-
- private Policy constructHealthCheckPolicyWithPayload(HashMap<String, String> payload) {
- return constructHealthCheckPolicyWithPayloadAndRecipe(payload, "Health-Check");
- }
-
- private Policy constructPolicyWithRecipe(String recipe) {
- return constructHealthCheckPolicyWithPayloadAndRecipe(null, recipe);
- }
-
- private Policy constructHealthCheckPolicyWithPayloadAndRecipe(HashMap<String, String> payload, String recipe) {
- Policy otherPolicy = new Policy();
- otherPolicy.setName("Perform health check");
- otherPolicy.setDescription("Upon getting the trigger event, perform health check");
- otherPolicy.setActor("APPC");
- otherPolicy.setTarget(new Target(TargetType.VNF));
- otherPolicy.setRecipe(recipe);
- otherPolicy.setPayload(payload);
- otherPolicy.setRetry(2);
- otherPolicy.setTimeout(300);
- return otherPolicy;
- }
-}
diff --git a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
deleted file mode 100644
index e63b04acd..000000000
--- a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- *
- * ================================================================================
- * Copyright (C) 2018 Nokia 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.actor.appclcm;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-
-
-public class AppcLcmRecipeFormatterTest {
-
- @Test
- public void shouldCorrectlyFormatRestartRequestWhenRestartGiven() {
- //given
- AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Restart");
- String expectedUrlRecipe = "restart";
- String expectedBodyRecipe = "Restart";
-
- //when
- String actualUrlRecipe = recipeFormatter.getUrlRecipe();
- String actualBodyRecipe = recipeFormatter.getBodyRecipe();
-
- //then
- assertEquals(expectedUrlRecipe, actualUrlRecipe);
- assertEquals(expectedBodyRecipe, actualBodyRecipe);
- }
-
- @Test
- public void shouldReturnCapitalizedBodySingleWordRecipe() {
- //given
- AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("moDify");
- String expectedRecipe = "Modify";
-
- //when
- String actualRecipe = recipeFormatter.getBodyRecipe();
-
- //then
- assertEquals(expectedRecipe, actualRecipe);
- }
-
- @Test
- public void shouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() {
- //given
- AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("coNfig-moDify");
- String expectedRecipe = "ConfigModify";
-
- //when
- String actualRecipe = recipeFormatter.getBodyRecipe();
-
- //then
- assertEquals(expectedRecipe, actualRecipe);
- }
-
- @Test
- public void shouldReturnLowercasedUrlSingleWordRecipe() {
- //given
- AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("ModIfy");
- String expectedRecipe = "modify";
-
- //when
- String actualRecipe = recipeFormatter.getUrlRecipe();
-
- //then
- assertEquals(expectedRecipe, actualRecipe);
- }
-
- @Test
- public void shouldReturnLowercasedDashJoinedUrlMultiWordRecipe() {
- //given
- AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Config-MoDify");
- String expectedRecipe = "config-modify";
-
- //when
- String actualRecipe = recipeFormatter.getUrlRecipe();
-
- //then
- assertEquals(expectedRecipe, actualRecipe);
- }
-} \ No newline at end of file
diff --git a/controlloop/common/actors/actor.sdnc/pom.xml b/controlloop/common/actors/actor.sdnc/pom.xml
deleted file mode 100644
index 8c26ce8c4..000000000
--- a/controlloop/common/actors/actor.sdnc/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2018 Huawei 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.sdnc</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>sdnc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${version.policy.common}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${version.policy.drools-pdp}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java b/controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java
deleted file mode 100644
index 9d7660c5d..000000000
--- a/controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SdncActorServiceProvider
- * ================================================================================
- * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. 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.actor.sdnc;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.sdnc.SdncHealNetworkInfo;
-import org.onap.policy.sdnc.SdncHealRequest;
-import org.onap.policy.sdnc.SdncHealRequestHeaderInfo;
-import org.onap.policy.sdnc.SdncHealRequestInfo;
-import org.onap.policy.sdnc.SdncHealServiceInfo;
-import org.onap.policy.sdnc.SdncHealVfModuleParameter;
-import org.onap.policy.sdnc.SdncHealVfModuleParametersInfo;
-import org.onap.policy.sdnc.SdncHealVfModuleRequestInput;
-import org.onap.policy.sdnc.SdncHealVnfInfo;
-
-import org.onap.policy.sdnc.SdncRequest;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class SdncActorServiceProvider implements Actor {
- private static final Logger logger = LoggerFactory.getLogger(SdncActorServiceProvider.class);
-
- // Strings for Sdnc Actor
- private static final String SDNC_ACTOR = "SDNC";
-
- // Strings for targets
- private static final String TARGET_VM = "VM";
-
- // Strings for recipes
- private static final String RECIPE_REROUTE = "Reroute";
-
- // Strings for recipes
- private static final String RECIPE_BW_ON_DEMAND = "BandwidthOnDemand";
-
- private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_REROUTE);
- private static final ImmutableMap<String, List<String>> targets =
- new ImmutableMap.Builder<String, List<String>>().put(RECIPE_REROUTE, ImmutableList.of(TARGET_VM)).build();
-
- @Override
- public String actor() {
- return SDNC_ACTOR;
- }
-
- @Override
- public List<String> recipes() {
- return ImmutableList.copyOf(recipes);
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList()));
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- return Collections.emptyList();
- }
-
- /**
- * Construct a request.
- *
- * @param onset the onset event
- * @param operation the control loop operation
- * @param policy the policy
- * @return the constructed request
- */
- public SdncRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
- Policy policy) {
- switch (policy.getRecipe()) {
- case RECIPE_REROUTE:
- return constructReOptimizeRequest(onset);
- case RECIPE_BW_ON_DEMAND:
- logger.info("Construct request for receipe {}" , RECIPE_BW_ON_DEMAND);
- return constructBwOnDemandRequest(onset);
- default:
- logger.info("Unsupported recipe {} " + policy.getRecipe());
- return null;
- }
- }
-
- private SdncRequest constructBwOnDemandRequest(VirtualControlLoopEvent onset) {
- // Construct an Sdnc request
- String serviceInstance = onset.getAai().get("service-instance.service-instance-id");
- if (serviceInstance == null || serviceInstance.isEmpty()) {
- // This indicates that AAI Enrichment needs to be done by event producer.
- return null;
- }
- SdncHealVfModuleParameter bandwidth = new SdncHealVfModuleParameter();
- bandwidth.setName("bandwidth");
- bandwidth.setValue(onset.getAai().get("bandwidth"));
-
- SdncHealVfModuleParameter timeStamp = new SdncHealVfModuleParameter();
- timeStamp.setName("bandwidth-change-time");
- timeStamp.setValue(onset.getAai().get("bandwidth-change-time"));
-
- SdncHealVfModuleParametersInfo vfParametersInfo = new SdncHealVfModuleParametersInfo();
- vfParametersInfo.addParameters(bandwidth);
- vfParametersInfo.addParameters(timeStamp);
-
- SdncHealVfModuleRequestInput vfRequestInfo = new SdncHealVfModuleRequestInput();
- vfRequestInfo.setVfModuleParametersInfo(vfParametersInfo);
-
- SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo();
- serviceInfo.setServiceInstanceId(serviceInstance);
-
- SdncHealRequestInfo requestInfo = new SdncHealRequestInfo();
- requestInfo.setRequestAction("SdwanBandwidthChange");
-
- SdncHealRequestHeaderInfo headerInfo = new SdncHealRequestHeaderInfo();
- headerInfo.setSvcAction("update");
- headerInfo.setSvcRequestId(UUID.randomUUID().toString());
-
- SdncRequest request = new SdncRequest();
- request.setNsInstanceId(serviceInstance);
- request.setRequestId(onset.getRequestId());
- request.setUrl("/GENERIC-RESOURCE-API:vnf-topology-operation");
-
- SdncHealVnfInfo vnfInfo = new SdncHealVnfInfo();
- vnfInfo.setVnfId(onset.getAai().get("vnfId"));
-
- SdncHealRequest healRequest = new SdncHealRequest();
- healRequest.setVnfInfo(vnfInfo);
- healRequest.setRequestHeaderInfo(headerInfo);
- healRequest.setVfModuleRequestInput(vfRequestInfo);
- healRequest.setRequestInfo(requestInfo);
- healRequest.setServiceInfo(serviceInfo);
- request.setHealRequest(healRequest);
- return request;
- }
-
- private SdncRequest constructReOptimizeRequest(VirtualControlLoopEvent onset) {
- // Construct an Sdnc request
- String serviceInstance = onset.getAai().get("service-instance.service-instance-id");
- if (serviceInstance == null || serviceInstance.isEmpty()) {
- // This indicates that AAI Enrichment needs to be done by event producer.
- return null;
- }
- SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo();
- serviceInfo.setServiceInstanceId(serviceInstance);
-
- String networkId = onset.getAai().get("network-information.network-id");
- if (networkId == null || networkId.isEmpty()) {
- // This indicates that AAI Enrichment needs to be done by event producer.
- return null;
- }
- SdncHealNetworkInfo networkInfo = new SdncHealNetworkInfo();
- networkInfo.setNetworkId(networkId);
-
- SdncHealRequestInfo requestInfo = new SdncHealRequestInfo();
- requestInfo.setRequestAction("ReoptimizeSOTNInstance");
-
- SdncHealRequestHeaderInfo headerInfo = new SdncHealRequestHeaderInfo();
- headerInfo.setSvcAction("reoptimize");
- headerInfo.setSvcRequestId(UUID.randomUUID().toString());
-
- SdncRequest request = new SdncRequest();
- request.setNsInstanceId(serviceInstance);
- request.setRequestId(onset.getRequestId());
- request.setUrl("/GENERIC-RESOURCE-API:network-topology-operation");
-
- SdncHealRequest healRequest = new SdncHealRequest();
- healRequest.setRequestHeaderInfo(headerInfo);
- healRequest.setNetworkInfo(networkInfo);
- healRequest.setRequestInfo(requestInfo);
- healRequest.setServiceInfo(serviceInfo);
- request.setHealRequest(healRequest);
- return request;
- }
-} \ No newline at end of file
diff --git a/controlloop/common/actors/actor.sdnc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.sdnc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
deleted file mode 100644
index f4d1e975e..000000000
--- a/controlloop/common/actors/actor.sdnc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actor.sdnc.SdncActorServiceProvider \ No newline at end of file
diff --git a/controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java b/controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java
deleted file mode 100644
index f968f8609..000000000
--- a/controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * TestSdncActorServiceProvider
- * ================================================================================
- * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. All rights reserved.
- * Modifications Copyright (C) 2018 AT&T Corp. 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.actor.sdnc;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import java.util.Objects;
-import java.util.UUID;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.AaiGetVnfResponse;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.sdnc.SdncRequest;
-import org.onap.policy.simulators.Util;
-
-public class SdncActorServiceProviderTest {
-
- /**
- * Set up for test class.
- */
- @BeforeClass
- public static void setUpSimulator() {
- try {
- Util.buildAaiSim();
- } catch (Exception e) {
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
-
- @Test
- public void testConstructRequest() {
- VirtualControlLoopEvent onset = new VirtualControlLoopEvent();
- ControlLoopOperation operation = new ControlLoopOperation();
-
- Policy policy = new Policy();
- policy.setRecipe("Reroute");
-
- SdncActorServiceProvider provider = new SdncActorServiceProvider();
- assertNull(provider.constructRequest(onset, operation, policy));
-
- onset.getAai().put("network-information.network-id", "network-5555");
- assertNull(provider.constructRequest(onset, operation, policy));
-
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
- assertNull(provider.constructRequest(onset, operation, policy));
-
- UUID requestId = UUID.randomUUID();
- onset.setRequestId(requestId);
- assertNull(provider.constructRequest(onset, operation, policy));
-
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
- assertNull(provider.constructRequest(onset, operation, policy));
-
- onset.getAai().put("service-instance.service-instance-id", "service-instance-01");
- assertNotNull(provider.constructRequest(onset, operation, policy));
-
- policy.setRecipe("Reroute");
- assertNotNull(provider.constructRequest(onset, operation, policy));
-
- SdncRequest request =
- provider.constructRequest(onset, operation, policy);
-
- assertEquals(requestId, Objects.requireNonNull(request).getRequestId());
- assertEquals("reoptimize", request.getHealRequest().getRequestHeaderInfo().getSvcAction());
- assertEquals("ReoptimizeSOTNInstance", request.getHealRequest().getRequestInfo().getRequestAction());
- assertEquals("network-5555", request.getHealRequest().getNetworkInfo().getNetworkId());
- assertEquals("service-instance-01", request.getHealRequest().getServiceInfo().getServiceInstanceId());
- }
-
- @Test
- public void testMethods() {
- SdncActorServiceProvider sp = new SdncActorServiceProvider();
-
- assertEquals("SDNC", sp.actor());
- assertEquals(1, sp.recipes().size());
- assertEquals("Reroute", sp.recipes().get(0));
- assertEquals("VM", sp.recipeTargets("Reroute").get(0));
- assertEquals(0, sp.recipePayloads("Reroute").size());
- }
-}
diff --git a/controlloop/common/actors/actor.sdnr/pom.xml b/controlloop/common/actors/actor.sdnr/pom.xml
deleted file mode 100644
index 671bab6c9..000000000
--- a/controlloop/common/actors/actor.sdnr/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2018 Wipro Limited 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.sdnr</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>sdnr</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${version.policy.common}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${version.policy.drools-pdp}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java b/controlloop/common/actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
deleted file mode 100644
index d6ec1d219..000000000
--- a/controlloop/common/actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SdnrActorServiceProvider
- * ================================================================================
- * Copyright (C) 2018 Wipro Limited 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.actor.sdnr;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopResponse;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.sdnr.PciCommonHeader;
-import org.onap.policy.sdnr.PciRequest;
-import org.onap.policy.sdnr.PciRequestWrapper;
-import org.onap.policy.sdnr.PciResponse;
-import org.onap.policy.sdnr.PciResponseCode;
-import org.onap.policy.sdnr.PciResponseWrapper;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SdnrActorServiceProvider implements Actor {
-
- public static class Pair<A, B> {
- public final A result;
- public final B message;
-
- public Pair(A result, B message) {
- this.result = result;
- this.message = message;
- }
-
- public A getResult() {
- return this.result;
- }
-
- public B getMessage() {
- return this.message;
- }
- }
-
- private static final Logger logger = LoggerFactory.getLogger(SdnrActorServiceProvider.class);
-
- // Strings for targets
- private static final String TARGET_VNF = "VNF";
-
- // Strings for recipes
- private static final String RECIPE_MODIFY = "ModifyConfig";
- private static final String RECIPE_MODIFY_ANR = "ModifyConfigANR";
-
- /* To be used in future releases when pci ModifyConfig is used */
- private static final String SDNR_REQUEST_PARAMS = "request-parameters";
- private static final String SDNR_CONFIG_PARAMS = "configuration-parameters";
-
- private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_MODIFY);
- private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>()
- .put(RECIPE_MODIFY, ImmutableList.of(TARGET_VNF)).build();
- private static final ImmutableMap<String, List<String>> payloads = new ImmutableMap.Builder<String, List<String>>()
- .put(RECIPE_MODIFY, ImmutableList.of(SDNR_REQUEST_PARAMS, SDNR_CONFIG_PARAMS)).build();
-
- @Override
- public String actor() {
- return "SDNR";
- }
-
- @Override
- public List<String> recipes() {
- return ImmutableList.copyOf(recipes);
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList()));
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- return ImmutableList.copyOf(payloads.getOrDefault(recipe, Collections.emptyList()));
- }
-
- /**
- * Constructs an SDNR request conforming to the pci API. The actual request is
- * constructed and then placed in a wrapper object used to send through DMAAP.
- *
- * @param onset
- * the event that is reporting the alert for policy to perform an
- * action
- * @param operation
- * the control loop operation specifying the actor, operation,
- * target, etc.
- * @param policy
- * the policy the was specified from the yaml generated by CLAMP or
- * through the Policy GUI/API
- * @return an SDNR request conforming to the pci API using the DMAAP wrapper
- */
-
- public static PciRequestWrapper constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
- Policy policy) {
-
- /* Construct an SDNR request using pci Model */
-
- /*
- * The actual pci request is placed in a wrapper used to send through dmaap. The
- * current version is 2.0 as of R1.
- */
- PciRequestWrapper dmaapRequest = new PciRequestWrapper();
- dmaapRequest.setVersion("1.0");
- dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + operation.getSubRequestId());
- dmaapRequest.setRpcName(policy.getRecipe().toLowerCase());
- dmaapRequest.setType("request");
-
- /* This is the actual request that is placed in the dmaap wrapper. */
- final PciRequest sdnrRequest = new PciRequest();
-
- /* The common header is a required field for all SDNR requests. */
- PciCommonHeader requestCommonHeader = new PciCommonHeader();
- requestCommonHeader.setRequestId(onset.getRequestId());
- requestCommonHeader.setSubRequestId(operation.getSubRequestId());
-
- sdnrRequest.setCommonHeader(requestCommonHeader);
- sdnrRequest.setPayload(onset.getPayload());
-
- /*
- * An action is required for all SDNR requests, this will be the recipe
- * specified in the policy.
- */
- sdnrRequest.setAction(policy.getRecipe());
-
- /*
- * Once the pci request is constructed, add it into the body of the dmaap
- * wrapper.
- */
- dmaapRequest.setBody(sdnrRequest);
- logger.info("SDNR Request to be sent is {}", dmaapRequest);
-
- /* Return the request to be sent through dmaap. */
- return dmaapRequest;
- }
-
- /**
- * Parses the operation attempt using the subRequestId of SDNR response.
- *
- * @param subRequestId
- * the sub id used to send to SDNR, Policy sets this using the
- * operation attempt
- *
- * @return the current operation attempt
- */
- public static Integer parseOperationAttempt(String subRequestId) {
- Integer operationAttempt;
- try {
- operationAttempt = Integer.parseInt(subRequestId);
- } catch (NumberFormatException e) {
- logger.debug("A NumberFormatException was thrown in parsing the operation attempt {}", subRequestId);
- return null;
- }
- return operationAttempt;
- }
-
- /**
- * Processes the SDNR pci response sent from SDNR. Determines if the SDNR
- * operation was successful/unsuccessful and maps this to the corresponding
- * Policy result.
- *
- * @param dmaapResponse
- * the dmaap wrapper message that contains the actual SDNR reponse
- * inside the body field
- *
- * @return an key-value pair that contains the Policy result and SDNR response
- * message
- */
- public static SdnrActorServiceProvider.Pair<PolicyResult, String> processResponse(
- PciResponseWrapper dmaapResponse) {
-
- logger.info("SDNR processResponse called : {}", dmaapResponse);
-
- /* The actual SDNR response is inside the wrapper's body field. */
- PciResponse sdnrResponse = dmaapResponse.getBody();
-
- /* The message returned in the SDNR response. */
- String message;
-
- /* The Policy result determined from the SDNR Response. */
- PolicyResult result;
-
- /*
- * If there is no status, Policy cannot determine if the request was successful.
- */
- if (sdnrResponse.getStatus() == null) {
- message = "Policy was unable to parse SDN-R response status field (it was null).";
- return new SdnrActorServiceProvider.Pair<>(PolicyResult.FAILURE_EXCEPTION, message);
- }
-
- /*
- * If there is no code, Policy cannot determine if the request was successful.
- */
- String responseValue = PciResponseCode.toResponseValue(sdnrResponse.getStatus().getCode());
- if (responseValue == null) {
- message = "Policy was unable to parse SDN-R response status code field.";
- return new SdnrActorServiceProvider.Pair<>(PolicyResult.FAILURE_EXCEPTION, message);
- }
- logger.info("SDNR Response Code is {}", responseValue);
-
- /* Save the SDNR response's message for Policy notification message. */
- message = sdnrResponse.getStatus().getValue();
- logger.info("SDNR Response Message is {}", message);
-
- /*
- * Response and Payload are just printed and no further action needed in
- * casablanca release
- */
- String rspPayload = sdnrResponse.getPayload();
- logger.info("SDNR Response Payload is {}", rspPayload);
-
- /* Maps the SDNR response result to a Policy result. */
- switch (responseValue) {
- case PciResponseCode.ACCEPTED:
- /* Nothing to do if code is accept, continue processing */
- result = null;
- break;
- case PciResponseCode.SUCCESS:
- result = PolicyResult.SUCCESS;
- break;
- case PciResponseCode.FAILURE:
- result = PolicyResult.FAILURE;
- break;
- case PciResponseCode.REJECT:
- case PciResponseCode.ERROR:
- default:
- result = PolicyResult.FAILURE_EXCEPTION;
- }
- return new SdnrActorServiceProvider.Pair<>(result, message);
- }
-
- /**
- * Converts the SDNR response to ControlLoopResponse object.
- *
- * @param dmaapResponse
- * the dmaap wrapper message that contains the actual SDNR reponse
- * inside the body field
- *
- * @return a ControlLoopResponse object to send to DCAE_CL_RSP topic
- */
- public static ControlLoopResponse getControlLoopResponse(PciResponseWrapper dmaapResponse,
- VirtualControlLoopEvent event) {
-
- logger.info("SDNR getClosedLoopResponse called : {} {}", dmaapResponse, event);
-
- /* The actual SDNR response is inside the wrapper's body field. */
- PciResponse sdnrResponse = dmaapResponse.getBody();
-
- /* The ControlLoop response determined from the SDNR Response and input event. */
- ControlLoopResponse clRsp = new ControlLoopResponse();
- clRsp.setPayload(sdnrResponse.getPayload());
- clRsp.setFrom("SDNR");
- clRsp.setTarget("DCAE");
- clRsp.setClosedLoopControlName(event.getClosedLoopControlName());
- clRsp.setPolicyName(event.getPolicyName());
- clRsp.setPolicyVersion(event.getPolicyVersion());
- clRsp.setRequestId(event.getRequestId());
- clRsp.setVersion(event.getVersion());
- logger.info("SDNR getClosedLoopResponse clRsp : {}", clRsp);
-
- return clRsp;
- }
-
-}
diff --git a/controlloop/common/actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
deleted file mode 100644
index c8d5e4c41..000000000
--- a/controlloop/common/actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actor.sdnr.SdnrActorServiceProvider
diff --git a/controlloop/common/actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java b/controlloop/common/actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java
deleted file mode 100644
index ac302565c..000000000
--- a/controlloop/common/actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*-
- * SdnrActorServiceProviderTest
- * ================================================================================
- * Copyright (C) 2018 Wipro Limited 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.actor.sdnr;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.time.Instant;
-import java.util.HashMap;
-import java.util.UUID;
-
-import org.junit.Test;
-import org.onap.policy.controlloop.ControlLoopEventStatus;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopResponse;
-import org.onap.policy.controlloop.ControlLoopTargetType;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.Target;
-import org.onap.policy.controlloop.policy.TargetType;
-import org.onap.policy.sdnr.PciRequest;
-import org.onap.policy.sdnr.PciResponse;
-import org.onap.policy.sdnr.PciResponseWrapper;
-import org.onap.policy.sdnr.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SdnrActorServiceProviderTest {
-
- private static final Logger logger = LoggerFactory.getLogger(SdnrActorServiceProviderTest.class);
-
- private static final VirtualControlLoopEvent onsetEvent;
- private static final ControlLoopOperation operation;
- private static final Policy policy;
-
- static {
- /*
- * Construct an onset. Using dummy AAI details since the code mandates AAI
- * details.
- */
- onsetEvent = new VirtualControlLoopEvent();
- onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
- onsetEvent.setRequestId(UUID.randomUUID());
- onsetEvent.setClosedLoopEventClient("tca.instance00001");
- onsetEvent.setTargetType(ControlLoopTargetType.VNF);
- onsetEvent.setTarget("generic-vnf.vnf-name");
- onsetEvent.setFrom("DCAE");
- onsetEvent.setClosedLoopAlarmStart(Instant.now());
- onsetEvent.setAai(new HashMap<>());
- onsetEvent.getAai().put("generic-vnf.vnf-name", "notused");
- onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
- onsetEvent.setPayload("some payload");
-
- /* Construct an operation with an SDNR actor and ModifyConfig operation. */
- operation = new ControlLoopOperation();
- operation.setActor("SDNR");
- operation.setOperation("ModifyConfig");
- operation.setTarget("VNF");
- operation.setEnd(Instant.now());
- operation.setSubRequestId("1");
-
- /* Construct a policy specifying to modify configuration. */
- policy = new Policy();
- policy.setName("Modify PCI Config");
- policy.setDescription("Upon getting the trigger event, modify pci config");
- policy.setActor("SDNR");
- policy.setTarget(new Target(TargetType.VNF));
- policy.getTarget().setResourceID("Eace933104d443b496b8.nodes.heat.vpg");
- policy.setRecipe("ModifyConfig");
- policy.setPayload(null);
- policy.setRetry(2);
- policy.setTimeout(300);
-
- }
-
- @Test
- public void getControlLoopResponseTest() {
- PciRequest sdnrRequest;
- sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody();
- PciResponse sdnrResponse = new PciResponse(sdnrRequest);
- sdnrResponse.getStatus().setCode(200);
- sdnrResponse.getStatus().setValue("SDNR success");
- sdnrResponse.setPayload("sdnr payload ");
- /* Print out request as json to make sure serialization works */
- String jsonResponse = Serialization.gsonPretty.toJson(sdnrResponse);
- logger.info(jsonResponse);
- PciResponseWrapper pciResponseWrapper = new PciResponseWrapper();
- pciResponseWrapper.setBody(sdnrResponse);
-
- ControlLoopResponse clRsp = SdnrActorServiceProvider.getControlLoopResponse(pciResponseWrapper, onsetEvent);
- assertEquals(clRsp.getClosedLoopControlName(), onsetEvent.getClosedLoopControlName());
- assertEquals(clRsp.getRequestId(), onsetEvent.getRequestId());
- assertEquals(clRsp.getPolicyName(), onsetEvent.getPolicyName());
- assertEquals(clRsp.getPolicyVersion(), onsetEvent.getPolicyVersion());
- assertEquals(clRsp.getVersion(), onsetEvent.getVersion());
- assertEquals(clRsp.getFrom(), "SDNR");
- assertEquals(clRsp.getTarget(), "DCAE");
- assertEquals(clRsp.getPayload(), sdnrResponse.getPayload());
- }
-
- @Test
- public void constructModifyConfigRequestTest() {
-
- PciRequest sdnrRequest;
- sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody();
-
- /* The service provider must return a non null SDNR request */
- assertNotNull(sdnrRequest);
-
- /* A common header is required and cannot be null */
- assertNotNull(sdnrRequest.getCommonHeader());
- assertEquals(sdnrRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestId());
-
- /* An action is required and cannot be null */
- assertNotNull(sdnrRequest.getAction());
- assertEquals("ModifyConfig", sdnrRequest.getAction());
-
- /* A payload is required and cannot be null */
- assertNotNull(sdnrRequest.getPayload());
- assertEquals("some payload", sdnrRequest.getPayload());
-
- logger.debug("SDNR Request: \n" + sdnrRequest.toString());
-
- /* Print out request as json to make sure serialization works */
- String jsonRequest = Serialization.gsonPretty.toJson(sdnrRequest);
- logger.debug("JSON Output: \n" + jsonRequest);
-
- /* The JSON string must contain the following fields */
- assertTrue(jsonRequest.contains("CommonHeader"));
- assertTrue(jsonRequest.contains("Action"));
- assertTrue(jsonRequest.contains("ModifyConfig"));
- assertTrue(jsonRequest.contains("payload"));
-
- PciResponse sdnrResponse = new PciResponse(sdnrRequest);
- sdnrResponse.getStatus().setCode(200);
- sdnrResponse.getStatus().setValue("SDNR success");
- /* Print out request as json to make sure serialization works */
- String jsonResponse = Serialization.gsonPretty.toJson(sdnrResponse);
- logger.debug("JSON Output: \n" + jsonResponse);
- }
-
- @Test
- public void testMethods() {
- SdnrActorServiceProvider sp = new SdnrActorServiceProvider();
-
- assertEquals("SDNR", sp.actor());
- assertEquals(1, sp.recipes().size());
- assertEquals("VNF", sp.recipeTargets("ModifyConfig").get(0));
- assertEquals(2, sp.recipePayloads("ModifyConfig").size());
- }
-}
diff --git a/controlloop/common/actors/actor.so/pom.xml b/controlloop/common/actors/actor.so/pom.xml
deleted file mode 100644
index 0092f41b8..000000000
--- a/controlloop/common/actors/actor.so/pom.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2017-2018 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.so</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>so</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.drools</groupId>
- <artifactId>drools-core</artifactId>
- <version>6.5.0.Final</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${version.policy.common}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${version.policy.drools-pdp}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java
deleted file mode 100644
index dcda995ad..000000000
--- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * SOActorServiceProvider
- * ================================================================================
- * Copyright (C) 2017-2019 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.actor.so;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.reflect.TypeToken;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import org.drools.core.WorkingMemory;
-import org.onap.policy.aai.AaiNqExtraProperty;
-import org.onap.policy.aai.AaiNqInventoryResponseItem;
-import org.onap.policy.aai.AaiNqResponseWrapper;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.so.SoCloudConfiguration;
-import org.onap.policy.so.SoManager;
-import org.onap.policy.so.SoModelInfo;
-import org.onap.policy.so.SoOperationType;
-import org.onap.policy.so.SoRelatedInstance;
-import org.onap.policy.so.SoRelatedInstanceListElement;
-import org.onap.policy.so.SoRequest;
-import org.onap.policy.so.SoRequestDetails;
-import org.onap.policy.so.SoRequestInfo;
-import org.onap.policy.so.SoRequestParameters;
-import org.onap.policy.so.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SoActorServiceProvider implements Actor {
- private static final Logger logger = LoggerFactory.getLogger(SoActorServiceProvider.class);
-
- // Strings for SO Actor
- private static final String SO_ACTOR = "SO";
-
- // Strings for targets
- private static final String TARGET_VFC = "VFC";
-
- // Strings for recipes
- private static final String RECIPE_VF_MODULE_CREATE = "VF Module Create";
- private static final String RECIPE_VF_MODULE_DELETE = "VF Module Delete";
-
- private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_VF_MODULE_CREATE,
- RECIPE_VF_MODULE_DELETE);
- private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>()
- .put(RECIPE_VF_MODULE_CREATE, ImmutableList.of(TARGET_VFC))
- .put(RECIPE_VF_MODULE_DELETE, ImmutableList.of(TARGET_VFC)).build();
-
- // name of request parameters within policy payload
- public static final String REQ_PARAM_NM = "requestParameters";
-
- // name of configuration parameters within policy payload
- public static final String CONFIG_PARAM_NM = "configurationParameters";
-
- private static final String MODEL_NAME_PROPERTY_KEY = "model-ver.model-name";
- private static final String MODEL_VERSION_PROPERTY_KEY = "model-ver.model-version";
- private static final String MODEL_VERSION_ID_PROPERTY_KEY = "model-ver.model-version-id";
-
- // used to decode configuration parameters via gson
- private static final Type CONFIG_TYPE = new TypeToken<List<Map<String, String>>>() {}.getType();
-
- // Static variables required to hold the IDs of the last service item, VNF item and VF Module.
- // Note that in
- // a multithreaded deployment this WILL break
- private static String lastVNFItemVnfId;
- private static String lastServiceItemServiceInstanceId;
- private static String lastVfModuleItemVfModuleInstanceId;
-
- @Override
- public String actor() {
- return SO_ACTOR;
- }
-
- @Override
- public List<String> recipes() {
- return ImmutableList.copyOf(recipes);
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList()));
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- return Collections.emptyList();
- }
-
- /**
- * Constructs a SO request conforming to the lcm API. The actual request is
- * constructed and then placed in a wrapper object used to send through DMAAP.
- *
- * @param onset the event that is reporting the alert for policy to perform an action
- * @param operation the control loop operation specifying the actor, operation,
- * target, etc.
- * @param policy the policy the was specified from the yaml generated by CLAMP or
- * through the Policy GUI/API
- * @param aaiResponseWrapper wrapper for AAI vserver named-query response
- * @return a SO request conforming to the lcm API using the DMAAP wrapper
- */
- public SoRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy,
- AaiNqResponseWrapper aaiResponseWrapper) {
- if (!SO_ACTOR.equals(policy.getActor()) || !recipes().contains(policy.getRecipe())) {
- return null;
- }
-
- // A&AI named query should have been performed by now. If not, return null
- if (aaiResponseWrapper == null) {
- return null;
- }
-
- AaiNqInventoryResponseItem vnfItem;
- AaiNqInventoryResponseItem vnfServiceItem;
- AaiNqInventoryResponseItem tenantItem;
-
- // Extract the items we're interested in from the response
- try {
- vnfItem = aaiResponseWrapper.getAaiNqResponse().getInventoryResponseItems().get(0).getItems()
- .getInventoryResponseItems().get(0);
- } catch (Exception e) {
- logger.error("VNF Item not found in AAI response {}", Serialization.gsonPretty.toJson(aaiResponseWrapper),
- e);
- return null;
- }
-
- try {
- vnfServiceItem = vnfItem.getItems().getInventoryResponseItems().get(0);
- } catch (Exception e) {
- logger.error("VNF Service Item not found in AAI response {}",
- Serialization.gsonPretty.toJson(aaiResponseWrapper), e);
- return null;
- }
-
- try {
- tenantItem = aaiResponseWrapper.getAaiNqResponse().getInventoryResponseItems().get(0).getItems()
- .getInventoryResponseItems().get(1);
- } catch (Exception e) {
- logger.error("Tenant Item not found in AAI response {}",
- Serialization.gsonPretty.toJson(aaiResponseWrapper), e);
- return null;
- }
-
- // Find the index for base vf module and non-base vf module
- AaiNqInventoryResponseItem baseItem = findVfModule(aaiResponseWrapper, true);
- AaiNqInventoryResponseItem vfModuleItem = findVfModule(aaiResponseWrapper, false);
-
- // Report the error if either base vf module or non-base vf module is not found
- if (baseItem == null || vfModuleItem == null) {
- logger.error("Either base or non-base vf module is not found from AAI response.");
- return null;
- }
-
- // Construct SO Request for a policy's recipe
- if (RECIPE_VF_MODULE_CREATE.equals(policy.getRecipe())) {
- return constructCreateRequest(aaiResponseWrapper, policy, tenantItem, vnfItem, vnfServiceItem,
- vfModuleItem);
- } else if (RECIPE_VF_MODULE_DELETE.equals(policy.getRecipe())) {
- return constructDeleteRequest(tenantItem, vnfItem, vnfServiceItem, vfModuleItem);
- } else {
- return null;
- }
- }
-
- /**
- * Construct SO request to create vf-module.
- *
- * @param aaiResponseWrapper the AAI response containing the VF modules
- * @param policy the policy
- * @param tenantItem tenant item from A&AI named-query response
- * @param vnfItem vnf item from A&AI named-query response
- * @param vnfServiceItem vnf service item from A&AI named-query response
- * @param vfModuleItem vf module item from A&AI named-query response
- * @return SO create vf-module request
- */
- private SoRequest constructCreateRequest(AaiNqResponseWrapper aaiResponseWrapper, Policy policy,
- AaiNqInventoryResponseItem tenantItem, AaiNqInventoryResponseItem vnfItem,
- AaiNqInventoryResponseItem vnfServiceItem,
- AaiNqInventoryResponseItem vfModuleItem) {
- SoRequest request = new SoRequest();
- request.setOperationType(SoOperationType.SCALE_OUT);
- //
- //
- // Do NOT send So the requestId, they do not support this field
- //
- request.setRequestDetails(new SoRequestDetails());
- request.getRequestDetails().setRequestParameters(new SoRequestParameters());
- request.getRequestDetails().getRequestParameters().setUserParams(null);
-
- // cloudConfiguration
- request.getRequestDetails().setCloudConfiguration(constructCloudConfiguration(tenantItem));
- // modelInfo
- request.getRequestDetails().setModelInfo(constructVfModuleModelInfo(vfModuleItem));
- request.getRequestDetails().getModelInfo().setModelVersionId(vfModuleItem.getVfModule().getModelVersionId());
-
- // requestInfo
- request.getRequestDetails().setRequestInfo(constructRequestInfo());
- String vfModuleName = aaiResponseWrapper.genVfModuleName();
- request.getRequestDetails().getRequestInfo().setInstanceName(vfModuleName);
-
- // relatedInstanceList
- SoRelatedInstanceListElement relatedInstanceListElement1 = new SoRelatedInstanceListElement();
- SoRelatedInstanceListElement relatedInstanceListElement2 = new SoRelatedInstanceListElement();
- relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance());
- relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance());
-
- // Service Item
- relatedInstanceListElement1.getRelatedInstance()
- .setInstanceId(vnfServiceItem.getServiceInstance().getServiceInstanceId());
- relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo());
- relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service");
- relatedInstanceListElement1.getRelatedInstance().getModelInfo()
- .setModelInvariantId(vnfServiceItem.getServiceInstance().getModelInvariantId());
- for (AaiNqExtraProperty prop : vnfServiceItem.getExtraProperties().getExtraProperty()) {
- if (prop.getPropertyName().equals(MODEL_NAME_PROPERTY_KEY)) {
- relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName(prop.getPropertyValue());
- } else if (prop.getPropertyName().equals(MODEL_VERSION_PROPERTY_KEY)) {
- relatedInstanceListElement1.getRelatedInstance().getModelInfo()
- .setModelVersion(prop.getPropertyValue());
- } else if (prop.getPropertyName().equals(MODEL_VERSION_ID_PROPERTY_KEY)) {
- relatedInstanceListElement1.getRelatedInstance().getModelInfo()
- .setModelVersionId(prop.getPropertyValue());
- }
- }
-
- // VNF Item
- relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfItem.getGenericVnf().getVnfId());
- relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo());
- relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf");
- relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelInvariantId(vnfItem.getGenericVnf().getModelInvariantId());
- for (AaiNqExtraProperty prop : vnfItem.getExtraProperties().getExtraProperty()) {
- if (prop.getPropertyName().equals(MODEL_NAME_PROPERTY_KEY)) {
- relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName(prop.getPropertyValue());
- } else if (prop.getPropertyName().equals(MODEL_VERSION_PROPERTY_KEY)) {
- relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelVersion(prop.getPropertyValue());
- } else if (prop.getPropertyName().equals(MODEL_VERSION_ID_PROPERTY_KEY)) {
- relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelVersionId(prop.getPropertyValue());
- }
- }
- relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelCustomizationName(vnfItem.getGenericVnf().getVnfType()
- .substring(vnfItem.getGenericVnf().getVnfType().lastIndexOf('/') + 1));
- relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelCustomizationId(vnfItem.getGenericVnf().getModelCustomizationId());
-
- // Insert the Service Item and VNF Item
- request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1);
- request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
-
- // Request Parameters
- buildRequestParameters(policy, request.getRequestDetails());
-
- // Configuration Parameters
- buildConfigurationParameters(policy, request.getRequestDetails());
- // Save the instance IDs for the VNF and service to static fields
- // vfModuleId is not required for the create vf-module
- preserveInstanceIds(vnfItem.getGenericVnf().getVnfId(), vnfServiceItem.getServiceInstance()
- .getServiceInstanceId(), null);
- if (logger.isDebugEnabled()) {
- logger.debug("Constructed SO request: {}", Serialization.gsonPretty.toJson(request));
- }
- return request;
- }
-
- /**
- * Construct SO request to delete vf-module.
- *
- * @param tenantItem tenant item from A&AI named-query response
- * @param vnfItem vnf item from A&AI named-query response
- * @param vnfServiceItem vnf service item from A&AI named-query response
- * @param vfModuleItem vf module item from A&AI named-query response
- * @return SO delete vf-module request
- */
- private SoRequest constructDeleteRequest(AaiNqInventoryResponseItem tenantItem, AaiNqInventoryResponseItem
- vnfItem, AaiNqInventoryResponseItem vnfServiceItem, AaiNqInventoryResponseItem vfModuleItem) {
- SoRequest request = new SoRequest();
- request.setOperationType(SoOperationType.DELETE_VF_MODULE);
- request.setRequestDetails(new SoRequestDetails());
- request.getRequestDetails().setRelatedInstanceList(null);
- request.getRequestDetails().setConfigurationParameters(null);
-
- // cloudConfiguration
- request.getRequestDetails().setCloudConfiguration(constructCloudConfiguration(tenantItem));
- // modelInfo
- request.getRequestDetails().setModelInfo(constructVfModuleModelInfo(vfModuleItem));
- // requestInfo
- request.getRequestDetails().setRequestInfo(constructRequestInfo());
- // Save the instance IDs for the VNF, service and vfModule to static fields
- preserveInstanceIds(vnfItem.getGenericVnf().getVnfId(), vnfServiceItem.getServiceInstance()
- .getServiceInstanceId(), vfModuleItem.getVfModule().getVfModuleId());
-
- if (logger.isDebugEnabled()) {
- logger.debug("Constructed SO request: {}", Serialization.gsonPretty.toJson(request));
- }
- return request;
- }
-
- /**
- * Construct requestInfo for the SO requestDetails.
- *
- * @return SO request information
- */
- private SoRequestInfo constructRequestInfo() {
- SoRequestInfo soRequestInfo = new SoRequestInfo();
- soRequestInfo.setSource("POLICY");
- soRequestInfo.setSuppressRollback(false);
- soRequestInfo.setRequestorId("policy");
- return soRequestInfo;
- }
-
- /**
- * Construct modelInfo of the vfModule for the SO requestDetails.
- *
- * @param vfModuleItem vf module item from A&AI named-query response
- * @return SO Model info for the vfModule
- */
- private SoModelInfo constructVfModuleModelInfo(AaiNqInventoryResponseItem vfModuleItem) {
- SoModelInfo soModelInfo = new SoModelInfo();
- soModelInfo.setModelType("vfModule");
- soModelInfo.setModelInvariantId(vfModuleItem.getVfModule().getModelInvariantId());
- soModelInfo.setModelCustomizationId(vfModuleItem.getVfModule().getModelCustomizationId());
-
- for (AaiNqExtraProperty prop : vfModuleItem.getExtraProperties().getExtraProperty()) {
- if (prop.getPropertyName().equals(MODEL_NAME_PROPERTY_KEY)) {
- soModelInfo.setModelName(prop.getPropertyValue());
- } else if (prop.getPropertyName().equals(MODEL_VERSION_PROPERTY_KEY)) {
- soModelInfo.setModelVersion(prop.getPropertyValue());
- }
- }
- return soModelInfo;
- }
-
- /**
- * Construct cloudConfiguration for the SO requestDetails.
- *
- * @param tenantItem tenant item from A&AI named-query response
- * @return SO cloud configuration
- */
- private SoCloudConfiguration constructCloudConfiguration(AaiNqInventoryResponseItem tenantItem) {
- SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
- cloudConfiguration.setTenantId(tenantItem.getTenant().getTenantId());
- cloudConfiguration.setLcpCloudRegionId(tenantItem.getItems().getInventoryResponseItems().get(0)
- .getCloudRegion().getCloudRegionId());
- return cloudConfiguration;
- }
-
- /**
- * This method is needed to get the serviceInstanceId and vnfInstanceId which is used
- * in the asyncSORestCall.
- *
- * @param requestId the request Id
- * @param wm the working memory
- * @param request the request
- */
- public static void sendRequest(String requestId, WorkingMemory wm, Object request) {
- SoManager soManager = new SoManager();
- soManager.asyncSoRestCall(requestId, wm, lastServiceItemServiceInstanceId, lastVNFItemVnfId,
- lastVfModuleItemVfModuleInstanceId, (SoRequest) request);
- }
-
- /**
- * Find the base or non base VF module item in an AAI response.
- * If there is more than one item, then the <i>last</i> item is returned
- *
- * @param aaiResponseWrapper the AAI response containing the VF modules
- * @param baseFlag true if we are searching for the base, false if we are searching
- * for the non base
- * @return the base or non base VF module item or null if the module was not found
- */
- private AaiNqInventoryResponseItem findVfModule(AaiNqResponseWrapper aaiResponseWrapper, boolean baseFlag) {
- List<AaiNqInventoryResponseItem> lst = aaiResponseWrapper.getVfModuleItems(baseFlag);
- return (lst.isEmpty() ? null : lst.get(lst.size() - 1));
- }
-
- /**
- * Builds the request parameters from the policy payload.
- *
- * @param policy the policy
- * @param request request into which to stick the request parameters
- */
- private void buildRequestParameters(Policy policy, SoRequestDetails request) {
- // assume null until proven otherwise
- request.setRequestParameters(null);
-
- if (policy.getPayload() == null) {
- return;
- }
-
- String json = policy.getPayload().get(REQ_PARAM_NM);
- if (json == null) {
- return;
- }
-
- request.setRequestParameters(Serialization.gsonPretty.fromJson(json, SoRequestParameters.class));
- }
-
- /**
- * Builds the configuration parameters from the policy payload.
- *
- * @param policy the policy
- * @param request request into which to stick the configuration parameters
- */
- private void buildConfigurationParameters(Policy policy, SoRequestDetails request) {
- // assume null until proven otherwise
- request.setConfigurationParameters(null);
-
- if (policy.getPayload() == null) {
- return;
- }
-
- String json = policy.getPayload().get(CONFIG_PARAM_NM);
- if (json == null) {
- return;
- }
-
- request.setConfigurationParameters(Serialization.gsonPretty.fromJson(json, CONFIG_TYPE));
- }
-
- /**
- * This method is called to remember the last service instance ID, VNF Item VNF ID and vf module ID.
- * Note these fields are static, beware for multithreaded deployments
- *
- * @param vnfInstanceId update the last VNF instance ID to this value
- * @param serviceInstanceId update the last service instance ID to this value
- * @param vfModuleId update the vfModule instance ID to this value
- */
- private static void preserveInstanceIds(final String vnfInstanceId, final String serviceInstanceId,
- final String vfModuleId) {
- lastVNFItemVnfId = vnfInstanceId;
- lastServiceItemServiceInstanceId = serviceInstanceId;
- lastVfModuleItemVfModuleInstanceId = vfModuleId;
- }
-}
diff --git a/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
deleted file mode 100644
index a955eb71c..000000000
--- a/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actor.so.SoActorServiceProvider \ No newline at end of file
diff --git a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java b/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java
deleted file mode 100644
index 272e45ae1..000000000
--- a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * TestSOActorServiceProvider
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018-2019 AT&T. 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.actor.so;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
-import org.onap.policy.aai.AaiNqResponse;
-import org.onap.policy.aai.AaiNqResponseWrapper;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.so.SoOperationType;
-import org.onap.policy.so.SoRequest;
-import org.onap.policy.so.SoRequestParameters;
-import org.onap.policy.so.util.Serialization;
-
-public class SoActorServiceProviderTest {
-
- private static final String VF_MODULE_CREATE = "VF Module Create";
- private static final String VF_MODULE_DELETE = "VF Module Delete";
-
- @Test
- public void testConstructRequest() throws Exception {
- VirtualControlLoopEvent onset = new VirtualControlLoopEvent();
- final ControlLoopOperation operation = new ControlLoopOperation();
- final AaiNqResponseWrapper aaiNqResp = loadAaiResponse(onset, "aai/AaiNqResponse-Full.json");
-
- final UUID requestId = UUID.randomUUID();
- onset.setRequestId(requestId);
-
- Policy policy = new Policy();
- policy.setActor("Dorothy");
- policy.setRecipe("GoToOz");
-
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp));
-
- policy.setActor("SO");
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp));
-
- policy.setRecipe(VF_MODULE_CREATE);
-
- // empty policy payload
- SoRequest request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp);
- assertNotNull(request);
-
- assertEquals("my_module_3", request.getRequestDetails().getRequestInfo().getInstanceName());
- assertEquals("policy", request.getRequestDetails().getRequestInfo().getRequestorId());
- assertEquals("RegionOne", request.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId());
-
- // non-empty policy payload
- policy.setPayload(makePayload());
- request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp);
- assertNotNull(request);
- assertEquals(true, request.getRequestDetails().getRequestParameters().isUsePreload());
- assertEquals("avalue", request.getRequestDetails().getRequestParameters().getUserParams().get(0).get("akey"));
- assertEquals(1, request.getRequestDetails().getConfigurationParameters().size());
- assertEquals("cvalue", request.getRequestDetails().getConfigurationParameters().get(0).get("ckey"));
-
- // payload with config, but no request params
- policy.setPayload(makePayload());
- policy.getPayload().remove(SoActorServiceProvider.REQ_PARAM_NM);
- request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp);
- assertNotNull(request);
- assertNull(request.getRequestDetails().getRequestParameters());
- assertNotNull(request.getRequestDetails().getConfigurationParameters());
-
- // payload with request, but no config params
- policy.setPayload(makePayload());
- policy.getPayload().remove(SoActorServiceProvider.CONFIG_PARAM_NM);
- request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp);
- assertNotNull(request);
- assertNotNull(request.getRequestDetails().getRequestParameters());
- assertNull(request.getRequestDetails().getConfigurationParameters());
-
- // null response
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, null));
-
- // response has no base VF module
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy,
- loadAaiResponse(onset, "aai/AaiNqResponse-NoBase.json")));
-
- // response has no non-base VF modules (other than the "dummy")
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy,
- loadAaiResponse(onset, "aai/AaiNqResponse-NoNonBase.json")));
-
- policy.setRecipe(VF_MODULE_DELETE);
- SoRequest deleteRequest = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp);
- assertNotNull(deleteRequest);
- assertEquals(SoOperationType.DELETE_VF_MODULE, deleteRequest.getOperationType());
-
- /*
- * NOTE: The remaining tests must be done in order
- */
-
- policy.setRecipe(VF_MODULE_CREATE);
-
- // null tenant
- aaiNqResp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems()
- .remove(1);
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp));
-
- // null service item
- aaiNqResp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0)
- .setItems(null);
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp));
-
- // null response
- aaiNqResp.setAaiNqResponse(null);
- assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp));
- }
-
- @Test
- public void testSendRequest() {
- try {
- SoActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null);
- } catch (Exception e) {
- fail("Test should not throw an exception");
- }
- }
-
- @Test
- public void testMethods() {
- SoActorServiceProvider sp = new SoActorServiceProvider();
-
- assertEquals("SO", sp.actor());
- assertEquals(2, sp.recipes().size());
- assertEquals(VF_MODULE_CREATE, sp.recipes().get(0));
- assertEquals(VF_MODULE_DELETE, sp.recipes().get(1));
- assertEquals(0, sp.recipePayloads(VF_MODULE_CREATE).size());
- assertEquals(0, sp.recipeTargets("unknown recipe").size());
- assertEquals(1, sp.recipeTargets(VF_MODULE_CREATE).size());
- }
-
- /**
- * Creates a policy payload containing request & configuration parameters.
- *
- * @return the payload
- */
- private Map<String, String> makePayload() {
- Map<String, String> payload = new TreeMap<>();
-
- payload.put(SoActorServiceProvider.REQ_PARAM_NM, makeReqParams());
- payload.put(SoActorServiceProvider.CONFIG_PARAM_NM, makeConfigParams());
-
- return payload;
- }
-
- /**
- * Creates request parameters.
- *
- * @return request parameters, encoded as JSON
- */
- private String makeReqParams() {
- SoRequestParameters params = new SoRequestParameters();
-
- params.setUsePreload(true);
-
- Map<String, String> map = new TreeMap<>();
- map.put("akey", "avalue");
-
- List<Map<String, String>> lst = new LinkedList<>();
- lst.add(map);
-
- params.setUserParams(lst);
-
- return Serialization.gsonPretty.toJson(params);
- }
-
- /**
- * Creates configuration parameters.
- *
- * @return configuration parameters, encoded as JSON
- */
- private String makeConfigParams() {
- Map<String, String> map = new TreeMap<>();
- map.put("ckey", "cvalue");
-
- List<Map<String, String>> lst = new LinkedList<>();
- lst.add(map);
-
- return Serialization.gsonPretty.toJson(lst);
- }
-
- /**
- * Reads an AAI vserver named-query response from a file.
- *
- * @param onset the ONSET event
- * @param fileName name of the file containing the JSON response
- * @return output from the AAI vserver named-query
- * @throws IOException if the file cannot be read
- */
- private AaiNqResponseWrapper loadAaiResponse(VirtualControlLoopEvent onset, String fileName) throws IOException {
- String resp = IOUtils.toString(getClass().getResource(fileName), StandardCharsets.UTF_8);
- AaiNqResponse aaiNqResponse = Serialization.gsonPretty.fromJson(resp, AaiNqResponse.class);
-
- return new AaiNqResponseWrapper(onset.getRequestId(), aaiNqResponse);
- }
-}
diff --git a/controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json b/controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json
deleted file mode 100644
index af40be948..000000000
--- a/controlloop/common/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/controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json b/controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json
deleted file mode 100644
index 7101f60f2..000000000
--- a/controlloop/common/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/controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json b/controlloop/common/actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json
deleted file mode 100644
index a58100bc5..000000000
--- a/controlloop/common/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/controlloop/common/actors/actor.test/pom.xml b/controlloop/common/actors/actor.test/pom.xml
deleted file mode 100644
index 873c7a64c..000000000
--- a/controlloop/common/actors/actor.test/pom.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2017-2018 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.test</artifactId>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actor.appc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actor.so</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actor.appclcm</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actor.vfc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actor.vfc/pom.xml b/controlloop/common/actors/actor.vfc/pom.xml
deleted file mode 100644
index 0b7b4c4fe..000000000
--- a/controlloop/common/actors/actor.vfc/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2017-2018 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.vfc</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>vfc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${version.policy.common}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${version.policy.drools-pdp}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java
deleted file mode 100644
index 098f1b791..000000000
--- a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2018 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2018-2019 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.actor.vfc;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-
-import org.onap.policy.aai.AaiGetVnfResponse;
-import org.onap.policy.aai.AaiManager;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.rest.RestManager;
-import org.onap.policy.vfc.VfcHealActionVmInfo;
-import org.onap.policy.vfc.VfcHealAdditionalParams;
-import org.onap.policy.vfc.VfcHealRequest;
-import org.onap.policy.vfc.VfcRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VfcActorServiceProvider implements Actor {
- private static final Logger logger = LoggerFactory.getLogger(VfcActorServiceProvider.class);
-
- // Strings for VFC Actor
- private static final String VFC_ACTOR = "VFC";
-
- // Strings for targets
- private static final String TARGET_VM = "VM";
-
- // Strings for recipes
- private static final String RECIPE_RESTART = "Restart";
-
- private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_RESTART);
- private static final ImmutableMap<String, List<String>> targets =
- new ImmutableMap.Builder<String, List<String>>().put(RECIPE_RESTART, ImmutableList.of(TARGET_VM)).build();
-
- @Override
- public String actor() {
- return VFC_ACTOR;
- }
-
- @Override
- public List<String> recipes() {
- return ImmutableList.copyOf(recipes);
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList()));
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- return Collections.emptyList();
- }
-
- /**
- * Construct a request.
- *
- * @param onset the onset event
- * @param operation the control loop operation
- * @param policy the policy
- * @param vnfResponse the VNF response
- * @return the constructed request
- */
- public static VfcRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
- Policy policy, AaiGetVnfResponse vnfResponse) {
-
- // Construct an VFC request
- VfcRequest request = new VfcRequest();
- String serviceInstance = onset.getAai().get("service-instance.service-instance-id");
- if (serviceInstance == null || "".equals(serviceInstance)) {
- AaiGetVnfResponse tempVnfResp = vnfResponse;
- if (tempVnfResp == null) { // if the response is null, we haven't queried
- // This does the AAI query since we haven't already
- tempVnfResp = getAaiServiceInstance(onset);
- if (tempVnfResp == null) {
- return null;
- }
- }
- serviceInstance = tempVnfResp.getServiceId();
- }
- request.setNsInstanceId(serviceInstance);
- request.setRequestId(onset.getRequestId());
- request.setHealRequest(new VfcHealRequest());
- request.getHealRequest().setVnfInstanceId(onset.getAai().get("generic-vnf.vnf-id"));
- request.getHealRequest().setCause(operation.getMessage());
- request.getHealRequest().setAdditionalParams(new VfcHealAdditionalParams());
-
- if (policy.getRecipe().toLowerCase().equalsIgnoreCase(RECIPE_RESTART)) {
- request.getHealRequest().getAdditionalParams().setAction("restartvm");
- request.getHealRequest().getAdditionalParams().setActionInfo(new VfcHealActionVmInfo());
- request.getHealRequest().getAdditionalParams().getActionInfo()
- .setVmid(onset.getAai().get("vserver.vserver-id"));
- request.getHealRequest().getAdditionalParams().getActionInfo()
- .setVmname(onset.getAai().get("vserver.vserver-name"));
- } else {
- return null;
- }
- return request;
- }
-
- private static AaiGetVnfResponse getAaiServiceInstance(VirtualControlLoopEvent event) {
- AaiGetVnfResponse response = null;
- UUID requestId = event.getRequestId();
- String vnfName = event.getAai().get("generic-vnf.vnf-name");
- String vnfId = event.getAai().get("generic-vnf.vnf-id");
- String aaiUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url");
- String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username");
- String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
- try {
- if (vnfName != null) {
- String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
- response = new AaiManager(new RestManager()).getQueryByVnfName(url, aaiUsername, aaiPassword, requestId,
- vnfName);
- } else if (vnfId != null) {
- String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf/";
- response = new AaiManager(new RestManager()).getQueryByVnfId(url, aaiUsername, aaiPassword, requestId,
- vnfId);
- } else {
- logger.error("getAAIServiceInstance failed");
- }
- } catch (Exception e) {
- logger.error("getAAIServiceInstance exception: ", e);
- }
- return response;
- }
-}
diff --git a/controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
deleted file mode 100644
index e43c726cf..000000000
--- a/controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actor.vfc.VfcActorServiceProvider
diff --git a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java
deleted file mode 100644
index 9e6b5b827..000000000
--- a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - Policy Drools Applications
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2018-2019 AT&T Corp. 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.actor.vfc;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import java.util.Objects;
-import java.util.UUID;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.AaiGetVnfResponse;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.simulators.Util;
-import org.onap.policy.vfc.VfcRequest;
-
-public class VfcActorServiceProviderTest {
-
- /**
- * Set up for test class.
- */
- @BeforeClass
- public static void setUpSimulator() {
- try {
- Util.buildAaiSim();
- } catch (Exception e) {
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
-
- @Test
- public void testConstructRequest() {
- VirtualControlLoopEvent onset = new VirtualControlLoopEvent();
- ControlLoopOperation operation = new ControlLoopOperation();
-
- Policy policy = new Policy();
- policy.setRecipe("GoToOz");
-
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null));
-
- onset.getAai().put("generic-vnf.vnf-id", "dorothy.gale.1939");
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null));
-
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null));
-
- UUID requestId = UUID.randomUUID();
- onset.setRequestId(requestId);
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null));
-
- onset.getAai().put("generic-vnf.vnf-name", "Dorothy");
- PolicyEngine.manager.getEnvironment().remove("aai.password");
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null));
-
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null));
-
- onset.getAai().put("service-instance.service-instance-id", "");
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null));
-
- assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()));
-
- policy.setRecipe("Restart");
- assertNotNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()));
-
- VfcRequest request =
- VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse());
-
- assertEquals(requestId, Objects.requireNonNull(request).getRequestId());
- assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId());
- assertEquals("restartvm", request.getHealRequest().getAdditionalParams().getAction());
- }
-
- @Test
- public void testMethods() {
- VfcActorServiceProvider sp = new VfcActorServiceProvider();
-
- assertEquals("VFC", sp.actor());
- assertEquals(1, sp.recipes().size());
- assertEquals("Restart", sp.recipes().get(0));
- assertEquals("VM", sp.recipeTargets("Restart").get(0));
- assertEquals(0, sp.recipePayloads("Restart").size());
- }
-}
diff --git a/controlloop/common/actors/actorServiceProvider/pom.xml b/controlloop/common/actors/actorServiceProvider/pom.xml
deleted file mode 100644
index b89b5806e..000000000
--- a/controlloop/common/actors/actorServiceProvider/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2017-2018 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>actorServiceProvider</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
deleted file mode 100644
index aeb536c57..000000000
--- a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ActorService
- * ================================================================================
- * Copyright (C) 2017-2018 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;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.Iterator;
-import java.util.ServiceLoader;
-
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ActorService {
-
- private static final Logger logger = LoggerFactory.getLogger(ActorService.class);
- private static ActorService service;
-
- // USed to load actors
- private final ServiceLoader<Actor> loader;
-
- private ActorService() {
- loader = ServiceLoader.load(Actor.class);
- }
-
- /**
- * Get the single instance.
- *
- * @return the instance
- */
- public static synchronized ActorService getInstance() {
- if (service == null) {
- service = new ActorService();
- }
- return service;
- }
-
- /**
- * Get the actors.
- *
- * @return the actors
- */
- public ImmutableList<Actor> actors() {
- Iterator<Actor> iter = loader.iterator();
- logger.debug("returning actors");
- while (iter.hasNext()) {
- if (logger.isDebugEnabled()) {
- logger.debug("Got {}", iter.next().actor());
- }
- }
-
- return ImmutableList.copyOf(loader.iterator());
- }
-}
diff --git a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java
deleted file mode 100644
index 47e02a5cb..000000000
--- a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Actor
- * ================================================================================
- * Copyright (C) 2017-2018 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.spi;
-
-import java.util.List;
-
-public interface Actor {
-
- String actor();
-
- List<String> recipes();
-
- List<String> recipeTargets(String recipe);
-
- List<String> recipePayloads(String recipe);
-
-}
diff --git a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java
deleted file mode 100644
index 4e50d855f..000000000
--- a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * TestActorServiceProvider
- * ================================================================================
- * Copyright (C) 2018 Ericsson. 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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-
-public class ActorServiceProviderTest {
-
- @Test
- public void testActorServiceProvider() {
- ActorService actorService = ActorService.getInstance();
- assertNotNull(actorService);
-
- assertEquals(1, actorService.actors().size());
-
- actorService = ActorService.getInstance();
- assertNotNull(actorService);
-
- Actor dummyActor = ActorService.getInstance().actors().get(0);
- assertNotNull(dummyActor);
-
- assertEquals("DummyActor", dummyActor.actor());
-
- assertEquals(2, dummyActor.recipes().size());
- assertEquals("Dorothy", dummyActor.recipes().get(0));
- assertEquals("Wizard", dummyActor.recipes().get(1));
-
- assertEquals(2, dummyActor.recipeTargets("Dorothy").size());
- assertEquals(2, dummyActor.recipePayloads("Dorothy").size());
- }
-}
diff --git a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/DummyActor.java b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/DummyActor.java
deleted file mode 100644
index 2e8512411..000000000
--- a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/DummyActor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * TestActorServiceProvider
- * ================================================================================
- * Copyright (C) 2018 Ericsson. 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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-
-public class DummyActor implements Actor {
- @Override
- public String actor() {
- return this.getClass().getSimpleName();
- }
-
- @Override
- public List<String> recipes() {
- List<String> recipeList = new ArrayList<>();
- recipeList.add("Dorothy");
- recipeList.add("Wizard");
-
- return recipeList;
- }
-
- @Override
- public List<String> recipeTargets(String recipe) {
- List<String> recipeTargetList = new ArrayList<>();
- recipeTargetList.add("Wicked Witch");
- recipeTargetList.add("Wizard of Oz");
-
- return recipeTargetList;
- }
-
- @Override
- public List<String> recipePayloads(String recipe) {
- List<String> recipePayloadList = new ArrayList<>();
- recipePayloadList.add("Dorothy");
- recipePayloadList.add("Toto");
-
- return recipePayloadList;
- }
-}
diff --git a/controlloop/common/actors/actorServiceProvider/src/test/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor b/controlloop/common/actors/actorServiceProvider/src/test/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor
deleted file mode 100644
index 2a4bb5749..000000000
--- a/controlloop/common/actors/actorServiceProvider/src/test/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actorserviceprovider.DummyActor \ No newline at end of file
diff --git a/controlloop/common/actors/pom.xml b/controlloop/common/actors/pom.xml
deleted file mode 100644
index f5247b82c..000000000
--- a/controlloop/common/actors/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- drools-pdp-apps
- ================================================================================
- Copyright (C) 2017-2018 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <packaging>pom</packaging>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>common</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
- <artifactId>actors</artifactId>
-
- <modules>
- <module>actorServiceProvider</module>
- <module>actor.appc</module>
- <module>actor.vfc</module>
- <module>actor.sdnc</module>
- <module>actor.appclcm</module>
- <module>actor.sdnr</module>
- <module>actor.so</module>
- <module>actor.test</module>
- </modules>
- <dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>policy-yaml</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>