summaryrefslogtreecommitdiffstats
path: root/docs/guides/onap-user/vfwcl-deployment-tutorial/index.rst
blob: f10a13a88c3d31b182cfcdb4ef7cae66e8f934da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
.. This work is licensed under a Creative Commons Attribution 4.0
.. International License. http://creativecommons.org/licenses/by/4.0
.. Copyright © 2017-2021 Aarna Networks, Inc.

vFWCL deployment Tutorial
#########################

Introduction
============

This tutorial describes the step by step instructions on how to achieve the control loop for vFW use case. Instructions in this tutorial will enable you to deploy the vfw control loop specific usecase.

vFW service components
~~~~~~~~~~~~~~~~~~~~~~

The vFW service is composed of the following components

vPKG VNF

- It is a packet generator which sends periodically different volumes of traffic to the sink through the firewall (vFw)

vFWSNK VNF

- Firewall: Reports the volume of traffic passing through to the DCAE collector (VES collector). The vFW has no real firewalling functionality.
- Traffic sink: Provides a graphical representation (bar charts) showing the volume of incoming traffic.

The below block diagram shows about the components part of vFW usecase

|image25|

vFWCL service overview
~~~~~~~~~~~~~~~~~~~~~~

The vFW contol loop use case consists in applying policy rules that aim to re-adjust the traffic volume
when high threshold (700 packets/10s) or low threshold (300 packets/10s) are crossed. In fact, the DCAE collects
events from the vFW, applies analytics (Threshold Crossing Analytics: TCA microservice) and publishes events to DMaap.
When detecting the triggering event, the policy engine executes the operational policy via the APP-C that modifies
vPKG application configurations in order to adjust the traffic volume to 500 packet per 10 seconds.

The vFW control loop is based on VES (VNF Event Stream) reported measurements that TCA analyses and publishes
related alams to DMaap. The policy has the responsibility for triggering ModifyConfig action that APPC executes
on the target vnf (vPKG). All closed loop interactions are relying on the Message router (DMaap) by publishing
topics and subscribing to them.

The ladder diagram below describes the components and their interactions that take place while running the vFWCL

|image53|

Prerequisite:
vFW service design and deployment should be completed before following the steps of this tutorial

Refer the below tutorials for doing vFW service design and deployment

.. toctree::
   :maxdepth: 1

   vFW Design Tutorial <../vfw-design-tutorial/index.rst>
   vFW Deployment Tutorial <../vfw-deployment-tutorial/index.rst>

Adding DCAE artifacts and policies
==================================

Follow the below steps to upload the blueprint for the TCA (Threshold Checking Application) DCAE microservice
and Distribute the service to the CLAMP

1. Login as DESIGNER (cs0008) and create the service, checkin and certify

|image16|

2. Add any VNF (ex: vfw_pg) that was already created during the SDC design phase

In the composition canvas drag and drop a resource of type VF from the abstract section in the Elements section (left hand side panel)

|image15|

3. Download the required DCAE MS blueprint to be attached to the service

Use the sample TCA blueprint located here:
https://git.onap.org/dcaegen2/platform/blueprints/tree/blueprints/k8s-tcagen2-clampnode.yaml

.. note::
  * Check if the version of the plugin used in the blueprint is different from existing, then update the blueprint import to match
  * To check the version run this: `cfy plugins list | grep k8splugin`

4. Now upload the Control Loop Artifact. The procedure to upload the artifact is

 * Click on the VF, as in the picture above the ‘vsp_pg 0’ is selected
 * Click on ‘DEPLOYMENT ARTIFACTS’  and then click on “Add Artifact”

 |image5|

 * Fill the details and in the type select DCAE_INVENTORY_BLUEPRINT, then click on Done as in the picture shown below

 |image13|

5. After uploading the DCAE artifact to the SDC Service, attach the policy model to the Service. From the left drop down,
select TCA policy under Policies, and click on the Add policy

|image1|

6. Click on Checkin on top right corner then click OK

|image12|

7. Search and select the same service from CATALOG and click on Certify on top right corner

|image14|

8. Click Distribute to distribute the service, then click on Distribution in the left hand side panel and monitor until
the distribution is complete. We should see artifacts deployed in CLAMP and Policy engine, as can be seen in the picture below

|image19|

At this point we can open the CLAMP GUI and verify that the DCAE microservice design template is in place

Deploy DCAE and Policy through CLAMP
====================================

CLAMP is a GUI tool which enables the users to design the policies, distribute them to the DROOLS engine and eventually deploy
the DCAE microservices.

1. Add the necessary certificates in the browser to login to the CLAMP GUI

The default certificate can be found here: https://gerrit.onap.org/r/gitweb?p=clamp.git;a=blob;f=src/main/resources/clds/aaf/org.onap.clamp.p12;h=268aa1a3ce56e01448f8043cc0b05b5fceb5a47d;hb=HEAD

The password is:  "China in the Spring"
The certificate must be loaded into your favorite browser before trying to load the CLAMP UI.

2. After the certificate is added, the CLAMP GUI can be accessed at:
`https://<host_IP>:30258` (host_IP is the node IP where CLAMP is running)

3. Before designing the policy we need to undeploy the default tca policy.
To undeploy default policy execute the below commands on control node

.. code-block::

  > kubectl get deployments -n onap | grep "dep-dcae-tca-analytics\|dcaegen2-analytics-tca" | awk '{print $1}' |
    xargs kubectl delete deployments -n onap
  > kubectl get svc -n onap | grep "dcae-tca-analytics\|dcaegen2-analytics-tca" | awk '{print $1}' |
    xargs kubectl delete svc -n onap
    To Verify there are no dcae-analytics POD, run the below command
  > kubectl get pods -n onap | grep 'analytics'

4. If the service has been distributed correctly, following is how the service design templates
listed in the Loop Templates as below

|image7|

Available Policy Models

|image10|

5. Create the loop from the templates distributed by SDC

|image4|

|image20|

6. Add the Operational Policy
Click on Loop Instance drop down and select Modify then click, select the policy model type then click Add

|image9|

|image3|

