aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-vcpe/src/main/resources/logic
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-onap-vcpe/src/main/resources/logic')
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/AAILookupRequestTask.js44
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/AAILookupResponseTask.js50
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js76
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js50
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js32
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js48
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js32
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js69
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js44
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js50
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js26
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyAAILookupStateTSL.js46
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js43
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js37
14 files changed, 647 insertions, 0 deletions
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupRequestTask.js
new file mode 100644
index 000000000..f3c0c45cd
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupRequestTask.js
@@ -0,0 +1,44 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+var guardDecisionAttributes = executor.subject.getOutFieldSchemaHelper("decisionAttributes").createNewInstance();
+
+guardDecisionAttributes.put("actor", "APPC");
+guardDecisionAttributes.put("recipe", "Restart");
+guardDecisionAttributes.put("target", executor.inFields.get("vnfID").toString());
+guardDecisionAttributes.put("clname", "APEXvCPEImplementation");
+
+executor.logger.info(guardDecisionAttributes);
+
+executor.outFields.put("decisionAttributes", guardDecisionAttributes);
+executor.outFields.put("onapName", "APEX");
+
+executor.getContextAlbum("ControlLoopExecutionIDAlbum").put(executor.executionID.toString(),
+ executor.inFields.get("vnfID"));
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE; \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupResponseTask.js
new file mode 100644
index 000000000..df98c25f4
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/AAILookupResponseTask.js
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vnfID = executor.getContextAlbum("ControlLoopExecutionIDAlbum").remove(executor.executionID.toString());
+
+executor.logger.info("Continuing execution with VNF ID: " + vnfID);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID.toString());
+executor.logger.info(vcpeClosedLoopStatus);
+
+var guardResult = executor.inFields.get("decision");
+
+if (guardResult === "PERMIT") {
+ vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_PERMIT");
+} else if (guardResult === "DENY") {
+ vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_DENY");
+} else {
+ executor.message = "guard result must be either \"PERMIT\" or \"DENY\"";
+ returnValue = executor.FALSE;
+}
+
+var uuidType = Java.type("java.util.UUID");
+var requestID = uuidType.fromString(vcpeClosedLoopStatus.get("requestID"));
+
+executor.outFields.put("requestID", requestID);
+executor.outFields.put("vnfID", vnfID);
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
new file mode 100644
index 000000000..45a70c014
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
@@ -0,0 +1,76 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var genericDataRecordType = Java.type("org.apache.avro.generic.GenericData.Record");
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+var appcBodyRecord = executor.subject.getOutFieldSchemaHelper("body").createNewInstance();
+var appcBodyRecordSchema = appcBodyRecord.getSchema();
+
+var inputRecord = new genericDataRecordType(appcBodyRecordSchema.getField("input").schema());
+var inputRecordRecordSchema = inputRecord.getSchema();
+
+var actionIndentifiersRecord = new genericDataRecordType(inputRecordRecordSchema.getField("action_DasH_identifiers")
+ .schema());
+
+var commonHeaderRecord = new genericDataRecordType(inputRecordRecordSchema.getField("common_DasH_header").schema());
+var commonHeaderRecordSchema = commonHeaderRecord.getSchema();
+
+var commonHeaderFlagsRecord = new genericDataRecordType(commonHeaderRecordSchema.getField("flags").schema());
+
+appcBodyRecord.put("input", inputRecord);
+inputRecord.put("action_DasH_identifiers", actionIndentifiersRecord);
+inputRecord.put("common_DasH_header", commonHeaderRecord);
+commonHeaderRecord.put("flags", commonHeaderFlagsRecord);
+
+inputRecord.put("action", "Restart");
+inputRecord.put("payload", "{}");
+
+actionIndentifiersRecord.put("vnf_DasH_id", executor.inFields.get("vnfID").toString());
+
+commonHeaderRecord.put("timestamp", new Date().toISOString());
+commonHeaderRecord.put("api_DasH_ver", "2.00");
+commonHeaderRecord.put("originator_DasH_id", executor.inFields.get("requestID").toString());
+commonHeaderRecord.put("request_DasH_id", executor.inFields.get("requestID").toString());
+commonHeaderRecord.put("sub_DasH_request_DasH_id", "1");
+
+commonHeaderFlagsRecord.put("ttl", "10000");
+commonHeaderFlagsRecord.put("force", "TRUE");
+commonHeaderFlagsRecord.put("mode", "EXCLUSIVE");
+
+executor.outFields.put("version", "2.0");
+executor.outFields.put("rpc-name", "restart");
+executor.outFields.put("correlation-id", executor.inFields.get("vnfID"));
+executor.outFields.put("type", "request");
+executor.outFields.put("body", appcBodyRecord);
+
+executor.getContextAlbum("RequestIDVNFIDAlbum").put(executor.inFields.get("requestID").toString(),
+ executor.inFields.get("vnfID"));
+
+vcpeClosedLoopStatus.put("notification", "OPERATION: RESTART REQUESTED");
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js
new file mode 100644
index 000000000..d382e6274
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var uuidType = Java.type("java.util.UUID");
+var integerType = Java.type("java.lang.Integer");
+
+var requestID = uuidType.fromString(executor.inFields.get("correlation-id"));
+var vnfID = executor.getContextAlbum("RequestIDVNFIDAlbum").remove(requestID.toString());
+
+var returnValue = executor.TRUE;
+
+if (vnfID != null) {
+ var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID.toString());
+
+ var notification = "OPERATION: VNF RESTART WITH RETURN CODE "
+ + executor.inFields.get("body").get("output").get("status").get("code") + ", "
+ + executor.inFields.get("body").get("output").get("status").get("message");
+
+ vcpeClosedLoopStatus.put("notification", notification);
+ vcpeClosedLoopStatus.put("notificationTime", executor.inFields.get("body").get("output").get("common_DasH_header")
+ .get("timestamp"));
+
+ executor.outFields.put("requestID", requestID);
+ executor.outFields.put("vnfID", vnfID);
+} else {
+ executor.message = "VNF ID not found in context album for request ID " + requestID;
+ returnValue = executor.FALSE
+}
+
+executor.logger.info(executor.outFields);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js
new file mode 100644
index 000000000..1fb46b7ba
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/AbatedTask.js
@@ -0,0 +1,32 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+vcpeClosedLoopStatus.put("notification", "VCPE NOTIFICATION HAS BEEN ABATED");
+vcpeClosedLoopStatus.put("notificationTime", new Date().toISOString());
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js
new file mode 100644
index 000000000..65922e7f1
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js
@@ -0,0 +1,48 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+executor.logger.info("Logging context information for VNF \"" + executor.inFields.get("vnfID") + "\"");
+
+executor.outFields.put("AAI", vcpeClosedLoopStatus.get("AAI"));
+executor.outFields.put("closedLoopControlName", vcpeClosedLoopStatus.get("closedLoopControlName"));
+executor.outFields.put("closedLoopAlarmStart", vcpeClosedLoopStatus.get("closedLoopAlarmStart"));
+executor.outFields.put("closedLoopAlarmEnd", vcpeClosedLoopStatus.get("closedLoopAlarmEnd"));
+executor.outFields.put("closedLoopEventClient", vcpeClosedLoopStatus.get("closedLoopEventClient"));
+executor.outFields.put("closedLoopEventStatus", vcpeClosedLoopStatus.get("closedLoopEventStatus"));
+executor.outFields.put("version", vcpeClosedLoopStatus.get("version"));
+executor.outFields.put("requestID", vcpeClosedLoopStatus.get("requestID"));
+executor.outFields.put("target_type", vcpeClosedLoopStatus.get("target_type"));
+executor.outFields.put("target", vcpeClosedLoopStatus.get("target"));
+executor.outFields.put("from", vcpeClosedLoopStatus.get("from"));
+executor.outFields.put("policyScope", vcpeClosedLoopStatus.get("policyScope"));
+executor.outFields.put("policyName", vcpeClosedLoopStatus.get("policyName"));
+executor.outFields.put("policyVersion", vcpeClosedLoopStatus.get("policyVersion"));
+executor.outFields.put("notification", vcpeClosedLoopStatus.get("notification"));
+executor.outFields.put("notificationTime", vcpeClosedLoopStatus.get("notificationTime"));
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js
new file mode 100644
index 000000000..7f3a9d6b6
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/DeniedTask.js
@@ -0,0 +1,32 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+vcpeClosedLoopStatus.put("notification", "VCPE VNF RESTART HAS BEEN DENIED BY GUARD");
+vcpeClosedLoopStatus.put("notificationTime", new Date().toISOString());
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js
new file mode 100644
index 000000000..435d6d735
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/GetVCPEStateTask.js
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var uuidType = Java.type("java.util.UUID");
+var longType = Java.type("java.lang.Long");
+
+var requestID = uuidType.fromString(executor.inFields.get("requestID"));
+var vnfID = uuidType.fromString(executor.inFields.get("AAI").get("generic_DasH_vnf_DoT_vnf_DasH_id"));
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID);
+
+if (vcpeClosedLoopStatus == null) {
+ executor.logger.info("Creating context information for new vCPE VNF \"" + vnfID.toString() + "\"");
+
+ vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").getSchemaHelper().createNewInstance();
+
+ vcpeClosedLoopStatus.put("AAI", executor.inFields.get("AAI"));
+ vcpeClosedLoopStatus.put("closedLoopControlName", executor.inFields.get("closedLoopControlName"));
+ vcpeClosedLoopStatus.put("closedLoopAlarmStart", executor.inFields.get("closedLoopAlarmStart"));
+ vcpeClosedLoopStatus.put("closedLoopEventClient", executor.inFields.get("closedLoopEventClient"));
+ vcpeClosedLoopStatus.put("closedLoopEventStatus", executor.inFields.get("closedLoopEventStatus"));
+ vcpeClosedLoopStatus.put("version", executor.inFields.get("version"));
+ vcpeClosedLoopStatus.put("requestID", executor.inFields.get("requestID"));
+ vcpeClosedLoopStatus.put("target_type", executor.inFields.get("target_type"));
+ vcpeClosedLoopStatus.put("target", executor.inFields.get("target"));
+ vcpeClosedLoopStatus.put("from", executor.inFields.get("from"));
+ vcpeClosedLoopStatus.put("policyScope", "vCPE");
+ vcpeClosedLoopStatus.put("policyName", "ONAPvCPEPolicyModel");
+ vcpeClosedLoopStatus.put("policyVersion", "0.0.1");
+ vcpeClosedLoopStatus.put("notification", "");
+ vcpeClosedLoopStatus.put("notificationTime", "");
+
+ if (executor.inFields.get("closedLoopAlarmEnd") != null) {
+ vcpeClosedLoopStatus.put("closedLoopAlarmEnd", executor.inFields.get("closedLoopAlarmEnd"));
+ } else {
+ vcpeClosedLoopStatus.put("closedLoopAlarmEnd", longType.valueOf(0));
+ }
+
+ executor.getContextAlbum("VCPEClosedLoopStatusAlbum").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);
+
+returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js
new file mode 100644
index 000000000..f3c0c45cd
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/GuardRequestTask.js
@@ -0,0 +1,44 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+var guardDecisionAttributes = executor.subject.getOutFieldSchemaHelper("decisionAttributes").createNewInstance();
+
+guardDecisionAttributes.put("actor", "APPC");
+guardDecisionAttributes.put("recipe", "Restart");
+guardDecisionAttributes.put("target", executor.inFields.get("vnfID").toString());
+guardDecisionAttributes.put("clname", "APEXvCPEImplementation");
+
+executor.logger.info(guardDecisionAttributes);
+
+executor.outFields.put("decisionAttributes", guardDecisionAttributes);
+executor.outFields.put("onapName", "APEX");
+
+executor.getContextAlbum("ControlLoopExecutionIDAlbum").put(executor.executionID.toString(),
+ executor.inFields.get("vnfID"));
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE; \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js
new file mode 100644
index 000000000..df98c25f4
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/GuardResponseTask.js
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vnfID = executor.getContextAlbum("ControlLoopExecutionIDAlbum").remove(executor.executionID.toString());
+
+executor.logger.info("Continuing execution with VNF ID: " + vnfID);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID.toString());
+executor.logger.info(vcpeClosedLoopStatus);
+
+var guardResult = executor.inFields.get("decision");
+
+if (guardResult === "PERMIT") {
+ vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_PERMIT");
+} else if (guardResult === "DENY") {
+ vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_DENY");
+} else {
+ executor.message = "guard result must be either \"PERMIT\" or \"DENY\"";
+ returnValue = executor.FALSE;
+}
+
+var uuidType = Java.type("java.util.UUID");
+var requestID = uuidType.fromString(vcpeClosedLoopStatus.get("requestID"));
+
+executor.outFields.put("requestID", requestID);
+executor.outFields.put("vnfID", vnfID);
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js
new file mode 100644
index 000000000..0c088078f
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/NoAAILookupTask.js
@@ -0,0 +1,26 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+executor.logger.info(executor.outFields);
+
+var returnValue = executor.TRUE;
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyAAILookupStateTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyAAILookupStateTSL.js
new file mode 100644
index 000000000..7bbfcd9ca
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyAAILookupStateTSL.js
@@ -0,0 +1,46 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var returnValue = executor.TRUE;
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+var aaiInfo = vcpeClosedLoopStatus.get("AAI");
+
+executor.logger.info(aaiInfo);
+
+if (aaiInfo.get("generic_DasH_vnf.resource_DasH_version") != null
+ && aaiInfo.get("generic_DasH_vnf.vnf_DasH_name") != null
+ && aaiInfo.get("generic_DasH_vnf.prov_DasH_status") != null
+ && aaiInfo.get("generic_DasH_vnf.is_DasH_closed_DasH_loop_DasH_disabled") != null
+ && aaiInfo.get("generic_DasH_vnf.orchestration_DasH_status") != null
+ && aaiInfo.get("generic_DasH_vnf.vnf_DasH_type") != null
+ && aaiInfo.get("generic_DasH_vnf.in_DasH_maint") != null
+ && aaiInfo.get("generic_DasH_vnf.service_DasH_id") != null
+ && aaiInfo.get("generic_DasH_vnf.vnf_DasH_id") != null) {
+ executor.subject.getTaskKey("AAILookupRequestTask").copyTo(executor.selectedTask);
+} else {
+ executor.subject.getTaskKey("NoAAILookupTask").copyTo(executor.selectedTask);
+}
+
+executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js
new file mode 100644
index 000000000..3fea4a025
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js
@@ -0,0 +1,43 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var returnValue = executor.TRUE;
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+var status = vcpeClosedLoopStatus.get("closedLoopEventStatus");
+
+var returnValue = executor.TRUE;
+
+if (status === "ONSET") {
+ executor.subject.getTaskKey("GuardRequestTask").copyTo(executor.selectedTask);
+} else if (status === "ABATED") {
+ executor.subject.getTaskKey("AbatedTask").copyTo(executor.selectedTask);
+ onsetFlag = executor.FALSE;
+} else {
+ executor.message = "closedLoopEventStatus must be either \"ONSET\" or \"ABATED\"";
+ returnValue = executor.FALSE;
+}
+
+executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js b/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js
new file mode 100644
index 000000000..b1b6420cb
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js
@@ -0,0 +1,37 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+executor.logger.info(executor.subject.id);
+executor.logger.info(executor.inFields);
+
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
+
+var guardResult = vcpeClosedLoopStatus.get("notification");
+
+if (guardResult === "OPERATION: GUARD_PERMIT") {
+ executor.subject.getTaskKey("APPCRestartVNFRequestTask").copyTo(executor.selectedTask);
+} else {
+ executor.subject.getTaskKey("DeniedTask").copyTo(executor.selectedTask);
+}
+
+executor.logger.info("RestartAPPCRequestPolicyPermitOrDenyTSL State Selected Task:" + executor.selectedTask);
+
+var returnValue = executor.TRUE;