aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-vcpe/src/main/resources/logic
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-12-19 21:42:34 -0600
committerliamfallon <liam.fallon@est.tech>2020-01-08 10:19:06 +0000
commit7a8e49a16020f7d04724803659f365236987c5ed (patch)
tree3b858f1c7f150ab6076dd61ba62c069607843d82 /examples/examples-onap-vcpe/src/main/resources/logic
parent004f3557013cb1919754a7318b0005e00b6867de (diff)
Update vCPE example to use Avro schemas
THis change updates the vCPE example to show how the example can work towards the APPC using Avro schemas only. This means that Policies can be adapted to changes in controller APIs using Avro alone. This example works with the old and new format policy-models. Issue-ID: POLICY-2043 Change-Id: I42ac0eac5203eaa37316cf6c460c67f7e8d6deb2 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'examples/examples-onap-vcpe/src/main/resources/logic')
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/AAILookupTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/AAILookupTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFResponseTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/AbatedTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/ControlLoopLogTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js)27
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/DeniedTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/GetVCPEStateTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardRequestTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardResponseTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/NoAAILookupTask.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/OnsetOrAbatedStateTSL.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/OnsetOrAbatedStateTSL.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/RestartAPPCRequestPolicyPermitOrDenyTSL.js (renamed from examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js)0
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckServiceIdTask.js46
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVNFIdTask.js45
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVServerIdTask.js46
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/ConfigureBlackWhiteListTask.js49
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControlLoopLogTask.js75
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerRequestTask.js71
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js90
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoControllerRequestActionTask.js27
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoLogActionTask.js28
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/ExecuteActionsPolicyActionStateTSL.js33
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/GetEntityStateTask.js157
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/InitiateActionsTask.js54
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/ReceiveEventPolicyExecuteOrLogStateTSL.js55
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/StopAndLogTask.js47
26 files changed, 837 insertions, 13 deletions
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/AAILookupTask.js
index fcb39052d..fcb39052d 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/AAILookupTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js
index dd69dcb1d..dd69dcb1d 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFResponseTask.js
index 75ab6a3af..75ab6a3af 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFResponseTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/AbatedTask.js
index f37b6f1b5..f37b6f1b5 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/AbatedTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/ControlLoopLogTask.js
index aa816ca95..a5a692cbc 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/ControlLoopLogTask.js
@@ -1,19 +1,20 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -40,7 +41,7 @@ clNotification.setClosedLoopEventClient(vcpeClosedLoopStatus.get("closedLoopEven
clNotification.setVersion(vcpeClosedLoopStatus.get("version"));
clNotification.setRequestId(java.util.UUID.fromString(vcpeClosedLoopStatus.get("requestID")));
clNotification.setTargetType(vcpeClosedLoopStatus.get("target_type"));
-clNotification.setTarget(org.onap.policy.controlloop.ControlLoopEventStatus.toStatus(vcpeClosedLoopStatus.get("target")));
+clNotification.setTarget(vcpeClosedLoopStatus.get("target"));
clNotification.setFrom(vcpeClosedLoopStatus.get("from"));
clNotification.setPolicyScope(vcpeClosedLoopStatus.get("policyScope"));
clNotification.setPolicyName(vcpeClosedLoopStatus.get("policyName"));
@@ -54,16 +55,16 @@ clNotification.setNotificationTime(notificationTime);
var aaiInfo = vcpeClosedLoopStatus.get("AAI");
-clNotification.getAai().put("generic-vnf.resource-version", aaiInfo.get("genericVnfResourceVersion"));
-clNotification.getAai().put("generic-vnf.vnf-name", aaiInfo.get("genericVnfVnfName"));
-clNotification.getAai().put("generic-vnf.prov-status", aaiInfo.get("genericVnfProvStatus"));
-clNotification.getAai().put("generic-vnf.is-closed-loop-disabled", aaiInfo.get("genericVnfIsClosedLoopDisabled"));
-clNotification.getAai().put("generic-vnf.orchestration-status", aaiInfo.get("genericVnfOrchestrationStatus"));
-clNotification.getAai().put("generic-vnf.vnf-type", aaiInfo.get("genericVnfVnfType"));
-clNotification.getAai().put("generic-vnf.in-maint", aaiInfo.get("genericVnfInMaint"));
-clNotification.getAai().put("generic-vnf.service-id", aaiInfo.get("genericVnfServiceId"));
+clNotification.getAai().put("generic-vnf.resource-version", aaiInfo.get("genericVnfResourceVersion"));
+clNotification.getAai().put("generic-vnf.vnf-name", aaiInfo.get("genericVnfVnfName"));
+clNotification.getAai().put("generic-vnf.prov-status", aaiInfo.get("genericVnfProvStatus"));
+clNotification.getAai().put("generic-vnf.is-closed-loop-disabled", aaiInfo.get("genericVnfIsClosedLoopDisabled"));
+clNotification.getAai().put("generic-vnf.orchestration-status", aaiInfo.get("genericVnfOrchestrationStatus"));
+clNotification.getAai().put("generic-vnf.vnf-type", aaiInfo.get("genericVnfVnfType"));
+clNotification.getAai().put("generic-vnf.in-maint", aaiInfo.get("genericVnfInMaint"));
+clNotification.getAai().put("generic-vnf.service-id", aaiInfo.get("genericVnfServiceId"));
if(vnfID != null) {
- clNotification.getAai().put("generic-vnf.vnf-id", aaiInfo.get("genericVnfVnfId"));
+ clNotification.getAai().put("generic-vnf.vnf-id", aaiInfo.get("genericVnfVnfId"));
}
executor.outFields.put("VirtualControlLoopNotification", clNotification);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/DeniedTask.js
index 353c21ef6..353c21ef6 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/DeniedTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/GetVCPEStateTask.js
index f4f6d908d..f4f6d908d 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/GetVCPEStateTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardRequestTask.js
index d247f8a65..d247f8a65 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardRequestTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardResponseTask.js
index 2a9100b7f..2a9100b7f 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardResponseTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/NoAAILookupTask.js
index ebc0e6387..ebc0e6387 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/NoAAILookupTask.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/OnsetOrAbatedStateTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/OnsetOrAbatedStateTSL.js
index c8a3bfba8..c8a3bfba8 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/OnsetOrAbatedStateTSL.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/OnsetOrAbatedStateTSL.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/RestartAPPCRequestPolicyPermitOrDenyTSL.js
index a1bac6546..a1bac6546 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/RestartAPPCRequestPolicyPermitOrDenyTSL.js
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckServiceIdTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckServiceIdTask.js
new file mode 100644
index 000000000..88bf72671
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckServiceIdTask.js
@@ -0,0 +1,46 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vnfId = executor.inFields.get("vnfID").toString();
+var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfId);
+var serviceId = vcpeClosedLoopStatus.get("AAI").get("genericVnfServiceId");
+var blackFlag = executor.getContextAlbum("ServiceIdWhiteBlackListAlbum").get(serviceId.toString());
+
+executor.logger.info("vnfId=" + vnfId + ", serviceId=" + serviceId + ", blackFlag=" + blackFlag);
+
+if (blackFlag != null && blackFlag === true) {
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+ vcpeClosedLoopStatus.put("notification", "BLACKLIST");
+ var message = vcpeClosedLoopStatus.get("message");
+
+ if (message != null) {
+ vcpeClosedLoopStatus.put("message", message + ":Service ID blacklisted");
+ }
+ else {
+ vcpeClosedLoopStatus.put("message", "Service ID blacklisted");
+ }
+}
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVNFIdTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVNFIdTask.js
new file mode 100644
index 000000000..d4e3f30dc
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVNFIdTask.js
@@ -0,0 +1,45 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vnfId = executor.inFields.get("vnfID").toString();
+var blackFlag = executor.getContextAlbum("VnfIdWhiteBlackListAlbum").get(vnfId);
+
+executor.logger.info("vnfId=" + vnfId + ", blackFlag=" + blackFlag);
+
+if (blackFlag != null && blackFlag === true) {
+ var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfId);
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+ vcpeClosedLoopStatus.put("notification", "BLACKLIST");
+ var message = vcpeClosedLoopStatus.get("message");
+
+ if (message != null) {
+ vcpeClosedLoopStatus.put("message", message + ":VNF ID blacklisted");
+ }
+ else {
+ vcpeClosedLoopStatus.put("message", "VNF ID blacklisted");
+ }
+}
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVServerIdTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVServerIdTask.js
new file mode 100644
index 000000000..785d93f25
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVServerIdTask.js
@@ -0,0 +1,46 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vnfId = executor.inFields.get("vnfID").toString();
+var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfId);
+var vServerId = vcpeClosedLoopStatus.get("AAI").get("vserverName");
+var blackFlag = executor.getContextAlbum("VServerIdWhiteBlackListAlbum").get(vServerId.toString());
+
+executor.logger.info("vnfId=" + vnfId + ", vServerId=" + vServerId + ", blackFlag=" + blackFlag);
+
+if (blackFlag != null && blackFlag === true) {
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+ vcpeClosedLoopStatus.put("notification", "BLACKLIST");
+ var message = vcpeClosedLoopStatus.get("message");
+
+ if (message != null) {
+ vcpeClosedLoopStatus.put("message", message + ":VServer ID blacklisted");
+ }
+ else {
+ vcpeClosedLoopStatus.put("message", "VServer ID blacklisted");
+ }
+}
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ConfigureBlackWhiteListTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ConfigureBlackWhiteListTask.js
new file mode 100644
index 000000000..2d41e5f90
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ConfigureBlackWhiteListTask.js
@@ -0,0 +1,49 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+// Pass through to the log state
+
+executor.logger.info(executor.outFields);
+
+var targetType = executor.inFields.get("targetType");
+var target = executor.inFields.get("target");
+var black = executor.inFields.get("black");
+
+var returnValue = executor.isTrue;
+
+if (targetType === "VNF") {
+ executor.getContextAlbum("VnfIdWhiteBlackListAlbum").put(target, black);
+ executor.logger.info("added VNF ID \"" + target + "\" with black flag \"" + black + "\" to VNF ID list");
+}
+else if (targetType === "Service") {
+ executor.getContextAlbum("ServiceIdWhiteBlackListAlbum").put(target, black);
+ executor.logger.info("added Service ID \"" + target + "\" with black flag \"" + black + "\" to Service ID list");
+}
+else if (targetType === "VServer") {
+ executor.getContextAlbum("VServerIdWhiteBlackListAlbum").put(target, black);
+ executor.logger.info("added VServer ID \"" + target + "\" with black flag \"" + black + "\" to VServer ID list");
+}
+else {
+ executor.logger.warn("unknown target type \"" + targetType + "\" specified");
+ returnValue = executor.isFalse;
+}
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControlLoopLogTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControlLoopLogTask.js
new file mode 100644
index 000000000..ca2166c75
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControlLoopLogTask.js
@@ -0,0 +1,75 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vnfID = executor.inFields.get("vnfID");
+if (vnfID == null) {
+ vnfID = executor.inFields.get("vnfName");
+}
+executor.logger.info("vnfID=" + vnfID);
+
+var controlLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfID.toString());
+
+executor.logger.info("Logging context information for VNF \"" + vnfID + "\"");
+
+var clNotification = executor.subject.getOutFieldSchemaHelper("VirtualControlLoopNotification").createNewInstance();
+
+clNotification.put("requestID", executor.inFields.get("requestID").toString());
+clNotification.put("closedLoopControlName", controlLoopStatus.get("closedLoopControlName"));
+clNotification.put("closedLoopAlarmStart", controlLoopStatus.get("closedLoopAlarmStart"));
+clNotification.put("closedLoopAlarmEnd", controlLoopStatus.get("closedLoopAlarmEnd"));
+clNotification.put("closedLoopEventClient", controlLoopStatus.get("closedLoopEventClient"));
+clNotification.put("version", controlLoopStatus.get("version"));
+clNotification.put("targetType", controlLoopStatus.get("target_type"));
+clNotification.put("target", controlLoopStatus.get("target"));
+clNotification.put("from", controlLoopStatus.get("from"));
+clNotification.put("policyScope", controlLoopStatus.get("policyScope"));
+clNotification.put("policyName", controlLoopStatus.get("policyName"));
+clNotification.put("policyVersion", controlLoopStatus.get("policyVersion"));
+clNotification.put("notification", controlLoopStatus.get("notification"));
+clNotification.put("message", controlLoopStatus.get("message"));
+clNotification.put("notificationTime", controlLoopStatus.get("notificationTime"));
+clNotification.put("opsClTimer", 0);
+
+var aaiInfo = controlLoopStatus.get("AAI");
+
+var aaiInfoOut = new java.util.HashMap();
+
+aaiInfoOut.put("generic-vnf.resource-version", aaiInfo.get("genericVnfResourceVersion"));
+aaiInfoOut.put("generic-vnf.vnf-name", aaiInfo.get("genericVnfVnfName"));
+aaiInfoOut.put("generic-vnf.prov-status", aaiInfo.get("genericVnfProvStatus"));
+aaiInfoOut.put("generic-vnf.is-closed-loop-disabled", aaiInfo.get("genericVnfIsClosedLoopDisabled"));
+aaiInfoOut.put("generic-vnf.orchestration-status", aaiInfo.get("genericVnfOrchestrationStatus"));
+aaiInfoOut.put("generic-vnf.vnf-type", aaiInfo.get("genericVnfVnfType"));
+aaiInfoOut.put("generic-vnf.in-maint", aaiInfo.get("genericVnfInMaint"));
+aaiInfoOut.put("generic-vnf.service-id", aaiInfo.get("genericVnfServiceId"));
+if (vnfID != null) {
+ aaiInfoOut.put("generic-vnf.vnf-id", aaiInfo.get("genericVnfVnfId"));
+}
+
+clNotification.put("AAI", aaiInfoOut);
+
+executor.outFields.put("VirtualControlLoopNotification", clNotification);
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerRequestTask.js
new file mode 100644
index 000000000..b6d4cae38
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerRequestTask.js
@@ -0,0 +1,71 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var controllerRequest = executor.subject.getOutFieldSchemaHelper("ControllerRequest").createNewInstance();
+
+var controllerRequestBody = executor.subject.getOutFieldSchemaHelper("ControllerRequest").createNewSubInstance(
+ "Controller_Body_Type");
+
+var controllerRequestBodyInput = executor.subject.getOutFieldSchemaHelper("ControllerRequest").createNewSubInstance(
+ "Controller_Body_Type_Input");
+
+var controllerRequestBodyInputCommonHeader = executor.subject.getOutFieldSchemaHelper("ControllerRequest")
+ .createNewSubInstance("Controller_Body_Type_Common_Header");
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+controllerRequest.put("version", "2.0.0");
+controllerRequest.put("rpc_DasH_name", "restart");
+controllerRequest.put("correlation_DasH_id", executor.inFields.get("requestID").toString());
+controllerRequest.put("type", "request");
+
+controllerRequestBodyInput.put("action", "Restart");
+controllerRequestBodyInput.put("action_DasH_identifiers", new java.util.HashMap());
+controllerRequestBodyInput.get("action_DasH_identifiers").put("vnf-id", executor.inFields.get("vnfID").toString());
+
+controllerRequestBodyInputCommonHeader.put("timestamp", java.lang.System.currentTimeMillis());
+controllerRequestBodyInputCommonHeader.put("api_DasH_ver", "2.00");
+controllerRequestBodyInputCommonHeader.put("originator_DasH_id", executor.inFields.get("requestID").toString());
+controllerRequestBodyInputCommonHeader.put("request_DasH_id", executor.inFields.get("requestID").toString());
+controllerRequestBodyInputCommonHeader.put("sub_DasH_request_DasH_id", "1");
+controllerRequestBodyInputCommonHeader.put("flags", new java.util.HashMap());
+controllerRequestBodyInputCommonHeader.get("flags").put("ttl", "10000");
+controllerRequestBodyInputCommonHeader.get("flags").put("force", "TRUE");
+controllerRequestBodyInputCommonHeader.get("flags").put("mode", "EXCLUSIVE");
+
+controllerRequestBodyInput.put("common_DasH_header", controllerRequestBodyInputCommonHeader);
+controllerRequestBody.put("input", controllerRequestBodyInput);
+controllerRequest.put("body", controllerRequestBody);
+
+executor.getContextAlbum("RequestIDVNFIDAlbum").put(executor.inFields.get("requestID").toString(),
+ executor.inFields.get("vnfID"));
+
+vcpeClosedLoopStatus.put("notification", "OPERATION");
+vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+
+executor.outFields.put("ControllerRequest", controllerRequest);
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
new file mode 100644
index 000000000..5a8703780
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
@@ -0,0 +1,90 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * APPC LCM Response code: 100 ACCEPTED
+ * 200 ERROR UNEXPECTED ERROR means failure
+ * 312 REJECTED DUPLICATE REQUEST
+ * 400 SUCCESS
+ *
+ * Note: Sometimes the corelationId has a -1 at the tail, need to get rid of it when present.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var controllerResponse = executor.inFields.get("ControllerResponse");
+
+var requestIDString = new java.lang.String(controllerResponse.get("correlation_DasH_id"));
+executor.logger.info("requestIDString =\"" + requestIDString + "\"");
+var vnfID = executor.getContextAlbum("RequestIDVNFIDAlbum").get(requestIDString);
+executor.logger.info("vnfID = " + vnfID);
+
+var returnValue = executor.isTrue;
+
+if (vnfID != null) {
+ var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfID.toString());
+ var requestId = java.util.UUID.fromString(vcpeClosedLoopStatus.get("requestID"));
+
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+
+ var returnedCode = controllerResponse.get("body").get("output").get("status").get("code");
+ var responseStatus = null;
+
+ if (returnedCode == 100) {
+ responseStatus = "ACCEPTED";
+ } else if (returnedCode == 200) {
+ responseStatus = "ERROR";
+ } else if (returnedCode >= 300 && returnedCode <= 316) {
+ responseStatus = "REJECT";
+ } else if (returnedCode == 400) {
+ responseStatus = "SUCCESS";
+ } else if (returnedCode == 450 || (returnedCode >= 401 && returnedCode <= 406)) {
+ responseStatus = "FAILURE";
+ } else if (returnedCode == 500) {
+ responseStatus = "PARTIAL_SUCCESS";
+ } else if (returnedCode >= 501 && returnedCode <= 599) {
+ responseStatus = "PARTIAL_FAILURE";
+ } else {
+ responseStatus = "SYSTEM_ERROR";
+ }
+
+ executor.logger.info("Got from APPC code: " + responseStatus);
+
+ if (responseStatus === "SUCCESS") {
+ vcpeClosedLoopStatus.put("notification", "OPERATION_SUCCESS");
+ vcpeClosedLoopStatus.put("message", "vCPE restarted");
+ executor.getContextAlbum("RequestIDVNFIDAlbum").remove(requestIDString);
+ } else if (responseStatus === "ACCEPTED" || responseStatus === "REJECT") {
+ executor.logger.info("Got ACCEPTED 100 or REJECT 312, keep the context, wait for next response. Code is: "
+ + responseStatus);
+ } else {
+ executor.getContextAlbum("RequestIDVNFIDAlbum").remove(requestIDString);
+ vcpeClosedLoopStatus.put("notification", "OPERATION_FAILURE");
+ vcpeClosedLoopStatus.put("message", "vCPE restart failed, code is " + responseStatus + ", message is "
+ + controllerResponse.get("body").get("output").get("status").get("message"));
+ }
+
+ executor.outFields.put("requestID", requestId);
+ executor.outFields.put("vnfID", vnfID);
+} else {
+ executor.message = "VNF ID not found in context album for request ID " + requestIDString;
+ returnValue = executor.isFalse;
+}
+
+executor.logger.info(executor.outFields);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoControllerRequestActionTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoControllerRequestActionTask.js
new file mode 100644
index 000000000..c24e76523
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoControllerRequestActionTask.js
@@ -0,0 +1,27 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+// Pass through to the log state
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoLogActionTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoLogActionTask.js
new file mode 100644
index 000000000..003942e22
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoLogActionTask.js
@@ -0,0 +1,28 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+// Pass through to the log state
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ExecuteActionsPolicyActionStateTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ExecuteActionsPolicyActionStateTSL.js
new file mode 100644
index 000000000..a8bb40c80
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ExecuteActionsPolicyActionStateTSL.js
@@ -0,0 +1,33 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var returnValue = executor.isTrue;
+var status = null;
+
+if (executor.inFields.get("action") === "ControllerRequestAction") {
+ executor.subject.getTaskKey("DoControllerRequestActionTask").copyTo(executor.selectedTask);
+} else {
+ executor.subject.getTaskKey("DoLogActionTask").copyTo(executor.selectedTask);
+}
+
+executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/GetEntityStateTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/GetEntityStateTask.js
new file mode 100644
index 000000000..1567608bb
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/GetEntityStateTask.js
@@ -0,0 +1,157 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * Note: The incoming closedloop message can be ONSET with both VNF-name and VNF-ID
+ * or ABATED with only VNF-name. So need to handle differently. For ABATED case,
+ * since we still keep the RequireIDVNFID context album, we can get it from there.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var utf8Type = Java.type("org.apache.avro.util.Utf8");
+var uuidType = Java.type("java.util.UUID");
+
+var clEvent = executor.inFields.get("VirtualControlLoopEvent");
+
+executor.logger.info(clEvent.toString());
+executor.logger.info(clEvent.get("closedLoopControlName"));
+
+var requestID = uuidType.fromString(clEvent.get("requestID"));
+executor.logger.info("requestID = " + requestID);
+var vnfID = null;
+var vcpeClosedLoopStatus = null;
+
+if (clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_id")) != null) {
+ vnfID = uuidType.fromString(clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_id")));
+ executor.logger.info("vnfID = " + vnfID);
+ vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfID);
+
+ if (vcpeClosedLoopStatus == null) {
+ executor.logger.info("Creating context information for new vCPE VNF \"" + vnfID.toString() + "\"");
+
+ vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").getSchemaHelper().createNewInstance();
+
+ vcpeClosedLoopStatus.put("closedLoopControlName", clEvent.get("closedLoopControlName"));
+ vcpeClosedLoopStatus.put("closedLoopAlarmStart", clEvent.get("closedLoopAlarmStart"));
+ vcpeClosedLoopStatus.put("closedLoopEventClient", clEvent.get("closedLoopEventClient"));
+ vcpeClosedLoopStatus.put("closedLoopEventStatus", clEvent.get("closedLoopEventStatus"));
+ vcpeClosedLoopStatus.put("version", clEvent.get("version"));
+ vcpeClosedLoopStatus.put("requestID", clEvent.get("requestID"));
+ vcpeClosedLoopStatus.put("target_type", clEvent.get("target_type"));
+ vcpeClosedLoopStatus.put("target", clEvent.get("target"));
+ vcpeClosedLoopStatus.put("from", clEvent.get("from"));
+ vcpeClosedLoopStatus.put("policyScope", "vCPE");
+ vcpeClosedLoopStatus.put("policyName", "ONAPvCPEPolicyModel");
+ vcpeClosedLoopStatus.put("policyVersion", "0.0.1");
+ vcpeClosedLoopStatus.put("notification", "ACTIVE");
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+ vcpeClosedLoopStatus.put("message", "");
+
+ var aaiInfo = executor.getContextAlbum("ControlLoopStatusAlbum").getSchemaHelper().createNewSubInstance(
+ "VCPE_AAI_Type");
+
+ aaiInfo.put("genericVnfResourceVersion", clEvent.get("AAI").get(
+ new utf8Type("generic_DasH_vnf_DoT_resource_DasH_version")));
+ aaiInfo.put("genericVnfVnfName", clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_name")));
+ aaiInfo.put("genericVnfProvStatus", clEvent.get("AAI").get(
+ new utf8Type("generic_DasH_vnf_DoT_prov_DasH_status")));
+ aaiInfo.put("genericVnfIsClosedLoopDisabled", clEvent.get("AAI").get(
+ new utf8Type("generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled")));
+ aaiInfo.put("genericVnfOrchestrationStatus", clEvent.get("AAI").get(
+ new utf8Type("generic_DasH_vnf_DoT_orchestration_DasH_status")));
+ aaiInfo.put("genericVnfVnfType", clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_type")));
+ aaiInfo.put("genericVnfInMaint", clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_in_DasH_maint")));
+ aaiInfo
+ .put("genericVnfServiceId", clEvent.get("AAI")
+ .get(new utf8Type("generic_DasH_vnf_DoT_service_DasH_id")));
+ aaiInfo.put("genericVnfVnfId", clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_id")));
+ aaiInfo.put("vserverIsClosedLoopDisabled", clEvent.get("AAI").get(
+ new utf8Type("vserver_DoT_is_DasH_closed_DasH_loop_DasH_disabled")));
+ aaiInfo.put("vserverProvStatus", clEvent.get("AAI").get(new utf8Type("vserver_DoT_prov_DasH_status")));
+ aaiInfo.put("vserverName", clEvent.get("AAI").get(new utf8Type("vserver_DoT_vserver_DasH_name")));
+
+ vcpeClosedLoopStatus.put("AAI", aaiInfo);
+
+ if (clEvent.get("closedLoopAlarmEnd") != null) {
+ vcpeClosedLoopStatus.put("closedLoopAlarmEnd", clEvent.get("closedLoopAlarmEnd"));
+ } else {
+ vcpeClosedLoopStatus.put("closedLoopAlarmEnd", java.lang.Long.valueOf(0));
+ }
+
+ executor.getContextAlbum("ControlLoopStatusAlbum").put(vnfID.toString(), vcpeClosedLoopStatus);
+
+ executor.logger.info("Created context information for new vCPE VNF \"" + vnfID.toString() + "\"");
+ }
+
+ executor.outFields.put("requestID", requestID);
+ executor.outFields.put("vnfID", vnfID);
+
+ executor.logger.info(executor.outFields);
+} else {
+ executor.logger.info("No vnf-id in VirtualControlLoopEvent, status:"
+ + clEvent.get("closedLoopEventStatus").toString());
+ var vnfName = clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_name"));
+ executor.logger.info("No vnf-id in VirtualControlLoopEvent for " + vnfName);
+
+ vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfName);
+
+ if (vcpeClosedLoopStatus == null) {
+ executor.logger.info("Creating context information for new vCPE VNF \"" + vnfName + "\"");
+
+ vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").getSchemaHelper().createNewInstance();
+
+ vcpeClosedLoopStatus.put("closedLoopControlName", clEvent.get("closedLoopControlName"));
+ vcpeClosedLoopStatus.put("closedLoopAlarmStart", clEvent.get("closedLoopAlarmStart"));
+ vcpeClosedLoopStatus.put("closedLoopEventClient", clEvent.get("closedLoopEventClient"));
+ vcpeClosedLoopStatus.put("closedLoopEventStatus", clEvent.get("closedLoopEventStatus("));
+ vcpeClosedLoopStatus.put("version", clEvent.get("version"));
+ vcpeClosedLoopStatus.put("requestID", clEvent.get("requestID"));
+ vcpeClosedLoopStatus.put("target_type", clEvent.get("targetType"));
+ vcpeClosedLoopStatus.put("target", clEvent.get("target"));
+ vcpeClosedLoopStatus.put("from", clEvent.get("from"));
+ vcpeClosedLoopStatus.put("policyScope", "vCPE");
+ vcpeClosedLoopStatus.put("policyName", "ONAPvCPEPolicyModel");
+ vcpeClosedLoopStatus.put("policyVersion", "0.0.1");
+ vcpeClosedLoopStatus.put("notification", "ACTIVE");
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+ vcpeClosedLoopStatus.put("message", "");
+
+ var aaiInfo = executor.getContextAlbum("ControlLoopStatusAlbum").getSchemaHelper().createNewSubInstance(
+ "VCPE_AAI_Type");
+
+ aaiInfo.put("genericVnfVnfName", clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_name")));
+ vcpeClosedLoopStatus.put("AAI", aaiInfo);
+
+ if (clEvent.get("closedLoopAlarmEnd") != null) {
+ vcpeClosedLoopStatus.put("closedLoopAlarmEnd", clEvent.get("closedLoopAlarmEnd"));
+ } else {
+ vcpeClosedLoopStatus.put("closedLoopAlarmEnd", java.lang.Long.valueOf(0));
+ }
+
+ executor.getContextAlbum("ControlLoopStatusAlbum").put(vnfName, vcpeClosedLoopStatus);
+
+ executor.logger.info("Created context information for new vCPE VNF \"" + vnfName + "\"");
+ }
+ executor.outFields.put("requestID", requestID);
+ executor.outFields.put("vnfName", vnfName);
+ executor.logger.info(executor.outFields);
+}
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/InitiateActionsTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/InitiateActionsTask.js
new file mode 100644
index 000000000..0303bc9a4
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/InitiateActionsTask.js
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+var eventList = executor.subject.getOutFieldSchemaHelper("ActionEventList").createNewInstance();
+
+var eventType = Java.type("org.onap.policy.apex.service.engine.event.ApexEvent");
+
+var controllerRequestActionEvent = new eventType("ActionEvent", "0.0.1", "org.onap.policy.apex.onap.vcpe", "APEX",
+ "APEX");
+
+controllerRequestActionEvent.put("action", "ControllerRequestAction");
+controllerRequestActionEvent.put("requestID", executor.inFields.get("requestID"));
+controllerRequestActionEvent.put("vnfID", executor.inFields.get("vnfID"));
+controllerRequestActionEvent.put("vnfName", executor.inFields.get("vnfName"));
+
+eventList.add(controllerRequestActionEvent);
+
+var logActionEvent = new eventType("ActionEvent", "0.0.1", "org.onap.policy.apex.onap.vcpe", "APEX", "APEX");
+
+logActionEvent.put("action", "LogAction");
+logActionEvent.put("requestID", executor.inFields.get("requestID"));
+logActionEvent.put("vnfID", executor.inFields.get("vnfID"));
+logActionEvent.put("vnfName", executor.inFields.get("vnfName"));
+
+eventList.add(logActionEvent);
+
+executor.outFields.put("ActionEventList", eventList);
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ReceiveEventPolicyExecuteOrLogStateTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ReceiveEventPolicyExecuteOrLogStateTSL.js
new file mode 100644
index 000000000..46a65add3
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ReceiveEventPolicyExecuteOrLogStateTSL.js
@@ -0,0 +1,55 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var returnValue = executor.isTrue;
+
+if( executor.inFields.get("vnfID") == null) {
+ executor.logger.info("ControlLoopStatusAlbum: vnfID is null");
+ var vnfName = executor.inFields.get("vnfName");
+ var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(
+ executor.inFields.get("vnfName"));
+} else {
+ var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+}
+
+var status = vcpeClosedLoopStatus.get("closedLoopEventStatus").toString();
+var notification = vcpeClosedLoopStatus.get("notification");
+
+var returnValue = executor.isTrue;
+
+if (notification != null && notification === "BLACKLIST") {
+ executor.subject.getTaskKey("StopAndLogTask").copyTo(executor.selectedTask);
+}
+else {
+ if (status === "ONSET") {
+ executor.subject.getTaskKey("InitiateActionsTask").copyTo(executor.selectedTask);
+ } else if (status === "ABATED") {
+ executor.subject.getTaskKey("StopAndLogTask").copyTo(executor.selectedTask);
+ } else {
+ executor.message = "closedLoopEventStatus is \"" + status + "\", it must be either \"ONSET\" or \"ABATED\"";
+ returnValue = executor.isFalse;
+ }
+}
+
+executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/StopAndLogTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/StopAndLogTask.js
new file mode 100644
index 000000000..af57bf1f7
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/StopAndLogTask.js
@@ -0,0 +1,47 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = null;
+if (executor.inFields.get("vnfID") == null) {
+ executor.logger.info("AbatedTask: vnfID is null");
+ var vnfName = executor.inFields.get("vnfName");
+ vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum")
+ .get(executor.inFields.get("vnfName"));
+} else {
+ vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum")
+ .get(executor.inFields.get("vnfID").toString());
+}
+
+vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+
+var message = vcpeClosedLoopStatus.get("message");
+if (message == null || message === "") {
+ vcpeClosedLoopStatus.put("message", "situation has been abated");
+}
+else {
+ vcpeClosedLoopStatus.put("notification", "FINAL_FAILURE");
+}
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.isTrue;