7. Click on the MS application box and configure
Fill the details in the pop up window and click on the save changes button.

 A. Click on app and Edit the Policy details, fill the below details

  * eventName: vFirewallBroadcastPackets
  * policyScope: DCAE
  * policyVersion: v0.0.1
  * Select controlLoopSchemaType as VM
  * policyName: DCAE.Config_tca-hi-lo
  * Select Pdp Group Info from the drop down as defaultGroup & xacm

 |image17|

 B. Click on the Add monitoring threshold1 button and fill the below details

  * version : 1.0.2
  * closedLoopControlName : name of the CL (ex: LOOP_TEMPLATE_mytest_srv_v1_0_vsp_pg0_k8s-tca)
  * select the direction from dropdown (ex: LESS)

 |image11|

 C. Click on the Add monitoring threshold2 button and fill the details same as above then click on Save Changes button

 |image24|

8. Click on the Operational policy box and configure
Fill the details in the pop window then click on save changes

|image22|

|image18|

9. Submit the control loop to the policy
From Loop Operations drop down select SUBMIT and click

|image23|

10. Deploy the control loop to DCAE
From Loop Operations drop down select DEPLOY and click, verify the details and click Deploy

|image2|

|image8|

Status Logs

|image21|

A successful deployment will make the service as DEPLOYED

11. You can login into the control node and verify whether your new analytics application got deployed using below command

.. code-block::

  > kubectl get pods -n onap | grep analytics
  Sample output
  dep-dcae-tca-analytics-7fccbf459-xkxlq             2/2     Running      0          6m15s

  > cfy deployment  list | grep CLAMP
  Sample output
  | CLAMP_615bb47a-ea3e-4a02-8928-0564df900826 | CLAMP_615bb47a-ea3e-4a02-8928-0564df900826 | 2020-11-10 19:23:22.286  |
  2020-11-10 19:23:22.286  |   tenant   |   default_tenant |   admin    |

Robot heatbridge
================

Run the Robot heatbridge script to populate the vserver (OAM IP, VM flavor name, ID etc.) related information in AAI.
This is required by APPC/SDNC for performing LCM operations.

Following is the command usage along with the example

./demo-k8s.sh <namespace> heatbridge <stack_name> <service_instance_id> <service> <oam-ip-address>

.. note::
  The stack_name & oam-ip-address of the VNF VM can be obtained from OpenStack Horizon and service_instance_id from the VID screen

.. code-block::

  ./demo-k8s.sh onap heatbridge vfw_sinc_vf e039b3d4-7ee5-4ad2-8108-ae31086ac7c0 vFW 172.29.249.157
  Number of parameters:
  6
  KEY:
  heatbridge
  ++ kubectl --namespace onap get pods
  ++ sed 's/ .*//'
  ++ grep robot
  + POD=dev-robot-58f85bb64d-zz5bh
  ++ dirname ./demo-k8s.sh
  + DIR=.
  + SCRIPTDIR=scripts/demoscript
  + ETEHOME=/var/opt/ONAP
  + '[' ']'
  ++ kubectl --namespace onap exec dev-robot-58f85bb64d-zz5bh -- bash -c 'ls -1q /share/logs/ | wc -l'
  + export GLOBAL_BUILD_NUMBER=13
  + GLOBAL_BUILD_NUMBER=13
  ++ printf %04d 13
  + OUTPUT_FOLDER=0013_demo_heatbridge
  + DISPLAY_NUM=103
  + VARIABLEFILES='-V /share/config/robot_properties.py'
  + kubectl --namespace onap exec dev-robot-58f85bb64d-zz5bh -- /var/opt/ONAP/runTags.sh -V /share/config/robot_properties.py -v HB_STACK:vfw_sinc_vf
  -v HB_VNF:e039b3d4-7ee5-4ad2-8108-ae31086ac7c0 -v HB_VNF:vFW -v HB_SERVICE:vFW -v HB_IPV4_OAM_ADDRESS:172.29.249.157 -d /share/logs/0013_demo_heatbridge
  -i heatbridge --display 103
  Starting Xvfb on display :103 with res 1280x1024x24
  Executing robot tests at log level TRACE
  ==============================================================================
  Testsuites
  ==============================================================================
  Testsuites.Demo :: Executes the VNF Orchestration Test cases including setu...
  ==============================================================================
  Run Heatbridge :: Try to run heatbridge                               | PASS |
  ------------------------------------------------------------------------------
  Testsuites.Demo :: Executes the VNF Orchestration Test cases inclu... | PASS |
  1 critical test, 1 passed, 0 failed
  1 test total, 1 passed, 0 failed
  ==============================================================================
  Testsuites                                                            | PASS |
  1 critical test, 1 passed, 0 failed
  1 test total, 1 passed, 0 failed
  ==============================================================================
  Output:  /share/logs/0013_demo_heatbridge/output.xml
  Log:     /share/logs/0013_demo_heatbridge/log.html
  Report:  /share/logs/0013_demo_heatbridge/report.html

Update the operational policy
=============================

1. GET the modelInvariantID of vPG

Following is the command usage along with the sample output

