aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
authorHockla, Ali (ah999m) <ah999m@att.com>2017-09-13 09:24:43 -0500
committerAli Hockla <ah999m@att.com>2017-09-14 15:03:17 +0000
commitc5f38f5de2f49d3f2fa7f03808f9f063f1cb2ed9 (patch)
tree93454ef45c37e7b033b45918ef2e1da0050980cb /controlloop
parentbc4267d043427c080b1cc1fe42ea0860bed9fa97 (diff)
Added changes for vDNS Use Case
-Renamed remaining MSO classes and packages to SO and modified drl accordingly -Connected SO Interface to SO Simulator -Added vDNS Control Loop junit -Modified SOActorServiceProvider to reflect AAI class changes (POLICY-103) Issue-ID: POLICY-102 Change-Id: Iea5d3f096c4ccfedde68e79d7593d66331127aaf Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/actors/actor.mso/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.so/pom.xml (renamed from controlloop/common/actors/actor.mso/pom.xml)4
-rw-r--r--controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java (renamed from controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java)170
-rw-r--r--controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/pom.xml2
-rw-r--r--controlloop/common/eventmanager/pom.xml4
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java6
-rw-r--r--controlloop/common/model-impl/pom.xml2
-rw-r--r--controlloop/common/model-impl/so/pom.xml (renamed from controlloop/common/model-impl/mso/pom.xml)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java)18
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java)5
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java)2
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/util/Serialization.java)2
-rw-r--r--controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java (renamed from controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java)20
-rw-r--r--controlloop/common/simulators/pom.xml9
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java (renamed from controlloop/common/simulators/src/main/java/org/onap/policy/simulators/MsoSimulatorJaxRs.java)13
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java6
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/MsoSimulatorTest.java59
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java133
-rw-r--r--controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java2
-rw-r--r--controlloop/templates/template.demo/pom.xml4
-rw-r--r--controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl33
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java7
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java16
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java304
40 files changed, 620 insertions, 235 deletions
diff --git a/controlloop/common/actors/actor.mso/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.mso/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
deleted file mode 100644
index 90d6c7f0e..000000000
--- a/controlloop/common/actors/actor.mso/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.actor.mso.MSOActorServiceProvider \ No newline at end of file
diff --git a/controlloop/common/actors/actor.mso/pom.xml b/controlloop/common/actors/actor.so/pom.xml
index 5b0f908fe..ff5b12167 100644
--- a/controlloop/common/actors/actor.mso/pom.xml
+++ b/controlloop/common/actors/actor.so/pom.xml
@@ -8,7 +8,7 @@
<artifactId>actors</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>actor.mso</artifactId>
+ <artifactId>actor.so</artifactId>
<dependencies>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
@@ -30,7 +30,7 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
- <artifactId>mso</artifactId>
+ <artifactId>so</artifactId>
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
diff --git a/controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
index 64e0c616b..905de98a6 100644
--- a/controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java
+++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * MSOActorServiceProvider
+ * SOActorServiceProvider
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.controlloop.actor.mso;
+package org.onap.policy.controlloop.actor.so;
import java.util.Collections;
import java.util.HashMap;
@@ -27,40 +27,39 @@ import java.util.Map;
import java.util.UUID;
import org.drools.core.WorkingMemory;
-import org.onap.policy.aai.AAINQF199.AAINQF199InstanceFilters;
-import org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;
-import org.onap.policy.aai.AAINQF199.AAINQF199Manager;
-import org.onap.policy.aai.AAINQF199.AAINQF199NamedQuery;
-import org.onap.policy.aai.AAINQF199.AAINQF199QueryParameters;
-import org.onap.policy.aai.AAINQF199.AAINQF199Request;
-import org.onap.policy.aai.AAINQF199.AAINQF199RequestWrapper;
-import org.onap.policy.aai.AAINQF199.AAINQF199Response;
-import org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;
+import org.onap.policy.aai.AAINQInstanceFilters;
+import org.onap.policy.aai.AAINQInventoryResponseItem;
+import org.onap.policy.aai.AAIManager;
+import org.onap.policy.aai.AAINQNamedQuery;
+import org.onap.policy.aai.AAINQQueryParameters;
+import org.onap.policy.aai.AAINQRequest;
+import org.onap.policy.aai.AAINQResponse;
+import org.onap.policy.aai.AAINQResponseWrapper;
import org.onap.policy.controlloop.ControlLoopNotificationType;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.actorServiceProvider.spi.Actor;
import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.mso.SOCloudConfiguration;
-import org.onap.policy.mso.SOManager;
-import org.onap.policy.mso.SOModelInfo;
-import org.onap.policy.mso.SORelatedInstance;
-import org.onap.policy.mso.SORelatedInstanceListElement;
-import org.onap.policy.mso.SORequest;
-import org.onap.policy.mso.SORequestDetails;
-import org.onap.policy.mso.SORequestInfo;
-import org.onap.policy.mso.SORequestParameters;
-import org.onap.policy.mso.util.Serialization;
+import org.onap.policy.so.SOCloudConfiguration;
+import org.onap.policy.so.SOManager;
+import org.onap.policy.so.SOModelInfo;
+import org.onap.policy.so.SORelatedInstance;
+import org.onap.policy.so.SORelatedInstanceListElement;
+import org.onap.policy.so.SORequest;
+import org.onap.policy.so.SORequestDetails;
+import org.onap.policy.so.SORequestInfo;
+import org.onap.policy.so.SORequestParameters;
+import org.onap.policy.so.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-public class MSOActorServiceProvider implements Actor {
+public class SOActorServiceProvider implements Actor {
- private static final Logger logger = LoggerFactory.getLogger(MSOActorServiceProvider.class);
+ private static final Logger logger = LoggerFactory.getLogger(SOActorServiceProvider.class);
private static String vnfItemVnfId;
@@ -129,10 +128,10 @@ public class MSOActorServiceProvider implements Actor {
}
/**
- * MSOActorServiceProvider Constructor
+ * SOActorServiceProvider Constructor
*
*/
- public MSOActorServiceProvider() {
+ public SOActorServiceProvider() {
}
@@ -142,65 +141,65 @@ public class MSOActorServiceProvider implements Actor {
* @param eventRequestID
* @returns the response to the AAI Named Query
*/
- private AAINQF199ResponseWrapper AaiNamedQueryRequest(VirtualControlLoopEvent onset) {
+ private AAINQResponseWrapper AaiNamedQueryRequest(VirtualControlLoopEvent onset) {
- // create AAI named-query request with UUID started with "F199"
- AAINQF199Request aainqf199request = new AAINQF199Request();
- AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();
- AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();
- AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();
+ // create AAI named-query request with UUID started with ""
+ AAINQRequest aainqrequest = new AAINQRequest();
+ AAINQQueryParameters aainqqueryparam = new AAINQQueryParameters();
+ AAINQNamedQuery aainqnamedquery = new AAINQNamedQuery();
+ AAINQInstanceFilters aainqinstancefilter = new AAINQInstanceFilters();
// queryParameters
- aainqf199namedquery.namedQueryUUID = UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"); // UUID.fromString($params.getAaiNamedQueryUUID()) TO DO: AaiNamedQueryUUID
- aainqf199queryparam.namedQuery = aainqf199namedquery;
- aainqf199request.queryParameters = aainqf199queryparam;
+ aainqnamedquery.namedQueryUUID = UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"); // UUID.fromString($params.getAaiNamedQueryUUID()) TO DO: AaiNamedQueryUUID
+ aainqqueryparam.namedQuery = aainqnamedquery;
+ aainqrequest.queryParameters = aainqqueryparam;
//
// instanceFilters
//
- Map<String, Map<String, String>> aainqf199instancefiltermap = new HashMap<>();
- Map<String, String> aainqf199instancefiltermapitem = new HashMap<>();
- aainqf199instancefiltermapitem.put("vserver-name", onset.AAI.get("vserver.vserver-name")); // TO DO: get vserver.vname from dcae onset.AAI.get("vserver.vserver-name")
- aainqf199instancefiltermap.put("vserver", aainqf199instancefiltermapitem);
- aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);
- aainqf199request.instanceFilters = aainqf199instancefilter;
+ Map<String, Map<String, String>> aainqinstancefiltermap = new HashMap<>();
+ Map<String, String> aainqinstancefiltermapitem = new HashMap<>();
+ aainqinstancefiltermapitem.put("vserver-name", onset.AAI.get("vserver.vserver-name")); // TO DO: get vserver.vname from dcae onset.AAI.get("vserver.vserver-name")
+ aainqinstancefiltermap.put("vserver", aainqinstancefiltermapitem);
+ aainqinstancefilter.instanceFilter.add(aainqinstancefiltermap);
+ aainqrequest.instanceFilters = aainqinstancefilter;
//
- // print aainqf199request for debug
+ // print aainqrequest for debug
//
logger.debug("AAI Request sent:");
- logger.debug(Serialization.gsonPretty.toJson(aainqf199request));
+ logger.debug(Serialization.gsonPretty.toJson(aainqrequest));
//
- // Create AAINQF199RequestWrapper
+ // Create AAINQRequestWrapper
//
- AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper(onset.requestID, aainqf199request);
+// AAINQRequestWrapper aainqRequestWrapper = new AAINQRequestWrapper(onset.requestID, aainqrequest);
//
- // insert aainqf199request into memory
+ // insert aainqrequest into memory
//
-// insert(aainqf199RequestWrapper);
+// insert(aainqRequestWrapper);
String url = "http://localhost:6666";
String username = "testUser";
String password = "testPass";
//***** send the request *****\\
- AAINQF199Response aainqf199response = AAINQF199Manager.postQuery(url, username, password, // TO DO: get AAI URL, username, and password
- aainqf199RequestWrapper.aainqf199request, onset.requestID);
+ AAINQResponse aainqresponse = AAIManager.postQuery(url, username, password, // TO DO: get AAI URL, username, and password
+ aainqrequest, onset.requestID);
// Check AAI response
- if (aainqf199response == null) {
+ if (aainqresponse == null) {
System.err.println("Failed to get AAI response");
// Fail and retract everything
return null;
} else {
- // Create AAINQF199ResponseWrapper
- AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper(onset.requestID, aainqf199response);
+ // Create AAINQResponseWrapper
+ AAINQResponseWrapper aainqResponseWrapper = new AAINQResponseWrapper(onset.requestID, aainqresponse);
- // insert aainqf199ResponseWrapper to memory -- Is this needed?
-// insert(aainqf199ResponseWrapper);
+ // insert aainqResponseWrapper to memory -- Is this needed?
+// insert(aainqResponseWrapper);
//
- extractSOFieldsFromNamedQuery(aainqf199ResponseWrapper, onset);
- return aainqf199ResponseWrapper;
+ extractSOFieldsFromNamedQuery(aainqResponseWrapper, onset);
+ return aainqResponseWrapper;
}
}
@@ -209,32 +208,32 @@ public class MSOActorServiceProvider implements Actor {
* @param namedQueryResponseWrapper
* @param onset
*/
- private void extractSOFieldsFromNamedQuery(AAINQF199ResponseWrapper namedQueryResponseWrapper, VirtualControlLoopEvent onset) {
+ private void extractSOFieldsFromNamedQuery(AAINQResponseWrapper namedQueryResponseWrapper, VirtualControlLoopEvent onset) {
try {
// vnfItem
- setVnfItemVnfId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID);
- setVnfItemVnfType(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType);
+ setVnfItemVnfId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID);
+ setVnfItemVnfType(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType);
setVnfItemVnfType(vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf("/")+1));
- setVnfItemModelInvariantId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId);
- setVnfItemModelVersionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion);
- setVnfItemModelName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue);
- setVnfItemModelVersion(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue);
- setVnfItemModelNameVersionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue);
+ setVnfItemModelInvariantId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.modelInvariantId);
+ setVnfItemModelVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion);
+ setVnfItemModelName(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue);
+ setVnfItemModelVersion(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue);
+ setVnfItemModelNameVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue);
// serviceItem
- setServiceItemServiceInstanceId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID);
- setServiceItemPersonaModelId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId);
- setServiceItemModelName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue);
- setServiceItemModelType(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue);
- setServiceItemModelVersion(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion);
- setServiceItemModelNameVersionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue);
+ setServiceItemServiceInstanceId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID);
+ setServiceItemPersonaModelId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId);
+ setServiceItemModelName(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue);
+ setServiceItemModelType(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue);
+ setServiceItemModelVersion(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion);
+ setServiceItemModelNameVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue);
// Find the index for base vf module and non-base vf module
int baseIndex = -1;
int nonBaseIndex = -1;
- List<AAINQF199InventoryResponseItem> inventoryItems = namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;
- for (AAINQF199InventoryResponseItem m : inventoryItems) {
+ List<AAINQInventoryResponseItem> inventoryItems = namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;
+ for (AAINQInventoryResponseItem m : inventoryItems) {
if (m.vfModule != null && m.vfModule.isBaseVfModule == true) {
baseIndex = inventoryItems.indexOf(m);
} else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) {
@@ -253,20 +252,20 @@ public class MSOActorServiceProvider implements Actor {
}
// This comes from the base module
- setVfModuleItemVfModuleName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName);
+ setVfModuleItemVfModuleName(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName);
setVfModuleItemVfModuleName(vfModuleItemVfModuleName.replace("Vfmodule", "vDNS"));
// vfModuleItem - NOT the base module
- setVfModuleItemPersonaModelId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId);
- setVfModuleItemPersonaModelVersion(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion);
- setVfModuleItemModelName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue);
- setVfModuleItemModelNameVersionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue);
+ setVfModuleItemPersonaModelId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId);
+ setVfModuleItemPersonaModelVersion(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion);
+ setVfModuleItemModelName(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue);
+ setVfModuleItemModelNameVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue);
// tenantItem
- setTenantItemTenantId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId);
+ setTenantItemTenantId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId);
// cloudRegionItem
- setCloudRegionItemCloudRegionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId);
+ setCloudRegionItemCloudRegionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId);
} catch (Exception e) {
logger.error(e.getMessage(), e);
@@ -330,7 +329,7 @@ public class MSOActorServiceProvider implements Actor {
* @param onset
* @param operation
* @param policy
- * @return MSORequest
+ * @return SORequest
*/
public SORequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy) {
@@ -353,6 +352,7 @@ public class MSOActorServiceProvider implements Actor {
// Construct SO Request
SORequest request = new SORequest();
+ request.requestId = onset.requestID;
request.requestDetails = new SORequestDetails();
request.requestDetails.modelInfo = new SOModelInfo();
request.requestDetails.cloudConfiguration = new SOCloudConfiguration();
@@ -406,9 +406,9 @@ public class MSOActorServiceProvider implements Actor {
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
//
- // print MSO request for debug
+ // print SO request for debug
//
- logger.debug("MSO request sent:");
+ logger.debug("SO request sent:");
logger.debug(Serialization.gsonPretty.toJson(request));
return request;
@@ -417,14 +417,14 @@ public class MSOActorServiceProvider implements Actor {
/**
* This method is needed to get the serviceInstanceId and vnfInstanceId which is used
- * in the asyncMSORestCall
+ * in the asyncSORestCall
*
* @param wm
* @param request
*/
public static void sendRequest(WorkingMemory wm, Object request) {
SOManager Mm = new SOManager();
- Mm.asyncMSORestCall(wm, getServiceItemServiceInstanceId(), getVnfItemVnfId(), (SORequest)request);
+ Mm.asyncSORestCall(wm, getServiceItemServiceInstanceId(), getVnfItemVnfId(), (SORequest)request);
}
/**
@@ -438,7 +438,7 @@ public class MSOActorServiceProvider implements Actor {
* @param vnfItemVnfId the vnfItemVnfId to set
*/
private void setVnfItemVnfId(String vnfItemVnfId) {
- MSOActorServiceProvider.vnfItemVnfId = vnfItemVnfId;
+ SOActorServiceProvider.vnfItemVnfId = vnfItemVnfId;
}
/**
@@ -537,7 +537,7 @@ public class MSOActorServiceProvider implements Actor {
*/
private void setServiceItemServiceInstanceId(
String serviceItemServiceInstanceId) {
- MSOActorServiceProvider.serviceItemServiceInstanceId = serviceItemServiceInstanceId;
+ SOActorServiceProvider.serviceItemServiceInstanceId = serviceItemServiceInstanceId;
}
/**
diff --git a/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
new file mode 100644
index 000000000..ad136e98f
--- /dev/null
+++ b/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor
@@ -0,0 +1 @@
+org.onap.policy.controlloop.actor.so.SOActorServiceProvider \ No newline at end of file
diff --git a/controlloop/common/actors/pom.xml b/controlloop/common/actors/pom.xml
index 1f38e90b1..48335de75 100644
--- a/controlloop/common/actors/pom.xml
+++ b/controlloop/common/actors/pom.xml
@@ -16,7 +16,7 @@
<module>actor.appc</module>
<module>actor.vfc</module>
<module>actor.appclcm</module>
- <module>actor.mso</module>
+ <module>actor.so</module>
<module>actor.test</module>
</modules>
<dependencies>
diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml
index 69d858a07..a3227cbc1 100644
--- a/controlloop/common/eventmanager/pom.xml
+++ b/controlloop/common/eventmanager/pom.xml
@@ -54,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
- <artifactId>actor.mso</artifactId>
+ <artifactId>actor.so</artifactId>
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@@ -132,7 +132,7 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
- <artifactId>mso</artifactId>
+ <artifactId>so</artifactId>
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
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 a1ae9f0d5..7751a4108 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
@@ -40,8 +40,8 @@ import org.onap.policy.controlloop.actor.appc.APPCActorServiceProvider;
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.controlloop.actor.mso.MSOActorServiceProvider;
-import org.onap.policy.mso.SOResponse;
+import org.onap.policy.controlloop.actor.so.SOActorServiceProvider;
+import org.onap.policy.so.SOResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider;
@@ -214,7 +214,7 @@ public class ControlLoopOperationManager implements Serializable {
this.currentOperation = operation;
return operationRequest;
case "SO":
- MSOActorServiceProvider SOAsp = new MSOActorServiceProvider();
+ SOActorServiceProvider SOAsp = new SOActorServiceProvider();
this.operationRequest = SOAsp.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy);
// Save the operation
diff --git a/controlloop/common/model-impl/pom.xml b/controlloop/common/model-impl/pom.xml
index e96befbf7..3f0c004e6 100644
--- a/controlloop/common/model-impl/pom.xml
+++ b/controlloop/common/model-impl/pom.xml
@@ -37,7 +37,7 @@
<module>appc</module>
<module>appclcm</module>
<module>events</module>
- <module>mso</module>
+ <module>so</module>
<module>rest</module>
<module>sdc</module>
<module>trafficgenerator</module>
diff --git a/controlloop/common/model-impl/mso/pom.xml b/controlloop/common/model-impl/so/pom.xml
index 5d386688d..faeb12130 100644
--- a/controlloop/common/model-impl/mso/pom.xml
+++ b/controlloop/common/model-impl/so/pom.xml
@@ -21,7 +21,7 @@
<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>
- <artifactId>mso</artifactId>
+ <artifactId>so</artifactId>
<parent>
<groupId>org.onap.policy.drools-applications</groupId>
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java
index 600816304..97978c73f 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
import java.time.LocalDateTime;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java
index 7e4951166..6b817075f 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java
index 894b17ade..97abd3950 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
index ea9146d24..86ade6db7 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
-import org.onap.policy.mso.util.Serialization;
+import org.onap.policy.so.util.Serialization;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
import org.drools.core.WorkingMemory;
@@ -127,16 +127,16 @@ public final class SOManager {
*
* This method makes an asynchronous Rest call to MSO and inserts the response into the Drools working memory
*/
- public void asyncMSORestCall(WorkingMemory wm, String serviceInstanceId, String vnfInstanceId, SORequest request) {
+ public void asyncSORestCall(WorkingMemory wm, String serviceInstanceId, String vnfInstanceId, SORequest request) {
executors.submit(new Runnable()
{
@Override
public void run()
{
- String serverRoot = ""; // TODO
- String username = ""; // TODO
- String password = ""; // TODO
- String url = serverRoot + "/serviceInstances/v5/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModules";
+ String serverRoot = "http://localhost:6667"; // TODO
+ String username = "username"; // TODO
+ String password = "password"; // TODO
+ String url = serverRoot + "/serviceInstances/v2/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModulesHTTPS/1.1";
String auth = username + ":" + password;
@@ -158,9 +158,9 @@ public final class SOManager {
mso = gson.fromJson(httpResponse.b, SOResponse.class);
mso.httpResponseCode = httpResponse.a;
}
-
-// logger.info("MSOResponse inserted " + mso.toString());
+
wm.insert(mso);
+ logger.info("SOResponse inserted " + gsonPretty.toJson(mso));
}
});
}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java
index cba763daf..94070ba9a 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java
index a2c9f81aa..150733963 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java
index d9d634a57..ac737307c 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java
index f32f7ccb1..c4b85ab52 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java
index 83a761377..3e90ff345 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java
@@ -18,10 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
import java.time.LocalDateTime;
+import java.util.UUID;
import com.google.gson.annotations.SerializedName;
@@ -33,7 +34,7 @@ public class SORequest implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
@SerializedName("requestId")
- public String requestId;
+ public UUID requestId;
@SerializedName("startTime")
//public LocalDateTime startTime;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java
index 4b4b8217e..ab4afc16c 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
import java.util.LinkedList;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java
index 76b62bfa0..d49897c72 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java
index 9e5b93ccb..640649800 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java
index 6e45afe83..c66f0979c 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
import java.util.LinkedList;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java
index ea8ebc64a..f3e15e1d7 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java
index d5174328e..4b57fc7ba 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java
index ddf937593..c5c3737b2 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java
index 4a806ced4..58999fd30 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
import java.util.LinkedList;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java
index 97d620f5c..745e237fe 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.io.Serializable;
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/util/Serialization.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java
index 24eb2951a..c9d013ea6 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/util/Serialization.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso.util;
+package org.onap.policy.so.util;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
diff --git a/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java
index bfbbf0b57..af8f4be0e 100644
--- a/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java
@@ -18,21 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.mso;
+package org.onap.policy.so;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
-import org.onap.policy.mso.SOCloudConfiguration;
-import org.onap.policy.mso.SOModelInfo;
-import org.onap.policy.mso.SORelatedInstance;
-import org.onap.policy.mso.SORelatedInstanceListElement;
-import org.onap.policy.mso.SORequest;
-import org.onap.policy.mso.SORequestDetails;
-import org.onap.policy.mso.SORequestInfo;
-import org.onap.policy.mso.SORequestParameters;
-import org.onap.policy.mso.util.Serialization;
+import org.onap.policy.so.SOCloudConfiguration;
+import org.onap.policy.so.SOModelInfo;
+import org.onap.policy.so.SORelatedInstance;
+import org.onap.policy.so.SORelatedInstanceListElement;
+import org.onap.policy.so.SORequest;
+import org.onap.policy.so.SORequestDetails;
+import org.onap.policy.so.SORequestInfo;
+import org.onap.policy.so.SORequestParameters;
+import org.onap.policy.so.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/controlloop/common/simulators/pom.xml b/controlloop/common/simulators/pom.xml
index 9d3b71c0d..26a81a8ff 100644
--- a/controlloop/common/simulators/pom.xml
+++ b/controlloop/common/simulators/pom.xml
@@ -47,12 +47,19 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
- <artifactId>mso</artifactId>
+ <artifactId>so</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>so</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
<artifactId>vfc</artifactId>
<version>${project.version}</version>
<scope>test</scope>
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/MsoSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
index 824c547ce..1ebb281fd 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/MsoSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
@@ -20,18 +20,25 @@
package org.onap.policy.simulators;
+import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.onap.policy.so.SORequest;
+import org.onap.policy.so.util.Serialization;
@Path("/serviceInstances")
-public class MsoSimulatorJaxRs {
+public class SoSimulatorJaxRs {
@POST
@Path("/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModulesHTTPS/1.1")
- public String msoPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public String SoPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, String req)
{
- return "{\"requestReferences\": {\"instanceId\": \"ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff\", \"requestId\": \"rq1234d1-5a33-ffdf-23ab-12abad84e331\"}}";
+ SORequest request = Serialization.gsonPretty.fromJson(req, SORequest.class);
+ return "{\"requestReferences\": {\"instanceId\": \"ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff\", \"requestId\": " + request.requestId + "}}";
}
}
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java
index 27cc6e0fa..e0eb1ff01 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java
@@ -22,7 +22,7 @@ package org.onap.policy.simulators;
import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.simulators.AaiSimulatorJaxRs;
-import org.onap.policy.simulators.MsoSimulatorJaxRs;
+import org.onap.policy.simulators.SoSimulatorJaxRs;
import org.onap.policy.simulators.VfcSimulatorJaxRs;
public class Util {
@@ -33,9 +33,9 @@ public class Util {
return testServer;
}
- public static HttpServletServer buildMsoSim() throws InterruptedException {
+ public static HttpServletServer buildSoSim() throws InterruptedException {
HttpServletServer testServer = HttpServletServer.factory.build("testServer", "localhost", 6667, "/", false, true);
- testServer.addServletClass("/*", MsoSimulatorJaxRs.class.getName());
+ testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName());
testServer.waitedStart(5000);
return testServer;
}
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/MsoSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/MsoSimulatorTest.java
deleted file mode 100644
index 917288ed5..000000000
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/MsoSimulatorTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * simulators
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.simulators;
-
-import static org.junit.Assert.*;
-
-import java.util.HashMap;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.drools.http.server.HttpServletServer;
-import org.onap.policy.mso.SOResponse;
-import org.onap.policy.mso.util.Serialization;
-import org.onap.policy.rest.RESTManager;
-import org.onap.policy.rest.RESTManager.Pair;
-
-public class MsoSimulatorTest {
-
- @BeforeClass
- public static void setUpSimulator() {
- try {
- Util.buildMsoSim();
- } catch (InterruptedException e) {
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
-
- @Test
- public void testResponse(){
- Pair<Integer, String> httpDetails = RESTManager.post("http://localhost:6667/serviceInstances/v2/12345/vnfs/12345/vfModulesHTTPS/1.1", "username", "password", new HashMap<String, String>(), "application/json", "Some Request Here");
- assertNotNull(httpDetails);
- SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class);
- assertNotNull(response);
- }
-}
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
new file mode 100644
index 000000000..0a7cd4168
--- /dev/null
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
@@ -0,0 +1,133 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * simulators
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.simulators;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.UUID;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.drools.http.server.HttpServletServer;
+import org.onap.policy.so.SOCloudConfiguration;
+import org.onap.policy.so.SOModelInfo;
+import org.onap.policy.so.SORelatedInstance;
+import org.onap.policy.so.SORelatedInstanceListElement;
+import org.onap.policy.so.SORequest;
+import org.onap.policy.so.SORequestDetails;
+import org.onap.policy.so.SORequestInfo;
+import org.onap.policy.so.SORequestParameters;
+import org.onap.policy.so.SOResponse;
+import org.onap.policy.so.util.Serialization;
+import org.onap.policy.rest.RESTManager;
+import org.onap.policy.rest.RESTManager.Pair;
+
+public class SoSimulatorTest {
+
+ @BeforeClass
+ public static void setUpSimulator() {
+ try {
+ Util.buildSoSim();
+ } catch (InterruptedException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
+
+ /**
+ * Create dummy SO request for TestResponse() junit
+ */
+ private SORequest createTestRequest() {
+
+ // Construct SO Request
+ SORequest request = new SORequest();
+ request.requestId = UUID.randomUUID();
+ request.requestDetails = new SORequestDetails();
+ request.requestDetails.modelInfo = new SOModelInfo();
+ request.requestDetails.cloudConfiguration = new SOCloudConfiguration();
+ request.requestDetails.requestInfo = new SORequestInfo();
+ request.requestDetails.requestParameters = new SORequestParameters();
+ request.requestDetails.requestParameters.userParams = null;
+ //
+ // cloudConfiguration
+ //
+ request.requestDetails.cloudConfiguration.lcpCloudRegionId = "DFW";
+ request.requestDetails.cloudConfiguration.tenantId = "1015548";
+ //
+ // modelInfo
+ //
+ request.requestDetails.modelInfo.modelType = "vfModule";
+ request.requestDetails.modelInfo.modelInvariantId = "f32568ec-2f1c-458a-864b-0593d53d141a";
+ request.requestDetails.modelInfo.modelNameVersionId = "69615025-879d-4f0d-afe3-b7d1a7eeed1f";
+ request.requestDetails.modelInfo.modelName = "C15ce9e1E9144c8fB8bb..dnsscaling..module-1";
+ request.requestDetails.modelInfo.modelVersion = "1.0";
+ //
+ // requestInfo
+ //
+ request.requestDetails.requestInfo.instanceName = "vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8";
+ request.requestDetails.requestInfo.source = "POLICY";
+ request.requestDetails.requestInfo.suppressRollback = false;
+ //
+ // relatedInstanceList
+ //
+ SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement();
+ SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement();
+ relatedInstanceListElement1.relatedInstance = new SORelatedInstance();
+ relatedInstanceListElement2.relatedInstance = new SORelatedInstance();
+ //
+ relatedInstanceListElement1.relatedInstance.instanceId = "cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5";
+ relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo();
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = "4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b";
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = "5c996219-b2e2-4c76-9b43-7e8672a33c1d";
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelName = "8330e932-2a23-4943-8606";
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = "1.0";
+ //
+ relatedInstanceListElement2.relatedInstance.instanceId = "594e2fe0-48b8-41ff-82e2-3d4bab69b192";
+ relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo();
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "033a32ed-aa65-4764-a736-36f2942f1aa0";
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = "d4d072dc-4e21-4a03-9524-628985819a8e";
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelName = "c15ce9e1-e914-4c8f-b8bb";
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "1";
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = "c15ce9e1-e914-4c8f-b8bb 1";
+ //
+ request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
+ request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
+
+ return request;
+ }
+
+ @Test
+ public void testResponse(){
+ String request = Serialization.gsonPretty.toJson(createTestRequest());
+ Pair<Integer, String> httpDetails = RESTManager.post("http://localhost:6667/serviceInstances/v2/12345/vnfs/12345/vfModulesHTTPS/1.1", "username", "password", new HashMap<>(), "application/json", request);
+ assertNotNull(httpDetails);
+ SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class);
+ assertNotNull(response);
+ }
+}
diff --git a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
index 825c69b50..5675b6bdf 100644
--- a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
+++ b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
@@ -144,7 +144,7 @@ public class TestFirewallDemo {
// So no need to test it again here
//
try {
- Thread.sleep(3000);
+ Thread.sleep(10000);
} catch (InterruptedException e) {
}
//
diff --git a/controlloop/templates/template.demo/pom.xml b/controlloop/templates/template.demo/pom.xml
index e08174004..d3d3ef0ab 100644
--- a/controlloop/templates/template.demo/pom.xml
+++ b/controlloop/templates/template.demo/pom.xml
@@ -73,7 +73,7 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
- <artifactId>mso</artifactId>
+ <artifactId>so</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
@@ -175,7 +175,7 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
- <artifactId>actor.mso</artifactId>
+ <artifactId>actor.so</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
index f832ea5e2..82899f08b 100644
--- a/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
+++ b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
@@ -39,18 +39,18 @@ import org.onap.policy.appclcm.LCMResponse;
import org.onap.policy.appclcm.LCMCommonHeader;
import org.onap.policy.vfc.VFCRequest;
import org.onap.policy.vfc.VFCManager;
-import org.onap.policy.mso.SOManager;
-import org.onap.policy.mso.SORequest;
-import org.onap.policy.mso.SORequestStatus;
-import org.onap.policy.mso.SORequestDetails;
-import org.onap.policy.mso.SOModelInfo;
-import org.onap.policy.mso.SOCloudConfiguration;
-import org.onap.policy.mso.SORequestInfo;
-import org.onap.policy.mso.SORequestParameters;
-import org.onap.policy.mso.SORelatedInstanceListElement;
-import org.onap.policy.mso.SORelatedInstance;
-import org.onap.policy.mso.SOResponse;
-import org.onap.policy.controlloop.actor.mso.MSOActorServiceProvider;
+import org.onap.policy.so.SOManager;
+import org.onap.policy.so.SORequest;
+import org.onap.policy.so.SORequestStatus;
+import org.onap.policy.so.SORequestDetails;
+import org.onap.policy.so.SOModelInfo;
+import org.onap.policy.so.SOCloudConfiguration;
+import org.onap.policy.so.SORequestInfo;
+import org.onap.policy.so.SORequestParameters;
+import org.onap.policy.so.SORelatedInstanceListElement;
+import org.onap.policy.so.SORelatedInstance;
+import org.onap.policy.so.SOResponse;
+import org.onap.policy.controlloop.actor.so.SOActorServiceProvider;
import org.onap.policy.guard.PolicyGuard;
import org.onap.policy.guard.PolicyGuard.LockResult;
import org.onap.policy.guard.TargetLock;
@@ -517,7 +517,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
if(request instanceof SORequest) {
// Call SO. The response will be inserted into memory once it's received
- MSOActorServiceProvider.sendRequest(drools.getWorkingMemory(), request);
+ SOActorServiceProvider.sendRequest(drools.getWorkingMemory(), request);
}
break;
case "VFC":
@@ -926,10 +926,8 @@ rule "${policyName}.SO.RESPONSE"
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
$opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
$lock : TargetLock (requestID == $event.requestID)
- $request : SORequest( requestId == $event.requestID.toString() )
- $response : SOResponse( request.requestId == $event.requestID.toString() )
- then
-
+ $response : SOResponse( requestReferences.requestId.toString() == $event.requestID.toString() )
+ then
//
// Logging
Logger.info("------------------------------------------------------------------------------------------------");
@@ -941,7 +939,6 @@ rule "${policyName}.SO.RESPONSE"
Logger.metrics($opTimer);
Logger.metrics($lock);
Logger.metrics($response);
-
// Get the result of the operation
//
PolicyResult policyResult = $operation.onResponse($response);
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
index b277b669e..16ad7a8b0 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
@@ -38,7 +38,6 @@ import java.util.regex.Pattern;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
@@ -58,7 +57,7 @@ import org.onap.policy.controlloop.impl.ControlLoopLoggerStdOutImpl;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
-import org.onap.policy.mso.util.Serialization;
+import org.onap.policy.so.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,6 +70,7 @@ public class TestSO {
public static void setUpSimulator() {
try {
Util.buildAaiSim();
+ Util.buildSoSim();
} catch (InterruptedException e) {
fail(e.getMessage());
}
@@ -81,7 +81,6 @@ public class TestSO {
HttpServletServer.factory.destroy();
}
- @Ignore
@Test
public void testvDNS() throws IOException {
@@ -192,7 +191,7 @@ public class TestSO {
// So no need to test it again here
//
try {
- Thread.sleep(3000);
+ Thread.sleep(10000);
} catch (InterruptedException e) {
}
//
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java
index fb9f88f16..5a96e1667 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java
@@ -35,8 +35,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
@@ -53,18 +51,16 @@ import org.onap.policy.controlloop.policy.guard.ControlLoopGuard;
import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
import org.onap.policy.guard.PolicyGuardYamlToXacml;
-import org.onap.policy.simulators.AaiSimulatorJaxRs;
-import org.onap.policy.simulators.MsoSimulatorJaxRs;
-import org.onap.policy.simulators.VfcSimulatorJaxRs;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
import com.att.research.xacml.api.pdp.PDPEngine;
import com.att.research.xacml.api.pdp.PDPEngineFactory;
import com.att.research.xacml.util.FactoryException;
import com.att.research.xacml.util.XACMLProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public final class Util {
private static final Logger logger = LoggerFactory.getLogger(Util.class);
@@ -121,8 +117,8 @@ public final class Util {
return org.onap.policy.simulators.Util.buildAaiSim();
}
- public static HttpServletServer buildMsoSim() throws InterruptedException {
- return org.onap.policy.simulators.Util.buildMsoSim();
+ public static HttpServletServer buildSoSim() throws InterruptedException {
+ return org.onap.policy.simulators.Util.buildSoSim();
}
public static HttpServletServer buildVfcSim() throws InterruptedException {
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
new file mode 100644
index 000000000..e107e2e7c
--- /dev/null
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
@@ -0,0 +1,304 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * demo
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.template.demo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+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.kie.api.runtime.KieSession;
+import org.kie.api.runtime.rule.FactHandle;
+import org.onap.policy.controlloop.ControlLoopEventStatus;
+import org.onap.policy.controlloop.ControlLoopNotificationType;
+import org.onap.policy.controlloop.ControlLoopTargetType;
+import org.onap.policy.controlloop.VirtualControlLoopEvent;
+import org.onap.policy.controlloop.VirtualControlLoopNotification;
+import org.onap.policy.controlloop.policy.ControlLoopPolicy;
+import org.onap.policy.controlloop.policy.TargetType;
+import org.onap.policy.drools.http.server.HttpServletServer;
+import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
+import org.onap.policy.guard.PolicyGuard;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VDNSControlLoopTest {
+
+ private static final Logger logger = LoggerFactory.getLogger(VDNSControlLoopTest.class);
+
+ private KieSession kieSession;
+ private Util.Pair<ControlLoopPolicy, String> pair;
+ private PolicyEngineJUnitImpl engine;
+
+ @BeforeClass
+ public static void setUpSimulator() {
+ try {
+ Util.buildAaiSim();
+ Util.buildSoSim();
+ } catch (InterruptedException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
+
+ @Test
+ public void successTest() {
+
+ /*
+ * Start the kie session
+ */
+ try {
+ kieSession = startSession("src/main/resources/ControlLoop_Template_xacml_guard.drl",
+ "src/test/resources/yaml/policy_ControlLoop_SO-test.yaml",
+ "type=operational",
+ "CL_vDNS",
+ "v2.0");
+ } catch (IOException e) {
+ e.printStackTrace();
+ logger.debug("Could not create kieSession");
+ fail("Could not create kieSession");
+ }
+
+ /*
+ * Create a thread to continuously fire rules
+ * until main thread calls halt
+ */
+ new Thread( new Runnable() {
+ @Override
+ public void run() {
+ kieSession.fireUntilHalt();
+ }
+ } ).start();
+
+ /*
+ * Create a unique requestId and a unique trigger source
+ */
+ UUID requestID = UUID.randomUUID();
+ String triggerSourceName = "foobartriggersource36";
+
+ /*
+ * This will be the object returned from the PolicyEngine
+ */
+ Object obj = null;
+
+ /*
+ * Simulate an onset event the policy engine will
+ * receive from DCAE to kick off processing through
+ * the rules
+ */
+ try {
+ sendOnset(pair.a, requestID, triggerSourceName);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ logger.debug("Unable to send onset event");
+ fail("Unable to send onset event");
+ }
+
+ /*
+ * Pull the object that was sent out and make
+ * sure it is a ControlLoopNoticiation of type active
+ */
+ obj = engine.subscribe("UEB", "POLICY-CL-MGT");
+ assertNotNull(obj);
+ assertTrue(obj instanceof VirtualControlLoopNotification);
+ assertTrue(((VirtualControlLoopNotification)obj).notification.equals(ControlLoopNotificationType.ACTIVE));
+
+
+ /*
+ * Give the control loop time to acquire a lock
+ */
+ try {
+ Thread.sleep(4000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ logger.debug("An interrupt Exception was thrown");
+ fail("An interrupt Exception was thrown");
+ }
+
+ /*
+ * Give time to finish processing
+ */
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ logger.debug("An interrupt Exception was thrown");
+ fail("An interrupt Exception was thrown");
+ }
+
+ /*
+ * One final check to make sure the lock is released
+ */
+ assertFalse(PolicyGuard.isLocked(TargetType.VNF, triggerSourceName, requestID));
+
+ /*
+ * This will stop the thread that is firing the rules
+ */
+ kieSession.halt();
+
+ /*
+ * The only fact in memory should be Params
+ */
+ assertEquals(1, kieSession.getFactCount());
+
+ /*
+ * Print what's left in memory
+ */
+ dumpFacts(kieSession);
+
+ /*
+ * Gracefully shut down the kie session
+ */
+ kieSession.dispose();
+ }
+
+ /**
+ * This method will start a kie session and instantiate
+ * the Policy Engine.
+ *
+ * @param droolsTemplate
+ * the DRL rules file
+ * @param yamlFile
+ * the yaml file containing the policies
+ * @param policyScope
+ * scope for policy
+ * @param policyName
+ * name of the policy
+ * @param policyVersion
+ * version of the policy
+ * @return the kieSession to be used to insert facts
+ * @throws IOException
+ */
+ private KieSession startSession(String droolsTemplate,
+ String yamlFile,
+ String policyScope,
+ String policyName,
+ String policyVersion) throws IOException {
+
+ /*
+ * Load policies from yaml
+ */
+ pair = Util.loadYaml(yamlFile);
+ assertNotNull(pair);
+ assertNotNull(pair.a);
+ assertNotNull(pair.a.getControlLoop());
+ assertNotNull(pair.a.getControlLoop().getControlLoopName());
+ assertTrue(pair.a.getControlLoop().getControlLoopName().length() > 0);
+
+ /*
+ * Construct a kie session
+ */
+ final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ pair.a.getControlLoop().getControlLoopName(),
+ policyScope,
+ policyName,
+ policyVersion,
+ URLEncoder.encode(pair.b, "UTF-8"));
+
+ /*
+ * Retrieve the Policy Engine
+ */
+ engine = (PolicyEngineJUnitImpl) kieSession.getGlobal("Engine");
+
+ logger.debug("============");
+ logger.debug(URLEncoder.encode(pair.b, "UTF-8"));
+ logger.debug("============");
+
+ return kieSession;
+ }
+
+ /**
+ * This method is used to simulate event messages from DCAE
+ * that start the control loop (onset message).
+ *
+ * @param policy the controlLoopName comes from the policy
+ * @param requestID the requestId for this event
+ * @param triggerSourceName
+ * @throws InterruptedException
+ */
+ protected void sendOnset(ControlLoopPolicy policy, UUID requestID, String triggerSourceName) throws InterruptedException {
+ VirtualControlLoopEvent event = new VirtualControlLoopEvent();
+ event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
+ event.requestID = requestID;
+ event.target = "VNF_NAME";
+ event.target_type = ControlLoopTargetType.VNF;
+ event.closedLoopAlarmStart = Instant.now();
+ event.AAI = new HashMap<>();
+ event.AAI.put("cloud-region.identity-url", "foo");
+ event.AAI.put("vserver.selflink", "bar");
+ event.AAI.put("vserver.is-closed-loop-disabled", "false");
+ event.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
+ event.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+ kieSession.insert(event);
+ Thread.sleep(2000);
+ }
+
+ /**
+ * This method is used to simulate event messages from DCAE
+ * that end the control loop (abatement message).
+ *
+ * @param policy the controlLoopName comes from the policy
+ * @param requestID the requestId for this event
+ * @param triggerSourceName
+ * @throws InterruptedException
+ */
+ protected void sendAbatement(ControlLoopPolicy policy, UUID requestID, String triggerSourceName) throws InterruptedException {
+ VirtualControlLoopEvent event = new VirtualControlLoopEvent();
+ event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
+ event.requestID = requestID;
+ event.target = "generic-vnf.vnf-id";
+ event.closedLoopAlarmStart = Instant.now().minusSeconds(5);
+ event.closedLoopAlarmEnd = Instant.now();
+ event.AAI = new HashMap<>();
+ event.AAI.put("cloud-region.identity-url", "foo");
+ event.AAI.put("vserver.selflink", "bar");
+ event.AAI.put("vserver.is-closed-loop-disabled", "false");
+ event.AAI.put("generic-vnf.vnf-id", "testGenericVnfID");
+ event.closedLoopEventStatus = ControlLoopEventStatus.ABATED;
+ kieSession.insert(event);
+ }
+
+ /**
+ * This method will dump all the facts in the working memory.
+ *
+ * @param kieSession the session containing the facts
+ */
+ public void dumpFacts(KieSession kieSession) {
+ logger.debug("Fact Count: {}", kieSession.getFactCount());
+ for (FactHandle handle : kieSession.getFactHandles()) {
+ logger.debug("FACT: {}", handle);
+ }
+ }
+}