aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java2
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java28
-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)226
-rw-r--r--controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor1
-rw-r--r--controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java14
-rw-r--r--controlloop/common/actors/pom.xml2
-rw-r--r--controlloop/common/eventmanager/pom.xml10
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java31
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java37
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java162
-rw-r--r--controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml6
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java30
-rw-r--r--controlloop/common/guard/pom.xml7
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java21
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java2
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java2
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java2
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java2
-rw-r--r--controlloop/common/guard/src/main/resources/operation_history.properties26
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java5
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java2
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java9
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java1
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java3
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java6
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java6
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java9
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java9
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java10
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java8
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java13
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java13
-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)19
-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/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java1
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java1
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java1
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java1
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java1
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java15
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java2
-rw-r--r--controlloop/common/simulators/pom.xml10
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java41
-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.java19
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java53
-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/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java10
-rw-r--r--controlloop/packages/basex/src/files/config/controlloop.properties.environment35
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/pom.xml56
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/META-INF/maven/archetype-metadata.xml78
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/pom.xml139
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties55
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json29
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json15
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vCPE.yaml23
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml29
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl1134
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/test/resources/projects/basic/archetype.properties43
-rw-r--r--controlloop/templates/pom.xml1
-rw-r--r--controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/pom.xml3
-rw-r--r--controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml2
-rw-r--r--controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/test/resources/projects/basic/goal.txt0
-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/ControlLoopXacmlGuardTest.java2
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java9
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java20
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java304
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java2
94 files changed, 2648 insertions, 522 deletions
diff --git a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
index 31bb5c8d2..dcdf59a56 100644
--- a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
@@ -94,7 +94,7 @@ public class AppcServiceProviderTest {
public static void setUpSimulator() {
try {
Util.buildAaiSim();
- } catch (InterruptedException e) {
+ } catch (Exception e) {
fail(e.getMessage());
}
}
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index 4ffbf6941..eaff2503a 100644
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -31,13 +31,13 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-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.AAINQF199Response;
+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.appclcm.LCMCommonHeader;
import org.onap.policy.appclcm.LCMRequest;
import org.onap.policy.appclcm.LCMRequestWrapper;
@@ -108,9 +108,9 @@ public class AppcLcmActorServiceProvider implements Actor {
*
* @return the vnf-id of the target vnf to act upon or null if not found
*/
- private static String parseAAIResponse(List<AAINQF199InventoryResponseItem> items, String resourceId) {
+ private static String parseAAIResponse(List<AAINQInventoryResponseItem> items, String resourceId) {
String vnfId = null;
- for (AAINQF199InventoryResponseItem item: items) {
+ for (AAINQInventoryResponseItem item: items) {
if ((item.genericVNF != null)
&& (item.genericVNF.modelInvariantId != null)
&& (resourceId.equals(item.genericVNF.modelInvariantId))) {
@@ -143,9 +143,9 @@ public class AppcLcmActorServiceProvider implements Actor {
//TODO: This request id should not be hard coded in future releases
UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087");
- AAINQF199Request aaiRequest = new AAINQF199Request();
- aaiRequest.queryParameters = new AAINQF199QueryParameters();
- aaiRequest.queryParameters.namedQuery = new AAINQF199NamedQuery();
+ AAINQRequest aaiRequest = new AAINQRequest();
+ aaiRequest.queryParameters = new AAINQQueryParameters();
+ aaiRequest.queryParameters.namedQuery = new AAINQNamedQuery();
aaiRequest.queryParameters.namedQuery.namedQueryUUID = requestId;
Map<String, Map<String, String>> filter = new HashMap<>();
@@ -154,11 +154,11 @@ public class AppcLcmActorServiceProvider implements Actor {
filterItem.put("vnf-id", sourceVnfId);
filter.put("generic-vnf", filterItem);
- aaiRequest.instanceFilters = new AAINQF199InstanceFilters();
+ aaiRequest.instanceFilters = new AAINQInstanceFilters();
aaiRequest.instanceFilters.instanceFilter.add(filter);
//TODO: URL should not be hard coded for future releases
- AAINQF199Response aaiResponse = AAINQF199Manager.postQuery(
+ AAINQResponse aaiResponse = AAIManager.postQuery(
"http://localhost:6666",
"policy", "policy",
aaiRequest, requestId);
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..aac90f7a6 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;
@@ -78,7 +77,7 @@ public class MSOActorServiceProvider implements Actor {
private static String serviceItemServiceInstanceId;
- private String serviceItemPersonaModelId;
+ private String serviceItemModelInvariantId;
private String serviceItemModelName;
@@ -90,9 +89,9 @@ public class MSOActorServiceProvider implements Actor {
private String vfModuleItemVfModuleName;
- private String vfModuleItemPersonaModelId;
+ private String vfModuleItemModelInvariantId;
- private String vfModuleItemPersonaModelVersion;
+ private String vfModuleItemModelVersionId;
private String vfModuleItemModelName;
@@ -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.modelVersionId);
+ 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);
+ setServiceItemModelInvariantId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.modelInvariantId);
+ 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.modelVersionId);
+ 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);
+ setVfModuleItemModelInvariantId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.modelInvariantId);
+ setVfModuleItemModelVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.modelVersionId);
+ 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);
@@ -316,7 +315,7 @@ public class MSOActorServiceProvider implements Actor {
(getServiceItemServiceInstanceId() == null) || (getServiceItemModelName() == null) ||
(getServiceItemModelType() == null) || (getServiceItemModelVersion() == null) ||
(getServiceItemModelNameVersionId() == null) || (getVfModuleItemVfModuleName() == null) ||
- (getVfModuleItemPersonaModelId() == null) || (getVfModuleItemPersonaModelVersion() == null) ||
+ (getVfModuleItemModelInvariantId() == null) || (getVfModuleItemModelVersionId() == null) ||
(getVfModuleItemModelName() == null) || (getVfModuleItemModelNameVersionId() == null) ||
(getTenantItemTenantId() == null) || (getCloudRegionItemCloudRegionId() == null)) {
return false;
@@ -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();
@@ -368,10 +368,10 @@ public class MSOActorServiceProvider implements Actor {
// modelInfo
//
request.requestDetails.modelInfo.modelType = "vfModule";
- request.requestDetails.modelInfo.modelInvariantId = getVfModuleItemPersonaModelId();
+ request.requestDetails.modelInfo.modelInvariantId = getVfModuleItemModelInvariantId();
request.requestDetails.modelInfo.modelNameVersionId = getVfModuleItemModelNameVersionId();
request.requestDetails.modelInfo.modelName = getVfModuleItemModelName();
- request.requestDetails.modelInfo.modelVersion = getVfModuleItemPersonaModelVersion();
+ request.requestDetails.modelInfo.modelVersion = getVfModuleItemModelVersionId();
//
// requestInfo
//
@@ -389,7 +389,7 @@ public class MSOActorServiceProvider implements Actor {
relatedInstanceListElement1.relatedInstance.instanceId = getServiceItemServiceInstanceId();
relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
- relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = getServiceItemPersonaModelId();
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = getServiceItemModelInvariantId();
relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = getServiceItemModelNameVersionId();
relatedInstanceListElement1.relatedInstance.modelInfo.modelName = getServiceItemModelName();
relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = getServiceItemModelVersion();
@@ -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;
}
/**
@@ -456,14 +456,14 @@ public class MSOActorServiceProvider implements Actor {
}
/**
- * @return the vnfItemPersonaModelId
+ * @return the vnfItemModelInvariantId
*/
public String getVnfItemModelInvariantId() {
return this.vnfItemModelInvariantId;
}
/**
- * @param vnfItemPersonaModelId the vnfItemPersonaModelId to set
+ * @param vnfItemModelInvariantId the vnfItemModelInvariantId to set
*/
private void setVnfItemModelInvariantId(String vnfItemModelInvariantId) {
this.vnfItemModelInvariantId = vnfItemModelInvariantId;
@@ -537,21 +537,21 @@ public class MSOActorServiceProvider implements Actor {
*/
private void setServiceItemServiceInstanceId(
String serviceItemServiceInstanceId) {
- MSOActorServiceProvider.serviceItemServiceInstanceId = serviceItemServiceInstanceId;
+ SOActorServiceProvider.serviceItemServiceInstanceId = serviceItemServiceInstanceId;
}
/**
- * @return the serviceItemPersonaModelId
+ * @return the serviceItemModelInvariantId
*/
- public String getServiceItemPersonaModelId() {
- return this.serviceItemPersonaModelId;
+ public String getServiceItemModelInvariantId() {
+ return this.serviceItemModelInvariantId;
}
/**
- * @param serviceItemPersonaModelId the serviceItemPersonaModelId to set
+ * @param serviceItemModeInvariantlId the serviceItemModelInvariantId to set
*/
- private void setServiceItemPersonaModelId(String serviceItemPersonaModelId) {
- this.serviceItemPersonaModelId = serviceItemPersonaModelId;
+ private void setServiceItemModelInvariantId(String serviceItemModelInvariantId) {
+ this.serviceItemModelInvariantId = serviceItemModelInvariantId;
}
/**
@@ -626,32 +626,32 @@ public class MSOActorServiceProvider implements Actor {
}
/**
- * @return the vfModuleItemPersonaModelId
+ * @return the vfModuleItemModelInvariantId
*/
- public String getVfModuleItemPersonaModelId() {
- return this.vfModuleItemPersonaModelId;
+ public String getVfModuleItemModelInvariantId() {
+ return this.vfModuleItemModelInvariantId;
}
/**
- * @param vfModuleItemPersonaModelId the vfModuleItemPersonaModelId to set
+ * @param vfModuleItemModelInvariantId the vfModuleItemModelInvariantId to set
*/
- private void setVfModuleItemPersonaModelId(String vfModuleItemPersonaModelId) {
- this.vfModuleItemPersonaModelId = vfModuleItemPersonaModelId;
+ private void setVfModuleItemModelInvariantId(String vfModuleItemModelInvariantId) {
+ this.vfModuleItemModelInvariantId = vfModuleItemModelInvariantId;
}
/**
- * @return the vfModuleItemPersonaModelVersion
+ * @return the vfModuleItemModelVersionId
*/
- public String getVfModuleItemPersonaModelVersion() {
- return this.vfModuleItemPersonaModelVersion;
+ public String getVfModuleItemModelVersionId() {
+ return this.vfModuleItemModelVersionId;
}
/**
- * @param vfModuleItemPersonaModelVersion the vfModuleItemPersonaModelVersion to set
+ * @param vfModuleItemModelVersionId the vfModuleItemModelVersionId to set
*/
- private void setVfModuleItemPersonaModelVersion(
- String vfModuleItemPersonaModelVersion) {
- this.vfModuleItemPersonaModelVersion = vfModuleItemPersonaModelVersion;
+ private void setVfModuleItemModelVersionId(
+ String vfModuleItemModelVersionId) {
+ this.vfModuleItemModelVersionId = vfModuleItemModelVersionId;
}
/**
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/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java
index ffada0a81..bd06ef133 100644
--- a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java
+++ b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java
@@ -19,19 +19,17 @@
package org.onap.policy.controlloop.actor.vfc;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.vfc.VFCRequest;
-import org.onap.policy.vfc.VFCHealRequest;
-import org.onap.policy.vfc.VFCHealAdditionalParams;
-import org.onap.policy.vfc.VFCHealActionVmInfo;
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.vfc.VFCHealActionVmInfo;
+import org.onap.policy.vfc.VFCHealAdditionalParams;
+import org.onap.policy.vfc.VFCHealRequest;
+import org.onap.policy.vfc.VFCRequest;
-import org.onap.policy.controlloop.actorServiceProvider.spi.Actor;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
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..93ff56cba 100644
--- a/controlloop/common/eventmanager/pom.xml
+++ b/controlloop/common/eventmanager/pom.xml
@@ -41,6 +41,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>com.att.research.xacml</groupId>
+ <artifactId>xacml</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.drools-applications</groupId>
<artifactId>actorServiceProvider</artifactId>
<version>1.1.0-SNAPSHOT</version>
@@ -54,7 +60,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 +138,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/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index c2846f86d..f891a2c6a 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -26,18 +26,17 @@ import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
-import java.util.List;
import java.util.UUID;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
+import org.onap.policy.aai.AAIGETVnfResponse;
+import org.onap.policy.aai.AAIGETVserverResponse;
+import org.onap.policy.aai.AAIManager;
import org.onap.policy.controlloop.ControlLoopEventStatus;
+import org.onap.policy.controlloop.ControlLoopException;
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.ControlLoopException;
import org.onap.policy.controlloop.policy.FinalResult;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.processor.ControlLoopProcessor;
@@ -49,13 +48,6 @@ import org.onap.policy.guard.TargetLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.AAIGETVserverResponse;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.RelationshipList;
-import org.onap.policy.aai.Relationship;
-
public class ControlLoopEventManager implements LockCallback, Serializable {
/**
@@ -68,7 +60,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
public final UUID requestID;
private String controlLoopResult;
- private ControlLoopProcessor processor = null;
+ private transient ControlLoopProcessor processor = null;
private VirtualControlLoopEvent onset;
private Integer numOnsets = 0;
private Integer numAbatements = 0;
@@ -78,7 +70,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
private boolean isActivated = false;
private LinkedList<ControlLoopOperation> controlLoopHistory = new LinkedList<>();
private ControlLoopOperationManager currentOperation = null;
- private TargetLock targetLock = null;
+ private transient TargetLock targetLock = null;
private static AAIGETVnfResponse vnfResponse = null;
private static AAIGETVserverResponse vserverResponse = null;
@@ -589,7 +581,6 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVnfResponse aaiResponse) {
- RelationshipList relationshipList = new RelationshipList();
if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
String value = aaiResponse.isClosedLoopDisabled;
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
@@ -602,7 +593,6 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVserverResponse aaiResponse) {
- RelationshipList relationshipList = new RelationshipList();
if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
String value = aaiResponse.isClosedLoopDisabled;
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
@@ -633,9 +623,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
try {
if (vserverName != null) {
- AAIManager manager = new AAIManager();
String url = "https://aai-ext1.test.att.com:8443/aai/v11/nodes/vservers?vserver-name=";
- response = manager.getQueryByVserverName(url, user, password, requestID, vserverName);
+ response = AAIManager.getQueryByVserverName(url, user, password, requestID, vserverName);
}
} catch (Exception e) {
logger.error("getAAIVserverInfo exception: ", e);
@@ -655,13 +644,11 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
try {
if (vnfName != null) {
- AAIManager manager = new AAIManager();
String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
- response = manager.getQueryByVnfName(url, user, password, requestID, vnfName);
+ response = AAIManager.getQueryByVnfName(url, user, password, requestID, vnfName);
} else if (vnfID != null) {
- AAIManager manager = new AAIManager();
String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf/";
- response = manager.getQueryByVnfID(url, user, password, requestID, vnfID);
+ response = AAIManager.getQueryByVnfID(url, user, password, requestID, vnfID);
}
} catch (Exception e) {
logger.error("getAAIVnfInfo exception: ", e);
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..8849a2351 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
@@ -20,11 +20,13 @@
package org.onap.policy.controlloop.eventmanager;
+import java.io.InputStream;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.AbstractMap;
import java.util.LinkedList;
+import java.util.Properties;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
@@ -37,14 +39,14 @@ import org.onap.policy.controlloop.ControlLoopException;
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.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;
public class ControlLoopOperationManager implements Serializable {
@@ -69,13 +71,13 @@ public class ControlLoopOperationManager implements Serializable {
//
//public final ATTControlLoopEvent onset;
public final ControlLoopEvent onset;
- public final Policy policy;
+ public final transient Policy policy;
//
// Properties used to track the Operation
//
private int attempts = 0;
- private Operation currentOperation = null;
+ private transient Operation currentOperation = null;
private LinkedList<Operation> operationHistory = new LinkedList<Operation>();
private PolicyResult policyResult = null;
private ControlLoopEventManager eventManager = null;
@@ -105,7 +107,7 @@ public class ControlLoopOperationManager implements Serializable {
}
private String guardApprovalStatus = "NONE";//"NONE", "PERMIT", "DENY"
- private Object operationRequest;
+ private transient Object operationRequest;
public Object getOperationRequest() {
return operationRequest;
@@ -214,12 +216,12 @@ 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
this.currentOperation = operation;
-
+
return operationRequest;
case "VFC":
this.operationRequest = VFCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.operation, this.policy);
@@ -364,9 +366,9 @@ public class ControlLoopOperationManager implements Serializable {
}
return PolicyResult.FAILURE;
}
-
+
}
-
+
return null;
}
@@ -512,13 +514,24 @@ public class ControlLoopOperationManager implements Serializable {
private void storeOperationInDataBase(){
+ // DB Properties
+ Properties props = new Properties();
+ try (InputStream is = org.onap.policy.guard.PIPEngineGetHistory.class.getResourceAsStream(org.onap.policy.guard.PIPEngineGetHistory.OPS_HIST_PROPS_LOC)){
+ props.load(is);
+ } catch (Exception ex) {
+ logger.error("getCountFromDB threw: ", ex);
+ return;
+ }
String OpsHistPU = System.getProperty("OperationsHistoryPU");
if(OpsHistPU == null || !OpsHistPU.equals("TestOperationsHistoryPU")){
OpsHistPU = "OperationsHistoryPU";
}
+ else{
+ props.clear();
+ }
EntityManager em;
try{
- em = Persistence.createEntityManagerFactory(OpsHistPU).createEntityManager();
+ em = Persistence.createEntityManagerFactory(OpsHistPU, props).createEntityManager();
}catch(Exception e){
logger.error("storeOperationInDataBase threw: ", e);
return;
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
index b6fad23d9..f2c565d9a 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,91 +20,91 @@
package org.onap.policy.controlloop.processor;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.policy.ControlLoop;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.FinalResult;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.PolicyResult;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor;
public class ControlLoopProcessor {
-
- private final String yaml;
- private final ControlLoopPolicy policy;
- private String currentPolicy = null;
-
- public ControlLoopProcessor(String yaml) throws ControlLoopException {
- this.yaml = yaml;
- try {
- Yaml y = new Yaml(new Constructor(ControlLoopPolicy.class));
- Object obj = y.load(this.yaml);
- if (obj instanceof ControlLoopPolicy) {
- this.policy = (ControlLoopPolicy) obj;
- this.currentPolicy = this.policy.getControlLoop().getTrigger_policy();
- } else {
- this.policy = null;
- throw new ControlLoopException("Unable to parse yaml into ControlLoopPolicy object");
- }
- } catch (Exception e) {
- //
- // Most likely this is a YAML Exception
- //
- throw new ControlLoopException(e);
- }
- }
-
- public ControlLoop getControlLoop() {
- return this.policy.getControlLoop();
- }
-
- public FinalResult checkIsCurrentPolicyFinal() {
- return FinalResult.toResult(this.currentPolicy);
- }
-
- public Policy getCurrentPolicy() {
- for (Policy policy : this.policy.getPolicies()) {
- if (policy.getId().equals(this.currentPolicy)) {
- return policy;
- }
- }
- return null;
- }
-
- public void nextPolicyForResult(PolicyResult result) throws ControlLoopException {
- Policy policy = this.getCurrentPolicy();
- try {
- if (this.policy == null) {
- throw new ControlLoopException("There is no current policy to determine where to go to.");
- }
- switch (result) {
- case SUCCESS:
- this.currentPolicy = policy.getSuccess();
- break;
- case FAILURE:
- this.currentPolicy = policy.getFailure();
- break;
- case FAILURE_TIMEOUT:
- this.currentPolicy = policy.getFailure_timeout();
- break;
- case FAILURE_RETRIES:
- this.currentPolicy = policy.getFailure_retries();
- break;
- case FAILURE_EXCEPTION:
- this.currentPolicy = policy.getFailure_exception();
- break;
- case FAILURE_GUARD:
- this.currentPolicy = policy.getFailure_guard();
- break;
- default:
- throw new ControlLoopException("Bad policy result given: " + result);
- }
- } catch (ControlLoopException e) {
- this.currentPolicy = FinalResult.FINAL_FAILURE_EXCEPTION.toString();
- throw e;
- }
- }
-
+
+ private final String yaml;
+ private final ControlLoopPolicy policy;
+ private String currentPolicy = null;
+
+ public ControlLoopProcessor(String yaml) throws ControlLoopException {
+ this.yaml = yaml;
+ try {
+ final Yaml y = new Yaml(new CustomClassLoaderConstructor(ControlLoopPolicy.class,
+ ControlLoopPolicy.class.getClassLoader()));
+ final Object obj = y.load(this.yaml);
+ if (obj instanceof ControlLoopPolicy) {
+ this.policy = (ControlLoopPolicy) obj;
+ this.currentPolicy = this.policy.getControlLoop().getTrigger_policy();
+ } else {
+ this.policy = null;
+ throw new ControlLoopException("Unable to parse yaml into ControlLoopPolicy object");
+ }
+ } catch (final Exception e) {
+ //
+ // Most likely this is a YAML Exception
+ //
+ throw new ControlLoopException(e);
+ }
+ }
+
+ public ControlLoop getControlLoop() {
+ return this.policy.getControlLoop();
+ }
+
+ public FinalResult checkIsCurrentPolicyFinal() {
+ return FinalResult.toResult(this.currentPolicy);
+ }
+
+ public Policy getCurrentPolicy() {
+ for (final Policy policy : this.policy.getPolicies()) {
+ if (policy.getId().equals(this.currentPolicy)) {
+ return policy;
+ }
+ }
+ return null;
+ }
+
+ public void nextPolicyForResult(PolicyResult result) throws ControlLoopException {
+ final Policy policy = this.getCurrentPolicy();
+ try {
+ if (this.policy == null) {
+ throw new ControlLoopException("There is no current policy to determine where to go to.");
+ }
+ switch (result) {
+ case SUCCESS:
+ this.currentPolicy = policy.getSuccess();
+ break;
+ case FAILURE:
+ this.currentPolicy = policy.getFailure();
+ break;
+ case FAILURE_TIMEOUT:
+ this.currentPolicy = policy.getFailure_timeout();
+ break;
+ case FAILURE_RETRIES:
+ this.currentPolicy = policy.getFailure_retries();
+ break;
+ case FAILURE_EXCEPTION:
+ this.currentPolicy = policy.getFailure_exception();
+ break;
+ case FAILURE_GUARD:
+ this.currentPolicy = policy.getFailure_guard();
+ break;
+ default:
+ throw new ControlLoopException("Bad policy result given: " + result);
+ }
+ } catch (final ControlLoopException e) {
+ this.currentPolicy = FinalResult.FINAL_FAILURE_EXCEPTION.toString();
+ throw e;
+ }
+ }
+
}
diff --git a/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml b/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
index 27c64b60a..827e2562b 100644
--- a/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
+++ b/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
@@ -11,12 +11,8 @@
<properties>
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:mariadb://localhost:3306/policy" />
- <property name="javax.persistence.jdbc.user" value="root" />
- <property name="javax.persistence.jdbc.password" value="aaaa" />
<property name="eclipselink.logging.level" value="WARNING" />
+ <!-- Credential and URL properties located in /guard/src/main/resources/operation_history.properties -->
</properties>
</persistence-unit>
-
-
</persistence>
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index ef7a1a94c..2e208748f 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -20,40 +20,26 @@
package org.onap.policy.controlloop.eventmanager;
-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.time.Instant;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.UUID;
import org.junit.Test;
-import org.onap.policy.aai.AAIGETVserverResponse;
import org.onap.policy.aai.AAIGETVnfResponse;
+import org.onap.policy.aai.AAIGETVserverResponse;
+import org.onap.policy.aai.RelatedToProperty;
import org.onap.policy.aai.RelatedToPropertyItem;
import org.onap.policy.aai.Relationship;
import org.onap.policy.aai.RelationshipData;
import org.onap.policy.aai.RelationshipDataItem;
import org.onap.policy.aai.RelationshipList;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.RelatedToProperty;
-import org.onap.policy.appc.Request;
-import org.onap.policy.appc.Response;
-import org.onap.policy.appc.ResponseCode;
-import org.onap.policy.appc.ResponseValue;
import org.onap.policy.controlloop.ControlLoopEventStatus;
-
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.Util;
+import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.controlloop.processor.ControlLoopProcessor;
-import org.onap.policy.controlloop.processor.ControlLoopProcessorTest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -79,6 +65,7 @@ public class ControlLoopEventManagerTest {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
try {
+ @SuppressWarnings("unused")
ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
@@ -104,32 +91,31 @@ public class ControlLoopEventManagerTest {
onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
try {
- ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
logger.info("testIsClosedLoopDisabled --");
- AAIManager manager = new AAIManager();
String user = "POLICY";
String password = "POLICY";
String vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491";
String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf/";
AAIGETVnfResponse response = getQueryByVnfID2(url, user, password, onset.requestID, vnfID);
assertNotNull(response);
- boolean disabled = eventManager.isClosedLoopDisabled(response);
+ boolean disabled = ControlLoopEventManager.isClosedLoopDisabled(response);
logger.info("QueryByVnfID - isClosedLoopDisabled: " + disabled);
String vnfName = "lll_vnf_010317";
url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
response = getQueryByVnfName2(url, user, password, onset.requestID, vnfName);
assertNotNull(response);
- disabled = eventManager.isClosedLoopDisabled(response);
+ disabled = ControlLoopEventManager.isClosedLoopDisabled(response);
logger.info("QueryByVnfName2 - isClosedLoopDisabled: " + disabled);
String vserverName = "USMSO1SX7NJ0103UJZZ01-vjunos0";
url = "https://aai-ext1.test.att.com:8443//aai/v11/nodes/vservers?vserver-name=";
+ @SuppressWarnings("unused")
AAIGETVserverResponse response2 = getQueryByVserverName2(url, user, password, onset.requestID, vserverName);
assertNotNull(response);
- disabled = eventManager.isClosedLoopDisabled(response);
+ disabled = ControlLoopEventManager.isClosedLoopDisabled(response);
logger.info("QueryByVserverName - isClosedLoopDisabled: " + disabled);
} catch (Exception e) {
fail(e.getMessage());
diff --git a/controlloop/common/guard/pom.xml b/controlloop/common/guard/pom.xml
index 2b173c36c..e0283589a 100644
--- a/controlloop/common/guard/pom.xml
+++ b/controlloop/common/guard/pom.xml
@@ -13,17 +13,10 @@
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>com.att.research.xacml</groupId>
- <artifactId>xacml</artifactId>
- <version>1.0.0</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>com.att.research.xacml</groupId>
<artifactId>xacml-pdp</artifactId>
<version>1.0.0</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
index 3e93bd761..afb847e09 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
@@ -20,6 +20,8 @@
package org.onap.policy.guard;
+import java.io.IOException;
+import java.io.InputStream;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.Collection;
@@ -64,7 +66,8 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
private static final Logger logger = LoggerFactory.getLogger(PIPEngineGetHistory.class);
- public static final String DEFAULT_DESCRIPTION = "PIP for retrieving Operations History from DB";
+ public static final String DEFAULT_DESCRIPTION = "PIP for retrieving Operations History from DB";
+ public static final String OPS_HIST_PROPS_LOC = "/operation_history.properties";
//
// Base issuer string. The issuer in the policy will also contain time window information
@@ -305,13 +308,25 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
private static int getCountFromDB(String actor, String operation, String target, String timeWindow){
+ // DB Properties
+ Properties props = new Properties();
+ try (InputStream is = org.onap.policy.guard.PIPEngineGetHistory.class.getResourceAsStream(OPS_HIST_PROPS_LOC)){
+ props.load(is);
+ } catch (IOException ex) {
+ logger.error("getCountFromDB threw: ", ex);
+ return -1;
+ }
+
EntityManager em = null;
String OpsHistPU = System.getProperty("OperationsHistoryPU");
if(OpsHistPU == null || !OpsHistPU.equals("TestOperationsHistoryPU")){
OpsHistPU = "OperationsHistoryPU";
}
+ else{
+ props.clear();
+ }
try{
- em = Persistence.createEntityManagerFactory(OpsHistPU).createEntityManager();
+ em = Persistence.createEntityManagerFactory(OpsHistPU, props).createEntityManager();
}catch(Exception ex){
logger.error("PIP thread got Exception. Can't connect to Operations History DB -- {}", OpsHistPU);
logger.error("getCountFromDB threw: ", ex);
@@ -372,7 +387,7 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
try {
diff = now - dateUtil.init(timeWindow).getMs();
} catch (Exception ex) {
- System.err.println("PIP thread got Exception " + ex.getLocalizedMessage());
+ logger.error("PIP thread got Exception " + ex);
return -1;
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
index dbaf711c4..5ecb44162 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
@@ -140,7 +140,7 @@ public class PolicyGuardXacmlHelper {
} catch (Exception e) {
String message = "Parsing Content-Type: " + connection.getContentType() + ", error=" + e.getMessage();
- logger.error("{}: callRESTfulPDP threw: ", message);
+ logger.error("{}: callRESTfulPDP threw: ", message, e);
}
} else {
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java
index ea966ea55..62ddb0d71 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java
@@ -38,7 +38,7 @@ public class PNFTargetLock implements TargetLock, Serializable {
private final TargetType targetType;
private final String target;
private final UUID requestID;
- private final LockCallback callback;
+ private final transient LockCallback callback;
public PNFTargetLock (TargetType type, String target, UUID requestID, LockCallback callback) {
this.lockID = UUID.randomUUID();
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java
index 1de105ce4..0a7556bc9 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java
@@ -37,7 +37,7 @@ public class VMTargetLock implements TargetLock, Serializable {
private final TargetType targetType;
private final String target;
private final UUID requestID;
- private final LockCallback callback;
+ private final transient LockCallback callback;
public VMTargetLock(TargetType targetType, String target, UUID requestID, LockCallback callback) {
this.lockID = UUID.randomUUID();
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
index 1350d5c54..b6e49b578 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
@@ -38,7 +38,7 @@ public class VNFTargetLock implements TargetLock, Serializable {
private final TargetType targetType;
private final String target;
private final UUID requestID;
- private final LockCallback callback;
+ private final transient LockCallback callback;
public VNFTargetLock (TargetType type, String target, UUID requestID, LockCallback callback) {
this.lockID = UUID.randomUUID();
diff --git a/controlloop/common/guard/src/main/resources/operation_history.properties b/controlloop/common/guard/src/main/resources/operation_history.properties
new file mode 100644
index 000000000..8c374a85b
--- /dev/null
+++ b/controlloop/common/guard/src/main/resources/operation_history.properties
@@ -0,0 +1,26 @@
+#/*-
+# * ============LICENSE_START=======================================================
+# * guard
+# * ================================================================================
+# * 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=========================================================
+# */
+
+#
+# Maria DB Operation History Credentials
+#
+javax.persistence.jdbc.user=root
+javax.persistence.jdbc.password=aaaa
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/policy
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java
index 57140cebe..a641383df 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java
@@ -24,6 +24,11 @@ import java.util.UUID;
import org.onap.policy.aai.AAIGETResponse;
public class AAIGETResponseWrapper implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 9167822470867043968L;
+
public UUID requestID;
public AAIGETResponse aairesponse;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
index b318f72ef..8ab94e9a4 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
@@ -21,8 +21,6 @@
package org.onap.policy.aai;
import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
import com.google.gson.annotations.SerializedName;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
index 23e2bf041..e373c1200 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
@@ -21,19 +21,10 @@
package org.onap.policy.aai;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.aai.AAIGETVserverResponse;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.RelationshipDataItem;
-import org.onap.policy.aai.RelationshipData;
import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.aai.AAINQRequest;
-import org.onap.policy.aai.AAINQResponse;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
import org.slf4j.Logger;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java
index 9cb0a220a..00f62cf10 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java
@@ -105,6 +105,7 @@ public final class AAINQF199Manager {
Thread.sleep(1000);
} catch (InterruptedException e) {
logger.error(e.getMessage());
+ Thread.currentThread().interrupt();
}
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java
index beec3204d..d2bff6b7b 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java
@@ -78,6 +78,9 @@ public class AAINQGenericVNF implements Serializable {
@SerializedName("model-invariant-id")
public String modelInvariantId;
+
+ @SerializedName("model-version-id")
+ public String modelVersionId;
public AAINQGenericVNF() {
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java
index c6efac781..ed7d9225a 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java
@@ -49,6 +49,12 @@ public class AAINQServiceInstance implements Serializable {
@SerializedName("resource-version")
public String resourceVersion;
+ @SerializedName("model-invariant-id")
+ public String modelInvariantId;
+
+ @SerializedName("model-version-id")
+ public String modelVersionId;
+
public AAINQServiceInstance() {
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java
index d3249d834..07c4303c2 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java
@@ -64,6 +64,12 @@ public class AAINQVfModule implements Serializable {
@SerializedName("contrail-service-instance-fqdn")
public String contrailServiceInstanceFqdn;
+ @SerializedName("model-invariant-id")
+ public String modelInvariantId;
+
+ @SerializedName("model-version-id")
+ public String modelVersionId;
+
public AAINQVfModule() {
}
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java
index 7b5bcafa7..d455bcf48 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java
@@ -20,10 +20,17 @@
package org.onap.policy.aai;
+import java.io.Serializable;
+
import com.google.gson.annotations.SerializedName;
-public class RelatedToPropertyItem {
+public class RelatedToPropertyItem implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5644372985092588637L;
+
@SerializedName("property-key")
public String propertyKey;
@SerializedName("property-value")
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java
index 8ceb067b1..029a4b823 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java
@@ -20,9 +20,16 @@
package org.onap.policy.aai;
+import java.io.Serializable;
+
import com.google.gson.annotations.SerializedName;
-public class Relationship {
+public class Relationship implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -68508443869003054L;
@SerializedName("related-to")
public String relatedTo;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
index 9b207ef68..a040f0d61 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
@@ -20,12 +20,16 @@
package org.onap.policy.aai;
-import java.util.List;
-import java.util.LinkedList;
+import java.io.Serializable;
import com.google.gson.annotations.SerializedName;
-public class RelationshipDataItem {
+public class RelationshipDataItem implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 550450041634939767L;
@SerializedName("relationship-key")
public String relationshipKey;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
index 14f601730..b31b3a6dc 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
@@ -25,9 +25,13 @@ import java.io.Serializable;
import java.util.List;
import java.util.LinkedList;
-public class RelationshipList {
+public class RelationshipList implements Serializable {
- @SerializedName("relationship-list")
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6115655704973981989L;
+ @SerializedName("relationship-list")
public List<Relationship> relationshipList = new LinkedList<>();
public RelationshipList() {
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
index 3b489155c..e668ca372 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
@@ -20,22 +20,11 @@
package org.onap.policy.aai;
-import static org.junit.Assert.*;
-import java.util.List;
-import java.util.LinkedList;
-import org.onap.policy.aai.RelationshipDataItem;
-import org.onap.policy.aai.RelationshipData;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.Relationship;
-import org.onap.policy.aai.RelatedToProperty;
-import org.onap.policy.aai.RelationshipList;
+import org.junit.Test;
import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.aai.AAIGETVnfResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.junit.Test;
-
public class AAIGETVnfResponseTest {
private static final Logger logger = LoggerFactory.getLogger(AAIGETVnfResponseTest.class);
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
index b24826576..83d2a2682 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
@@ -20,22 +20,11 @@
package org.onap.policy.aai;
-import static org.junit.Assert.*;
-import java.util.List;
-import java.util.LinkedList;
-import org.onap.policy.aai.RelationshipDataItem;
-import org.onap.policy.aai.RelationshipData;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.Relationship;
-import org.onap.policy.aai.RelatedToProperty;
-import org.onap.policy.aai.RelationshipList;
+import org.junit.Test;
import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.aai.AAIGETVserverResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.junit.Test;
-
public class AAIGETVserverResponseTest {
private static final Logger logger = LoggerFactory.getLogger(AAIGETVserverResponseTest.class);
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..f967414c1 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;
@@ -107,6 +107,7 @@ public final class SOManager {
logger.error("Failed to deserialize into SOResponse: ", e);
} catch (InterruptedException e) {
logger.error("Interrupted exception: ", e);
+ Thread.currentThread().interrupt();
}
}
@@ -127,16 +128,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 +159,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/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
index b2535e3af..144b97133 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
@@ -19,7 +19,6 @@
package org.onap.policy.vfc;
import java.io.Serializable;
-import java.time.LocalDateTime;
import com.google.gson.annotations.SerializedName;
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
index a65ad8aac..a4647cb9f 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
@@ -19,7 +19,6 @@
package org.onap.policy.vfc;
import java.io.Serializable;
-import java.time.LocalDateTime;
import com.google.gson.annotations.SerializedName;
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
index f7fc891c0..a19f72bce 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
@@ -19,7 +19,6 @@
package org.onap.policy.vfc;
import java.io.Serializable;
-import java.time.LocalDateTime;
import com.google.gson.annotations.SerializedName;
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
index 6777353a8..a225f2d71 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
@@ -107,6 +107,7 @@ public final class VFCManager implements Runnable {
logger.error("Failed to deserialize into VFCResponse {}",e.getLocalizedMessage(),e);
} catch (InterruptedException e) {
logger.error("Interrupted exception: {}", e.getLocalizedMessage(), e);
+ Thread.currentThread().interrupt();
}
} else {
logger.warn("VFC Heal Restcall failed");
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
index a45a62dfa..9e3a77a2b 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
@@ -19,7 +19,6 @@
package org.onap.policy.vfc;
import java.io.Serializable;
-import java.time.LocalDateTime;
import com.google.gson.annotations.SerializedName;
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
index 2bdb650ba..fd59325d0 100644
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
@@ -18,19 +18,10 @@
package org.onap.policy.vfc;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.onap.policy.vfc.VFCRequest;
-import org.onap.policy.vfc.VFCHealRequest;
-import org.onap.policy.vfc.VFCHealAdditionalParams;
-import org.onap.policy.vfc.VFCHealActionVmInfo;
-import org.onap.policy.vfc.VFCResponse;
-import org.onap.policy.vfc.VFCResponseDescriptor;
+import java.util.LinkedList;
+
import org.junit.Test;
import org.onap.policy.vfc.util.Serialization;
-import java.util.LinkedList;
-import java.util.List;
public class TestDemo {
@@ -75,7 +66,7 @@ public class TestDemo {
responseDescriptor.errorCode = null;
responseDescriptor.responseId = "11";
- response.responseDescriptor.responseHistoryList = new LinkedList();
+ response.responseDescriptor.responseHistoryList = new LinkedList<>();
response.responseDescriptor.responseHistoryList.add(responseDescriptor);
body = Serialization.gsonPretty.toJson(response);
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java
index f0c680784..710ca0165 100644
--- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java
+++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java
@@ -493,7 +493,7 @@ public class ControlLoopCompiler implements Serializable{
private static class PolicyNodeWrapper implements NodeWrapper {
private static final long serialVersionUID = 8170162175653823082L;
- private Policy policy;
+ private transient Policy policy;
public PolicyNodeWrapper(Policy operPolicy) {
this.policy = operPolicy;
diff --git a/controlloop/common/simulators/pom.xml b/controlloop/common/simulators/pom.xml
index 9d3b71c0d..fc0d4c2d3 100644
--- a/controlloop/common/simulators/pom.xml
+++ b/controlloop/common/simulators/pom.xml
@@ -43,16 +43,22 @@
<groupId>org.onap.policy.drools-applications</groupId>
<artifactId>aai</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
</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/AaiSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
index 504eb3da4..a9c35b6ce 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
@@ -20,10 +20,15 @@
package org.onap.policy.simulators;
+import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
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.aai.AAINQRequest;
+import org.onap.policy.aai.util.Serialization;
@Path("/aai")
public class AaiSimulatorJaxRs {
@@ -37,9 +42,39 @@ public class AaiSimulatorJaxRs {
@POST
@Path("/search/named-query")
- public String aaiPostQuery()
+ @Consumes(MediaType.APPLICATION_JSON)
+ public String aaiPostQuery(String req)
+ {
+ AAINQRequest request = Serialization.gsonPretty.fromJson(req, AAINQRequest.class);
+
+ if (request.instanceFilters.instanceFilter.get(0).containsKey("vserver"))
+ {
+ return "{\n\t\"inventory-response-item\": [{\n\t\t\t\"extra-properties\": {},\n\t\t\t\"inventory-response-items\": {\n\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"c15ce9e1-e914-4c8f-b8bb\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"033a32ed-aa65-4764-a736-36f2942f1aa0\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"d4d072dc-4e21-4a03-9524-628985819a8e\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"generic-vnf\": {\n\t\t\t\t\t\t\t\"in-maint\": false,\n\t\t\t\t\t\t\t\"is-closed-loop-disabled\": false,\n\t\t\t\t\t\t\t\"orchestration-status\": \"Created\",\n\t\t\t\t\t\t\t\"model-invariant-id\": \"033a32ed-aa65-4764-a736-36f2942f1aa0\",\n\t\t\t\t\t\t\t\"model-version-id\": \"1.0\",\n\t\t\t\t\t\t\t\"resource-version\": \"1485542422\",\n\t\t\t\t\t\t\t\"service-id\": \"b3f70641-bdb9-4030-825e-6abb73a1f929\",\n\t\t\t\t\t\t\t\"vnf-id\": \"594e2fe0-48b8-41ff-82e2-3d4bab69b192\",\n\t\t\t\t\t\t\t\"vnf-name\": \"Vnf_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\",\n\t\t\t\t\t\t\t\"vnf-type\": \"8330e932-2a23-4943-8606/c15ce9e1-e914-4c8f-b8bb 1\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"inventory-response-items\": {\n\t\t\t\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"8330e932-2a23-4943-8606\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"service\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"5c996219-b2e2-4c76-9b43-7e8672a33c1d\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"service-instance\": {\n\t\t\t\t\t\t\t\t\t\t\"model-invariant-id\": \"4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b\",\n\t\t\t\t\t\t\t\t\t\t\"model-version-id\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485542400\",\n\t\t\t\t\t\t\t\t\t\t\"service-instance-id\": \"cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5\",\n\t\t\t\t\t\t\t\t\t\t\"service-instance-name\": \"Service_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..base_vlb..module-0\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"79ee24cd-fc9a-4f14-afae-5e1dd2ab2941\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"5484cabb-1a0d-4f29-a616-094a3f643d73\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"model-name\": \"C15ce9e1E9144c8fB8bb..base_vlb..module-0\",\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"heat-stack-id\": \"Vfmodule_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8/5845f37b-6cda-4e91-8ca3-f5572d226488\",\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": true,\n\t\t\t\t\t\t\t\t\t\t\"orchestration-status\": \"active\",\n\t\t\t\t\t\t\t\t\t\t\"model-invariant-id\": \"79ee24cd-fc9a-4f14-afae-5e1dd2ab2941\",\n\t\t\t\t\t\t\t\t\t\t\"model-version-id\": \"1\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485542667\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"b0eff878-e2e1-4947-9597-39afdd0f51dd\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"Vfmodule_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..dnsscaling..module-1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"f32568ec-2f1c-458a-864b-0593d53d141a\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"69615025-879d-4f0d-afe3-b7d1a7eeed1f\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": false,\n\t\t\t\t\t\t\t\t\t\t\"model-invariant-id\": \"f32568ec-2f1c-458a-864b-0593d53d141a\",\n\t\t\t\t\t\t\t\t\t\t\"model-version-id\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485561752\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"dummy\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"dummy\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..dnsscaling..module-1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"f32568ec-2f1c-458a-864b-0593d53d141a\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"69615025-879d-4f0d-afe3-b7d1a7eeed1f\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"heat-stack-id\": \"vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8/f447ce51-14dd-4dcd-9957-68a047c79673\",\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": false,\n\t\t\t\t\t\t\t\t\t\t\"orchestration-status\": \"active\",\n\t\t\t\t\t\t\t\t\t\t\"model-invariant-id\": \"f32568ec-2f1c-458a-864b-0593d53d141a\",\n\t\t\t\t\t\t\t\t\t\t\"model-version-id\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485562712\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"8cd79e44-1fae-48c1-a160-609f90b46749\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"extra-properties\": {},\n\t\t\t\t\t\t\"inventory-response-items\": {\n\t\t\t\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\t\t\t\"cloud-region\": {\n\t\t\t\t\t\t\t\t\t\t\"cloud-owner\": \"Rackspace\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-region-id\": \"DFW\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-region-version\": \"v1\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-type\": \"SharedNode\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-zone\": \"CloudZone\",\n\t\t\t\t\t\t\t\t\t\t\"owner-defined-type\": \"OwnerType\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485465545\"\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tenant\": {\n\t\t\t\t\t\t\t\"resource-version\": \"1485465545\",\n\t\t\t\t\t\t\t\"tenant-id\": \"1015548\",\n\t\t\t\t\t\t\t\"tenant-name\": \"1015548\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t\"vserver\": {\n\t\t\t\t\"in-maint\": false,\n\t\t\t\t\"is-closed-loop-disabled\": false,\n\t\t\t\t\"prov-status\": \"ACTIVE\",\n\t\t\t\t\"resource-version\": \"1485546436\",\n\t\t\t\t\"vserver-id\": \"70f081eb-2a87-4c81-9296-4b93d7d145c6\",\n\t\t\t\t\"vserver-name\": \"vlb-lb-32c8\",\n\t\t\t\t\"vserver-name2\": \"vlb-lb-32c8\",\n\t\t\t\t\"vserver-selflink\": \"https://dfw.servers.api.rackspacecloud.com/v2/1015548/servers/70f081eb-2a87-4c81-9296-4b93d7d145c6\"\n\t\t\t}\n\t\t}\n\t]\n}";
+ }
+ else
+ {
+ return "{\"inventory-response-item\": [{\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"de7cc3ab-0212-47df-9e64-da1c79234deb\",\"vnf-name\": \"ZRDM2MMEX39\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1503082370097\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {},\"inventory-response-items\": {\"inventory-response-item\": [{\"model-name\": \"service-instance\",\"service-instance\": {\"service-instance-id\": \"37b8cdb7-94eb-468f-a0c2-4e3c3546578e\",\"service-instance-name\": \"Changed Service Instance NAME\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\",\"resource-version\": \"1503082993532\",\"orchestration-status\": \"Active\"},\"extra-properties\": {},\"inventory-response-items\": {\"inventory-response-item\": [{\"model-name\": \"pnf\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test\",\"vnf-name\": \"jimmy-test-vnf\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504013830207\",\"model-invariant-id\": \"862b25a1-262a-4961-bdaa-cdc55d69785a\",\"model-version-id\": \"e9f1fa7d-c839-418a-9601-03dc0d2ad687\"},\"extra-properties\": {}},{\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test-vnf2\",\"vnf-name\": \"jimmy-test-vnf2-named\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504014833841\",\"model-invariant-id\": \"Eace933104d443b496b8.nodes.heat.vpg\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {}}]}}]}}]}";
+ }
+ }
+
+ @GET
+ @Path("/v11/network/generic-vnfs/generic-vnf?vnf-name={vnfName}")
+ public String getByVnfName (@PathParam("vnfName") String vnfName)
+ {
+ return "{ \"vnf-id\": \"5e49ca06-2972-4532-9ed4-6d071588d792\", \"vnf-name\": \"USUCP0PCOIL0110UJRT01\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": false, \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
+ }
+
+ @GET
+ @Path("/v11/network/generic-vnfs/generic-vnf/{vnfId}")
+ public String getByVnfId (@PathParam("vnfId") String vnfId)
+ {
+ return "{ \"vnf-id\": \"5e49ca06-2972-4532-9ed4-6d071588d792\", \"vnf-name\": \"USUCP0PCOIL0110UJRT01\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": false, \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
+ }
+
+ @GET
+ @Path("/v11/nodes/vservers?vserver-name={vserverName}")
+ public String getByVserverName (@PathParam("vserverName") String vserverName)
{
-// return "{\"inventory-response-item\":[{\"vserver\":{\"vserver-id\": \"vserver-id-Manisha-01\",\"vserver-name\": \"vserver-name-16102016-aai3255-data-11-1\",\"vserver-name2\": \"example-vserver-name2-val-68608\",\"prov-status\": \"example-prov-status-val-59118\",\"vserver-selflink\": \"example-vserver-selflink-val-10902\",\"in-maint\": true,\"is-closed-loop-disabled\": false,\"resource-version\": \"1477946963\"},\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"de7cc3ab-0212-47df-9e64-da1c79234deb\",\"vnf-name\": \"ZRDM2MMEX39\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1503082370097\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {},\"inventory-response-items\":{\"inventory-response-item\":[{\"generic-vnf\":{\"vnf-id\": \"generic-vnf-id-Manisha-01\",\"vnf-name\": \"bpsx0001v-16102016-aai3255-data-11\",\"vnf-name2\": \"example-vnf-name2-val-8204\",\"vnf-type\": \"my-vnf-type\",\"service-id\": \"c7611ebe-c324-48f1-8085-94aef0c6ef3d\",\"regional-resource-zone\": \"example-regional-resource-zone-val-8204\",\"prov-status\": \"ACTIVE\",\"operational-state\": \"example-operational-state-val-3289\",\"license-key\": \"example-license-key-val-3289\",\"equipment-role\": \"example-equipment-role-val-3289\",\"orchestration-status\": \"example-orchestration-status-val-3289\",\"heat-stack-id\": \"example-heat-stack-id-val-3289\",\"mso-catalog-key\": \"example-mso-catalog-key-val-3289\",\"management-option\": \"example-management-option-val-8204\",\"ipv4-oam-address\": \"example-ipv4-oam-address-val-8204\",\"ipv4-loopback0-address\": \"example-ipv4-loopback0-address-val-8204\",\"nm-lan-v6-address\": \"example-nm-lan-v6-address-val-8204\",\"management-v6-address\": \"example-management-v6-address-val-8204\",\"vcpu\": 7957,\"vcpu-units\": \"example-vcpu-units-val-8204\",\"vmemory\": 168,\"vmemory-units\": \"example-vmemory-units-val-8204\",\"vdisk\": 3227,\"vdisk-units\": \"example-vdisk-units-val-8204\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1477946966\"},\"model-name\": \"service-instance\",\"service-instance\": {\"service-instance-id\": \"37b8cdb7-94eb-468f-a0c2-4e3c3546578e\",\"service-instance-name\": \"Changed Service Instance NAME\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\",\"resource-version\": \"1503082993532\",\"orchestration-status\": \"Active\"},\"extra-properties\": {},\"inventory-response-items\":{\"inventory-response-item\":[{\"service-instance\":{\"service-instance-id\": \"service-instance-id-Manisha-01\",\"service-instance-name\": \"example-service-instance-name-val-5008-1\",\"widget-model-id\": \"example-widget-model-id-val-52958\",\"widget-model-version\": \"example-widget-model-version-val-42840\",\"bandwidth-total\": \"example-bandwidth-total-val-99587\",\"bandwidth-up-wan1\": \"example-bandwidth-up-wan1-val-73709\",\"bandwidth-down-wan1\": \"example-bandwidth-down-wan1-val-20007\",\"bandwidth-up-wan2\": \"example-bandwidth-up-wan2-val-16857\",\"bandwidth-down-wan2\": \"example-bandwidth-down-wan2-val-95839\",\"vhn-portal-url\": \"example-vhn-portal-url-val-21541\",\"operational-status\": \"example-operational-status-val-48090\",\"service-instance-location-id\": \"example-service-instance-location-id-val-9684\",\"resource-version\": \"1477946961\"},\"extra-properties\": {}},{\"model-name\": \"pnf\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test\",\"vnf-name\": \"jimmy-test-vnf\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504013830207\",\"model-invariant-id\": \"862b25a1-262a-4961-bdaa-cdc55d69785a\",\"model-version-id\": \"e9f1fa7d-c839-418a-9601-03dc0d2ad687\"},\"extra-properties\": {}},{\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test-vnf2\",\"vnf-name\": \"jimmy-test-vnf2-named\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504014833841\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {}}]}}]}}]}";
- return "{\n\t\"inventory-response-item\": [{\n\t\t\t\"extra-properties\": {},\n\t\t\t\"inventory-response-items\": {\n\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"c15ce9e1-e914-4c8f-b8bb\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"033a32ed-aa65-4764-a736-36f2942f1aa0\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"d4d072dc-4e21-4a03-9524-628985819a8e\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"generic-vnf\": {\n\t\t\t\t\t\t\t\"in-maint\": false,\n\t\t\t\t\t\t\t\"is-closed-loop-disabled\": false,\n\t\t\t\t\t\t\t\"orchestration-status\": \"Created\",\n\t\t\t\t\t\t\t\"model-invariant-id\": \"Eace933104d443b496b8.nodes.heat.vpg\",\n\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\"resource-version\": \"1485542422\",\n\t\t\t\t\t\t\t\"service-id\": \"b3f70641-bdb9-4030-825e-6abb73a1f929\",\n\t\t\t\t\t\t\t\"vnf-id\": \"594e2fe0-48b8-41ff-82e2-3d4bab69b192\",\n\t\t\t\t\t\t\t\"vnf-name\": \"Vnf_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\",\n\t\t\t\t\t\t\t\"vnf-type\": \"8330e932-2a23-4943-8606/c15ce9e1-e914-4c8f-b8bb 1\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"inventory-response-items\": {\n\t\t\t\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"8330e932-2a23-4943-8606\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"service\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"5c996219-b2e2-4c76-9b43-7e8672a33c1d\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"service-instance\": {\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485542400\",\n\t\t\t\t\t\t\t\t\t\t\"service-instance-id\": \"cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5\",\n\t\t\t\t\t\t\t\t\t\t\"service-instance-name\": \"Service_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..base_vlb..module-0\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"79ee24cd-fc9a-4f14-afae-5e1dd2ab2941\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"5484cabb-1a0d-4f29-a616-094a3f643d73\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"model-name\": \"C15ce9e1E9144c8fB8bb..base_vlb..module-0\",\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"heat-stack-id\": \"Vfmodule_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8/5845f37b-6cda-4e91-8ca3-f5572d226488\",\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": true,\n\t\t\t\t\t\t\t\t\t\t\"orchestration-status\": \"active\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"79ee24cd-fc9a-4f14-afae-5e1dd2ab2941\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485542667\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"b0eff878-e2e1-4947-9597-39afdd0f51dd\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"Vfmodule_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..dnsscaling..module-1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"f32568ec-2f1c-458a-864b-0593d53d141a\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"69615025-879d-4f0d-afe3-b7d1a7eeed1f\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": false,\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"f32568ec-2f1c-458a-864b-0593d53d141a\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485561752\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"dummy\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"dummy\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..dnsscaling..module-1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"f32568ec-2f1c-458a-864b-0593d53d141a\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"69615025-879d-4f0d-afe3-b7d1a7eeed1f\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"heat-stack-id\": \"vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8/f447ce51-14dd-4dcd-9957-68a047c79673\",\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": false,\n\t\t\t\t\t\t\t\t\t\t\"orchestration-status\": \"active\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"f32568ec-2f1c-458a-864b-0593d53d141a\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485562712\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"8cd79e44-1fae-48c1-a160-609f90b46749\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"extra-properties\": {},\n\t\t\t\t\t\t\"inventory-response-items\": {\n\t\t\t\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\t\t\t\"cloud-region\": {\n\t\t\t\t\t\t\t\t\t\t\"cloud-owner\": \"Rackspace\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-region-id\": \"DFW\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-region-version\": \"v1\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-type\": \"SharedNode\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-zone\": \"CloudZone\",\n\t\t\t\t\t\t\t\t\t\t\"owner-defined-type\": \"OwnerType\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485465545\"\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tenant\": {\n\t\t\t\t\t\t\t\"resource-version\": \"1485465545\",\n\t\t\t\t\t\t\t\"tenant-id\": \"1015548\",\n\t\t\t\t\t\t\t\"tenant-name\": \"1015548\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t\"vserver\": {\n\t\t\t\t\"in-maint\": false,\n\t\t\t\t\"is-closed-loop-disabled\": false,\n\t\t\t\t\"prov-status\": \"ACTIVE\",\n\t\t\t\t\"resource-version\": \"1485546436\",\n\t\t\t\t\"vserver-id\": \"70f081eb-2a87-4c81-9296-4b93d7d145c6\",\n\t\t\t\t\"vserver-name\": \"vlb-lb-32c8\",\n\t\t\t\t\"vserver-name2\": \"vlb-lb-32c8\",\n\t\t\t\t\"vserver-selflink\": \"https://dfw.servers.api.rackspacecloud.com/v2/1015548/servers/70f081eb-2a87-4c81-9296-4b93d7d145c6\"\n\t\t\t}\n\t\t}\n\t]\n}";
+ return "{\"vserver\": [{ \"vserver-id\": \"d0668d4f-c25e-4a1b-87c4-83845c01efd8\", \"vserver-name\": \"USMSO1SX7NJ0103UJZZ01-vjunos0\", \"vserver-name2\": \"vjunos0\", \"vserver-selflink\": \"https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8\", \"in-maint\": false, \"is-closed-loop-disabled\": false, \"resource-version\": \"1494001931513\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"generic-vnf\", \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/e1a41e99-4ede-409a-8f9d-b5e12984203a\", \"relationship-data\": [ {\"relationship-key\": \"generic-vnf.vnf-id\",\"relationship-value\": \"e1a41e99-4ede-409a-8f9d-b5e12984203a\" }], \"related-to-property\": [ {\"property-key\": \"generic-vnf.vnf-name\",\"property-value\": \"USMSO1SX7NJ0103UJSW01\" }]},{ \"related-to\": \"pserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/pservers/pserver/USMSO1SX7NJ0103UJZZ01\", \"relationship-data\": [ {\"relationship-key\": \"pserver.hostname\",\"relationship-value\": \"USMSO1SX7NJ0103UJZZ01\" }], \"related-to-property\": [{\"property-key\": \"pserver.pserver-name2\"}]} ]}}]}";
}
}
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..9fbb2b50f 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
@@ -20,30 +20,39 @@
package org.onap.policy.simulators;
+import java.io.IOException;
+
import org.onap.policy.drools.http.server.HttpServletServer;
+import org.onap.policy.drools.utils.NetworkUtil;
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 {
- public static HttpServletServer buildAaiSim() throws InterruptedException {
+ public static HttpServletServer buildAaiSim() throws InterruptedException, IOException {
HttpServletServer testServer = HttpServletServer.factory.build("testServer", "localhost", 6666, "/", false, true);
testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName());
testServer.waitedStart(5000);
+ if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
+ throw new IllegalStateException("cannot connect to port " + testServer.getPort());
return testServer;
}
- public static HttpServletServer buildMsoSim() throws InterruptedException {
+ public static HttpServletServer buildSoSim() throws InterruptedException, IOException {
HttpServletServer testServer = HttpServletServer.factory.build("testServer", "localhost", 6667, "/", false, true);
- testServer.addServletClass("/*", MsoSimulatorJaxRs.class.getName());
+ testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName());
testServer.waitedStart(5000);
+ if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
+ throw new IllegalStateException("cannot connect to port " + testServer.getPort());
return testServer;
}
- public static HttpServletServer buildVfcSim() throws InterruptedException {
+ public static HttpServletServer buildVfcSim() throws InterruptedException, IOException {
HttpServletServer testServer = HttpServletServer.factory.build("testServer", "localhost", 6668, "/", false, true);
testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName());
testServer.waitedStart(5000);
+ if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
+ throw new IllegalStateException("cannot connect to port " + testServer.getPort());
return testServer;
}
}
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
index 1b12b2527..dc53e267a 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
@@ -23,15 +23,23 @@ package org.onap.policy.simulators;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.aai.AAIGETResponse;
-import org.onap.policy.aai.AAINQF199.AAINQF199Manager;
-import org.onap.policy.aai.AAINQF199.AAINQF199Request;
-import org.onap.policy.aai.AAINQF199.AAINQF199Response;
+import org.onap.policy.aai.AAIGETVnfResponse;
+import org.onap.policy.aai.AAINQInstanceFilters;
+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.drools.http.server.HttpServletServer;
public class AaiSimulatorTest {
@@ -40,7 +48,7 @@ public class AaiSimulatorTest {
public static void setUpSimulator() {
try {
Util.buildAaiSim();
- } catch (InterruptedException e) {
+ } catch (Exception e) {
fail(e.getMessage());
}
}
@@ -52,14 +60,47 @@ public class AaiSimulatorTest {
@Test
public void testGet() {
- AAIGETResponse response = AAINQF199Manager.getQuery("http://localhost:6666", "testUser", "testPass", UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792");
+ AAIGETVnfResponse response = AAIManager.getQueryByVnfID("http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass", UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792");
assertNotNull(response);
assertNotNull(response.relationshipList);
}
@Test
public void testPost() {
- AAINQF199Response response = AAINQF199Manager.postQuery("http://localhost:6666", "testUser", "testPass", new AAINQF199Request(), UUID.randomUUID());
+ AAINQRequest request = new AAINQRequest();
+ AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters();
+ AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery();
+ tempNamedQuery.namedQueryUUID = UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469");
+ tempQueryParameters.namedQuery = tempNamedQuery;
+ request.queryParameters = tempQueryParameters;
+ Map<String, String> tempInnerMap = new HashMap<>();
+ tempInnerMap.put("vserver-name", "vserver-name-16102016-aai3255-data-11-1");
+ Map<String, Map<String, String>> tempOuterMap = new HashMap<>();
+ tempOuterMap.put("vserver", tempInnerMap);
+ List<Map<String, Map<String, String>>> tempInstanceFilter = new LinkedList<>();
+ tempInstanceFilter.add(tempOuterMap);
+ AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters();
+ tempInstanceFilters.instanceFilter = tempInstanceFilter;
+ request.instanceFilters = tempInstanceFilters;
+
+ AAINQResponse response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID());
+ assertNotNull(response);
+ assertNotNull(response.inventoryResponseItems);
+
+ tempNamedQuery.namedQueryUUID = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087");
+ tempQueryParameters.namedQuery = tempNamedQuery;
+ request.queryParameters = tempQueryParameters;
+ tempInnerMap = new HashMap<>();
+ tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb");
+ tempOuterMap = new HashMap<>();
+ tempOuterMap.put("generic-vnf", tempInnerMap);
+ tempInstanceFilter = new LinkedList<>();
+ tempInstanceFilter.add(tempOuterMap);
+ tempInstanceFilters = new AAINQInstanceFilters();
+ tempInstanceFilters.instanceFilter = tempInstanceFilter;
+ request.instanceFilters = tempInstanceFilters;
+
+ response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID());
assertNotNull(response);
assertNotNull(response.inventoryResponseItems);
}
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..2cf6b8e0c
--- /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 (Exception 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/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
index db110383c..0fb41ab9b 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
@@ -20,19 +20,19 @@
package org.onap.policy.simulators;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
import java.util.HashMap;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.policy.drools.http.server.HttpServletServer;
-import org.onap.policy.vfc.VFCResponse;
-import org.onap.policy.vfc.util.Serialization;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
+import org.onap.policy.vfc.VFCResponse;
+import org.onap.policy.vfc.util.Serialization;
public class VfcSimulatorTest {
@@ -40,7 +40,7 @@ public class VfcSimulatorTest {
public static void setUpSimulator() {
try {
Util.buildVfcSim();
- } catch (InterruptedException e) {
+ } catch (Exception e) {
fail(e.getMessage());
}
}
diff --git a/controlloop/packages/basex/src/files/config/controlloop.properties.environment b/controlloop/packages/basex/src/files/config/controlloop.properties.environment
new file mode 100644
index 000000000..34684ae01
--- /dev/null
+++ b/controlloop/packages/basex/src/files/config/controlloop.properties.environment
@@ -0,0 +1,35 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP APPS Base Package
+# ================================================================================
+# 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=========================================================
+###
+
+# Environment file (.environment) for control loop applications in this
+# directory, it will be automatically loaded by PDP-D, after being expanded
+# by installation scripts.
+
+aai.url=${{AAI_URL}}
+aai.username=${{AAI_USERNAME}}
+aai.password=${{AAI_PASSWORD}}
+
+so.url=${{SO_URL}}
+so.username=${{SO_USERNAME}}
+so.password=${{SO_PASSWORD}}
+
+vfc.url=${{VFC_URL}}
+vfc.username=${{VFC_USERNAME}}
+vfc.password=${{VFC_PASSWORD}} \ No newline at end of file
diff --git a/controlloop/templates/archetype-cl-amsterdam/pom.xml b/controlloop/templates/archetype-cl-amsterdam/pom.xml
new file mode 100644
index 000000000..2f810e299
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP
+ ================================================================================
+ 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=========================================================
+ -->
+
+<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</groupId>
+ <artifactId>templates</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>archetype-cl-amsterdam</artifactId>
+ <packaging>maven-archetype</packaging>
+
+ <name>archetype-cl-amsterdam</name>
+ <description>Archetype to generate a yaml based control loop for ONAP Amsterdam release</description>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>3.0.1</version>
+ </extension>
+ </extensions>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>3.0.1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/META-INF/maven/archetype-metadata.xml b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 000000000..dfe7e72cf
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ archetype-closed-loop-demo-rules
+ ================================================================================
+ 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=========================================================
+ -->
+
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
+ name="closed-loop-rules"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <requiredProperties>
+ <requiredProperty key="closedLoopControlName">
+ <defaultValue>ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="controlLoopYaml">
+ <defaultValue>controlLoop%3A%0A++version%3A+2.0.0%0A++controlLoopName%3A+ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0A++trigger_policy%3A+unique-policy-id-1-restart%0A++timeout%3A+3600%0A+%0Apolicies%3A%0A+%0A++-+id%3A+unique-policy-id-1-restart%0A++++name%3A+Restart+the+VM%0A++++description%3A%0A++++actor%3A+APPC%0A++++recipe%3A+Restart%0A++++target%3A%0A++++++type%3A+VM%0A++++retry%3A+3%0A++++timeout%3A+1200%0A++++success%3A+final_success%0A++++failure%3A+final_failure%0A++++failure_timeout%3A+final_failure_timeout%0A++++failure_retries%3A+final_failure_retries%0A++++failure_exception%3A+final_failure_exception%0A++++failure_guard%3A</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="policyName">
+ <defaultValue>DCAE.Config_tca-hi-lo</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="policyScope">
+ <defaultValue>DCAE</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="policyVersion">
+ <defaultValue>1.1.0</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="dmaapServers">
+ <defaultValue>vm1.mr.simpledemo.openecomp.org</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="dcaeTopic">
+ <defaultValue>unauthenticated.TCA_EVENT_OUTPUT</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="dcaeServers">
+ <defaultValue>10.0.4.102</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="dependenciesVersion">
+ <defaultValue>1.1.0</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
+
+ <fileSets>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.drl</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>src/main/config</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.json</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</archetype-descriptor>
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/pom.xml b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 000000000..e0a967f3d
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP
+ ================================================================================
+ 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=========================================================
+ -->
+
+<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>
+
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+ <packaging>kjar</packaging>
+
+ <name>${artifactId}</name>
+ <description>Control Loop Amsterdam Release Rules</description>
+
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-maven-plugin</artifactId>
+ <version>6.5.0.Final</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>events</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>appc</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>appclcm</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>vfc</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>so</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>aai</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>sdc</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>trafficgenerator</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>eventmanager</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>guard</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>actorServiceProvider</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>actor.appc</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>actor.appclcm</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>actor.so</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>actor.vfc</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>policy-yaml</artifactId>
+ <version>${dependenciesVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>policy-management</artifactId>
+ <version>${dependenciesVersion}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
new file mode 100644
index 000000000..ddc70d784
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
@@ -0,0 +1,55 @@
+###
+# ============LICENSE_START=======================================================
+# archetype-closed-loop-demo-rules
+# ================================================================================
+# 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=========================================================
+###
+
+controller.name=${artifactId}
+
+ueb.source.topics=${dcaeTopic},APPC-CL
+
+ueb.source.topics.${dcaeTopic}.servers=${dcaeServers}
+ueb.source.topics.${dcaeTopic}.apiKey=
+ueb.source.topics.${dcaeTopic}.apiSecret=
+ueb.source.topics.${dcaeTopic}.events=org.onap.policy.controlloop.VirtualControlLoopEvent
+ueb.source.topics.${dcaeTopic}.events.org.onap.policy.controlloop.VirtualControlLoopEvent.filter=closedLoopEventStatus=.*
+ueb.source.topics.${dcaeTopic}.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
+
+ueb.source.topics.APPC-CL.servers=${dmaapServers}
+ueb.source.topics.APPC-CL.apiKey=
+ueb.source.topics.APPC-CL.apiSecret=
+ueb.source.topics.APPC-CL.events=org.onap.policy.appclcm.LCMResponseWrapper
+ueb.source.topics.APPC-CL.events.org.onap.policy.appclcm.LCMResponseWrapper.filter=body\=.*
+ueb.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
+
+ueb.sink.topics=APPC-CL,POLICY-CL-MGT
+
+ueb.sink.topics.APPC-CL.servers=${dmaapServers}
+ueb.sink.topics.APPC-CL.apiKey=
+ueb.sink.topics.APPC-CL.apiSecret=
+ueb.sink.topics.APPC-CL.events=org.onap.policy.appclcm.LCMRequestWrapper
+ueb.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
+
+ueb.sink.topics.POLICY-CL-MGT.servers=${dmaapServers}
+ueb.sink.topics.POLICY-CL-MGT.apiKey=
+ueb.sink.topics.POLICY-CL-MGT.apiSecret=
+ueb.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
+ueb.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
+
+rules.groupId=${groupId}
+rules.artifactId=${artifactId}
+rules.version=${version}
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
new file mode 100644
index 000000000..68d565dcd
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
@@ -0,0 +1,29 @@
+{
+ "controller.name": "${artifactId}",
+
+ "ueb.source.topics": "${dcaeTopic},APPC-CL",
+
+ "ueb.source.topics.${dcaeTopic}.servers": "${dcaeServers}",
+ "ueb.source.topics.${dcaeTopic}.events": "org.onap.policy.controlloop.VirtualControlLoopEvent",
+ "ueb.source.topics.${dcaeTopic}.events.org.onap.policy.controlloop.VirtualControlLoopEvent.filter": "closedLoopEventStatus=.*",
+ "ueb.source.topics.${dcaeTopic}.events.custom.gson": "org.onap.policy.controlloop.util.Serialization,gson",
+
+ "ueb.source.topics.APPC-CL.servers": "${dmaapServers}",
+ "ueb.source.topics.APPC-CL.events": "org.onap.policy.appclcm.LCMResponseWrapper",
+ "ueb.source.topics.APPC-CL.events.org.onap.policy.appclcm.LCMResponseWrapper.filter": "common-header=.*,status=.*",
+ "ueb.source.topics.APPC-CL.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
+
+ "ueb.sink.topics": "APPC-CL,POLICY-CL-MGT",
+
+ "ueb.sink.topics.APPC-CL.servers": "${dmaapServers}",
+ "ueb.sink.topics.APPC-CL.events": "org.onap.policy.appclcm.LCMRequestWrapper",
+ "ueb.sink.topics.APPC-CL.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
+
+ "ueb.sink.topics.POLICY-CL-MGT.servers": "${dmaapServers}",
+ "ueb.sink.topics.POLICY-CL-MGT.events": "org.onap.policy.controlloop.VirtualControlLoopNotification",
+ "ueb.sink.topics.POLICY-CL-MGT.events.custom.gson": "org.onap.policy.controlloop.util.Serialization,gson",
+
+ "rules.groupId": "${groupId}",
+ "rules.artifactId": "${artifactId}",
+ "rules.version": "${version}"
+}
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json
new file mode 100644
index 000000000..edb1e27e5
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json
@@ -0,0 +1,15 @@
+{
+ "closedLoopControlName": "${closedLoopControlName}",
+ "closedLoopAlarmStart": 1463679805324,
+ "closedLoopEventClient": "microservice.stringmatcher",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
+ "target_type": "VNF",
+ "target": "generic-vnf.vnf-id",
+ "AAI": {
+ "vserver.is-closed-loop-disabled": "false",
+ "generic-vnf.vnf-id": "fw0001vm001fw001"
+ },
+ "from": "DCAE",
+ "version": "1.0.2"
+}
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vCPE.yaml b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vCPE.yaml
new file mode 100644
index 000000000..abe02c6a9
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vCPE.yaml
@@ -0,0 +1,23 @@
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ${closedLoopControlName}
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 3600
+ abatement: true
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart the VM
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ retry: 3
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
new file mode 100644
index 000000000..9ec524b0e
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
@@ -0,0 +1,29 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ archetype-closed-loop-demo-rules
+ ================================================================================
+ 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=========================================================
+ -->
+
+<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
+ <kbase name="rules">
+ <ksession name="amsterdam"/>
+ </kbase>
+</kmodule>
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
new file mode 100644
index 000000000..3e4f76c2f
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
@@ -0,0 +1,1134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * 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.controlloop;
+
+import org.onap.policy.controlloop.VirtualControlLoopEvent;
+import org.onap.policy.controlloop.VirtualControlLoopNotification;
+import org.onap.policy.controlloop.ControlLoopEventStatus;
+import org.onap.policy.controlloop.ControlLoopNotificationType;
+import org.onap.policy.controlloop.ControlLoopLogger;
+import org.onap.policy.controlloop.policy.PolicyResult;
+import org.onap.policy.controlloop.policy.ControlLoopPolicy;
+import org.onap.policy.controlloop.policy.Policy;
+import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager;
+import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NEW_EVENT_STATUS;
+import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager;
+import org.onap.policy.controlloop.actor.so.SOActorServiceProvider;
+import org.onap.policy.appc.Request;
+import org.onap.policy.appc.Response;
+import org.onap.policy.appc.CommonHeader;
+import org.onap.policy.appclcm.LCMRequestWrapper;
+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.vfc.VFCRequest;
+import org.onap.policy.vfc.VFCManager;
+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.guard.PolicyGuard;
+import org.onap.policy.guard.PolicyGuard.LockResult;
+import org.onap.policy.guard.TargetLock;
+import org.onap.policy.guard.GuardResult;
+import org.onap.policy.guard.PolicyGuardRequest;
+import org.onap.policy.guard.PolicyGuardResponse;
+import org.onap.policy.guard.PolicyGuardXacmlRequestAttributes;
+import org.onap.policy.guard.PolicyGuardXacmlHelper;
+
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+import java.time.Instant;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+import org.onap.policy.drools.system.PolicyEngine;
+
+declare Params
+ closedLoopControlName : String
+ controlLoopYaml : String
+end
+
+
+declare OperationTimer
+ closedLoopControlName : String
+ requestID : String
+ delay : String
+end
+
+declare ControlLoopTimer
+ closedLoopControlName : String
+ requestID : String
+ delay : String
+end
+
+/*
+*
+* Called once and only once to insert the parameters into working memory for this Closed Loop policy.
+*
+*/
+rule "${policyName}.SETUP"
+ when
+ then
+
+ Params params = new Params();
+ params.setClosedLoopControlName("${closedLoopControlName}");
+ params.setControlLoopYaml("${controlLoopYaml}");
+ insert(params);
+
+
+ // Note: globals have bad behavior when persistence is used,
+ // hence explicitly getting the logger vs using a global
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {} : YAML=[{}]", params.getClosedLoopControlName(), drools.getRule().getName(), params.getControlLoopYaml());
+end
+
+/*
+*
+* This rule responds to DCAE Events where there is no manager yet. Either it is
+* the first ONSET, or a subsequent badly formed Event (i.e. Syntax error, or is-closed-loop-disabled)
+*
+*/
+rule "${policyName}.EVENT"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
+ not ( ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID ) )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+
+ try {
+
+ //
+ // Check the event, because we need it to not be null when
+ // we create the ControlLoopEventManager. The ControlLoopEventManager
+ // will do extra syntax checking as well check if the closed loop is disabled.
+ //
+ if ($event.requestID == null) {
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.notification = ControlLoopNotificationType.REJECTED;
+ notification.from = "policy";
+ notification.message = "Missing requestID";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+
+ //
+ // Let interested parties know
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+
+ //
+ // Retract it from memory
+ //
+ retract($event);
+ } else {
+ //
+ // Create an EventManager
+ //
+ ControlLoopEventManager manager = new ControlLoopEventManager($params.getClosedLoopControlName(), $event.requestID);
+ //
+ // Determine if EventManager can actively process the event (i.e. syntax, is_closed_loop_disabled checks etc.)
+ //
+ VirtualControlLoopNotification notification = manager.activate($params.getControlLoopYaml(), $event);
+ notification.from = "pdp-0001-controller=controlloop"; // Engine.getInstanceName()
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ //
+ // Are we actively pursuing this event?
+ //
+ if (notification.notification == ControlLoopNotificationType.ACTIVE) {
+ //
+ // Insert Event Manager into memory, this will now kick off processing.
+ //
+ insert(manager);
+ //
+ // Let interested parties know
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ //
+ // Setup the Overall Control Loop timer
+ //
+ ControlLoopTimer clTimer = new ControlLoopTimer();
+ clTimer.setClosedLoopControlName($event.closedLoopControlName);
+ clTimer.setRequestID($event.requestID.toString());
+ clTimer.setDelay(manager.getControlLoopTimeout(1500) + "s");
+ //
+ // Insert it
+ //
+ insert(clTimer);
+ } else {
+ //
+ // Let interested parties know
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ //
+ // Retract it from memory
+ //
+ retract($event);
+ }
+
+ //
+ // Now that the manager is inserted into Drools working memory, we'll wait for
+ // another rule to fire in order to continue processing. This way we can also
+ // then screen for additional ONSET and ABATED events for this RequestID.
+ //
+ }
+ } catch (Exception e) {
+ logger.warn("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName(), e);
+
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.notification = ControlLoopNotificationType.REJECTED;
+ notification.message = "Exception occurred " + e.getMessage();
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ //
+ //
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ //
+ // Retract the event
+ //
+ retract($event);
+ }
+end
+
+/*
+*
+* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager
+* is now created. We can start processing the yaml specification via the Event Manager.
+*
+*/
+rule "${policyName}.EVENT.MANAGER"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $clTimer : ControlLoopTimer ( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}: event={} manager={} clTimer={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $clTimer);
+ //
+ // Check which event this is.
+ //
+ ControlLoopEventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);
+
+ //
+ // Check what kind of event this is
+ //
+ if (eventStatus == NEW_EVENT_STATUS.SUBSEQUENT_ONSET) {
+ //
+ // We don't care about subsequent onsets
+ //
+ logger.info("{}: {}: subsequent onset",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+ retract($event);
+ return;
+ }
+ if (eventStatus == NEW_EVENT_STATUS.SYNTAX_ERROR) {
+ //
+ // Ignore any bad syntax events
+ //
+ logger.warn("{}: {}: syntax error",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+ retract($event);
+ return;
+ }
+ //
+ // We only want the initial ONSET event in memory,
+ // all the other events need to be retracted to support
+ // cleanup and avoid the other rules being fired for this event.
+ //
+ if (eventStatus != NEW_EVENT_STATUS.FIRST_ONSET) {
+ logger.warn("{}: {}: no first onset",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+ retract($event);
+ }
+
+ logger.debug("{}: {}: target={}", $params.getClosedLoopControlName(),
+ drools.getRule().getName(), $event.target);
+ //
+ // Now start seeing if we need to process this event
+ //
+ try {
+ //
+ // Check if this is a Final Event
+ //
+ VirtualControlLoopNotification notification = $manager.isControlLoopFinal();
+
+
+ if (notification != null) {
+ //
+ // Its final, but are we waiting for abatement?
+ //
+ if ($manager.getNumAbatements() > 0) {
+ logger.info("{}: {}: abatement received for {}. Closing the control loop",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event.requestID);
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ //
+ // In this case, we are done
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ //
+ // Unlock the target
+ //
+ TargetLock lock = $manager.unlockCurrentOperation();
+ if (lock != null) {
+ logger.debug("{}: {}: retracting lock=", $params.getClosedLoopControlName(),
+ drools.getRule().getName(), lock);
+ retract(lock);
+ }
+ //
+ // Retract everything from memory
+ //
+ logger.info("{}: {}: retracting onset, manager, and timer",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+
+ retract($manager.getOnsetEvent());
+ retract($manager);
+ retract($clTimer);
+ //
+ // TODO - what if we get subsequent Events for this RequestID?
+ // By default, it will all start over again. May be confusing for Ruby.
+ // Or, we could track this and then subsequently ignore the events
+ //
+ } else {
+ //
+ // Check whether we need to wait for abatement
+ //
+ if ($manager.getProcessor().getControlLoop().getAbatement() == true && notification.notification == ControlLoopNotificationType.FINAL_SUCCESS) {
+ logger.info("{}: {}: waiting for abatement ..",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+ } else {
+ logger.info("{}: {}: no abatement expect for {}. Closing the control loop",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event.requestID);
+
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+
+ //
+ // In this case, we are done
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ //
+ // Unlock the target
+ //
+ TargetLock lock = $manager.unlockCurrentOperation();
+ if (lock != null) {
+ logger.debug("{}: {}: retracting lock=", $params.getClosedLoopControlName(),
+ drools.getRule().getName(), lock);
+ retract(lock);
+ }
+ //
+ // Retract everything from memory
+ //
+ logger.info("{}: {}: retracting onset, manager, and timer",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+
+ retract($manager.getOnsetEvent());
+ retract($manager);
+ retract($clTimer);
+ }
+ }
+ } else {
+ //
+ // NOT final, so let's ask for the next operation
+ //
+ ControlLoopOperationManager operation = $manager.processControlLoop();
+ if (operation != null) {
+ logger.info("{}: {}: starting operation={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ operation);
+ //
+ // insert into memory
+ //
+ insert(operation);
+ //
+ // insert operation timeout object
+ //
+ OperationTimer opTimer = new OperationTimer();
+ opTimer.setClosedLoopControlName($event.closedLoopControlName);
+ opTimer.setRequestID($event.requestID.toString());
+ opTimer.setDelay(operation.getOperationTimeout().toString() + "s");
+ insert(opTimer);
+
+ //
+ // Let's ask for a lock right away
+ //
+ LockResult<GuardResult, TargetLock> result = $manager.lockCurrentOperation();
+ if (result.getA().equals(GuardResult.LOCK_ACQUIRED)) {
+ logger.info("{}: {}: guard lock acquired={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ result.getB());
+
+ //
+ // Insert into memory
+ //
+ insert(result.getB());
+ }
+ } else {
+ //
+ // Probably waiting for abatement
+ //
+ logger.info("{}: {}: no operation, probably waiting for abatement",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+ }
+ }
+ } catch (Exception e) {
+ logger.warn("{}: {}: unexpected",
+ $params.getClosedLoopControlName(),
+ drools.getRule().getName(), e);
+
+ //
+ // TODO should we abort if we get an exception?
+ //
+ }
+
+end
+
+
+
+/*
+*
+*
+*
+*/
+rule "${policyName}.EVENT.MANAGER.OPERATION.NOT_LOCKED.TIMEOUT"
+ timer (int: 5s 5s)
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
+ not ( TargetLock (requestID == $event.requestID) )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}: event={} manager={} operation={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $operation);
+
+ //
+ // Need to ask for a Lock
+ //
+ LockResult<GuardResult, TargetLock> result = $manager.lockCurrentOperation();
+ if (result.getA().equals(GuardResult.LOCK_ACQUIRED)) {
+ logger.info("{}: {}: guard lock acquired={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ result.getB());
+
+ //
+ // Insert into memory
+ //
+ insert(result.getB());
+ }
+
+end
+
+/*
+*
+* Guard Permitted, let's send request to the actor.
+*
+*/
+rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID, getGuardApprovalStatus() == "Permit" )
+ $lock : TargetLock (requestID == $event.requestID)
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}: event={} manager={} operation={} lock={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $operation, $lock);
+
+ Object request = $operation.getOperationRequest();
+
+ if (request != null) {
+ logger.debug("{}: {}: starting operation ..",
+ $params.getClosedLoopControlName(), drools.getRule().getName());
+ //
+ // Tell interested parties we are performing this Operation
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.notification = ControlLoopNotificationType.OPERATION;
+ notification.message = $operation.getOperationMessage();
+ notification.history = $operation.getHistory();
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+
+ switch ($operation.policy.getActor()){
+
+ case "APPC":
+
+ if (request instanceof Request || request instanceof LCMRequestWrapper) {
+ PolicyEngine.manager.deliver("APPC-CL", request);
+ }
+ break;
+ case "SO":
+ // at this point the AAI named query request should have already been made, the response recieved and used
+ // in the construction of the SO Request which is stored in operationRequest
+
+ if(request instanceof SORequest) {
+ // Call SO. The response will be inserted into memory once it's received
+ SOActorServiceProvider.sendRequest(drools.getWorkingMemory(), request);
+ }
+ break;
+ case "VFC":
+ if (request instanceof VFCRequest) {
+ // Start VFC thread
+ VFCManager vfcManager = new VFCManager((VFCRequest) request);
+ vfcManager.setVFCParams(
+ PolicyEngine.manager.getEnvironmentProperty("vfc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.user"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.password"));
+
+ Thread t = new Thread(vfcManager);
+ t.start();
+ }
+ break;
+ }
+ } else {
+ //
+ // What happens if its null?
+ //
+ logger.warn("{}: {}: unexpected null operation request",
+ $params.getClosedLoopControlName(),
+ drools.getRule().getName());
+ }
+end
+
+
+/*
+*
+* We were able to acquire a lock so now let's ask Xacml Guard whether
+* we are allowed to proceed with the request to the actor.
+*
+*/
+rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID, getGuardApprovalStatus() == "NONE" )
+ $lock : TargetLock (requestID == $event.requestID)
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}: event={} manager={} operation={} lock={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $operation, $lock);
+
+ //
+ // We are starting the operation but the actor won't be contacted until Guard is queried and permitted.
+ //
+ $operation.startOperation($event);
+
+ //
+ // Sending notification that we are about to query Guard ("DB write - start operation")
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.notification = ControlLoopNotificationType.OPERATION;
+ notification.message = $operation.getOperationMessage();
+ notification.history = $operation.getHistory();
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+
+ //
+ // Now send Guard Request to XACML Guard. In order to bypass the call to Guard,
+ // just change guardEnabled to false.
+ //
+ // In order to use REST XACML, provide a URL instead of "" as a second argument
+ // to the CallGuardTask() and set the first argument to null
+ // (instead of XacmlPdpEngine).
+ //
+ boolean guardEnabled = false;
+
+ if(guardEnabled){
+
+ Thread t = new Thread(new org.onap.policy.guard.CallGuardTask(
+ null,
+ PolicyEngine.manager.getEnvironmentProperty("guard.url"),
+ drools.getWorkingMemory(),
+ $event.closedLoopControlName,
+ $operation.policy.getActor().toString(),
+ $operation.policy.getRecipe(),
+ $manager.getTargetInstance($operation.policy),
+ //$event.target,
+ $event.requestID.toString()
+ ));
+ t.start();
+ }
+ else{
+ insert(new PolicyGuardResponse("Permit", $event.requestID, $operation.policy.getRecipe()));
+ }
+
+end
+
+//
+// This rule will be triggered when a thread talking to the XACML Guard inserts a
+// guardResponse object into the working memory
+//
+rule "${policyName}.GUARD.RESPONSE"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
+ $lock : TargetLock (requestID == $event.requestID)
+ $opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
+ $guardResponse : PolicyGuardResponse(requestID == $event.requestID, $operation.policy.recipe == operation)
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}: event={} manager={} operation={} lock={} opTimer={} guardResponse={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $operation, $lock, $opTimer, $guardResponse);
+
+
+ //we will permit the operation if there was no Guard for it
+ if($guardResponse.result == "Indeterminate"){
+ $guardResponse.result = "Permit";
+ }
+
+ //
+ // This notification has Guard result in "message". ("DB write - end operation in case of Guard Deny")
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.notification = ControlLoopNotificationType.OPERATION;
+ notification.message = $operation.getOperationMessage($guardResponse.result);
+ notification.history = $operation.getHistory();
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+
+ if($guardResponse.result == "Permit"){
+
+ modify($operation){setGuardApprovalStatus($guardResponse.result)};
+ }
+ else {
+ //This is the Deny case
+ $operation.setOperationHasGuardDeny();
+ retract($opTimer);
+ retract($operation);
+ modify($manager) {finishOperation($operation)};
+ }
+
+ retract($guardResponse);
+
+end
+
+/*
+*
+* This rule responds to APPC Response Events
+*
+* I would have like to be consistent and write the Response like this:
+* $response : Response( CommonHeader.RequestID == $onset.requestID )
+*
+* However, no compile error was given. But a runtime error was given. I think
+* because drools is confused between the classname CommonHeader vs the property CommonHeader.
+*
+*/
+rule "${policyName}.APPC.RESPONSE"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
+ $opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
+ $lock : TargetLock (requestID == $event.requestID)
+ $response : Response( getCommonHeader().RequestID == $event.requestID )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+ logger.debug("{}: {}: event={} manager={} operation={} lock={} opTimer={} response={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $operation, $lock, $opTimer, $response);
+ //
+ // Get the result of the operation
+ //
+ PolicyResult policyResult = $operation.onResponse($response);
+ if (policyResult != null) {
+ logger.debug("{}: {}: operation finished - result={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ policyResult);
+ //
+ // This Operation has completed, construct a notification showing our results. (DB write - end operation)
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ notification.message = $operation.getOperationHistory();
+ notification.history = $operation.getHistory();
+ if (policyResult.equals(PolicyResult.SUCCESS)) {
+ notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
+ //
+ // Let interested parties know
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ } else {
+ notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
+ //
+ // Let interested parties know
+ //
+ 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
+
+/*
+*
+* The problem with Responses is that they don't have a controlLoopControlName
+* field in them, so the only way to attach them is via RequestID. If we have multiple
+* control loop .drl's loaded in the same container, we need to be sure the cleanup
+* rules don't remove Responses for other control loops.
+*
+*/
+rule "${policyName}.APPC.RESPONSE.CLEANUP"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $response : Response($id : getCommonHeader().RequestID )
+ not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+ logger.debug("{}: {}: orphan appc response={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(), $id);
+
+ //
+ // Retract it
+ //
+ retract($response);
+end
+
+/*
+*
+* This rule responds to APPC Response Events using the new LCM interface provided by appc
+*
+*/
+rule "${policyName}.APPC.LCM.RESPONSE"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
+ $opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
+ $lock : TargetLock (requestID == $event.requestID)
+ $response : LCMResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.requestID )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+ logger.debug("{}: {}: event={} manager={} operation={} lock={} opTimer={} response={}",
+ $params.getClosedLoopControlName(), 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={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ policyResult);
+
+ //
+ // This Operation has completed, construct a notification showing our results. (DB write - end operation)
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ notification.message = $operation.getOperationHistory();
+ notification.history = $operation.getHistory();
+ if (policyResult.equals(PolicyResult.SUCCESS)) {
+ notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
+ } else {
+ notification.notification = 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 LCM reponses
+*
+*/
+rule "${policyName}.APPC.LCM.RESPONSE.CLEANUP"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $response : LCMResponseWrapper($id : getBody().getCommonHeader().getRequestId )
+ not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+ logger.debug("{}: {}: orphan appc response={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(), $id);
+ //
+ // Retract it
+ //
+ retract($response);
+end
+
+/*
+*
+* This rule responds to SO Response Events
+*
+*/
+rule "${policyName}.SO.RESPONSE"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName )
+ $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
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+ logger.debug("{}: {}: event={} manager={} operation={} lock={} opTimer={} request={} response={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $operation, $lock, $operation, $opTimer, $request, $response);
+
+ // Get the result of the operation
+ //
+ PolicyResult policyResult = $operation.onResponse($response);
+ if (policyResult != null) {
+ logger.debug("{}: {}: operation finished - result={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ policyResult);
+
+ //
+ // This Operation has completed, construct a notification showing our results
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ notification.message = $operation.getOperationHistory();
+ notification.history = $operation.getHistory();
+ if (policyResult.equals(PolicyResult.SUCCESS)) {
+ notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
+ } else {
+ notification.notification = 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
+
+/*
+*
+* This is the timer that manages the timeout for an individual operation.
+*
+*/
+rule "${policyName}.EVENT.MANAGER.OPERATION.TIMEOUT"
+ timer (expr: $to )
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
+ $opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString(), $to : getDelay() )
+ $lock : TargetLock (requestID == $event.requestID)
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+ logger.debug("{}: {}: event={} manager={} operation={} lock={} opTimer={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $operation, $lock, $operation, $opTimer);
+
+ //
+ // Tell it its timed out
+ //
+ $operation.setOperationHasTimedOut();
+ //
+ // Create a notification for it ("DB Write - end operation")
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
+ notification.message = $operation.getOperationHistory();
+ notification.history = $operation.getHistory();
+ //
+ // Let interested parties know
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ //
+ // Get rid of the timer
+ //
+ retract($opTimer);
+ //
+ // Ensure the operation is complete
+ //
+ if ($operation.isOperationComplete() == true) {
+ //
+ // It is complete, remove it from memory
+ //
+ retract($operation);
+ //
+ // Complete the operation
+ //
+ modify($manager) {finishOperation($operation)};
+ } else {
+ //
+ // Just doing this will kick off the LOCKED rule again
+ //
+ modify($operation) {};
+ }
+end
+
+/*
+*
+* This is the timer that manages the overall control loop timeout.
+*
+*/
+rule "${policyName}.EVENT.MANAGER.TIMEOUT"
+ timer (expr: $to )
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
+ $clTimer : ControlLoopTimer ( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString(), $to : getDelay() )
+ $operations : LinkedList()
+ from collect( ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID ) )
+ $opTimers : LinkedList()
+ from collect( OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() ) )
+ $locks : LinkedList()
+ from collect( TargetLock (requestID == $event.requestID) )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
+
+ if ($operations == null) {
+ logger.debug("{}: {}: event={} manager={} clTimer={} operations=0",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $clTimer);
+ } else {
+ logger.debug("{}: {}: event={} manager={} clTimer={} operations={}",
+ $params.getClosedLoopControlName(), drools.getRule().getName(),
+ $event, $manager, $clTimer, $operations.size());
+ }
+ //
+ // Tell the Event Manager it has timed out
+ //
+ VirtualControlLoopNotification notification = $manager.setControlLoopTimedOut();
+ if (notification != null) {
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ //
+ // Let interested parties know
+ //
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+ }
+ //
+ // Retract EVERYTHING
+ //
+ retract($event);
+ retract($manager);
+ retract($clTimer);
+ if ($operations != null && $operations.size() > 0) {
+ Iterator<ControlLoopOperationManager> iter = $operations.iterator();
+ while (iter.hasNext()) {
+ ControlLoopOperationManager manager = iter.next();
+ retract(manager);
+ }
+ }
+ if ($opTimers != null && $opTimers.size() > 0) {
+ Iterator<OperationTimer> iter = $opTimers.iterator();
+ while (iter.hasNext()) {
+ OperationTimer opTimer = iter.next();
+ retract(opTimer);
+ }
+ }
+ if ($locks != null && $locks.size() > 0) {
+ Iterator<TargetLock> iter = $locks.iterator();
+ while (iter.hasNext()) {
+ TargetLock lock = iter.next();
+ //
+ // Ensure we release the lock
+ //
+ PolicyGuard.unlockTarget(lock);
+ //
+ //
+ //
+ retract(lock);
+ }
+ }
+end
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/test/resources/projects/basic/archetype.properties b/controlloop/templates/archetype-cl-amsterdam/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 000000000..8cc10c97c
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,43 @@
+###
+# ============LICENSE_START=======================================================
+# archetype-closed-loop-demo-rules
+# ================================================================================
+# 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=========================================================
+###
+
+groupId=org.onap.policy.demo.drools
+artifactId=amsterdam
+version=1.1.0-SNAPSHOT
+package=org.onap.policy.demo.drools
+closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+controlLoopYaml=controlLoop%3A%0A++version%3A+2.0.0%0A++controlLoopName%3A+ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0A++trigger_policy%3A+unique-policy-id-1-restart%0A++timeout%3A+3600%0A++abatement%3A+true%0A+%0Apolicies%3A%0A++-+id%3A+unique-policy-id-1-restart%0A++++name%3A+Restart+the+VM%0A++++description%3A%0A++++actor%3A+APPC%0A++++recipe%3A+Restart%0A++++target%3A%0A++++++type%3A+VM%0A++++retry%3A+3%0A++++timeout%3A+1200%0A++++success%3A+final_success%0A++++failure%3A+final_failure%0A++++failure_timeout%3A+final_failure_timeout%0A++++failure_retries%3A+final_failure_retries%0A++++failure_exception%3A+final_failure_exception%0A++++failure_guard%3A+final_failure_guard%0A
+policyScope=service=test;resource=FRWL;type=configuration
+policyName=FirewallDemo
+policyVersion=v1.0
+dmaapServers=server1,server2,server3
+appcTopic=APPC-CL
+notificationTopic=POLICY-CL-MGT
+dcaeTopic=DCAE-CL-EVENT
+dcaeServers=server1,server2,server3
+dependenciesVersion=1.0.0-SNAPSHOT
+aaiURL=http://localhost:8080/TestREST/Test
+aaiUsername=policy
+aaiPassword=policy
+aaiNamedQueryUUID=d925ed73-8231-4d02-9545-db4e101fffff
+aaiPatternMatch=false
+soURL=http://localhost:8080/TestREST/Test
+soUsername=policy
+soPassword=policy
diff --git a/controlloop/templates/pom.xml b/controlloop/templates/pom.xml
index 046ccee6e..f36e4bb01 100644
--- a/controlloop/templates/pom.xml
+++ b/controlloop/templates/pom.xml
@@ -35,6 +35,7 @@
<modules>
<module>template.demo</module>
<module>template.demo.v1.0.0</module>
+ <module>archetype-cl-amsterdam</module>
</modules>
diff --git a/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/pom.xml b/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/pom.xml
index 9c2634579..fdf74293e 100644
--- a/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/pom.xml
+++ b/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START=======================================================
- archetype-closed-loop-demo-rules
+ ONAP
================================================================================
Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
================================================================================
@@ -26,6 +26,7 @@
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
+ <packaging>kjar</packaging>
<name>${artifactId}</name>
<description>Control Loop Legacy Rules for 1.0.0</description>
diff --git a/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml b/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
index 8116d880a..f9d166c74 100644
--- a/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
+++ b/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
@@ -24,6 +24,6 @@
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules">
- <ksession name="closedloop-demo"/>
+ <ksession name="legacy"/>
</kbase>
</kmodule>
diff --git a/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/test/resources/projects/basic/goal.txt b/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/test/resources/projects/basic/goal.txt
deleted file mode 100644
index e69de29bb..000000000
--- a/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/src/test/resources/projects/basic/goal.txt
+++ /dev/null
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/ControlLoopXacmlGuardTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java
index d1fa4fc10..64ad490b2 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java
@@ -60,7 +60,7 @@ public class ControlLoopXacmlGuardTest {
public static void setUpSimulator() {
try {
Util.buildAaiSim();
- } catch (InterruptedException e) {
+ } catch (Exception e) {
fail(e.getMessage());
}
}
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..08f73f4bc 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,7 +70,8 @@ public class TestSO {
public static void setUpSimulator() {
try {
Util.buildAaiSim();
- } catch (InterruptedException e) {
+ Util.buildSoSim();
+ } catch (Exception 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..715b8f795 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);
@@ -117,15 +113,15 @@ public final class Util {
return null;
}
- public static HttpServletServer buildAaiSim() throws InterruptedException {
+ public static HttpServletServer buildAaiSim() throws InterruptedException, IOException {
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, IOException {
+ return org.onap.policy.simulators.Util.buildSoSim();
}
- public static HttpServletServer buildVfcSim() throws InterruptedException {
+ public static HttpServletServer buildVfcSim() throws InterruptedException, IOException {
return org.onap.policy.simulators.Util.buildVfcSim();
}
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..9608f7cf0
--- /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 (Exception 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);
+ }
+ }
+}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
index 49cbf5227..a19d9267c 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
@@ -60,7 +60,7 @@ public class VFWControlLoopTest {
public static void setUpSimulator() {
try {
Util.buildAaiSim();
- } catch (InterruptedException e) {
+ } catch (Exception e) {
fail(e.getMessage());
}
}