summaryrefslogtreecommitdiffstats
path: root/examples/examples-pcvs/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-pcvs/src/main')
-rw-r--r--examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java72
-rw-r--r--examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java57
-rw-r--r--examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java30
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json69
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json51
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json28
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json120
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json101
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json50
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py214
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py216
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh23
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh23
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh21
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh21
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh21
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh21
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh21
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh33
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh22
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh33
-rw-r--r--examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh22
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc16
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc22
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc8
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc34
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc8
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc10
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc8
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js80
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js65
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js63
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js69
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js58
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js76
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js83
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js63
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js170
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js80
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js58
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex325
41 files changed, 2565 insertions, 0 deletions
diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java
new file mode 100644
index 000000000..19825e335
--- /dev/null
+++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelFactory.java
@@ -0,0 +1,72 @@
+/*-
+ * ============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.examples.pcvs.model;
+
+import java.io.File;
+
+import org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader;
+import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+import org.onap.policy.apex.model.utilities.ResourceUtils;
+
+/**
+ * A factory for creating PCVSDomainModel objects.
+ *
+ * @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+ */
+public class PCVSDomainModelFactory {
+
+ /**
+ * Generates the PCVS VPN-SLA policy model from CLI commands and creates an APEX model.
+ *
+ * @param workingDirectory The working directory for the CLI editor for includes
+ *
+ * @return the PCVS VPN-SLA policy model
+ */
+ public AxPolicyModel getPCVVpnSlaSPolicyModel(final String workingDirectory) {
+ final String path = "target/model-gen/pcvs/vpnsla";
+ final String file = "policy.json";
+ final String full = path + "/" + file;
+
+ final File pathFile = new File(path);
+ pathFile.mkdirs();
+
+ final String[] args =
+ new String[] { "-c", "src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex", "-wd",
+ workingDirectory, "-o", full };
+
+ final ApexCLIEditorMain cliEditor = new ApexCLIEditorMain(args);
+ if (cliEditor.getErrorCount() > 0) {
+ throw new ApexRuntimeException(
+ "Apex CLI editor execution failed with " + cliEditor.getErrorCount() + " errors");
+ }
+
+ java.util.TimeZone.getTimeZone("gmt");
+ try {
+ final ApexModelReader<AxPolicyModel> reader = new ApexModelReader<>(AxPolicyModel.class);
+ return reader.read(ResourceUtils.getResourceAsString(full));
+ } catch (final Exception e) {
+ throw new ApexRuntimeException("Failed to build PCVS SLA1 policy from path: " + full, e);
+ }
+ }
+
+}
diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java
new file mode 100644
index 000000000..ee6277a8e
--- /dev/null
+++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.examples.pcvs.model;
+
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver;
+import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+
+/**
+ * The Class PCVSDomainModelSaver.
+ *
+ * @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+ */
+public final class PCVSDomainModelSaver {
+
+ /** Private constructor to prevent instantiation. */
+ private PCVSDomainModelSaver() {}
+
+ /**
+ * Write all PCVS models to args[0].
+ *
+ * @param args uses <code>arg[0]</code> for directory information
+ * @throws ApexException the apex exception
+ */
+ public static void main(final String[] args) throws ApexException {
+ if (args.length != 2) {
+ System.err.println(
+ "usage: " + PCVSDomainModelSaver.class.getCanonicalName() + " workingDirectory modelDirectory");
+ return;
+ }
+
+ final AxPolicyModel pcvsPolicyModel = new PCVSDomainModelFactory().getPCVVpnSlaSPolicyModel(args[0]);
+ final ApexModelSaver<AxPolicyModel> pcvsModelSaver =
+ new ApexModelSaver<>(AxPolicyModel.class, pcvsPolicyModel, args[1] + "vpnsla/");
+ pcvsModelSaver.apexModelWriteJSON();
+ pcvsModelSaver.apexModelWriteXML();
+
+ }
+}
diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java
new file mode 100644
index 000000000..ff9b39730
--- /dev/null
+++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/package-info.java
@@ -0,0 +1,30 @@
+/*-
+ * ============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=========================================================
+ */
+
+/**
+ * Contains the model for Policy-controlled Video Streaming.
+ *
+ * @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+ * @author Joseph McNamara (joseph.mcnamara@ericsson.com)
+ * @author John Keeney (john.keeney@ericsson.com)
+ */
+
+package org.onap.policy.apex.examples.pcvs.model;
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json
new file mode 100644
index 000000000..841028bd5
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/kafka2kafka.json
@@ -0,0 +1,69 @@
+{
+ "engineServiceParameters":{
+ "name" : "VpnSlaApexEngine",
+ "version" : "1.0.0",
+ "id" : 45,
+ "instanceCount" : 1,
+ "deploymentPort" : 12345,
+ "policyModelFileName" : 'examples/models/pcvs/vpnsla/PCVS-VpnSla.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'
+ }
+ }
+ }
+ }
+ },
+ "eventOutputParameters": {
+ "aProducer": {
+ "carrierTechnologyParameters":{
+ "carrierTechnology" : "KAFKA",
+ "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
+ "parameters" : {
+ 'bootstrapServers' : 'localhost:9092',
+ 'acks' : 'all',
+ 'retries' : 0,
+ 'batchSize' : 16384,
+ 'lingerTime' : 1,
+ 'bufferMemory' : 33554432,
+ 'producerTopic' : 'apex-out',
+ 'keySerializer' : 'org.apache.kafka.common.serialization.StringSerializer',
+ 'valueSerializer' : 'org.apache.kafka.common.serialization.StringSerializer'
+ }
+ },
+ "eventProtocolParameters":{
+ "eventProtocol" : "JSON"
+ }
+ }
+ },
+ "eventInputParameters": {
+ "aConsumer": {
+ "carrierTechnologyParameters":{
+ "carrierTechnology" : "KAFKA",
+ "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.kafka.KAFKACarrierTechnologyParameters",
+ "parameters" : {
+ 'bootstrapServers' : 'localhost:9092',
+ 'groupId' : 'apex-group-id',
+ 'enableAutoCommit' : true,
+ 'autoCommitTime' : 1000,
+ 'sessionTimeout' : 30000,
+ 'consumerPollTime' : 100,
+ 'consumerTopicList' : ['apex-in-0', 'apex-in-1'],
+ 'keyDeserializer' : 'org.apache.kafka.common.serialization.StringDeserializer',
+ 'valueDeserializer' : 'org.apache.kafka.common.serialization.StringDeserializer'
+ }
+ },
+ "eventProtocolParameters":{
+ "eventProtocol" : "JSON"
+ }
+ }
+ }
+}
diff --git a/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json
new file mode 100644
index 000000000..d48a47e69
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/config/pcvs/vpnsla/stdin2stdout.json
@@ -0,0 +1,51 @@
+{
+ "engineServiceParameters":{
+ "name" : "VpnSlaApexEngine",
+ "version" : "1.0.0",
+ "id" : 45,
+ "instanceCount" : 1,
+ "deploymentPort" : 12345,
+ "policyModelFileName" : "examples/models/pcvs/vpnsla/PCVS-VpnSla.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"
+ }
+ }
+ }
+ }
+ },
+ "eventOutputParameters": {
+ "FirstProducer": {
+ "carrierTechnologyParameters" : {
+ "carrierTechnology" : "FILE",
+ "parameters" : {
+ "standardIO" : true
+ }
+ },
+ "eventProtocolParameters" : {
+ "eventProtocol" : "JSON"
+ }
+ }
+ },
+ "eventInputParameters": {
+ "FirstConsumer": {
+ "carrierTechnologyParameters" : {
+ "carrierTechnology" : "FILE",
+ "parameters" : {
+ "standardIO" : true
+ }
+ },
+ "eventProtocolParameters" : {
+ "eventProtocol" : "JSON"
+ }
+ }
+ }
+}
diff --git a/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json
new file mode 100644
index 000000000..50eac5726
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json
@@ -0,0 +1,28 @@
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "CustomerContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_CustomerContext",
+ "customerName": "A",
+ "links": "L01 L05 L09 L10",
+ "dtSLA": 180,
+ "dtYTD": 10,
+ "priority": false,
+ "satisfaction": 80
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "CustomerContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_CustomerContext",
+ "customerName": "B",
+ "links": "L02 L07 L09 L10",
+ "dtSLA": 180,
+ "dtYTD": 120,
+ "priority": true,
+ "satisfaction": 99
+}
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json
new file mode 100644
index 000000000..f611ce16d
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json
@@ -0,0 +1,120 @@
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L01",
+ "start": "A1",
+ "end": "A1CO",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L02",
+ "start": "B1",
+ "end": "B1CO",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L03",
+ "start": "A2",
+ "end": "A2CO",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L04",
+ "start": "B2",
+ "end": "B2CO",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L05",
+ "start": "A1CO",
+ "end": "BBL",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L06",
+ "start": "B1CO",
+ "end": "BBL",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L07",
+ "start": "A2CO",
+ "end": "BBR",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L08",
+ "start": "B2CO",
+ "end": "BBR",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L09",
+ "start": "BBL",
+ "end": "BBR",
+ "status": true
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "EdgeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_EdgeContext",
+ "edgeName": "L10",
+ "start": "BBR",
+ "end": "BBL",
+ "status": true
+}
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json
new file mode 100644
index 000000000..5c195a8cf
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json
@@ -0,0 +1,101 @@
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "A1",
+ "mininetName": "nn"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "A2",
+ "mininetName": "nn"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "B1",
+ "mininetName": "nn"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "B2",
+ "mininetName": "nn"
+}
+
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "A1CO",
+ "mininetName": "s1"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "A2CO",
+ "mininetName": "s2"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "B1CO",
+ "mininetName": "s3"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "B2CO",
+ "mininetName": "s4"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "BBL",
+ "mininetName": "s5"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "NodeContextEventIn",
+ "version": "1.0.0",
+ "source": "CtxtManagement",
+ "target" : "VpnSlaPolicy_NodeContext",
+ "nodeName": "BBR",
+ "mininetName": "s6"
+}
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json
new file mode 100644
index 000000000..d204614f6
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json
@@ -0,0 +1,50 @@
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "VpnSlaTrigger",
+ "version": "1.0.0",
+ "source": "ExampleEvents",
+ "target" : "VpnSlaPolicy",
+ "edgeName": "L09",
+ "status": "UP"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "VpnSlaTrigger",
+ "version": "1.0.0",
+ "source": "ExampleEvents",
+ "target" : "VpnSlaPolicy",
+ "edgeName": "L09",
+ "status": "UP"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "VpnSlaTrigger",
+ "version": "1.0.0",
+ "source": "ExampleEvents",
+ "target" : "VpnSlaPolicy",
+ "edgeName": "L09",
+ "status": "DOWN"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "VpnSlaTrigger",
+ "version": "1.0.0",
+ "source": "ExampleEvents",
+ "target" : "VpnSlaPolicy",
+ "edgeName": "L09",
+ "status": "DOWN"
+}
+
+{
+ "nameSpace": "org.onap.policy.apex.examples.pcvs.vpnsla",
+ "name": "VpnSlaTrigger",
+ "version": "1.0.0",
+ "source": "ExampleEvents",
+ "target" : "VpnSlaPolicy",
+ "edgeName": "L09",
+ "status": "UP"
+}
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py
new file mode 100644
index 000000000..907dd22cb
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py
@@ -0,0 +1,214 @@
+# ============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=========================================================
+
+import http.client
+import json
+import time
+from kafka import KafkaConsumer, KafkaProducer
+
+class StaticFlowPusher(object):
+
+ def __init__(self, server):
+ self.server = server
+
+ def get(self, data):
+ ret = self.rest_call({}, 'GET')
+ return json.loads(ret[2])
+
+ def set(self, data):
+ ret = self.rest_call(data, 'POST')
+ return ret[0] == 200
+
+ def remove(self, objtype, data):
+ ret = self.rest_call(data, 'DELETE')
+ return ret[0] == 200
+
+ def getControllerSummary(self, data):
+ ret = self.rest_call_controller_summary({}, 'GET')
+ return json.loads(ret[2])
+
+ def getLinks(self, data):
+ ret = self.rest_call_links({}, 'GET')
+ return json.loads(ret[2].decode())
+
+ def rest_call(self, data, action):
+ path = '/wm/staticflowpusher/json'
+ headers = {
+ 'Content-type': 'application/json',
+ 'Accept': 'application/json',
+ }
+ body = json.dumps(data)
+ conn = http.client.HTTPConnection(self.server, 8080)
+ conn.request(action, path, body, headers)
+ response = conn.getresponse()
+ ret = (response.status, response.reason, response.read())
+ print(ret)
+ conn.close()
+ return ret
+
+ def rest_call_controller_summary(self, data, action):
+ path = '/wm/core/controller/summary/json'
+ headers = {
+ 'Content-type': 'application/json',
+ 'Accept': 'application/json',
+ }
+ body = json.dumps(data)
+ conn = http.client.HTTPConnection(self.server, 8080)
+ conn.request(action, path, body, headers)
+ response = conn.getresponse()
+ ret = (response.status, response.reason, response.read())
+ print(ret)
+ conn.close()
+ return ret
+
+ def rest_call_links(self, data, action):
+ path = '/wm/topology/links/json'
+ headers = {
+ 'Content-type': 'application/json',
+ 'Accept': 'application/json',
+ }
+ body = json.dumps(data)
+ conn = http.client.HTTPConnection(self.server, 8080)
+ conn.request(action, path, body, headers)
+ response = conn.getresponse()
+ ret = (response.status, response.reason, response.read())
+ conn.close()
+ return ret
+
+pusher = StaticFlowPusher('127.0.1.1')
+
+
+def parseLinks(links):
+ #print("\n\n\n",links)
+ result = []
+ for link in links:
+ list = []
+ #print("\n\n\n",link)
+ #print("\nsrc-switch : s", link['src-switch'][len(link['src-switch'])-1])
+ #print("\ndst-switch : s", link['dst-switch'][len(link['dst-switch'])-1])
+ list.append("s")
+ list.append(link['src-switch'][len(link['src-switch'])-1])
+ list.append("-s")
+ list.append(link['dst-switch'][len(link['dst-switch'])-1])
+ result.append(''.join(list))
+ #print(result, "\n")
+ return result
+
+
+
+counter =0
+healthyList = []
+testableList = []
+healthyLinks = ""
+testableLinks = ""
+producer = KafkaProducer(bootstrap_servers='localhost:9092')
+while(True):
+ time.sleep(30)
+ switchLinks = pusher.getLinks({})
+ if counter == 0:
+ healthyList = parseLinks(switchLinks)
+ #Build All Links
+ print("READING LINKS FROM MININET\n")
+ for l in healthyList:
+ link = ""
+ #print(l, "\n")
+ #Links between switches [s6-s7 is ignored so it matches VPN SCENARIO]
+ if(l == "s1-s5"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L05', 'start': 'A1CO','end': 'BBL'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(l == "s5-s6"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L09', 'start': 'BBL','end': 'BBR'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(l == "s2-s6"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L07', 'start': 'A2CO','end': 'BBR'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(l == "s5-s7"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L10', 'start': 'BBR','end': 'BBL'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(l == "s3-s5"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L06', 'start': 'B1CO','end': 'BBL'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(l == "s4-s6"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L08', 'start': 'B2CO','end': 'BBR'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ #Links between switches and hosts [NoT SENT IN FROM FLOODLIGHT]
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L01', 'start': 'A1','end': 'A1CO'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L02', 'start': 'B1','end': 'B1CO'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L03', 'start': 'A2','end': 'A2CO'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'EdgeContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_EdgeContext','status': true,'edgeName': 'L04', 'start': 'B2','end': 'B2CO'}")
+ print("LINKS HAVE BEEN SENT TO APEX\n")
+
+ #Build Customers
+ print("BUILDING CUSTOMERS\n")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'CustomerContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_CustomerContext','dtYTD': 10,'dtSLA': 180,'links': 'L01 L05 L09 L10','customerName': 'A', 'priority': true,'satisfaction': 80}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'CustomerContextEventIn','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy_CustomerContext','dtYTD': 120,'dtSLA': 180,'links': 'L02 L07 L09 L10','customerName': 'B', 'priority': false,'satisfaction': 99}")
+ print("CUSTOMERS HAVE BEEN SENT TO APEX\n")
+ healthyLinks = switchLinks
+ myfile = open('LinkInfo.json', 'a')
+ myfile.write(str(healthyLinks))
+ myfile.write('\n')
+ myfile.close()
+ print("We start off with", len(healthyLinks), "healthy Links!\n")
+ else:
+ testableList = parseLinks(switchLinks)
+ issueLink = "";
+ for h in healthyList:
+ issueLink = h
+ for t in testableList:
+ if t == h:
+ issueLink = ""
+ if issueLink != "":
+ print("There is an issue with the links! ", issueLink, " \n")
+ if(issueLink == "s1-s5"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L05'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(issueLink == "s5-s6"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L09'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(issueLink == "s2-s6"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L07'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(issueLink == "s5-s7"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L10'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(issueLink == "s3-s5"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L06'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ if(issueLink == "s4-s6"):
+ link = "{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'DOWN','edgeName': 'L08'}"
+ producer.send("apex-in-0", bytes(link, encoding="ascii"))
+ break
+ if issueLink == "":
+ print("All Links are working\n")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L01'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L02'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L03'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L04'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L05'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L06'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L07'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L08'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L09'}")
+ producer.send("apex-in-0", b"{'nameSpace': 'org.onap.policy.apex.examples.pcvs.vpnsla','name': 'VpnSlaTrigger','version': '1.0.0','source': 'LinkMonitor.py','target': 'VpnSlaPolicy','status': 'UP','edgeName': 'L10'}")
+
+ testableLinks = switchLinks
+ myfile = open('LinkInfo.json', 'a')
+ myfile.write(str(testableLinks))
+ myfile.write('\n')
+ myfile.close()
+ counter += 1
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py
new file mode 100644
index 000000000..4d6aea8f5
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py
@@ -0,0 +1,216 @@
+# ============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=========================================================
+
+#Add Mininet to PATH
+import sys
+sys.path.insert(0, "/~/mininet")
+
+#Kafka
+import httplib
+import json
+import time
+from kafka import KafkaConsumer, KafkaProducer
+
+#Mininet
+from mininet.clean import *
+from mininet.cli import *
+from mininet.link import *
+from mininet.log import *
+from mininet.net import *
+from mininet.node import *
+from mininet.nodelib import *
+from mininet.topo import *
+from mininet.topolib import *
+
+class StaticFlowPusher(object):
+ def __init__(self, server):
+ self.server = server
+
+ def enableFirewall(self, data):
+ path = "/wm/firewall/module/enable/json"
+ headers = {'Content-Type': 'application/json','Accept': 'application/json',}
+ body = json.dumps(data)
+ conn = httplib.HTTPConnection(self.server, 8080)
+ conn.request("PUT", path, "")
+ response = conn.getresponse()
+ ret = (response.status, response.reason, response.read())
+ conn.close()
+ return ret
+
+ def addRule(self, data):
+ path = '/wm/firewall/rules/json'
+ headers = {'Content-Type': 'application/json','Accept': 'application/json',}
+ body = json.dumps(data)
+ conn = httplib.HTTPConnection(self.server, 8080)
+ conn.request('POST', path, body, headers)
+ response = conn.getresponse()
+ ret = (response.status, response.reason, response.read())
+ conn.close()
+ return ret
+
+ def deleteRule(self, data):
+ path = '/wm/firewall/rules/json'
+ headers = {'Content-Type': 'application/json','Accept': 'application/json',}
+ body = json.dumps(data)
+ conn = httplib.HTTPConnection(self.server, 8080)
+ conn.request('DELETE', path, body, headers)
+ response = conn.getresponse()
+ ret = (response.status, response.reason, response.read())
+ conn.close()
+ return ret
+
+#Build Pusher(REST/IN)
+pusher = StaticFlowPusher('127.0.0.1')
+
+net = Mininet(link=TCLink)
+
+#Create Customers
+customerA1 = net.addHost( 'A1' )
+customerA2 = net.addHost( 'A2' )
+customerB1 = net.addHost( 'B1' )
+customerB2 = net.addHost( 'B2' )
+
+#Create Switches
+switchA1CO = net.addSwitch( 's1' )
+switchA2CO = net.addSwitch( 's2' )
+switchB1CO = net.addSwitch( 's3' )
+switchB2CO = net.addSwitch( 's4' )
+switchBBL = net.addSwitch( 's5' )
+switchBBR = net.addSwitch( 's6' )
+# we need an extra switch here because Mininet does not allow two links between two switches
+switchEx = net.addSwitch( 's7' )
+
+#Create Links
+net.addLink( customerA1, switchA1CO )
+net.addLink( customerA2, switchA2CO )
+net.addLink( customerB1, switchB1CO )
+net.addLink( customerB2, switchB2CO )
+net.addLink( switchA1CO, switchBBL )
+net.addLink( switchB1CO, switchBBL )
+net.addLink( switchA2CO, switchBBR )
+net.addLink( switchB2CO, switchBBR )
+net.addLink( switchBBL, switchBBR)
+net.addLink( switchBBR, switchEx, bw=1.2 )
+net.addLink( switchEx, switchBBL )
+
+#Create Controller
+floodlightController = net.addController(name='c0' , controller=RemoteController , ip='127.0.0.1', port=6653)
+
+net.start()
+
+if pusher.enableFirewall({})[0] == 200:
+ print("Firewall enabled!")
+
+#print(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01"})[2])
+s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01"})[2])['rule-id']
+s2id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:02"})[2])['rule-id']
+s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03"})[2])['rule-id']
+s4id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:04"})[2])['rule-id']
+s5id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:05"})[2])['rule-id']
+s6id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:06"})[2])['rule-id']
+s7id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:07"})[2])['rule-id']
+
+
+result = 100
+while result!=0:
+ result = net.pingAll(None)
+print("Network Simulation Complete")
+
+#Assume control and when finished "exit"
+cli = CLI( net )
+
+consumer = KafkaConsumer(bootstrap_servers='localhost:9092',auto_offset_reset='latest')
+consumer.subscribe(['apex-out'])
+print("Starting Message Loop")
+for message in consumer:
+ myOutput = json.loads(message.value.decode())
+ action = ""
+ try:
+ print("Checking Message")
+ #print("SWITCHES= ",net.switches)
+ #print("LINKS= ",net.links)
+ #print("VALUES= ",net.values)
+ if myOutput['edgeName'] != '':
+ print("Message Received: ",myOutput['edgeName'])
+ pusher.deleteRule({"ruleid": s1id})
+ pusher.deleteRule({"ruleid": s2id})
+ pusher.deleteRule({"ruleid": s3id})
+ pusher.deleteRule({"ruleid": s4id})
+ pusher.deleteRule({"ruleid": s5id})
+ pusher.deleteRule({"ruleid": s6id})
+ pusher.deleteRule({"ruleid": s7id})
+ s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01"})[2])['rule-id']
+ s2id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:02"})[2])['rule-id']
+ s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03"})[2])['rule-id']
+ s4id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:04"})[2])['rule-id']
+ s5id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:05"})[2])['rule-id']
+ s6id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:06"})[2])['rule-id']
+ s7id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:07"})[2])['rule-id']
+ if myOutput['edgeName'] == "L01":
+ action = "link s1 s5 down"
+ #net.configLinkStatus('s1', 's5', "down")
+ pusher.deleteRule({"ruleid": s1id})
+ s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L02":
+ action = "link s3 s5 down"
+ #net.configLinkStatus('s3', 's5', "down")
+ pusher.deleteRule({"ruleid": s3id})
+ s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L03":
+ action = "link s2 s6 down"
+ #net.configLinkStatus('s2', 's6', "down")
+ pusher.deleteRule({"ruleid": s1id})
+ s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L04":
+ action = "link s4 s6 down"
+ #net.configLinkStatus('s4', 's6', "down")
+ pusher.deleteRule({"ruleid": s3id})
+ s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L05":
+ action = "link s1 s5 down"
+ #net.configLinkStatus('s1', 's5', "down")
+ pusher.deleteRule({"ruleid": s1id})
+ s1id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:01", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L06":
+ action = "link s3 s5 down"
+ #net.configLinkStatus('s3', 's5', "down")
+ pusher.deleteRule({"ruleid": s3id})
+ s3id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:03", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L07":
+ action = "link s2 s6 down"
+ #net.configLinkStatus('s2', 's6', "down")
+ pusher.deleteRule({"ruleid": s2id})
+ s2id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:02", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L08":
+ action = "link s4 s6 down"
+ #net.configLinkStatus('s4', 's6', "down")
+ pusher.deleteRule({"ruleid": s4id})
+ s4id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:04", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L09":
+ action = "link s5 s6 down"
+ #net.configLinkStatus('s5', 's6', "down")
+ pusher.deleteRule({"ruleid": s7id})
+ s7id = json.loads(pusher.addRule({"switchid": "00:00:00:00:00:00:00:07", "action": "DENY"})[2])['rule-id']
+ if myOutput['edgeName'] == "L10":
+ print("L10")
+ #print(action)
+ #print("3")
+ except KeyError:
+ print(myOutput)
+print("HA")
+net.stop()
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh
new file mode 100644
index 000000000..0579dcce5
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/configure.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+cp $APEX_HOME/etc/logback-logic.xml $APEX_HOME/etc/logback.xml
+cp $APEX_HOME/examples/scripts/pcvs/vpnsla/LinkMonitor.py $src_dir/kafka-python
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh
new file mode 100644
index 000000000..7d8542f5a
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/env.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+export src_dir=/usr/local/src
+export APEX_HOME=/opt/app/policy/apex-pdp
+export APEX_USER=apexuser
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh
new file mode 100644
index 000000000..dd2f77d88
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-apex.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+(cd $APEX_HOME; ./bin/apexApps.sh engine -c examples/config/pcvs/vpnsla/kafka2kafka.json)
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh
new file mode 100644
index 000000000..a2f6ba417
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-floodlight.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+(cd $src_dir/floodlight-master; java -jar target/floodlight.jar)
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh
new file mode 100644
index 000000000..37321a6f2
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-kafka-zk.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+/opt/Kafka/kafka_2.12-1.0.0/bin/kafka-server-start.sh /opt/Kafka/kafka_2.12-1.0.0/config/server.properties \ No newline at end of file
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh
new file mode 100644
index 000000000..2a166bc87
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-linkmonitor.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+(cd $src_dir; python3 $src_dir/kafka-python/LinkMonitor.py) \ No newline at end of file
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh
new file mode 100644
index 000000000..ba6e343b2
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/start-mininet.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+mn -c && python $APEX_HOME/examples/scripts/pcvs/vpnsla/MininetTopology.py
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh
new file mode 100644
index 000000000..1e709bb53
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a1.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+MOD_SCRIPT_NAME=`basename $0`
+
+if [ $# -eq 0 ]; then
+ echo ""
+ echo "$MOD_SCRIPT_NAME - run VLC that streams video"
+ echo ""
+ echo " Usage: $MOD_SCRIPT_NAME [video file]"
+ echo ""
+ exit
+fi
+
+vlc-wrapper -vvv $1 --sout "#duplicate{dst=rtp{dst=10.0.0.2,port=5004,mux=ts},dst=display}" --sout-keep -q
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh
new file mode 100644
index 000000000..b00bca2c6
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/a2.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+vlc-wrapper rtp://@:5004 -q
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh
new file mode 100644
index 000000000..8de02941a
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b1.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+MOD_SCRIPT_NAME=`basename $0`
+
+if [ $# -eq 0 ]; then
+ echo ""
+ echo "$MOD_SCRIPT_NAME - run VLC that streams video"
+ echo ""
+ echo " Usage: $MOD_SCRIPT_NAME [video file]"
+ echo ""
+ exit
+fi
+
+vlc-wrapper -vvv $1 --sout "#duplicate{dst=rtp{dst=10.0.0.4,port=5004,mux=ts},dst=display}" --sout-keep -q
+
diff --git a/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh
new file mode 100644
index 000000000..b00bca2c6
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/examples/scripts/pcvs/vpnsla/streams/b2.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# ============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=========================================================
+
+vlc-wrapper rtp://@:5004 -q
+
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc
new file mode 100644
index 000000000..eca3836a3
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc
@@ -0,0 +1,16 @@
+{
+ "type" : "record",
+ "name" : "Customer",
+ "fields" : [
+ {"name" : "customerName", "type" : "string"},
+ {"name" : "dtSLA" , "type" : "int"},
+ {"name" : "dtYTD" , "type" : "int"},
+ {"name" : "priority" , "type" : "boolean"},
+ {"name" : "satisfaction", "type" : "int"},
+ {
+ "name": "links",
+ "doc": "Links used by this customer",
+ "type": {"type" : "array", "items" : "string"}
+ }
+ ]
+}
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc
new file mode 100644
index 000000000..5961cb6f6
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc
@@ -0,0 +1,22 @@
+{
+ "type" : "record",
+ "name" : "Situation",
+ "fields" : [
+ {"name": "description", "type": "string", "doc": "Description of the taken decision"},
+ {
+ "name": "decision",
+ "doc": "taken decision",
+ "type": {
+ "type": "enum",
+ "name": "decisionEnum",
+ "symbols" : [
+ "IMPEDE",
+ "REBUILD",
+ "NONE"
+ ]
+ }
+ },
+ {"name": "customers", "type": {"type" : "array", "items" : "string"}, "doc": "List of customers affected by the decision"},
+ {"name": "problemID", "type": "string", "doc": "Identifier of the problem for lookup in problemMap"}
+ ]
+}
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc
new file mode 100644
index 000000000..440a3d0a9
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc
@@ -0,0 +1,8 @@
+{
+ "type": "enum",
+ "name": "Status",
+ "symbols" : [
+ "UP",
+ "DOWN"
+ ]
+}
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc
new file mode 100644
index 000000000..c633c129d
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc
@@ -0,0 +1,34 @@
+{
+ "type" : "record",
+ "name" : "Problem",
+ "fields" : [
+ {"name": "edge", "type": "string"},
+ {"name": "startTime", "type": "long"},
+ {"name": "lastUpdate", "type": "long"},
+ {"name": "endTime", "type": "long"},
+ {
+ "name": "status",
+ "doc": "problem status",
+ "type": {
+ "type": "enum",
+ "name": "statusEnum",
+ "symbols" : [
+ "NONE",
+ "STILL",
+ "SOLVED",
+ "NEW"
+ ]
+ }
+ },
+ {
+ "name": "edgeUsedBy",
+ "doc": "customers using the edge",
+ "type": {"type" : "array", "items" : "string"}
+ },
+ {
+ "name": "impededLast",
+ "doc": "customers last impeded",
+ "type": {"type" : "array", "items" : "string"}
+ }
+ ]
+}
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc
new file mode 100644
index 000000000..622f8af61
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc
@@ -0,0 +1,8 @@
+{
+ "type" : "record",
+ "name" : "Situation",
+ "fields" : [
+ {"name": "problemID", "type": "string", "doc": "Identifier of the problem for lookup in problemMap"},
+ {"name": "violatedSLAs", "type": {"type" : "array", "items" : "string"}, "doc": "List of customers with SLA violations"}
+ ]
+}
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc
new file mode 100644
index 000000000..993f608ab
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc
@@ -0,0 +1,10 @@
+{
+ "type" : "record",
+ "name" : "TopologyEdges",
+ "fields" : [
+ {"name": "name", "type": "string", "doc": "Name of the Edge, typically a link name"},
+ {"name": "start", "type": "string", "doc": "Edge endpoint: start - a node name"},
+ {"name": "end", "type": "string", "doc": "Edge endpoint: end - a node name"},
+ {"name": "active", "type": "boolean", "doc": "Flag for active/inactive edges, inactive means a link is down"}
+ ]
+}
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc
new file mode 100644
index 000000000..bf5e62796
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc
@@ -0,0 +1,8 @@
+{
+ "type" : "record",
+ "name" : "TopologyNodes",
+ "fields" : [
+ {"name" : "name", "type" : "string", "doc": "The name of the node"},
+ {"name" : "mnname", "type" : "string", "doc": "The name of the node in Mininet"}
+ ]
+}
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js
new file mode 100644
index 000000000..cefb7a97c
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js
@@ -0,0 +1,80 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var ifCustomerName = executor.inFields["customerName"];
+var ifLinks = executor.inFields["links"];
+
+logger.trace("-- got infields, testing existing customer");
+var ctxtCustomer = executor.getContextAlbum("albumCustomerMap").get(ifCustomerName);
+if (ctxtCustomer != null) {
+ executor.getContextAlbum("albumCustomerMap").remove(ifCustomerName);
+ logger.trace("-- removed customer: <" + ifCustomerName + ">");
+}
+
+logger.trace("-- creating customer: <" + ifCustomerName + ">");
+var links = new Array();
+for (var i = 0; i < ifLinks.split(" ").length; i++) {
+ var link = executor.getContextAlbum("albumTopoEdges").get(ifLinks.split(" ")[i]);
+ if (link != null) {
+ logger.trace("-- link: <" + ifLinks.split(" ")[i] + ">");
+ links.push(ifLinks.split(" ")[i]);
+ } else {
+ logger.trace("-- unknown link: <" + ifLinks.split(" ")[i] + "> for customer <" + ifCustomerName + ">");
+ }
+}
+logger.trace("-- links: <" + links + ">");
+ctxtCustomer = "{customerName:" + ifCustomerName + ", dtSLA:" + executor.inFields["dtSLA"] + ", dtYTD:"
+ + executor.inFields["dtYTD"] + ", priority:" + executor.inFields["priority"] + ", satisfaction:"
+ + executor.inFields["satisfaction"] + ", links:[" + links + "]}";
+
+executor.getContextAlbum("albumCustomerMap").put(ifCustomerName, ctxtCustomer);
+
+if (logger.isTraceEnabled()) {
+ logger.trace(" >> *** Customers ***");
+ if (executor.getContextAlbum("albumCustomerMap") != null) {
+ for (var i = 0; i < executor.getContextAlbum("albumCustomerMap").values().size(); i++) {
+ logger.trace(" >> >> " + executor.getContextAlbum("albumCustomerMap").values().get(i).get("customerName")
+ + " : " + "dtSLA=" + executor.getContextAlbum("albumCustomerMap").values().get(i).get("dtSLA")
+ + " : " + "dtYTD=" + executor.getContextAlbum("albumCustomerMap").values().get(i).get("dtYTD")
+ + " : " + "links=" + executor.getContextAlbum("albumCustomerMap").values().get(i).get("links")
+ + " : " + "priority="
+ + executor.getContextAlbum("albumCustomerMap").values().get(i).get("priority") + " : "
+ + "satisfaction="
+ + executor.getContextAlbum("albumCustomerMap").values().get(i).get("satisfaction"));
+ }
+ } else {
+ logger.trace(" >> >> customer album is null");
+ }
+}
+
+executor.outFields["report"] = "customer ctxt :: added customer: " + ifCustomerName;
+
+logger.info("vpnsla: ctxt added customer " + ifCustomerName);
+
+var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = new returnValueType(true);
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js
new file mode 100644
index 000000000..dd667a87d
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js
@@ -0,0 +1,65 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var ifEdgeName = executor.inFields["edgeName"];
+var ifEdgeStatus = executor.inFields["status"];
+
+var albumTopoEdges = executor.getContextAlbum("albumTopoEdges");
+
+logger.trace("-- got infields, testing existing edge");
+
+var ctxtEdge = albumTopoEdges.get(ifEdgeName);
+if (ctxtEdge != null) {
+ albumTopoEdges.remove(ifEdgeName);
+ logger.trace("-- removed edge: <" + ifEdgeName + ">");
+}
+
+logger.trace("-- creating edge: <" + ifEdgeName + ">");
+ctxtEdge = "{name:" + ifEdgeName + ", start:" + executor.inFields["start"] + ", end:" + executor.inFields["end"]
+ + ", active:" + ifEdgeStatus + "}";
+albumTopoEdges.put(ifEdgeName, ctxtEdge);
+
+if (logger.isTraceEnabled()) {
+ logger.trace(" >> *** Edges ***");
+ if (albumTopoEdges != null) {
+ for (var i = 0; i < albumTopoEdges.values().size(); i++) {
+ logger.trace(" >> >> " + albumTopoEdges.values().get(i).get("name") + " \t "
+ + albumTopoEdges.values().get(i).get("start") + " --> " + albumTopoEdges.values().get(i).get("end")
+ + " \t " + albumTopoEdges.values().get(i).get("active"));
+ }
+ } else {
+ logger.trace(" >> >> edge album is null");
+ }
+}
+
+executor.outFields["report"] = "edge ctxt :: added edge " + ifEdgeName;
+
+logger.info("vpnsla: ctxt added edge " + ifEdgeName);
+
+var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = new returnValueType(true);
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js
new file mode 100644
index 000000000..532820f15
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js
@@ -0,0 +1,63 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var ifNodeName = executor.inFields["nodeName"];
+var ifMininetName = executor.inFields["mininetName"];
+
+var albumTopoNodes = executor.getContextAlbum("albumTopoNodes");
+
+logger.trace("-- got infields, testing existing node");
+
+var ctxtNode = albumTopoNodes.get(ifNodeName);
+if (ctxtNode != null) {
+ albumTopoNodes.remove(ifNodeName);
+ logger.trace("-- removed node: <" + ifNodeName + ">");
+}
+
+logger.trace("-- creating node: <" + ifNodeName + ">");
+ctxtNode = "{name:" + ifNodeName + ", mnname:" + ifMininetName + "}";
+albumTopoNodes.put(ifNodeName, ctxtNode);
+
+if (logger.isTraceEnabled()) {
+ logger.trace(" >> *** Nodes ***");
+ if (albumTopoNodes != null) {
+ for (var i = 0; i < albumTopoNodes.values().size(); i++) {
+ logger.trace(" >> >> " + albumTopoNodes.values().get(i).get("name") + " : "
+ + albumTopoNodes.values().get(i).get("mnname"));
+ }
+ } else {
+ logger.trace(" >> >> node album is null");
+ }
+}
+
+executor.outFields["report"] = "node ctxt :: added node " + ifNodeName;
+
+logger.info("vpnsla: ctxt added node " + ifNodeName);
+
+var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = new returnValueType(true);
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js
new file mode 100644
index 000000000..df96235d3
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var ifDecision = executor.inFields["decision"];
+var ifMatchStart = executor.inFields["matchStart"];
+
+var albumCustomerMap = executor.getContextAlbum("albumCustomerMap");
+var albumProblemMap = executor.getContextAlbum("albumProblemMap");
+
+switch (ifDecision.get("decision").toString()) {
+case "NONE":
+ executor.outFields["edgeName"] = "";
+ executor.outFields["action"] = "";
+ break;
+case "IMPEDE":
+ for (var i = 0; i < ifDecision.get("customers").size(); i++) {
+ customer = albumCustomerMap.get(ifDecision.get("customers").get(i).toString());
+ executor.outFields["edgeName"] = customer.get("links").get(0);
+ executor.outFields["action"] = "firewall";
+ }
+ break;
+case "REBUILD":
+ // finally solved, remove problem
+ albumProblemMap.remove(ifDecision.get("problemID"));
+ executor.outFields["edgeName"] = "L10"; // this is ###static###
+ executor.outFields["action"] = "rebuild"; // this is ###static###
+ break;
+default:
+
+}
+
+var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = new returnValueType(true);
+
+if (executor.outFields["action"] != "") {
+ logger.info("vpnsla: action is to " + executor.outFields["action"] + " " + executor.outFields["edgeName"]);
+} else {
+ logger.info("vpnsla: no action required");
+}
+
+logger.trace("-- outfields: " + executor.outFields);
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".a");
+
+var now = new Date().getTime();
+logger.info("VPN SLA finished in " + (now - ifMatchStart) + " ms");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js
new file mode 100644
index 000000000..ad6a51027
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js
@@ -0,0 +1,58 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+importClass(org.slf4j.LoggerFactory);
+
+importClass(java.util.ArrayList);
+
+importClass(org.apache.avro.generic.GenericData.Array);
+importClass(org.apache.avro.generic.GenericRecord);
+importClass(org.apache.avro.Schema);
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
+
+var ifSituation = executor.inFields["situation"];
+
+// create outfiled for decision
+var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance();
+decision.put("description", "None, everything is ok");
+decision.put("decision", "NONE");
+decision.put("customers", new ArrayList());
+
+var returnValueType = Java.type("java.lang.Boolean");
+if (ifSituation.get("problemID") == "NONE") {
+ logger.trace("-- no problem, everything ok");
+ var returnValue = new returnValueType(true);
+} else {
+ logger.trace("-- wrong problemID <" + problemID + "> for NONE task, we should not be here");
+ rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + problemID
+ + "> for NONE task, we should not be here");
+ var returnValue = new returnValueType(false);
+}
+
+executor.outFields["decision"] = decision;
+
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".d-non");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js
new file mode 100644
index 000000000..5f2e3be92
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+importClass(org.slf4j.LoggerFactory);
+
+importClass(java.util.ArrayList);
+
+importClass(org.apache.avro.generic.GenericData.Array);
+importClass(org.apache.avro.generic.GenericRecord);
+importClass(org.apache.avro.Schema);
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
+
+var ifSituation = executor.inFields["situation"];
+
+var albumCustomerMap = executor.getContextAlbum("albumCustomerMap");
+var albumProblemMap = executor.getContextAlbum("albumProblemMap");
+
+// create outfiled for decision
+var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance();
+decision.put("description", "None, everything is ok");
+decision.put("decision", "IMPEDE");
+decision.put("problemID", ifSituation.get("problemID"));
+decision.put("customers", new ArrayList());
+
+var problem = albumProblemMap.get(ifSituation.get("problemID"));
+var returnValueType = Java.type("java.lang.Boolean");
+if (problem != null && ifSituation.get("violatedSLAs").size() > 0) {
+ logger.trace("-- impede by priority");
+ for (var i = 0; i < problem.get("edgeUsedBy").size(); i++) {
+ customerCtxt = albumCustomerMap.get(problem.get("edgeUsedBy").get(i).toString());
+ if (customerCtxt.get("priority") == false) {
+ decision.get("customers").add(customerCtxt.get("customerName"));
+ }
+ }
+ var returnValue = new returnValueType(true);
+} else {
+ logger.trace("-- wrong problemID <" + ifSituation.get("problemID") + "> for PRIORITY task, we should not be here");
+ rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + ifSituation.get("problemID")
+ + "> for PRIORITY task, we should not be here");
+ var returnValue = new returnValueType(false);
+}
+
+// set impededLast to decision[customers]
+problem.get("impededLast").clear();
+problem.get("impededLast").addAll(decision.get("customers"));
+
+executor.outFields["decision"] = decision;
+logger.trace("-- decision: " + decision);
+
+logger.info("vpnsla: priority, impeding customers " + decision.get("customers"));
+
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".d-pri");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js
new file mode 100644
index 000000000..bd09a747b
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js
@@ -0,0 +1,83 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+importClass(org.slf4j.LoggerFactory);
+
+importClass(java.util.ArrayList);
+
+importClass(org.apache.avro.generic.GenericData.Array);
+importClass(org.apache.avro.generic.GenericRecord);
+importClass(org.apache.avro.Schema);
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
+
+var ifSituation = executor.inFields["situation"];
+
+var albumCustomerMap = executor.getContextAlbum("albumCustomerMap");
+var albumProblemMap = executor.getContextAlbum("albumProblemMap");
+
+// create outfiled for decision
+var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance();
+decision.put("description", "Impede given customers selected based on maximum SLA delta");
+decision.put("decision", "IMPEDE");
+decision.put("problemID", ifSituation.get("problemID"));
+decision.put("customers", new ArrayList());
+
+var problem = albumProblemMap.get(ifSituation.get("problemID"));
+var returnValueType = Java.type("java.lang.Boolean");
+if (problem != null && ifSituation.get("violatedSLAs").size() == 0) {
+ logger.trace("-- impede by maximum SLA");
+ var customer = "";
+ var customerSla = 0;
+ for (var i = 0; i < problem.get("edgeUsedBy").size(); i++) {
+ customerCtxt = albumCustomerMap.get(problem.get("edgeUsedBy").get(i).toString());
+ if (customerSla == 0) {
+ customerSla = customerCtxt.get("dtSLA") - customerCtxt.get("dtYTD");
+ }
+ if ((customerCtxt.get("dtSLA") - customerCtxt.get("dtYTD")) >= customerSla) {
+ customer = customerCtxt.get("customerName");
+ customerSla = (customerCtxt.get("dtSLA") - customerCtxt.get("dtYTD"));
+ }
+ }
+ decision.get("customers").add(customer);
+ var returnValue = new returnValueType(true);
+} else {
+ logger.trace("-- wrong problemID <" + ifSituation.get("problemID") + "> for SLA task, we should not be here");
+ rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + ifSituation.get("problemID")
+ + "> for SLA task, we should not be here");
+ var returnValue = new returnValueType(false);
+}
+
+// set impededLast to decision[customers]
+problem.get("impededLast").clear();
+problem.get("impededLast").addAll(decision.get("customers"));
+
+executor.outFields["decision"] = decision;
+logger.trace("-- decision: " + decision);
+
+logger.info("vpnsla: sla balance, impeding customers " + decision.get("customers"));
+
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".d-sla");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js
new file mode 100644
index 000000000..78bc94f00
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js
@@ -0,0 +1,63 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+importClass(org.slf4j.LoggerFactory);
+
+importClass(java.util.ArrayList);
+
+importClass(org.apache.avro.generic.GenericData.Array);
+importClass(org.apache.avro.generic.GenericRecord);
+importClass(org.apache.avro.Schema);
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
+
+var ifSituation = executor.inFields["situation"];
+
+var albumProblemMap = executor.getContextAlbum("albumProblemMap");
+
+// create outfiled for decision
+var decision = executor.subject.getOutFieldSchemaHelper("decision").createNewInstance();
+decision.put("description", "None, everything is ok");
+decision.put("decision", "REBUILD");
+decision.put("customers", new ArrayList());
+decision.put("problemID", ifSituation.get("problemID"));
+
+var returnValueType = Java.type("java.lang.Boolean");
+if (albumProblemMap.get(ifSituation.get("problemID")).get("status") == "SOLVED") {
+ logger.trace("-- problem solved");
+ var returnValue = new returnValueType(true);
+} else {
+ logger.trace("-- wrong problemID <" + problemID + "> for SOLVED task, we should not be here");
+ rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + problemID
+ + "> for SOLVED task, we should not be here");
+ var returnValue = new returnValueType(false);
+}
+
+executor.outFields["decision"] = decision;
+
+logger.info("vpnsla: sla solved, problem solved");
+
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".d-non");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js
new file mode 100644
index 000000000..48d69e8eb
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js
@@ -0,0 +1,170 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+importClass(org.slf4j.LoggerFactory);
+
+importClass(java.util.ArrayList);
+
+importClass(org.apache.avro.generic.GenericData.Array);
+importClass(org.apache.avro.generic.GenericRecord);
+importClass(org.apache.avro.Schema);
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
+
+var ifEdgeName = executor.inFields["edgeName"];
+var ifEdgeStatus = executor.inFields["status"].toString();
+var ifhasChanged = executor.inFields["hasChanged"];
+var ifMatchStart = executor.inFields["matchStart"];
+
+var albumCustomerMap = executor.getContextAlbum("albumCustomerMap");
+var albumProblemMap = executor.getContextAlbum("albumProblemMap");
+
+var linkProblem = albumProblemMap.get(ifEdgeName);
+
+// create outfiled for situation
+var situation = executor.subject.getOutFieldSchemaHelper("situation").createNewInstance();
+situation.put("violatedSLAs", new ArrayList());
+
+// create a string as states+hasChanged+linkProblem and switch over it
+var switchTest = ifEdgeStatus + ":" + ifhasChanged + ":" + (linkProblem == null ? "no" : "yes");
+switch (switchTest) {
+case "UP:false:no":
+ logger.trace("-- edge <" + ifEdgeName + "> UP:false:no => everything ok");
+ logger.info("vpnsla: everything ok");
+ situation.put("problemID", "NONE");
+ break;
+case "UP:false:yes":
+ logger.trace("-- edge <" + ifEdgeName + "> UP:false:yes ==> did we miss earlier up?, removing problem");
+ albumProblemMap.remove(ifEdgeName);
+ linkProblem = null;
+ situation.put("problemID", "NONE");
+ break;
+case "UP:true:no":
+ logger.trace("-- edge <" + ifEdgeName + "> UP:true:no ==> did we miss the earlier down?, creating new problem");
+ situation.put("problemID", ifEdgeName);
+ break;
+case "UP:true:yes":
+ logger.trace("-- edge <" + ifEdgeName + "> UP:true:yes ==> detected solution, link up again");
+ logger.info("vpnsla: problem solved");
+ linkProblem.put("endTime", ifMatchStart);
+ linkProblem.put("status", "SOLVED");
+ situation.put("problemID", "NONE");
+ break;
+case "DOWN:false:no":
+ logger.trace("-- edge <" + ifEdgeName + "> DOWN:false:no ==> did we miss an earlier down?, creating new problem");
+ situation.put("problemID", ifEdgeName);
+ break;
+case "DOWN:false:yes":
+ logger.trace("-- edge <" + ifEdgeName + "> DOWN:false:yes ==> problem STILL exists");
+ logger.info("vpnsla: problem still exists");
+ linkProblem.put("status", "STILL");
+ situation.put("problemID", ifEdgeName);
+ break;
+case "DOWN:true:no":
+ logger.trace("-- edge <" + ifEdgeName + "> DOWN:true:no ==> found NEW problem");
+ logger.info("vpnsla: this is a new problem");
+ situation.put("problemID", ifEdgeName);
+ break;
+case "DOWN:true:yes":
+ logger.trace("-- edge <" + ifEdgeName
+ + "> DOWN:true:yes ==> did we miss to remove an earlier problem?, remove and create new problem");
+ linkProblem = null;
+ situation.put("problemID", ifEdgeName);
+ break;
+
+default:
+ logger.error("-- input wrong for edge" + ifEdgeName + ": edge status <" + ifEdgeStatus
+ + "> unknown or null on hasChanged <" + ifhasChanged + ">");
+ rootLogger.error("-- input wrong for edge" + ifEdgeName + ": edge status <" + ifEdgeStatus
+ + "> unknown or null on hasChanged <" + ifhasChanged + ">");
+}
+
+// create new problem if situation requires it
+if (situation.get("problemID").equals(ifEdgeName) && linkProblem == null) {
+ logger.trace("-- edge <" + ifEdgeName + "> creating new problem");
+ linkProblem = albumProblemMap.getSchemaHelper().createNewInstance();
+ linkProblem.put("edge", ifEdgeName);
+ linkProblem.put("startTime", ifMatchStart);
+ linkProblem.put("lastUpdate", ifMatchStart);
+ linkProblem.put("endTime", 0);
+ linkProblem.put("status", "NEW");
+ linkProblem.put("edgeUsedBy", new ArrayList());
+ linkProblem.put("impededLast", new ArrayList());
+
+ for (var i = 0; i < albumCustomerMap.values().size(); i++) {
+ var customer = albumCustomerMap.values().get(i);
+ var customerLinks = albumCustomerMap.values().get(i).get("links");
+ for (var k = 0; k < customerLinks.size(); k++) {
+ if (customerLinks.get(k) == ifEdgeName) {
+ linkProblem.get("edgeUsedBy").add(customer.get("customerName"));
+ }
+ }
+ }
+ albumProblemMap.put(ifEdgeName, linkProblem);
+ logger.trace("-- edge <" + ifEdgeName + "> problem created as <" + linkProblem + ">");
+}
+
+// set dtYTD if situation requires it
+if (linkProblem != null && (linkProblem.get("status") == "STILL" || linkProblem.get("status") == "SOLVED")) {
+ var linkDownTimeinSecs = (ifMatchStart - linkProblem.get("lastUpdate")) / 1000;
+ logger.trace("-- edge <" + ifEdgeName + "> down time: " + linkDownTimeinSecs + " s");
+ for (var k = 0; k < linkProblem.get("impededLast").size(); k++) {
+ for (var i = 0; i < albumCustomerMap.values().size(); i++) {
+ var customer = albumCustomerMap.values().get(i);
+ if (customer.get("customerName").equals(linkProblem.get("impededLast").get(k))) {
+ logger.info("-- vpnsla: customer " + customer.get("customerName") + " YDT downtime increased from "
+ + customer.get("dtYTD") + " to " + (customer.get("dtYTD") + linkDownTimeinSecs));
+ customer.put("dtYTD", (customer.get("dtYTD") + linkDownTimeinSecs))
+ }
+ }
+ }
+ // set lastUpdate to this policy execution for next execution calculation
+ linkProblem.put("lastUpdate", ifMatchStart);
+}
+
+// check SLA violations if situation requires it
+if (linkProblem != null && linkProblem.get("status") != "SOLVED") {
+ logger.info(">e> customer\tDT SLA\tDT YTD\tviolation");
+ for (var i = 0; i < albumCustomerMap.values().size(); i++) {
+ var customer = albumCustomerMap.values().get(i);
+ if (customer.get("dtYTD") > customer.get("dtSLA")) {
+ situation.get("violatedSLAs").add(customer.get("customerName"));
+ logger.info(">e> " + customer.get("customerName") + "\t\t" + customer.get("dtSLA") + "s\t"
+ + customer.get("dtYTD") + "s\t" + "!!");
+ } else {
+ logger.info(">e> " + customer.get("customerName") + "\t\t" + customer.get("dtSLA") + "s\t"
+ + customer.get("dtYTD") + "s");
+ }
+ }
+}
+
+executor.outFields["situation"] = situation;
+
+logger.trace("-- out fields <" + executor.outFields + ">");
+
+var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = new returnValueType(true);
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".e");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js
new file mode 100644
index 000000000..c50dd9794
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js
@@ -0,0 +1,80 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+
+var now = new Date().getTime();
+executor.outFields["matchStart"] = now;
+
+importClass(org.slf4j.LoggerFactory);
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id);
+logger.trace("-- infields: " + executor.inFields);
+
+var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
+
+var ifEdgeName = executor.inFields["edgeName"];
+var ifLinkStatus = executor.inFields["status"];
+
+var albumTopoEdges = executor.getContextAlbum("albumTopoEdges");
+
+logger.trace("-- got infields, checking albumTopoEdges changes");
+
+var active = false;
+switch (ifLinkStatus.toString()) {
+case "UP":
+ active = true;
+ break;
+case "DOWN":
+ active = false;
+ break;
+default:
+ active = false;
+ logger.error("-- trigger sent unknown link status <" + ifLinkStatus + "> for link <" + ifEdgeName + ">");
+ rootLogger.error(executor.subject.id + " " + "-- trigger sent unknown link status <" + ifLinkStatus
+ + "> for link <" + ifEdgeName + ">");
+}
+
+var link = albumTopoEdges.get(ifEdgeName);
+if (link == null) {
+ logger.trace("-- link <" + ifEdgeName + "> not in albumTopoEdges");
+} else {
+ logger.trace("-- found link <" + link + "> in albumTopoEdges");
+ logger.trace("-- active <" + active + "> : link.active <" + link.get("active") + ">");
+ if (active != link.get("active")) {
+ link.put("active", active);
+ logger.trace("-- link <" + ifEdgeName + "> status changed to <active:" + link.get("active") + ">");
+ executor.outFields["hasChanged"] = true;
+ } else {
+ logger.trace("-- link <" + ifEdgeName + "> status not changed <active:" + link.get("active") + ">");
+ executor.outFields["hasChanged"] = false;
+ }
+}
+
+executor.outFields["edgeName"] = ifEdgeName;
+executor.outFields["status"] = ifLinkStatus;
+
+logger.info("vpnsla: detected " + ifEdgeName + " as " + ifLinkStatus);
+
+var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = new returnValueType(true);
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".m");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js
new file mode 100644
index 000000000..44767467d
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js
@@ -0,0 +1,58 @@
+/*
+ * ============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=========================================================
+ */
+
+load("nashorn:mozilla_compat.js");
+importClass(org.slf4j.LoggerFactory);
+
+var logger = executor.logger;
+logger.trace("start: " + executor.subject.id + " - TSL");
+
+var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
+
+var ifSituation = executor.inFields["situation"];
+
+var albumProblemMap = executor.getContextAlbum("albumProblemMap");
+
+var returnValueType = Java.type("java.lang.Boolean");
+if (ifSituation.get("problemID") == "NONE") {
+ logger.trace("-- situation has no problem, selecting <VpnSlaPolicyDecideNoneTask>");
+ executor.subject.getTaskKey("VpnSlaPolicyDecideNoneTask").copyTo(executor.selectedTask);
+ var returnValue = new returnValueType(true);
+} else if (albumProblemMap.get(ifSituation.get("problemID")).get("status") == "SOLVED") {
+ logger.trace("-- situation is solved, selecting <VpnSlaPolicyDecideSolvedTask>");
+ executor.subject.getTaskKey("VpnSlaPolicyDecideSolvedTask").copyTo(executor.selectedTask);
+ var returnValue = new returnValueType(true);
+} else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() > 0) {
+ logger.trace("-- situation is problem with violations, selecting <VpnSlaPolicyDecidePriorityTask>");
+ executor.subject.getTaskKey("VpnSlaPolicyDecidePriorityTask").copyTo(executor.selectedTask);
+ var returnValue = new returnValueType(true);
+} else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() == 0) {
+ logger.trace("-- situation is problem without violations, selecting <VpnSlaPolicyDecideSlaTask>");
+ executor.subject.getTaskKey("VpnSlaPolicyDecideSlaTask").copyTo(executor.selectedTask);
+ var returnValue = new returnValueType(true);
+} else {
+ logger.error("-- detected unknown decision for situation <" + ifSituation.get("problemID") + ">");
+ rootLogger.error(executor.subject.id + " " + "-- detected unknown decision for situation <"
+ + ifSituation.get("problemID") + ">");
+ var returnValue = new returnValueType(false);
+}
+
+logger.trace("finished: " + executor.subject.id);
+logger.debug(".d-tsl");
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex
new file mode 100644
index 000000000..eb4145788
--- /dev/null
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex
@@ -0,0 +1,325 @@
+#-------------------------------------------------------------------------------
+# ============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=========================================================
+#-------------------------------------------------------------------------------
+
+# ============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=PCVS-VpnSla version=1.0.0 description="Policies-Controlled Video Streaming, VPN SLA Policy Model"
+
+
+
+schema create name=reportDecl version=1.0.0 description="Report of activities of a policy/task" flavour=Java schema=java.lang.String
+event create name=ReportOut version=1.0.0 description="Report of a policy (issued by a task)" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="APEX" target="CtxtManagement"
+event parameter create name=ReportOut version=1.0.0 parName=report schemaName=reportDecl schemaVersion=1.0.0
+
+schema create name=timestampDecl version=1.0.0 description="Timestamp" flavour=Java schema=java.lang.Long
+
+
+
+schema create name=ctxtEdgeNameDecl version=1.0.0 description="Topology Edges: edge (link) name" flavour=Java schema=java.lang.String
+schema create name=ctxtEdgeStartDecl version=1.0.0 description="Topology Edges: edge endpoint (start)" flavour=Java schema=java.lang.String
+schema create name=ctxtEdgeEndDecl version=1.0.0 description="Topology Edges: edge endpoint (end)" flavour=Java schema=java.lang.String
+schema create name=ctxtEdgeStatusDecl version=1.0.0 description="Topology Edges: edge status as up (true) or down (false)" flavour=Java schema=java.lang.Boolean
+
+schema create name=ctxtTopologyEdgesDecl version=1.0.0 description="Topology Edges Context Map" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-edges.avsc"
+LE
+album create name=albumTopoEdges scope=global writable=true schemaName=ctxtTopologyEdgesDecl
+
+
+task create name=EdgeContextTask version=1.0.0 description="This task adds event context to edge context"
+task inputfield create name=EdgeContextTask version=1.0.0 fieldName=edgeName schemaName=ctxtEdgeNameDecl schemaVersion=1.0.0
+task inputfield create name=EdgeContextTask version=1.0.0 fieldName=start schemaName=ctxtEdgeStartDecl schemaVersion=1.0.0
+task inputfield create name=EdgeContextTask version=1.0.0 fieldName=end schemaName=ctxtEdgeEndDecl schemaVersion=1.0.0
+task inputfield create name=EdgeContextTask version=1.0.0 fieldName=status schemaName=ctxtEdgeStatusDecl schemaVersion=1.0.0
+task outputfield create name=EdgeContextTask version=1.0.0 fieldName=report schemaName=reportDecl schemaVersion=1.0.0
+task contextref create name=EdgeContextTask albumName=albumTopoEdges
+task logic create name=EdgeContextTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js"
+LE
+
+event create name=EdgeContextEventIn version=1.0.0 description="Event to add an Edge to engine Context" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="CtxtManagement" target="APEX"
+event parameter create name=EdgeContextEventIn version=1.0.0 parName=edgeName schemaName=ctxtEdgeNameDecl schemaVersion=1.0.0
+event parameter create name=EdgeContextEventIn version=1.0.0 parName=start schemaName=ctxtEdgeStartDecl schemaVersion=1.0.0
+event parameter create name=EdgeContextEventIn version=1.0.0 parName=end schemaName=ctxtEdgeEndDecl schemaVersion=1.0.0
+event parameter create name=EdgeContextEventIn version=1.0.0 parName=status schemaName=ctxtEdgeStatusDecl schemaVersion=1.0.0
+
+policy create name=EdgeContextPolicy version=1.0.0 description="Policy that adds an edge to context" template=FREEFORM firstState=EdgeContextState
+policy state create name=EdgeContextPolicy version=1.0.0 stateName=EdgeContextState triggerName=EdgeContextEventIn triggerVersion=1.0.0 defaultTaskName=EdgeContextTask defaultTaskVersion=1.0.0
+policy state output create name=EdgeContextPolicy version=1.0.0 stateName=EdgeContextState outputName=EdgeContextState_Output_Direct eventName=ReportOut eventVersion=1.0.0 nextState=NULL
+policy state taskref create name=EdgeContextPolicy version=1.0.0 stateName=EdgeContextState taskLocalName=doContext taskName=EdgeContextTask taskVersion=1.0.0 outputType=DIRECT outputName=EdgeContextState_Output_Direct
+
+
+
+schema create name=ctxtNodeNameDecl version=1.0.0 description="Topology Nodes: node name" flavour=Java schema=java.lang.String
+schema create name=ctxtNodeMininetNameDecl version=1.0.0 description="Topology Nodes: node name in Mininet" flavour=Java schema=java.lang.String
+
+schema create name=ctxtTopologyNodesDecl version=1.0.0 description="Topology Nodes Context Map" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/topology-nodes.avsc"
+LE
+album create name=albumTopoNodes scope=global writable=true schemaName=ctxtTopologyNodesDecl
+
+task create name=NodeContextTask version=1.0.0 description="This task adds event context to node context"
+task inputfield create name=NodeContextTask version=1.0.0 fieldName=nodeName schemaName=ctxtNodeNameDecl schemaVersion=1.0.0
+task inputfield create name=NodeContextTask version=1.0.0 fieldName=mininetName schemaName=ctxtNodeMininetNameDecl schemaVersion=1.0.0
+task outputfield create name=NodeContextTask version=1.0.0 fieldName=report schemaName=reportDecl schemaVersion=1.0.0
+task contextref create name=NodeContextTask albumName=albumTopoNodes
+task logic create name=NodeContextTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js"
+LE
+
+event create name=NodeContextEventIn version=1.0.0 description="Event to add Node to engine Context" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="CtxtManagement" target="APEX"
+event parameter create name=NodeContextEventIn version=1.0.0 parName=nodeName schemaName=ctxtNodeNameDecl schemaVersion=1.0.0
+event parameter create name=NodeContextEventIn version=1.0.0 parName=mininetName schemaName=ctxtNodeMininetNameDecl schemaVersion=1.0.0
+
+policy create name=NodeContextPolicy version=1.0.0 description="Policy that adds an node to context" template=FREEFORM firstState=NodeContextState
+policy state create name=NodeContextPolicy version=1.0.0 stateName=NodeContextState triggerName=NodeContextEventIn triggerVersion=1.0.0 defaultTaskName=NodeContextTask defaultTaskVersion=1.0.0
+policy state output create name=NodeContextPolicy version=1.0.0 stateName=NodeContextState outputName=NodeContextState_Output_Direct eventName=ReportOut eventVersion=1.0.0 nextState=NULL
+policy state taskref create name=NodeContextPolicy version=1.0.0 stateName=NodeContextState taskLocalName=doContext taskName=NodeContextTask taskVersion=1.0.0 outputType=DIRECT outputName=NodeContextState_Output_Direct
+
+
+
+
+schema create name=ctxtCustomerNameDecl version=1.0.0 description="Customer Context: customer name" flavour=Java schema=java.lang.String
+schema create name=ctxtCustomerPriorityDecl version=1.0.0 description="Customer Context: priority flag" flavour=Java schema=java.lang.Boolean
+schema create name=ctxtCustomerSatisfactionDecl version=1.0.0 description="Customer Context: satisfaction in percent" flavour=Java schema=java.lang.Integer
+schema create name=ctxtCustomerDowntimeSLADecl version=1.0.0 description="Customer Context: contracted downtime as per SLA" flavour=Java schema=java.lang.Integer
+schema create name=ctxtCustomerDowntimeYTDDecl version=1.0.0 description="Customer Context: year-to-date downtime experienced" flavour=Java schema=java.lang.Integer
+schema create name=ctxtCustomerLinksDecl version=1.0.0 description="Customer Context: links a customer uses (for events/task)" flavour=Java schema=java.lang.String
+
+schema create name=ctxtCustomerMapDecl version=1.0.0 description="Map of customers with all known information" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/customers.avsc"
+LE
+album create name=albumCustomerMap scope=global writable=true schemaName=ctxtCustomerMapDecl
+
+task create name=CustomerContextTask version=1.0.0 description="This task adds event context to customer context"
+task inputfield create name=CustomerContextTask version=1.0.0 fieldName=customerName schemaName=ctxtCustomerNameDecl schemaVersion=1.0.0
+task inputfield create name=CustomerContextTask version=1.0.0 fieldName=priority schemaName=ctxtCustomerPriorityDecl schemaVersion=1.0.0
+task inputfield create name=CustomerContextTask version=1.0.0 fieldName=satisfaction schemaName=ctxtCustomerSatisfactionDecl schemaVersion=1.0.0
+task inputfield create name=CustomerContextTask version=1.0.0 fieldName=dtSLA schemaName=ctxtCustomerDowntimeSLADecl schemaVersion=1.0.0
+task inputfield create name=CustomerContextTask version=1.0.0 fieldName=dtYTD schemaName=ctxtCustomerDowntimeYTDDecl schemaVersion=1.0.0
+task inputfield create name=CustomerContextTask version=1.0.0 fieldName=links schemaName=ctxtCustomerLinksDecl schemaVersion=1.0.0
+task outputfield create name=CustomerContextTask version=1.0.0 fieldName=report schemaName=reportDecl schemaVersion=1.0.0
+task contextref create name=CustomerContextTask albumName=albumCustomerMap
+task contextref create name=CustomerContextTask albumName=albumTopoEdges
+task logic create name=CustomerContextTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js"
+LE
+
+event create name=CustomerContextEventIn version=1.0.0 description="Event to add Customers to engine Context" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="CtxtManagement" target="APEX"
+event parameter create name=CustomerContextEventIn version=1.0.0 parName=customerName schemaName=ctxtCustomerNameDecl schemaVersion=1.0.0
+event parameter create name=CustomerContextEventIn version=1.0.0 parName=priority schemaName=ctxtCustomerPriorityDecl schemaVersion=1.0.0
+event parameter create name=CustomerContextEventIn version=1.0.0 parName=satisfaction schemaName=ctxtCustomerSatisfactionDecl schemaVersion=1.0.0
+event parameter create name=CustomerContextEventIn version=1.0.0 parName=dtSLA schemaName=ctxtCustomerDowntimeSLADecl schemaVersion=1.0.0
+event parameter create name=CustomerContextEventIn version=1.0.0 parName=dtYTD schemaName=ctxtCustomerDowntimeYTDDecl schemaVersion=1.0.0
+event parameter create name=CustomerContextEventIn version=1.0.0 parName=links schemaName=ctxtCustomerLinksDecl schemaVersion=1.0.0
+
+policy create name=CustomerContextPolicy version=1.0.0 description="Policy that adds Customer information to engine context" template=FREEFORM firstState=CustomerContextState
+policy state create name=CustomerContextPolicy version=1.0.0 stateName=CustomerContextState triggerName=CustomerContextEventIn triggerVersion=1.0.0 defaultTaskName=CustomerContextTask defaultTaskVersion=1.0.0
+policy state output create name=CustomerContextPolicy version=1.0.0 stateName=CustomerContextState outputName=CustomerContextState_Output_Direct eventName=ReportOut eventVersion=1.0.0 nextState=NULL
+policy state taskref create name=CustomerContextPolicy version=1.0.0 stateName=CustomerContextState taskLocalName=doContext taskName=CustomerContextTask taskVersion=1.0.0 outputType=DIRECT outputName=CustomerContextState_Output_Direct
+
+
+
+
+schema create name=edgeNameDecl version=1.0.0 description="Edge name" flavour=Java schema=java.lang.String
+schema create name=edgeStatusDecl version=1.0.0 description="Statuf of the edge (UP, DOWN)" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/link-status.avsc"
+LE
+schema create name=edgeChangedDecl version=1.0.0 description="Status Change (true:change, false:no change)" flavour=Java schema=java.lang.Boolean
+
+task create name=VpnSlaPolicyMatchTask version=1.0.0 description="Pre-process an edge event"
+task inputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=status schemaName=edgeStatusDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=status schemaName=edgeStatusDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=hasChanged schemaName=edgeChangedDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyMatchTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task contextref create name=VpnSlaPolicyMatchTask albumName=albumTopoEdges
+task logic create name=VpnSlaPolicyMatchTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js"
+LE
+
+
+
+
+schema create name=problemMapDecl version=1.0.0 description="Map of problems with all known Information" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/problems.avsc"
+LE
+album create name=albumProblemMap scope=global writable=true schemaName=problemMapDecl
+
+schema create name=establishSituationDecl version=1.0.0 description="Establish: the situation that was established" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/situation.avsc"
+LE
+
+task create name=VpnSlaPolicyEstablishTask version=1.0.0 description="Task taking a match event and establishing a situation"
+task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=status schemaName=edgeStatusDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=hasChanged schemaName=edgeChangedDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyEstablishTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task contextref create name=VpnSlaPolicyEstablishTask albumName=albumProblemMap
+task contextref create name=VpnSlaPolicyEstablishTask albumName=albumCustomerMap
+task logic create name=VpnSlaPolicyEstablishTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js"
+LE
+
+
+
+
+schema create name=decideDecisionDecl version=1.0.0 description="Decide: the taken decision" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/avro/decision.avsc"
+LE
+
+task create name=VpnSlaPolicyDecideNoneTask version=1.0.0 description="Decide task for a 'none' problem"
+task inputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecideNoneTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task logic create name=VpnSlaPolicyDecideNoneTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js"
+LE
+
+
+task create name=VpnSlaPolicyDecideSlaTask version=1.0.0 description="Decide task solving the problem by balancing SLAs"
+task inputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecideSlaTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task contextref create name=VpnSlaPolicyDecideSlaTask albumName=albumCustomerMap
+task contextref create name=VpnSlaPolicyDecideSlaTask albumName=albumProblemMap
+task logic create name=VpnSlaPolicyDecideSlaTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js"
+LE
+
+
+task create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 description="Decide task solving the problem by using customer priorities"
+task inputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecidePriorityTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task contextref create name=VpnSlaPolicyDecidePriorityTask albumName=albumCustomerMap
+task contextref create name=VpnSlaPolicyDecidePriorityTask albumName=albumProblemMap
+task logic create name=VpnSlaPolicyDecidePriorityTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js"
+LE
+
+
+task create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 description="Decide task solving the problem by using customer priorities"
+task inputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=situation schemaName=establishSituationDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyDecideSolvedTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task contextref create name=VpnSlaPolicyDecideSolvedTask albumName=albumProblemMap
+task logic create name=VpnSlaPolicyDecideSolvedTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js"
+LE
+
+
+
+
+schema create name=actionDecl version=1.0.0 description="An action for the actioning system" flavour=Java schema=java.lang.String
+
+task create name=VpnSlaPolicyActTask version=1.0.0 description="Task issueing an action for taken decision"
+task inputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0
+task inputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0
+task outputfield create name=VpnSlaPolicyActTask version=1.0.0 fieldName=action schemaName=actionDecl schemaVersion=1.0.0
+task contextref create name=VpnSlaPolicyActTask albumName=albumCustomerMap
+task contextref create name=VpnSlaPolicyActTask albumName=albumProblemMap
+task logic create name=VpnSlaPolicyActTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js"
+LE
+
+
+
+
+
+
+
+event create name=VpnSlaTrigger version=1.0.0 description="Event triggering the VPN SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="TriggerSys" target="VpnSlaMatch"
+event parameter create name=VpnSlaTrigger version=1.0.0 parName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0
+event parameter create name=VpnSlaTrigger version=1.0.0 parName=status schemaName=edgeStatusDecl schemaVersion=1.0.0
+
+event create name=VpnSlaMatchOut version=1.0.0 description="Event with matched trigger for the VPN SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="VpnSlaMatch" target="VpnSlaEstablish"
+event parameter create name=VpnSlaMatchOut version=1.0.0 parName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0
+event parameter create name=VpnSlaMatchOut version=1.0.0 parName=status schemaName=edgeStatusDecl schemaVersion=1.0.0
+event parameter create name=VpnSlaMatchOut version=1.0.0 parName=hasChanged schemaName=edgeChangedDecl schemaVersion=1.0.0
+event parameter create name=VpnSlaMatchOut version=1.0.0 parName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+
+event create name=VpnSlaEstablishOut version=1.0.0 description="Event with situation for the SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="SlaEstablish" target="SlaDecide"
+event parameter create name=VpnSlaEstablishOut version=1.0.0 parName=situation schemaName=establishSituationDecl schemaVersion=1.0.0
+event parameter create name=VpnSlaEstablishOut version=1.0.0 parName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+
+event create name=VpnSlaDecideOut version=1.0.0 description="Event with a decision for the SLA policy" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="SlaDecide" target="SlaAct"
+event parameter create name=VpnSlaDecideOut version=1.0.0 parName=decision schemaName=decideDecisionDecl schemaVersion=1.0.0
+event parameter create name=VpnSlaDecideOut version=1.0.0 parName=matchStart schemaName=timestampDecl schemaVersion=1.0.0
+
+event create name=VpnSlaActOut version=1.0.0 description="Event action" nameSpace=org.onap.policy.apex.examples.pcvs.vpnsla source="SlaAct" target="ActioningSystem"
+event parameter create name=VpnSlaActOut version=1.0.0 parName=edgeName schemaName=edgeNameDecl schemaVersion=1.0.0
+event parameter create name=VpnSlaActOut version=1.0.0 parName=action schemaName=actionDecl schemaVersion=1.0.0
+
+
+policy create name=VpnSlaPolicy version=1.0.0 description="Policy deciding customer treatment based on SLAs as MEDA policy" template=FREEFORM firstState=VpnSlaPolicyMatchState
+
+policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyActState triggerName=VpnSlaDecideOut triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyActTask defaultTaskVersion=1.0.0
+policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyActState outputName=SlaPolicyAct_Output_Direct eventName=VpnSlaActOut eventVersion=1.0.0 nextState=NULL
+policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyActState taskLocalName=act taskName=VpnSlaPolicyActTask taskVersion=1.0.0 outputType=DIRECT outputName=SlaPolicyAct_Output_Direct
+
+policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState triggerName=VpnSlaEstablishOut triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyDecideSlaTask defaultTaskVersion=1.0.0
+policy state contextref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState albumName=albumProblemMap
+policy state selecttasklogic create name=VpnSlaPolicy stateName=VpnSlaPolicyDecideState logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js"
+LE
+policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState outputName=VpnSlaPolicyDecide_Output_Direct eventName=VpnSlaDecideOut eventVersion=1.0.0 nextState=VpnSlaPolicyActState
+policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decideNone taskName=VpnSlaPolicyDecideNoneTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct
+policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decideNone taskName=VpnSlaPolicyDecideSolvedTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct
+policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decideSla taskName=VpnSlaPolicyDecideSlaTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct
+policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyDecideState taskLocalName=decidePriority taskName=VpnSlaPolicyDecidePriorityTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyDecide_Output_Direct
+
+policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpmSlaPolicyEstablishState triggerName=VpnSlaMatchOut triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyEstablishTask defaultTaskVersion=1.0.0
+policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpmSlaPolicyEstablishState outputName=VpnSlaPolicyEstablish_Output_Direct eventName=VpnSlaEstablishOut eventVersion=1.0.0 nextState=VpnSlaPolicyDecideState
+policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpmSlaPolicyEstablishState taskLocalName=establish taskName=VpnSlaPolicyEstablishTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyEstablish_Output_Direct
+
+policy state create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyMatchState triggerName=VpnSlaTrigger triggerVersion=1.0.0 defaultTaskName=VpnSlaPolicyMatchTask defaultTaskVersion=1.0.0
+policy state output create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyMatchState outputName=VpnSlaPolicyMatch_Output_Direct eventName=VpnSlaMatchOut eventVersion=1.0.0 nextState=VpmSlaPolicyEstablishState
+policy state taskref create name=VpnSlaPolicy version=1.0.0 stateName=VpnSlaPolicyMatchState taskLocalName=match taskName=VpnSlaPolicyMatchTask taskVersion=1.0.0 outputType=DIRECT outputName=VpnSlaPolicyMatch_Output_Direct
+
+
+
+validate
+quit
+