.. code-block::

  curl -k -X GET https://<kubernetes-host>:30233/aai/v11/network/generic-vnfs/ -H 'Accept: application/json' -H 'Authorization: Basic QUFJOkFBSQ==' -H ' Content-Type: application/json' -H 'X-FromAppId: Postman' -H 'X-TransactionId: get_generic_vnf' | jq

  {
  "generic-vnf": [
    {
      "vnf-id": "edc085e8-5088-4b73-bcdc-b8b0bf5e528b",
      "vnf-name": "vfw_vpg_vnf",
      "vnf-type": "vFWCL_service/vsp_vpg 0",
      "service-id": "929190d1-fed1-4dff-883f-f0ede779065e",
      "prov-status": "PREPROV",
      "orchestration-status": "Created",
      "in-maint": false,
      "is-closed-loop-disabled": false,
      "resource-version": "1609783281808",
      "model-invariant-id": "7d4fef5e-f9b0-4e03-a653-712d6630f389",
      "model-version-id": "a248f68e-c1f2-4b25-8120-c4f7310b0d1e",
      "model-customization-id": "cf0019db-f51f-472a-996d-9da19d41f7b4",
      "relationship-list": {
        "relationship": [
          {
            "related-to": "service-instance",
            "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-  instance/e039b3d4-7ee5-4ad2-8108-ae31086ac7c0",
            "relationship-data": [
              {
                "relationship-key": "customer.global-customer-id",
                "relationship-value": "Demonstration"
              },
              {
                "relationship-key": "service-subscription.service-type",
                "relationship-value": "vFWCL"
              },
              {
                "relationship-key": "service-instance.service-instance-id",
                "relationship-value": "e039b3d4-7ee5-4ad2-8108-ae31086ac7c0"
              }
            ],
            "related-to-property": [
              {
                "property-key": "service-instance.service-instance-name",
                "property-value": "vFWCL_srv_00"
              }
            ]
          },
          {
            "related-to": "platform",
            "related-link": "/aai/v11/business/platforms/platform/Platform-Demonstration",
            "relationship-data": [
              {
                "relationship-key": "platform.platform-name",
                "relationship-value": "Platform-Demonstration"
              }
            ]
          },
          {
            "related-to": "line-of-business",
            "related-link": "/aai/v11/business/lines-of-business/line-of-business/LOB-Demonstration",
            "relationship-data": [
              {
                "relationship-key": "line-of-business.line-of-business-name",
                "relationship-value": "LOB-Demonstration"
              }
            ]
          }
        ]
      }
    },
    {
      "vnf-id": "816040b6-d9bf-43ba-b852-e31e21a0a5f4",
      "vnf-name": "vfw_sinc_vnf",
      "vnf-type": "vFWCL_service/vsp_sinc 0",
      "service-id": "929190d1-fed1-4dff-883f-f0ede779065e",
      "prov-status": "ACTIVE",
      "orchestration-status": "Active",
      "in-maint": false,
      "is-closed-loop-disabled": false,
      "resource-version": "1609788164862",
      "model-invariant-id": "4d432903-4338-48ae-a105-47c0c8d19193",
      "model-version-id": "86b98636-150b-4f1c-a768-61e6c43a3199",
      "model-customization-id": "d3671119-5b65-40ed-abea-d1fe0d09c3ba",
      "relationship-list": {
        "relationship": [
          {
            "related-to": "vserver",
            "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-  region/CloudOwner/RegionOne/tenants/tenant/747a01548b494670892413c496c1c250/vservers/vserver/3353a853-87cc-47cc-9e6a-4f45b6dc580f",
            "relationship-data": [
              {
                "relationship-key": "cloud-region.cloud-owner",
                "relationship-value": "CloudOwner"
              },
              {
                "relationship-key": "cloud-region.cloud-region-id",
                "relationship-value": "RegionOne"
              },
              {
                "relationship-key": "tenant.tenant-id",
                "relationship-value": "747a01548b494670892413c496c1c250"
              },
              {
                "relationship-key": "vserver.vserver-id",
                "relationship-value": "3353a853-87cc-47cc-9e6a-4f45b6dc580f"
              }
            ],
            "related-to-property": [
              {
                "property-key": "vserver.vserver-name",
                "property-value": "zdfw1fwl01snk01"
              }
            ]
          },
          {
            "related-to": "vserver",
            "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-  region/CloudOwner/RegionOne/tenants/tenant/747a01548b494670892413c496c1c250/vservers/vserver/642b5709-4f3d-405b-bcb2-dc82884cb8de",
            "relationship-data": [
              {
                "relationship-key": "cloud-region.cloud-owner",
                "relationship-value": "CloudOwner"
              },
              {
                "relationship-key": "cloud-region.cloud-region-id",
                "relationship-value": "RegionOne"
              },
              {
                "relationship-key": "tenant.tenant-id",
                "relationship-value": "747a01548b494670892413c496c1c250"
              },
              {
                "relationship-key": "vserver.vserver-id",
                "relationship-value": "642b5709-4f3d-405b-bcb2-dc82884cb8de"
              }
            ],
            "related-to-property": [
              {
                "property-key": "vserver.vserver-name",
                "property-value": "zdfw1fwl01fwl01"
              }
            ]
          },
          {
            "related-to": "service-instance",
            "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-  instance/e039b3d4-7ee5-4ad2-8108-ae31086ac7c0",
            "relationship-data": [
              {
                "relationship-key": "customer.global-customer-id",
                "relationship-value": "Demonstration"
              },
              {
                "relationship-key": "service-subscription.service-type",
                "relationship-value": "vFWCL"
              },
              {
                "relationship-key": "service-instance.service-instance-id",
                "relationship-value": "e039b3d4-7ee5-4ad2-8108-ae31086ac7c0"
              }
            ],
            "related-to-property": [
              {
                "property-key": "service-instance.service-instance-name",
                "property-value": "vFWCL_srv_00"
              }
            ]
          },
          {
            "related-to": "platform",
            "related-link": "/aai/v11/business/platforms/platform/Platform-Demonstration",
            "relationship-data": [
              {
                "relationship-key": "platform.platform-name",
                "relationship-value": "Platform-Demonstration"
              }
            ]
          },
          {
            "related-to": "line-of-business",
            "related-link": "/aai/v11/business/lines-of-business/line-of-business/LOB-Demonstration",
            "relationship-data": [
              {
                "relationship-key": "line-of-business.line-of-business-name",
                "relationship-value": "LOB-Demonstration"
              }
            ]
          }
        ]
      }
    }
  ]
  }

2. Get the Operational policy name and version

Following is the command usage and the sample output

