aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/templates
diff options
context:
space:
mode:
authorpramod.jamkhedkar <pramod@research.att.com>2019-11-13 13:36:56 -0500
committerpramod.jamkhedkar <pramod@research.att.com>2019-11-15 12:51:55 -0500
commit9398165f5c35e686e2570c68cd0eb4a2e9254a02 (patch)
treea725c77c9986505250163c1199429afa1acb68dc /controlloop/templates
parent03dff4f370602a2e6726d2b8357e10c30dcf8210 (diff)
Removing Named Query
Removing all the related files and necessary modifications for removing named query. The code now only supports Custom Query. Issue-ID: POLICY-2125 Change-Id: I2d376eb955d69f45c39ad4d4a1cfacb4d620ca8e Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
Diffstat (limited to 'controlloop/templates')
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl31
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java40
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java2
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java2
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java2
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java1
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java1
-rw-r--r--controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml8
-rw-r--r--controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml8
-rw-r--r--controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vPCI.yaml2
10 files changed, 51 insertions, 46 deletions
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
index d3c95a77b..88bf6141f 100644
--- 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
@@ -39,7 +39,6 @@ import org.onap.policy.controlloop.actor.so.SoActorServiceProvider;
import org.onap.policy.controlloop.actor.cds.CdsActorServiceProvider;
import org.onap.policy.controlloop.actor.cds.CdsActorServiceProvider.CdsActorServiceManager;
import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants;
-import org.onap.policy.aai.AaiNqResponseWrapper;
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
@@ -797,7 +796,6 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
// NOTE: The environment properties uses "guard.disabled" but the boolean is guardEnabled
boolean guardEnabled = "false".equalsIgnoreCase(PolicyEngineConstants.getManager().getEnvironmentProperty("guard.disabled"));
- boolean cqEnabled = "true".equalsIgnoreCase(PolicyEngineConstants.getManager().getEnvironmentProperty("aai.customQuery"));
if(guardEnabled){
@@ -809,25 +807,20 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
$operation.getTargetEntity(),
$event.getRequestId().toString(),
() -> {
- if (!cqEnabled) {
- AaiNqResponseWrapper resp = $manager.getNqVserverFromAai();
- return(resp == null ? null : resp.countVfModules());
- } else {
- try {
- AaiCqResponse resp_cq = $manager.getCqResponse($event);
- if (resp_cq == null){
- return null;
- } else {
- String custId = $operation.policy.getTarget().getModelCustomizationId();
- String invId = $operation.policy.getTarget().getModelInvariantId();
- String verId = $operation.policy.getTarget().getModelVersionId();
- return resp_cq.getVfModuleCount(custId, invId, verId);
- }
- } catch (Exception e){
- logger.warn("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName(), e);
+ try {
+ AaiCqResponse resp_cq = $manager.getCqResponse($event);
+ if (resp_cq == null){
+ return null;
+ } else {
+ String custId = $operation.policy.getTarget().getModelCustomizationId();
+ String invId = $operation.policy.getTarget().getModelInvariantId();
+ String verId = $operation.policy.getTarget().getModelVersionId();
+ return resp_cq.getVfModuleCount(custId, invId, verId);
}
- return null;
+ } catch (Exception e){
+ logger.warn("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName(), e);
}
+ return null;
}));
t.start();
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java
index 57085f614..f41bd874b 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java
@@ -53,10 +53,9 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
public static void setUpBeforeClass() {
ControlLoopBase.setUpBeforeClass(
"../archetype-cl-amsterdam/src/main/resources/archetype-resources"
- + "/src/main/resources/__closedLoopControlName__.drl",
+ + "/src/main/resources/__closedLoopControlName__.drl",
"src/test/resources/yaml/policy_ControlLoop_vCPE.yaml",
- "service=ServiceDemo;resource=Res1Demo;type=operational",
- "CL_vCPE",
+ "service=ServiceDemo;resource=Res1Demo;type=operational", "CL_vCPE",
"org.onap.closed_loop.ServiceDemo:VNFS:1.0.0");
}
@@ -81,7 +80,7 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
* Simulate an onset event the policy engine will receive from DCAE to kick off processing
* through the rules
*/
- sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, "vCPEInfraVNF13", true);
+ sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, "OzVServer", true);
kieSession.fireUntilHalt();
@@ -152,10 +151,10 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
Object obj = null;
if ("POLICY-CL-MGT".equals(topic)) {
obj = org.onap.policy.controlloop.util.Serialization.gsonJunit.fromJson(event,
- org.onap.policy.controlloop.VirtualControlLoopNotification.class);
+ org.onap.policy.controlloop.VirtualControlLoopNotification.class);
} else if ("APPC-LCM-READ".equals(topic)) {
obj = org.onap.policy.appclcm.util.Serialization.gsonJunit.fromJson(event,
- org.onap.policy.appclcm.AppcLcmDmaapWrapper.class);
+ org.onap.policy.appclcm.AppcLcmDmaapWrapper.class);
}
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
@@ -163,20 +162,24 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
String policyName = notification.getPolicyName();
if (policyName.endsWith("EVENT")) {
logger.debug("Rule Fired: " + notification.getPolicyName());
- assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.getNotification()));
+ assertTrue(
+ ControlLoopNotificationType.ACTIVE.equals(notification.getNotification()));
} else if (policyName.endsWith("GUARD_NOT_YET_QUERIED")) {
logger.debug("Rule Fired: " + notification.getPolicyName());
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertTrue(
+ ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
assertNotNull(notification.getMessage());
assertTrue(notification.getMessage().startsWith("Sending guard query"));
} else if (policyName.endsWith("GUARD.RESPONSE")) {
logger.debug("Rule Fired: " + notification.getPolicyName());
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertTrue(
+ ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
assertNotNull(notification.getMessage());
assertTrue(notification.getMessage().toLowerCase().endsWith("permit"));
} else if (policyName.endsWith("GUARD_PERMITTED")) {
logger.debug("Rule Fired: " + notification.getPolicyName());
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertTrue(
+ ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
assertNotNull(notification.getMessage());
assertTrue(notification.getMessage().startsWith("actor=APPC"));
} else if (policyName.endsWith("OPERATION.TIMEOUT")) {
@@ -186,17 +189,20 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
fail("Operation Timed Out");
} else if (policyName.endsWith("APPC.LCM.RESPONSE")) {
logger.debug("Rule Fired: " + notification.getPolicyName());
- assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.getNotification()));
+ assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS
+ .equals(notification.getNotification()));
assertNotNull(notification.getMessage());
assertTrue(notification.getMessage().startsWith("actor=APPC"));
sendEvent(pair.first, requestId, ControlLoopEventStatus.ABATED);
} else if (policyName.endsWith("EVENT.MANAGER")) {
logger.debug("Rule Fired: " + notification.getPolicyName());
if ("getFail".equals(notification.getAai().get("generic-vnf.vnf-name"))) {
- assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification());
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE,
+ notification.getNotification());
kieSession.halt();
} else {
- assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.getNotification());
+ assertEquals(ControlLoopNotificationType.FINAL_SUCCESS,
+ notification.getNotification());
kieSession.halt();
}
} else if (policyName.endsWith("EVENT.MANAGER.TIMEOUT")) {
@@ -238,7 +244,8 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
* @param requestId the requestId for this event
* @param status could be onset or abated
*/
- protected void sendEvent(ControlLoopPolicy policy, UUID requestId, ControlLoopEventStatus status) {
+ protected void sendEvent(ControlLoopPolicy policy, UUID requestId,
+ ControlLoopEventStatus status) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
event.setRequestId(requestId);
@@ -250,8 +257,8 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
kieSession.insert(event);
}
- protected void sendEvent(ControlLoopPolicy policy, UUID requestId, ControlLoopEventStatus status, String vnfName,
- boolean isEnriched) {
+ protected void sendEvent(ControlLoopPolicy policy, UUID requestId,
+ ControlLoopEventStatus status, String vnfName, boolean isEnriched) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
event.setRequestId(requestId);
@@ -260,6 +267,7 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
event.setClosedLoopAlarmStart(Instant.now());
event.setAai(new HashMap<>());
event.getAai().put("generic-vnf.vnf-name", vnfName);
+ event.getAai().put("vserver.vserver-name", vnfName);
if (isEnriched) {
event.getAai().put("generic-vnf.in-maint", "false");
event.getAai().put("generic-vnf.is-closed-loop-disabled", "false");
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java
index 1a5bf3982..0e05a0c6d 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java
@@ -235,7 +235,7 @@ public class VdnsControlLoopCqTest extends ControlLoopBase implements TopicListe
event.setTargetType(ControlLoopTargetType.VNF);
event.setClosedLoopAlarmStart(Instant.now());
event.setAai(new HashMap<>());
- event.getAai().put("vserver.vserver-name", "Ete_vFWCLvFWSNK_7ba1fbde_0");
+ event.getAai().put("vserver.vserver-name", "OzVServer");
event.getAai().put("vserver.is-closed-loop-disabled", "false");
event.getAai().put("vserver.prov-status", "ACTIVE");
event.setClosedLoopEventStatus(status);
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
index 3c658c1fd..da237fa05 100644
--- 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
@@ -267,7 +267,7 @@ public class VdnsControlLoopTest extends ControlLoopBase implements TopicListene
event.setTargetType(ControlLoopTargetType.VNF);
event.setClosedLoopAlarmStart(Instant.now());
event.setAai(new HashMap<>());
- event.getAai().put("vserver.vserver-name", "dfw1lb01lb01");
+ event.getAai().put("vserver.vserver-name", "OzVServer");
event.getAai().put("vserver.is-closed-loop-disabled", "false");
event.getAai().put("vserver.prov-status", "ACTIVE");
event.setClosedLoopEventStatus(status);
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 c326da145..cbdf09c8d 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
@@ -285,6 +285,7 @@ public class VfwControlLoopTest extends ControlLoopBase implements TopicListener
event.setClosedLoopAlarmStart(Instant.now());
event.setAai(new HashMap<>());
event.getAai().put("generic-vnf.vnf-name", "testGenericVnfID");
+ event.getAai().put("vserver.vserver-name", "testVserverName");
event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
@@ -306,6 +307,7 @@ public class VfwControlLoopTest extends ControlLoopBase implements TopicListener
event.setClosedLoopAlarmStart(Instant.now());
event.setAai(new HashMap<>());
event.getAai().put("generic-vnf.vnf-name", vnfId);
+ event.getAai().put("vserver.vserver-name", vnfId);
event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java
index 9d3486f5b..d3aedd68f 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java
@@ -265,6 +265,7 @@ public class VpciControlLoopTest extends ControlLoopBase implements TopicListene
event.getAai().put("generic-vnf.is-closed-loop-disabled", "false");
event.getAai().put("generic-vnf.prov-status", "ACTIVE");
event.getAai().put("generic-vnf.vnf-id", "notused");
+ event.getAai().put("vserver.vserver-name", "OzVServer");
} else {
event.getAai().put("generic-vnf.vnf-id", "getFail");
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java
index d0427e47f..527fd298d 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java
@@ -269,6 +269,7 @@ public class VsonhControlLoopTest extends ControlLoopBase implements TopicListen
event.getAai().put("generic-vnf.is-closed-loop-disabled", "false");
event.getAai().put("generic-vnf.prov-status", "ACTIVE");
event.getAai().put("generic-vnf.vnf-id", "notused");
+ event.getAai().put("vserver.vserver-name", "OzVServer");
} else {
event.getAai().put("generic-vnf.vnf-id", "getFail");
}
diff --git a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml
index c6125d082..d32f55b5d 100644
--- a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml
+++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml
@@ -29,11 +29,11 @@ policies:
recipe: VF Module Create
target:
type: VFMODULE
- modelInvariantId: 90b793b5-b8ae-4c36-b10b-4b6372859d3a
- modelVersionId: 2210154d-e61a-4d7f-8fb9-0face1aee3f8
- modelName: SproutScalingVf..scaling_sprout..module-1
+ modelInvariantId: e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e
+ modelVersionId: 94b18b1d-cc91-4f43-911a-e6348665f292
+ modelName: VfwclVfwsnkBbefb8ce2bde..base_vfw..module-0
modelVersion: 1
- modelCustomizationId: 3e2d67ad-3495-4732-82f6-b0b872791fff
+ modelCustomizationId: 47958575-138f-452a-8c8d-d89b595f8164
payload:
requestParameters: '{"usePreload":true,"userParams":[]}'
configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]'
diff --git a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml
index fa66a2639..8c94b1adc 100644
--- a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml
+++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml
@@ -15,9 +15,9 @@ controlLoop:
version: 2.0.0
controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
services:
- - serviceInvariantUUID: 5cfe6f4a-41bc-4247-8674-ebd4b98e35cc
- serviceUUID: 0f40bba5-986e-4b3c-803f-ddd1b7b25f24
- serviceName: 57e66ea7-0ed6-45c7-970f
+ - serviceInvariantUUID: f6937c86-584c-47ae-ad29-8d41d6f0cc7c
+ serviceUUID: 7be584e2-0bb2-4126-adaf-ced2c77ca0b3
+ serviceName: Service_Ete_Name7ba1fbde-6187-464a-a62d-d9dd25bdf4e8
trigger_policy: unique-policy-id-1-modifyConfig
timeout: 60
abatement: true
@@ -29,7 +29,7 @@ policies:
actor: APPC
recipe: ModifyConfig
target:
- resourceID: Eace933104d443b496b8.nodes.heat.vpg
+ resourceID: bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38
type: VNF
retry: 0
timeout: 30
diff --git a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vPCI.yaml b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vPCI.yaml
index 35cb2ac3d..42e2000db 100644
--- a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vPCI.yaml
+++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vPCI.yaml
@@ -26,7 +26,7 @@ policies:
recipe: ModifyConfig
target:
# These fields are not used
- resourceID: Eace933104d443b496b8.nodes.heat.vpg
+ resourceID: bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38
type: VNF
retry: 0
timeout: 300