diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-07-25 13:56:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-07-25 13:56:20 +0000 |
commit | dccf9a9e0758be0a926c94bf1599ee625066100d (patch) | |
tree | cae6ba9c95fb6425ef6f796a7b746511c6c159a4 /examples/examples-onap-vcpe/src/main/resources | |
parent | 79ae3f7f229db52b8ab18c405c5109f8d18db1b6 (diff) | |
parent | d524cedc578ae1bfa3bae895b3170f87463cbed9 (diff) |
Merge "Adding more examples to apex-pdp"
Diffstat (limited to 'examples/examples-onap-vcpe/src/main/resources')
24 files changed, 1539 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; diff --git a/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex new file mode 100644 index 000000000..22d0ddae0 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex @@ -0,0 +1,320 @@ +#------------------------------------------------------------------------------- +# ============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========================================================= +#------------------------------------------------------------------------------- + +model create name=ONAPvCPEPolicyModel + +schema create name=SimpleStringType flavour=Java schema=java.lang.String +schema create name=SimpleLongType flavour=Java schema=java.lang.Long +schema create name=SimpleBooleanType flavour=Java schema=java.lang.Boolean +schema create name=UUIDType flavour=Java schema=java.util.UUID + +schema create name=VCPEAAIInfoType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/VCPEAAIInfoType.avsc" +LE + +schema create name=GuardDecisionAttributesType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/GuardDecisionAttributesType.avsc" +LE + +schema create name=APPCInputBodyType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/APPCInputBodyType.avsc" +LE + +schema create name=APPCOutputBodyType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/APPCOutputBodyType.avsc" +LE + +schema create name=VCPEClosedLoopStatusType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/VCPEClosedLoopStatusType.avsc" +LE + +album create name=VCPEClosedLoopStatusAlbum scope=policy writable=true schemaName=VCPEClosedLoopStatusType + +album create name=ControlLoopExecutionIDAlbum scope=policy writable=true schemaName=UUIDType + +album create name=RequestIDVNFIDAlbum scope=policy writable=true schemaName=UUIDType + +event create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 version=1.0.2 nameSpace=org.onap.policy.apex.onap.vcpe source=DCAE target=APEX + +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopControlName schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopAlarmStart schemaName=SimpleLongType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopEventClient schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=closedLoopEventStatus schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=requestID schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=target_type schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=target schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=from schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=version schemaName=SimpleStringType +event parameter create name=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 parName=AAI schemaName=VCPEAAIInfoType + +event create name=VCPEStateUpdatedEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=VCPEStateUpdatedEvent parName=requestID schemaName=UUIDType +event parameter create name=VCPEStateUpdatedEvent parName=vnfID schemaName=UUIDType + +event create name=GuardRequestEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=GuardRequestEvent parName=decisionAttributes schemaName=GuardDecisionAttributesType +event parameter create name=GuardRequestEvent parName=onapName schemaName=SimpleStringType + +event create name=GuardResponseEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=GuardResponseEvent parName=decision schemaName=SimpleStringType +event parameter create name=GuardResponseEvent parName=details schemaName=SimpleStringType + +event create name=APPCRestartVNFRequestEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APPC + +event parameter create name=APPCRestartVNFRequestEvent parName=body schemaName=APPCInputBodyType +event parameter create name=APPCRestartVNFRequestEvent parName=version schemaName=SimpleStringType +event parameter create name=APPCRestartVNFRequestEvent parName=rpc-name schemaName=SimpleStringType +event parameter create name=APPCRestartVNFRequestEvent parName=correlation-id schemaName=SimpleStringType +event parameter create name=APPCRestartVNFRequestEvent parName=type schemaName=SimpleStringType + +event create name=APPCRestartVNFResponseEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APPC + +event parameter create name=APPCRestartVNFResponseEvent parName=body schemaName=APPCOutputBodyType +event parameter create name=APPCRestartVNFResponseEvent parName=version schemaName=SimpleStringType +event parameter create name=APPCRestartVNFResponseEvent parName=rpc-name schemaName=SimpleStringType +event parameter create name=APPCRestartVNFResponseEvent parName=correlation-id schemaName=SimpleStringType +event parameter create name=APPCRestartVNFResponseEvent parName=type schemaName=SimpleStringType + +event create name=ControlLoopLogEvent nameSpace=org.onap.policy.apex.onap.vcpe source=APEX target=APEX + +event parameter create name=ControlLoopLogEvent parName=AAI schemaName=VCPEAAIInfoType +event parameter create name=ControlLoopLogEvent parName=closedLoopControlName schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=closedLoopAlarmStart schemaName=SimpleLongType +event parameter create name=ControlLoopLogEvent parName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +event parameter create name=ControlLoopLogEvent parName=closedLoopEventClient schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=closedLoopEventStatus schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=version schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=requestID schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=target_type schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=target schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=from schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=policyScope schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=policyName schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=policyVersion schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=notification schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=message schemaName=SimpleStringType +event parameter create name=ControlLoopLogEvent parName=notificationTime schemaName=SimpleStringType + +task create name=GetVCPEStateTask + +task inputfield create name=GetVCPEStateTask fieldName=closedLoopControlName schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=closedLoopAlarmStart schemaName=SimpleLongType +task inputfield create name=GetVCPEStateTask fieldName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +task inputfield create name=GetVCPEStateTask fieldName=closedLoopEventClient schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=closedLoopEventStatus schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=requestID schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=target_type schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=target schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=from schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=version schemaName=SimpleStringType +task inputfield create name=GetVCPEStateTask fieldName=AAI schemaName=VCPEAAIInfoType + +task contextref create name=GetVCPEStateTask albumName=VCPEClosedLoopStatusAlbum + +task outputfield create name=GetVCPEStateTask fieldName=requestID schemaName=UUIDType +task outputfield create name=GetVCPEStateTask fieldName=vnfID schemaName=UUIDType + +task logic create name=GetVCPEStateTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/GetVCPEStateTask.js" +LE + +task create name=AbatedTask + +task inputfield create name=AbatedTask fieldName=requestID schemaName=UUIDType +task inputfield create name=AbatedTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=AbatedTask fieldName=requestID schemaName=UUIDType +task outputfield create name=AbatedTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=AbatedTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=AbatedTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/AbatedTask.js" +LE + +task create name=GuardRequestTask + +task inputfield create name=GuardRequestTask fieldName=requestID schemaName=UUIDType +task inputfield create name=GuardRequestTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=GuardRequestTask fieldName=decisionAttributes schemaName=GuardDecisionAttributesType +task outputfield create name=GuardRequestTask fieldName=onapName schemaName=SimpleStringType + +task contextref create name=GuardRequestTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=GuardRequestTask albumName=ControlLoopExecutionIDAlbum + +task logic create name=GuardRequestTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/GuardRequestTask.js" +LE + +task create name=GuardResponseTask + +task inputfield create name=GuardResponseTask fieldName=decision schemaName=SimpleStringType +task inputfield create name=GuardResponseTask fieldName=details schemaName=SimpleStringType + +task outputfield create name=GuardResponseTask fieldName=requestID schemaName=UUIDType +task outputfield create name=GuardResponseTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=GuardResponseTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=GuardResponseTask albumName=ControlLoopExecutionIDAlbum + +task logic create name=GuardResponseTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/GuardResponseTask.js" +LE + +task create name=DeniedTask + +task inputfield create name=DeniedTask fieldName=requestID schemaName=UUIDType +task inputfield create name=DeniedTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=DeniedTask fieldName=requestID schemaName=UUIDType +task outputfield create name=DeniedTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=DeniedTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=DeniedTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/DeniedTask.js" +LE + +task create name=APPCRestartVNFRequestTask + +task inputfield create name=APPCRestartVNFRequestTask fieldName=requestID schemaName=UUIDType +task inputfield create name=APPCRestartVNFRequestTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=APPCRestartVNFRequestTask fieldName=body schemaName=APPCInputBodyType +task outputfield create name=APPCRestartVNFRequestTask fieldName=version schemaName=SimpleStringType +task outputfield create name=APPCRestartVNFRequestTask fieldName=rpc-name schemaName=SimpleStringType +task outputfield create name=APPCRestartVNFRequestTask fieldName=correlation-id schemaName=SimpleStringType +task outputfield create name=APPCRestartVNFRequestTask fieldName=type schemaName=SimpleStringType + +task contextref create name=APPCRestartVNFRequestTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=APPCRestartVNFRequestTask albumName=RequestIDVNFIDAlbum + +task logic create name=APPCRestartVNFRequestTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/APPCRestartVNFRequestTask.js" +LE + +task create name=APPCRestartVNFResponseTask + +task inputfield create name=APPCRestartVNFResponseTask fieldName=body schemaName=APPCOutputBodyType +task inputfield create name=APPCRestartVNFResponseTask fieldName=version schemaName=SimpleStringType +task inputfield create name=APPCRestartVNFResponseTask fieldName=rpc-name schemaName=SimpleStringType +task inputfield create name=APPCRestartVNFResponseTask fieldName=correlation-id schemaName=SimpleStringType +task inputfield create name=APPCRestartVNFResponseTask fieldName=type schemaName=SimpleStringType + +task outputfield create name=APPCRestartVNFResponseTask fieldName=requestID schemaName=UUIDType +task outputfield create name=APPCRestartVNFResponseTask fieldName=vnfID schemaName=UUIDType + +task contextref create name=APPCRestartVNFResponseTask albumName=VCPEClosedLoopStatusAlbum +task contextref create name=APPCRestartVNFResponseTask albumName=RequestIDVNFIDAlbum + +task logic create name=APPCRestartVNFResponseTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/APPCRestartVNFResponseTask.js" +LE + +task create name=ControlLoopLogTask + +task inputfield create name=ControlLoopLogTask fieldName=requestID schemaName=UUIDType +task inputfield create name=ControlLoopLogTask fieldName=vnfID schemaName=UUIDType + +task outputfield create name=ControlLoopLogTask fieldName=AAI schemaName=VCPEAAIInfoType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopControlName schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopAlarmStart schemaName=SimpleLongType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true +task outputfield create name=ControlLoopLogTask fieldName=closedLoopEventClient schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=closedLoopEventStatus schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=requestID schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=version schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=target_type schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=target schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=from schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=policyScope schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=policyName schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=policyVersion schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=notification schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=message schemaName=SimpleStringType +task outputfield create name=ControlLoopLogTask fieldName=notificationTime schemaName=SimpleStringType + +task contextref create name=ControlLoopLogTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=ControlLoopLogTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/ControlLoopLogTask.js" +LE + +policy create name=ReceiveEventPolicy template=Freestyle firstState=GetVCPEState + +policy state create name=ReceiveEventPolicy stateName=AbatedState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask +policy state output create name=ReceiveEventPolicy stateName=AbatedState outputName=AbatedOutput eventName=ControlLoopLogEvent +policy state taskref create name=ReceiveEventPolicy stateName=AbatedState taskName=ControlLoopLogTask outputType=DIRECT outputName=AbatedOutput + +policy state create name=ReceiveEventPolicy stateName=OnsetOrAbatedState triggerName=VCPEStateUpdatedEvent defaultTaskName=AbatedTask +policy state output create name=ReceiveEventPolicy stateName=OnsetOrAbatedState outputName=OnsetOutput eventName=GuardRequestEvent +policy state taskref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState taskName=GuardRequestTask outputType=DIRECT outputName=OnsetOutput +policy state output create name=ReceiveEventPolicy stateName=OnsetOrAbatedState outputName=AbatedOutput eventName=VCPEStateUpdatedEvent nextState=AbatedState +policy state taskref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState taskName=AbatedTask outputType=DIRECT outputName=AbatedOutput + +policy state contextref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState albumName=VCPEClosedLoopStatusAlbum + +policy state selecttasklogic create name=ReceiveEventPolicy stateName=OnsetOrAbatedState logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js" +LE + +policy state create name=ReceiveEventPolicy stateName=GetVCPEState triggerName=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 defaultTaskName=GetVCPEStateTask +policy state output create name=ReceiveEventPolicy stateName=GetVCPEState outputName=GetVCPEStateOutput eventName=VCPEStateUpdatedEvent nextState=OnsetOrAbatedState +policy state taskref create name=ReceiveEventPolicy stateName=GetVCPEState taskName=GetVCPEStateTask outputType=DIRECT outputName=GetVCPEStateOutput + +policy create name=RestartAPPCRequestPolicy template=Freestyle firstState=PolicyGuardResponseState + +policy state create name=RestartAPPCRequestPolicy stateName=DeniedState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask +policy state output create name=RestartAPPCRequestPolicy stateName=DeniedState outputName=DeniedOutput eventName=ControlLoopLogEvent +policy state taskref create name=RestartAPPCRequestPolicy stateName=DeniedState taskName=ControlLoopLogTask outputType=DIRECT outputName=DeniedOutput + +policy state create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState triggerName=VCPEStateUpdatedEvent defaultTaskName=DeniedTask +policy state output create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState outputName=PermitOutput eventName=APPCRestartVNFRequestEvent +policy state taskref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState taskName=APPCRestartVNFRequestTask outputType=DIRECT outputName=PermitOutput +policy state output create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState outputName=DenyOutput eventName=VCPEStateUpdatedEvent nextState=DeniedState +policy state taskref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState taskName=DeniedTask outputType=DIRECT outputName=DenyOutput + +policy state create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState triggerName=GuardResponseEvent defaultTaskName=GuardResponseTask +policy state output create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState outputName=GuardResponseOutput eventName=VCPEStateUpdatedEvent nextState=PermitOrDenyState +policy state taskref create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState taskName=GuardResponseTask outputType=DIRECT outputName=GuardResponseOutput + +policy state contextref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState albumName=VCPEClosedLoopStatusAlbum + +policy state selecttasklogic create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js" +LE + +policy create name=RestartAPPCResponsePolicy template=Freestyle firstState=RestartAPPCResponseState + +policy state create name=RestartAPPCResponsePolicy stateName=ResponseLogState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask +policy state output create name=RestartAPPCResponsePolicy stateName=ResponseLogState outputName=ResponseLogOutput eventName=ControlLoopLogEvent +policy state taskref create name=RestartAPPCResponsePolicy stateName=ResponseLogState taskName=ControlLoopLogTask outputType=DIRECT outputName=ResponseLogOutput + +policy state create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState triggerName=APPCRestartVNFResponseEvent defaultTaskName=APPCRestartVNFResponseTask +policy state output create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState outputName=APPCRestartVNFResponseOutput eventName=VCPEStateUpdatedEvent nextState=ResponseLogState +policy state taskref create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState taskName=APPCRestartVNFResponseTask outputType=DIRECT outputName=APPCRestartVNFResponseOutput + +validate + diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInstanceFiltersType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInstanceFiltersType.avsc new file mode 100644 index 000000000..621372d2f --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInstanceFiltersType.avsc @@ -0,0 +1,30 @@ +{ + "type": "record", + "name": "AAIInstanceFilters_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "type": "record", + "name": "instance_DasH_filters", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "instance_DasH_filter", + "type": { + "type": "array", + "items": { + "type": "record", + "name": "generic_DasH_vnf", + "fields": [ + { + "name": "vnf_DasH_id", + "type": "string" + } + ] + } + } + } + ] + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInventoryResponseItemType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInventoryResponseItemType.avsc new file mode 100644 index 000000000..e64d0e36a --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/AAIInventoryResponseItemType.avsc @@ -0,0 +1,70 @@ +{ + "type": "array", + "items": { + "type": "record", + "name": "AAIInventoryResponseItem_Type", + "fields": [ + { + "name": "model_DasH_name", + "type": "string" + }, + { + "name": "extra_DasH_properties", + "type": { + "type": "record", + "name": "AAIInventoryResponseItemExtraProperties_Type", + "fields": [] + } + }, + { + "name": "generic_DasH_vnf", + "type": { + "type": "record", + "name": "AAIInventoryResponseItemGenericVNF_Type", + "fields": [ + { + "name": "vnf_DasH_id", + "type": "string" + }, + { + "name": "vnf_DasH_name", + "type": "string" + }, + { + "name": "vnf_DasH_type", + "type": "string" + }, + { + "name": "service_DasH_id", + "type": "string" + }, + { + "name": "orchestration_DasH_status", + "type": "string" + }, + { + "name": "in_DasH_maint", + "type": "boolean" + }, + { + "name": "is_DasH_closed_DasH_loop_DasH_disabled", + "type": "boolean" + }, + { + "name": "resource_DasH_version", + "type": "string" + }, + { + "name": "model_DasH_invariant_DasH_id", + "type": "string" + }, + { + "name": "model_DasH_version_DasH_id", + "type": "string" + } + ] + } + } + ] + } +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/AAINamedQueryType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/AAINamedQueryType.avsc new file mode 100644 index 000000000..ffa3ca534 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/AAINamedQueryType.avsc @@ -0,0 +1,11 @@ +{ + "type": "record", + "name": "AAINamedQuery_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "named_DasH_query_DasH_uuid", + "type": "string" + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/APPCInputBodyType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCInputBodyType.avsc new file mode 100644 index 000000000..3acf96e7f --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCInputBodyType.avsc @@ -0,0 +1,76 @@ +{ + "type" : "record", + "name" : "APPCInputBody_Type", + "namespace" : "org.onap.policy.apex.onap.vcpe", + "fields" : [ + { + "name": "input", + "type": { + "type" : "record", + "name" : "InputRecord", + "fields" : [ + { + "name": "action", "type": "string" + }, + { + "name": "action_DasH_identifiers", + "type": { + "type" : "record", + "name" : "ActionIdentifiersRecord", + "fields" : [ + { + "name": "vnf_DasH_id", "type": "string" + } + ] + } + }, + { + "name": "common_DasH_header", + "type": { + "type" : "record", + "name" : "InputCommonHeaderRecord", + "fields" : [ + { + "name": "request_DasH_id", "type": "string" + }, + { + "name": "originator_DasH_id", "type": "string" + }, + { + "name": "api_DasH_ver", "type": "string" + }, + { + "name": "sub_DasH_request_DasH_id", "type": "string" + }, + { + "name": "timestamp", "type": "string" + }, + { + "name": "flags", + "type": { + "type" : "record", + "name" : "FlagsRecord", + "fields" : [ + { + "name": "ttl", "type": "string" + }, + { + "name": "force", "type": "string" + }, + { + "name": "mode", "type": "string" + } + ] + } + } + ] + } + }, + { + "name": "payload", "type": "string" + } + ] + } + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/APPCOutputBodyType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCOutputBodyType.avsc new file mode 100644 index 000000000..2c110170a --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/APPCOutputBodyType.avsc @@ -0,0 +1,55 @@ +{ + "type" : "record", + "name" : "APPCOutputBody_Type", + "namespace" : "org.onap.policy.apex.onap.vcpe", + "fields" : [ + { + "name": "output", + "type": { + "type" : "record", + "name" : "OutputRecord", + "fields" : [ + { + "name": "status", + "type": { + "type" : "record", + "name" : "StatusRecord", + "fields" : [ + { + "name": "code", "type": "int" + }, + { + "name": "message", "type": "string" + } + ] + } + }, + { + "name": "common_DasH_header", + "type": { + "type" : "record", + "name" : "OutputCommonHeaderRecord", + "fields" : [ + { + "name": "request_DasH_id", "type": "string" + }, + { + "name": "originator_DasH_id", "type": "string" + }, + { + "name": "api_DasH_ver", "type": "string" + }, + { + "name": "sub_DasH_request_DasH_id", "type": "string" + }, + { + "name": "timestamp", "type": "string" + } + ] + } + } + ] + } + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/GuardDecisionAttributesType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/GuardDecisionAttributesType.avsc new file mode 100644 index 000000000..bc25955fa --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/GuardDecisionAttributesType.avsc @@ -0,0 +1,23 @@ +{ + "type": "record", + "name": "GuardDecisionAttributes_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "actor", + "type": "string" + }, + { + "name": "recipe", + "type": "string" + }, + { + "name": "target", + "type": "string" + }, + { + "name": "clname", + "type": "string" + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEAAIInfoType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEAAIInfoType.avsc new file mode 100644 index 000000000..ff7cad18a --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEAAIInfoType.avsc @@ -0,0 +1,43 @@ +{ + "type": "record", + "name": "AAI_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] +} diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc new file mode 100644 index 000000000..e628c23d9 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc @@ -0,0 +1,112 @@ +{ + "type": "record", + "name": "VCPEClosedLoopStatus", + "fields": [ + { + "name": "AAI", + "type": { + "type": "record", + "name": "VCPE_AAI_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] + } + }, + { + "name": "closedLoopAlarmStart", + "type": "long" + }, + { + "name": "closedLoopAlarmEnd", + "type": "long" + }, + { + "name": "closedLoopControlName", + "type": "string" + }, + { + "name": "version", + "type": "string" + }, + { + "name": "requestID", + "type": "string" + }, + { + "name": "closedLoopEventClient", + "type": "string" + }, + { + "name": "closedLoopEventStatus", + "type": "string" + }, + { + "name": "target_type", + "type": "string" + }, + { + "name": "target", + "type": "string" + }, + { + "name": "from", + "type": "string" + }, + { + "name": "policyScope", + "type": "string" + }, + { + "name": "policyName", + "type": "string" + }, + { + "name": "policyVersion", + "type": "string" + }, + { + "name": "notification", + "type": "string" + }, + { + "name": "notificationTime", + "type": "string" + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusTypeWithHistory.avsc b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusTypeWithHistory.avsc new file mode 100644 index 000000000..9b76f9440 --- /dev/null +++ b/examples/examples-onap-vcpe/src/main/resources/schemas/VCPEClosedLoopStatusTypeWithHistory.avsc @@ -0,0 +1,152 @@ +{ + "type": "record", + "name": "VCPEClosedLoopStatus", + "fields": [ + { + "name": "AAI", + "type": { + "type": "record", + "name": "VCPE_AAI_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] + } + }, + { + "name": "closedLoopAlarmStart", + "type": "long" + }, + { + "name": "closedLoopControlName", + "type": "string" + }, + { + "name": "version", + "type": "string" + }, + { + "name": "requestID", + "type": "string" + }, + { + "name": "closedLoopEventClient", + "type": "string" + }, + { + "name": "closedLoopEventStatus", + "type": "string" + }, + { + "name": "target_type", + "type": "string" + }, + { + "name": "target", + "type": "string" + }, + { + "name": "from", + "type": "string" + }, + { + "name": "policyScope", + "type": "string" + }, + { + "name": "policyName", + "type": "string" + }, + { + "name": "policyVersion", + "type": "string" + }, + { + "name": "notification", + "type": "string" + }, + { + "name": "history", + "type": [ + { + "type": "record", + "name": "VCPE_History_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "generic_DasH_vnf_DoT_resource_DasH_version", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_name", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_prov_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_is_DasH_closed_DasH_loop_DasH_disabled", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_orchestration_DasH_status", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_type", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_in_DasH_maint", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_service_DasH_id", + "type": "string" + }, + { + "name": "generic_DasH_vnf_DoT_vnf_DasH_id", + "type": "string" + } + ] + } + ] + } + ] +}
\ No newline at end of file |