.. code-block::

  curl -k -u 'healthcheck:zb!XztG34' -X GET -H 'Accept:application/json' https://<kubernetes-host>:6969/policy/pap/v1/pdps

  #sample command and output
  curl  -k -u 'healthcheck:zb!XztG34' -X GET -H 'Accept:application/json' https://10.43.244.213:6969/policy/pap/v1/pdps | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  100  2678  100  2678    0     0   7695      0 --:--:-- --:--:-- --:--:--  7695
  {
  "groups": [
    {
      "name": "defaultGroup",
      "description": "The default group that registers all supported policy types and pdps.",
      "pdpGroupState": "ACTIVE",
      "properties": {},
      "pdpSubgroups": [
        {
          "pdpType": "apex",
          "supportedPolicyTypes": [
            {
              "name": "onap.policies.controlloop.operational.Apex",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.controlloop.operational.common.Apex",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.native.Apex",
              "version": "1.0.0"
            }
          ],
          "policies": [],
          "currentInstanceCount": 1,
          "desiredInstanceCount": 1,
          "properties": {},
          "pdpInstances": [
            {
              "instanceId": "dev-policy-apex-pdp-0",
              "pdpState": "ACTIVE",
              "healthy": "HEALTHY",
              "message": "Pdp Heartbeat"
            }
          ]
        },
        {
          "pdpType": "drools",
          "supportedPolicyTypes": [
            {
              "name": "onap.policies.controlloop.Operational",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.controlloop.operational.common.Drools",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.native.drools.Controller",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.native.drools.Artifact",
              "version": "1.0.0"
            }
          ],
          "policies": [],
          "currentInstanceCount": 1,
          "desiredInstanceCount": 1,
          "properties": {},
          "pdpInstances": [
            {
              "instanceId": "dev-drools-0",
              "pdpState": "ACTIVE",
              "healthy": "HEALTHY"
            }
          ]
        },
        {
          "pdpType": "xacml",
          "supportedPolicyTypes": [
            {
              "name": "onap.policies.controlloop.guard.common.FrequencyLimiter",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.controlloop.guard.common.MinMax",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.controlloop.guard.common.Blacklist",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.controlloop.guard.coordination.FirstBlocksSecond",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.monitoring.*",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.*",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.resource.AffinityPolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.resource.DistancePolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.resource.HpaPolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.resource.OptimizationPolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.resource.PciPolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.service.QueryPolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.service.SubscriberPolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.resource.Vim_fit",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.optimization.resource.VnfPolicy",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.native.Xacml",
              "version": "1.0.0"
            },
            {
              "name": "onap.policies.Naming",
              "version": "1.0.0"
            }
          ],
          "policies": [
            {
              "name": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP",
              "version": "1.0.0"
            }
          ],
          "currentInstanceCount": 1,
          "desiredInstanceCount": 1,
          "properties": {},
          "pdpInstances": [
            {
              "instanceId": "dev-policy-xacml-pdp-6c5f6db887-zkh6h",
              "pdpState": "ACTIVE",
              "healthy": "HEALTHY"
            }
          ]
        }
      ]
    }
  ]
  }

3. Remove the vFW Policy from PDP

Following is the command usage

.. code-block::

  POLICY_ID = "OPERATIONAL_dcae_service_v1_0_Drools_1_0_0_of6"
  POLICY_VERSION = "1.0.0"

  curl -k -u 'healthcheck:zb!XztG34' -X DELETE -H 'Content-Type:application/json' https://<kubernetes-host>:6969/policy/pap/v1/pdps/policies/$POLICY_ID/versions/$POLICY_VERSION

4. Get latest policy

Following is the command usage and sample output

.. code-block::

  POLICY_TYPEID="onap.policies.controlloop.operational.common.Drools"
  VERSIONID='1.0.0'
  POLICY_ID="OPERATIONAL_dcae_service_v1_0_Drools_1_0_0_of6"

  curl -k -u 'healthcheck:zb!XztG34' -X GET -H 'Accept:application/json' https://<kubernetes-host>:6969/policy/api/v1/policytypes/$POLICY_TYPEID/versions/$VERSIONID/policies/$POLICY_ID/versions/latest > operational_policy_template.json

5. Update this policy in the policy DB

Following is the command usage and sample output

.. code-block::

  POLICY_TYPEID="onap.policies.controlloop.operational.common.Drools"
  VERSIONID='1.0.0'

  curl -k -u 'healthcheck:zb!XztG34' -X POST -H 'Content-Type:application/json' --data @./operational_policy_template.json https://<kubernetes-host>:6969/policy/api/v1/policytypes/$POLICY_TYPEID/versions/$VERSIONID/policies

  {
	"tosca_definitions_version": "tosca_simple_yaml_1_1_0",
	"topology_template": {
		"policies": [{
			"OPERATIONAL_dcae_service_v1_0_Drools_1_0_0_of6": {
				"type": "onap.policies.controlloop.operational.common.Drools",
				"type_version": "1.0.0",
				"properties": {
					"abatement": true,
					"operations": [{
						"failure_retries": "final_failure_retries",
						"id": "ModifyConfig",
						"failure_timeout": "final_failure_timeout",
						"failure": "final_failure",
						"operation": {
							"payload": {
								"active-streams": 5
							},
							"target": {
								"entityIds": {
									"resourceID": "7d4fef5e-f9b0-4e03-a653-712d6630f389"
								},
								"targetType": "VNF"
							},
							"actor": "APPC",
							"operation": "ModifyConfig"
						},
						"failure_guard": "final_failure_guard",
						"retries": 3,
						"timeout": 3600,
						"failure_exception": "final_failure_exception",
						"description": "ModifyConfig",
						"success": "final_success"
					}],
					"trigger": "ModifyConfig",
					"timeout": 3600,
					"id": "LOOP_tca"
				},
				"name": "OPERATIONAL_dcae_service_v1_0_Drools_1_0_0_of6",
				"version": "1.0.0",
				"metadata": {
					"policy-id": "OPERATIONAL_dcae_service_v1_0_Drools_1_0_0_of6",
					"policy-version": "1.0.0"
				}
			}
		}]
	},
	"name": "ToscaServiceTemplateSimple",
	"version": "1.0.0",
	"metadata": {}
  }

6. Deploy this version of the policy using PAP API

Prepare the payload for the deployment API by naming the file as pap_template.json. The contents are policy name, version and command usage as below

.. code-block::

  cat pap_template.json
  {
    "policies" : [
     {
       "policy-id": "OPERATIONAL_dcae_service_v1_0_Drools_1_0_0_of6",
       "policy-version": "3"
     }
     ]
  }

  curl -k -u 'healthcheck:zb!XztG34' -X POST --data @./pap_template.json -H 'Content-Type:application/json' https://<kubernetes-host>:6969/policy/pap/v1/pdps/policies

Set network topology for vPG in APPC
====================================

1. Enable direct access to vFW PG VNF instance from control node

