Saryu Shah | f8732ac | 2017-11-09 22:42:29 +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 vFW flow in a standalone PDP-D |
| 7 | **************************************************** |
| 8 | |
| 9 | .. contents:: |
| 10 | :depth: 3 |
| 11 | |
| 12 | |
| 13 | High Level Architecture |
| 14 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 15 | The vFW flow begins with an onset message that is sent from DCAE notifying the PDP-D that an action needs to be taken on a VNF. Once the PDP-D has inserted the onset into drools memory, rules begin to fire to start processing the onset for the vFW policy that exists in drools memory. If the onset is not enriched with A&AI data, Policy will query A&AI for the VNF data otherwise the PDP-D will get the A&AI data needed directly from the onset. Then an A&AI named query is executed on the source VNF entity from the onset to find the target VNF entity that the PDP-D will take action on. Once the target entity is retrieved from A&AI, a Guard query is executed to determine if the action to be taken is allowed. If Guard returns a permit, the PDP-D will then send an APPC ModifyConfig recipe request to modify pg-streams as specified in the request payload. If APPC is successful then the PDP-D will send a final success notification on the POLICY-CL-MGT topic and gracefully end processing the event. |
| 16 | |
| 17 | Initial Setup |
| 18 | ^^^^^^^^^^^^^ |
| 19 | |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 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*". |
Saryu Shah | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 21 | |
| 22 | .. image:: Tut_vFW_simulators_enabled.JPG |
| 23 | |
| 24 | Now start the PDP-D using the command "policy start" |
| 25 | |
| 26 | .. image:: Tut_vFW_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 vFW policy that was created. |
| 32 | |
| 33 | .. code-block:: bash |
| 34 | |
Saryu Shah | 4783328 | 2018-10-19 23:58:21 +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 | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 36 | |
| 37 | .. image:: Tut_vFW_get_facts.JPG |
| 38 | |
| 39 | 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: |
| 40 | |
| 41 | .. image:: Tut_vFW_simulated_onset.JPG |
| 42 | |
| 43 | **NOTE:** The onset that gets injected has to have a closedLoopControlName that matches the pushed policy's closedLoopControlName. |
| 44 | |
| 45 | Inject the onset using the Telemetry API. |
| 46 | |
| 47 | .. code-block:: bash |
| 48 | |
Saryu Shah | 4783328 | 2018-10-19 23:58:21 +0000 | [diff] [blame^] | 49 | curl -k --silent --user @1b3rt:31nst31n --header "Content-Type: text/plain" --data @dcae.vfw.onset.json -X PUT https://localhost:9696/policy/pdp/engine/topics/sources/ueb/unauthenticated.DCAE_EVENT_OUTPUT/events | python -m json.tool |
Saryu Shah | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 50 | |
| 51 | .. image:: Tut_vFW_onset_injected.JPG |
| 52 | |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 53 | 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 VNF that is currently processing. |
Saryu Shah | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 54 | |
| 55 | .. image:: Tut_vFW_get_facts_2.JPG |
| 56 | |
Saryu Shah | 355b579 | 2017-11-10 17:02:32 +0000 | [diff] [blame] | 57 | 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. |
Saryu Shah | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 58 | |
| 59 | .. image:: Tut_vFW_policy_active.JPG |
| 60 | |
| 61 | Next a query will be sent to A&AI to get information on the VNF specified from the onset. The picture below shows the query going OUT of the PDP-D and the response coming IN. |
| 62 | |
| 63 | **NOTE:** Policy does A&AI queries for VNF information when the onset is not enriched with A&AI data. In this example only the generic-vnf.vnf-name was provided so a query to A&AI is necessary to retrieve data that is needed in the APPC request. |
| 64 | |
| 65 | .. image:: Tut_vFW_aai_get.JPG |
| 66 | |
| 67 | For the vFW use case, the source entity reported in the onset message may not be the target entity that the APPC operation takes action on. To determine the true target entity, an A&AI named query is performed. The request is shown in the network log. |
| 68 | |
| 69 | .. image:: Tut_vFW_aai_named_query_request.JPG |
| 70 | |
| 71 | The response is also displayed in the network log. |
| 72 | |
| 73 | .. image:: Tut_vFW_aai_named_query_response.JPG |
| 74 | |
| 75 | Once the target entity is found, 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. |
| 76 | |
| 77 | .. image:: Tut_vFW_policy_guard_start.JPG |
| 78 | |
Saryu Shah | 4783328 | 2018-10-19 23:58:21 +0000 | [diff] [blame^] | 79 | | |
| 80 | |
Saryu Shah | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 81 | .. image:: Tut_vFW_policy_guard_result.JPG |
| 82 | |
Saryu Shah | 4783328 | 2018-10-19 23:58:21 +0000 | [diff] [blame^] | 83 | | |
| 84 | |
Saryu Shah | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 85 | .. image:: Tut_vFW_policy_operation_start.JPG |
| 86 | |
| 87 | Once the operation starts an APPC request is sent out. |
| 88 | |
| 89 | .. image:: Tut_vFW_appc_request.JPG |
| 90 | |
| 91 | A simulated APPC response will be injected to the APPC-CL topic, this is the example response used: |
| 92 | |
| 93 | .. image:: Tut_vFW_simulated_appc_response.JPG |
| 94 | |
| 95 | Inject the response using the Telemetry API. |
| 96 | |
| 97 | .. code-block:: bash |
| 98 | |
Saryu Shah | 4783328 | 2018-10-19 23:58:21 +0000 | [diff] [blame^] | 99 | curl -k --silent --user @1b3rt:31nst31n --header "Content-Type: text/plain" --data @appc.legacy.success.json -X PUT https://localhost:9696/policy/pdp/engine/topics/sources/ueb/APPC-CL/events | python -m json.tool |
Saryu Shah | f8732ac | 2017-11-09 22:42:29 +0000 | [diff] [blame] | 100 | |
| 101 | .. image:: Tut_vFW_insert_appc_response.JPG |
| 102 | |
| 103 | The network log will show the PDP-D sent an operation success notification. |
| 104 | |
| 105 | .. image:: Tut_vFW_policy_operation_success.JPG |
| 106 | |
| 107 | Then a final success notification is sent. |
| 108 | |
| 109 | .. image:: Tut_vFW_policy_final_success.JPG |
| 110 | |
| 111 | After processing there should only be 1 fact left in memory. |
| 112 | |
| 113 | .. image:: Tut_vFW_final_memory.JPG |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | End of Document |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | .. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Tutorial%3A+Testing+the+vFW+flow+in+a+standalone+PDP-D |
| 124 | |