summaryrefslogtreecommitdiffstats
path: root/examples/examples-pcvs/src/site-docs/adoc/fragments
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-pcvs/src/site-docs/adoc/fragments')
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/install.adoc133
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/introduction.adoc24
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla.adoc165
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-ctxt.adoc36
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-internal.adoc32
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-trigger.adoc24
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/cli-spec.adoc25
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-customers.adoc23
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-edges.adoc23
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-nodes.adoc23
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-customer.adoc23
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-edges.adoc22
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-nodes.adoc22
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/events-trigger.adoc23
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-act.adoc23
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-none.adoc20
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-priority.adoc20
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-sla.adoc20
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-solved.adoc20
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide.adoc26
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-establish.adoc29
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-match.adoc25
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/policy.adoc28
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-linkmonitor.adoc24
-rw-r--r--examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-mininet.adoc23
25 files changed, 856 insertions, 0 deletions
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/install.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/install.adoc
new file mode 100644
index 000000000..f849c43ab
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/install.adoc
@@ -0,0 +1,133 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Install Demo
+
+Requirements:
+
+* Ubuntu server: 1.4 GB
+* Ubuntu with Xubuntu Desktop, git, Firefox: 2.3 GB
+* Ubuntu with all, system updated: 3 GB
+* With ZK, Kafka, VLC, Mininet, Floodlight, Python: 4.4 GB
+* APEX Build (M2 and built): M2 ~ 2 GB, APEX ~3.5 GB
+* APEX install (not build locally): ~ 300 MB
+
+
+On a Ubuntu OS (install a stable or LTS server first)
+
+----
+# pre for Ubuntu, tools and X
+sudo apt-get -y install --no-install-recommends software-properties-common
+sudo apt-get -y install --no-install-recommends build-essential
+sudo apt-get -y install --no-install-recommends git
+sudo aptitude -y install --no-install-recommends xubuntu-desktop
+sudo apt-get -y install --no-install-recommends firefox
+
+
+# install Java
+sudo add-apt-repository ppa:webupd8team/java
+sudo apt-get update
+sudo apt-get -y install --no-install-recommends oracle-java8-installer
+java -version
+
+
+# reboot system, run system update, then continue
+
+# if VBox additions are needed, install and reboot
+sudo (cd /usr/local/share; wget https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_5.2.7-120528.iso)
+sudo mount /usr/local/share/VBoxGuestAdditions_5.2.7-120528.iso /media/cdrom
+sudo (cd /media/cdrom;VBoxLinuxAdditions.run)
+
+
+# update apt-get DB
+sudo apt-get update
+
+# if APEX is build from source, install maven and rpm
+sudo apt-get install maven rpm
+
+# install ZooKeeper
+sudo apt-get install zookeeperd
+
+# install Kafka
+(cd /tmp;wget http://ftp.heanet.ie/mirrors/www.apache.org/dist/kafka/1.0.0/kafka_2.12-1.0.0.tgz --show-progress)
+sudo mkdir /opt/Kafka
+sudo tar -xvf /tmp/kafka_2.12-1.0.0.tgz -C /opt/Kafka/
+
+# install mininet
+cd /usr/local/src
+sudo git clone https://github.com/mininet/mininet.git
+(cd mininet;util/install.sh -a)
+
+# install floodlight, requires ant
+sudo apt-get install ant
+cd /usr/local/src
+sudo wget --no-check-certificate https://github.com/floodlight/floodlight/archive/master.zip
+sudo unzip master.zip
+cd floodlight-master
+sudo ant
+sudo mkdir /var/lib/floodlight
+sudo chmod 777 /var/lib/floodlight
+
+# install python pip
+sudo apt-get install python-pip
+
+# install kafka-python (need newer version from github)
+cd /usr/local/src
+sudo git clone https://github.com/dpkp/kafka-python
+sudo pip install ./kafka-python
+
+# install vlc
+sudo apt-get install vlc
+----
+
+Install APEX either from source or from a distribution package.
+See the APEX documentation for details.
+We assume that APEX is installed in `/opt/ericsson/apex/apex`
+
+Copy the LinkMonitor file to Kafka-Python
+
+----
+sudo cp /opt/ericsson/apex/apex/examples/scripts/pcvs/vpnsla/LinkMonitor.py /usr/local/src/kafka-python
+----
+
+Change the Logback configuration in APEX to logic logging
+
+----
+(cd /opt/ericsson/apex/apex/etc; sudo cp logback-logic.xml logback.xml)
+----
+
+
+== Get the Demo Video
+
+* For all download options of the movie please visit link:http://bbb3d.renderfarming.net/download.html[]
+* For lower-res downloads and mirrors see link:https://peach.blender.org/download[]
+
+----
+sudo mkdir /usr/local/src/videos
+----
+
+
+Standard 720p (recommended)
+
+----
+(cd /usr/local/src/videos; sudo curl -o big_buck_bunny_480p_surround.avi http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_surround-fix.avi)
+----
+
+
+Full HD video
+
+----
+(cd videos; sudo curl -o bbb_sunflower_1080p_60fps_normal.mp4 http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4)
+----
+
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/introduction.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/introduction.adoc
new file mode 100644
index 000000000..5b4fc1206
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/introduction.adoc
@@ -0,0 +1,24 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+This module contains several demos for Policy-controlled Video Streaming (PCVS).
+Each demo defines a policy using AVRO and Javascript (or other scripting languages for the policy logic).
+To run the demo, a vanilla Ubuntu server with some extra software packages is required:
+
+* Mininet as network simulator
+* Floodlight as SDN controller
+* Kafka as messaging system
+* Zookeeper for Kafka configuration
+* APEX for policy control
+
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla.adoc
new file mode 100644
index 000000000..80b43a7dd
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla.adoc
@@ -0,0 +1,165 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== VPN SLA Demo
+
+This demo uses a network with several central office and core switches, over which two VPNs are run.
+A customer `A` has two location `A1` and `A2` and a VPN between them.
+A customer `B` has two location `B1` and `B2` and a VPN between them.
+
+.VPN SLA Architecture
+image::pcvs/vpnsla-arch.png[VPN SLA Architecture]
+
+The architecture above shows the scenario.
+The components are realized in this demo as follows:
+
+* _CEP / Analytics_ - a simple Python script taking events from Kafka and sending them to APEX
+* _APEX / Policy_ - the APEX engine running the VPA SLA policy
+* _Controller_ - A vanilla Floodlight controller taking events from the Link Monitor and configuring Mininet
+* _Network_ - A network created using Mininet
+
+The demo requires to start some software (detailed below).
+To show actual video streams, we use `VLC`.
+If you do not want to show video streams, but only the policy, skip the `VLC` section.
+
+All shown scripts are available in a full APEX installation in `$APEX_HOME/examples/scripts/pcvs/vpnsla`.
+
+=== Start all Software
+
+Create environment variables in a file, say `env.sh`.
+In each new Xterm
+
+* Source these environment settings, e.g. `. ./env.sh`
+* Run the commands below as root (`sudo` per command or `sudo -i` for interactive mode as shown below)
+
+----
+#!/usr/bin/env bash
+
+export src_dir=/usr/local/src
+export APEX_HOME=/opt/ericsson/apex/apex
+export APEX_USER=apexuser
+----
+
+In a new Xterm, start Floodlight
+
+----
+sudo -i
+. ./env.sh
+cd $src_dir/floodlight-master && java -jar target/floodlight.jar
+----
+
+In a new Xterm start Mininet
+
+----
+sudo -i
+. ./env.sh
+mn -c && python $APEX_HOME/examples/scripts/pcvs/vpnsla/MininetTopology.py
+----
+
+In a new Xterm, start Kafka
+
+----
+sudo -i
+. ./env.sh
+/opt/Kafka/kafka_2.12-1.0.0/bin/kafka-server-start.sh /opt/Kafka/kafka_2.12-1.0.0/config/server.properties
+----
+
+In a new Xerm start APEX with the Kafka configuration for this demo
+
+----
+cd $APEX_HOME
+./bin/apexApps.sh engine -c examples/config/pcvs/vpnsla/kafka2kafka.json
+----
+
+In a new Xterm start the Link Monitor.
+The Link Monitor has a 30 second sleep to slow down the demonstration.
+So the first action of it comes 30 seconds after start.
+Every new action in 30 second intervals.
+
+----
+sudo -i
+. ./env.sh
+cd $src_dir
+xterm -hold -e 'python3 $src_dir/kafka-python/LinkMonitor.py' &
+----
+
+Now all software should be started and the demo is running.
+The Link Monitor will send link up events, picked up by APEX which triggers the policy.
+Since there is no problem, the policy will do nothing.
+
+
+
+=== Create 2 Video Streams with VLC
+
+In the Mininet console, type `xterm A1 A2` and `xterm B1 B2` to open terminals on these nodes.
+
+`A2` and `B2` are the receiving nodes.
+In these terminals, run `vlc-wrapper`.
+In each opened VLC window do
+
+* Click Media -> Open Network Stream
+* Give the URL as `rtp://@:5004`
+
+`A1` and `B1` are the sending nodes (sending the video stream)
+In these terminals, run `vlc-wrapper`.
+In each opened VLC window do
+
+* Click Media -> Stream
+* Add the video (from `/usr/local/src/videos`)
+* Click `Stream`
+* Click `Next`
+* Change the destination `RTP / MPEG Transport Stream` and click `Add`
+* Change the address and type to `10.0.0.2` in `A1` and to `10.0.0.4` in `B1`
+* Turn off `Active Transcoding` (this is important to minimize CPU load)
+* Click `Next`
+* Click `Stream`
+
+The video should be streaming across the network from `A1` to `A2` and from `B1` to `B2`.
+If the video streams a slow or interrupted the CPU load is too high.
+In these cases either try a better machine or use a different (lower quality) video stream.
+
+=== Take out L09 and let the Policy do it's Magic
+
+Now it is time to take out the link `L09`.
+This will be picked up by the Link Monitor, which sends a new event (L09 DOWN) to the policy.
+The policy then will calculate which customer should be impeded (throttled).
+This will continue, until SLAs are violated, then a priority calculation will kick in (Customer `A` is prioritized in the setup).
+
+To initiate this, simply type `link s5 s6 down` in the Mininet console followed by `exit`.
+
+If you have the video streams running, you will see one or the other struggeling, depending on the policy decision.
+
+=== Reset the Demo
+
+If you want to reset the demo, simple stop (in this order) the following process
+
+* Link Monitor
+* APEX
+* Mininet
+* Floodlight
+
+Then restart them in this order
+
+* Floodlight
+* Mininet
+* APEX
+* Link Monitor
+
+
+=== Monitor the Demo
+
+Floodlight and APEX provide REST interfaces for monitoring.
+
+* Floodlight: see link:https://floodlight.atlassian.net/wiki/spaces/floodlightcontroller/pages/40403023/Web+GUI[Floodlight Docs] for details on how to access the monitoring. In a standard installation as we use here, pointing browser to the URL `http://localhost:8080/ui/pages/index.html` should work on the same host
+* APEX please see the APEX documentation for link:https://ericsson.github.io/apex-docs/user-manual/engine-apps/um-engapps-eng-monitoring.html[Monitoring Client] or link:https://ericsson.github.io/apex-docs/user-manual/engine-apps/um-engapps-full-client.html[Full Client] for details on how to monitor APEX.
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-ctxt.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-ctxt.adoc
new file mode 100644
index 000000000..6d71c6f93
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-ctxt.adoc
@@ -0,0 +1,36 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Context Schemas
+
+The context schemas are for the local context.
+We model edges and nodes for the topology, customers, and problems with all information on detected problems.
+
+.AVRO Schema Edges
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/avro/topology-edges.avsc[AVRO Schema Edges]
+----
+
+
+.AVRO Schema Nodes
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/avro/topology-nodes.avsc[AVRO Schema Nodes]
+----
+
+.AVRO Schema Customers
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/avro/customers.avsc[AVRO Schema Customers]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-internal.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-internal.adoc
new file mode 100644
index 000000000..29822040d
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-internal.adoc
@@ -0,0 +1,32 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Internal Event Schemas
+
+For the communication between some of the policy states we are also using Avro schemas, namely:
+
+* Establish -> Decide: a schema for the established situation
+* Decide -> Act: a schema for the taken decision
+
+.AVRO Schema Situation
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/avro/situation.avsc[AVRO Schema Situation]
+----
+
+
+.AVRO Schema Decision
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/avro/decision.avsc[AVRO Schema Decision]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-trigger.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-trigger.adoc
new file mode 100644
index 000000000..255cb9b32
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/avro-trigger.adoc
@@ -0,0 +1,24 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Schema for Trigger Event Status
+
+The trigger event provides a status as `UP` or `DOWN`.
+To avoid tests for these strings in the logic, we defined an Avro schema for an enumeration.
+This does not impact the trigger system (it can still send the strings), but makes the task logic simpler.
+
+.AVRO Schema Link Status
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/avro/link-status.avsc[AVRO Schema Link Status]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/cli-spec.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/cli-spec.adoc
new file mode 100644
index 000000000..28ad0c653
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/cli-spec.adoc
@@ -0,0 +1,25 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Complete Policy Definition
+
+The complete policy definition is realized using the APEX CLI Editor.
+The script below shows the actual policy specification.
+All logic and schemas are included (as macro file).
+
+.APEX VPN SLA Policy Specification
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/vpnsla.apex[APEX VPN SLA Policy Specification]
+----
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-customers.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-customers.adoc
new file mode 100644
index 000000000..c430621e4
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-customers.adoc
@@ -0,0 +1,23 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Context Events: Customers
+
+The following events create all customers of the topology.
+
+.Context Events Customers
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/examples/events/pcvs/vpnsla/CtxtCustomers.json[Context Events Customers]
+----
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-edges.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-edges.adoc
new file mode 100644
index 000000000..fa4282cd9
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-edges.adoc
@@ -0,0 +1,23 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Context Events: Edges
+
+The following events create all edges of the topology.
+
+.Context Events Edges
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/examples/events/pcvs/vpnsla/CtxtEdges.json[Context Events Edges]
+----
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-nodes.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-nodes.adoc
new file mode 100644
index 000000000..980aef088
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-events-nodes.adoc
@@ -0,0 +1,23 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Context Events: Nodes
+
+The following events create all nodes of the topology.
+
+.Context Events Nodes
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/examples/events/pcvs/vpnsla/CtxtNodes.json[Context Events Nodes]
+----
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-customer.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-customer.adoc
new file mode 100644
index 000000000..0463507d1
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-customer.adoc
@@ -0,0 +1,23 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Customer Context
+
+The customer context logic simply takes the trigger event (for context) and creates a new customer in the local context topology.
+
+.JS Logic Customer Context
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/ctxt-customer.js[JS Logic Customer Context]
+----
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-edges.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-edges.adoc
new file mode 100644
index 000000000..b64ca3e0b
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-edges.adoc
@@ -0,0 +1,22 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Edge Context
+
+The edge context logic simply takes the trigger event (for context) and creates a new edge in the local context topology.
+
+.JS Logic Edge Context
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/ctxt-edges.js[JS Logic Edge Context]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-nodes.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-nodes.adoc
new file mode 100644
index 000000000..f8ff014b8
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/ctxt-logic-nodes.adoc
@@ -0,0 +1,22 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Node Context
+
+The node context logic simply takes the trigger event (for context) and creates a new node in the local context topology.
+
+.JS Logic Node Context
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/ctxt-nodes.js[JS Logic Node Context]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/events-trigger.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/events-trigger.adoc
new file mode 100644
index 000000000..687936c16
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/events-trigger.adoc
@@ -0,0 +1,23 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Example Trigger Events
+
+The following events are examples for trigger events
+
+.Trigger Examples
+[source,json,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/examples/events/pcvs/vpnsla/Trigger_Edge09.json[Trigger Examples]
+----
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-act.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-act.adoc
new file mode 100644
index 000000000..6e0ca0c9e
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-act.adoc
@@ -0,0 +1,23 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Policy Act State
+
+This is the logic for the act state.
+It is simply selecting an action, and creating the repsonse event for the orchestrator (the output of the policy).
+
+.JS Logic Policy Act State
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/task-act.js[JS Logic Policy Act State]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-none.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-none.adoc
new file mode 100644
index 000000000..f35d55365
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-none.adoc
@@ -0,0 +1,20 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Decide None
+
+.JS Logic Policy Decide State - None
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/task-decide-none.js[JS Logic Policy Decide State - None]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-priority.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-priority.adoc
new file mode 100644
index 000000000..d04e8c2e6
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-priority.adoc
@@ -0,0 +1,20 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+=== Logic: Decide Priority
+
+.JS Logic Policy Decide State - Priority
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/task-decide-priority.js[JS Logic Policy Decide State - Priority]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-sla.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-sla.adoc
new file mode 100644
index 000000000..cb3d9cb85
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-sla.adoc
@@ -0,0 +1,20 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Decide SLA
+
+.JS Logic Policy Decide State - SLA
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/task-decide-sla.js[JS Logic Policy Decide State - SLA]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-solved.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-solved.adoc
new file mode 100644
index 000000000..8cf601c90
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide-solved.adoc
@@ -0,0 +1,20 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Decide Solved
+
+.JS Logic Policy Decide State - Solved
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/task-decide-solved.js[JS Logic Policy Decide State - Solved]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide.adoc
new file mode 100644
index 000000000..0b5b0b819
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-decide.adoc
@@ -0,0 +1,26 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Policy Decide State
+
+The decide state can select between different algorithms depending on the situation.
+So it needs a Task Selection Logic (TSL).
+This TSL select a task in the current policy execution (i.e. potentially a different one per execution).
+
+.JS Logic Policy Decide State - TSL
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/tsl-decide.js[JS Logic Policy Decide State - TSL]
+----
+
+The actual task logic are then `none`, `solved`, `sla`, and `priority`.
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-establish.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-establish.adoc
new file mode 100644
index 000000000..9bf74738b
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-establish.adoc
@@ -0,0 +1,29 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Policy Establish State
+
+This is the logic for the establish state.
+It is the most complicated logic, since establishing a situation for a decision is the most important part of any policy.
+First, the policy describes what we find (the switch block), in terms of 8 normal situations and 1 extreme error case.
+
+If required, it creates local context information for the problem (if it is new) or updates it (if the problem still exists).
+It also calculates customer SLA downtime and checks for any SLA violations.
+Finally, it creates a situation object.
+
+.JS Logic Policy Establish State
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/task-establish.js[JS Logic Policy Establish State]
+----
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-match.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-match.adoc
new file mode 100644
index 000000000..be4bd0895
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/logic-match.adoc
@@ -0,0 +1,25 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Logic: Policy Match State
+
+This is the logic for the match state.
+It is kept very simple.
+Beside taking the trigger event, it also creates a timestamp.
+This timestamp is later used for SLA and downtime calculations as well as for some performance information of the policy.
+
+.JS Logic Policy Match State
+[source,javascript,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/com/ericsson/apex/domains/pcvs/vpnsla/logic/task-match.js[JS Logic Policy Match State]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/policy.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/policy.adoc
new file mode 100644
index 000000000..b5bfcc5ab
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/policy.adoc
@@ -0,0 +1,28 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== VPN SLA Policy
+
+The VPN SLA policy is designed as a MEDA policy.
+The first state (M = Match) takes the trigger event (a link up or down) and checks if this is a change to the known topology.
+The second state (E = Establish) takes all available information (trigger event, local context) and defines what situation we have.
+The third state (D = Decide) takes the situation and selects which algorithm is best to process it.
+This state can select between `none` (nothing to do), `solved` (a problem is solved now), `sla` (compare the current customer SLA situation and select one to impede), and `priority` (impede non-priority customers).
+The fourth and final state (A = Act) selects the right action for the taken decision and creates the response event sent to the orchestrator.
+
+We have added three more policies to set the local context: one for adding nodes, one for adding edges (links), and one for adding customers.
+These policies do not realize any action, they are only here for updating the local context.
+This mechanism is the fasted way to update local context, and it is independent of any context plugin.
+
+The policy uses data defined in Avro, so we have a number of Avro schema definitions.
+
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-linkmonitor.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-linkmonitor.adoc
new file mode 100644
index 000000000..592dda3b2
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-linkmonitor.adoc
@@ -0,0 +1,24 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Link Monitor
+
+The Link Monitor is a Python script.
+At startup, it sends the context events to APEX to initialize the topology and the customers.
+Then it takes events from Kafka and sends them to APEX.
+
+.Link Monitor
+[source,python,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/examples/scripts/pcvs/vpnsla/LinkMonitor.py[Link Monitor]
+----
diff --git a/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-mininet.adoc b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-mininet.adoc
new file mode 100644
index 000000000..cdcf525fc
--- /dev/null
+++ b/examples/examples-pcvs/src/site-docs/adoc/fragments/vpnsla/python-mininet.adoc
@@ -0,0 +1,23 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== Mininet Topology
+
+The topology is realized using Mininet.
+The following script is use to estalish the topology and to realize network configurations.
+
+.Mininet Topology
+[source,python,options="nowrap"]
+----
+include::{adsite-examples-pcvs-dir}/main/resources/examples/scripts/pcvs/vpnsla/MininetTopology.py[Mininet Topology]
+----