.. note::
   These steps are applicable only when your openstack instance is running on the GCP

   You can refer to `Google Cloud Docs <https://cloud.google.com/vpc/docs/configure-alias-ip-ranges>`_ to find
   more details about how to add IP alias to a running GCP instance

Execute the below commands from your laptop using gcloud CLI

a. Find the Default interface name and primary internal IP for the GCP instance

.. code-block::

  gcloud compute instances describe openstack-01 | grep 'nic\|networkIP'

  #sample command output
  name: nic0
  networkIP: 10.128.0.43

b. For the Default interface nic0 add an IP alias from the default subnet

.. code-block::

  gcloud compute instances network-interfaces update openstack-01 \
    --zone us-central1-f \
    --network-interface nic0 \
    --aliases "/30"

  # sample output
  Updating network interface [nic0] of instance [openstack-01]...done

c. Verify if the instance has got a new IP alias

.. code-block::

  gcloud compute instances describe openstack-01 | grep 'nic\|networkIP\|aliasIpRanges\|ipCidrRange'

  # from the output note down the IP alias ipCidrRange attribute that you will need it inplace
  aliasIpRanges:
  ipCidrRange: 10.128.0.124/30
  name: nic0
  networkIP: 10.128.0.22

2. Map openstack-01 GCP IP alias to vFW PG VNF openstack instance public IP

a. SSH into GCP openstack-01  VM instance and verify if you can see the new IP alias in the routing table

.. code-block::

  ip route show table local | grep '/30'

  # sample output
  local 10.128.0.112/30 dev eth0 proto 66 scope host

b. Find the vFW packet generator public / external network IP address

Run the below command on the openstack instance

.. code-block::

  openstack server list
  # sample output
  | ID | Name | Status | Networks | Image  | Flavor  |
  | 1faa6593-7e9e-452d-a5dc-1536e18e4b94 | zdfw1fwl01pgn01 | ACTIVE | OAM_NETWORK=10.10.10.12; public=172.29.249.200;
  zdfw1fwl01_unprotected=192.168.10.200| trusty | m1.medium |

c. Now update openstack-01 GCP instance iptables to forward the traffic to vFW PG VNF VM

Below are the commands to forward all traffic reaching to IP alias (ex: 10.128.0.112/30)
to vFW PG VNF VM (ex:zdfw1fwl01pgn01) instance public IP (ex:172.29.249.200)

.. code-block::

  # DNAT rule update
  sudo iptables -t nat -I PREROUTING -d 10.128.0.112 -j DNAT --to-destination 172.29.249.200
  sudo iptables -t nat -I POSTROUTING -s 172.29.249.200 -j MASQUERADE

  # Update INPUT, FORWARD AND OUTPUT chain to allow traffic for all ports
  sudo iptables -I INPUT 1 -p udp -j ACCEPT
  sudo iptables -I FORWARD 1 -p tcp -j ACCEPT
  sudo iptables -I OUTPUT 1 -p tcp -j ACCEPT
  sudo iptables -I OUTPUT 1 -p udp -j ACCEPT

d. Verify if you can access vFW PG instance from the control node

SSH into vFW PG VNF instance using the openstack-01 GCP IP alias, it should connect to the vFW PG VNF instance

3. Mount APPC

a. Get the VNF instance ID, either through VID or through AAI. Below the AAI request

Search for the vnf-name as vfw_pg_vsp_002-1 from the output of the below command and find the corresponding vnf-id,
the value is: a1ca05b4-3231-4e4a-a09c-74f2292fe577

