Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 1 | |
| 2 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 3 | .. http://creativecommons.org/licenses/by/4.0 |
| 4 | |
| 5 | ********************************************************* |
| 6 | Tutorial: Testing the vCPE use case in a standalone PDP-D |
| 7 | ********************************************************* |
| 8 | |
| 9 | .. contents:: |
| 10 | :depth: 3 |
| 11 | |
| 12 | |
| 13 | High Level Architecture |
| 14 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 15 | The vCPE flow begins with an onset message that is sent from DCAE notifying the PDP-D that an action needs to be taken on a VM/VNF. Once the PDP-D has inserted the onset into drools memory, rules begin to fire to start processing the onset for the vCPE policy that exists in drools memory. If the onset is not enriched with A&AI data, Policy will query A&AI for the VM/VNF data otherwise the PDP-D will get the A&AI data needed directly from the onset. A Guard query is then executed to determine if the action to be taken is allowed. If Guard returns a permit, the PDP-D will then send an APPC Restart recipe request to restart the VM/VNF specified in the request. If APPC is successful then the PDP-D will send a operation success notification on the POLICY-CL-MGT topic. The PDP-D waits for an abatement message to come from DCAE before ending the transaction. Once the abatement is received the PDP-D sends a final success notification and gracefully ends processing the event. |
| 16 | |
| 17 | Initial Setup |
| 18 | ^^^^^^^^^^^^^ |
| 19 | |
| 20 | For this tutorial, a feature for simulating components involved in the flow outside of Policy will be turned on. Run "*features enable controlloop-utils*". |
| 21 | |
| 22 | .. image:: Tut_vCPE_simulators_enabled.JPG |
| 23 | |
| 24 | Now start the PDP-D using the command "policy start" |
| 25 | |
| 26 | .. image:: Tut_vCPE_policy_start.JPG |
| 27 | |
| 28 | Running the Flow |
| 29 | ^^^^^^^^^^^^^^^^ |
| 30 | |
| 31 | The telemetry API is used to see what is in memory. There should only be 1 fact, the Params object which is created at initialization time and contains the vCPE policy that was created. |
| 32 | |
| 33 | .. code-block:: bash |
| 34 | |
Saryu Shah | 65640a2 | 2018-10-18 01:19:03 +0000 | [diff] [blame] | 35 | curl -k --silent --user @1b3rt:31nst31n -X GET https://localhost:9696/policy/pdp/engine/controllers/amsterdam/drools/facts/amsterdam | python -m json.tool |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 36 | |
| 37 | |
| 38 | .. image:: Tut_vCPE_get_facts.JPG |
| 39 | |
| 40 | Using the telemetry API, a simulated onset can be injected by the user. For demo purposes, this is the simulated onset that will be used: |
| 41 | |
| 42 | .. image:: Tut_vCPE_simulated_onset.JPG |
| 43 | |
| 44 | **NOTE:** The onset that gets injected has to have a closedLoopControlName that matches the pushed policy's closedLoopControlName. |
| 45 | |
| 46 | Inject the onset using the Telemetry API. |
| 47 | |
| 48 | .. code-block:: bash |
| 49 | |
Saryu Shah | 65640a2 | 2018-10-18 01:19:03 +0000 | [diff] [blame] | 50 | curl -k --silent --user @1b3rt:31nst31n --header "Content-Type: text/plain" --data @dcae.vcpe.onset.json -X PUT https://localhost:9696/policy/pdp/engine/topics/sources/ueb/unauthenticated.DCAE_EVENT_OUTPUT/events | python -m json.tool |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 51 | |
| 52 | .. image:: Tut_vCPE_insert_onset.JPG |
| 53 | |
| 54 | **NOTE:** The simulated onset is enriched with A&AI data. The PDP-D will not make an A&AI query since the data needed can be extracted from the onset. |
| 55 | |
| 56 | Now check the facts in memory, there should be 7 objects present. Two timers exist to put a time limit on the operation and on the overall control loop (in the case of retries or policy chaining). The event and it's associated manager and operation manager are also present in memory. A lock on the target entity is inserted to ensure no other events try to take action on the VM/VNF that is currently processing. |
| 57 | |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 58 | .. image:: Tut_vCPE_get_facts_2.JPG |
| 59 | |
| 60 | The network log will be used to monitor the activity coming in and out of the PDP-D. This log is located at *$POLICY_HOME/logs/network.log*. This will show the notifications that the PDP-D sends out at different stages of processing. The order of successful processing begins with an ACTIVE notification to show that the onset was acknowledged and the operation is beginning transit. |
| 61 | |
| 62 | .. image:: Tut_vCPE_policy_active.JPG |
| 63 | |
| 64 | Once the event is in the ACTIVE state, the PDP-D consults Guard to determine if this operation should be allowed, a series of operation notifications are sent for starting the Guard query, obtaining a PERMIT or DENY, and beginning the operation. |
| 65 | |
| 66 | .. image:: Tut_vCPE_guard_not_queried.JPG |
| 67 | |
Saryu Shah | 4a9687b | 2018-10-19 23:06:49 +0000 | [diff] [blame] | 68 | | |
| 69 | |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 70 | .. image:: Tut_vCPE_guard_result.JPG |
| 71 | |
Saryu Shah | 4a9687b | 2018-10-19 23:06:49 +0000 | [diff] [blame] | 72 | | |
| 73 | |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 74 | .. image:: Tut_vCPE_policy_operation.JPG |
| 75 | |
| 76 | Once the operation starts an APPC request is sent out. |
| 77 | |
| 78 | .. image:: Tut_vCPE_appc_request.JPG |
| 79 | |
| 80 | A simulated APPC response will be injected to the APPC-LCM-WRITE topic, this is the example response used: |
| 81 | |
| 82 | .. image:: Tut_vCPE_simulated_appc_response.JPG |
| 83 | |
| 84 | Inject the response using the Telemetry API. |
| 85 | |
| 86 | .. code-block:: bash |
| 87 | |
Saryu Shah | 65640a2 | 2018-10-18 01:19:03 +0000 | [diff] [blame] | 88 | curl -k --silent --user @1b3rt:31nst31n --header "Content-Type: text/plain" --data @appc.lcm.success.json -X PUT https://localhost:9696/policy/pdp/engine/topics/sources/ueb/APPC-LCM-WRITE/events | python -m json.tool |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 89 | |
| 90 | .. image:: Tut_vCPE_inject_appc_response.JPG |
| 91 | |
| 92 | The network log will show the PDP-D sent an operation success notification. |
| 93 | |
| 94 | .. image:: Tut_vCPE_policy_operation_success.JPG |
| 95 | |
| 96 | For the vCPE use case, once an operation is successful, the PDP-D waits for DCAE to send an abatement message to end processing. The following abatement message will be used: |
| 97 | |
| 98 | .. image:: Tut_vCPE_simulated_abatement.JPG |
| 99 | |
| 100 | Inject the abatement message using the Telemetry API. |
| 101 | |
| 102 | .. code-block:: bash |
| 103 | |
Saryu Shah | 65640a2 | 2018-10-18 01:19:03 +0000 | [diff] [blame] | 104 | curl -k --silent --user @1b3rt:31nst31n --header "Content-Type: text/plain" --data @dcae.vcpe.abatement.json -X PUT https://localhost:9696/policy/pdp/engine/topics/sources/ueb/unauthenticated.DCAE_EVENT_OUTPUT/events | python -m json.tool |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 105 | |
| 106 | .. image:: Tut_vCPE_insert_abatement.JPG |
| 107 | |
| 108 | Once the abatement is received, a final success notification is sent from the PDP-D. |
| 109 | |
| 110 | .. image:: Tut_vCPE_policy_final_success.JPG |
| 111 | |
| 112 | After processing there should only be 1 fact left in memory. |
| 113 | |
| 114 | .. image:: Tut_vCPE_final_memory.JPG |
| 115 | |
| 116 | |
| 117 | End of Document |
| 118 | |
| 119 | |
| 120 | .. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Tutorial%3A+Testing+the+vCPE+use+case+in+a+standalone+PDP-D |
| 121 | |
| 122 | |