diff options
author | ramverma <ram.krishna.verma@ericsson.com> | 2018-07-24 17:36:53 +0100 |
---|---|---|
committer | ramverma <ram.krishna.verma@ericsson.com> | 2018-07-25 11:47:15 +0100 |
commit | d524cedc578ae1bfa3bae895b3170f87463cbed9 (patch) | |
tree | 0740644e356534f770d59ff34f16e5d9ca601276 /examples/examples-onap-vcpe | |
parent | 41ecf036b7f1b3bdd56311a0bc706407b242faca (diff) |
Adding more examples to apex-pdp
- Adding more examples (DecisionMaker, Periodic & ONAPvCPE) to apex-pdp.
- Fixed CORS issue in plugin-event-carrier-restserver module.
Added a ContainerResponseFilter to intercept every request/response coming to
REST server and add the required headers to support CORS.
Change-Id: Ic3e36c683f2a78992ce1417d2c00233b34066f2f
Issue-ID: POLICY-861
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'examples/examples-onap-vcpe')
43 files changed, 2709 insertions, 0 deletions
diff --git a/examples/examples-onap-vcpe/pom.xml b/examples/examples-onap-vcpe/pom.xml new file mode 100644 index 000000000..2fa531529 --- /dev/null +++ b/examples/examples-onap-vcpe/pom.xml @@ -0,0 +1,85 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 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========================================================= +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>examples-onap-vcpe</artifactId> + <name>${project.artifactId}</name> + <description>Specific code for the APEX ONAP vCPE Example</description> + + <properties> + <policymodel.name>ONAPvCPEPolicyModel</policymodel.name> + <apex-domains-onap-vcpe-dir>${project.basedir}/src</apex-domains-onap-vcpe-dir> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.policy.apex-pdp.auth</groupId> + <artifactId>cli-editor</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.services</groupId> + <artifactId>services-engine</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-grizzly2-http</artifactId> + <version>${version.jersey}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Generate the APEX Policy JSON from the APEX CLI command --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-policy</id> + <phase>compile</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain</mainClass> + <classpathScope>compile</classpathScope> + <arguments> + <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> + <argument>--output-model-file=${project.build.directory}/classes/${policymodel.name}.json</argument> + <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument> + <argument>--working-dir=${project.basedir}</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file 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 diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java new file mode 100644 index 000000000..a821462f6 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java @@ -0,0 +1,59 @@ +/*- + * ============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========================================================= + */ + +package org.onap.policy.apex.domains.onap.vcpe; + +import java.net.URI; + +import org.glassfish.grizzly.http.server.HttpServer; +import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; +import org.glassfish.jersey.server.ResourceConfig; +import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; + +public class AAIAndGuardSim { + private static final String BASE_URI = "http://192.168.144.235:54321/AAIAndGuardSim"; + private HttpServer server; + + public AAIAndGuardSim() { + final ResourceConfig rc = new ResourceConfig(AAIAndGuardSimEndpoint.class); + server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc); + + while (!server.isStarted()) { + ThreadUtilities.sleep(50); + } + } + + public void tearDown() throws Exception { + server.shutdown(); + } + + public static void main(final String[] args) throws Exception { + final AAIAndGuardSim sim = new AAIAndGuardSim(); + + while (true) { + try { + Thread.sleep(100); + } catch (final InterruptedException e) { + break; + } + } + sim.tearDown(); + } +} diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java new file mode 100644 index 000000000..6c7f7db19 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java @@ -0,0 +1,137 @@ +/*- + * ============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========================================================= + */ + +package org.onap.policy.apex.domains.onap.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import com.google.gson.Gson; + +import java.util.Map; +import java.util.Random; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.core.Response; + + +@Path("/sim") +public class AAIAndGuardSimEndpoint { + + private static int postMessagesReceived = 0; + private static int putMessagesReceived = 0; + private static int statMessagesReceived = 0; + private static int getMessagesReceived = 0; + + @Path("/pdp/api/Stats") + @GET + public Response serviceGetStats() { + statMessagesReceived++; + return Response.status(200).entity("{\"GET\": " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived + + ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); + } + + @Path("/pdp/api/getDecision") + @POST + public Response serviceGuardPostRequest(final String jsonString) { + postMessagesReceived++; + + if (postMessagesReceived % 2 == 0) { + return Response.status(200).entity("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}") + .build(); + } else { + return Response.status(200).entity("{\"decision\": \"DENY\", \"details\": \"Decision Denied. NOK :-(\"}") + .build(); + } + } + + @Path("/event/GetEvent") + @GET + public Response serviceGetEvent() { + final Random rand = new Random(); + final int nextMatchCase = rand.nextInt(4); + final String nextEventName = "Event0" + rand.nextInt(2) + "00"; + + final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.sample.events\",\n" + "\"name\": \"" + + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_" + getMessagesReceived + + "\",\n" + "\"target\": \"apex\",\n" + "\"TestSlogan\": \"Test slogan for External Event0\",\n" + + "\"TestMatchCase\": " + nextMatchCase + ",\n" + "\"TestTimestamp\": " + System.currentTimeMillis() + + ",\n" + "\"TestTemperature\": 9080.866\n" + "}"; + + getMessagesReceived++; + + return Response.status(200).entity(eventString).build(); + } + + @Path("/event/GetEmptyEvent") + @GET + public Response serviceGetEmptyEvent() { + return Response.status(200).build(); + } + + @Path("/event/GetEventBadResponse") + @GET + public Response serviceGetEventBadResponse() { + return Response.status(400).build(); + } + + @Path("/event/PostEvent") + @POST + public Response servicePostRequest(final String jsonString) { + postMessagesReceived++; + + @SuppressWarnings("unchecked") + final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class); + assertTrue(jsonMap.containsKey("name")); + assertEquals("0.0.1", jsonMap.get("version")); + assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace")); + assertEquals("Act", jsonMap.get("source")); + assertEquals("Outside", jsonMap.get("target")); + + return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived + + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); + } + + @Path("/event/PostEventBadResponse") + @POST + public Response servicePostRequestBadResponse(final String jsonString) { + return Response.status(400).build(); + } + + @Path("/event/PutEvent") + @PUT + public Response servicePutRequest(final String jsonString) { + putMessagesReceived++; + + @SuppressWarnings("unchecked") + final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class); + assertTrue(jsonMap.containsKey("name")); + assertEquals("0.0.1", jsonMap.get("version")); + assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace")); + assertEquals("Act", jsonMap.get("source")); + assertEquals("Outside", jsonMap.get("target")); + + return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived + + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); + } +} diff --git a/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json b/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json new file mode 100644 index 000000000..f2ffdf079 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json @@ -0,0 +1,88 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "policy/ONAPTLGoalPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + }, + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters": { + "Avro": { + "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + } + } + } + } + }, + "eventInputParameters": { + "VCPEInitConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "src/main/resources/config/VCPEInitiationEvents.txt" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "closedLoopControlName", + "versionAlias": "version", + "sourceAlias": "from" + } + } + }, + "GuardRequestorConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters", + "parameters": { + "url": "http://localhost:54321/AAIAndGuardSim/sim/pdp/api/getDecision", + "httpMethod": "POST", + "restRequestTimeout": 2000 + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "GuardResponseEvent", + "eventNameFilter": "GuardResponseEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorProducer", + "requestorTimeout": 500 + } + }, + "eventOutputParameters": { + "GuardRequestorProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "GuardRequestEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorConsumer", + "requestorTimeout": 500 + }, + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/VCPEEventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json b/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json new file mode 100644 index 000000000..2d2005d98 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json @@ -0,0 +1,22 @@ +{ + "body": { + "output": { + "common-header": { + "timestamp": "2017-08-25T21:06:23.037Z", + "api-ver": "5.00", + "originator-id": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "request-id": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 400, + "message": "Restart Successful" + } + } + }, + "version": "2.0", + "rpc-name": "restart", + "correlation-id": "664be3d2-6c12-4f4b-a3e7-c349acced200-1", + "type": "response" +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json new file mode 100644 index 000000000..729451191 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json @@ -0,0 +1,16 @@ +{ + "closedLoopControlName": "${closedLoopControlName}", + "closedLoopAlarmStart": 1463679805324, + "closedLoopAlarmEnd": 1463699805324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ABATED", + "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "vserver.is-closed-loop-disabled": "false", + "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json new file mode 100644 index 000000000..feb15c153 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json @@ -0,0 +1,15 @@ +{ + "closedLoopControlName": "${closedLoopControlName}", + "closedLoopAlarmStart": 1463679805324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "vserver.is-closed-loop-disabled": "false", + "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json new file mode 100644 index 000000000..46b5dbe73 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json @@ -0,0 +1,16 @@ +{ + "query-parameters": { + "named-query": { + "named-query-uuid": "a93ac487-409c-4e8c-9e5f-334ae8f99087" + } + }, + "instance-filters": { + "instance-filter": [ + { + "generic-vnf": { + "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb" + } + } + ] + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json new file mode 100644 index 000000000..5bcff1b4b --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json @@ -0,0 +1,76 @@ +{ + "inventory-response-item": [ + { + "model-name": "service-instance", + "generic-vnf": { + "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb", + "vnf-name": "ZRDM2MMEX39", + "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1503082370097", + "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4", + "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "service-instance", + "service-instance": { + "service-instance-id": "37b8cdb7-94eb-468f-a0c2-4e3c3546578e", + "service-instance-name": "Changed Service Instance NAME", + "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4", + "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9", + "resource-version": "1503082993532", + "orchestration-status": "Active" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "pnf", + "generic-vnf": { + "vnf-id": "jimmy-test", + "vnf-name": "jimmy-test-vnf", + "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1504013830207", + "model-invariant-id": "862b25a1-262a-4961-bdaa-cdc55d69785a", + "model-version-id": "e9f1fa7d-c839-418a-9601-03dc0d2ad687" + }, + "extra-properties": { + } + }, + { + "model-name": "service-instance", + "generic-vnf": { + "vnf-id": "jimmy-test-vnf2", + "vnf-name": "jimmy-test-vnf2-named", + "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "orchestration-status": "active", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1504014833841", + "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4", + "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json new file mode 100644 index 000000000..3e8391eaa --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json @@ -0,0 +1,287 @@ +{ + "inventory-response-item": [ + { + "model-name": "vFW", + "generic-vnf": { + "vnf-id": "vFirewall_demo_app", + "vnf-name": "vFirewall_demo_app", + "vnf-type": "vFW", + "service-id": "vFirewall_demo_app", + "orchestration-status": "running", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509456799110", + "model-invariant-id": "vFirewall", + "model-version-id": "vFW" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vserver": { + "vserver-id": "5b06cf36-40a0-4bcb-bde9-849aa4702d67", + "vserver-name": "vFW", + "vserver-name2": "vFW", + "prov-status": "Running", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/5b06cf36-40a0-4bcb-bde9-849aa4702d67", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509047869791" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vnfc": { + "vnfc-name": "VNFC_vGMUX_demo_app2", + "nfc-naming-code": "vGMUXCODE2", + "nfc-function": "vGMUX", + "prov-status": "Running", + "orchestration-status": "Error", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509407048855" + }, + "extra-properties": { + } + }, + { + "tenant": { + "tenant-id": "466979b815b5415ba14ada713e6e1846", + "tenant-name": "Integration", + "resource-version": "1508920100541" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "pod25", + "cloud-region-id": "RegionOne", + "identity-url": "http://10.12.25.2:5000/v3", + "sriov-automation": false, + "resource-version": "1509048416263" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "esr-system-info": { + "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29", + "system-name": "example-system-name-val-29070", + "type": "example-type-val-85254", + "vendor": "example-vendor-val-94515", + "version": "example-version-val-71880", + "service-url": "http://10.12.25.2:5000/v3", + "user-name": "demo", + "password": "onapdemo", + "system-type": "VIM", + "ssl-cacert": "example-ssl-cacert-val-75021", + "ssl-insecure": true, + "ip-address": "example-ip-address-val-44431", + "port": "example-port-val-93234", + "cloud-domain": "Default", + "default-tenant": "Integration", + "resource-version": "1508920101033" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "vserver": { + "vserver-id": "0c52905c-f682-42cf-bd52-e7f8953e80e3", + "vserver-name": "vFW", + "vserver-name2": "vFW", + "prov-status": "Running", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/0c52905c-f682-42cf-bd52-e7f8953e80e3", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509047548567" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vnfc": { + "vnfc-name": "VNFC_vGMUX_demo_app3", + "nfc-naming-code": "vGMUXCODE3", + "nfc-function": "vGMUX", + "prov-status": "Running", + "orchestration-status": "Running", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509041912808" + }, + "extra-properties": { + } + }, + { + "tenant": { + "tenant-id": "466979b815b5415ba14ada713e6e1846", + "tenant-name": "Integration", + "resource-version": "1508920100541" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "pod25", + "cloud-region-id": "RegionOne", + "identity-url": "http://10.12.25.2:5000/v3", + "sriov-automation": false, + "resource-version": "1509048416263" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "esr-system-info": { + "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29", + "system-name": "example-system-name-val-29070", + "type": "example-type-val-85254", + "vendor": "example-vendor-val-94515", + "version": "example-version-val-71880", + "service-url": "http://10.12.25.2:5000/v3", + "user-name": "demo", + "password": "onapdemo", + "system-type": "VIM", + "ssl-cacert": "example-ssl-cacert-val-75021", + "ssl-insecure": true, + "ip-address": "example-ip-address-val-44431", + "port": "example-port-val-93234", + "cloud-domain": "Default", + "default-tenant": "Integration", + "resource-version": "1508920101033" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "vserver": { + "vserver-id": "33e16e02-098a-4f4e-a37f-b4e0307596c0", + "vserver-name": "vFW", + "vserver-name2": "vFW", + "prov-status": "Running", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/33e16e02-098a-4f4e-a37f-b4e0307596c0", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509047285114" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "vnfc": { + "vnfc-name": "vnfc-related-to-vserver-example", + "nfc-naming-code": "example-nfc-naming-code-val-78172", + "nfc-function": "example-nfc-function-val-56352", + "prov-status": "example-prov-status-val-10699", + "orchestration-status": "example-orchestration-status-val-68896", + "ipaddress-v4-oam-vip": "example-ipaddress-v4-oam-vip-val-71483", + "in-maint": true, + "is-closed-loop-disabled": true, + "group-notation": "example-group-notation-val-31912", + "resource-version": "1508800709772" + }, + "extra-properties": { + } + }, + { + "vnfc": { + "vnfc-name": "VNFC_vGMUX_demo_app", + "nfc-naming-code": "vGMUXCODE", + "nfc-function": "vGMUX", + "prov-status": "Running", + "orchestration-status": "Running", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1509041573965" + }, + "extra-properties": { + } + }, + { + "tenant": { + "tenant-id": "466979b815b5415ba14ada713e6e1846", + "tenant-name": "Integration", + "resource-version": "1508920100541" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "pod25", + "cloud-region-id": "RegionOne", + "identity-url": "http://10.12.25.2:5000/v3", + "sriov-automation": false, + "resource-version": "1509048416263" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "esr-system-info": { + "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29", + "system-name": "example-system-name-val-29070", + "type": "example-type-val-85254", + "vendor": "example-vendor-val-94515", + "version": "example-version-val-71880", + "service-url": "http://10.12.25.2:5000/v3", + "user-name": "demo", + "password": "onapdemo", + "system-type": "VIM", + "ssl-cacert": "example-ssl-cacert-val-75021", + "ssl-insecure": true, + "ip-address": "example-ip-address-val-44431", + "port": "example-port-val-93234", + "cloud-domain": "Default", + "default-tenant": "Integration", + "resource-version": "1508920101033" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json new file mode 100644 index 000000000..1d3f64c78 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json @@ -0,0 +1,206 @@ +{ + "inventory-response-item": [ + { + "vserver": { + "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "vserver-name": "zdfw1lb01lb02", + "vserver-name2": "zdfw1lb01lb02", + "prov-status": "ACTIVE", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510606403522" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer", + "generic-vnf": { + "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vnf-name": "Vfmodule_vLB1113", + "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", + "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510604011851", + "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", + "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2", + "model-customization-id": "1983c783-444f-4e79-af3a-85e5d49628f3", + "nf-type": "", + "nf-function": "", + "nf-role": "", + "nf-naming-code": "" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer-1106", + "service-instance": { + "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", + "service-instance-name": "vLoadBalancer-1113", + "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", + "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50", + "resource-version": "1510603936425" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer-1106" + }, + { + "property-name": "model.model-type", + "property-value": "service" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + } + }, + { + "model-name": "Vloadbalancer..base_vlb..module-0", + "vf-module": { + "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12", + "vf-module-name": "Vfmodule_vLB1113-1", + "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db", + "orchestration-status": "active", + "is-base-vf-module": true, + "resource-version": "1510604612557", + "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2", + "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071", + "model-customization-id": "93fd5bd4-8051-4074-8530-c0c504604df5", + "module-index": 0 + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..base_vlb..module-0" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + } + ] + } + }, + { + "tenant": { + "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", + "tenant-name": "Integration-SB-00", + "resource-version": "1509587770200" + }, + "extra-properties": { + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "CloudOwner", + "cloud-region-id": "RegionOne", + "cloud-type": "SharedNode", + "owner-defined-type": "OwnerType", + "cloud-region-version": "v1", + "cloud-zone": "CloudZone", + "sriov-automation": false, + "resource-version": "1509587770092" + }, + "extra-properties": { + } + } + ] + } + } + ] + } + } + ] +} diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json new file mode 100644 index 000000000..6e18a91b0 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "2.0", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "type": "request", + "body": { + "input": { + "common-header": { + "timestamp": "2018-02-26T10:23:41.97Z", + "api-ver": "2.15", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "sub-request-id": "1", + "flags": {} + }, + "action": "Restart", + "action-identifiers": { + "vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json new file mode 100644 index 000000000..9a0ff9af1 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "0.0.1", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "type": "response", + "body": { + "output": { + "common-header": { + "timestamp": "2018-02-26T10:23:42.97Z", + "api-ver": "5.00", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 400, + "message": "Restart Failed" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json new file mode 100644 index 000000000..4afc51d85 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "0.0.1", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "type": "response", + "body": { + "output": { + "common-header": { + "timestamp": "2018-02-26T10:23:42.97Z", + "api-ver": "5.00", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 200, + "message": "Restart Successful" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json new file mode 100644 index 000000000..2f53a83bc --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json @@ -0,0 +1,22 @@ +{ + "rpc-name": "restart", + "version": "0.0.1", + "correlation-id": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "type": "response", + "body": { + "output": { + "common-header": { + "timestamp": "2018-02-26T10:23:42.97Z", + "api-ver": "5.00", + "originator-id": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "request-id": "4a68f8a5-0db9-4070-a132-adede51ebeef", + "sub-request-id": "1", + "flags": {} + }, + "status": { + "code": 200, + "message": "Restart Successful" + } + } + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json new file mode 100644 index 000000000..5efbfef69 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json @@ -0,0 +1,23 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638001326, + "closedLoopAlarmEnd": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ABATED", + "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "version": "1.0.2", + "from": "DCAE", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1", + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF13", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bd01f" + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json new file mode 100644 index 000000000..7cc910e96 --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json @@ -0,0 +1,15 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638001326, + "closedLoopAlarmEnd": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ABATED", + "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "version": "1.0.2", + "from": "DCAE", + "AAI": { + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + } +}
\ No newline at end of file diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json new file mode 100644 index 000000000..405cc0b2b --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json @@ -0,0 +1,22 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "generic-vnf.resource-version": "1", + "generic-vnf.vnf-name": "vCPEInfraVNF13", + "generic-vnf.prov-status": "PREPROV", + "generic-vnf.is-closed-loop-disabled": "false", + "generic-vnf.orchestration-status": "Created", + "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0", + "generic-vnf.in-maint": "false", + "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bd01f", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + }, + "from": "DCAE", + "version": "1.0.2" +} diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json new file mode 100644 index 000000000..342451a0c --- /dev/null +++ b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json @@ -0,0 +1,15 @@ +{ + "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "closedLoopAlarmStart": 1519638197324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "vserver.is-closed-loop-disabled": "false", + "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1" + }, + "from": "DCAE", + "version": "1.0.2" +} |