.. code-block::

  curl -X GET   https://<kubernetes-host>:30233/aai/v8/network/generic-vnfs/   -H 'Accept: application/json'   -H 'Authorization: Basic QUFJOkFBSQ=='   -H 'Content-Type:application/json' -H 'X-FromAppId: Postman' -H 'X-TransactionId: get_generic_vnf' -k

  {
	"generic-vnf": [{
		"vnf-id": "a1ca05b4-3231-4e4a-a09c-74f2292fe577",
		"vnf-name": "vfw_pg_vsp_002-1",
		"vnf-type": "vfw-service-002/vfw_pg_vsp_002 0",
		"service-id": "f18af052-6dfb-40e8-ad25-f060eb898f53",
		"prov-status": "ACTIVE",
		"orchestration-status": "Active",
		"in-maint": false,
		"is-closed-loop-disabled": false,
		"resource-version": "1617776160138",
		"model-invariant-id": "7a347a5a-8f3f-416c-81f3-13b30631c1e6",
		"model-version-id": "f988048a-b4f4-4f5e-aa7c-fdaa0d7ea017",
		"model-customization-id": "601d5d68-fbbe-4c1f-a624-08a3445ae8fe",
		"relationship-list": {
			"relationship": [{
				"related-to": "service-instance",
				"relationship-label": "org.onap.relationships.inventory.ComposedOf",
				"related-link": "/aai/v16/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/6f294c8f-ac67-4b33-9e56-014fb63791a5",
				"relationship-data": [{
					"relationship-key": "customer.global-customer-id",
					"relationship-value": "Demonstration"
				}, {
					"relationship-key": "service-subscription.service-type",
					"relationship-value": "vFW"
				}, {
					"relationship-key": "service-instance.service-instance-id",
					"relationship-value": "6f294c8f-ac67-4b33-9e56-014fb63791a5"
				}],
				"related-to-property": [{
					"property-key": "service-instance.service-instance-name",
					"property-value": "vfw-service-002-1"
				}]
			}, {
				"related-to": "platform",
				"relationship-label": "org.onap.relationships.inventory.Uses",
				"related-link": "/aai/v16/business/platforms/platform/Platform-Demonstration",
				"relationship-data": [{
					"relationship-key": "platform.platform-name",
					"relationship-value": "Platform-Demonstration"
				}]
			}, {
				"related-to": "line-of-business",
				"relationship-label": "org.onap.relationships.inventory.Uses",
				"related-link": "/aai/v16/business/lines-of-business/line-of-business/LOB-Demonstration",
				"relationship-data": [{
					"relationship-key": "line-of-business.line-of-business-name",
					"relationship-value": "LOB-Demonstration"
				}]
			}, {
				"related-to": "vserver",
				"relationship-label": "tosca.relationships.HostedOn",
				"related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/759425709b7a4b3ca257d3f93ef4e91e/vservers/vserver/856aed6e-cc25-4819-a03d-5549f5fe8662",
				"relationship-data": [{
					"relationship-key": "cloud-region.cloud-owner",
					"relationship-value": "CloudOwner"
				}, {
					"relationship-key": "cloud-region.cloud-region-id",
					"relationship-value": "RegionOne"
				}, {
					"relationship-key": "tenant.tenant-id",
					"relationship-value": "759425709b7a4b3ca257d3f93ef4e91e"
				}, {
					"relationship-key": "vserver.vserver-id",
					"relationship-value": "856aed6e-cc25-4819-a03d-5549f5fe8662"
				}],
				"related-to-property": [{
					"property-key": "vserver.vserver-name",
					"property-value": "zdfw1fwl01pgn01"
				}]
			}]
		}
	}, {
		"vnf-id": "be9e190e-a20c-4900-8074-cffec77131f1",
		"vnf-name": "vfw_sinc_vsp_002-1",
		"vnf-type": "vfw-service-002/vfw_sinc_vsp_002 0",
		"service-id": "f18af052-6dfb-40e8-ad25-f060eb898f53",
		"prov-status": "ACTIVE",
		"orchestration-status": "Active",
		"in-maint": false,
		"is-closed-loop-disabled": false,
		"resource-version": "1617776104234",
		"model-invariant-id": "9b25321d-9260-4739-97f8-7c85fba4e755",
		"model-version-id": "c785c203-9c39-4b6a-9c2e-f24bb8d4d92d",
		"model-customization-id": "a1e0ddf7-5d50-43a4-a6f1-0bfde3c1de78",
		"relationship-list": {
			"relationship": [{
				"related-to": "service-instance",
				"relationship-label": "org.onap.relationships.inventory.ComposedOf",
				"related-link": "/aai/v16/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/6f294c8f-ac67-4b33-9e56-014fb63791a5",
				"relationship-data": [{
					"relationship-key": "customer.global-customer-id",
					"relationship-value": "Demonstration"
				}, {
					"relationship-key": "service-subscription.service-type",
					"relationship-value": "vFW"
				}, {
					"relationship-key": "service-instance.service-instance-id",
					"relationship-value": "6f294c8f-ac67-4b33-9e56-014fb63791a5"
				}],
				"related-to-property": [{
					"property-key": "service-instance.service-instance-name",
					"property-value": "vfw-service-002-1"
				}]
			}, {
				"related-to": "platform",
				"relationship-label": "org.onap.relationships.inventory.Uses",
				"related-link": "/aai/v16/business/platforms/platform/Platform-Demonstration",
				"relationship-data": [{
					"relationship-key": "platform.platform-name",
					"relationship-value": "Platform-Demonstration"
				}]
			}, {
				"related-to": "line-of-business",
				"relationship-label": "org.onap.relationships.inventory.Uses",
				"related-link": "/aai/v16/business/lines-of-business/line-of-business/LOB-Demonstration",
				"relationship-data": [{
					"relationship-key": "line-of-business.line-of-business-name",
					"relationship-value": "LOB-Demonstration"
				}]
			}, {
				"related-to": "vserver",
				"relationship-label": "tosca.relationships.HostedOn",
				"related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/759425709b7a4b3ca257d3f93ef4e91e/vservers/vserver/30dd6250-8a74-4ed7-9729-6ce7190c6661",
				"relationship-data": [{
					"relationship-key": "cloud-region.cloud-owner",
					"relationship-value": "CloudOwner"
				}, {
					"relationship-key": "cloud-region.cloud-region-id",
					"relationship-value": "RegionOne"
				}, {
					"relationship-key": "tenant.tenant-id",
					"relationship-value": "759425709b7a4b3ca257d3f93ef4e91e"
				}, {
					"relationship-key": "vserver.vserver-id",
					"relationship-value": "30dd6250-8a74-4ed7-9729-6ce7190c6661"
				}],
				"related-to-property": [{
					"property-key": "vserver.vserver-name",
					"property-value": "vfw_sinc_vsp_002-1"
				}]
			}, {
				"related-to": "vserver",
				"relationship-label": "tosca.relationships.HostedOn",
				"related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/759425709b7a4b3ca257d3f93ef4e91e/vservers/vserver/9ab8d517-2b1c-4d31-a04c-0fe2f8396815",
				"relationship-data": [{
					"relationship-key": "cloud-region.cloud-owner",
					"relationship-value": "CloudOwner"
				}, {
					"relationship-key": "cloud-region.cloud-region-id",
					"relationship-value": "RegionOne"
				}, {
					"relationship-key": "tenant.tenant-id",
					"relationship-value": "759425709b7a4b3ca257d3f93ef4e91e"
				}, {
					"relationship-key": "vserver.vserver-id",
					"relationship-value": "9ab8d517-2b1c-4d31-a04c-0fe2f8396815"
				}],
				"related-to-property": [{
					"property-key": "vserver.vserver-name",
					"property-value": "zdfw1fwl01snk01"
				}]
			}]
		}
	}]
  }

b. Get the public IP address of the Packet Generator VM from your deployment

c. To mount APPC, run the below command by replacing <vnf-id> and <vnf-ip> with the values obtained from the above steps (a) & (b) respectively

