blob: 4eeba7b8454081d705a71740d4bc42ff7c7cb2ce [file] [log] [blame]
helenc8783e58ef52018-11-30 16:10:10 -08001.. 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
Gary Wucd47a012018-11-30 07:18:36 -08006.. contents::
7 :depth: 3
8..
9
10vFW Traffic Distribution Use Case
11---------------------------------
12Description
13~~~~~~~~~~~
14
Lukasz Rajewski048e0892019-09-12 09:03:47 +020015The purpose of this work is to show Traffic Distribiution functionality implemented in Casablanca and Dublin releases for vFW Use Case.
Lukasz Rajewski80726d82019-06-04 13:47:17 +020016The orchstration workflow triggers a change to traffic distribution (redistribution) done by a traffic balancing/distribution entity (aka anchor point).
17The DistributeTraffic action targets the traffic balancing/distribution entity, in some cases DNS, other cases a load balancer external to the VNF instance, as examples.
18Traffic distribution (weight) changes intended to take a VNF instance out of service are completed only when all in-flight traffic/transactions have been completed.
19DistributeTrafficCheck command may be used to verify initial conditions of redistribution or can be used to verify the state of VNFs and redistribution itself.
20To complete the traffic redistribution process, gracefully taking a VNF instance out-of-service/into-service, without dropping in-flight calls or sessions,
Lukasz Rajewski048e0892019-09-12 09:03:47 +020021QuiesceTraffic/ResumeTraffic command may need to follow traffic distribution changes. The VNF application remains in an active state.
Gary Wucd47a012018-11-30 07:18:36 -080022
Gary Wucd47a012018-11-30 07:18:36 -080023
Lukasz Rajewski80726d82019-06-04 13:47:17 +020024Traffic Distribution functionality is an outcome of Change Management project. Further details can be found on following pages
25
26https://wiki.onap.org/display/DW/Change+Management+Extensions (DistributeTraffic LCM and Use Case)
27
28https://wiki.onap.org/display/DW/Change+Management+Dublin+Extensions (Distribute Traffic Workflow with Optimization Framework)
Gary Wucd47a012018-11-30 07:18:36 -080029
30Test Scenario
31~~~~~~~~~~~~~
32
Lukasz Rajewski80726d82019-06-04 13:47:17 +020033.. figure:: files/dt-use-case.png
Gary Wucd47a012018-11-30 07:18:36 -080034 :scale: 40 %
35 :align: center
36
Lukasz Rajewski80726d82019-06-04 13:47:17 +020037 Figure 1 The idea of Traffic Distribution Use Case
Gary Wucd47a012018-11-30 07:18:36 -080038
Lukasz Rajewski048e0892019-09-12 09:03:47 +020039The idea of the simplified scenario presented in the Casablanca release is shown on Figure 1. In a result of the DistributeTraffic 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).
40Result of the change can be observed also on the vSINKs' dashboards which show a current incoming traffic. Observation of the dashboard from vSINK 1 and vSINK 2 proves workflow works properly.
Gary Wucd47a012018-11-30 07:18:36 -080041
Lukasz Rajewski80726d82019-06-04 13:47:17 +020042.. figure:: files/dt-result.png
43 :scale: 60 %
Gary Wucd47a012018-11-30 07:18:36 -080044 :align: center
45
46 Figure 2 The result of traffic distribution
47
Lukasz Rajewski048e0892019-09-12 09:03:47 +020048The purpose of the work in the Dublin release was to built a Traffic Distribution Workflow that 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.
Lukasz Rajewski80726d82019-06-04 13:47:17 +020049
50.. figure:: files/dt-workflow.png
51 :scale: 60 %
52 :align: center
53
54 Figure 3 The Traffic Distribution Workflow
55
56The prepared Traffic Distribution Workflow has following steps:
57
Lukasz Rajewski048e0892019-09-12 09:03:47 +020058- 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 migrate traffic out from.
Lukasz Rajewski80726d82019-06-04 13:47:17 +020059 Optimization Framework role is to find the vFW-SINK VNF/VF-module instance where traffic should be migrated to and vPKG which will be associated with this vFW.
Lukasz Rajewski048e0892019-09-12 09:03:47 +020060 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.
Lukasz Rajewski80726d82019-06-04 13:47:17 +020061
62- 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)
63
Lukasz Rajewski048e0892019-09-12 09:03:47 +020064- Optimization Framework, base on the information from the polcies and service topology information taken from A&AI (**4-11**), offers traffic distribution anchor and destination canidates' 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**).
Lukasz Rajewski80726d82019-06-04 13:47:17 +020065
66- Information from Optimization Framework can be used to construct APPC LCM requests for DistributeTrafficCheck and DistributeTraffic commands (**15, 24, 33, 42**). This information is used to fill CDT templates with proper data for further Ansible playbooks execution (**17, 26, 35, 44**)
67
68- In the first DistributeTrafficCheck LCM request on vPGN VNF/VF-Module APPC, over Ansible, checks if already configured destinatrion of vPKG packages is different than already configured. If not workflow is stopped (**23**).
69
70- Next, APPC performs the DistributeTraffic action like it is shown on Figure 1 and Figure 2 (**25-31**). If operation is completed properly traffic should be redirected to vFW 2 and vSINK 2 instance. If not, workflow is stopped (**32**).
71
Lukasz Rajewski048e0892019-09-12 09:03:47 +020072- Finally, APPC executes the DistributeTrafficCheck action on vFW 1 in order to verify that it does not receives any traffic anymore (**34-40**) and on vFW 2 in order to verify that it receives traffic forwarded from vFW 2 (**43-49**)
Lukasz Rajewski80726d82019-06-04 13:47:17 +020073
74Scenario Setup
75--------------
76
Gary Wucd47a012018-11-30 07:18:36 -080077In order to setup the scenario and to test the DistributeTraffic LCM API in action you need to perform the following steps:
78
791. Create an instance of vFWDT (vPKG , 2 x vFW, 2 x vSINK) – dedicated for the DistributeTraffic LCM API tests
80
Lukasz Rajewski80726d82019-06-04 13:47:17 +020081#. Gather A&AI facts for Traffic Distribution use case configuration
Gary Wucd47a012018-11-30 07:18:36 -080082
Lukasz Rajewski80726d82019-06-04 13:47:17 +020083#. Install Traffic Distribution workflow packages
Gary Wucd47a012018-11-30 07:18:36 -080084
Lukasz Rajewski80726d82019-06-04 13:47:17 +020085#. Configure Optimization Framework for Traffic Distribution workflow
Gary Wucd47a012018-11-30 07:18:36 -080086
Lukasz Rajewski80726d82019-06-04 13:47:17 +020087#. Configure vPKG and vFW VNFs in APPC CDT tool
Gary Wucd47a012018-11-30 07:18:36 -080088
Lukasz Rajewski80726d82019-06-04 13:47:17 +020089#. Configure Ansible Server to work with vPKG and vFW VMs
Gary Wucd47a012018-11-30 07:18:36 -080090
Lukasz Rajewski80726d82019-06-04 13:47:17 +020091#. Execute Traffic Distribution Workflow
Gary Wucd47a012018-11-30 07:18:36 -080092
Lukasz Rajewski80726d82019-06-04 13:47:17 +020093You will use the following ONAP K8s VMs or containers:
Gary Wucd47a012018-11-30 07:18:36 -080094
Lukasz Rajewski80726d82019-06-04 13:47:17 +020095- ONAP Rancher Server – workflow setup and its execution
Gary Wucd47a012018-11-30 07:18:36 -080096
Lukasz Rajewski80726d82019-06-04 13:47:17 +020097- APPC MariaDB container – setup Ansible adapter for vFWDT VNFs
Gary Wucd47a012018-11-30 07:18:36 -080098
Lukasz Rajewski80726d82019-06-04 13:47:17 +020099- APPC Ansible Server container – setup of Ansible Server, configuration of playbook and input parameters for LCM actions
Gary Wucd47a012018-11-30 07:18:36 -0800100
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200101.. note:: In all occurences <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
Gary Wucd47a012018-11-30 07:18:36 -0800102
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200103vFWDT Service Instantiation
104~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gary Wucd47a012018-11-30 07:18:36 -0800105
106In order to test a DistributeTraffic LCM API functionality 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 verification of DistributeTraffic LCM API – there is no need to use the ScaleOut function to test DistributeTraffic functionality what simplifies preparations for tests.
107
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200108In 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:
Gary Wucd47a012018-11-30 07:18:36 -0800109
1101. Please use the following HEAT templates:
111
112https://github.com/onap/demo/tree/master/heat/vFWDT
113
1142. Create Virtual Service in SDC with composition like it is shown on Figure 3
115
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200116.. figure:: files/vfwdt-service.png
117 :scale: 60 %
Gary Wucd47a012018-11-30 07:18:36 -0800118 :align: center
119
120 Figure 3 Composition of vFWDT Service
121
1223. Use the following payload files in the SDNC-Preload phase during the VF-Module instantiation
123
124- :download:`vPKG preload example <files/vpkg-preload.json>`
125
126- :download:`vFW/SNK 1 preload example <files/vfw-1-preload.json>`
127
128- :download:`vFW/SNK 2 preload example <files/vfw-2-preload.json>`
129
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200130.. note:: Use publikc-key that is a pair for private key files used to log into ONAP OOM Rancher server. It will simplify further configuration
Gary Wucd47a012018-11-30 07:18:36 -0800131
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200132.. note:: vFWDT has a specific configuration of the networks – different than the one in original vFW use case (see Figure 4). 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.
133
134.. figure:: files/vfwdt-networks.png
135 :scale: 15 %
Gary Wucd47a012018-11-30 07:18:36 -0800136 :align: center
137
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200138 Figure 4 Configuration of networks for vFWDT service
139
1404. Go to *robot* folder in Rancher server (being *root* user)
141
142Go 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
143
1445. Run robot *heatbridge* in order to upload service topology information into A&AI
145
146::
147
148 ./demo-k8s.sh onap heatbridge <stack_name> <service_instance_id> <service> <oam-ip-address>
149
150where:
151
152- <stack_name> - HEAT stack name from: OpenStack -> Orchestration -> Stacks
153- <service_instance_id> - is service_instance_id which you can get from VID or AAI REST API
154- <service> - in our case it should be vFWDT but may different (vFW, vFWCL) if you have assigned different service type in SDC
155- <oam-ip-address> - it is the name of HEAT input which stores ONAP management network name
156
157Much 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:
158
1591. Go to *robot* folder in Rancher server (being *root* user)
160
161Go 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
162
1632. Run robot scripts for vFWDT instantiation
164
165::
166
167 ./demo-k8s.sh onap init
168 ./ete-k8s.sh onap instantiateVFWDT
169
170
171.. note:: You can verify the status of robot's service instantiation process by going to http://<K8S-NODE-IP>:30209/logs/ (login/password: test/test)
172
173After 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 proove that further ansible configuration action will be possible
174
175::
176
177 ssh -i <rancher_private_key> ubuntu@<VM-IP>
178
179
180.. note:: The same private key file is used to ssh into Rancher server and VMs created by ONAP
181
182Preparation of Workflow Script Environment
183~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184
1851. Enter over ssh Rancher server using root user
186
187::
188
189 ssh -i <rancher_private_key> root@<K8S-RANCHER-IP>
190
1912. Clone onap/demo repository
192
193::
194
195 git clone --single-branch --branch dublin "https://gerrit.onap.org/r/demo"
196
1973. Enter vFWDT tutorial directory
198
199::
200
201 cd demo/tutorials/vFWDT
202 ls
203
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200204what should show following folders
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200205
206::
207
208 root@sb01-rancher:~/demo/tutorials/vFWDT# ls
209 playbooks preloads workflow
210
211
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200212.. note:: Remember vFWDT tutorial directory `~/demo/tutorials/vFWDT` for the further use
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200213
2144. Install python dependencies
215
216::
217
218 sudo apt-get install python3-pip
219 pip3 install -r workflow/requirements.txt --user
220
221Gathering Scenario Facts
222------------------------
223In order to configure CDT tool for execution of Ansible playbooks and for execution of Traffic distribution workflow we need following A&AI facts for vFWDT service
224
225- **vnf-id** of generic-vnf vFW instance that we want to migrate traffic out from
226- **vnf-type** of vPKG VNF - required to configure CDT for Distribute Traffic LCMs
227- **vnf-type** of vFW-SINK VNFs - required to configure CDT for Distribute Traffic LCMs
228
229Gathering facts from VID Portal
230~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231
2321. Enter the VID portal
233
234::
235
236 https://<K8S-NODE-IP>:30200/vid/welcome.htm
237
2382. In the left hand menu enter **Search for Existing Service Instances**
239
2403. Select proper subscriber from the list and press **Submit** button. When service instance of vFWDT Service Type appears Click on **View/Edit** link
241
242.. 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
243
2444. For each VNF in vFWDT service instance note its *vnf-id* and *vnf-type*
245
246.. figure:: files/vfwdt-vid-vpkg.png
247 :scale: 60 %
248 :align: center
249
250 Figure 5 vnf-type and vnf-id for vPKG VNF
251
252.. figure:: files/vfwdt-vid-vnf-1.png
253 :scale: 60 %
254 :align: center
255
256 Figure 6 vnf-type and vnf-id for vFW-SINK 1 VNF
257
258.. figure:: files/vfwdt-vid-vnf-2.png
259 :scale: 60 %
260 :align: center
261
262 Figure 7 vnf-type and vnf-id for vFW-SINK 2 VNF
263
264Gathering facts directly from A&AI
265~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
266
2671. Enter OpenStack dashboard on whicvh 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
268
2692. Open Postman or any other REST client
270
2713. In Postman in General Settings disable *SSL Certificate verification*
272
2734. You can use also following Postman Collection for AAI :download:`AAI Postman Collection <files/vfwdt-aai-postman.json>`
274
2755. Alternatively create Collection and set its *Authorization* to *Basic Auth* type with login/password: AAI/AAI
276
2776. Create new GET query for *tenants* type with following link and read *tenant-id* value
278
279::
280
281 https://<K8S-NODE-IP>:30233/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/
282
283.. note:: *CloudOwner* and *Region* names are fixed for default setup of ONAP
284
2857. 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
286
287::
288
289 https://<K8S-NODE-IP>:30233/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/<tenant-id>/vservers/?vserver-name=<vm-name>
290
291Read from the response (realtionship with *generic-vnf* type) vnf-id of vPKG VNF
292
293.. note:: If you do not receive any vserver candidate it means that heatbridge procedure was not performed or was not completed successfuly. It is mandatory to continue this tutorial
294
2958. Create new GET query for *generic-vnf* type with following link replacing <vnf-id> with value read from previous GET response
296
297::
298
299 https://<K8S-NODE-IP>:30233/aai/v14/network/generic-vnfs/generic-vnf/<vnf-id>
300
3019. Repeat this procedure also for 2 vFW VMs and note their *vnf-type* and *vnf-id*
302
303Configuration of ONAP Environment
304---------------------------------
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200305This 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
306
307Configuration of Policies for Optimization Framework
308~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
309We need to enter the Policy editor in order to upload policy types and then the policy rules for the demo. The polcies are required for the Optimization Framework and they guide OOF how to determine
310vFW and vPGN instances used in the Traffic Distribution workflow.
311
3121. Enter the Policy portal
313
314Specify *demo*:*demo* as a login and password
315
316::
317
318 https://<K8S-NODE-IP>:30219/onap/login.htm
319
320From 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.
321
322.. figure:: files/vfwdt-policy-type-list.png
323 :scale: 70 %
324 :align: center
325
326 Figure 8 List of MicroService policy types in the Policy portal
327
3282. Upload the policy types
329
330Before 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:
331
332- VNF Policy - it used to filter vf-module instances i.e. base on their attributes from the AAI like *provStatus*, *cloudRegionId* etc.
333- Query Policy - it is used to declare extra inpt parameters for OOF placement request - in our case we need to specify cloud region name
334- Affinity Policy - it is used to specify the placement rule used for selection vf-module candiate 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
335
336Enter vFWDT tutorial directory on Rancher server (already created in `Preparation of Workflow Script Environment`_) and create policy types from the following files
337
338::
339
340 root@sb01-rancher:~/demo/tutorials/vFWDT# ls policies/types/
341 affinityPolicy-v20181031.yml queryPolicy-v20181031.yml vnfPolicy-v20181031.yml
342
343For 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*
344
345.. figure:: files/vfwdt-add-micro-service-policy.png
346 :scale: 70 %
347 :align: center
348
349 Figure 9 Creation of new MicroService policy type for OOF
350
351In a result you should see in the dictionary all three new types of policies declared
352
353.. figure:: files/vfwdt-completed-policy-type-list.png
354 :scale: 70 %
355 :align: center
356
357 Figure 10 Completed list of MicroService policy types in the Policy portal
358
3593. Push the policies into the PDP
360
361In 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
362
363::
364
365 root@sb01-rancher:~/demo/tutorials/vFWDT# ls policies/rules/
366 QueryPolicy_vFW_TD.json affinity_vFW_TD.json uploadPolicies.sh vnfPolicy_vFW_TD.json vnfPolicy_vPGN_TD.json
367
368When 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
369
370::
371
372 ./policies/rules/uploadPolicies.sh
373
374To update existing policies execute script with an extra argument
375
376::
377
378 ./policies/rules/uploadPolicies.sh U
379
380The result can be verified in the Policy portal, in the *Editor* section, after entering *OSDF_DUBLIN* directory
381
382.. figure:: files/vfwdt-policy-editor-osdf-dublin.png
383 :scale: 70 %
384 :align: center
385
386 Figure 11 List of policies for OOF and vFW traffic distribution
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200387
388Testing Gathered Facts on Workflow Script
389~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
390
391Having 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
392is 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.
393
394At this stage we will execute script in the initial mode to generate some configuration helpful in CDT and Ansible configuration.
395
3961. Enter vFWDT tutorial directory on Rancher server (already created in `Preparation of Workflow Script Environment`_) and execute there workflow script with follwoing parameters
397
398::
399
400 python3 workflow.py <VNF-ID> <K8S-NODE-IP> True False True True
401
402For now and for further use workflow script has following input parameters:
403
404- vnf-id of vFW VNF instance that traffic should be migrated out from
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200405- External IP of ONAP Rancher Node i.e. 10.12.5.160 (If Rancher Node is missing this is NFS node)
406- External IP of ONAP K8s Worker Node i.e. 10.12.5.212
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200407- if script should use and build OOF response cache (cache it speed-ups further executions of script)
408- if instead of vFWDT service instance vFW or vFWCL one is used (should be False always)
409- if only configuration information will be collected (True for initial phase and False for full execution of workflow)
410- 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)
411
4122. The script at this stage should give simmilar output
413
414::
415
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200416 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
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200417
418 OOF Cache True, is CL vFW False, only info False, check LCM result True
419
420 vFWDT Service Information:
421 {
422 "vf-module-id": "0dce0e61-9309-449a-8e3e-f001635aaab1",
423 "service-info": {
424 "global-customer-id": "DemoCust_ccc04407-1740-4359-b3c4-51bbcb62d9f6",
425 "service-type": "vFWDT",
426 "service-instance-id": "ab37d391-95c6-4844-b7c3-23d111bfa2ce"
427 },
428 "vfw-model-info": {
429 "model-version-id": "f7fc17ba-48b9-456b-acc1-f89f31eda8cc",
430 "vnf-type": "vFWDT 2019-05-20 21:10:/vFWDT_vFWSNK b463aa83-b1fc 0",
431 "model-invariant-id": "0dfe8d6d-21c1-42f6-867a-1867cebb7751",
432 "vnf-name": "Ete_vFWDTvFWSNK_ccc04407_1"
433 },
434 "vpgn-model-info": {
435 "model-version-id": "0f8a2467-af44-4d7c-ac55-a346dcad9e0e",
436 "vnf-type": "vFWDT 2019-05-20 21:10:/vFWDT_vPKG a646a255-9bee 0",
437 "model-invariant-id": "75e5ec48-f43e-40d2-9877-867cf182e3d0",
438 "vnf-name": "Ete_vFWDTvPKG_ccc04407_0"
439 }
440 }
441
442 Ansible Inventory:
443 [vpgn]
444 vofwl01pgn4407 ansible_ssh_host=10.0.210.103 ansible_ssh_user=ubuntu
445 [vfw-sink]
446 vofwl01vfw4407 ansible_ssh_host=10.0.110.1 ansible_ssh_user=ubuntu
447 vofwl02vfw4407 ansible_ssh_host=10.0.110.4 ansible_ssh_user=ubuntu
448
449The 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.
450Ansible Inventory section contains information about the content Ansible Inventor file that will be configured later on `Configuration of Ansible Server`_
451
452Configuration of VNF in the APPC CDT tool
453~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
454
455Following steps aim to configure DistributeTraffic LCM action for our vPKG and vFW-SINK VNFs in APPC CDT tool.
456
4571. Enter the Controller Design Tool portal
458
459::
460
461 https://<K8S-NODE-IP>:30289/index.html
462
4632. Click on *MY VNFS* button and login to CDT portal giving i.e. *demo* user name
464
4653. Click on the *CREATE NEW VNF TYPE* button
466
467.. figure:: files/vfwdt-create-vnf-type.png
468 :scale: 70 %
469 :align: center
470
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200471 Figure 12 Creation of new VNF type in CDT
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200472
4734. Enter previously retrieved VNF Type for vPKG VNF and press the *NEXT* button
474
475.. figure:: files/vfwdt-enter-vnf-type.png
476 :scale: 70 %
477 :align: center
478
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200479 Figure 13 Creation of new VNF type in CDT
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200480
4815. 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:
482
483- *DistributeTraffic* as Action name
484
485- *ANSIBLE* as Device Protocol
486
487- *Y* value in Template dropdown menu
488
489- *admin* as User Name
490
491- *8000* as Port Number
492
493
494.. figure:: files/vfwdt-new-lcm-ref-data.png
495 :scale: 70 %
496 :align: center
497
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200498 Figure 14 DistributeTraffic LCM action editing
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200499
5006. Go to the *Template* tab and in the editor paste the request template of the DistributeTraffic LCM action for vPKG VNF type
501
502::
503
504 {
505 "InventoryNames": "VM",
506 "PlaybookName": "${()=(book_name)}",
507 "NodeList": [{
508 "vm-info": [{
509 "ne_id": "${()=(ne_id)}",
510 "fixed_ip_address": "${()=(fixed_ip_address)}"
511 }],
512 "site": "site",
513 "vnfc-type": "vpgn"
514 }],
515 "EnvParameters": {
516 "ConfigFileName": "../traffic_distribution_config.json",
517 "vnf_instance": "vfwdt",
518 },
519 "FileParameters": {
520 "traffic_distribution_config.json": "${()=(file_parameter_content)}"
521 },
522 "Timeout": 3600
523 }
524
525.. note:: For all this VNF types and for all actions CDT template is the same except **vnfc-type** parameter that for vPKG VNF type should have value *vpgn* and for vFW-SINK VNF type should have value *vfw-sink*
526
527The meaning of selected template parameters is following:
528
529- **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
530- **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* valuye means that NodeList will have information about VMs on which playbook should be executed. In this use case this is always only one VM
531- **NodeList** parameter value must match the group of VMs like it was specified in the Ansible inventory file. *PlaybookName* must be the same as the name of playbook that was uploaded before to the Ansible server.
532- **FileParameters**
533
534
535.. figure:: files/vfwdt-create-template.png
536 :scale: 70 %
537 :align: center
538
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200539 Figure 15 LCM DistributeTraffic request template
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200540
5417. Afterwards press the *SYNCHRONIZE WITH TEMPLATE PARAMETERS* button. You will be moved to the *Parameter Definition* tab. The new parameters will be listed there.
542
543.. figure:: files/vfwdt-template-parameters.png
544 :scale: 70 %
545 :align: center
546
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200547 Figure 16 Summary of parameters specified for DistributeTraffic LCM action.
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200548
549.. 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
550
5518. Finally, go back to the *Reference Data* tab and click *SAVE ALL TO APPC*.
552
553.. note:: Remember to configure DistributeTraffic and DistributeTrafficCheck actions for vPKG VNF type and DistributeTrafficCheck action for vFW-SINK
Gary Wucd47a012018-11-30 07:18:36 -0800554
555Configuration of Ansible Server
556~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
557
558After an instantiation of the vFWDT service the Ansible server must be configured in order to allow it a reconfiguration of vPKG VM.
559
Lukasz Rajewski80726d82019-06-04 13:47:17 +02005601. 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
Gary Wucd47a012018-11-30 07:18:36 -0800561
562::
563
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200564 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/
Gary Wucd47a012018-11-30 07:18:36 -0800565
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200566.. note:: The private key file must be the same like configured at this stage `vFWDT Service Instantiation`_
567
5682. Enter the Rancher server and then enter the APPC Ansible server container
Gary Wucd47a012018-11-30 07:18:36 -0800569
570::
571
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200572 kubectl exec -it -n onap `kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep appc-ansible` -- sh
Gary Wucd47a012018-11-30 07:18:36 -0800573
Lukasz Rajewski80726d82019-06-04 13:47:17 +02005743. Give the private key file a proper access rights
Gary Wucd47a012018-11-30 07:18:36 -0800575
576::
577
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200578 cd /opt/ansible-server/Playbooks/
579 chmod 400 onap.pem
580 chown ansible:ansible onap.pem
Gary Wucd47a012018-11-30 07:18:36 -0800581
Lukasz Rajewski80726d82019-06-04 13:47:17 +02005824. Edit the :file:`/opt/ansible-server/Playbooks/Ansible\ \_\ inventory` file including all the hosts of vFWDT service instance used in this use case.
583 The content of the file is generated by workflow script `Testing Gathered Facts on Workflow Script`_
Gary Wucd47a012018-11-30 07:18:36 -0800584
585::
586
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200587 [vpgn]
588 vofwl01pgn4407 ansible_ssh_host=10.0.210.103 ansible_ssh_user=ubuntu
589 [vfw-sink]
590 vofwl01vfw4407 ansible_ssh_host=10.0.110.1 ansible_ssh_user=ubuntu
591 vofwl02vfw4407 ansible_ssh_host=10.0.110.4 ansible_ssh_user=ubuntu
Gary Wucd47a012018-11-30 07:18:36 -0800592
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200593.. 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
Gary Wucd47a012018-11-30 07:18:36 -0800594
Lukasz Rajewski80726d82019-06-04 13:47:17 +02005955. Configure the default private key file used by Ansible server to access hosts over ssh
Gary Wucd47a012018-11-30 07:18:36 -0800596
597::
598
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200599 vi /etc/ansible/ansible.cfg
Gary Wucd47a012018-11-30 07:18:36 -0800600
601::
602
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200603 [defaults]
604 host_key_checking = False
605 private_key_file = /opt/ansible-server/Playbooks/onap.pem
Gary Wucd47a012018-11-30 07:18:36 -0800606
Gary Wucd47a012018-11-30 07:18:36 -0800607
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200608.. note:: This is the default privaye key file. In the `/opt/ansible-server/Playbooks/Ansible\ \_\ inventory` different key could be configured but APPC in time of execution of playbbok 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
Gary Wucd47a012018-11-30 07:18:36 -0800609
Gary Wucd47a012018-11-30 07:18:36 -0800610
Lukasz Rajewski80726d82019-06-04 13:47:17 +02006116. Test that the Ansible server can access over ssh vFWDT hosts configured in the ansible inventory
Gary Wucd47a012018-11-30 07:18:36 -0800612
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200613::
614
615 ansible –i Ansible_inventory vpgn,vfw-sink –m ping
616
617
6187. Download the distribute traffic playbook into the :file:`/opt/ansible-server/Playbooks` directory
619
620Exit Ansible server pod and enter vFWDT tutorial directory `Preparation of Workflow Script Environment`_ on Rancher server. Afterwards, copy playbooks into Ansible server pod
621
622::
623
624 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/
625 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/
626
6278. After the configuration of Ansible serverthe structure of `/opt/ansible-server/Playbooks` directory should be following
628
629::
630
631 /opt/ansible-server/Playbooks $ ls -R
632 .:
633 Ansible_inventory onap.pem vfw-sink vpgn
634
635 ./vfw-sink:
636 latest
637
638 ./vfw-sink/latest:
639 ansible
640
641 ./vfw-sink/latest/ansible:
642 distributetrafficcheck
643
644 ./vfw-sink/latest/ansible/distributetrafficcheck:
645 site.yml
646
647 ./vpgn:
648 latest
649
650 ./vpgn/latest:
651 ansible
652
653 ./vpgn/latest/ansible:
654 distributetraffic distributetrafficcheck
655
656 ./vpgn/latest/ansible/distributetraffic:
657 site.yml
658
659 ./vpgn/latest/ansible/distributetrafficcheck:
660 site.yml
661
662
663Configuration of APPC DB for Ansible
664~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
665
666For 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.
667
6681. Enter the APPC DB container
669
670::
671
672 kubectl exec -it -n onap `kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep appc-db-0` -- sh
673
6742. Enter the APPC DB CLI (password is *gamma*)
Gary Wucd47a012018-11-30 07:18:36 -0800675
676::
677
678 mysql -u sdnctl -p
679
Lukasz Rajewski80726d82019-06-04 13:47:17 +02006803. Execute the following SQL commands
Gary Wucd47a012018-11-30 07:18:36 -0800681
682::
683
684 MariaDB [(none)]> use sdnctl;
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200685 MariaDB [sdnctl]> UPDATE DEVICE_AUTHENTICATION SET URL = 'http://appc-ansible-server:8000/Dispatch' WHERE ACTION LIKE 'DistributeTraffic%';
686 MariaDB [sdnctl]> UPDATE DEVICE_AUTHENTICATION SET PASSWORD = 'admin' WHERE ACTION LIKE 'DistributeTraffic%';
Gary Wucd47a012018-11-30 07:18:36 -0800687 MariaDB [sdnctl]> select * from DEVICE_AUTHENTICATION;
Gary Wucd47a012018-11-30 07:18:36 -0800688
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200689Result should be simmilar to the following one:
Gary Wucd47a012018-11-30 07:18:36 -0800690
691::
692
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200693 +--------------------------+------------------------------------------------------+----------+------------------------+-----------+----------+-------------+------------------------------------------+
694 | DEVICE_AUTHENTICATION_ID | VNF_TYPE | PROTOCOL | ACTION | USER_NAME | PASSWORD | PORT_NUMBER | URL |
695 +--------------------------+------------------------------------------------------+----------+------------------------+-----------+----------+-------------+------------------------------------------+
696 | 137 | vFWDT 2019-05-20 21:10:/vFWDT_vPKG a646a255-9bee 0 | ANSIBLE | DistributeTraffic | admin | admin | 8000 | http://appc-ansible-server:8000/Dispatch |
697 | 143 | vFWDT 2019-05-20 21:10:/vFWDT_vFWSNK b463aa83-b1fc 0 | ANSIBLE | DistributeTraffic | admin | admin | 8000 | http://appc-ansible-server:8000/Dispatch |
698 | 149 | vFWDT 2019-05-20 21:10:/vFWDT_vFWSNK b463aa83-b1fc 0 | ANSIBLE | DistributeTrafficCheck | admin | admin | 8000 | http://appc-ansible-server:8000/Dispatch |
699 | 152 | vFWDT 2019-05-20 21:10:/vFWDT_vPKG a646a255-9bee 0 | ANSIBLE | DistributeTrafficCheck | admin | admin | 8000 | http://appc-ansible-server:8000/Dispatch |
700 +--------------------------+------------------------------------------------------+----------+------------------------+-----------+----------+-------------+------------------------------------------+
701 4 rows in set (0.00 sec)
Gary Wucd47a012018-11-30 07:18:36 -0800702
Gary Wucd47a012018-11-30 07:18:36 -0800703
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200704Testing Traffic Distribution Workflow
705-------------------------------------
Gary Wucd47a012018-11-30 07:18:36 -0800706
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200707Since all the configuration of components of ONAP is already prepared it is possible to enter second phase of Traffic Distribution Workflow execution -
708the execution of DistributeTraffic and DistributeTrafficCheck LCM actions with configuration resolved before by OptimizationFramework.
Gary Wucd47a012018-11-30 07:18:36 -0800709
Gary Wucd47a012018-11-30 07:18:36 -0800710
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200711Workflow Execution
712~~~~~~~~~~~~~~~~~~
Gary Wucd47a012018-11-30 07:18:36 -0800713
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200714In order to run Traffic Distribution Workflow execute following commands from the vFWDT tutorial directory `Preparation of Workflow Script Environment`_ on Rancher server.
Gary Wucd47a012018-11-30 07:18:36 -0800715
716::
717
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200718 cd workflow
Lukasz Rajewski048e0892019-09-12 09:03:47 +0200719 python3 workflow.py 909d396b-4d99-4c6a-a59b-abe948873303 10.12.5.217 10.12.5.63 True False False True
Gary Wucd47a012018-11-30 07:18:36 -0800720
Gary Wucd47a012018-11-30 07:18:36 -0800721
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200722The order of executed LCM actions is following:
Gary Wucd47a012018-11-30 07:18:36 -0800723
Lukasz Rajewski80726d82019-06-04 13:47:17 +02007241. DistributeTrafficCheck on vPKG VM - ansible playbook checks if traffic destinations specified by OOF is not configued in the vPKG and traffic does not go from vPKG already.
725 If vPKG send alreadyt traffic to destination the playbook will fail and workflow will break.
7262. DistributeTraffic on vPKG VM - ansible playbook reconfigures vPKG in order to send traffic to destination specified before by OOF. When everything is fine at this stage
727 change of the traffic should be observed on following dashboards (please turn on automatic reload of graphs)
728
729 ::
730
731 http://<vSINK-1-IP>:667/
732 http://<vSINK-2-IP>:667/
733
7343. 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
7354. 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
736
737
738Workflow Results
739~~~~~~~~~~~~~~~~
740
741Expected result of workflow execution, when everythin is fine, is following:
Gary Wucd47a012018-11-30 07:18:36 -0800742
743::
744
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200745 Distribute Traffic Workflow Execution:
746 APPC REQ 0 - DistributeTrafficCheck
747 Request Accepted. Receiving result status...
748 Checking LCM DistributeTrafficCheck Status
749 IN_PROGRESS
750 IN_PROGRESS
751 IN_PROGRESS
752 IN_PROGRESS
753 SUCCESSFUL
754 APPC REQ 1 - DistributeTraffic
755 Request Accepted. Receiving result status...
756 Checking LCM DistributeTraffic Status
757 IN_PROGRESS
758 IN_PROGRESS
759 IN_PROGRESS
760 IN_PROGRESS
761 IN_PROGRESS
762 IN_PROGRESS
763 IN_PROGRESS
764 IN_PROGRESS
765 IN_PROGRESS
766 IN_PROGRESS
767 IN_PROGRESS
768 IN_PROGRESS
769 IN_PROGRESS
770 IN_PROGRESS
771 IN_PROGRESS
772 IN_PROGRESS
773 IN_PROGRESS
774 IN_PROGRESS
775 IN_PROGRESS
776 SUCCESSFUL
777 APPC REQ 2 - DistributeTrafficCheck
778 Request Accepted. Receiving result status...
779 Checking LCM DistributeTrafficCheck Status
780 IN_PROGRESS
781 IN_PROGRESS
782 IN_PROGRESS
783 IN_PROGRESS
784 IN_PROGRESS
785 IN_PROGRESS
786 IN_PROGRESS
787 IN_PROGRESS
788 IN_PROGRESS
789 SUCCESSFUL
790 APPC REQ 3 - DistributeTrafficCheck
791 Request Accepted. Receiving result status...
792 Checking LCM DistributeTrafficCheck Status
793 IN_PROGRESS
794 IN_PROGRESS
795 IN_PROGRESS
796 IN_PROGRESS
797 IN_PROGRESS
798 IN_PROGRESS
799 IN_PROGRESS
800 SUCCESSFUL
Gary Wucd47a012018-11-30 07:18:36 -0800801
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200802In case of failure the result can be following:
Gary Wucd47a012018-11-30 07:18:36 -0800803
804::
805
Lukasz Rajewski80726d82019-06-04 13:47:17 +0200806 Distribute Traffic Workflow Execution:
807 APPC REQ 0 - DistributeTrafficCheck
808 Request Accepted. Receiving result status...
809 Checking LCM DistributeTrafficCheck Status
810 IN_PROGRESS
811 IN_PROGRESS
812 IN_PROGRESS
813 IN_PROGRESS
814 IN_PROGRESS
815 IN_PROGRESS
816 IN_PROGRESS
817 IN_PROGRESS
818 IN_PROGRESS
819 IN_PROGRESS
820 IN_PROGRESS
821 IN_PROGRESS
822 IN_PROGRESS
823 IN_PROGRESS
824 IN_PROGRESS
825 FAILED
826 Traceback (most recent call last):
827 File "workflow.py", line 563, in <module>
828 sys.argv[5].lower() == 'true', sys.argv[6].lower() == 'true')
829 File "workflow.py", line 557, in execute_workflow
830 confirm_appc_lcm_action(onap_ip, req, check_result)
831 File "workflow.py", line 529, in confirm_appc_lcm_action
832 raise Exception("LCM {} {} - {}".format(req['input']['action'], status['status'], status['status-reason']))
833 Exception: LCM DistributeTrafficCheck FAILED - FAILED
834
835.. 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 succedds.