diff options
Diffstat (limited to 'src/site-docs/adoc/fragments/howto-websockets')
8 files changed, 280 insertions, 0 deletions
diff --git a/src/site-docs/adoc/fragments/howto-websockets/demo-00.adoc b/src/site-docs/adoc/fragments/howto-websockets/demo-00.adoc new file mode 100644 index 000000000..a9f72a80c --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/demo-00.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) +// + +== Demo with VPN Policy Model + +We assume that you have an APEX installation using the full package, i.e. APEX with all examples, of version `0.5.6` or higher. +We will use the VPN policy from the APEX examples here. + +Now, have the following ready to start the demo: + +- 3 terminals on the host where APEX is running (we need 1 for APEX and 1 for each client) +- the events in the file `$APEX_HOME/examples/events/VPN/SetupEvents.json` open in an editor (we need to send those events to APEX) +- the events in the file `$APEX_HOME/examples/events/VPN/Link09Events.json` open in an editor (we need to send those events to APEX) + diff --git a/src/site-docs/adoc/fragments/howto-websockets/demo-01-vpn-wsconfig.adoc b/src/site-docs/adoc/fragments/howto-websockets/demo-01-vpn-wsconfig.adoc new file mode 100644 index 000000000..f1d4d7327 --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/demo-01-vpn-wsconfig.adoc @@ -0,0 +1,69 @@ +// +// ============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) +// + +=== A Websocket Configuration for the VPN Domain + +Create a new APEX configuration using the VPN policy model and configuring APEX as discussed above for Websockets. +Copy the following configuration into `$APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json` (for Windows use `%APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json`): + +[source%nowrap,json,numbered,subs="attributes+"] +---- +{ + "engineServiceParameters" : { + "name" : "VPNApexEngine", + "version" : "0.0.1", + "id" : 45, + "instanceCount" : 1, + "deploymentPort" : 12345, + "policyModelFileName" : "examples/models/VPN/VPNPolicyModelAvro.json", + "engineParameters" : { + "executorParameters" : { + "MVEL" : { + "parameterClassName" : "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + } + }, + "contextParameters" : { + "parameterClassName" : "org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters":{ + "Avro":{ + "parameterClassName" : "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + } + } + } + } + }, + "producerCarrierTechnologyParameters" : { + "carrierTechnology" : "WEBSOCKET", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "wsClient" : false, + "port" : 42452 + } + }, + "producerEventProtocolParameters" : { + "eventProtocol" : "JSON" + }, + "consumerCarrierTechnologyParameters" : { + "carrierTechnology" : "WEBSOCKET", + "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameters" : { + "wsClient" : false, + "port" : 42450 + } + }, + "consumerEventProtocolParameters" : { + "eventProtocol" : "JSON" + } +} +---- + diff --git a/src/site-docs/adoc/fragments/howto-websockets/demo-02-start-engine.adoc b/src/site-docs/adoc/fragments/howto-websockets/demo-02-start-engine.adoc new file mode 100644 index 000000000..58d3e1fe8 --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/demo-02-start-engine.adoc @@ -0,0 +1,41 @@ +// +// ============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) +// + +=== Start APEX Engine + +In a new terminal, start APEX with the new configuration for Websocket-Server ingress/egress: + +[source%nowrap,sh,numbered] +---- +#: $APEX_HOME/bin/apexEngine.sh -c $APEX_HOME/examples/config/VPN/Ws2WsServerAvroContextJsonEvent.json +---- + +[source%nowrap,bat,numbered] +---- +#: %APEX_HOME%\bin\apexEngine.bat -c %APEX_HOME%\examples\config\VPN\Ws2WsServerAvroContextJsonEvent.json +---- + +Wait for APEX to start, it takes a while to create all Websocket servers (about 8 seconds on a standard laptop without cached binaries). +depending on your log messages, you will see no (some, a lot) log messages. +If APEX starts correctly, the last few messages you should see are: + +[source%nowrap,sh,numbered] +---- +2017-07-28 13:17:20,834 Apex [main] INFO c.e.a.s.engine.runtime.EngineService - engine model VPNPolicyModelAvro:0.0.1 added to the engine-AxArtifactKey:(name=VPNApexEngine-0,version=0.0.1) +2017-07-28 13:17:21,057 Apex [Apex-apex-engine-service-0:0] INFO c.e.a.s.engine.runtime.EngineService - Engine AxArtifactKey:(name=VPNApexEngine-0,version=0.0.1) processing ... +2017-07-28 13:17:21,296 Apex [main] INFO c.e.a.s.e.r.impl.EngineServiceImpl - Added the action listener to the engine +Started Apex service +---- + +APEX is running in the new terminal and will produce output when the policy is triggered/executed. + diff --git a/src/site-docs/adoc/fragments/howto-websockets/demo-03-start-echo-client.adoc b/src/site-docs/adoc/fragments/howto-websockets/demo-03-start-echo-client.adoc new file mode 100644 index 000000000..473696d46 --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/demo-03-start-echo-client.adoc @@ -0,0 +1,15 @@ +// +// ============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) +// + +include::{adsite-tools-wsclients-dir}/site-docs/adoc/fragments/run-echo.adoc[leveloffset=+1] + diff --git a/src/site-docs/adoc/fragments/howto-websockets/demo-04-start-console-client.adoc b/src/site-docs/adoc/fragments/howto-websockets/demo-04-start-console-client.adoc new file mode 100644 index 000000000..5a501e11b --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/demo-04-start-console-client.adoc @@ -0,0 +1,15 @@ +// +// ============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) +// + +include::{adsite-tools-wsclients-dir}/site-docs/adoc/fragments/run-console.adoc[leveloffset=+1] + diff --git a/src/site-docs/adoc/fragments/howto-websockets/demo-05-send-events.adoc b/src/site-docs/adoc/fragments/howto-websockets/demo-05-send-events.adoc new file mode 100644 index 000000000..3f5955869 --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/demo-05-send-events.adoc @@ -0,0 +1,58 @@ +// +// ============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) +// + +=== Send Events + +Now you have the full system up and running: + +- Terminal 1: APEX ready and loaded +- Terminal 2: an echo client, printing received messages produced by the VPN policy +- Terminal 2: a console client, waiting for input on the console (standard in) and sending text to APEX + +We started the engine with the VPN policy example. +So all the events we are using now are located in files in the following example directory: + +[source%nowrap,sh,numbered] +---- +#: $APEX_HOME/examples/events/VPN +> %APEX_HOME%\examples\events\VPN +---- + +To sends events, simply copy the content of the event files into Terminal 3 (the console client). +It will read multi-line JSON text and send the events. +So copy the content of `SetupEvents.json` into the client. +APEX will trigger a policy and produce some output, the echo client will also print some events created in the policy. +In Terminal 1 (APEX) you’ll see some status messages from the policy as: + +[source%nowrap,sh,numbered,subs="attributes+"] +---- +include::{adsite-main-dir}/site-docs/adoc/fragments/howto-websockets/wsc-screens/vpn-setup-events.log[APEX output for VPN Setup Events] +---- + +In Terminal 2 (echo-client) you see the received events, the last two should look like: + +[source%nowrap,sh,numbered,subs="attributes+"] +---- +include::{adsite-main-dir}/site-docs/adoc/fragments/howto-websockets/wsc-screens/echo-client-received-events.log[Echo Client Received Events] +---- + +Congratulations, you have triggered a policy in APEX using Websockets, the policy did run through, created events, picked up by the echo-client. + +Now you can send the Link 09 and Link 10 events, they will trigger the actual VPN policy and some calculations are made. +Let’s take the Link 09 events from `Link09Events.json`, copy them all into Terminal 3 (the console). +APEX will run the policy (with some status output), and the echo client will receive and print events. + +To terminate the applications, simply press `CTRL+C` in Terminal 1 (APEX). +This will also terminate the echo-client in Terminal 2. +Then type `exit<enter>` in Terminal 3 (or `CTRL+C`) to terminate the console-client. + diff --git a/src/site-docs/adoc/fragments/howto-websockets/wsc-screens/echo-client-received-events.log b/src/site-docs/adoc/fragments/howto-websockets/wsc-screens/echo-client-received-events.log new file mode 100644 index 000000000..b3aeb43dd --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/wsc-screens/echo-client-received-events.log @@ -0,0 +1,29 @@ +ws-simple-echo: received +--------------------------------- +{ + "name": "VPNCustomerCtxtActEvent", + "version": "0.0.1", + "nameSpace": "org.onap.policy.apex.domains.vpn.events", + "source": "Source", + "target": "Target", + "CustomerName": "C", + "LinkList": "L09 L10", + "SlaDT": 300, + "YtdDT": 300 +} +================================= + +ws-simple-echo: received +--------------------------------- +{ + "name": "VPNCustomerCtxtActEvent", + "version": "0.0.1", + "nameSpace": "org.onap.policy.apex.domains.vpn.events", + "source": "Source", + "target": "Target", + "CustomerName": "D", + "LinkList": "L09 L10", + "SlaDT": 300, + "YtdDT": 400 +} +================================= diff --git a/src/site-docs/adoc/fragments/howto-websockets/wsc-screens/vpn-setup-events.log b/src/site-docs/adoc/fragments/howto-websockets/wsc-screens/vpn-setup-events.log new file mode 100644 index 000000000..071d43532 --- /dev/null +++ b/src/site-docs/adoc/fragments/howto-websockets/wsc-screens/vpn-setup-events.log @@ -0,0 +1,29 @@ +{Link=L09, LinkUp=true} +L09 true +outFields: {Link=L09, LinkUp=true} +{Link=L10, LinkUp=true} +L09 true +L10 true +outFields: {Link=L10, LinkUp=true} +{CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300} +*** Customers *** +C 300 300 [L09, L10] +outFields: {CustomerName=C, LinkList=L09 L10, SlaDT=300, YtdDT=300} +{CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50} +*** Customers *** +A 300 50 [L09, L10] +C 300 300 [L09, L10] +outFields: {CustomerName=A, LinkList=L09 L10, SlaDT=300, YtdDT=50} +{CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400} +*** Customers *** +A 300 50 [L09, L10] +C 300 300 [L09, L10] +D 300 400 [L09, L10] +outFields: {CustomerName=D, LinkList=L09 L10, SlaDT=300, YtdDT=400} +{CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299} +*** Customers *** +A 300 50 [L09, L10] +B 300 299 [L09, L10] +C 300 300 [L09, L10] +D 300 400 [L09, L10] +outFields: {CustomerName=B, LinkList=L09 L10, SlaDT=300, YtdDT=299}
\ No newline at end of file |