.. code-block::

  curl -X PUT \
   http://<kubernetes-host>:30230/restconf/config/network-topology:network-topology/topology/topology-netconf/node/<vnf-id> \
  -H 'Accept: application/xml' \
  -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
  -H 'Content-Type: text/xml' \
  -d '<node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
   <node-id><vnf-id></node-id>
   <host xmlns="urn:opendaylight:netconf-node-topology"><vnf-ip></host>
   <port xmlns="urn:opendaylight:netconf-node-topology">830</port>
   <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username>
   <password xmlns="urn:opendaylight:netconf-node-topology">netconf</password>
   <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
   </node>'

  #smaple command and output:
  curl -vvv -X PUT   http://192.168.122.99:30230/restconf/config/network-topology:network-topology/topology/topology-netconf/node/a1ca05b4-3231-4e4a-a09c-74f2292fe577   -H 'Accept: application/xml'   -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ=='   -H 'Content-Type: text/xml'   -d '<node xmlns="urn:TBD:params:xml:ns:yang:network-topology"> <node-id>a1ca05b4-3231-4e4a-a09c-74f2292fe577</node-id> <host xmlns="urn:opendaylight:netconf-node-topology">192.168.122.238</host> <port xmlns="urn:opendaylight:netconf-node-topology">830</port> <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username> <password xmlns="urn:opendaylight:netconf-node-topology">netconf</password> <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only> </node>'
  *   Trying 192.168.122.99...
  * TCP_NODELAY set
  * Connected to 192.168.122.99 (192.168.122.99) port 30230 (#0)
  > PUT /restconf/config/network-topology:network-topology/topology/topology-netconf/node/a1ca05b4-3231-4e4a-a09c-74f2292fe577 HTTP/1.1
  > Host: 192.168.122.99:30230
  > User-Agent: curl/7.58.0
  > Accept: application/xml
  > Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==
  > Content-Type: text/xml
  > Content-Length: 488
  >
  * upload completely sent off: 488 out of 488 bytes
  < HTTP/1.1 200 OK
  < Content-Length: 0
  <
  * Connection #0 to host 192.168.122.99 left intact

d. To verify the NETCONF connection has successfully being established, run the following request (replace <vnd-id> with yours)

.. code-block::

  curl -X GET \
  http://<kubernetes-host>:30230/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/<vnf-id> \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ=='

  #smaple command and output:
  curl -X GET   http://192.168.122.99:30230/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/a1ca05b4-3231-4e4a-a09c-74f2292fe577    -H 'Accept: application/json'   -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  100  5368  100  5368    0     0   374k      0 --:--:-- --:--:-- --:--:--  374k
  {
  "node": [
    {
      "node-id": "a1ca05b4-3231-4e4a-a09c-74f2292fe577",
      "netconf-node-topology:unavailable-capabilities": {},
      "netconf-node-topology:available-capabilities": {
        "available-capability": [
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:yang-library:1.0?revision=2018-01-17&module-set-id=29"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:base:1.1"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:base:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:writable-running:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:validate:1.1"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit&also-supported=report-all,report-all-tagged,trim,explicit"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:interleave:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:rollback-on-error:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:xpath:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:startup:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:candidate:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "urn:ietf:params:netconf:capability:notification:1.0"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:netconf:notification:1.0?revision=2008-07-14)notifications"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:iana-crypt-hash?revision=2014-08-06)iana-crypt-hash"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-x509-cert-to-name?revision=2014-12-10)ietf-x509-cert-to-name"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-system?revision=2014-08-06)ietf-system"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?revision=2010-10-04)ietf-netconf-monitoring"
          },
          {
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-datastores?revision=2017-08-17)ietf-datastores"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:1?revision=2017-02-20)yang"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)ietf-interfaces"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:iana-if-type?revision=2014-05-08)iana-if-type"
          },
          {
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-netconf-server?revision=2016-11-02)ietf-netconf-server"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:opendaylight:params:xml:ns:yang:sample-plugin?revision=2016-09-18)sample-plugin"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(http://nokia.com/pnf-simulator)pnf-simulator"
          },
          {
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-ssh-server?revision=2016-11-02)ietf-ssh-server"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)ietf-netconf-notifications"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:netconf:base:1.0?revision=2011-06-01)ietf-netconf"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-yang-types?revision=2013-07-15)ietf-yang-types"
          },
          {
            "capability": "(urn:mynetconf:test?revision=2019-03-01)mynetconf"
          },
          {
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-keystore?revision=2016-10-31)ietf-keystore"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:netmod:notification?revision=2008-07-14)nc-notifications"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-yang-metadata?revision=2016-08-05)ietf-yang-metadata"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-inet-types?revision=2013-07-15)ietf-inet-types"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(http://example.net/turing-machine?revision=2013-12-27)turing-machine"
          },
          {
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-tls-server?revision=2016-11-02)ietf-tls-server"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults?revision=2011-06-01)ietf-netconf-with-defaults"
          },
          {
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-yang-library?revision=2018-01-17)ietf-yang-library"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-ip?revision=2014-06-16)ietf-ip"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:ietf:params:xml:ns:yang:ietf-netconf-acm?revision=2018-02-14)ietf-netconf-acm"
          },
          {
            "capability-origin": "device-advertised",
            "capability": "(urn:opendaylight:params:xml:ns:yang:stream-count?revision=2016-09-18)stream-count"
          }
        ]
      },
      "netconf-node-topology:host": "192.168.122.238",
      "netconf-node-topology:clustered-connection-status": {
        "netconf-master-node": "akka.tcp://opendaylight-cluster-data@127.0.0.1:2550"
      },
      "netconf-node-topology:connection-status": "connected",
      "netconf-node-topology:port": 830
    }
  ]
  }

VPP setup
=========

1. The information that we need to configure the VPP reporter (which is the VES agent application
that generates events destined for the ONAP VES collector) is the VES IP and port.
The below instructions can be used for this configuration

.. code-block::

  kubectl get svc -n onap -o wide | grep ves
  dcae-hv-ves-collector                                       ClusterIP      10.43.130.145   <none>                                 6061/TCP                                                      12d   app=dcae-hv-ves-collector
  dcae-ves-collector                                          ClusterIP      10.43.83.158    <none>                                 8080/TCP,8443/TCP                                             12d   app=dcae-ves-collector
  xdcae-hv-ves-collector                                      NodePort       10.43.32.76     <none>                                 6061:30222/TCP                                                12d   app=dcae-hv-ves-collector
  xdcae-ves-collector                                         NodePort       10.43.97.42     <none>                                 8080:30235/TCP,8443:30417/TCP                                 12d   app=dcae-ves-collector

2. Use the port of xdcae-ves (30235 in this case) and the kubernetes-host IP

- Log in to the vfw sinc VNF as user ubuntu
- Modify /opt/config/dcae_collector_ip.txt and /opt/config/dcae_collector_port.txt
- Kill the vpp reporter if running already
- Start the vpp reporter by executing the script

  - cd /opt/VES/evel/evel-library/code/VESreporting
  - ./go-client.sh &
