summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-05-10 00:07:39 -0500
committerJorge Hernandez <jh1730@att.com>2017-05-10 00:07:39 -0500
commitf0c29b57e132e6335f0fa7bbad885d403e4c85df (patch)
treede0b0cf6954d948f9d133f9983a687bf796ad052
parent4b2c7e373d42c724d6a26f4b283b4a1e74b67b27 (diff)
[POLICY-11] Sample Query with variable arguments
The sample drl query can be used in conjuction with the REST API to externally retrieve/retract objects in the KieSession working memory. Change-Id: Ia6ca683988a0181a4846b57b0decca4668e74889 Signed-off-by: Jorge Hernandez <jh1730@att.com>
-rw-r--r--archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.accepted.json1
-rw-r--r--archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.success.json1
-rw-r--r--archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/dcae.onset.json2
-rw-r--r--archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl44
4 files changed, 14 insertions, 34 deletions
diff --git a/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.accepted.json b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.accepted.json
new file mode 100644
index 000000000..01be66011
--- /dev/null
+++ b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.accepted.json
@@ -0,0 +1 @@
+{"Status":{"Value":"ACCEPTED","Code":"100"},"Payload":{"pg-streams":"{\\\"pg-streams\\\": {\\\"pg-stream\\\":[{\\\"id\\\":\\\"fw_udp1\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp2\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp3\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp4\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp5\\\", \\\"is-enabled\\\":\\\"true\\\"}]}}","generic-vnf.vnf-id":"fw0001vm001fw001"},"CommonHeader":{"TimeStamp":"1493841850199","APIver":"1.01","RequestID":"664be3d2-6c12-4f4b-a3e7-c349acced200","SubrequestID":null,"OriginatorID":null}}
diff --git a/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.success.json b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.success.json
new file mode 100644
index 000000000..b9ef41f50
--- /dev/null
+++ b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/appc.success.json
@@ -0,0 +1 @@
+{"Status":{"Value":"SUCCESS","Code":"400"},"Payload":{"pg-streams":"{\\\"pg-streams\\\": {\\\"pg-stream\\\":[{\\\"id\\\":\\\"fw_udp1\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp2\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp3\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp4\\\", \\\"is-enabled\\\":\\\"true\\\"},{\\\"id\\\":\\\"fw_udp5\\\", \\\"is-enabled\\\":\\\"true\\\"}]}}","generic-vnf.vnf-id":"fw0001vm001fw001"},"CommonHeader":{"TimeStamp":"1493841850199","APIver":"1.01","RequestID":"664be3d2-6c12-4f4b-a3e7-c349acced200","SubrequestID":null,"OriginatorID":null}}
diff --git a/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/dcae.onset.json b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/dcae.onset.json
index 5c787ed5d..4553faa13 100644
--- a/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/dcae.onset.json
+++ b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/config/dcae.onset.json
@@ -7,7 +7,7 @@
"target_type": "VF",
"target": "generic-vnf.vnf-id",
"AAI": {
- "generic-vnf.vnf-id": "fw0001vm001fw001",
+ "generic-vnf.vnf-id": "fw0001vm001fw001"
},
"from": "DCAE",
"version": "1.0.2"
diff --git a/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl
index f03d32ba3..c5614e006 100644
--- a/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl
+++ b/archetype-closedloop-demo-rules/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl
@@ -1121,40 +1121,18 @@ rule "${policyName}.MSO.RESPONSE"
}
end
-
/*
-*
-* Queries
-*
-*/
-query "${policyName}.QUERY.PARAMS"
- param : Params()
-end
-
-query "${policyName}.QUERY.EVENTS"
- event : VirtualControlLoopEvent()
-end
-
-query "${policyName}.QUERY.MANAGERS"
- manager : EventManager()
-end
-
-query "${policyName}.QUERY.OPERATIONS"
- manager : ControlLoopOperationWrapper()
-end
-
-query "${policyName}.QUERY.APPC.REQUEST"
- appcRequest : Request()
-end
-
-query "${policyName}.QUERY.APPC.RESPONSE"
- appcResponse : Response()
-end
-
-query "${policyName}.QUERY.MSO.REQUEST"
- msoRequest : MSORequest()
+ * Sample Queries for illustration with and without arguments
+ * The results of the query can be introspected (and retracted if desired)
+ * through REST API.
+ */
+query "${policyName}.QUERY.EVENT.ONSET"
+ event : VirtualControlLoopEvent( closedLoopEventStatus == ControlLoopEventStatus.ONSET )
end
-query "${policyName}.QUERY.MSO.RESPONSE"
- msoResponse : MSOResponse()
+query "${policyName}.QUERY.MANAGER.RNA" (String aRequestId, Integer numOnsetsLowerBound, Boolean aActivated)
+ manager : EventManager( closedLoopControlName == "${closedLoopControlName}",
+ requestID.toString() == aRequestId,
+ numOnsets > numOnsetsLowerBound,
+ activated == aActivated )
end