aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/actors/actor.sdnr/pom.xml83
-rw-r--r--controlloop/common/actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java255
-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.java147
-rw-r--r--controlloop/common/actors/pom.xml1
-rw-r--r--controlloop/common/controller-casablanca/pom.xml10
-rw-r--r--controlloop/common/eventmanager/pom.xml12
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java59
-rw-r--r--controlloop/common/feature-controlloop-casablanca/pom.xml16
-rw-r--r--controlloop/common/feature-controlloop-casablanca/src/main/feature/config/casablanca-controller.properties19
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java16
-rw-r--r--controlloop/common/model-impl/pom.xml1
-rw-r--r--controlloop/common/model-impl/sdnr/pom.xml46
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java264
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java143
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java96
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java159
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java76
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java91
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java213
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java106
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java114
-rw-r--r--controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml118
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java117
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java215
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciCommonHeader.java144
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequest.java92
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequestWrapper.java66
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseCode.java55
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseWrapper.java68
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciStatus.java74
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciWrapper.java115
-rw-r--r--controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/TestSerialization.java57
-rw-r--r--controlloop/packages/basex-controlloop/src/files/bin/create-cl-casablanca20
-rw-r--r--controlloop/packages/basex-controlloop/src/files/bin/push-policies-casablanca13
-rw-r--r--controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/pom.xml10
-rw-r--r--controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.pcims.onset.json18
-rw-r--r--controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.sdnr.success.json23
-rw-r--r--controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl114
-rw-r--r--controlloop/templates/template.demo/pom.xml12
40 files changed, 3254 insertions, 5 deletions
diff --git a/controlloop/common/actors/actor.sdnr/pom.xml b/controlloop/common/actors/actor.sdnr/pom.xml
new file mode 100644
index 000000000..50ed820c0
--- /dev/null
+++ b/controlloop/common/actors/actor.sdnr/pom.xml
@@ -0,0 +1,83 @@
+<?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
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
+ <artifactId>actors</artifactId>
+ <version>1.3.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>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>policy-management</artifactId>
+ <version>${project.version}</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
new file mode 100644
index 000000000..406870208
--- /dev/null
+++ b/controlloop/common/actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
@@ -0,0 +1,255 @@
+/*-
+ * ============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.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";
+
+ /* 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);
+ }
+}
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
new file mode 100644
index 000000000..c8d5e4c41
--- /dev/null
+++ b/controlloop/common/actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
@@ -0,0 +1 @@
+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
new file mode 100644
index 000000000..030bb9ec4
--- /dev/null
+++ b/controlloop/common/actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java
@@ -0,0 +1,147 @@
+/*-
+ * 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 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.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.sdnr.PciRequest;
+import org.onap.policy.sdnr.PciResponse;
+import org.onap.policy.sdnr.util.Serialization;
+import org.onap.policy.simulators.Util;
+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 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/pom.xml b/controlloop/common/actors/pom.xml
index 3bdb57c5f..3c2162b18 100644
--- a/controlloop/common/actors/pom.xml
+++ b/controlloop/common/actors/pom.xml
@@ -36,6 +36,7 @@
<module>actor.appc</module>
<module>actor.vfc</module>
<module>actor.appclcm</module>
+ <module>actor.sdnr</module>
<module>actor.so</module>
<module>actor.test</module>
</modules>
diff --git a/controlloop/common/controller-casablanca/pom.xml b/controlloop/common/controller-casablanca/pom.xml
index b567e39f8..f606d690e 100644
--- a/controlloop/common/controller-casablanca/pom.xml
+++ b/controlloop/common/controller-casablanca/pom.xml
@@ -90,6 +90,11 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
+ <artifactId>sdnr</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
<artifactId>vfc</artifactId>
<version>${project.version}</version>
</dependency>
@@ -140,6 +145,11 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
+ <artifactId>actor.sdnr</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
<artifactId>actor.so</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml
index 4e01c6699..deb17b8aa 100644
--- a/controlloop/common/eventmanager/pom.xml
+++ b/controlloop/common/eventmanager/pom.xml
@@ -66,6 +66,12 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
+ <artifactId>actor.sdnr</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>
@@ -102,6 +108,12 @@
</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>appc</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index f1d912ef5..1ad1e5af7 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -26,8 +26,8 @@ import java.time.Instant;
import java.util.AbstractMap;
import java.util.LinkedList;
import java.util.List;
-import java.util.Properties;
import java.util.NoSuchElementException;
+import java.util.Properties;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
@@ -43,12 +43,14 @@ import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actor.appc.APPCActorServiceProvider;
import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider;
+import org.onap.policy.controlloop.actor.sdnr.SdnrActorServiceProvider;
import org.onap.policy.controlloop.actor.so.SOActorServiceProvider;
import org.onap.policy.controlloop.actor.vfc.VFCActorServiceProvider;
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.guard.Util;
+import org.onap.policy.sdnr.PciResponseWrapper;
import org.onap.policy.so.SOResponseWrapper;
import org.onap.policy.vfc.VFCResponse;
import org.slf4j.Logger;
@@ -214,6 +216,8 @@ public class ControlLoopOperationManager implements Serializable {
break;
case "SO":
break;
+ case "SDNR":
+ break;
case "VFC":
break;
default:
@@ -284,6 +288,21 @@ public class ControlLoopOperationManager implements Serializable {
this.policyResult = PolicyResult.FAILURE;
}
return operationRequest;
+ case "SDNR":
+ /*
+ * If the recipe is ModifyConfig, a SDNR request is constructed.
+ */
+ this.currentOperation = operation;
+ this.operationRequest = SdnrActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
+ operation.clOperation, this.policy);
+ //
+ // Save the operation
+ //
+ if (this.operationRequest == null) {
+ this.policyResult = PolicyResult.FAILURE;
+ }
+
+ return operationRequest;
default:
throw new ControlLoopException("invalid actor " + policy.getActor() + " on policy");
}
@@ -309,6 +328,11 @@ public class ControlLoopOperationManager implements Serializable {
// Cast LCM response and handle it
//
return onResponse((LcmResponseWrapper) response);
+ } else if (response instanceof PciResponseWrapper) {
+ //
+ // Cast SDNR response and handle it
+ //
+ return onResponse((PciResponseWrapper) response);
} else if (response instanceof SOResponseWrapper) {
//
// Cast SO response and handle it
@@ -451,6 +475,39 @@ public class ControlLoopOperationManager implements Serializable {
}
/**
+ * This method handles operation responses from SDNR.
+ *
+ * @param dmaapResponse the SDNR response
+ * @return the result of the response handling
+ */
+ private PolicyResult onResponse(PciResponseWrapper dmaapResponse) {
+ /*
+ * Parse out the operation attempt using the subrequestid
+ */
+ Integer operationAttempt = SdnrActorServiceProvider
+ .parseOperationAttempt(dmaapResponse.getBody().getCommonHeader().getSubRequestId());
+ if (operationAttempt == null) {
+ this.completeOperation(operationAttempt, "Policy was unable to parse SDNR SubRequestID.",
+ PolicyResult.FAILURE_EXCEPTION);
+ }
+
+ /*
+ * Process the SDNR response to see what PolicyResult should be returned
+ */
+ SdnrActorServiceProvider.Pair<PolicyResult, String> result =
+ SdnrActorServiceProvider.processResponse(dmaapResponse);
+
+ if (result.getResult() != null) {
+ this.completeOperation(operationAttempt, result.getMessage(), result.getResult());
+ if (PolicyResult.FAILURE_TIMEOUT.equals(this.policyResult)) {
+ return null;
+ }
+ return result.getResult();
+ }
+ return null;
+ }
+
+ /**
* This method handles operation responses from SO.
*
* @param msoResponse the SO response
diff --git a/controlloop/common/feature-controlloop-casablanca/pom.xml b/controlloop/common/feature-controlloop-casablanca/pom.xml
index 258b7596f..ccdda5e31 100644
--- a/controlloop/common/feature-controlloop-casablanca/pom.xml
+++ b/controlloop/common/feature-controlloop-casablanca/pom.xml
@@ -113,6 +113,11 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
+ <artifactId>sdnr</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
<artifactId>vfc</artifactId>
<version>${project.version}</version>
</dependency>
@@ -181,6 +186,17 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
+ <artifactId>actor.sdnr</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
<artifactId>actor.so</artifactId>
<version>${project.version}</version>
<exclusions>
diff --git a/controlloop/common/feature-controlloop-casablanca/src/main/feature/config/casablanca-controller.properties b/controlloop/common/feature-controlloop-casablanca/src/main/feature/config/casablanca-controller.properties
index 5c055009b..3ec25f7a2 100644
--- a/controlloop/common/feature-controlloop-casablanca/src/main/feature/config/casablanca-controller.properties
+++ b/controlloop/common/feature-controlloop-casablanca/src/main/feature/config/casablanca-controller.properties
@@ -20,7 +20,7 @@
controller.name=casablanca
-dmaap.source.topics=${{PDPD_CONFIGURATION_TOPIC}},${{DCAE_TOPIC}},APPC-CL,APPC-LCM-WRITE
+dmaap.source.topics=${{PDPD_CONFIGURATION_TOPIC}},${{DCAE_TOPIC}},APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP
dmaap.source.topics.${{PDPD_CONFIGURATION_TOPIC}}.servers=${{PDPD_CONFIGURATION_SERVERS}}
dmaap.source.topics.${{PDPD_CONFIGURATION_TOPIC}}.apiKey=
@@ -54,7 +54,7 @@ dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.LcmResponseWra
dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
dmaap.source.topics.APPC-LCM-WRITE.https=true
-dmaap.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT
+dmaap.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL
dmaap.sink.topics.APPC-CL.servers=${{DMAAP_SERVERS}}
dmaap.sink.topics.APPC-CL.apiKey=
@@ -80,3 +80,18 @@ dmaap.sink.topics.POLICY-CL-MGT.https=true
rules.groupId=${project.groupId}
rules.artifactId=controller-casablanca
rules.version=${project.version}
+
+dmaap.sink.topics.SDNR-CL.servers=${{DMAAP_SERVERS}}
+dmaap.sink.topics.SDNR-CL.apiKey=
+dmaap.sink.topics.SDNR-CL.apiSecret=
+dmaap.sink.topics.SDNR-CL.events=org.onap.policy.sdnr.PciRequestWrapper
+dmaap.sink.topics.SDNR-CL.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
+dmaap.sink.topics.SDNR-CL.https=true
+
+dmaap.source.topics.SDNR-CL-RSP.servers=${{DMAAP_SERVERS}}
+dmaap.source.topics.SDNR-CL-RSP.apiKey=
+dmaap.source.topics.SDNR-CL-RSP.apiSecret=
+dmaap.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper
+dmaap.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=type\=response
+dmaap.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
+dmaap.source.topics.SDNR-CL-RSP.https=true
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java
index eab04e22e..2753ececc 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java
@@ -20,11 +20,11 @@
package org.onap.policy.controlloop;
-import com.google.gson.annotations.SerializedName;
-
import java.io.Serializable;
import java.util.UUID;
+import com.google.gson.annotations.SerializedName;
+
public abstract class ControlLoopEvent implements Serializable {
private static final long serialVersionUID = 2391252138583119195L;
@@ -62,6 +62,9 @@ public abstract class ControlLoopEvent implements Serializable {
@SerializedName("closedLoopEventStatus")
private ControlLoopEventStatus closedLoopEventStatus;
+ @SerializedName("payload")
+ private String payload;
+
public ControlLoopEvent() {
}
@@ -85,6 +88,7 @@ public abstract class ControlLoopEvent implements Serializable {
this.policyName = event.policyName;
this.policyVersion = event.policyVersion;
this.closedLoopEventStatus = event.closedLoopEventStatus;
+ this.payload = event.payload;
}
public boolean isEventStatusValid() {
@@ -178,4 +182,12 @@ public abstract class ControlLoopEvent implements Serializable {
public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) {
this.closedLoopEventStatus = closedLoopEventStatus;
}
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String payload) {
+ this.payload = payload;
+ }
}
diff --git a/controlloop/common/model-impl/pom.xml b/controlloop/common/model-impl/pom.xml
index 01a789b66..ebf35b8f6 100644
--- a/controlloop/common/model-impl/pom.xml
+++ b/controlloop/common/model-impl/pom.xml
@@ -36,6 +36,7 @@
<module>aai</module>
<module>appc</module>
<module>appclcm</module>
+ <module>sdnr</module>
<module>events</module>
<module>so</module>
<module>rest</module>
diff --git a/controlloop/common/model-impl/sdnr/pom.xml b/controlloop/common/model-impl/sdnr/pom.xml
new file mode 100644
index 000000000..de67a4d96
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/pom.xml
@@ -0,0 +1,46 @@
+<!--
+ ============LICENSE_START=======================================================
+ Drools PDP Application Models
+ ================================================================================
+ 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.model-impl</groupId>
+ <artifactId>model-impl</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sdnr</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java
new file mode 100644
index 000000000..d9e59ad3b
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java
@@ -0,0 +1,264 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class PciCommonHeader implements Serializable {
+
+ private static final long serialVersionUID = 5435363539127062114L;
+
+ @SerializedName(value = "TimeStamp")
+ private Instant timeStamp = Instant.now();
+
+ @SerializedName(value = "APIVer")
+ private String apiVer = "1.0";
+
+ @SerializedName(value = "RequestID")
+ private UUID requestId;
+
+ @SerializedName(value = "SubRequestID")
+ private String subRequestId;
+
+ @SerializedName(value = "RequestTrack")
+ private Map<String, String> requestTrack = new HashMap<>();
+
+ @SerializedName(value = "Flags")
+ private Map<String, String> flags = new HashMap<>();
+
+ public PciCommonHeader() {
+
+ }
+
+ /**
+ * Used to copy a pci common header.
+ *
+ * @param commonHeader a header that is defined by the Pci api guide that contains information
+ * about the request (requestId, flags, etc.)
+ */
+ public PciCommonHeader(PciCommonHeader commonHeader) {
+ this.timeStamp = commonHeader.timeStamp;
+ this.requestId = commonHeader.requestId;
+ this.subRequestId = commonHeader.subRequestId;
+ if (commonHeader.requestTrack != null) {
+ this.requestTrack.putAll(commonHeader.requestTrack);
+ }
+ if (commonHeader.flags != null) {
+ this.flags.putAll(commonHeader.flags);
+ }
+ }
+
+ /**
+ * Get the timestamp.
+ *
+ * @return the timeStamp
+ */
+ public Instant getTimeStamp() {
+ return timeStamp;
+ }
+
+ /**
+ * Set the timestamp.
+ *
+ * @param timeStamp
+ * the timeStamp to set
+ */
+ public void setTimeStamp(Instant timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+ /**
+ * Get the API version.
+ *
+ * @return the apiVer
+ */
+ public String getApiVer() {
+ return apiVer;
+ }
+
+ /**
+ * Set the API version.
+ *
+ * @param apiVer
+ * the apiVer to set
+ */
+ public void setApiVer(String apiVer) {
+ this.apiVer = apiVer;
+ }
+
+ /**
+ * Get the request Id.
+ *
+ * @return the requestId
+ */
+ public UUID getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Set the request Id.
+ *
+ * @param requestId
+ * the requestId to set
+ */
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * Get the sub request Id.
+ *
+ * @return the subRequestId
+ */
+ public String getSubRequestId() {
+ return subRequestId;
+ }
+
+ /**
+ * Set the sub request Id.
+ *
+ * @param subRequestId
+ * the subRequestId to set
+ */
+ public void setSubRequestId(String subRequestId) {
+ this.subRequestId = subRequestId;
+ }
+ /**
+ * Set the request track.
+ *
+ * @param requestTrack
+ * the requestTrack to set
+ */
+ public void setRequestTrack(Map<String, String> requestTrack) {
+ this.requestTrack = requestTrack;
+ }
+ /**
+ * Get the request track.
+ *
+ * @return the requestTrack
+ */
+ public Map<String, String> getRequestTrack() {
+ return requestTrack;
+ }
+
+ /**
+ * Get the flags.
+ *
+ * @return the flags
+ */
+ public Map<String, String> getFlags() {
+ return flags;
+ }
+
+ /**
+ * Set the flags.
+ *
+ * @param flags
+ * the flags to set
+ */
+ public void setFlags(Map<String, String> flags) {
+ this.flags = flags;
+ }
+
+ @Override
+ public String toString() {
+ return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer
+ + ", requestId=" + requestId + ", subRequestId=" + subRequestId + ", requestTrack=" + requestTrack
+ + ", flags=" + flags + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((apiVer == null) ? 0 : apiVer.hashCode());
+ result = prime * result + ((flags == null) ? 0 : flags.hashCode());
+ result = prime * result + ((requestTrack == null) ? 0 : requestTrack.hashCode());
+ result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
+ result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode());
+ result = prime * result + ((timeStamp == null) ? 0 : timeStamp.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PciCommonHeader other = (PciCommonHeader) obj;
+ if (apiVer == null) {
+ if (other.apiVer != null) {
+ return false;
+ }
+ } else if (!apiVer.equals(other.apiVer)) {
+ return false;
+ }
+ if (flags == null) {
+ if (other.flags != null) {
+ return false;
+ }
+ } else if (!flags.equals(other.flags)) {
+ return false;
+ }
+ if (requestTrack == null) {
+ if (other.requestTrack != null) {
+ return false;
+ }
+ } else if (!requestTrack.equals(other.requestTrack)) {
+ return false;
+ }
+ if (requestId == null) {
+ if (other.requestId != null) {
+ return false;
+ }
+ } else if (!requestId.equals(other.requestId)) {
+ return false;
+ }
+ if (subRequestId == null) {
+ if (other.subRequestId != null) {
+ return false;
+ }
+ } else if (!subRequestId.equals(other.subRequestId)) {
+ return false;
+ }
+ if (timeStamp == null) {
+ if (other.timeStamp != null) {
+ return false;
+ }
+ } else if (!timeStamp.equals(other.timeStamp)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java
new file mode 100644
index 000000000..5155f0b5c
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class PciRequest implements Serializable {
+
+ private static final long serialVersionUID = 323235565922846624L;
+
+ @SerializedName(value = "CommonHeader")
+ private PciCommonHeader commonHeader;
+
+ @SerializedName(value = "Action")
+ private String action;
+
+ @SerializedName(value = "Payload")
+ private String payload;
+
+ public PciRequest() {
+ // Create a default PCI request
+ }
+
+ public PciCommonHeader getCommonHeader() {
+ return commonHeader;
+ }
+
+ public void setCommonHeader(PciCommonHeader commonHeader) {
+ this.commonHeader = commonHeader;
+ }
+
+ /**
+ * Get the action.
+ *
+ * @return the action
+ */
+ public String getAction() {
+ return action;
+ }
+
+ /**
+ * Set the action.
+ *
+ * @param action
+ * the action to set
+ */
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ /**
+ * Get the payload.
+ *
+ * @return the payload
+ */
+
+ public String getPayload() {
+ return payload;
+ }
+
+ /**
+ * Set the payload.
+ *
+ * @param action
+ * the action to set
+ */
+
+ public void setPayload(String payload) {
+ this.payload = payload;
+ }
+
+ @Override
+ public String toString() {
+ return "PciRequest[commonHeader=" + commonHeader + ", action=" + action + ", payload=" + payload + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
+ result = prime * result + ((action == null) ? 0 : action.hashCode());
+ result = prime * result + ((payload == null) ? 0 : payload.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PciRequest other = (PciRequest) obj;
+ if (commonHeader == null) {
+ if (other.commonHeader != null) {
+ return false;
+ }
+ } else if (!commonHeader.equals(other.commonHeader)) {
+ return false;
+ }
+ if (action == null) {
+ if (other.action != null) {
+ return false;
+ }
+ } else if (!action.equals(other.action)) {
+ return false;
+ }
+ if (payload == null) {
+ if (other.payload != null) {
+ return false;
+ }
+ } else if (!payload.equals(other.payload)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java
new file mode 100644
index 000000000..5a84009c0
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class PciRequestWrapper extends PciWrapper implements Serializable {
+
+ private static final long serialVersionUID = 879766924715980798L;
+
+ @SerializedName(value = "body")
+ private PciRequest body;
+
+ public PciRequestWrapper() {
+ super();
+ }
+
+ public PciRequestWrapper(PciRequest request) {
+ body = request;
+ }
+
+ /**
+ * Get the body.
+ *
+ * @return the body
+ */
+ public PciRequest getBody() {
+ return body;
+ }
+
+ /**
+ * Set the body.
+ *
+ * @param body
+ * the body to set
+ */
+ public void setBody(PciRequest body) {
+ this.body = body;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestWrapper [body=" + body + ", toString()=" + super.toString() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((body == null) ? 0 : body.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PciRequestWrapper other = (PciRequestWrapper) obj;
+ if (body == null) {
+ if (other.body != null) {
+ return false;
+ }
+ } else if (!body.equals(other.body)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java
new file mode 100644
index 000000000..21750e1bd
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java
@@ -0,0 +1,159 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class PciResponse implements Serializable {
+
+ private static final long serialVersionUID = 8375708697287669750L;
+
+ @SerializedName(value = "CommonHeader")
+ private PciCommonHeader commonHeader;
+
+ @SerializedName(value = "Status")
+ private Status status = new Status();
+
+ @SerializedName(value = "Payload")
+ private String payload;
+
+ public PciResponse() {
+ // EMPTY
+ }
+
+ /**
+ * Constructs a response using the common header of the request since they will
+ * be the same.
+ *
+ * @param request
+ * an sdnr Pci request object specified by the Pci api guide
+ */
+ public PciResponse(PciRequest request) {
+ this.commonHeader = new PciCommonHeader(request.getCommonHeader());
+
+ }
+
+ /**
+ * Get the common header.
+ *
+ * @return the commonHeader
+ */
+ public PciCommonHeader getCommonHeader() {
+ return commonHeader;
+ }
+
+ /**
+ * Set the common header.
+ *
+ * @param commonHeader
+ * the commonHeader to set
+ */
+ public void setCommonHeader(PciCommonHeader commonHeader) {
+ this.commonHeader = commonHeader;
+ }
+
+ /**
+ * Get the status.
+ *
+ * @return the status
+ */
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * Set the status.
+ *
+ * @param status
+ * the status to set
+ */
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ /**
+ * Get the payload.
+ *
+ * @return the payload
+ */
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String payload) {
+ this.payload = payload;
+ }
+
+ @Override
+ public String toString() {
+ return "PciResponse[CommonHeader=" + commonHeader + ", Status=" + status + ", Payload="
+ + payload + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
+ result = prime * result + ((payload == null) ? 0 : payload.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PciResponse other = (PciResponse) obj;
+ if (commonHeader == null) {
+ if (other.commonHeader != null) {
+ return false;
+ }
+ } else if (!commonHeader.equals(other.commonHeader)) {
+ return false;
+ }
+ if (payload == null) {
+ if (other.payload != null) {
+ return false;
+ }
+ } else if (!payload.equals(other.payload)) {
+ return false;
+ }
+ if (status == null) {
+ if (other.status != null) {
+ return false;
+ }
+ } else if (!status.equals(other.status)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java
new file mode 100644
index 000000000..eba57366d
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+public class PciResponseCode {
+
+ /* These fields define the key to the response code value. */
+ public static final String ACCEPTED = "ACCEPTED";
+ public static final String ERROR = "ERROR";
+ public static final String REJECT = "REJECT";
+ public static final String SUCCESS = "SUCCESS";
+ public static final String FAILURE = "FAILURE";
+ public static final String PARTIAL_SUCCESS = "PARTIAL SUCCESS";
+ public static final String PARTIAL_FAILURE = "PARTIAL FAILURE";
+
+ private Integer code;
+
+ protected PciResponseCode(final int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return this.code;
+ }
+
+ @Override
+ public String toString() {
+ return Integer.toString(this.code);
+ }
+
+ /**
+ * Translates the code to a string value that represents the meaning of the
+ * code.
+ *
+ * @param code
+ * the numeric value that is returned by SDNR based on success,
+ * failure, etc. of the action requested
+ * @return the string value equivalent of the SDNR response code
+ */
+ public static String toResponseValue(int code) {
+ if (code == 100) {
+ return ACCEPTED;
+ } else if (code == 200) {
+ return SUCCESS;
+ } else if (code >= 300 && code <= 313) {
+ return REJECT;
+ } else if (code == 400) {
+ return ERROR;
+ } else if (code == 450 || (code >= 401 && code <= 406)) {
+ return FAILURE;
+ } else if (code == 500) {
+ return PARTIAL_SUCCESS;
+ } else if (code >= 501 && code <= 599) {
+ return PARTIAL_FAILURE;
+ }
+ return null;
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java
new file mode 100644
index 000000000..696d08623
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class PciResponseWrapper extends PciWrapper implements Serializable {
+
+ private static final long serialVersionUID = 109837814781086802L;
+
+ @SerializedName(value = "body")
+ private PciResponse body;
+
+ public PciResponseWrapper() {
+ super();
+ }
+
+ /**
+ * Get the body.
+ *
+ * @return the body
+ */
+ public PciResponse getBody() {
+ return body;
+ }
+
+ /**
+ * Set the body.
+ *
+ * @param body
+ * the body to set
+ */
+ public void setBody(PciResponse body) {
+ this.body = body;
+ }
+
+ @Override
+ public String toString() {
+ return "ResponseWrapper [body=" + body + ", toString()=" + super.toString() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((body == null) ? 0 : body.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PciResponseWrapper other = (PciResponseWrapper) obj;
+ if (body == null) {
+ if (other.body != null) {
+ return false;
+ }
+ } else if (!body.equals(other.body)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java
new file mode 100644
index 000000000..456c57877
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java
@@ -0,0 +1,213 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class PciWrapper implements Serializable {
+
+ private static final long serialVersionUID = 375215806432396532L;
+
+ @SerializedName(value = "version")
+ private String version;
+
+ @SerializedName(value = "cambria-partition")
+ private String cambriaPartition;
+
+ @SerializedName(value = "rpc-name")
+ private String rpcName;
+
+ @SerializedName(value = "correlation-id")
+ private String correlationId;
+
+ @SerializedName(value = "type")
+ private String type;
+
+ public PciWrapper() {
+ // Create a default PciWrapper instance
+ }
+
+ /**
+ * Get the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Set the version.
+ *
+ * @param version
+ * the version to set
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Get the cambria partition.
+ *
+ * @return the cambriaPartition
+ */
+ public String getCambriaPartition() {
+ return cambriaPartition;
+ }
+
+ /**
+ * Set the cambria partition.
+ *
+ * @param cambriaPartition
+ * the cambriaPartition to set
+ */
+ public void setCambriaPartition(String cambriaPartition) {
+ this.cambriaPartition = cambriaPartition;
+ }
+
+ /**
+ * Get the RPN name.
+ *
+ * @return the rpcName
+ */
+ public String getRpcName() {
+ return rpcName;
+ }
+
+ /**
+ * Set the RPC name.
+ *
+ * @param rpcName
+ * the rpcName to set
+ */
+ public void setRpcName(String rpcName) {
+ this.rpcName = rpcName;
+ }
+
+ /**
+ * Get the correlation Id.
+ *
+ * @return the correlationId
+ */
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ /**
+ * Set the correclation Id.
+ *
+ * @param correlationId
+ * the correlationId to set
+ */
+ public void setCorrelationId(String correlationId) {
+ this.correlationId = correlationId;
+ }
+
+ /**
+ * Get the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Set the type.
+ *
+ * @param type
+ * the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "Wrapper [version=" + version + ", cambriaPartition=" + cambriaPartition + ", rpcName=" + rpcName
+ + ", correlationId=" + correlationId + ", type=" + type + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((cambriaPartition == null) ? 0 : cambriaPartition.hashCode());
+ result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode());
+ result = prime * result + ((rpcName == null) ? 0 : rpcName.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PciWrapper other = (PciWrapper) obj;
+ if (cambriaPartition == null) {
+ if (other.cambriaPartition != null) {
+ return false;
+ }
+ } else if (!cambriaPartition.equals(other.cambriaPartition)) {
+ return false;
+ }
+ if (correlationId == null) {
+ if (other.correlationId != null) {
+ return false;
+ }
+ } else if (!correlationId.equals(other.correlationId)) {
+ return false;
+ }
+ if (rpcName == null) {
+ if (other.rpcName != null) {
+ return false;
+ }
+ } else if (!rpcName.equals(other.rpcName)) {
+ return false;
+ }
+ if (type == null) {
+ if (other.type != null) {
+ return false;
+ }
+ } else if (!type.equals(other.type)) {
+ return false;
+ }
+ if (version == null) {
+ if (other.version != null) {
+ return false;
+ }
+ } else if (!version.equals(other.version)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java
new file mode 100644
index 000000000..dc0295ae1
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class Status implements Serializable {
+
+ private static final long serialVersionUID = 877641506135467199L;
+
+ @SerializedName(value = "Code")
+ private int code;
+
+ @SerializedName(value = "Value")
+ private String value;
+
+ public Status() {
+ // Create a default PciResponseStatus instance
+ }
+
+ /**
+ * Constructor for the class Status.
+ *
+ */
+ public Status(int code, String value) {
+ super();
+ this.code = code;
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ @Override
+ public String toString() {
+ return "Status [code = " + code + ", value = " + value + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + code;
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Status other = (Status) obj;
+ if (code != other.code) {
+ return false;
+ }
+ if (value == null) {
+ if (other.value != null) {
+ return false;
+ }
+ } else if (!value.equals(other.value)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java
new file mode 100644
index 000000000..0208884ce
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr.util;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+import java.lang.reflect.Type;
+import java.time.Instant;
+
+import org.onap.policy.sdnr.PciRequest;
+import org.onap.policy.sdnr.PciResponse;
+
+
+public final class Serialization {
+ private Serialization() {}
+
+ public static class RequestAdapter implements JsonSerializer<PciRequest>, JsonDeserializer<PciRequest> {
+
+ @Override
+ public JsonElement serialize(PciRequest src, Type typeOfSrc, JsonSerializationContext context) {
+ JsonElement requestJson = gsonPretty.toJsonTree(src, PciRequest.class);
+ JsonObject input = new JsonObject();
+ input.add("input", requestJson);
+
+ return input;
+ }
+
+ @Override
+ public PciRequest deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
+ return gsonPretty.fromJson(json.getAsJsonObject().get("input"), PciRequest.class);
+ }
+ }
+
+ public static class ResponseAdapter implements JsonSerializer<PciResponse>, JsonDeserializer<PciResponse> {
+
+ @Override
+ public JsonElement serialize(PciResponse src, Type typeOfSrc, JsonSerializationContext context) {
+ JsonElement responseJson = gsonPretty.toJsonTree(src, PciResponse.class);
+ JsonObject output = new JsonObject();
+ output.add("output", responseJson);
+ return output;
+ }
+
+ @Override
+ public PciResponse deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
+ return gsonPretty.fromJson(json.getAsJsonObject().get("output"), PciResponse.class);
+ }
+ }
+
+ public static class InstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> {
+
+ @Override
+ public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
+ return Instant.parse(json.getAsString());
+ }
+
+ @Override
+ public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) {
+ return new JsonPrimitive(src.toString());
+ }
+
+ }
+
+ public static class InstantJunitAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> {
+
+ @Override
+ public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
+ return Instant.ofEpochMilli(json.getAsLong());
+ }
+
+ @Override
+ public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) {
+ return new JsonPrimitive(src.toEpochMilli());
+ }
+
+ }
+
+ public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting()
+ .registerTypeAdapter(Instant.class, new InstantAdapter()).create();
+
+ public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting()
+ .registerTypeAdapter(PciRequest.class, new RequestAdapter())
+ .registerTypeAdapter(PciResponse.class, new ResponseAdapter()).create();
+
+ public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting()
+ .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create();
+
+}
diff --git a/controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml b/controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml
new file mode 100644
index 000000000..c128ab483
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml
@@ -0,0 +1,118 @@
+###
+# ============LICENSE_START=======================================================
+# sdnr
+# ================================================================================
+# 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=========================================================
+###
+
+Request:
+ type: object
+ properties:
+ CommonHeader:
+ type: object
+ properties:
+ TimeStamp:
+ type: string
+ APIver:
+ type: string
+ value: '1.01'
+ OriginatorID:
+ type: string
+ RequestID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ SubRequestID:
+ type: string
+ Flags:
+ type: object
+ required:
+ - TimeStamp
+ - APIver
+ - OriginatorID
+ - RequestID
+ Action:
+ type: string
+ enum:
+ - Audit
+ - ActionStatus
+ - BlockAudits
+ - Configure
+ - HealthCheck
+ - Install
+ - LiveUpgrade
+ - Migrate
+ - ModifyConfig
+ - Query
+ - Rebuild
+ - Reconfigure
+ - Restart
+ - Rollback
+ - Scale
+ - Start
+ - Stop
+ - Sync
+ - Terminate
+ - Test
+ - Upgrade
+ TargetID:
+ type: string
+ ObjectID:
+ type: string
+ Payload:
+ type: object
+ required:
+ - CommonHeader
+ - Action
+ - TargetID
+Response:
+ type: object
+ properties:
+ CommonHeader:
+ type: object
+ properties:
+ TimeStamp:
+ type: string
+ APIver:
+ type: string
+ OriginatorID:
+ type: string
+ RequestID:
+ type: string
+ SubRequestID:
+ type: string
+ Flags:
+ type: object
+ required:
+ - TimeStamp
+ - APIver
+ - OriginatorID
+ - RequestID
+ Status:
+ type: object
+ properties:
+ Code:
+ type: integer
+ Value:
+ type: string
+ required:
+ - Code
+ - Value
+ Payload:
+ type: object
+ required:
+ - CommonHeader
+ - Status
+
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
new file mode 100644
index 000000000..52137ef7d
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class PciResponseTest {
+
+ Status status = new Status(0, "");
+
+ String responsePayload = "";
+ String requestPayload = "";
+
+
+ @Test
+ public void testHashCode() {
+ PciResponse response = new PciResponse();
+ assertTrue(response.hashCode() != 0);
+ response.setCommonHeader(new PciCommonHeader());
+ assertTrue(response.hashCode() != 0);
+ response.setPayload(responsePayload);
+ assertTrue(response.hashCode() != 0);
+ response.setStatus(null);
+ assertTrue(response.hashCode() != 0);
+ }
+
+ @Test
+ public void testPciResponse() {
+ PciResponse response = new PciResponse();
+ assertNull(response.getCommonHeader());
+ assertNull(response.getPayload());
+ assertNotNull(response.getStatus());
+ }
+
+ @Test
+ public void testToString() {
+ PciResponse response = new PciResponse();
+ assertFalse(response.toString().isEmpty());
+ }
+
+ @Test
+ public void testEqualsObject() {
+ PciResponse response = new PciResponse();
+ assertTrue(response.equals(response));
+ assertFalse(response.equals(null));
+ assertFalse(response.equals(new Object()));
+
+ PciResponse response2 = new PciResponse();
+ assertTrue(response.equals(response2));
+
+ response.setCommonHeader(new PciCommonHeader());
+ assertFalse(response.equals(response2));
+ response2.setCommonHeader(response.getCommonHeader());
+ assertTrue(response.equals(response2));
+
+ response.setPayload(responsePayload);
+ assertFalse(response.equals(response2));
+ response2.setPayload(response.getPayload());
+ assertTrue(response.equals(response2));
+
+ response.setCommonHeader(null);
+ assertFalse(response.equals(response2));
+ response2.setCommonHeader(null);
+ assertTrue(response.equals(response2));
+
+ response.setPayload(null);
+ assertFalse(response.equals(response2));
+ response2.setPayload(response.getPayload());
+ assertTrue(response.equals(response2));
+
+ response.setStatus(null);
+ assertFalse(response.equals(response2));
+ response2.setStatus(response.getStatus());
+ assertTrue(response.equals(response2));
+
+ Status status = new Status();
+ status.setCode(5);
+ response.setStatus(status);
+ response2.setStatus(new Status());
+ assertFalse(response.equals(response2));
+ }
+
+ @Test
+ public void testResponseRequest() {
+ PciRequest request = new PciRequest();
+ request.setCommonHeader(new PciCommonHeader());
+ request.setPayload(requestPayload);
+
+ PciResponse response = new PciResponse(request);
+
+ assertTrue(response.getCommonHeader().equals(request.getCommonHeader()));
+ }
+
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
new file mode 100644
index 000000000..f975e5575
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
@@ -0,0 +1,215 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.policy.sdnr.util.Serialization;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdnrTest {
+
+ private static final Logger logger = LoggerFactory.getLogger(SdnrTest.class);
+
+ private static PciRequestWrapper dmaapRequest;
+ private static PciResponseWrapper dmaapResponse;
+
+ static {
+ /*
+ * Construct an SDNR Request to be Serialized
+ */
+ dmaapRequest = new PciRequestWrapper();
+ dmaapRequest.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1");
+ dmaapRequest.setRpcName("restart");
+ dmaapRequest.setType("request");
+
+ dmaapResponse = new PciResponseWrapper();
+ dmaapResponse.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1");
+ dmaapResponse.setRpcName("restart");
+ dmaapResponse.setType("response");
+
+ PciRequest sdnrRequest = new PciRequest();
+
+ sdnrRequest.setAction("ModifyConfig");
+
+ PciCommonHeader commonHeader = new PciCommonHeader();
+ commonHeader.setRequestId(UUID.fromString("664be3d2-6c12-4f4b-a3e7-c349acced200"));
+ commonHeader.setSubRequestId("1");
+
+ sdnrRequest.setCommonHeader(commonHeader);
+
+ sdnrRequest.setPayload(null);
+
+ dmaapRequest.setBody(sdnrRequest);
+
+ /*
+ * Construct an SDNR Response to be Serialized
+ */
+ PciResponse sdnrResponse = new PciResponse(sdnrRequest);
+ sdnrResponse.getStatus().setCode(400);
+ sdnrResponse.getStatus().setValue("Restart Successful");
+ sdnrResponse.setPayload(null);
+
+ dmaapResponse.setBody(sdnrResponse);
+ }
+
+ @Test
+ public void testRequestSerialization() {
+
+ /*
+ * Use the gson serializer to obtain json
+ */
+ String jsonRequest = Serialization.gson.toJson(dmaapRequest, PciRequestWrapper.class);
+ assertNotNull(jsonRequest);
+
+ /*
+ * The serializer should have added an extra sub-tag called "input" that wraps the request
+ */
+ assertTrue(jsonRequest.contains("input"));
+
+ /*
+ * The common-header, request-id, and sub-request-id should exist
+ */
+ assertTrue(jsonRequest.contains("CommonHeader"));
+ assertTrue(jsonRequest.contains("RequestID"));
+ assertTrue(jsonRequest.contains("SubRequestID"));
+
+ /*
+ * The action sub-tag should exist
+ */
+ assertTrue(jsonRequest.contains("Action"));
+
+ logger.debug("Request as JSON: " + jsonRequest + "\n\n");
+ }
+
+ @Test
+ public void testRequestDeserialization() {
+
+ /*
+ * Convert the PCI request object into json so we have a string of json to use for testing
+ */
+ String jsonRequest = Serialization.gson.toJson(dmaapRequest, PciRequestWrapper.class);
+
+ /*
+ * Use the serializer to convert the json string into a java object
+ */
+ PciRequestWrapper pciRequestWrapper = Serialization.gson.fromJson(jsonRequest, PciRequestWrapper.class);
+ assertNotNull(pciRequestWrapper);
+ assertEquals(dmaapRequest, pciRequestWrapper);
+
+ /*
+ * The type of the DMAAP wrapper should be request
+ */
+ assertEquals("request", dmaapRequest.getType());
+
+ /*
+ * The DMAAP wrapper must have a body as that is the true SDNR request
+ */
+ assertNotNull(dmaapRequest.getBody());
+ PciRequest sdnrRequest = dmaapRequest.getBody();
+ assertNotNull(sdnrRequest);
+
+ /*
+ * The common header should not be null
+ */
+ assertNotNull(sdnrRequest.getCommonHeader());
+
+ /*
+ * The action should not be null and should be set to restart
+ */
+ assertNotNull(sdnrRequest.getAction());
+ assertEquals("ModifyConfig", sdnrRequest.getAction());
+
+ logger.debug("Request as a Java Object: \n" + sdnrRequest.toString() + "\n\n");
+ }
+
+ @Test
+ public void testResponseSerialization() {
+
+ /*
+ * Use the serializer to convert the object into json
+ */
+ String jsonResponse = Serialization.gson.toJson(dmaapResponse, PciResponseWrapper.class);
+ assertNotNull(jsonResponse);
+
+ /*
+ * The serializer should have added an extra sub-tag called "input" that wraps the request
+ */
+ assertTrue(jsonResponse.contains("output"));
+
+ /*
+ * The response should contain a common-header, request-id, sub-request-id, and status
+ */
+ assertTrue(jsonResponse.contains("CommonHeader"));
+ assertTrue(jsonResponse.contains("RequestID"));
+ assertTrue(jsonResponse.contains("SubRequestID"));
+ assertTrue(jsonResponse.contains("Status"));
+
+ logger.debug("Response as JSON: " + jsonResponse + "\n\n");
+ }
+
+ @Test
+ public void testResponseDeserialization() {
+ /*
+ * Convert the PCI response object into json so we have a string of json to use for testing
+ */
+ String jsonResponse = Serialization.gson.toJson(dmaapResponse, PciResponseWrapper.class);
+
+ /*
+ * Use the serializer to convert the json string into a java object
+ */
+ PciResponseWrapper pciResponseWrapper = Serialization.gson.fromJson(jsonResponse, PciResponseWrapper.class);
+ assertNotNull(pciResponseWrapper);
+ assertEquals(dmaapResponse, pciResponseWrapper);
+
+ /*
+ * The type of the DMAAP wrapper should be response
+ */
+ assertEquals("response", dmaapResponse.getType());
+
+ /*
+ * The DMAAP wrapper must have a body as that is the true SDNR response
+ */
+ assertNotNull(dmaapResponse.getBody());
+ PciResponse sdnrResponse = dmaapResponse.getBody();
+ assertNotNull(sdnrResponse);
+
+ /*
+ * The common header should not be null
+ */
+ assertNotNull(sdnrResponse.getCommonHeader());
+
+ /*
+ * The status should not be null and the status code should be 400
+ */
+ assertNotNull(sdnrResponse.getStatus());
+ assertEquals(400, sdnrResponse.getStatus().getCode());
+
+ logger.debug("Response as a Java Object: \n" + sdnrResponse.toString() + "\n\n");
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciCommonHeader.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciCommonHeader.java
new file mode 100644
index 000000000..5c4dec3bc
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciCommonHeader.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+
+public class TestPciCommonHeader {
+
+ @Test
+ public void testPciCommonHeader() {
+ PciCommonHeader commonHeader = new PciCommonHeader();
+ assertNotNull(commonHeader);
+ assertNotNull(new PciCommonHeader(commonHeader));
+ assertNotEquals(0, commonHeader.hashCode());
+
+ commonHeader.setApiVer("Kansas");
+ assertEquals("Kansas", commonHeader.getApiVer());
+
+ Map<String, String> flagMap = new HashMap<>();
+ commonHeader.setFlags(flagMap);
+ assertEquals(flagMap, commonHeader.getFlags());
+
+ Map<String, String> requestMap = new HashMap<>();
+ commonHeader.setRequestTrack(requestMap);
+ assertEquals(requestMap, commonHeader.getRequestTrack());
+
+ UUID requestId = UUID.randomUUID();
+ commonHeader.setRequestId(requestId);
+ assertEquals(requestId, commonHeader.getRequestId());
+
+ commonHeader.setSubRequestId("Can I go home?");
+ assertEquals("Can I go home?", commonHeader.getSubRequestId());
+
+ Instant timestamp = Instant.now();
+ commonHeader.setTimeStamp(timestamp);
+ assertEquals(timestamp, commonHeader.getTimeStamp());
+
+ assertNotEquals(0, commonHeader.hashCode());
+
+ assertEquals("CommonHeader [timeStamp=", commonHeader.toString().substring(0, 24));
+
+ PciCommonHeader copiedPciCommonHeader = new PciCommonHeader();
+ copiedPciCommonHeader.setApiVer(commonHeader.getApiVer());
+ copiedPciCommonHeader.setFlags(commonHeader.getFlags());
+ copiedPciCommonHeader.setRequestId(commonHeader.getRequestId());
+ copiedPciCommonHeader.setSubRequestId(commonHeader.getSubRequestId());
+ copiedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
+
+ assertTrue(commonHeader.equals(commonHeader));
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertFalse(commonHeader.equals(null));
+ assertFalse(commonHeader.equals("Hello"));
+
+ PciCommonHeader clonedPciCommonHeader = new PciCommonHeader(commonHeader);
+ clonedPciCommonHeader.setApiVer(commonHeader.getApiVer());
+ clonedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
+
+ assertTrue(commonHeader.equals(clonedPciCommonHeader));
+
+ commonHeader.setApiVer(null);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setApiVer(null);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ commonHeader.setApiVer("Kansas");
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setApiVer("Kansas");
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+
+ commonHeader.setFlags(null);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setFlags(null);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ commonHeader.setFlags(flagMap);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setFlags(flagMap);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+
+ commonHeader.setRequestTrack(null);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setRequestTrack(null);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ commonHeader.setRequestTrack(requestMap);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setRequestTrack(requestMap);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+
+
+ commonHeader.setRequestId(null);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setRequestId(null);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ commonHeader.setRequestId(requestId);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setRequestId(requestId);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+
+ commonHeader.setSubRequestId(null);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setSubRequestId(null);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ commonHeader.setSubRequestId("Can I go home?");
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setSubRequestId("Can I go home?");
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+
+ commonHeader.setTimeStamp(null);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setTimeStamp(null);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ commonHeader.setTimeStamp(timestamp);
+ assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ copiedPciCommonHeader.setTimeStamp(timestamp);
+ assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequest.java
new file mode 100644
index 000000000..3a84adcd4
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequest.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestPciRequest {
+
+ @Test
+ public void testPciRequest() {
+ PciRequest request = new PciRequest();
+ assertNotNull(request);
+ assertNotEquals(0, request.hashCode());
+
+ PciCommonHeader commonHeader = new PciCommonHeader();
+ String requestPayload = "";
+
+ request.setCommonHeader(commonHeader);
+ assertEquals(commonHeader, request.getCommonHeader());
+
+ request.setPayload(requestPayload);
+ assertEquals(requestPayload, request.getPayload());
+
+ request.setAction("Modify");
+ assertEquals("Modify", request.getAction());
+
+ assertNotEquals(0, request.hashCode());
+
+ assertEquals("PciRequest[commonHeader=CommonHeader [timeStamp=", request.toString().substring(0, 48));
+
+ PciRequest copiedPciRequest = new PciRequest();
+ copiedPciRequest.setCommonHeader(request.getCommonHeader());
+ copiedPciRequest.setAction(request.getAction());
+ copiedPciRequest.setPayload(request.getPayload());
+
+ assertTrue(request.equals(request));
+ assertTrue(request.equals(copiedPciRequest));
+ assertFalse(request.equals(null));
+ assertFalse(request.equals("Hello"));
+
+ request.setCommonHeader(null);
+ assertFalse(request.equals(copiedPciRequest));
+ copiedPciRequest.setCommonHeader(null);
+ assertTrue(request.equals(copiedPciRequest));
+ request.setCommonHeader(commonHeader);
+ assertFalse(request.equals(copiedPciRequest));
+ copiedPciRequest.setCommonHeader(commonHeader);
+ assertTrue(request.equals(copiedPciRequest));
+
+ request.setAction(null);
+ assertFalse(request.equals(copiedPciRequest));
+ copiedPciRequest.setAction(null);
+ assertTrue(request.equals(copiedPciRequest));
+ request.setAction("Modify");
+ assertFalse(request.equals(copiedPciRequest));
+ copiedPciRequest.setAction("Modify");
+ assertTrue(request.equals(copiedPciRequest));
+
+ request.setPayload(null);
+ assertFalse(request.equals(copiedPciRequest));
+ copiedPciRequest.setPayload(null);
+ assertTrue(request.equals(copiedPciRequest));
+ request.setPayload(requestPayload);
+ assertFalse(request.equals(copiedPciRequest));
+ copiedPciRequest.setPayload(requestPayload);
+ assertTrue(request.equals(copiedPciRequest));
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequestWrapper.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequestWrapper.java
new file mode 100644
index 000000000..7ab68a6ca
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciRequestWrapper.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestPciRequestWrapper {
+
+ @Test
+ public void testPciRequestWrapperWrapper() {
+ assertNotNull(new PciRequestWrapper(new PciRequest()));
+ PciRequestWrapper requestWrapper = new PciRequestWrapper();
+ assertNotNull(requestWrapper);
+ assertNotEquals(0, requestWrapper.hashCode());
+
+ PciRequest request = new PciRequest();
+
+ requestWrapper.setBody(request);
+ assertEquals(request, requestWrapper.getBody());
+
+ assertNotEquals(0, requestWrapper.hashCode());
+
+ assertEquals("RequestWrapper [body=PciRequest[commonHeader=nul", requestWrapper.toString().substring(0, 48));
+
+ PciRequestWrapper copiedPciRequestWrapper = new PciRequestWrapper();
+ copiedPciRequestWrapper.setBody(requestWrapper.getBody());
+
+ assertTrue(requestWrapper.equals(requestWrapper));
+ assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
+ assertFalse(requestWrapper.equals(null));
+ assertFalse(requestWrapper.equals("Hello"));
+
+ requestWrapper.setBody(null);
+ assertFalse(requestWrapper.equals(copiedPciRequestWrapper));
+ copiedPciRequestWrapper.setBody(null);
+ assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
+ requestWrapper.setBody(request);
+ assertFalse(requestWrapper.equals(copiedPciRequestWrapper));
+ copiedPciRequestWrapper.setBody(request);
+ assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseCode.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseCode.java
new file mode 100644
index 000000000..056ce60e6
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseCode.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class TestPciResponseCode {
+
+ @Test
+ public void testPciResponseCode() {
+ assertNull(PciResponseCode.toResponseValue(0));
+
+ assertEquals(PciResponseCode.ACCEPTED, PciResponseCode.toResponseValue(100));
+ assertEquals(PciResponseCode.SUCCESS, PciResponseCode.toResponseValue(200));
+ assertEquals(PciResponseCode.REJECT, PciResponseCode.toResponseValue(300));
+ assertEquals(PciResponseCode.ERROR, PciResponseCode.toResponseValue(400));
+ assertEquals(PciResponseCode.FAILURE, PciResponseCode.toResponseValue(450));
+ assertEquals(PciResponseCode.FAILURE, PciResponseCode.toResponseValue(401));
+ assertEquals(PciResponseCode.FAILURE, PciResponseCode.toResponseValue(406));
+ assertEquals(PciResponseCode.PARTIAL_SUCCESS, PciResponseCode.toResponseValue(500));
+ assertEquals(PciResponseCode.PARTIAL_FAILURE, PciResponseCode.toResponseValue(501));
+ assertEquals(PciResponseCode.PARTIAL_FAILURE, PciResponseCode.toResponseValue(599));
+
+ assertEquals("100", new PciResponseCode(100).toString());
+ assertEquals("200", new PciResponseCode(200).toString());
+ assertEquals("300", new PciResponseCode(300).toString());
+ assertEquals("400", new PciResponseCode(400).toString());
+ assertEquals("450", new PciResponseCode(450).toString());
+ assertEquals("500", new PciResponseCode(500).toString());
+ assertEquals("510", new PciResponseCode(510).toString());
+
+ assertEquals(300, new PciResponseCode(300).getCode());
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseWrapper.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseWrapper.java
new file mode 100644
index 000000000..d48fd39b8
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciResponseWrapper.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import com.google.gson.Gson;
+
+import org.junit.Test;
+
+public class TestPciResponseWrapper {
+
+ @Test
+ public void testPciResponseWrapperWrapper() {
+
+ PciResponseWrapper responseWrapper = new PciResponseWrapper();
+ assertNotNull(responseWrapper);
+ assertNotEquals(0, responseWrapper.hashCode());
+
+ PciResponse response = new PciResponse();
+
+ responseWrapper.setBody(response);
+ assertEquals(response, responseWrapper.getBody());
+
+ assertNotEquals(0, responseWrapper.hashCode());
+
+ assertNotEquals("ResponseWrapper [body=Response [commonHeader=n", responseWrapper.toString().substring(0, 46));
+
+ PciResponseWrapper copiedPciResponseWrapper = new PciResponseWrapper();
+ copiedPciResponseWrapper.setBody(responseWrapper.getBody());
+
+ assertTrue(responseWrapper.equals(responseWrapper));
+ //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
+ assertFalse(responseWrapper.equals(null));
+ assertFalse(responseWrapper.equals("Hello"));
+
+ responseWrapper.setBody(null);
+ assertFalse(responseWrapper.equals(copiedPciResponseWrapper));
+ copiedPciResponseWrapper.setBody(null);
+ //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
+ responseWrapper.setBody(response);
+ //assertFalse(responseWrapper.equals(copiedPciResponseWrapper));
+ copiedPciResponseWrapper.setBody(response);
+ //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciStatus.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciStatus.java
new file mode 100644
index 000000000..b09922342
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciStatus.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestPciStatus {
+
+ @Test
+ public void testResponseStatus() {
+ Status status = new Status();
+ assertNotNull(status);
+ assertNotEquals(0, status.hashCode());
+
+ status.setCode(1234);
+ assertEquals(1234, status.getCode());
+
+ status.setValue("The wonderful land of Oz");
+ assertEquals("The wonderful land of Oz", status.getValue());
+
+ assertEquals("Status [code = 1234, value = The wonderfu", status.toString().substring(0, 41));
+
+ Status copiedStatus = new Status();
+ copiedStatus.setCode(status.getCode());
+ copiedStatus.setValue(status.getValue());
+
+ assertTrue(status.equals(status));
+ assertTrue(status.equals(copiedStatus));
+ assertFalse(status.equals(null));
+ assertFalse(status.equals("Hello"));
+
+ status.setCode(-1);
+ assertFalse(status.equals(copiedStatus));
+ copiedStatus.setCode(-1);
+ assertTrue(status.equals(copiedStatus));
+ status.setCode(1234);
+ assertFalse(status.equals(copiedStatus));
+ copiedStatus.setCode(1234);
+ assertTrue(status.equals(copiedStatus));
+
+ status.setValue(null);
+ assertFalse(status.equals(copiedStatus));
+ copiedStatus.setValue(null);
+ assertTrue(status.equals(copiedStatus));
+ status.setValue("The wonderful land of Oz");
+ assertFalse(status.equals(copiedStatus));
+ copiedStatus.setValue("The wonderful land of Oz");
+ assertTrue(status.equals(copiedStatus));
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciWrapper.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciWrapper.java
new file mode 100644
index 000000000..e0964df65
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/TestPciWrapper.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestPciWrapper {
+
+ @Test
+ public void testPciWrapper() {
+ PciWrapper wrapper = new PciWrapper();
+ assertNotNull(wrapper);
+ assertNotEquals(0, wrapper.hashCode());
+
+ wrapper.setVersion("19.3.9");
+ assertEquals("19.3.9", wrapper.getVersion());
+
+ wrapper.setCambriaPartition("The Emerald City");
+ assertEquals("The Emerald City", wrapper.getCambriaPartition());
+
+ wrapper.setRpcName("Tornado");
+ assertEquals("Tornado", wrapper.getRpcName());
+
+ wrapper.setCorrelationId("YellowBrickRoad");
+ assertEquals("YellowBrickRoad", wrapper.getCorrelationId());
+
+ wrapper.setType("Munchkin");
+ assertEquals("Munchkin", wrapper.getType());
+
+ assertNotEquals(0, wrapper.hashCode());
+
+ assertEquals("Wrapper [version=19.3.9, cambriaPartition=The ", wrapper.toString().substring(0, 46));
+
+ PciWrapper copiedPciWrapper = new PciWrapper();
+ copiedPciWrapper.setVersion(wrapper.getVersion());
+ copiedPciWrapper.setCambriaPartition(wrapper.getCambriaPartition());
+ copiedPciWrapper.setRpcName(wrapper.getRpcName());
+ copiedPciWrapper.setCorrelationId(wrapper.getCorrelationId());
+ copiedPciWrapper.setType(wrapper.getType());
+
+ assertTrue(wrapper.equals(wrapper));
+ assertTrue(wrapper.equals(copiedPciWrapper));
+ assertFalse(wrapper.equals(null));
+ assertFalse(wrapper.equals("Hello"));
+
+ wrapper.setVersion(null);
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setVersion(null);
+ assertTrue(wrapper.equals(copiedPciWrapper));
+ wrapper.setVersion("19.3.9");
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setVersion("19.3.9");
+ assertTrue(wrapper.equals(copiedPciWrapper));
+
+ wrapper.setCambriaPartition(null);
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setCambriaPartition(null);
+ assertTrue(wrapper.equals(copiedPciWrapper));
+ wrapper.setCambriaPartition("The Emerald City");
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setCambriaPartition("The Emerald City");
+ assertTrue(wrapper.equals(copiedPciWrapper));
+
+ wrapper.setRpcName(null);
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setRpcName(null);
+ assertTrue(wrapper.equals(copiedPciWrapper));
+ wrapper.setRpcName("Tornado");
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setRpcName("Tornado");
+ assertTrue(wrapper.equals(copiedPciWrapper));
+
+ wrapper.setCorrelationId(null);
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setCorrelationId(null);
+ assertTrue(wrapper.equals(copiedPciWrapper));
+ wrapper.setCorrelationId("YellowBrickRoad");
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setCorrelationId("YellowBrickRoad");
+ assertTrue(wrapper.equals(copiedPciWrapper));
+
+ wrapper.setType(null);
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setType(null);
+ assertTrue(wrapper.equals(copiedPciWrapper));
+ wrapper.setType("Munchkin");
+ assertFalse(wrapper.equals(copiedPciWrapper));
+ copiedPciWrapper.setType("Munchkin");
+ assertTrue(wrapper.equals(copiedPciWrapper));
+ }
+}
diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/TestSerialization.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/TestSerialization.java
new file mode 100644
index 000000000..7b139de73
--- /dev/null
+++ b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/TestSerialization.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdnr
+ * ================================================================================
+ * 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.sdnr.util;
+
+import static org.junit.Assert.assertEquals;
+
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+
+import org.junit.Test;
+
+public class TestSerialization {
+
+ @Test
+ public void test() {
+ String nameString = "Dorothy";
+ String jsonName = Serialization.gsonPretty.toJson(nameString, String.class);
+ assertEquals("\"Dorothy\"", jsonName);
+ String jsonInOutName = Serialization.gsonPretty.fromJson(jsonName, String.class);
+ assertEquals("Dorothy", jsonInOutName);
+
+ Instant instant0 = Instant.ofEpochMilli(1516127215000L);
+ String instantString0 = Serialization.gsonPretty.toJson(instant0, Instant.class);
+ assertEquals("\"2018-01-16T18:26:55Z\"", instantString0);
+ Instant outInstant0 = Serialization.gsonPretty.fromJson(instantString0, Instant.class);
+ assertEquals(instant0, outInstant0);
+
+ Instant instant1 = Instant.ofEpochMilli(1516127215000L);
+ String instantString1 = Serialization.gsonJunit.toJson(instant1, Instant.class);
+ assertEquals("1516127215000", instantString1);
+ Instant outInstant1 = Serialization.gsonJunit.fromJson(instantString1, Instant.class);
+ assertEquals(instant1, outInstant1);
+
+ ZonedDateTime zdt = ZonedDateTime.ofInstant(instant0, ZoneId.of("UTC"));
+ String zdtString = Serialization.gsonPretty.toJson(zdt, ZonedDateTime.class);
+ assertEquals("{\n \"dateTime\": {\n \"date\":", zdtString.substring(0, 29));
+ }
+}
diff --git a/controlloop/packages/basex-controlloop/src/files/bin/create-cl-casablanca b/controlloop/packages/basex-controlloop/src/files/bin/create-cl-casablanca
index dd88b5ccc..68395bc88 100644
--- a/controlloop/packages/basex-controlloop/src/files/bin/create-cl-casablanca
+++ b/controlloop/packages/basex-controlloop/src/files/bin/create-cl-casablanca
@@ -54,6 +54,11 @@ VOLTE_CONTROL_LOOP_NAME="ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b"
VOLTE_POLICY_NAME="volte"
VOLTE_CONTROL_LOOP_YAML="controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+VFC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
+# vPCI Policy Parameters
+VPCI_CONTROL_LOOP_NAME="ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459"
+VPCI_POLICY_NAME="vpci"
+VPCI_CONTROL_LOOP_YAML="controlLoop%3A%0D%0A++version%3A+3.0.0%0D%0A++controlLoopName%3A+ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459%0D%0A++trigger_policy%3A+unique-policy-id-123-modifyconfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-123-modifyconfig%0D%0A++++name%3A+modify+PCI+config%0D%0A++++description%3A%0D%0A++++actor%3A+SDNR%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+These+fields+are+not+used%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
+
# Generic Scope and Version
POLICY_SCOPE="casablanca"
POLICY_VERSION="v0.0.1"
@@ -86,6 +91,10 @@ read -e -i "${VOLTE_CONTROL_LOOP_NAME}" -p "VOLTE Control Loop Name> " VOLTE_CON
read -e -i "${VOLTE_POLICY_NAME}" -p "VOLTE Policy Name> " VOLTE_POLICY_NAME
read -e -i "${VOLTE_CONTROL_LOOP_YAML}" -p "VOLTE Control Loop Yaml> " VOLTE_CONTROL_LOOP_YAML
+read -e -i "${VPCI_CONTROL_LOOP_NAME}" -p "VPCI Control Loop Name> " VPCI_CONTROL_LOOP_NAME
+read -e -i "${VPCI_POLICY_NAME}" -p "VPCI Policy Name> " VPCI_POLICY_NAME
+read -e -i "${VPCI_CONTROL_LOOP_YAML}" -p "VPCI Control Loop Yaml> " VPCI_CONTROL_LOOP_YAML
+
read -e -i "${POLICY_SCOPE}" -p "Generic Policy Scope> " POLICY_SCOPE
read -e -i "${POLICY_VERSION}" -p "Generic Policy Version> " POLICY_VERSION
@@ -120,6 +129,10 @@ if [ -z "${VOLTE_CONTROL_LOOP_NAME}" ]; then echo "Aborting: VOLTE Control Loop
if [ -z "${VOLTE_POLICY_NAME}" ]; then echo "Aborting: VOLTE Policy Name not provided"; exit 1; fi
if [ -z "${VOLTE_CONTROL_LOOP_YAML}" ]; then echo "Aborting: VOLTE Control Loop Yaml not provided"; exit 1; fi
+if [ -z "${VPCI_CONTROL_LOOP_NAME}" ]; then echo "Aborting: VPCI Control Loop Name not provided"; exit 1; fi
+if [ -z "${VPCI_POLICY_NAME}" ]; then echo "Aborting: VPCI Policy Name not provided"; exit 1; fi
+if [ -z "${VPCI_CONTROL_LOOP_YAML}" ]; then echo "Aborting: VPCI Control Loop Yaml not provided"; exit 1; fi
+
if [ -z "${POLICY_SCOPE}" ]; then echo "Aborting: Template Policy Scope not provided"; exit 1; fi
if [ -z "${POLICY_VERSION}" ]; then echo "Aborting: Template Policy Version not provided"; exit 1; fi
@@ -162,6 +175,10 @@ echo "VOLTE Drools Fact Generation: VOLTE Control Loop Control Name: ${VOLTE_CON
echo "VOLTE Drools Fact Generation: VOLTE Control Loop Policy Name: ${VOLTE_POLICY_NAME}"
echo "VOLTE Drools Fact Generation: VOLTE Control Loop Yaml: ${VOLTE_CONTROL_LOOP_YAML}"
echo
+echo "VPCI Drools Fact Generation: VPCI Control Loop Control Name: ${VPCI_CONTROL_LOOP_NAME}"
+echo "VPCI Drools Fact Generation: VPCI Control Loop Policy Name: ${VPCI_POLICY_NAME}"
+echo "VPCI Drools Fact Generation: VPCI Control Loop Yaml: ${VPCI_CONTROL_LOOP_YAML}"
+echo
echo "Generic Drools Fact: Control Loop Policy Scope: ${POLICY_SCOPE}"
echo "Generic: Control Loop Policy Version: ${POLICY_VERSION}"
echo
@@ -252,6 +269,9 @@ mvn archetype:generate \
-DvolteClosedLoopControlName="${VOLTE_CONTROL_LOOP_NAME}" \
-DvoltePolicyName="${VOLTE_POLICY_NAME}" \
-DvolteControlLoopYaml="${VOLTE_CONTROL_LOOP_YAML}" \
+ -DvpciClosedLoopControlName="${VPCI_CONTROL_LOOP_NAME}" \
+ -DvpciPolicyName="${VPCI_POLICY_NAME}" \
+ -DvpciControlLoopYaml="${VPCI_CONTROL_LOOP_YAML}" \
-DpolicyScope="${POLICY_SCOPE}" \
-DpolicyVersion="${POLICY_VERSION}" \
-DbrmsgwTopic="${BRMSGW_TOPIC}" \
diff --git a/controlloop/packages/basex-controlloop/src/files/bin/push-policies-casablanca b/controlloop/packages/basex-controlloop/src/files/bin/push-policies-casablanca
index 5bd23f49b..180cdff2d 100644
--- a/controlloop/packages/basex-controlloop/src/files/bin/push-policies-casablanca
+++ b/controlloop/packages/basex-controlloop/src/files/bin/push-policies-casablanca
@@ -113,6 +113,19 @@ curl --silent --user @1b3rt:31nst31n -X PUT --header 'Content-Type: text/plain'
}' "http://localhost:9696/policy/pdp/engine/topics/sources/ueb/${BRMSGW_TOPIC}/events" | python -m json.tool
sleep 2
+echo
+echo "Inserting vPCI Policy..."
+curl --silent --user @1b3rt:31nst31n -X PUT --header 'Content-Type: text/plain' -d '{
+ "closedLoopControlName": "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459",
+ "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+3.0.0%0D%0A++controlLoopName%3A+ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459%0D%0A++trigger_policy%3A+unique-policy-id-123-modifyconfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-123-modifyconfig%0D%0A++++name%3A+modify+PCI+config%0D%0A++++description%3A%0D%0A++++actor%3A+SDNR%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+These+fields+are+not+used%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard",
+ "policyName": "vpci",
+ "policyScope": "DCAE",
+ "policyVersion": "1.2.0"
+}' "http://localhost:9696/policy/pdp/engine/topics/sources/ueb/${BRMSGW_TOPIC}/events" | python -m json.tool
+
+sleep 2
+
+
echo
echo "Policy insertions completed."
diff --git a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/pom.xml b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/pom.xml
index 1fc31bae2..e458ae963 100644
--- a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/pom.xml
+++ b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/pom.xml
@@ -60,6 +60,11 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
+ <artifactId>sdnr</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications.controlloop.common.model-impl</groupId>
<artifactId>appclcm</artifactId>
<version>${dependenciesVersion}</version>
</dependency>
@@ -110,6 +115,11 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
+ <artifactId>actor.sdnr</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
<artifactId>actor.appclcm</artifactId>
<version>${dependenciesVersion}</version>
</dependency>
diff --git a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.pcims.onset.json b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.pcims.onset.json
new file mode 100644
index 000000000..0e67d3251
--- /dev/null
+++ b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.pcims.onset.json
@@ -0,0 +1,18 @@
+{
+ "closedLoopControlName": "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459",
+ "closedLoopAlarmStart": 1510187409180,
+ "closedLoopEventClient": "microservice.PCI",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "9d2d790e-a5f0-11e8-98d0-529269fb1459",
+ "target_type": "VNF",
+ "target": "generic-vnf.vnf-id",
+ "AAI": {
+ "generic-vnf.is-closed-loop-disabled": "false",
+ "generic-vnf.prov-status": "ACTIVE",
+ "generic-vnf.vnf-id": "notused"
+ },
+ "from": "PCIMS",
+ "version": "1.0.2",
+ "Action": "ModifyConfig",
+ "payload": "{ \"Configurations\":[ { \"data\":{ \"FAPService\":{ \"alias\":\"Cell1\", \"X0005b9Lte\" : { \"PhyCellIdInUse\" : \"35\", \"PnfName\" : \"cu1\" }, \"CellConfig\":{ \"LTE\":{ \"RAN\":{ \"Common\":{ \"CellIdentity\":\"1\" } } } } } } } ] }"
+}
diff --git a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.sdnr.success.json b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.sdnr.success.json
new file mode 100644
index 000000000..74d7f60bb
--- /dev/null
+++ b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/config/vPCI.sdnr.success.json
@@ -0,0 +1,23 @@
+{
+ "body": {
+ "output": {
+ "CommonHeader": {
+ "TimeStamp": "2018-09-10T07:10:05.614Z",
+ "APIver": "1.0",
+ "RequestID": "9d2d790e-a5f0-11e8-98d0-529269fb1459",
+ "SubRequestID": "1",
+ "RequestTrack": [],
+ "Flags": []
+ },
+ "Status": {
+ "Code": 200,
+ "Value": "SUCCESS"
+ },
+ "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{ \"FAPService\":{ \"alias\":\"Network1\", \"X0005b9Lte\" : { \"PnfName\" : \"cu1\" }, \"CellConfig\":{ \"LTE\":{ \"RAN\":{ \"Common\":{ \"CellIdentity\":\"1\" } } } } } } } ] }"
+ }
+ },
+ "version": "1.0",
+ "rpc-name": "ModifyConfig",
+ "correlation-id": "9d2d790e-a5f0-11e8-98d0-529269fb1459-1",
+ "type": "response"
+}
diff --git a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
index 0352dec10..24f70cdd9 100644
--- a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
+++ b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
@@ -42,6 +42,10 @@ import org.onap.policy.appclcm.LcmResponseWrapper;
import org.onap.policy.appclcm.LcmRequest;
import org.onap.policy.appclcm.LcmResponse;
import org.onap.policy.appclcm.LcmCommonHeader;
+import org.onap.policy.sdnr.PciRequestWrapper;
+import org.onap.policy.sdnr.PciResponseWrapper;
+import org.onap.policy.sdnr.PciRequest;
+import org.onap.policy.sdnr.PciResponse;
import org.onap.policy.vfc.VFCRequest;
import org.onap.policy.vfc.VFCResponse;
import org.onap.policy.vfc.VFCManager;
@@ -535,6 +539,11 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
t.start();
}
break;
+ case "SDNR":
+ if (request instanceof PciRequestWrapper) {
+ PolicyEngine.manager.deliver("SDNR-CL", request);
+ }
+ break;
}
} else {
//
@@ -1268,3 +1277,108 @@ rule "EVENT.CLEANUP"
retract($event);
end
+
+/*
+*
+* This rule responds to SDNR Response Events.
+*
+*/
+rule "SDNR.RESPONSE"
+ when
+ $params : ControlLoopParams( $clName : getClosedLoopControlName() )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $clName, closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId() )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() )
+ $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() )
+ $lock : TargetLock (requestID == $event.getRequestId())
+ $response : PciResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $clName, $params.getPolicyName() + "." + drools.getRule().getName());
+ logger.debug("{}: {}: event={} manager={} operation={} lock={} opTimer={} response={}",
+ $clName, $params.getPolicyName() + "." + drools.getRule().getName(),
+ $event, $manager, $operation, $lock, $operation, $opTimer, $response);
+
+ //
+ // Get the result of the operation
+ //
+ PolicyResult policyResult = $operation.onResponse($response);
+ if (policyResult != null) {
+ logger.debug("{}: {}: operation finished - result={}",
+ $clName, $params.getPolicyName() + "." + drools.getRule().getName(),
+ policyResult);
+
+ //
+ // This Operation has completed, construct a notification showing our results. (DB write - end operation)
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.setFrom("policy");
+ notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName());
+ notification.setPolicyScope($params.getPolicyScope());
+ notification.setPolicyVersion($params.getPolicyVersion());
+ notification.setMessage($operation.getOperationHistory());
+ notification.setHistory($operation.getHistory());
+ if (policyResult.equals(PolicyResult.SUCCESS)) {
+ notification.setNotification(ControlLoopNotificationType.OPERATION_SUCCESS);
+ } else {
+ notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE);
+ }
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ //
+ // Ensure the operation is complete
+ //
+ if ($operation.isOperationComplete() == true) {
+ //
+ // It is complete, remove it from memory
+ //
+ retract($operation);
+ //
+ // We must also retract the timer object
+ // NOTE: We could write a Rule to do this
+ //
+ retract($opTimer);
+ //
+ // Complete the operation
+ //
+ modify($manager) {finishOperation($operation)};
+ } else {
+ //
+ // Just doing this will kick off the LOCKED rule again
+ //
+ modify($operation) {};
+ }
+ } else {
+ //
+ // Its not finished yet (i.e. expecting more Response objects)
+ //
+ // Or possibly it is a leftover response that we timed the request out previously
+ //
+ }
+ //
+ // We are going to retract these objects from memory
+ //
+ retract($response);
+end
+
+/*
+*
+* Clean Up any lingering SDNR reponses.
+*
+*/
+rule "SDNR.RESPONSE.CLEANUP"
+ when
+ $params : ControlLoopParams( $clName : getClosedLoopControlName() )
+ $response : PciResponseWrapper($id : getBody().getCommonHeader().getRequestId )
+ not ( VirtualControlLoopEvent( requestId == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $clName, $params.getPolicyName() + "." + drools.getRule().getName());
+ logger.debug("{}: {}: orphan sdnr response={}",
+ $clName, $params.getPolicyName() + "." + drools.getRule().getName(), $id);
+ //
+ // Retract it
+ //
+ retract($response);
+end
diff --git a/controlloop/templates/template.demo/pom.xml b/controlloop/templates/template.demo/pom.xml
index c793d97f6..6b1302240 100644
--- a/controlloop/templates/template.demo/pom.xml
+++ b/controlloop/templates/template.demo/pom.xml
@@ -68,6 +68,12 @@
</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>appclcm</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
@@ -166,6 +172,12 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common.actors</groupId>
+ <artifactId>actor.sdnr</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>