- Add the following route for the metadata service if not present already

  .. code-block::

      sudo ip route add 169.254.169.254 via <vfw_sinc OAM_NETWORK IP> dev <interface name>
      sample command:
      # sudo ip route add 169.254.169.254 via 10.10.10.11 dev eth3
- Verify that the metadata service is accessible by issuing the following command

  - curl http://169.254.169.254

3. The events generated from this program will trigger the vFW CL flow.
In a successful deployment of the vFW CL, the graphs look as in the screenshot below.
We can see that the bars are shorter and more uniform as compared to vFW deployment without the CL

Browse to the zdfw1fwl01snk01 on port 667 to see a graph representing the traffic being received

.. code-block::

  http://<zdfw1fwl01snk01>:667/

|image54|

4. Check the events sent by TCA on unauthenticated.DCAE_CL_OUTPUT

These events are the resulting of the TCA application, e.g. TCA has noticed an event was crossing
a given threshold, hence is sending a message of that particular topic. Then Policy will grab this event
and perform the appropriate action, as defined in the Policy. In the case of vFWCL, Policy will send
an event on the APPC_CL topic, that APPC will consume. This will trigger a NETCONF request to the
packet generator to adjust the traffic.

.. code-block::

  curl -X GET \
  http://<kubernetes-host>:3904/events/unauthenticated.DCAE_CL_OUTPUT/group1/C1 \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/cambria'

  #smaple command and output:
  curl -X GET   http://10.43.214.215:3904/events/unauthenticated.DCAE_CL_OUTPUT/group1/C1   -H 'Accept: application/json'   -H 'Content-Type: application/cambria' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  100   909  100   909    0     0    677      0  0:00:01  0:00:01 --:--:--   677
  [
  "{\"closedLoopEventClient\":\"DCAE_INSTANCE_ID.dcae-tca\",\"policyVersion\":\"v0.0.1\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyScope\":\"DCAE\",\"target_type\":\"VM\",\"AAI\":{\"vserver.prov-status\":\"ACTIVE\",\"vserver.resource-version\":\"1617776112073\",\"vserver.is-closed-loop-disabled\":false,\"vserver.vserver-name2\":\"vfw_sinc_vsp_002-1\",\"vserver.vserver-id\":\"30dd6250-8a74-4ed7-9729-6ce7190c6661\",\"vserver.vserver-selflink\":\"http://10.200.142.157:8774/v2.1/servers/30dd6250-8a74-4ed7-9729-6ce7190c6661\",\"vserver.in-maint\":false,\"vserver.vserver-name\":\"vfw_sinc_vsp_002-1\"},\"closedLoopAlarmStart\":1500584201765465,\"closedLoopEventStatus\":\"ONSET\",\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"target\":\"vserver.vserver-name\",\"requestID\":\"2f546551-f304-4e76-9e8e-45c601790823\",\"from\":\"DCAE\"}"
  ]

5. Check the active streams value in vPG over restconf

The number of streams will change along the time, this is the result of close-loop policy.
When the traffic goes over a certain threshold, DCAE will publish an event on the unauthenticated.DCAE_CL_OUTPUT
topic that will be picked up by APPC, that will send a NETCONF request to the packet generator to adjust the traffic it's sending.

Run the below command to check the stream count, you should see the value as 5

.. code-block::

  curl -v --noproxy '*' --user "admin":"Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"  -H "Accept: application/xml" -H "Content-type: application/xml" -X GET   http:/<kubernetes-host>:30230/restconf/config/network-topology:network-topology/topology/topology-netconf/node/<VPG VNFID>/yang-ext:mount/stream-count:stream-count/streams/

  #sample command and output
  curl -v --noproxy '*' --user "admin":"Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"  -H "Accept: application/xml" -H "Content-type: application/xml" -X GET http:/192.168.122.99:30230/restconf/config/network-topology:network-topology/topology/topology-netconf/node/a1ca05b4-3231-4e4a-a09c-74f2292fe577/yang-ext:mount/stream-count:stream-count/streams/
  Note: Unnecessary use of -X or --request, GET is already inferred.
  * Unwillingly accepted illegal URL using 1 slash!
  *   Trying 192.168.122.99...
  * TCP_NODELAY set
  * Connected to 192.168.122.99 (192.168.122.99) port 30230 (#0)
  * Server auth using Basic with user 'admin'
  > GET /restconf/config/network-topology:network-topology/topology/topology-netconf/node/a1ca05b4-3231-4e4a-a09c-74f2292fe577/yang-ext:mount/stream-count:stream-  count/streams/ HTTP/1.1
  > Host: 192.168.122.99:30230
  > Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==
  > User-Agent: curl/7.58.0
  > Accept: application/xml
  > Content-type: application/xml
  >
  < HTTP/1.1 200 OK
  < Content-Type: application/xml
  < Content-Length: 110
  <
  * Connection #0 to host 192.168.122.99 left intact
  <streams xmlns="urn:opendaylight:params:xml:ns:yang:stream-count"><active-streams>5</active-streams></streams>


.. |image16| image:: media/image16.png
.. |image15| image:: media/image15.png
.. |image5| image:: media/image5.png
.. |image13| image:: media/image13.png
.. |image1| image:: media/image1.png
.. |image12| image:: media/image12.png
.. |image14| image:: media/image14.png
.. |image19| image:: media/image19.png
.. |image7| image:: media/image7.png
.. |image10| image:: media/image10.png
.. |image4| image:: media/image4.png
.. |image20| image:: media/image20.png
.. |image9| image:: media/image9.png
.. |image3| image:: media/image3.png
.. |image17| image:: media/image17.png
.. |image11| image:: media/image11.png
.. |image24| image:: media/image24.png
.. |image22| image:: media/image22.png
.. |image18| image:: media/image18.png
.. |image23| image:: media/image23.png
.. |image2| image:: media/image2.png
.. |image8| image:: media/image8.png
.. |image21| image:: media/image21.png
.. |image25| image:: media/image25.png
.. |image53| image:: media/image53.jpg
.. |image54| image:: media/image54.png