X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=docs%2Fapex%2FAPEX-User-Manual.rst;h=d32b1de98ae376cd0920f77e968d8df45a391dcf;hb=61cb1efbe843f279027f81070b8175df5c72230d;hp=e4424b4cc1696ed9f922fcd8de6546289663b036;hpb=4eae906a5dd646c429376903cfb27d9476ab90cc;p=policy%2Fparent.git diff --git a/docs/apex/APEX-User-Manual.rst b/docs/apex/APEX-User-Manual.rst index e4424b4c..d32b1de9 100644 --- a/docs/apex/APEX-User-Manual.rst +++ b/docs/apex/APEX-User-Manual.rst @@ -943,7 +943,7 @@ Verify Installation - run Engine .. container:: paragraph A simple verification of an APEX installation can be done by - simply starting the APEX engine without any configuration. On + simply starting the APEX engine without specifying a tosca policy. On Unix (or Cygwin) start the engine using ``$APEX_HOME/bin/apexApps.sh engine``. On Windows start the engine using ``%APEX_HOME%\bin\apexApps.bat engine``. The engine will fail @@ -958,21 +958,16 @@ Verify Installation - run Engine :number-lines: Starting Apex service with parameters [] . . . - start of Apex service failed: Apex configuration file was not specified as an argument - 2018-09-03 13:11:33,914 Apex [main] ERROR o.o.p.a.service.engine.main.ApexMain - start of Apex service failed - org.onap.policy.apex.model.basicmodel.concepts.ApexException: Apex configuration file was not specified as an argument - at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validateReadableFile(ApexCommandLineArguments.java:267) - at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validate(ApexCommandLineArguments.java:161) - at org.onap.policy.apex.service.engine.main.ApexMain.(ApexMain.java:68) - at org.onap.policy.apex.service.engine.main.ApexMain.main(ApexMain.java:165) - usage: org.onap.policy.apex.service.engine.main.ApexMain [options...] - options - -c,--config-file the full path to the configuration file to use, the configuration file must be a Json file - containing the Apex configuration parameters - -h,--help outputs the usage of this command - -m,--model-file the full path to the model file to use, if set it overrides the model file set in the - configuration file - -v,--version outputs the version of Apex + start of Apex service failed. + org.onap.policy.apex.model.basicmodel.concepts.ApexException: Arguments validation failed. + at org.onap.policy.apex.service.engine.main.ApexMain.populateApexParameters(ApexMain.java:238) + at org.onap.policy.apex.service.engine.main.ApexMain.(ApexMain.java:86) + at org.onap.policy.apex.service.engine.main.ApexMain.main(ApexMain.java:351) + Caused by: org.onap.policy.apex.model.basicmodel.concepts.ApexException: Tosca Policy file was not specified as an argument + at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validateReadableFile(ApexCommandLineArguments.java:242) + at org.onap.policy.apex.service.engine.main.ApexCommandLineArguments.validate(ApexCommandLineArguments.java:172) + at org.onap.policy.apex.service.engine.main.ApexMain.populateApexParameters(ApexMain.java:235) + ... 2 common frames omitted Verify Installation - run an Example #################################### @@ -1007,7 +1002,9 @@ Verify Installation - run an Example .. container:: paragraph - You can now try to run apex. + Create a Tosca Policy for the SampleDomain example using ApexCliToscaEditor + as explained in the section "The APEX CLI Tosca Editor". Assume the tosca policy name is SampleDomain_tosca.json. + You can then try to run apex using the ToscaPolicy. .. container:: listingblock @@ -1016,8 +1013,8 @@ Verify Installation - run an Example .. code:: :number-lines: - # $APEX_HOME/bin/apexApps.sh engine -c $APEX_HOME/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json -m $APEX_HOME/examples/models/SampleDomain/SamplePolicyModelJAVA.json (1) - >%APEX_HOME%\bin\apexApps.bat engine -c %APEX_HOME%\examples\config\SampleDomain\Stdin2StdoutJsonEventJava.json -m %APEX_HOME%\examples\models\SampleDomain\SamplePolicyModelJAVA.json :: (2) + # $APEX_HOME/bin/apexApps.sh engine -p $APEX_HOME/examples/SampleDomain_tosca.json (1) + >%APEX_HOME%\bin\apexApps.bat engine -p %APEX_HOME%\examples\SampleDomain_tosca.json(2) .. container:: colist arabic @@ -1039,7 +1036,7 @@ Verify Installation - run an Example .. code:: :number-lines: - Starting Apex service with parameters [-c, v:/dev/ericsson/apex/onap/apex-pdp/packages/apex-pdp-package-full/target/install_hierarchy/examples/config/SampleDomain/Stdin2StdoutJsonEventJava.json] . . . + Starting Apex service with parameters [-p, /home/ubuntu/apex/SampleDomain_tosca.json] . . . 2018-09-05 15:16:42,800 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-0:0.0.1 . 2018-09-05 15:16:42,804 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-1:0.0.1 . 2018-09-05 15:16:42,804 Apex [main] INFO o.o.p.a.s.e.r.impl.EngineServiceImpl - Created apex engine MyApexEngine-2:0.0.1 . @@ -1362,6 +1359,51 @@ Build a Docker Image ENV PATH /opt/app/policy/apex-pdp/bin:$PATH WORKDIR /home/apexuser +Running APEX in Standalone mode +------------------------------- + + .. container:: paragraph + + APEX Engine can run in standalone mode by taking in a ToscaPolicy + as an argument and executing it. + Assume there is a tosca policy named ToscaPolicy.json in APEX_HOME directory + This policy can be executed in standalone mode using any of the below methods. + +Run in an APEX installation +########################### + + .. container:: listingblock + + .. container:: content + + .. code:: + :number-lines: + + # $APEX_HOME/bin/apexApps.sh engine -p $APEX_HOME/ToscaPolicy.json(1) + >%APEX_HOME%\bin\apexApps.bat engine -p %APEX_HOME%\ToscaPolicy.json(2) + +.. container:: colist arabic + + +-------+---------+ + | **1** | UNIX | + +-------+---------+ + | **2** | Windows | + +-------+---------+ + +Run in a docker container +######################### + + .. container:: listingblock + + .. container:: content + + .. code:: + :number-lines: + + # docker run -p 6969:6969 -v $APEX_HOME/ToscaPolicy.json:/tmp/policy/ToscaPolicy.json \ + --name apex -it nexus3.onap.org:10001/onap/policy-apex-pdp:latest /bin/bash \ + -c "/opt/app/policy/apex-pdp/bin/apexEngine.sh -p /tmp/policy/ToscaPolicy.json" + APEX Configurations Explained ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1514,8 +1556,7 @@ Engine Service Parameters "id" : 45, (3) "instanceCount" : 4, (4) "deploymentPort" : 12345, (5) - "policyModelFileName" : "examples/models/VPN/VPNPolicyModelJava.json", (6a) - "policy_type_impl" : {...}, (6b) + "policy_type_impl" : {...}, (6) "periodicEventPeriod": 1000, (7) "engineParameters":{ (8) "executorParameters":{...}, (9) @@ -1557,13 +1598,7 @@ Engine Service Parameters | | Websocket connection to the | | | engine | +-----------------------------------+-----------------------------------+ - | **6a** | the APEX policy model file to | - | | load into the engine on startup | - | | when APEX is running native | - | | policies in standalone mode | - | | (optional) | - +-----------------------------------+-----------------------------------+ - | **6b** | the APEX policy model as a JSON | + | **6** | the APEX policy model as a JSON | | | or YAML block to load into the | | | engine on startup when | | | APEX is running a policy that has | @@ -1746,6 +1781,52 @@ Input and Output Interfaces | **18** | any other output configuration (e.g. event name filter, see below) | +--------+--------------------------------------------------------------------+ +Event Name +########## + + .. container:: paragraph + + Any event defined in APEX has to be unique. The "name" of + of an event is used as an identifier for an ApexEvent. Every + event has to be tagged to an eventName. This can be done in different + ways. Either the actual event can have a field called "name". Or, the + event has some other field that can act as the identifier, which can be + specified using "nameAlias". But in other cases, where a "name" or "nameAlias" + cannot be specified, the incoming event coming over an endpoint can be + manually tagged to an "eventName" before consuming it. + + .. container:: paragraph + + The "eventName" can have a single event's name if the event coming + over the endpoint has to be always mapped to the specified eventName's + definition. Otherwise, if different events can come over the endpoint, + then "eventName" field can consist of multiple event names separated by + "|" symbol. In this case, based on the received event's structure, it is + mapped to any one of the event name specified in the "eventName" field. + + .. container:: paragraph + + The following code shows some examples on how to specify the eventName field: + + .. container:: listingblock + + .. container:: content + + .. code:: + + "eventInputParameters": { + "Input1": { + "carrierTechnologyParameters" : {...}, + "eventProtocolParameters":{...}, + "eventName" : "VesEvent" (1) + }, + "Input2": { + "carrierTechnologyParameters" : {...}, + "eventProtocolParameters":{...}, + "eventName" : "AAISuccessResponseEvent|AAIFailureResponseEvent" (2) + } + } + Event Filters ############# @@ -3794,7 +3875,6 @@ A configuration example "id" : 45, "instanceCount" : 4, "deploymentPort" : 12345, - "policyModelFileName" : "examples/models/some-model.json", "engineParameters" : { "executorParameters" : { "JAVASCRIPT" : { @@ -4013,12 +4093,9 @@ The APEX Engine .. container:: paragraph - The APEX engine comes with a few CLI arguments for setting - configuration and policy model. The configuration file is - always required. The policy model file is only required if - no model file is specified in the configuration, or if the - specified model file should be over written. The option - ``-h`` prints a help screen. + The APEX engine comes with a few CLI arguments, the main one is for setting + the tosca policy file for execution. The tosca policy file is + always required. The option ``-h`` prints a help screen. .. container:: listingblock @@ -4028,12 +4105,9 @@ The APEX Engine usage: org.onap.policy.apex.service.engine.main.ApexMain [options...] options - -c,--config-file the full path to the configuration file to use, the configuration file must be a Json file - containing the Apex configuration parameters - -h,--help outputs the usage of this command - -m,--model-file the full path to the model file to use, if set it overrides the model file set in the - configuration file - -v,--version outputs the version of Apex + -p,--tosca-policy-file the full path to the ToscaPolicy file to use. + -h,--help outputs the usage of this command + -v,--version outputs the version of Apex The APEX CLI Editor ------------------- @@ -5161,11 +5235,21 @@ Example Configuration for a Production Server +Unsupported Features +^^^^^^^^^^^^^^^^^^^^ + + .. container:: paragraph + + This section documents some legacy and unsupported features + in apex-pdp. The documentation here has not been updated for + recent versions of apex-pdp. For example, the apex-pdp models + specified in this example should now be in TOSCA format. + Building a System with Websocket Backend -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +---------------------------------------- Websockets ----------- +########## .. container:: paragraph @@ -5187,7 +5271,7 @@ Websockets does not support WAMP at the moment. Websocket in Java ------------------ +################# .. container:: paragraph @@ -5201,7 +5285,7 @@ Websocket in Java Netty, … there are also Kafka extensions for Websockets. Websocket Example Code for Websocket clients (FOSS) ---------------------------------------------------- +################################################### .. container:: paragraph @@ -5234,7 +5318,7 @@ Websocket Example Code for Websocket clients (FOSS) example `__ BCP: Websocket Configuration ----------------------------- +############################ .. container:: paragraph @@ -5267,7 +5351,7 @@ BCP: Websocket Configuration reconnected manually after an APEX boot. Demo with VPN Policy Model --------------------------- +########################## .. container:: paragraph @@ -5294,7 +5378,7 @@ Demo with VPN Policy Model in an editor (we need to send those events to APEX) A Websocket Configuration for the VPN Domain -############################################ +******************************************** .. container:: paragraph @@ -5361,7 +5445,7 @@ A Websocket Configuration for the VPN Domain } Start APEX Engine -################# +***************** .. container:: paragraph @@ -5412,7 +5496,7 @@ Start APEX Engine policy is triggered/executed. Run the Websocket Echo Client -############################# +***************************** .. container:: paragraph @@ -5502,7 +5586,7 @@ Run the Websocket Echo Client ws-simple-echo: opened connection to APEX (Web Socket Protocol Handshake) Run the Websocket Console Client -################################ +******************************** .. container:: paragraph @@ -5593,7 +5677,7 @@ Run the Websocket Console Client ws-simple-console: opened connection to APEX (Web Socket Protocol Handshake) Send Events -########### +*********** .. container:: paragraph @@ -5739,6 +5823,3 @@ Send Events .. container:: :name: footer-text - - -