5554cd4db26a92f56a7854bb82b35373053b9f9d
[integration.git] / docs / docs_vFWDT.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2    International License. http://creativecommons.org/licenses/by/4.0
3
4 .. _docs_vfw_traffic:
5
6 .. contents::
7    :depth: 3
8 ..
9
10 vFW In-Place Software Upgrade with Traffic Distribution Use Case
11 ----------------------------------------------------------------
12 Description
13 ~~~~~~~~~~~
14
15 The purpose of this work is to show In-Place Software Upgrade Traffic Distribution functionality implemented in Frankfurt release for vFW Use Case.
16 The use case is an evolution of vFW Traffic Distribution Use Case which was developed for Casablanca and Dublin releases.
17 The orchestration workflow triggers a change of the software on selected instance of the firewall. The change is proceeded with minimization of disruption of the
18 service since the firewall being upgraded must have all the traffic migrated out before the upgrade can be started. The traffic migration (redistribution) is done by
19 a traffic balancing/distribution entity (aka anchor point). The DistributeTraffic action targets the traffic balancing/distribution entity, in some cases DNS, other cases a load balancer external to the VNF instance, as examples.
20 Traffic distribution (weight) changes intended to take a VNF instance out of service are completed only when all in-flight traffic/transactions have been completed.
21 DistributeTrafficCheck command may be used to verify initial conditions of redistribution or can be used to verify the state of VNFs and redistribution itself.
22 To complete the traffic redistribution process, gracefully taking a VNF instance out-of-service/into-service, without dropping in-flight calls or sessions,
23 QuiesceTraffic/ResumeTraffic command may need to follow traffic distribution changes. The upgrade operation consist of the UpgradePreCheck operation which can used to verify
24 initial conditions for the operation like difference of the software version to the one requested, SoftwareUpgrade operation is responsible for modification of the software on
25 selected vFW instance and UpgradePostCheck LCM actions is used to verify if the software was properly installed on vFW. After the completion of the software upgrade the traffic is migrated to the
26 instance of the vFW which was before being upgraded. The workflow can be configured also in such a way to perform only singular migration of the traffic without upgrade of the software
27 what allows to experiment with the version of the workflow implemented in the previous releases. All the LCM operations are executed by APPC controller and they are implemented with Ansible protocol. In order to avoid the inconsistency in the VNFs state the Lock/Unlocks
28 mechanisms is used to prevent parallel execution of LCM actions on VNFs that are under maintenance because of the workflow that is currently executed on them.
29 The VNF application remains in an active state.
30
31 Traffic Distribution and In-Place Software Upgrade functionality is an outcome of Change Management project. Further details can be found on the following pages
32
33 - Frankfurt: https://wiki.onap.org/display/DW/Change+Management+Frankfurt+Extensions (Traffic Distribution workflow enhancements)
34
35 - Dublin: https://wiki.onap.org/display/DW/Change+Management+Extensions (DistributeTraffic LCM and Use Case)
36
37 - Casablanca https://wiki.onap.org/display/DW/Change+Management+Dublin+Extensions (Distribute Traffic Workflow with Optimization Framework)
38
39 Test Scenarios
40 ~~~~~~~~~~~~~~
41
42 .. figure:: files/dt-use-case.png
43    :scale: 40 %
44    :align: center
45
46    Figure 1 The overview of interaction of components in vFW In-Place Software Upgrade with Traffic Distribution Use Case
47
48 The main idea of the use case and prepared workflow is to show the interaction of different components of ONAP, including AAI, Policy, OOF, APPC for realization of scenario of software upgrade
49 of vFW instance with migration of the traffic in time of its upgrade. vFW instance was modified to have two instances of vFW with dedicated vSINKs. The general idea of interaction of ONAP components
50 is shown on Figure 1. Software Upgrade is performed on selected vFW instance. vPKG and the other vFW taking action while migration of the traffic out of vFW being upgraded. In a result of the DistributeTraffic
51 LCM action traffic flow originated from vPKG to vFW 1 and vSINK 1 is redirected to vFW 2 and vSINK 2 (as it is seen on Figure 2). Result of the change can be observed also on the vSINKs' dashboards which show
52 a current incoming traffic. After migration software is upgraded on the vFW and afterwards the traffic can be migrated back to this vFW instance. Observation of the dashboard from vSINK 1 and vSINK 2 proves workflow works properly.
53
54 .. figure:: files/dt-result.png
55    :scale: 60 %
56    :align: center
57
58    Figure 2 The result of traffic distribution in time of the upgrade
59
60 The traffic distribution sub-workflow takes as an input configuration parameters delivered by Optimization Framework and on their basis several traffic distribution LCM actions are executed by APPC in the specific workflow.
61 Further LCM actions are executed in order to present the idea of vFW In-Place Software Upgrade with Traffic Distribution. In this use case also APPC locking mechanisms is demonstrated, changes in APPC for VNFC level Ansible
62 actions support and changes for APPC Ansible automation also are used in the use case. The APPC Ansible automation scripts allows to configure LCM actions without the need to enter the CDT portal, however there is
63 possibility to do it manually and documentation describes also how to do it. In the same sense, the upload of policy types and policy instances is automated but the documentation describes how to do it manually.
64
65 The demonstration scripts can be used to execute two different scenarios:
66
67 1. Simple distribution of traffic from selected vFW instance to the other one
68
69 2. Upgrade of the software on selected vFW instance. Both are preceded with shared phase of identification of VF-modules for reconfiguration what is done with help of Optimization Framework.
70
71 Workflows
72 ~~~~~~~~~
73
74 Whole vFW In-Place Software Upgrade with Traffic Distribution use case can be decomposed into following workflows:
75
76 1. High level workflow (simplified workflow on Figure 3 and more detailed on Figure 4)
77
78 .. figure:: files/vfwdt-workflow-general.png
79    :scale: 100 %
80    :align: center
81
82    Figure 3 The In-Place Software Upgrade with Traffic Distribution general workflow
83
84 * Identification of vFW instances (**I**) for migration of the traffic (source and destination) and identification of vPKG instance (anchor point) which would be responsible for reconfiguration of the traffic distribution. This operation id performed by Optimization Framework, HAS algorithm in particular
85
86 * Before any operation is started workflow Locks (**II-IV**) with APPC all the VNFs involved in the procedure: vFW 1, vFW 2 and vPKG. In fact this is the vFW being upgraded, vFW which will be used to migrate traffic to and vPKG which performs the traffic distribution procedure. The VNFs needs to be locked in order to prevent the execution of other LCM actions in time of the whole workflow execution. Workflow checks state of the Lock on each VNF (**II**)(**1-6**), if the Locs are free (**III**)(**7**) the Locs are being acquired (**IV**)(**8-14**). If any Lock Check or Lock fails (**7, 14**), workflow is stopped.
87
88 * Depending on the workflow type different (Traffic Distribution or In-Place Software Upgrade with Traffic Distribution) LCM action are executed by APPC (**V**). All with Ansible protocol and with VNF and VF-modules identified before by Optimization Framework or the input parameters like selected vFW VNF instance. Workflows are conditional and will not be performed if the preconditions were not satisfied. In case of failure of LCM operation any other actions are canceled.
89
90 * At the end workflow Unlocks with APPC the previously Locked VNFs (**VI**)(**15-21**). This operations is performed always even when some steps before were not completed. The purpose is to not leave VNFs in locked state (in maintenance status) as this will prevent future execution of LCM actions or workflows on them. The locks are being automatically released after longer time.
91
92 .. figure:: files/vfwdt-general-workflow-sd.png
93    :scale: 80 %
94    :align: center
95
96    Figure 4 The In-Place Software Upgrade with Traffic Distribution detailed workflow
97
98 2. Identification of VF-modules candidates for migration of traffic (detailed workflow is shown on Figure 5)
99
100 .. figure:: files/vfwdt-identification-workflow-sd.png
101    :scale: 80 %
102    :align: center
103
104    Figure 5 Identification of VF-Module candidates for migration of traffic
105
106 - Workflow sends placement request to Optimization Framework (**1**) specific information about the vPKG and vFW-SINK models and VNF-ID of vFW that we want to upgrade.
107   Optimization Framework role is to find the vFW-SINK VNF/VF-module instance where traffic should be migrated to in time of the upgrade and vPKG which will be associated with this vFW.
108   Although in our case the calculation is very simple, the mechanism is ready to work for instances of services with VNF having houndreds of VF-modules spread accross different cloud regions.
109
110 - Optimization Framework takes from the Policy Framework policies (**2-3**) for VNFs and for relations between each other (in our case there is checked ACTIVE status of vFW-SINK and vPKG VF-modules and the Region to which they belong)
111
112 - Optimization Framework, base on the information from the policies and service topology information taken from A&AI (**4-11**), offers traffic distribution anchor and destination candidates' pairs (**12-13**) (pairs of VF-modules data with information about their V-Servers and their network interfaces). This information is returned to the workflow script (**14**).
113
114 - Information from Optimization Framework can be used to construct APPC LCM requests for DistributeTrafficCheck, DistributeTraffic, UpgradePreCheck, SoftwareUpgrade and UpgradePostCheck commands. This information is used to fill CDT templates with proper data for further Ansible playbooks execution. Script generates also here CDT templates for LCM actions which can be uploaded automatically to APPC DB.
115
116 3. The Traffic Distribution sub-workflow (simplified workflow on Figure 6 and more detailed on Figure 7)
117
118 .. figure:: files/vfwdt-workflow-traffic.png
119    :scale: 100 %
120    :align: center
121
122    Figure 6 The Traffic Distribution general workflow
123
124 - In the first DistributeTrafficCheck LCM request on vPGN VNF/VF-Module APPC, over Ansible, checks if already configured destination of vPKG packages is different than already configured one (**I-III**)(**1-8**). If not workflow is stopped (**9**).
125
126 - Next, APPC performs the DistributeTraffic action (**IV**)(**10-17**). If operation is completed properly traffic should be redirected to vFW 2 and vSINK 2 instance. If not, workflow is stopped (**18**).
127
128 - Finally, APPC executes the DistributeTrafficCheck action (**V**) on vFW 1 in order to verify that it does not receive any traffic anymore (**19-26**) and on vFW 2 in order to verify that it receives traffic forwarded from vFW 2 (**28-35**). Workflow is stopped with failed state (**37**) if one of those conditions was not satisfied (**27, 36**)
129
130 .. figure:: files/vfwdt-td-workflow-sd.png
131    :scale: 80 %
132    :align: center
133
134    Figure 7 The Traffic Distribution detailed workflow
135
136 4. The In-Place Software Upgrade with Traffic Distribution sub-workflow (simplified workflow on Figure 8 and more detailed on Figure 9)
137
138 .. figure:: files/vfwdt-workflow-upgrade.png
139    :scale: 100 %
140    :align: center
141
142    Figure 8 The In-Place Software Upgrade general workflow
143
144 - Firstly there is performed the UpgradePreCheck LCM operation on selected vFW instance (**I**)(**1-8**). The Ansible script executed by the APPC checks if the software version is different than the one indicated in workflow's input. If it is the same the workflow is stopped (**9**).
145
146 - When software of selected vFW instance needs to be upgraded (**II**) then the traffic migration procedure needs to be performed (**III** - see sub-workflow 3). If migration of traffic fails workflow is stopped.
147
148 - Next APPC performs over Ansible procedure of in place software upgrade. In our case this is simple refresh of the software packages on VM in order to simulate some upgrade process. Successful completion of the script should set the version of the software to the one from the upgrade request. If action fails workflow is stopped without further rollback (**18**).
149
150 - Afterwards, APPC performs the UpgradePostCheck LCM action (**IV**)(**19-26**). The script verifies if the version of software is the same like requested before in the upgrade. If not, workflow is stopped without further rollback (**27**).
151
152 - Finally, when software upgrade is completed traffic migration procedure needs to be performed again (**VI**) to migrate traffic back to upgraded before vFW instance (see sub-workflow 3). If migration of traffic fails workflow is stopped and rollback is no being performed.
153
154 .. figure:: files/vfwdt-upgrade-workflow-sd.png
155    :scale: 80 %
156    :align: center
157
158    Figure 9 The In-Place Software Upgrade detailed workflow
159
160 Scenario Setup
161 --------------
162
163 In order to setup the scenario and to test workflows with APPC LCM APIs in action you need to perform the following steps:
164
165 1. Create an instance of vFWDT (vPKG , 2 x vFW, 2 x vSINK) – dedicated for the traffic migration tests
166
167 #. Gather A&AI facts for use case configuration
168
169 #. Install Software Upgrade and Traffic Distribution workflow packages
170
171 #. Configure Optimization Framework for Traffic Distribution candidates gathering
172
173 #. Configure vPKG and vFW VNFs in APPC CDT tool
174
175 #. Configure Ansible Server to work with vPKG and vFW VMs
176
177 #. Execute Traffic Distribution or In-Place Upgrade Workflows
178
179 You will use the following ONAP K8s VMs or containers:
180
181 -  ONAP Rancher Server – workflow setup and its execution
182
183 -  APPC MariaDB container – setup Ansible adapter for vFWDT VNFs
184
185 -  APPC Ansible Server container – setup of Ansible Server, configuration of playbook and input parameters for LCM actions
186
187 .. note:: In all occurrences *K8S_NODE_IP* constant is the IP address of any K8s Node of ONAP OOM installation which hosts ONAP pods i.e. k8s-node-1 and *K8S-RANCHER-IP* constant is the IP address of K8S Rancher Server
188
189 vFWDT Service Instantiation
190 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
191
192 In order to test workflows a dedicated vFW instance must be prepared. It differs from a standard vFW instance by having an additional VF-module with a second instance of vFW and a second instance of vSINK. Thanks to that when a service instance is deployed there are already available two instances of vFW and vSINK that can be used for migration of traffic from one vFW instance to the other one – there is no need to use the ScaleOut function to test workflows what simplifies preparations for tests.
193
194 In order to instantiate vFWDT service please follow the procedure for standard vFW with following changes. You can create such service manually or you can use robot framework. For manual instantiation:
195
196 1. Please use the following HEAT templates:
197
198 https://github.com/onap/demo/tree/master/heat/vFWDT
199
200 2. Create Virtual Service in SDC with composition like it is shown on Figure 10
201
202 .. figure:: files/vfwdt-service.png
203    :scale: 60 %
204    :align: center
205
206    Figure 10 Composition of vFWDT Service
207
208 3. Use the following payload files in the SDNC-Preload phase during the VF-Module instantiation
209
210 - :download:`vPKG preload example <files/vpkg-preload.json>`
211
212 - :download:`vFW/SNK 1 preload example <files/vfw-1-preload.json>`
213
214 - :download:`vFW/SNK 2 preload example <files/vfw-2-preload.json>`
215
216 .. note:: Use public-key that is a pair for private key files used to log into ONAP OOM Rancher server. It will simplify further configuration
217
218 .. note:: vFWDT has a specific configuration of the networks – different than the one in original vFW use case (see Figure 11). Two networks must be created before the heat stack creation: *onap-private* network (10.0.0.0/16 typically) and *onap-external-private* (e.g. "10.100.0.0/16"). The latter one should be connected over a router to the external network that gives an access to VMs. Thanks to that VMs can have a floating IP from the external network assigned automatically in a time of stacks' creation. Moreover, the vPKG heat stack must be created before the vFW/vSINK stacks (it means that the VF-module for vPKG must be created as a first one). The vPKG stack creates two networks for the vFWDT use case: *protected* and *unprotected*; so these networks must be present before the stacks for vFW/vSINK are created.
219
220 .. figure:: files/vfwdt-networks.png
221    :scale: 15 %
222    :align: center
223
224    Figure 11 Configuration of networks for vFWDT service
225
226 4. Go to *robot* folder in Rancher server (being *root* user)
227
228 Go to the Rancher node and locate *demo-k8s.sh* script in *oom/kubernetes/robot* directory. This script will be used to run heatbridge procedure which will update A&AI information taken from OpenStack
229
230 5. Run robot *heatbridge* in order to upload service topology information into A&AI
231
232 ::
233
234     ./demo-k8s.sh onap heatbridge <stack_name> <service_instance_id> <service> <oam-ip-address>
235
236 where:
237
238 - <stack_name> - HEAT stack name from: OpenStack -> Orchestration -> Stacks
239 - <service_instance_id> - is service_instance_id which you can get from VID or AAI REST API
240 - <service> - in our case it should be vFWDT but may different (vFW, vFWCL) if you have assigned different service type in SDC
241 - <oam-ip-address> - it is the name of HEAT input which stores ONAP management network name
242
243 Much easier way to create vFWDT service instance is to trigger it from the robot framework. Robot automates creation of service instance and it runs also heatbridge. To create vFWDT this way:
244
245 1. Go to *robot* folder in Rancher server (being *root* user)
246
247 Go to the Rancher node and locate *demo-k8s.sh* script in *oom/kubernetes/robot* directory. This script will be used to run instantiate vFWDT service
248
249 2. Run robot scripts for vFWDT instantiation
250
251 ::
252
253     ./demo-k8s.sh onap init
254     ./ete-k8s.sh onap instantiateVFWDTGRA
255
256
257 .. note:: You can verify the status of robot's service instantiation process by going to https://K8S_NODE_IP:30209/logs/ (login/password: test/test)
258
259 After successful instantiation of vFWDT service go to the OpenStack dashboard and project which is configured for VNFs deployment and locate vFWDT VMs. Choose one and try to ssh into one them to prove that further ansible configuration action will be possible
260
261 ::
262
263     ssh -i <rancher_private_key> ubuntu@<VM-IP>
264
265
266 .. note:: The same private key file is used to ssh into Rancher server and VMs created by ONAP
267
268 Preparation of Workflow Script Environment
269 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270
271 1. Enter over ssh Rancher server using root user
272
273 ::
274
275     ssh -i <rancher_private_key> root@<K8S-RANCHER-IP>
276
277 2. Clone onap/demo repository
278
279 ::
280
281     git clone --single-branch --branch frankfurt "https://gerrit.onap.org/r/demo"
282
283 3. Enter vFWDT tutorial directory
284
285 ::
286
287     cd demo/tutorials/vFWDT
288     ls
289
290 what should show following folders
291
292 ::
293
294     root@sb01-rancher:~/demo/tutorials/vFWDT# ls
295     playbooks  preloads  workflow
296
297
298 .. note:: Remember vFWDT tutorial directory `~/demo/tutorials/vFWDT` for the further use
299
300 4. Install python dependencies
301
302 ::
303
304     sudo apt-get install python3-pip
305     pip3 install -r workflow/requirements.txt --user
306
307 Gathering Scenario Facts
308 ------------------------
309 In order to configure CDT tool for execution of Ansible playbooks and for execution of workflows we need following A&AI facts for vFWDT service
310
311 - **vnf-id** of generic-vnf vFW instance that we want to migrate traffic out from
312 - **vnf-type** of vPKG VNF - required to configure CDT for Distribute Traffic LCMs
313 - **vnf-type** of vFW-SINK VNFs - required to configure CDT for Distribute Traffic and Software Upgrade LCMs
314
315 Gathering facts from VID Portal
316 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317
318 1. Enter the VID portal
319
320 ::
321
322     https://K8S_NODE_IP:30200/vid/welcome.htm
323
324 2. In the left hand menu enter **Search for Existing Service Instances**
325
326 3. Select proper subscriber from the list and press **Submit** button. When service instance of vFWDT Service Type appears Click on **View/Edit** link
327
328 .. note:: The name of the subscriber you can read from the robot logs if your have created vFWDT instance with robot. Otherwise this should be *Demonstration* subscriber
329
330 4. For each VNF in vFWDT service instance note its *vnf-id* and *vnf-type*
331
332 .. figure:: files/vfwdt-vid-vpkg.png
333    :scale: 60 %
334    :align: center
335
336    Figure 12 vnf-type and vnf-id for vPKG VNF
337
338 .. figure:: files/vfwdt-vid-vnf-1.png
339    :scale: 60 %
340    :align: center
341
342    Figure 13 vnf-type and vnf-id for vFW-SINK 1 VNF
343
344 .. figure:: files/vfwdt-vid-vnf-2.png
345    :scale: 60 %
346    :align: center
347
348    Figure 14 vnf-type and vnf-id for vFW-SINK 2 VNF
349
350 Gathering facts directly from A&AI
351 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
352
353 1. Enter OpenStack dashboard on which vFWDT instance was created and got to **Project->Compute->Instances** and read VM names of vPKG VM and 2 vFW VMs created in vFWDT service instance
354
355 2. Open Postman or any other REST client
356
357 3. In Postman in General Settings disable *SSL Certificate verification*
358
359 4. You can use also following Postman Collection for AAI :download:`AAI Postman Collection <files/vfwdt-aai-postman.json>`
360
361 5. Alternatively create Collection and set its *Authorization* to *Basic Auth* type with login/password: AAI/AAI
362
363 6. Create new GET query for *tenants* type with following link and read *tenant-id* value
364
365 ::
366
367     https://K8S_NODE_IP:30233/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/
368
369 .. note:: *CloudOwner* and *Region* names are fixed for default setup of ONAP
370
371 7. Create new GET query for *vserver* type with following link replacing <tenant-id> with value read before and <vm-name> with vPKG VM name read from OpenStack dashboard
372
373 ::
374
375     https://K8S_NODE_IP:30233/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/<tenant-id>/vservers/?vserver-name=<vm-name>
376
377 Read from the response (relationship with *generic-vnf* type) vnf-id of vPKG VNF
378
379 .. note:: If you do not receive any vserver candidate it means that heatbridge procedure was not performed or was not completed successfully. It is mandatory to continue this tutorial
380
381 8. Create new GET query for *generic-vnf* type with following link replacing <vnf-id> with value read from previous GET response
382
383 ::
384
385     https://K8S_NODE_IP:30233/aai/v14/network/generic-vnfs/generic-vnf/<vnf-id>
386
387 9. Repeat this procedure also for 2 vFW VMs and note their *vnf-type* and *vnf-id*
388
389 Configuration of ONAP Environment
390 ---------------------------------
391 This sections show the steps necessary to configure Policies, CDT and Ansible server what is required for execution of APPC LCM actions in the workflow script
392
393 Configuration of Policies for Optimization Framework
394 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
395 We need to enter the Policy editor in order to upload policy types and then the policy rules for the demo. The policies are required for the Optimization Framework and they guide OOF how to determine
396 vFW and vPGN instances used in the Traffic Distribution workflow.
397
398 1. Enter the Policy portal
399
400 Specify *demo*:*demo* as a login and password
401
402 ::
403
404     https://K8S_NODE_IP:30219/onap/login.htm
405
406 From the left side menu enter *Dictionary* section and from the combo boxes select *MicroService Policy* and *MicroService Models* respectively. Below you can see the result.
407
408 .. figure:: files/vfwdt-policy-type-list.png
409    :scale: 70 %
410    :align: center
411
412    Figure 15 List of MicroService policy types in the Policy portal
413
414 2. Upload the policy types
415
416 Before policy rules for Traffic Distribution can be uploaded we need to create policy types to store these rules. For that we need to create following three types:
417
418 - VNF Policy - it used to filter vf-module instances i.e. base on their attributes from the AAI like *provStatus*, *cloudRegionId* etc.
419 - Query Policy - it is used to declare extra input parameters for OOF placement request  - in our case we need to specify cloud region name
420 - Affinity Policy - it is used to specify the placement rule used for selection vf-module candidate pairs of vFW vf-module instance (traffic destination) and vPGN vf-module instance (anchor point). In this case the match is done by belonging to the same cloud region
421
422 Enter vFWDT tutorial directory on Rancher server (already created in `Preparation of Workflow Script Environment`_) and create policy types from the following files
423
424 ::
425
426     root@sb01-rancher:~/demo/tutorials/vFWDT# ls policies/types/
427     affinityPolicy-v20181031.yml  queryPolicy-v20181031.yml  vnfPolicy-v20181031.yml
428
429 For each file press *Create* button, choose the policy type file, select the *Micro Service Option* (always one available) and enter the *Version* which must be the same like the one specified for policy instances. In this case pass value *OpenSource.version.1*
430
431 .. figure:: files/vfwdt-add-micro-service-policy.png
432    :scale: 70 %
433    :align: center
434
435    Figure 16 Creation of new MicroService policy type for OOF
436
437 In a result you should see in the dictionary all three new types of policies declared
438
439 .. figure:: files/vfwdt-completed-policy-type-list.png
440    :scale: 70 %
441    :align: center
442
443    Figure 17 Completed list of MicroService policy types in the Policy portal
444
445 3. Push the policies into the PDP
446
447 In order to push policies into the PDP it is required to execute already prepared *uploadPolicies.sh* script that builds policy creation/update requests and automatically sends them to the Policy PDP pod
448
449 ::
450
451     root@sb01-rancher:~/demo/tutorials/vFWDT# ls policies/rules/
452     QueryPolicy_vFW_TD.json  affinity_vFW_TD.json  uploadPolicies.sh  vnfPolicy_vFW_TD.json  vnfPolicy_vPGN_TD.json
453
454 When necessary, you can modify policy json files. Script will read these files and will build new PDP requests based on them. To create new policies execute script in the following way
455
456 ::
457
458     ./policies/rules/uploadPolicies.sh
459
460 To update existing policies execute script with an extra argument
461
462 ::
463
464     ./policies/rules/uploadPolicies.sh U
465
466 The result can be verified in the Policy portal, in the *Editor* section, after entering *OSDF_DUBLIN* directory
467
468 .. figure:: files/vfwdt-policy-editor-osdf-dublin.png
469    :scale: 70 %
470    :align: center
471
472    Figure 18 List of policies for OOF and vFW traffic distribution
473
474 Testing Gathered Facts on Workflow Script
475 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
476
477 Having collected *vnf-id* and *vnf-type* parameters we can execute Traffic Distribution Workflow Python script. It works in two modes. First one executes ony initial phase where AAI and OOF
478 is used to collect neccessary information for configuration of APPC and for further execution phase. The second mode performs also second phase which executes APPC LCM actions.
479
480 At this stage we will execute script in the initial mode to generate some configuration helpful in CDT and Ansible configuration.
481
482 1. Enter vFWDT tutorial directory on Rancher server (already created in `Preparation of Workflow Script Environment`_). In the *workflow* folder you can find workflow script used to gather necessary configuration and responsible for execution of the LCM actions. It has following syntax
483
484 ::
485
486     python3 workflow.py <VNF-ID> <RANCHER_NODE_IP> <K8S_NODE_IP> <IF-CACHE> <IF-VFWCL> <INITIAL-ONLY> <CHECK-STATUS> <VERSION>
487
488 - <VNF-ID> - vnf-id of vFW VNF instance that traffic should be migrated out from
489 - <RANCHER_NODE_IP> - External IP of ONAP Rancher Node i.e. 10.12.5.160 (If Rancher Node is missing this is NFS node)
490 - <K8S_NODE_IP> - External IP of ONAP K8s Worker Node i.e. 10.12.5.212
491 - <IF-CACHE> - If script should use and build OOF response cache (cache it speed-ups further executions of script)
492 - <IF-VFWCL> - If instead of vFWDT service instance vFW or vFWCL one is used (should be False always)
493 - <INITIAL-ONLY> - If only configuration information will be collected (True for initial phase and False for full execution of workflow)
494 - <CHECK-STATUS> - If APPC LCM action status should be verified and FAILURE should stop workflow (when False FAILED status of LCM action does not stop execution of further LCM actions)
495 - <VERSION> - New version of vFW - for tests '1.0' or '2.0'. Ignore when you want to test traffic distribution workflow
496
497 2. Execute there workflow script with following parameters
498
499 ::
500
501     python3 workflow.py <VNF-ID> <RANCHER_NODE_IP> <K8S_NODE_IP> True False True True 2.0
502
503 3. The script at this stage should give simmilar output
504
505 ::
506
507     Executing workflow for VNF ID '909d396b-4d99-4c6a-a59b-abe948873303' on Rancher with IP 10.0.0.10 and ONAP with IP 10.12.5.217
508
509     OOF Cache True, is CL vFW False, only info False, check LCM result True
510
511     New vFW software version 2.0
512
513     Starting OSDF Response Server...
514
515     vFWDT Service Information:
516     {
517         "vf-module-id": "0dce0e61-9309-449a-8e3e-f001635aaab1",
518         "service-info": {
519             "global-customer-id": "DemoCust_ccc04407-1740-4359-b3c4-51bbcb62d9f6",
520             "service-type": "vFWDT",
521             "service-instance-id": "ab37d391-95c6-4844-b7c3-23d111bfa2ce"
522         },
523         "vfw-model-info": {
524             "model-version-id": "f7fc17ba-48b9-456b-acc1-f89f31eda8cc",
525             "vnf-type": "vFWDT 2019-05-20 21:10:/vFWDT_vFWSNK b463aa83-b1fc 0",
526             "model-invariant-id": "0dfe8d6d-21c1-42f6-867a-1867cebb7751",
527             "vnf-name": "Ete_vFWDTvFWSNK_ccc04407_1"
528         },
529         "vpgn-model-info": {
530             "model-version-id": "0f8a2467-af44-4d7c-ac55-a346dcad9e0e",
531             "vnf-type": "vFWDT 2019-05-20 21:10:/vFWDT_vPKG a646a255-9bee 0",
532             "model-invariant-id": "75e5ec48-f43e-40d2-9877-867cf182e3d0",
533             "vnf-name": "Ete_vFWDTvPKG_ccc04407_0"
534         }
535     }
536
537     Ansible Inventory:
538     [vpgn]
539     vofwl01pgn4407 ansible_ssh_host=10.0.210.103 ansible_ssh_user=ubuntu
540     [vfw-sink]
541     vofwl01vfw4407 ansible_ssh_host=10.0.110.1 ansible_ssh_user=ubuntu
542     vofwl02vfw4407 ansible_ssh_host=10.0.110.4 ansible_ssh_user=ubuntu
543
544 The result should have almoast the same information for *vnf-id's* of both vFW VNFs. *vnf-type* for vPKG and vFW VNFs should be the same like those collected in previous steps.
545 Ansible Inventory section contains information about the content Ansible Inventor file that will be configured later on `Configuration of Ansible Server`_. The first phase of the workflow script will generate also the CDT artifacts which can be used for automatic configuration of the CDT tool - they can be ignored for manual CDT configuration.
546
547 Configuration of VNF in the APPC CDT tool
548 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
549
550 .. note:: Automated procedure can be found at the end of the section
551
552 Following steps aim to configure DistributeTraffic LCM action for our vPKG and vFW-SINK VNFs in APPC CDT tool. 
553
554 1. Enter the Controller Design Tool portal
555
556 ::
557
558     https://K8S_NODE_IP:30289/index.html
559
560 2. Click on *MY VNFS* button and login to CDT portal giving i.e. *demo* user name
561
562 3. Click on the *CREATE NEW VNF TYPE* button
563
564 .. figure:: files/vfwdt-create-vnf-type.png
565    :scale: 70 %
566    :align: center
567
568    Figure 19 Creation of new VNF type in CDT
569
570 4. Enter previously retrieved VNF Type for vPKG VNF and press the *NEXT* button
571
572 .. figure:: files/vfwdt-enter-vnf-type.png
573    :scale: 70 %
574    :align: center
575
576    Figure 20 Creation of new VNF type in CDT
577
578 5. For already created VNF Type (if the view does not open itself) click the *View/Edit* button. In the LCM action edit view in the first tab please choose:
579
580 -  *DistributeTraffic* as Action name
581
582 -  *ANSIBLE* as Device Protocol
583
584 -  *Y* value in Template dropdown menu
585
586 -  *admin* as User Name
587
588 -  *8000* as Port Number
589
590
591 .. figure:: files/vfwdt-new-lcm-ref-data.png
592    :scale: 70 %
593    :align: center
594
595    Figure 21 DistributeTraffic LCM action editing
596
597 6. Go to the *Template* tab and in the editor paste the request template of LCM actions for vPKG VNF type
598
599 For DistributeTraffic and DistributeTrafficCheck LCMs
600
601 ::
602
603     {
604         "InventoryNames": "VM",
605         "PlaybookName": "${book_name}",
606         "AutoNodeList": true,
607         "EnvParameters": {
608             "ConfigFileName": "../traffic_distribution_config.json",
609             "vnf_instance": "vfwdt"
610         },
611         "FileParameters": {
612             "traffic_distribution_config.json": "${file_parameter_content}"
613         },
614         "Timeout": 3600
615     }
616
617
618 For DistributeTraffic and DistributeTrafficCheck LCMs
619
620 ::
621
622     {
623         "InventoryNames": "VM",
624         "PlaybookName": "${book_name}",
625         "AutoNodeList": true,
626         "EnvParameters": {
627             "ConfigFileName": "../config.json",
628             "vnf_instance": "vfwdt",
629             "new_software_version": "${new-software-version}",
630             "existing_software_version": "${existing-software-version}"
631         },
632         "FileParameters": {
633             "config.json": "${file_parameter_content}"
634         },
635         "Timeout": 3600
636     }
637
638
639 The meaning of selected template parameters is following:
640
641 - **EnvParameters** group contains all the parameters that will be passed directly to the Ansible playbook during the request's execution. *vnf_instance* is an obligatory parameter for VNF Ansible LCMs. In our case for simplification it has predefined value
642 - **InventoryNames** parameter is obligatory if you want to have NodeList with limited VMs or VNFCs that playbook should be executed on. It can have value *VM* or *VNFC*. In our case *VM* value means that NodeList will have information about VMs on which playbook should be executed. In this use case this is always only one VM
643 - **AutoNodeList** parameter set to True indicates that template does not need the NodeList section specific and it will be generated automatically base on information from AAI - this requires proper data in the vserver and vnfc objects associated with VNFs
644 - **PlaybookName** must be the same as the name of playbook that was uploaded before to the Ansible server.
645 - **FileParameters** sections contains information about the configuration files with their content necessary to execute the playbook
646
647
648 .. figure:: files/vfwdt-create-template.png
649    :scale: 70 %
650    :align: center
651
652    Figure 22 LCM DistributeTraffic request template
653
654 7. Afterwards press the *SYNCHRONIZE WITH TEMPLATE PARAMETERS* button. You will be moved to the *Parameter Definition* tab. The new parameters will be listed there.
655
656 .. figure:: files/vfwdt-template-parameters.png
657    :scale: 70 %
658    :align: center
659
660    Figure 23 Summary of parameters specified for DistributeTraffic LCM action.
661
662 .. note:: For each parameter you can define its: mandatory presence; default value; source (Manual/A&AI). For our case modification of this settings is not necessary
663
664 8. Finally, go back to the *Reference Data* tab and click *SAVE ALL TO APPC*.
665
666 .. note:: Remember to configure DistributeTraffic and DistributeTrafficCheck actions for vPKG VNF type and UpgradeSoftware, UpgradePreCheck, UpgradePostCheck and DistributeTrafficCheck actions for vFW-SINK
667
668 9. Configuration of CDT tool is also automated and all steps above can be repeated with script *configure_ansible.sh*
669
670 Enter vFWDT tutorial directory `Preparation of Workflow Script Environment`_ on Rancher server, make sure that *onap.pem* file is in *playbooks* directory and run
671
672 ::
673
674     ./playbooks/configure_ansible.sh
675
676 Configuration of Ansible Server
677 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
678
679 .. note:: Automated procedure can be found at the end of the section
680
681 After an instantiation of the vFWDT service the Ansible server must be configured in order to allow it a reconfiguration of vPKG VM.
682
683 1. Copy from Rancher server private key file used for vFWDT VMs' creation and used for access to Rancher server into the :file:`/opt/ansible-server/Playbooks/onap.pem` file
684
685 ::
686
687     sudo kubectl cp <path/to/file>/onap.pem onap/`kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep appc-ansible`:/opt/ansible-server/Playbooks/
688
689 .. note:: The private key file must be the same like configured at this stage `vFWDT Service Instantiation`_
690
691 2. Enter the Rancher server and then enter the APPC Ansible server container
692
693 ::
694
695     kubectl exec -it -n onap `kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep appc-ansible` -- sh
696
697 3. Give the private key file a proper access rights
698
699 ::
700
701     cd /opt/ansible-server/Playbooks/
702     chmod 400 onap.pem
703     chown ansible:ansible onap.pem
704
705 4. Edit the :file:`/opt/ansible-server/Playbooks/Ansible\ \_\ inventory` file including all the hosts of vFWDT service instance used in this use case.
706    The content of the file is generated by workflow script `Testing Gathered Facts on Workflow Script`_
707
708 ::
709
710     [vpgn]
711     vofwl01pgn4407 ansible_ssh_host=10.0.210.103 ansible_ssh_user=ubuntu
712     [vfw-sink]
713     vofwl01vfw4407 ansible_ssh_host=10.0.110.1 ansible_ssh_user=ubuntu
714     vofwl02vfw4407 ansible_ssh_host=10.0.110.4 ansible_ssh_user=ubuntu
715
716 .. note:: Names of hosts and their IP addresses will be different. The names of the host groups are the same like 'vnfc-type' attributes configured in the CDT templates
717
718 5. Configure the default private key file used by Ansible server to access hosts over ssh
719
720 ::
721
722     vi /etc/ansible/ansible.cfg
723
724 ::
725
726     [defaults]
727     host_key_checking = False
728     private_key_file = /opt/ansible-server/Playbooks/onap.pem
729
730
731 .. note:: This is the default private key file. In the `/opt/ansible-server/Playbooks/Ansible\ \_\ inventory` different key could be configured but APPC in time of execution of playbook on Ansible server creates its own dedicated inventory file which does not have private key file specified. In consequence, this key file configured is mandatory for proper execution of playbooks by APPC
732
733
734 6. Test that the Ansible server can access over ssh vFWDT hosts configured in the ansible inventory
735
736 ::
737
738     ansible –i Ansible_inventory vpgn,vfw-sink –m ping
739
740
741 7. Download the LCM playbooks into the :file:`/opt/ansible-server/Playbooks` directory
742
743 Exit Ansible server pod and enter vFWDT tutorial directory `Preparation of Workflow Script Environment`_ on Rancher server. Afterwards, copy playbooks into Ansible server pod
744
745 ::
746
747     sudo kubectl cp playbooks/vfw-sink onap/`kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep appc-ansible`:/opt/ansible-server/Playbooks/
748     sudo kubectl cp playbooks/vpgn onap/`kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep appc-ansible`:/opt/ansible-server/Playbooks/
749
750 8. Configuration of ansible server is also automated and all steps above can be repeated with script *configure_ansible.sh* introduced in the previous section
751
752 9. After the configuration of Ansible server with script the structure of `/opt/ansible-server/Playbooks` directory should be following
753
754 ::
755
756     /opt/ansible-server/Playbooks $ ls -R
757     .:
758     ansible.cfg  Ansible_inventory  configure_ansible.sh  onap.pem  server.py  upgrade.sh  vfw-sink  vpgn
759
760     ./vfw-sink:
761     latest
762
763     ./vfw-sink/latest:
764     ansible
765
766     ./vfw-sink/latest/ansible:
767     distributetrafficcheck  upgradepostcheck  upgradeprecheck  upgradesoftware
768
769     ./vfw-sink/latest/ansible/distributetrafficcheck:
770     site.yml
771
772     ./vfw-sink/latest/ansible/upgradepostcheck:
773     site.yml
774
775     ./vfw-sink/latest/ansible/upgradeprecheck:
776     site.yml
777
778     ./vfw-sink/latest/ansible/upgradesoftware:
779     site.yml
780
781     ./vpgn:
782     latest
783
784     ./vpgn/latest:
785     ansible
786
787     ./vpgn/latest/ansible:
788     distributetraffic  distributetrafficcheck
789
790     ./vpgn/latest/ansible/distributetraffic:
791     site.yml
792
793     ./vpgn/latest/ansible/distributetrafficcheck:
794     site.yml
795
796
797 Configuration of APPC DB for Ansible
798 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
799
800 .. note:: Automated procedure can be found at the end of the section
801
802 For each VNF that uses the Ansible protocol you need to configure *PASSWORD* and *URL* field in the *DEVICE_AUTHENTICATION* table. This step must be performed after configuration in CDT which populates data in *DEVICE_AUTHENTICATION* table.
803
804 1. Enter the APPC DB container
805
806 ::
807
808     kubectl exec -it -n onap `kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep appc-db-0` -- sh
809
810 2. Enter the APPC DB CLI (password is *gamma*)
811
812 ::
813
814     mysql -u sdnctl -p
815
816 3. Execute the following SQL commands
817
818 ::
819
820     MariaDB [(none)]> use sdnctl;
821     MariaDB [sdnctl]> UPDATE DEVICE_AUTHENTICATION SET URL = 'http://appc-ansible-server:8000/Dispatch' WHERE WHERE PROTOCOL LIKE 'ANSIBLE' AND URL IS NULL;
822     MariaDB [sdnctl]> UPDATE DEVICE_AUTHENTICATION SET PASSWORD = 'admin' WHERE PROTOCOL LIKE 'ANSIBLE' AND PASSWORD IS NULL;
823     MariaDB [sdnctl]> select * from DEVICE_AUTHENTICATION WHERE PROTOCOL LIKE 'ANSIBLE';
824
825 Result should be similar to the following one:
826
827 ::
828
829     +--------------------------+------------------------------------------------------+----------+------------------------+-----------+----------+-------------+------------------------------------------+
830     | DEVICE_AUTHENTICATION_ID | VNF_TYPE                                             | PROTOCOL | ACTION                 | USER_NAME | PASSWORD | PORT_NUMBER | URL                                      |
831     +--------------------------+------------------------------------------------------+----------+------------------------+-----------+----------+-------------+------------------------------------------+
832     |                      118 | vFWDT 2020-04-21 17-26-/vFWDT_vFWSNK 1faca5b5-4c29 1 | ANSIBLE  | DistributeTrafficCheck | admin     | admin    |        8000 | http://appc-ansible-server:8000/Dispatch |
833     |                      121 | vFWDT 2020-04-21 17-26-/vFWDT_vFWSNK 1faca5b5-4c29 1 | ANSIBLE  | UpgradeSoftware        | admin     | admin    |        8000 | http://appc-ansible-server:8000/Dispatch |
834     |                      124 | vFWDT 2020-04-21 17-26-/vFWDT_vFWSNK 1faca5b5-4c29 1 | ANSIBLE  | UpgradePreCheck        | admin     | admin    |        8000 | http://appc-ansible-server:8000/Dispatch |
835     |                      127 | vFWDT 2020-04-21 17-26-/vFWDT_vFWSNK 1faca5b5-4c29 1 | ANSIBLE  | UpgradePostCheck       | admin     | admin    |        8000 | http://appc-ansible-server:8000/Dispatch |
836     |                      133 | vFWDT 2020-04-21 17-26-/vFWDT_vPKG 8021eee9-3a8f 0   | ANSIBLE  | DistributeTraffic      | admin     | admin    |        8000 | http://appc-ansible-server:8000/Dispatch |
837     |                      136 | vFWDT 2020-04-21 17-26-/vFWDT_vPKG 8021eee9-3a8f 0   | ANSIBLE  | DistributeTrafficCheck | admin     | admin    |        8000 | http://appc-ansible-server:8000/Dispatch |
838     +--------------------------+------------------------------------------------------+----------+------------------------+-----------+----------+-------------+------------------------------------------+
839
840     6 rows in set (0.00 sec)
841
842 4. Configuration of APPC DB is also automated and all steps above can be repeated with script *configure_ansible.sh* introduced in the previous sections
843
844
845 Testing Workflows
846 -----------------
847
848 Since all the configuration of components of ONAP is already prepared it is possible to enter second phase of workflows execution -
849 the execution of APPC LCM actions with configuration resolved before by OptimizationFramework.
850
851
852 Workflow Execution
853 ~~~~~~~~~~~~~~~~~~
854
855 In order to run workflows execute following commands from the vFWDT tutorial directory `Preparation of Workflow Script Environment`_ on Rancher server. 
856
857 For Traffic Distribution workflow run
858
859 ::
860
861     cd workflow
862     python3 workflow.py 909d396b-4d99-4c6a-a59b-abe948873303 10.12.5.217 10.12.5.63 True False False True
863
864
865 The order of executed LCM actions for Traffic Distribution workflow is following:
866
867 1. CheckLock on vPKG, vFW-1 and vFW-2 VMs
868 2. Lock on vPKG, vFW-1 and vFW-2 VMs
869 3. DistributeTrafficCheck on vPKG VM - ansible playbook checks if traffic destinations specified by OOF is not configured in the vPKG and traffic does not go from vPKG already.
870    If vPKG send already traffic to destination the playbook will fail and workflow will break.
871 4. DistributeTraffic on vPKG VM - ansible playbook reconfigures vPKG in order to send traffic to destination specified before by OOF.
872 5. DistributeTrafficCheck on vFW-1 VM - ansible playbook checks if traffic is not present on vFW from which traffic should be migrated out. If traffic is still present after 30 seconds playbook fails
873 6. DistributeTrafficCheck on vFW-2 VM - ansible playbook checks if traffic is present on vFW from which traffic should be migrated out. If traffic is still not present after 30 seconds playbook fails
874 7. Lock on vPKG, vFW-1 and vFW-2 VMs
875
876
877 For In-Place Software Upgrade with Traffic Distribution workflow run
878
879 ::
880
881     cd workflow
882     python3 workflow.py 909d396b-4d99-4c6a-a59b-abe948873303 10.12.5.217 10.12.5.63 True False False True 2.0
883
884
885 The order of executed LCM actions for In-Place Software Upgrade with Traffic Distribution workflow is following:
886
887 1. CheckLock on vPKG, vFW-1 and vFW-2 VMs
888 2. Lock on vPKG, vFW-1 and vFW-2 VMs
889 3. UpgradePreCheck on vFW-1 VM - checks if the software version on vFW is different than the one requested in the workflow input
890 4. DistributeTrafficCheck on vPKG VM - ansible playbook checks if traffic destinations specified by OOF is not configured in the vPKG and traffic does not go from vPKG already.
891    If vPKG send already traffic to destination the playbook will fail and workflow will break.
892 5. DistributeTraffic on vPKG VM - ansible playbook reconfigures vPKG in order to send traffic to destination specified before by OOF.
893 6. DistributeTrafficCheck on vFW-1 VM - ansible playbook checks if traffic is not present on vFW from which traffic should be migrated out. If traffic is still present after 30 seconds playbook fails
894 7. DistributeTrafficCheck on vFW-2 VM - ansible playbook checks if traffic is present on vFW from which traffic should be migrated out. If traffic is still not present after 30 seconds playbook fails
895 8. UpgradeSoftware on vFW-1 VM - ansible playbook modifies the software on the vFW instance and sets the version of the software to the specified one in the request 
896 9. UpgradePostCheck on vFW-1 VM - ansible playbook checks if the software of vFW is the same like the one specified in the workflows input. 
897 10. DistributeTraffic on vPKG VM - ansible playbook reconfigures vPKG in order to send traffic to destination specified before by OOF (reverse configuration).
898 11. DistributeTrafficCheck on vFW-2 VM - ansible playbook checks if traffic is not present on vFW from which traffic should be migrated out. If traffic is still present after 30 seconds playbook fails
899 12. DistributeTrafficCheck on vFW-1 VM - ansible playbook checks if traffic is present on vFW from which traffic should be migrated out. If traffic is still not present after 30 seconds playbook fails
900 13. Unlock on vPKG, vFW-1 and vFW-2 VMs
901
902
903 For both workflows when everything is fine with both workflows change of the traffic should be observed on following dashboards (please turn on automatic reload of graphs). The observed traffic pattern for upgrade scenario should be similar to the one presented in Figure 2
904
905     ::
906
907         http://vSINK-1-IP:667/
908         http://vSINK-2-IP:667/
909
910 Workflow Results
911 ~~~~~~~~~~~~~~~~
912
913 Expected result of Traffic Distribution workflow execution, when everything is fine, is following:
914
915 ::
916
917     Distribute Traffic Workflow Execution:
918     WORKFLOW << Migrate vFW Traffic Conditionally >>
919     APPC LCM << CheckLock >> [Check vPGN Lock Status]
920     UNLOCKED
921     APPC LCM << CheckLock >> [Check vFW-1 Lock Status]
922     UNLOCKED
923     APPC LCM << CheckLock >> [Check vFW-2 Lock ]
924     UNLOCKED
925     APPC LCM << Lock >> [Lock vPGN]
926     SUCCESSFUL
927     APPC LCM << Lock >> [Lock vFW-1]
928     SUCCESSFUL
929     APPC LCM << Lock >> [Lock vFW-2]
930     SUCCESSFUL
931     APPC LCM << DistributeTrafficCheck >> [Check current traffic destination on vPGN]
932     ACCEPTED
933     APPC LCM << DistributeTrafficCheck >> [Status]
934     IN_PROGRESS
935     IN_PROGRESS
936     IN_PROGRESS
937     SUCCESSFUL
938     WORKFLOW << Migrate Traffic and Verify >>
939     APPC LCM << DistributeTraffic >> [Migrating source vFW traffic to destination vFW]
940     ACCEPTED
941     APPC LCM << DistributeTraffic >> [Status]
942     IN_PROGRESS
943     IN_PROGRESS
944     IN_PROGRESS
945     IN_PROGRESS
946     IN_PROGRESS
947     IN_PROGRESS
948     IN_PROGRESS
949     IN_PROGRESS
950     SUCCESSFUL
951     APPC LCM << DistributeTrafficCheck >> [Checking traffic has been stopped on the source vFW]
952     ACCEPTED
953     APPC LCM << DistributeTrafficCheck >> [Status]
954     IN_PROGRESS
955     IN_PROGRESS
956     IN_PROGRESS
957     SUCCESSFUL
958     APPC LCM << DistributeTrafficCheck >> [Checking traffic has appeared on the destination vFW]
959     ACCEPTED
960     APPC LCM << DistributeTrafficCheck >> [Status]
961     IN_PROGRESS
962     IN_PROGRESS
963     SUCCESSFUL
964     APPC LCM << Unlock >> [Unlock vPGN]
965     SUCCESSFUL
966     APPC LCM << Unlock >> [Unlock vFW-1]
967     SUCCESSFUL
968     APPC LCM << Unlock >> [Unlock vFW-2]
969     SUCCESSFUL
970
971
972 In case we want to execute operation and one of the VNFs is locked because of other operation being executed:
973
974 ::
975
976     Distribute Traffic Workflow Execution:
977     WORKFLOW << Migrate vFW Traffic Conditionally >>
978     APPC LCM << CheckLock >> [Check vPGN Lock Status]
979     LOCKED
980     Traceback (most recent call last):
981     File "workflow.py", line 1235, in <module>
982         sys.argv[6].lower() == 'true', sys.argv[7].lower() == 'true', new_version)
983     File "workflow.py", line 1209, in execute_workflow
984         _execute_lcm_requests({"requests": lcm_requests, "description": "Migrate vFW Traffic Conditionally"}, onap_ip, check_result)
985     File "workflow.py", line 101, in wrap
986         ret = f(*args, **kwargs)
987     File "workflow.py", line 1007, in _execute_lcm_requests
988         raise Exception("APPC LCM << {} >> FAILED".format(req['input']['action']))
989     Exception: APPC LCM << CheckLock >> FAILED
990
991
992 In case of failure the result can be following:
993
994 ::
995
996     Distribute Traffic Workflow Execution:
997     WORKFLOW << Migrate vFW Traffic Conditionally >>
998     APPC LCM << CheckLock >> [Check vPGN Lock Status]
999     UNLOCKED
1000     APPC LCM << CheckLock >> [Check vFW-1 Lock Status]
1001     UNLOCKED
1002     APPC LCM << CheckLock >> [Check vFW-2 Lock ]
1003     UNLOCKED
1004     APPC LCM << Lock >> [Lock vPGN]
1005     SUCCESSFUL
1006     APPC LCM << Lock >> [Lock vFW-1]
1007     SUCCESSFUL
1008     APPC LCM << Lock >> [Lock vFW-2]
1009     SUCCESSFUL
1010     APPC LCM << DistributeTrafficCheck >> [Check current traffic destination on vPGN]
1011     ACCEPTED
1012     APPC LCM << DistributeTrafficCheck >> [Status]
1013     FAILED
1014     APPC LCM <<DistributeTrafficCheck>> [FAILED - FAILED]
1015     WORKFLOW << Migrate Traffic and Verify >> SKIP
1016     APPC LCM << Unlock >> [Unlock vPGN]
1017     SUCCESSFUL
1018     APPC LCM << Unlock >> [Unlock vFW-1]
1019     SUCCESSFUL
1020     APPC LCM << Unlock >> [Unlock vFW-2]
1021     SUCCESSFUL
1022
1023
1024 .. note:: When CDT and Ansible is configured properly Traffic Distribution Workflow can fail when you pass as a vnf-id argument the ID of vFW VNF which does not handle traffic at the moment. To solve that pass the VNF ID of the other vFW VNF instance. Because of the same reason you cannot execute twice in a row workflow for the same VNF ID if first execution succeeds.