aboutsummaryrefslogtreecommitdiffstats
path: root/docs/design/foo.rst
blob: e0d461be10669e338857cfee3be25610dac3fb30 (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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
.. contents::
   :depth: 3
..

Policy Design and API Flow for Model Driven Control Loop
========================================================

This page shows how the Policy Design and API Flow to/from the PAP and
PDPs works to support Model Driven Control Loops in Dublin.

-  `1 Policy Types <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `1.1 onap.policies.Monitoring Policy
      Type <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `1.2 onap.policies.controlloop.Operational Policy
      Type <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `1.2.1 Operational Policy Type Schema for
         Drools <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `1.2.3 Operational Policy Type Schema for APEX (El Alto
         proposal) <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `1.3 onap.policies.controlloop.Guard Policy
      Type <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `1.3.1 onap.policies.controlloop.guard.FrequencyLimiter Policy
         Type <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `1.3.2 onap.policies.controlloop.guard.Blacklist Policy
         Type <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `1.3.3 onap.policies.controlloop.guard.MinMax Policy
         Type <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `1.3.4 onap.policies.controlloop.Coordination Policy Type
      (STRETCH) <#PolicyDesignandAPIFlowforModelDrivenCon>`__

-  `2 PDP Deployment and Registration with
   PAP <#PolicyDesignandAPIFlowforModelDrivenCon>`__

-  `3. Public APIs <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `3.1 Policy Type Design API for TOSCA Policy
      Types <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.1.1 Policy Type
         query <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.1.2 Policy Type
         Create/Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.1.3 Policy Type
         Delete <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `3.2 Policy Design
      API <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.2.1 Policy
         query <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.2.2 Policy
         Create/Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

         -  `3.2.2.1 Monitoring Policy
            Create/Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

            -  `3.2.2.2.1 Drools Operational Policy
               Create/Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

            -  `3.2.2.2.2 APEX Operational Policy
               Create/Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

         -  `3.2.2.3 Guard Policy
            Create/Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

         -  `3.2.2.4 Policy Lifecycle API - Creating Coordination
            Policies <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.2.3 Policy
         Delete <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `3.3 Policy Administration
      API <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.3.1 PDP Group
         Query <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.3.2 PDP Group
         Deployment <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `Simple API for CLAMP to deploy one or more policy-id's with
         optional
         policy-version. <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `Simple API for CLAMP to undeploy a policy-id with optional
         policy-version. <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.3.3 PDP Group
         Delete <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.3.4 PDP Group State
         Management <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.3.5 PDP Group
         Statistics <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.3.6 PDP Group Health
         Check <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `3.4 Policy Decision API - Getting Policy
      Decisions <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.4.1 Decision API
         Schema <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `3.4.2 Decision API
         Queries <#PolicyDesignandAPIFlowforModelDrivenCon>`__

-  `4. Policy Framework Internal
   APIs <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `4.1 PAP to PDP API <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `4.1.1 PAP API for
         PDPs <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `4.1.2 PDP API for
         PAPs <#PolicyDesignandAPIFlowforModelDrivenCon>`__

         -  `4.1.2.1 PDP
            Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

         -  `4.1.2.2 PDP State
            Change <#PolicyDesignandAPIFlowforModelDrivenCon>`__

         -  `4.1.2.3 PDP Health
            Check <#PolicyDesignandAPIFlowforModelDrivenCon>`__

   -  `4.2 Policy Type Implementations (Native
      Policies) <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `4.2.1 Policy Type Implementation
         Query <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `4.2.2 Policy Type Implementation
         Create/Update <#PolicyDesignandAPIFlowforModelDrivenCon>`__

      -  `4.2.3 Policy Type Implementation
         Delete <#PolicyDesignandAPIFlowforModelDrivenCon>`__

The figure below shows the Artifacts (Blue) in the ONAP Policy
Framework, the Activities (Yellow) that manipulate them, and important
components (Pink) that interact with them.

Please see the :ref:`TOSCA Policy
Primer <tosca-policy>`__ page for an
introduction to TOSCA policy concepts.

TOSCA defines a *PolicyType*, the definition of a type of policy that
can be applied to a service. It also defines a *Policy*, the definition
of an instance of a *PolicyType*. In the Policy Framework, we must
handle and manage these TOSCA definitions and tie them to real
implementations of policies that can run on PDPs.

The diagram above outlines how this is achieved. Each TOSCA *PolicyType*
must have a corresponding *PolicyTypeImpl* in the Policy Framework. The
TOSCA \ *PolicyType* definition can be used to create a TOSCA *Policy*
definition, either directly by the Policy Framework, by CLAMP, or by
some other system. Once the \ *Policy* artifact exists, it can be used
together with the *PolicyTypeImpl* artifact to create a *PolicyImpl*
artifact. A *PolicyImpl* artifact is an executable policy implementation
that can run on a PDP.

The TOSCA *PolicyType* artifact defines the external characteristics of
the policy; defining its properties, the types of entities it acts on,
and its triggers.  A *PolicyTypeImpl* artifact is an XACML, Drools, or
APEX implementation of that policy definition. *PolicyType* and
*PolicyTypeImpl* artifacts may be preloaded, may be loaded manually, or
may be created using the Lifecycle API. Alternatively, *PolicyType*
definitions may be loaded over the Lifecycle API for preloaded
*PolicyTypeImpl* artifacts. A TOSCA *PolicyType* artifact can be used by
clients (such as CLAMP or CLI tools) to create, parse, serialize, and/or
deserialize an actual Policy.

The TOSCA *Policy* artifact is used internally by the Policy Framework,
or is input by CLAMP or other systems. This artifact specifies the
values of the properties for the policy and specifies the specific
entities the policy acts on. Policy Design uses the TOSCA *Policy*
artifact and the *PolicyTypeImpl* artifact to create an executable
*PolicyImpl* artifact. 

1 Policy Types
==============

Policy Type Design manages TOSCA *PolicyType* artifacts and their
*PolicyTypeImpl* implementations\ *.*

*TOSCA PolicyType* may ultimately be defined by the modeling team but
for now are defined by the Policy Framework project. Various editors and
GUIs are available for creating *PolicyTypeImpl* implementations.
However, systematic integration of *PolicyTypeImpl* implementation is
outside the scope of the ONAP Dublin release.

The \ *PolicyType* definitions and implementations listed below are
preloaded and are always available for use in the Policy Framework.

====================================== ==================================================================================================
**Policy Type**                        **Description**
====================================== ==================================================================================================
onap.policies.Monitoring               Overarching model that supports Policy driven DCAE microservice components used in a Control Loops
onap.policies.controlloop.Operational  Used to support actor/action operational policies for control loops
onap.policies.controlloop.Guard        Control Loop guard policies for policing control loops
onap.policies.controlloop.Coordination Control Loop Coordination policies to assist in coordinating multiple control loops at runtime
====================================== ==================================================================================================

1.1 onap.policies.Monitoring Policy Type
----------------------------------------

This is a base Policy Type that supports Policy driven DCAE microservice
components used in a Control Loops. The implementation of this Policy
Type is developed using the XACML PDP to support question/answer Policy
Decisions during runtime for the DCAE Policy Handler.

**Base Policy Type definition for onap.policies.Monitoring**  

.. codeblock:: yaml

    tosca_definitions_version: tosca_simple_yaml_1_0_0
    topology_template:
        policy_types:
            - onap.policies.Monitoring:
                derived_from: tosca.policies.Root
                version: 1.0.0
                description: a base policy type for all policies that govern monitoring provision

The \ *PolicyTypeImpl* implementation of the *onap.policies.Montoring*
Policy Type is generic to support definition of TOSCA *PolicyType*
artifacts in the Policy Framework using the Policy Type Design API.
Therefore many TOSCA *PolicyType* artifacts will use the same
*PolicyTypeImpl* implementation with different property types and
towards different targets. This allows dynamically generated DCAE
microservice component Policy Types to be created at Design Time.

DCAE microservice components can generate their own TOSCA \ *PolicyType*
using TOSCA-Lab Control Loop guard policies in SDC (Stretch Goal) or can
do so manually. See `How to generate artefacts for SDC catalog using
Tosca Lab
Tool <file://localhost/display/DW/How+to+generate+artefacts+for+SDC+catalog+using+Tosca+Lab+Tool>`__
for details on TOSCA-LAB in SDC. For Dublin, the DCAE team is defining
the manual steps required to build policy models \ `Onboarding steps for
DCAE MS through SDC/Policy/CLAMP
(Dublin) <file://localhost/pages/viewpage.action%3fpageId=60883710>`__.

NOTE: For Dublin, mS Policy Types will be pre-loaded into the SDC
platform and be available as a Normative. The policy framework will
pre-load support for those mS Monitoring policy types.

**PolicyType onap.policies.monitoring.MyDCAEComponent derived from
onap.policies.Monitoring**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

policy_types:

- onap.policies.Monitoring:

derived_from: tosca.policies.Root

version: 1.0.0

description: a base policy type for all policies that govern monitoring
provision

- onap.policies.monitoring.MyDCAEComponent:

derived_from: onap.policies.Monitoring

version: 1.0.0

properties:

mydcaecomponent_policy:

type: map

description: The Policy Body I need

entry_schema:

type: onap.datatypes.monitoring.mydatatype

data_types:

- onap.datatypes.monitoring.MyDataType:

derived_from: tosca.datatypes.Root

properties:

my_property_1:

type: string

description: A description of this property

constraints:

- valid_values:

- value example 1

- value example 2

TCA Example - Please note that the official version of this will be
located in the SDC repository.

**Example TCA DCAE microservice**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

policy_types:

onap.policies.Monitoring:

derived_from: tosca.policies.Root

description: a base policy type for all policies that governs monitoring
provisioning

onap.policy.monitoring.cdap.tca.hi.lo.app:

derived_from: onap.policies.Monitoring

version: 1.0.0

properties:

tca_policy:

type: map

description: TCA Policy JSON

entry_schema:

type: onap.datatypes.monitoring.tca_policy

data_types:

onap.datatypes.monitoring.metricsPerEventName:

derived_from: tosca.datatypes.Root

properties:

controlLoopSchemaType:

type: string

required: true

description: Specifies Control Loop Schema Type for the event Name e.g.
VNF, VM

constraints:

- valid_values:

- VM

- VNF

eventName:

type: string

required: true

description: Event name to which thresholds need to be applied

policyName:

type: string

required: true

description: TCA Policy Scope Name

policyScope:

type: string

required: true

description: TCA Policy Scope

policyVersion:

type: string

required: true

description: TCA Policy Scope Version

thresholds:

type: list

required: true

description: Thresholds associated with eventName

entry_schema:

type: onap.datatypes.monitoring.thresholds

onap.datatypes.monitoring.tca_policy:

derived_from: tosca.datatypes.Root

properties:

domain:

type: string

required: true

description: Domain name to which TCA needs to be applied

default: measurementsForVfScaling

constraints:

- equal: measurementsForVfScaling

metricsPerEventName:

type: list

required: true

description: Contains eventName and threshold details that need to be
applied to given eventName

entry_schema:

type: onap.datatypes.monitoring.metricsPerEventName

onap.datatypes.monitoring.thresholds:

derived_from: tosca.datatypes.Root

properties:

closedLoopControlName:

type: string

required: true

description: Closed Loop Control Name associated with the threshold

closedLoopEventStatus:

type: string

required: true

description: Closed Loop Event Status of the threshold

constraints:

- valid_values:

- ONSET

- ABATED

direction:

type: string

required: true

description: Direction of the threshold

constraints:

- valid_values:

- LESS

- LESS_OR_EQUAL

- GREATER

- GREATER_OR_EQUAL

- EQUAL

fieldPath:

type: string

required: true

description: Json field Path as per CEF message which needs to be
analyzed for TCA

constraints:

- valid_values:

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated

-
$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated

- $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle

-
$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt

- $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice

-
$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq

- $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal

- $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem

- $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait

- $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage

- $.event.measurementsForVfScalingFields.meanRequestLatency

-
$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered

-
$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached

-
$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured

- $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree

- $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed

-
$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value

severity:

type: string

required: true

description: Threshold Event Severity

constraints:

- valid_values:

- CRITICAL

- MAJOR

- MINOR

- WARNING

- NORMAL

thresholdValue:

type: integer

required: true

description: Threshold value for the field Path inside CEF message

version:

type: string

required: true

description: Version number associated with the threshold

1.2 onap.policies.controlloop.Operational Policy Type
-----------------------------------------------------

This policy type is used to support actor/action operational policies
for control loops. There are two types of implementations for this
policy type

1. Existing Drools implementations that supports runtime Control Loop
   actions taken on components such as SO/APPC/VFC/SDNC/SDNR

2. New implementations using APEX to support Control Loops.

For Dublin, this policy type will ONLY be used for the Policy Framework
to distinguish the policy type as operational. The contents are still
TBD for El Alto.

**Base Policy type definition for
onap.policies.controlloop.Operational**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

policy_types:

onap.policies.controlloop.Operational:

derived_from: tosca.policies.Root

version: 1.0.0

description: Operational Policy for Control Loops

Applications should use the following Content-Type when creating
onap.policies.controlloop.Operational policies:

Content-Type: "application/yaml; vnd.onap.operational"

1.2.1 Operational Policy Type Schema for Drools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For Dublin Drools will still support the Casablanca YAML definition of
an Operational Policy for Control Loops.

Please use the Casablanca version of the YAML Operational Policy format
defined \ https://git.onap.org/policy/drools-applications/tree/controlloop/common/policy-yaml/README-v2.0.0.md.

1.2.3 Operational Policy Type Schema for APEX (El Alto proposal)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The operational Policy Type schema for for APEX will extend the base
operational Policy Type schema. This Policy Type allows parameters
specific to the APEX PDP to be specified as a TOSCA policy.

**Operational Policy Model Parameter Schema for APEX**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

# Note: The full APEX PolicyType definition will be developed during the
Dublin

# timeframe of the ONAP project

policy_types:

onap.policies.controlloop.Operational:

derived_from: tosca.policies.Root

version: 1.0.0

description: Operational Policy for Control Loops

 onap.policies.controloop.operational.Apex:

derived_from: onap.policies.controlloop.Operational

version: 1.0.0

description: Operational Policy for Control Loops using the APEX PDP

 properties:

# Some of these properties may be redundant in a Kubernetes deployment

engine_service:

type: onap.datatypes.policies.controlloop.operational.apex.EngineService

description: APEX Engine Service Parameters

inputs:

type: map

description: Inputs for handling events coming into the APEX engine

entry_schema:

type: onap.datatypes.policies.controlloop.operational.apex.EventHandler

outputs:

type: map

description: Outputs for handling events going out of the APEX engine

entry_schema:

type: onap.datatypes.policies.controlloop.operational.apex.EventHandler

environment:

type: list

description: Envioronmental parameters for the APEX engine

entry_schema:

type: onap.datatypes.policies.controlloop.operational.apex.Environment

data_types:

onap.datatypes.policies.controlloop.operational.apex.EngineService:

derived_from: tosca.datatypes.Root

properties:

name:

type: string

description: Specifies the engine name

required: false

default: "ApexEngineService"

version:

type: string

description: Specifies the engine version in double dotted format

required: false

default: "1.0.0"

id:

type: int

description: Specifies the engine id

required: true

instance_count:

type: int

description: Specifies the number of engine threads that should be run

required: true

deployment_port:

type: int

description: Specifies the port to connect to for engine administration

required: false

default: 1

policy_model_file_name:

type: string

description: The name of the file from which to read the APEX policy
model

required: false

default: ""

  policy_type_impl:

type: string

description: The policy type implementation from which to read the APEX
policy model

required: false

default: ""

periodic_event_period:

type: string

description: The time interval in milliseconds for the periodic scanning

event, 0 means "don't scan"

required: false

default: 0

engine:

type:
onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine

description: The parameters for all engines in the APEX engine service

required: true

onap.datatypes.policies.controlloop.operational.apex.EventHandler:

derived_from: tosca.datatypes.Root

properties:

name:

type: string

description: Specifies the event handler name, if not specified this is
set to

the key name

 required: false

carrier_technology:

type:
onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology

description: Specifies the carrier technology of the event handler (such

as REST/Web Socket/Kafka)

required: true

event_protocol:

type: onap.datatypes.policies.controlloop.operational.apex.EventProtocol

description: Specifies the event protocol of events for the event
handler

(such as Yaml/JSON/XML/POJO)

required: true

event_name:

type: string

description: Specifies the event name for events on this event handler,
if

not specified, the event name is read from or written to the event being

received or sent

required: false

event_name_filter:

type: string

description: Specifies a filter as a regular expression, events that do

not match the filter are dropped, the default is to let all events

through

required: false

synchronous_mode:

type: bool

description: Specifies the event handler is syncronous (receive event
and

send response)

required: false

default: false

synchronous_peer:

type: string

description: The peer event handler (output for input or input for
output)

of this event handler in synchronous mode, this parameter is mandatory
if

the event handler is in synchronous mode

required: false

default: ""

synchronous_timeout:

type: int

description: The timeout in milliseconds for responses to be issued by

APEX torequests, this parameter is mandatory if the event handler is in

synchronous mode

required: false

default: ""

requestor_mode:

type: bool

description: Specifies the event handler is in requestor mode (send
event

and wait for response mode)

required: false

default: false

requestor_peer:

type: string

description: The peer event handler (output for input or input for
output)

of this event handler in requestor mode, this parameter is mandatory if

the event handler is in requestor mode

required: false

default: ""

requestor_timeout:

type: int

description: The timeout in milliseconds for wait for responses to

requests, this parameter is mandatory if the event handler is in

requestor mode

required: false

default: ""

onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology:

derived_from: tosca.datatypes.Root

properties:

label:

type: string

description: The label (name) of the carrier technology (such as REST,

Kafka, WebSocket)

required: true

plugin_parameter_class_name:

type: string

description: The class name of the class that overrides default handling

of event input or output for this carrier technology, defaults to the
supplied

input or output class

required: false

onap.datatypes.policies.controlloop.operational.apex.EventProtocol:

derived_from: tosca.datatypes.Root

properties:

label:

type: string

description: The label (name) of the event protocol (such as Yaml,

JSON, XML, or POJO)

required: true

event_protocol_plugin_class:

type: string

description: The class name of the class that overrides default handling

of the event protocol for this carrier technology, defaults to the

supplied event protocol class

required: false

onap.datatypes.policies.controlloop.operational.apex.Environmental:

derived_from: tosca.datatypes.Root

properties:

name:

type: string

description: The name of the environment variable

required: true

value:

type: string

description: The value of the environment variable

required: true

onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine:

derived_from: tosca.datatypes.Root

properties:

context:

type:
onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context

description: The properties for handling context in APEX engines,

defaults to using Java maps for context

required: false

executors:

type: map

description: The plugins for policy executors used in engines such as

javascript, MVEL, Jython

required: true

entry_schema:

description: The plugin class path for this policy executor

type: string

onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context:

derived_from: tosca.datatypes.Root

properties:

distributor:

type: onap.datatypes.policies.controlloop.operational.apex.Plugin

description: The plugin to be used for distributing context between

APEX PDPs at runtime

required: false

schemas:

type: map

description: The plugins for context schemas available in APEX PDPs

such as Java and Avro

required: false

entry_schema:

type: onap.datatypes.policies.controlloop.operational.apex.Plugin

locking:

type: onap.datatypes.policies.controlloop.operational.apex.plugin

description: The plugin to be used for locking context in and

between APEX PDPs at runtime

required: false

persistence:

type: onap.datatypes.policies.controlloop.operational.apex.Plugin

description: The plugin to be used for persisting context for APEX PDPs

at runtime

required: false

onap.datatypes.policies.controlloop.operational.apex.Plugin:

derived_from: tosca.datatypes.Root

properties:

name:

type: string

description: The name of the executor such as Javascript, Jython or MVEL

required: true

plugin_class_name:

type: string

description: The class path of the plugin class for this executor

1.3 onap.policies.controlloop.Guard Policy Type
-----------------------------------------------

This policy type is the the type definition for Control Loop guard
policies for frequency limiting, blacklisting and min/max guards to help
protect runtime Control Loop Actions from doing harm to the network.
This policy type is developed using the XACML PDP to support
question/answer Policy Decisions during runtime for the Drools and APEX
onap.controlloop.Operational policy type implementations.

The base schema is defined as below:

**Base Policy type definition for onap.policies.controlloop.Guard**
 Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

policy_types:

- onap.policies.controlloop.Guard:

derived_from: tosca.policies.Root

version: 1.0.0

description: Guard Policies for Control Loop Operational Policies

As with *onap.policies.Monitoring* policy type, the *PolicyTypeImpl*
implementation of the *onap.policies.controlloop.Guard* Policy Type is
generic to support definition of TOSCA *PolicyType* artifacts in the
Policy Framework using the Policy Type Design API.

For Dublin, only the following derived Policy Type definitions below are
preloaded in the Policy Framework. However, the creation of policies
will still support the payload from Casablanca.

**Casablanca Guard Payload**  Expand source

ContentType: "application/json; vnd.onap.guard"

Accepts: "application/json"

#

# Request BODY

#

{

"policy-id" : "guard.frequency.scaleout",

"contents" : {

"actor": "SO",

"recipe": "scaleOut",

"targets": ".*",

"clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",

"limit": "1",

"timeWindow": "10",

"timeUnits": "minute",

"guardActiveStart": "00:00:01-05:00",

"guardActiveEnd": "23:59:59-05:00"

}

}

#

# Request RESPONSE

#

{

"guard.frequency.scaleout": {

"type": "onap.policies.controlloop.guard.FrequencyLimiter",

"version": "1.0.0",

"metadata": {

"policy-id": "guard.frequency.scaleout",

"policy-version": 1

}

}

}

1.3.1 onap.policies.controlloop.guard.FrequencyLimiter Policy Type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is WIP for El Alto for the proposed policy type.

**Policy Typefor Frequency Limiter Guard Policy**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

policy_types:

- onap.policies.controlloop.Guard:

derived_from: tosca.policies.Root

version: 1.0.0

description: Guard Policies for Control Loop Operational Policies

- onap.policies.controlloop.guard.FrequencyLimiter:

derived_from: onap.policies.controlloop.Guard

version: 1.0.0

description: Supports limiting the frequency of actions being taken by a
Actor.

properties:

frequency_policy:

type: map

description:

entry_schema:

type: onap.datatypes.guard.FrequencyLimiter

data_types:

- onap.datatypes.guard.FrequencyLimiter:

derived_from: tosca.datatypes.Root

properties:

actor:

type: string

description: Specifies the Actor

required: true

recipe:

type: string

description: Specified the Recipe

required: true

time_window:

type: scalar-unit.time

description: The time window to count the actions against.

required: true

limit:

type: integer

description: The limit

required: true

constraints:

- greater_than: 0

time_range:

type: tosca.datatypes.TimeInterval

description: An optional range of time during the day the frequency is
valid for.

required: false

controlLoopName:

type: string

description: An optional specific control loop to apply this guard to.

required: false

target:

type: string

description: An optional specific VNF to apply this guard to.

required: false

1.3.2 onap.policies.controlloop.guard.Blacklist Policy Type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Policy Type for Blacklist Guard Policies**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

policy_types:

- onap.policies.controlloop.Guard:

derived_from: tosca.policies.Root

version: 1.0.0

description: Guard Policies for Control Loop Operational Policies

- onap.policies.controlloop.guard.Blacklist:

derived_from: onap.policies.controlloop.Guard

version: 1.0.0

description: Supports blacklist of VNF's from performing control loop
actions on.

properties:

blacklist_policy:

type: map

description:

entry_schema:

type: onap.datatypes.guard.Blacklist

data_types:

- onap.datatypes.guard.Blacklist:

derived_from: tosca.datatypes.Root

properties:

actor:

type: string

description: Specifies the Actor

required: true

recipe:

type: string

description: Specified the Recipe

required: true

time_range:

type: tosca.datatypes.TimeInterval

description: An optional range of time during the day the blacklist is
valid for.

required: false

controlLoopName:

type: string

description: An optional specific control loop to apply this guard to.

required: false

blacklist:

type: list

description: List of VNF's

required: true

1.3.3 onap.policies.controlloop.guard.MinMax Policy Type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Policy Type for Min/Max VF Module Policies**  Expand source

policy_types:

- onap.policies.controlloop.Guard:

derived_from: tosca.policies.Root

version: 1.0.0

description: Guard Policies for Control Loop Operational Policies

- onap.policies.controlloop.guard.MinMax:

derived_from: onap.policies.controlloop.Guard

version: 1.0.0

description: Supports Min/Max number of VF Modules

properties:

minmax_policy:

type: map

description:

entry_schema:

type: onap.datatypes.guard.MinMax

data_types:

- onap.datatypes.guard.MinMax:

derived_from: tosca.datatypes.Root

properties:

actor:

type: string

description: Specifies the Actor

required: true

recipe:

type: string

description: Specified the Recipe

required: true

time_range:

type: tosca.datatypes.TimeInterval

description: An optional range of time during the day the Min/Max limit
is valid for.

required: false

controlLoopName:

type: string

description: An optional specific control loop to apply this guard to.

required: false

min_vf_module_instances:

type: integer

required: true

description: The minimum instances of this VF-Module

max_vf_module_instances:

type: integer

required: false

description: The maximum instances of this VF-Module

1.3.4 onap.policies.controlloop.Coordination Policy Type (STRETCH)
------------------------------------------------------------------

This policy type defines Control Loop Coordination policies to assist in
coordinating multiple control loops during runtime. This policy type is
developed using XACML PDP to support question/answer policy decisions at
runtime for the onap.policies.controlloop.operational policy types.

2 PDP Deployment and Registration with PAP
==========================================

The unit of execution and scaling in the Policy Framework is a
*PolicyImpl* entity. A *PolicyImpl* entity runs on a PDP. As is
explained above a *PolicyImpl* entity is a *PolicyTypeImpl*
implementation parameterized with a TOSCA *Policy*.

In order to achieve horizontal scalability, we group the PDPs running
instances of a given *PolicyImpl* entity logically together into a
*PDPSubGroup*. The number of PDPs in a *PDPSubGroup* can then be scaled
up and down using Kubernetes. In other words, all PDPs in a subgroup run
the same \ *PolicyImpl*, that is the same policy template implementation
(in XACML, Drools, or APEX) with the same parameters.

The figure above shows the layout of *PDPGroup* and *PDPSubGroup*
entities. The figure shows examples of PDP groups for Control Loop and
Monitoring policies on the right.

The health of PDPs is monitored by the PAP in order to alert operations
teams managing policy. The PAP manages the life cycle of policies
running on PDPs.

The table below shows the methods in which *PolicyImpl* entities can be
deployed to PDP Subgroups

=============== ================================================================================================================================================================================================================================================================================== ================================================================================================================================================================================ ========================================================================================================================================================================================================================
**Method**      **Description**                                                                                                                                                                                                                                                                    **Advantages**                                                                                                                                                                   **Disadvantages**
=============== ================================================================================================================================================================================================================================================================================== ================================================================================================================================================================================ ========================================================================================================================================================================================================================
Cold Deployment The *PolicyImpl (PolicyTypeImpl* and TOSCA *Policy)* are predeployed on the PDP. The PDP is fully configured and ready to execute when started.                                                                                                                                    No run time configuration required and run time administration is simple.                                                                                                        Very restrictive, no run time configuration of PDPs is possible.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
                PDPs register with the PAP when they start, providing the *PolicyImpl* they have been predeployed with.                                                                                                                                                                                                                                                                                                                                                            
Warm Deployment The *PolicyTypeImpl* entity is predeployed on the PDP. A TOSCA *Policy* may be loaded at startup. The PDP may be configured or reconfigured with a new or updated TOSCA *Policy* at run time.                                                                                      The configuration, parameters, and PDP group of PDPs may be changed at run time by loading or updating a TOSCA *Policy* into the PDP.                                            Administration and management is required. The configuration and life cycle of the TOSCA policies can change at run time and must be administered and managed.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
                PDPs register with the PAP when they start, providing the *PolicyImpl* they have been predeployed with if any. The PAP may update the TOSCA *Policy* on a PDP at any time after registration.                                                                                      Lifecycle management of TOSCA *Policy* entities is supported, allowing features such as *PolicyImpl* Safe Mode and \ *Policy*\ Impl retirement.                                 
Hot Deployment  The *PolicyImpl (PolicyTypeImpl* and TOSCA *Policy)*  are deployed at run time. The *PolicyImpl (PolicyTypeImpl* and TOSCA *Policy)* may be loaded at startup. The PDP may be configured or reconfigured with a new or updated *PolicyTypeImpl* and/or TOSCA *Policy* at run time. The policy logic, rules, configuration, parameters, and PDP group of PDPs  may be changed at run time by loading or updating a TOSCA *Policy* and *PolicyTypeImpl* into the PDP. Administration and management is more complex. The *PolicyImpl* itself and its configuration and life cycle as well as the life cycle of the TOSCA policies can change at run time and must be administered and managed.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
                PDPs register with the PAP when they start, providing the *PolicyImpl* they have been predeployed with if any. The PAP may update the TOSCA *Policy* and *PolicyTypeImpl* on a PDP at any time after registration.                                                                 Lifecycle management of TOSCA *Policy* entities and *PolicyTypeImpl* entites is supported, allowing features such as *PolicyImpl* Safe Mode and \ *Policy*\ Impl retirement.    
=============== ================================================================================================================================================================================================================================================================================== ================================================================================================================================================================================ ========================================================================================================================================================================================================================

3. Public APIs
==============

The Policy Framework supports the APIs documented in the subsections
below. The APIs in this section are supported for use by external
components.

3.1 Policy Type Design API for TOSCA Policy Types
-------------------------------------------------

The purpose of this API is to support CRUD of TOSCA *PolicyType*
entities. This API is provided by the *PolicyDevelopment* component of
the Policy Framework, see `The ONAP Policy
Framework <file://localhost/display/DW/The+ONAP+Policy+Framework>`__
architecture.

The API allows applications to create, update, delete, and query
*PolicyType* entities so that they become available for use in ONAP by
applications such as CLAMP\ *.* Some Policy Type entities are preloaded
in the Policy Framework. The TOSCA fields below are valid on API calls:

============ ======= ======== ========== ===============================================================================================================================
**Field**    **GET** **POST** **DELETE** **Comment**
============ ======= ======== ========== ===============================================================================================================================
(name)       M       M        M          The definition of the reference to the Policy Type, GET allows ranges to be specified
version      O       M        C          GET allows ranges to be specified, must be specified if more than one version of the Policy Type exists
description  R       O        N/A        Desciption of the Policy Type
derived_from R       C        N/A        Must be specified when a Policy Type is derived from another Policy Type such as in the case of derived Monitoring Policy Types
metadata     R       O        N/A        Metadata for the Policy Type
properties   R       M        N/A        This field holds the specification of the specific Policy Type in ONAP
targets      R       O        N/A        A list of node types and/or group types to which the Policy Type can be applied
triggers     R       O        N/A        Specification of policy triggers, not currently supported in ONAP
============ ======= ======== ========== ===============================================================================================================================

| Note: On this and subsequent tables, use the following legend:
  M-Mandatory, O-Optional, R-Read-only, C-Conditional. Conditional means
  the field is mandatory when some other field is present.
| Note: Preloaded policy types may only be queried over this API,
  modification or deletion of preloaded policy type implementations is
  disabled.
| Note: Policy types  that are in use (referenced by defined Policies)
  may not be deleted
| Note: The group types of targets in TOSCA are groups of TOSCA nodes,
  not PDP groups; the *target* concept in TOSCA is equivalent to the
  Policy Enforcement Point (PEP) concept

3.1.1 Policy Type query
~~~~~~~~~~~~~~~~~~~~~~~

The API allows applications (such as CLAMP and Integration) to query
the \ *PolicyType* entities that are available for \ *Policy* creation
using a GET operation.

*https:{url}:{port}/policy/api/v1/policytypes GET*

**Policy Type Query - When system comes up before any mS are onboarded**
 Expand source

policy_types:

- onap.policies.Monitoring:

version: 1.0.0

description: A base policy type for all policies that govern monitoring
provision

derived_from: tosca.policies.Root

properties:

# Omitted for brevity, see Section 1

 - onap.policies.controlloop.Operational:

version: 1.0.0

  description: Operational Policy for Control Loops

derived_from: tosca.policies.Root

properties:

# Omitted for brevity, see Section 1

- onap.policies.controloop.operational.Drools:

version: 1.0.0

description: Operational Policy for Control Loops using the Drools PDP

derived_from: onap.policies.controlloop.Operational

properties:

# Omitted for brevity, see Section 1

- onap.policies.controloop.operational.Apex:

version: 1.0.0

description: Operational Policy for Control Loops using the APEX PDP

derived_from: onap.policies.controlloop.Operational

properties:

# Omitted for brevity, see Section 1

 - onap.policies.controlloop.Guard:

version: 1.0.0

description: Operational Policy for Control Loops

derived_from: tosca.policies.Root

properties:

# Omitted for brevity, see Section 1

- onap.policies.controlloop.guard.FrequencyLimiter:

version: 1.0.0

  description: Supports limiting the frequency of actions being taken by
a Actor.

derived_from: onap.policies.controlloop.Guard

properties:

# Omitted for brevity, see Section 1

- onap.policies.controlloop.guard.Blacklist:

version: 1.0.0

description: Supports blacklist of VNF's from performing control loop
actions on.

derived_from: onap.policies.controlloop.Guard

properties:

# Omitted for brevity, see Section 1

- onap.policies.controlloop.guard.MinMax:

version: 1.0.0

description: Supports Min/Max number of VF Modules

derived_from: onap.policies.controlloop.Guard

properties:

# Omitted for brevity, see Section 1

- onap.policies.controlloop.coordination.TBD: (STRETCH GOALS)

version: 1.0.0

description: Control Loop Coordination policy types

derived_from: onap.policies.controlloop.Coordination

properties:

# Omitted for brevity, see Section 1

data_types:

# Any bespoke data types referenced by policy type definitions

The table below shows some more examples of GET operations

======================================================================================================== ================================================================
**Example**                                                                                              **Description**
======================================================================================================== ================================================================
*https:{url}:{port}/policy/api/v1/policytypes*                                                           Get all Policy Type entities in the system
*https:{url}:{port}/policy/api/v1/policytypes/{policy type id}*                                          Get a specific policy type and all the available versions.
                                                                                                        
*eg.                                                                                                    
https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app*               
*https:{url}:{port}/policy/api/v1/policytypes/{policy type id}/versions/{version id}*                    Get the specific Policy Type with the specified name and version
                                                                                                        
*eg.                                                                                                    
https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0*
======================================================================================================== ================================================================

3.1.2 Policy Type Create/Update
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The API allows applications and users (such as a DCAE microservice
component developer) to create or update a Policy Type using a POST
operation. This API allows new Policy Types to be created or existing
Policy Types to be modified. POST operations with a new Policy Type name
or a new version of an existing Policy Type name are used to create a
new Policy Type. POST operations with an existing Policy Type name and
version are used to update an existing Policy Type. Many Policy Types
can be created or updated in a single POST operation by specifying more
than one Policy Type on the TOSCA *policy_types* list.

For example, the POST operation below with the TOSCA body below is used
to create a new Policy type for a DCAE microservice.

*https:{url}:{port}/policy/api/v1/policytypes POST*

**Create a new Policy Type for a DCAE microservice**  Expand source

policy_types:

- onap.policies.monitoring.cdap.tca.hi.lo.app:

version: 1.0.0

  derived_from: onap.policies.Monitoring

description: A DCAE TCA high/low policy type

properties:

tca_policy:

type: map

description: TCA Policy JSON

default:'{<JSON omitted for brevity>}'

entry_schema:

type: onap.datatypes.monitoring.tca_policy

data_types:

<omitted for brevity>

Following creation of a DCAE TCA policy type operation, the GET call for
Monitoring policies will list the new policy type. 

*https:{url}:{port}/policy/api/v1/policytypes GET*

**Policy Type Query after DCAE TCA mS Policy Type is created**  Expand
source

policy_types:

- onap.policies.Monitoring:

version: 1.0.0

derived_from: tosca.policies.Root

description: A base policy type for all policies that govern monitoring
provision

- onap.policies.monitoring.cdap.tca.hi.lo.app:

version: 1.0.0

  derived_from: onap.policies.Monitoring

description: A DCAE TCA high/low policy type

- onap.policies.controlloop.Operational:

version: 1.0.0

description: Operational Policy for Control Loops

derived_from: tosca.policies.Root

- onap.policies.controloop.operational.Drools:

version: 1.0.0

description: Operational Policy for Control Loops using the Drools PDP

derived_from: onap.policies.controlloop.Operational

- onap.policies.controloop.operational.Apex:

version: 1.0.0

description: Operational Policy for Control Loops using the APEX PDP

derived_from: onap.policies.controlloop.Operational

- onap.policies.controlloop.Guard:

version: 1.0.0

description: Operational Policy for Control Loops

derived_from: tosca.policies.Root

- onap.policies.controlloop.guard.FrequencyLimiter:

version: 1.0.0

description: Supports limiting the frequency of actions being taken by a
Actor.

derived_from: onap.policies.controlloop.Guard

- onap.policies.controlloop.guard.Blacklist:

version: 1.0.0

description: Supports blacklist of VNF's from performing control loop
actions on.

derived_from: onap.policies.controlloop.Guard

- onap.policies.controlloop.guard.MinMax:

version: 1.0.0

description: Supports Min/Max number of VF Modules

derived_from: onap.policies.controlloop.Guard

- onap.policies.controlloop.coordination.TBD: (STRETCH GOALS)

version: 1.0.0

description: Control Loop Coordination policy types

derived_from: onap.policies.controlloop.Coordination

Now the \ *onap.policies.Monitoring.cdap.tca.hi.lo.app* Policy Type is
available to CLAMP for creating concrete policies. See the Yaml
contribution on the \ `Model driven Control Loop
Design <file://localhost/display/DW/Model+driven+Control+Loop+Design>`__ page
for a full listing of the DCAE TCA policy type used in the example
above.

3.1.3 Policy Type Delete
~~~~~~~~~~~~~~~~~~~~~~~~

The API also allows Policy Types to be deleted with a DELETE operation.
The format of the delete operation is as below:

*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0
DELETE*

| Note: Predefined policy types cannot be deleted
| Note: Policy types that are in use (Parameterized by a TOSCA Policy)
  may not be deleted, the parameterizing TOSCA policies must be deleted
  first
| Note: The *version* parameter may be omitted on the DELETE operation
  if there is only one version of the policy type in the system

3.2 Policy Design API
---------------------

The purpose of this API is to support CRUD of TOSCA *Policy* entities
from TOSCA compliant *PolicyType* definitions. TOSCA *Policy* entities
become the parameters for \ *PolicyTypeImpl* entities, producing
*PolicyImpl* entities that can run on PDPs. This API is provided by the
*PolicyDevelopment* component of the Policy Framework, see `The ONAP
Policy
Framework <file://localhost/display/DW/The+ONAP+Policy+Framework>`__
architecture.

This API allows applications (such as CLAMP and Integration) to create,
update, delete, and query *Policy* entities\ *.* The TOSCA fields below
are valid on API calls:

=========== ======= ======== ========== ================================================================================
**Field**   **GET** **POST** **DELETE** **Comment**
=========== ======= ======== ========== ================================================================================
(name)      M       M        M          The definition of the reference to the Policy, GET allows ranges to be specified
type        O       M        O          The Policy Type of the policy, see section 3.1
description R       O        O         
metadata    R       O        N/A       
properties  R       M        N/A        This field holds the specification of the specific Policy in ONAP
targets     R       O        N/A        A list of nodes and/or groups to which the Policy can be applied
=========== ======= ======== ========== ================================================================================

| Note: Policies that are deployed (used on deployed *PolicyImpl*
  entities) may not be deleted
| Note: This API is NOT used by DCAE for a decision on what policy the
  DCAE PolicyHandler should retrieve and enforce
| Note: The groups of targets in TOSCA are groups of TOSCA nodes, not
  PDP groups; the *target* concept in TOSCA is equivalent to the Policy
  Enforcement Point (PEP) concept

YAML is used for illustrative purposes in the examples in this section.
JSON (application/json) will be used as the content type in the
implementation of this API.

3.2.1 Policy query
~~~~~~~~~~~~~~~~~~

The API allows applications (such as CLAMP and Integration) to query
the \ *Policy* entities that are available for deployment using a GET
operation.

Note: This operation simply returns TOSCA policies that are defined in
the Policy Framework, it does NOT make a decision.

The table below shows some more examples of GET operations

==================================================================================================================================================================================================== ===================================================================================
**Example**                                                                                                                                                                                          **Description**
==================================================================================================================================================================================================== ===================================================================================
*https:{url}:{port}/policy/api/v1/policytypes/{policy type id}/versions/{versions}/policies*                                                                                                         Get all Policies for a specific Policy Type and version
                                                                                                                                                                                                    
*eg.                                                                                                                                                                                                
https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies*                                                                                   
*https://{url}:{port}/policy/api/v1/policytypes/{policy type id}/versions/{version}/policies/{policy name}/versions/{version}*                                                                       Gets a specific Policy version
                                                                                                                                                                                                    
*eg.                                                                                                                                                                                                
https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.scaleout.tca/versions/1.0.0 GET*                                              
*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.scaleout.tca/versions/latest GET*                                             Returns the latest version of a Policy
*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.scaleout.tca/deployed GET*                                                    Returns the version of the Policy that has been deployed on one or more PDP groups.
*https://{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.2.3/policies/CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A/versions/1.0.2 GET* Returns a specific version of a monitoring policy
==================================================================================================================================================================================================== ===================================================================================

3.2.2 Policy Create/Update
~~~~~~~~~~~~~~~~~~~~~~~~~~

The API allows applications and users (such as CLAMP and Integration) to
create or update a Policy using a POST operation. This API allows new
Policies to be created or existing Policies to be modified. POST
operations with a new Policy name are used to create a new Policy. POST
operations with an existing Policy name are used to update an existing
Policy. Many Policies can be created or updated in a single POST
operation by specifying more than one Policy on the TOSCA *policies*
list.

3.2.2.1 Monitoring Policy Create/Update
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

While designing a control loop using CLAMP, a Control Loop Designer uses
the Policy Type for a specific DCAE mS component (See Section 3.1.1) to
create a specific Policy. CLAMP then uses this API operation to submit
the Policy to the Policy Framework.

For example, the POST operation below with the TOSCA body below is used
to create a new scaleout Policy for
the \ *onap.policies.monitoring.cdap.tca.hi.lo.app* microservice. The
name of the policy "onap.scaleout.tca" is up to the user to determine
themselves.

*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.Monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies POST*

**TOSCA Body of a new TCA High/Low Policy**  Expand source

https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies
POST

Content-Type: application/yaml

Accept: application/yaml

#Request Body

policies:

-

onap.scaleout.tca:

  type: onap.policies.monitoring.cdap.tca.hi.lo.app

version: 1.0.0

metadata:

policy-id: onap.scaleout.tca # SHOULD MATCH THE TOSCA policy-name field
above. DCAE needs this - convenience.

description: The scaleout policy for vDNS # GOOD FOR CLAMP GUI

properties:

domain: measurementsForVfScaling

metricsPerEventName:

-

eventName: vLoadBalancer

controlLoopSchemaType: VNF

policyScope: "type=configuration"

policyName: "onap.scaleout.tca"

policyVersion: "v0.0.1"

thresholds:

- closedLoopControlName:
"CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A"

closedLoopEventStatus: ONSET

version: "1.0.2"

fieldPath:
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"

thresholdValue: 500

direction: LESS_OR_EQUAL

severity: MAJOR

-

closedLoopControlName:
"CL-LBAL-LOW-TRAFFIC-SIG-0C5920A6-B564-8035-C878-0E814352BC2B"

closedLoopEventStatus: ONSET

version: "1.0.2"

fieldPath:
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"

thresholdValue: 5000

direction: GREATER_OR_EQUAL

severity: CRITICAL

#Response Body

policies:

- onap.scaleout.tca:

type: onap.policies.monitoring.cdap.tca.hi.lo.app

version: 1.0.0

metadata:

#

# version is managed by Policy Lifecycle and returned

# back to the caller.

#

policy-version: 1

#

# These were passed in, and should not be changed. Will

# be passed back.

#

policy-id: onap.scaleout.tca

properties:

domain: measurementsForVfScaling

metricsPerEventName:

-

eventName: vLoadBalancer

controlLoopSchemaType: VNF

policyScope: "type=configuration"

<OMITTED FOR BREVITY>

Given a return code of success and a "metadata" section that indicates
versioning information. The "metadata" section conforms exactly to how
SDC implements lifecycle management versioning for first class
normatives in the TOSCA Models. The policy platform will implement
lifecycle identically to SDC to ensure conformity for policy creation.
The new metadata fields return versioning details.

The following new policy will be listed and will have a "metadata"
section as shown below:

*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies
GET*

**Policy with Metadata section for lifecycle management**  Expand source

policies:

- onap.scaleout.tca:

type: onap.policies.monitoring.cdap.tca.hi.lo.app

version: 1.0.0

metadata:

policy-id: onap.scaleout.tca

policy-version: 1

- my.other.policy:

type: onap.policies.monitoring.cdap.tca.hi.lo.app

version: 1.0.0

metadata:

invariantUUID: 20ad46cc-6b16-4404-9895-93d2baaa8d25

UUID: 4f715117-08b9-4221-9d63-f3fa86919742

version: 5

name: my.other.policy

scope: foo=bar;field2=value2

description: The policy for some other use case

- yet.another.policy:

type: onap.policies.monitoring.cdap.tca.hi.lo.app

version: 1.0.0

metadata:

invariantUUID: 20ad46cc-6b16-4404-9895-93d2baaa8d25

UUID: 4f715117-08b9-4221-9d63-f3fa86919742

version: 3

name: yet.another.policy

scope: foo=bar;

description: The policy for yet another use case

The contents of the new policy can be retrieved using the ID:

*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.scaleout.tca
GET*

**Query on a new TCA High/Low Policy**  Expand source

policies:

-

onap.scaleout.tca:

type: onap.policies.monitoring.cdap.tca.hi.lo.app

version: 1.0.0

metadata:

invariantUUID: 20ad46cc-6b16-4404-9895-93d2baaa8d25

UUID: 4f715117-08b9-4221-9d63-f3fa86919742

version: 1

name: onap.scaleout.tca

scope: foo=bar;

description: The scaleout policy for vDNS

properties:

domain: measurementsForVfScaling

<OMMITTED FOR BREVITY>

**3.2.2.2 Operational Policy Create/Update**

While designing an operational policy, the designer uses the Policy Type
for the operational policy (See Section 3.1.1) to create a specific
Policy and submits the Policy to the Policy Framework.

This URL will be fixed for CLAMP in Dublin and the payload will match
updated version of Casablanca YAML that supports VFModules.

*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.controloop.operational/versions/1.0.0/policies POST*

*Content-Type: application/yaml; legacy-version*

FUTURE: Content-Type: application/yaml; tosca

NOTE: The controlLoopName will be assumed to be the policy-id

**Create an Operational Policy**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

topology_template:

policies:

-

operational.scaleout:

type: onap.policies.controlloop.Operational

version: 1.0.0

metadata:

policy-id: operational.scaleout

properties:

controlLoop:

version: 2.0.0

controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3

trigger_policy: unique-policy-id-1-scale-up

timeout: 1200

abatement: false

policies:

- id: unique-policy-id-1-scale-up

name: Create a new VF Module

description:

actor: SO

recipe: VF Module Create

target:

type: VNF

payload:

requestParameters: '{"usePreload":true,"userParams":[]}'

configurationParameters:
'[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]'

retry: 0

timeout: 1200

success: final_success

failure: final_failure

failure_timeout: final_failure_timeout

failure_retries: final_failure_retries

failure_exception: final_failure_exception

failure_guard: final_failure_guard

**Response from creating Operational Policy**  Expand source

tosca_definitions_version: tosca_simple_yaml_1_0_0

topology_template:

policies:

-

operational.scaleout:

type: onap.policies.controlloop.Operational

version: 1.0.0

metadata:

policy-id: operational.scaleout

policy-version: 1

properties:

controlLoop:

version: 2.0.0

controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3

trigger_policy: unique-policy-id-1-scale-up

timeout: 1200

abatement: false

policies:

- id: unique-policy-id-1-scale-up

name: Create a new VF Module

description:

actor: SO

recipe: VF Module Create

target:

type: VNF

payload:

requestParameters: '{"usePreload":true,"userParams":[]}'

configurationParameters:
'[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]'

retry: 0

timeout: 1200

success: final_success

failure: final_failure

failure_timeout: final_failure_timeout

failure_retries: final_failure_retries

failure_exception: final_failure_exception

failure_guard: final_failure_guard

3.2.2.2.1 Drools Operational Policy Create/Update
'''''''''''''''''''''''''''''''''''''''''''''''''

TBD `Jorge Hernandez <file://localhost/display/~jhh>`__

3.2.2.2.2 APEX Operational Policy Create/Update
'''''''''''''''''''''''''''''''''''''''''''''''

The POST operation below with the TOSCA body below is used to create a
new Sample Domain test polict for the APEX Sample Domain operational
policy type.

*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.controloop.operational.apex/versions/1.0.0/policies POST*

**Create an APEX Policy for a Sample Domain**  Expand source

policies:

- onap.policy.operational.apex.sampledomain.Test:

type: onap.policies.controloop.operational.Apex

properties:

engine_service:

name: "MyApexEngine"

version: "0.0.1"

id: 45

instance_count: 4

deployment_port: 12561

policy_type_impl:
"onap.policies.controlloop.operational.apex.sampledomain.Impl"

engine:

executors:

JAVASCRIPT:
"org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"

inputs:

first_consumer:

carrier_technology:

label: "RESTCLIENT",

plugin_parameter_class_name:
"org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",

parameters:

url: "https://localhost:32801/EventGenerator/GetEvents"

event_protocol:

label: "JSON"

outputs:

first_producer:

carrier_technology:

label: "RESTCLIENT",

plugin_parameter_class_name:
"org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",

parameters:

url: "https://localhost:32801/EventGenerator/PostEvent"

event_protocol:

label: "JSON"

3.2.2.3 Guard Policy Create/Update
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TBD `Pamela Dragosh <file://localhost/display/~pdragosh>`__ Similar to
Operational Policies

3.2.2.4 Policy Lifecycle API - Creating Coordination Policies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TBD Similar to Operational Policies, stretch for Dublin

3.2.3 Policy Delete
~~~~~~~~~~~~~~~~~~~

The API also allows Policies to be deleted with a DELETE operation. The
format of the delete operation is as below:

=========================================================================================================================================== =========================================================================================================================================
**Example**                                                                                                                                 **Description**
=========================================================================================================================================== =========================================================================================================================================
*https:{url}:{port}/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.scaleout.tca DELETE* Deletes a Policy - all versions will be deleted.
                                                                                                                                           
                                                                                                                                            NOTE: The API call will fail if the policy has been deployed in one or more PDP Group. They must be undeployed first from all PDP Groups.
=========================================================================================================================================== =========================================================================================================================================

3.3 Policy Administration API
-----------------------------

The purpose of this API is to support CRUD of PDP groups and subgroups
and to support the deployment and life cycles of *PolicyImpl* entities
(TOSCA *Policy* and *PolicyTypeImpl* entities) on PDP sub groups and
PDPs. See Section 2 for details on policy deployment on PDP groups and
subgroups. This API is provided by the *PolicyAdministration* component
(PAP) of the Policy Framework, see `The ONAP Policy
Framework <file://localhost/display/DW/The+ONAP+Policy+Framework>`__
architecture.

PDP groups and subgroups may be prefedined in the system. Predefined
groups and subgroups may not be modified or deleted over this API.
However, the policies running on predefined groups or subgroups as well
as the instance counts and properties may be modified.

A PDP may be preconfigured with its PDP group, PDP subgroup, and
policies. The PDP sends this information to the PAP when it starts. If
the PDP group, subgroup, or any policy is unknown to the PAP, the PAP
locks the PDP in state PASSIVE.

The fields below are valid on API calls:

============= ====================== ======================== ========== ========================================================================= ===================================================================== ==============================================================================================
**Field**     **GET**                **POST**                 **DELETE** **Comment**                                                                                                                                    
============= ====================== ======================== ========== ========================================================================= ===================================================================== ==============================================================================================
name          M                      M                        M          The name of the PDP group                                                                                                                      
version       O                      M                        C          The version of the PDP group                                                                                                                   
state         R                      N/A                      N/A        The administrative state of the PDP group: PASSIVE, SAFE, TEST, or ACTIVE                                                                      
description   R                      O                        N/A        The PDP group description                                                                                                                      
properties    R                      O                        N/A        Specific properties for a PDP group                                                                                                            
pdp_subgroups R                      M                        N/A        A list of PDP subgroups for a PDP group                                                                                                        
\             pdp_type               R                        M          N/A                                                                       The PDP type of this PDP subgroup, currently xacml, drools, or apex  
\             supported_policy_types R                        N/A        N/A                                                                       A list of the policy types supported by the PDPs in this PDP subgroup
\             policies               R                        M          N/A                                                                       The list of policies running on the PDPs in this PDP subgroup        
\                                    (name)                   R          M                                                                         N/A                                                                   The name of a TOSCA policy running in this PDP subgroup
\                                    policy_type              R          N/A                                                                       N/A                                                                   The TOSCA policy type of the policy
\                                    policy_type_version      R          N/A                                                                       N/A                                                                   The version of the TOSCA policy type of the policy
\                                    policy_type_impl         R          C                                                                         N/A                                                                   The policy type implementation (XACML, Drools Rules, or APEX Model) that implements the policy
\             instance_count         R                        N/A        N/A                                                                       The number of PDP instances running in a PDP subgroup                
\             min_instance_count     O                        N/A        N/A                                                                       The minumum number of PDP instances to run in a PDP subgroup         
\             properties             O                        N/A        N/A                                                                       Deployment configuration or other properties for the PDP subgroup    
\             deployment_info        R                        N/A        N/A                                                                       Information on the deployment for a PDP subgroup                     
\             instances              R                        N/A        N/A                                                                       A list of PDP instances running in a PDP subgroup                    
\                                    instance                 R          N/A                                                                       N/A                                                                   The instance ID of a PDP running in a Kuberenetes Pod
\                                    state                    R          N/A                                                                       N/A                                                                   The administrative state of the PDP: PASSIVE, SAFE, TEST, or ACTIVE
\                                    healthy                  R          N/A                                                                       N/A                                                                   The result of the latest health check on the PDP: HEALTHY/NOT_HEALTHY/TEST_IN_PROGRESS
\                                    message                  O          N/A                                                                       N/A                                                                   A status message for the PDP if any
\                                    deployment_instance_info R          N/A                                                                       N/A                                                                   Information on the node running the PDP
============= ====================== ======================== ========== ========================================================================= ===================================================================== ==============================================================================================

Note: In the Dublin release, the *policy_type_impl* of all policy types
in a PDP subgroup must be the same.

YAML is used for illustrative purposes in the examples in this section.
JSON (application/json) will be used as the content type in the
implementation of this API.

3.3.1 PDP Group Query
~~~~~~~~~~~~~~~~~~~~~

This operation allows the PDP groups and subgroups to be listed together
with the policies that are deployed on each PDP group and subgroup.

*https:{url}:{port}/policy/pap/v1/pdps GET*

**PDP Group query for all PDP groups and Subgroups**  Expand source

pdp_groups:

- name: onap.pdpgroup.controlloop.Operational

version: 1.0.0

state: active

description: ONAP Control Loop Operational and Guard policies

  properties:

# PDP group level properties if any

pdp_subgroups:

pdp_type: drools

supported_policy_types:

- onap.controllloop.operational.drools.vCPE

- onap.controllloop.operational.drools.vFW

  policies:

- onap.controllloop.operational.drools.vCPE.eastRegion:

policy_type: onap.controllloop.operational.drools.vCPE

policy_type_version: 1.0.0

policy_type_impl: onap.controllloop.operational.drools.impl

- onap.controllloop.operational.drools.vFW.eastRegion:

policy_type: onap.controllloop.operational.drools.vFW

policy_type_version: 1.0.0

policy_type_impl: onap.controllloop.operational.drools.impl

min_instance_count: 3

 instance_count: 3

properties:

# The properties below are for illustration only

instance_spawn_load_threshold: 70%

instance_kill_load_threshold: 50%

instance_geo_redundancy: true

deployment_info:

service_endpoint: https://<the drools service endpoint for this PDP
group>

deployment: A deployment identifier

# Other deployment info

instances:

- instance: drools_1

state: active

healthy: yes

deployment_instance_info:

node_address: drools_1_pod

# Other deployment instance info

- instance: drools_2

state: active

healthy: yes

 deployment_instance_info:

node_address: drools_2_pod

# Other deployment instance info

- instance: drools_3

state: active

healthy: yes

 deployment_instance_info:

node_address: drools_3_pod

# Other deployment instance info

- pdp_type: apex

supported_policy_types:

- onap.controllloop.operational.apex.BBS

- onap.controllloop.operational.apex.SampleDomain

policies:

- onap.controllloop.operational.apex.BBS.eastRegion:

policy_type: onap.controllloop.operational.apex.BBS

policy_type_version: 1.0.0

policy_type_impl: onap.controllloop.operational.apex.impl

- onap.controllloop.operational.apex.sampledomain.eastRegion:

policy_type: onap.controllloop.operational.apex.SampleDomain

policy_type_version: 1.0.0

policy_type_impl: onap.controllloop.operational.apex.impl

min_instance_count: 2

 instance_count: 3

properties:

# The properties below are for illustration only

instance_spawn_load_threshold: 80%

instance_kill_load_threshold: 60%

instance_geo_redundancy: true

deployment_info:

service_endpoint: https://<the apex service endpoint for this PDP group>

deployment: A deployment identifier

# Other deployment info

instances:

- instance: apex_1

state: active

healthy: yes

  deployment_instance_info:

node_address: apex_1_podgroup

# Other deployment instance info

- instance: apex_2

deployment_instance_info:

node_address: apex_2_pod

# Other deployment instance infoCreation

- instance: apex_3

state: active

healthy: yes

  deployment_instance_info:

node_address: apex_3_pod

# Other deployment instance info

- pdp_type: xacml

supported_policy_types:

- onap.policies.controlloop.guard.FrequencyLimiter

  - onap.policies.controlloop.guard.BlackList

- onap.policies.controlloop.guard.MinMax

policies:

- onap.policies.controlloop.guard.frequencylimiter.EastRegion:

policy_type: onap.policies.controlloop.guard.FrequencyLimiter

policy_type_version: 1.0.0

policy_type_impl: onap.controllloop.guard.impl

- onap.policies.controlloop.guard.blackList.EastRegion:

policy_type: onap.policies.controlloop.guard.BlackList

policy_type_version: 1.0.0

policy_type_impl: onap.controllloop.guard.impl

- onap.policies.controlloop.Guard.MinMax.EastRegion:

policy_type: onap.policies.controlloop.guard.MinMax

policy_type_version: 1.0.0

policy_type_impl: onap.controllloop.guard.impl

min_instance_count: 2

  instance_count: 2

properties:

# The properties below are for illustration only

instance_geo_redundancy: true

deployment_info:

service_endpoint: https://<the XACML service endpoint for this PDP
group>

deployment: A deployment identifier

# Other deployment info

instances:

- instance: xacml_1

state: active

healthy: yes

 deployment_instance_info:

node_address: xacml_1_pod

# Other deployment instance info

- instance: xacml_2

state: active

healthy: yes

 deployment_instance_info:

node_address: xacml_2_pod

# Other deployment instance info

- name: onap.pdpgroup.monitoring

version: 2.1.3

state: active

description: DCAE mS Configuration Policies

properties:

# PDP group level properties if any

pdp_subgroups:

- pdp_type: xacml

supported_policy_types:

- onap.policies.monitoring.cdap.tca.hi.lo.app

policies:

- onap.scaleout.tca:

policy_type: onap.policies.monitoring.cdap.tca.hi.lo.app

policy_type_version: 1.0.0

policy_type_impl: onap.policies.monitoring.impl

min_instance_count: 2

 instance_count: 2

properties:

# The properties below are for illustration only

instance_geo_redundancy: true

deployment_info:

service_endpoint: https://<the XACML service endpoint for this PDP
group>

deployment: A deployment identifier

# Other deployment info

instances:

- instance: xacml_1

state: active

healthy: yes

 deployment_instance_info:

node_address: xacml_1_pod

# Other deployment instance info

- instance: xacml_2

state: active

healthy: yes

 deployment_instance_info:

node_address: xacml_2_pod

# Other deployment instance info

The table below shows some more examples of GET operations

======================================================================================= ================================================================
**Example**                                                                             **Description**
======================================================================================= ================================================================
*https:{url}:{port}/policy/pap/v1/pdps*                                                 Get all PDP Groups and subgroups in the system
*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.controlloop*                Get PDP Groups and subgroups that match the supplied name filter
*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.monitoring/subgroups/xacml* Get the PDP subgroup informtation for the specified subgroup
\                                                                                      
======================================================================================= ================================================================

3.3.2 PDP Group Deployment
~~~~~~~~~~~~~~~~~~~~~~~~~~

This operation allows the PDP groups and subgroups to be created. A POST
operation is used to create a new PDP group name. A POST operation is
also used to update an existing PDP group. Many PDP groups can be
created or updated in a single POST operation by specifying more than
one PDP group in the POST operation body.

*https:{url}:{port}/policy/pap/v1/pdps POST*

**POST body to deploy or update PDP groups**  Expand source

pdp_groups:

- name: onap.pdpgroup.controlloop.operational

description: ONAP Control Loop Operational and Guard policies

pdp_subgroups:

- pdp_type: drools

supportedPolicyTypes:

- onap.controllloop.operational.drools.vcpe.EastRegion

version: 1.2.3

- onap.controllloop.operational.drools.vfw.EastRegion

version: 1.2.3

min_instance_count: 3group

properties:

# The properties below are for illustration only

instance_spawn_load_threshold: 70%

instance_kill_load_threshold: 50%

instance_geo_redundancy: true

- pdp_type: apex

policies:

- onap.controllloop.operational.apex.bbs.EastRegion

version: 1.2.3

- onap.controllloop.operational.apex.sampledomain.EastRegion

version: 1.2.3

min_instance_count: 2

properties:

# The properties below are for illustration only

instance_spawn_load_threshold: 80%

instance_kill_load_threshold: 60%

instance_geo_redundancy: true

- pdp_type: xacml

policies:

- onap.policies.controlloop.guard.frequencylimiter.EastRegion

version: 1.2.3

- onap.policies.controlloop.guard.blacklist.EastRegion

version: 1.2.3

- onap.policies.controlloop.guard.minmax.EastRegion

version: 1.2.3

min_instance_count: 2

properties:

# The properties below are for illustration only

instance_geo_redundancy: true

- name: onap.pdpgroup.monitoring

description: DCAE mS Configuration Policies

properties:

# PDP group level properties if any

pdp_subgroups:

- pdp_type: xacml

policies:

- onap.scaleout.tca

version: 1.2.3

min_instance_count: 2

properties:

# The properties below are for illustration only

instance_geo_redundancy: true

Other systems such as CLAMP can use this API to deploy policies using a
POST operation with the body below where only mandatory fields are
specified.

*https:{url}:{port}/policy/pap/v1/pdps POST*

**POST body to deploy or update PDP groups**  Expand source

pdp_groups:

- name: onap.pdpgroup.Monitoring

description: DCAE mS Configuration Policies

pdp_subgroups:

- pdp_type: xacml

policies:

- onap.scaleout.tca

Simple API for CLAMP to deploy one or more policy-id's with optional policy-version.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*https:{url}:{port}/policy/pap/v1/pdps/policies POST*

Content-Type: application/json

{

"policies" : [

{

"policy-id": "onap.scaleout.tca",

"policy-version": 1

},

{

"policy-id": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3"

},

{

"policy-id":
"guard.frequency.ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3"

},

{

"policy-id":
"guard.minmax.ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3"

}

]

}

HTTP status code indicates success or failure.{

"errorDetails": "some error message"

}

Simple API for CLAMP to undeploy a policy-id with optional policy-version.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*https:{url}:{port}/policy/pap/v1/pdps/policies{policy-id} DELETE*

*https:{url}:{port}/policy/pap/v1/pdps/policies{policy-id}/versions/{policy-version}
DELETE*

HTTP status code indicates success or failure.

{

"errorDetails": "some error message"

}

3.3.3 PDP Group Delete
~~~~~~~~~~~~~~~~~~~~~~

The API also allows PDP groups to be deleted with a DELETE operation.
DELETE operations are only permitted on PDP groups in PASSIVE state. The
format of the delete operation is as below:

*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.monitoring
DELETE*

3.3.4 PDP Group State Management
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The state of PDP groups is managed by the API. PDP groups can be in
states PASSIVE, TEST, SAFE, or ACTIVE. For a full description of PDP
group states, see `The ONAP Policy
Framework <file://localhost/display/DW/The+ONAP+Policy+Framework>`__
architecture page. The state of a PDP group is changed with a PUT
operation.

The following PUT operation changes a PDP group to ACTIVE:

*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.monitoring/state=active*

There are a number of rules for state management:

1. Only one version of a PDP group may be ACTIVE at any time

2. If a PDP group with a certain version is ACTIVE and a later version
   of the same PDP group is activated, then the system upgrades the PDP
   group

3. If a PDP group with a certain version is ACTIVE and an earlier
   version of the same PDP group is activated, then the system
   downgrades the PDP group

4. There is no restriction on the number of PASSIVE versions of a PDP
   group that can exist in the system

5. <Rules on SAFE/TEST> ? `Pamela
   Dragosh <file://localhost/display/~pdragosh>`__

3.3.5 PDP Group Statistics
~~~~~~~~~~~~~~~~~~~~~~~~~~

This operation allows statistics for PDP groups, PDP subgroups, and
individual PDPs to be retrieved.

*https:{url}:{port}/policy/pap/v1/pdps/statistics GET*

**Draft Example statistics returned for a PDP Group**  Expand source

report_timestamp: 2019-02-11T15:23:50+00:00

pdp_group_count: 2

pdp_groups:

- name: onap.pdpgroup.controlloop.Operational

state: active

create_timestamp: 2019-02-11T15:23:50+00:00

update_timestamp: 2019-02-12T15:23:50+00:00

state_change_timestamp: 2019-02-13T15:23:50+00:00

pdp_subgroups:

- pdp_type: drools

instance_count: 3

deployed_policy_count: 2

policy_execution_count: 123

policy_execution_ok_count: 121

policy_execution_fail_count: 2

instances:

- instance: drools_1

start_timestamp: 2019-02-13T15:23:50+00:00

policy_execution_count: 50

policy_execution_ok_count: 49

policy_execution_fail_count: 1

- instance: drools_2

start_timestamp: 2019-02-13T15:30:50+00:00

policy_execution_count: 50

policy_execution_ok_count: 49

policy_execution_fail_count: 1

- instance: drools_3

start_timestamp: 2019-02-13T15:33:50+00:00

policy_execution_count: 23

policy_execution_ok_count: 23

policy_execution_fail_count: 0

The table below shows some more examples of GET operations for
statistics

================================================================================================== ===================================================================================
**Example**                                                                                        **Description**
================================================================================================== ===================================================================================
*https:{url}:{port}/policy/pap/v1/pdps/statistics*                                                 Get statistics for all PDP Groups and subgroups in the system
*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.controlloop/statistics*                Get statistics for all PDP Groups and subgroups that match the supplied name filter
*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.monitoring/subgroups/xacml/statistics* Get statistics for the specified subgroup
\                                                                                                 
================================================================================================== ===================================================================================

3.3.6 PDP Group Health Check
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A PDP group health check allows ordering of health checks on PDP groups
and on individual PDPs. As health checks may be long lived operations,
Health checks are scheduled for execution by this operation. Users check
the result of a health check test by issuing a PDP Group Query operation
(see Section 3.3.1) and checking the *healthy* field of PDPs.

*https:{url}:{port}/policy/pap/v1/pdps/healthcheck PUT*

The operation returns a HTTP status code of 202: Accepted if the health
check request has been accepted by the PAP. The PAP then orders
execution of the health check on the PDPs. The health check result is
retrieved with a subsequent GET operation.

The table below shows some more examples of PUT operations for ordering
health checks

======================================================================================================= ========================================================================================
**Example**                                                                                             **Description**
======================================================================================================= ========================================================================================
*https:{url}:{port}/policy/pap/v1/pdps/healthcheck PUT*                                                 Order a health check on all PDP Groups and subgroups in the system
*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.controlloop/healthcheck PUT*                Order a health check on all PDP Groups and subgroups that match the supplied name filter
*https:{url}:{port}/policy/pap/v1/pdps/groups/onap.pdpgroup.monitoring/subgroups/xacml/healthcheck PUT* Order a health check on the specified subgroup
\                                                                                                      
======================================================================================================= ========================================================================================

3.4 Policy Decision API - Getting Policy Decisions
--------------------------------------------------

Policy decisions are required by ONAP components to support the
policy-driven ONAP architecture. Policy Decisions are implemented using
the XACML PDP. The calling application must provide attributes in order
for the XACML PDP to return a correct decision.

3.4.1 Decision API Schema
~~~~~~~~~~~~~~~~~~~~~~~~~

The schema for the decision API is defined below.

3.4.2 Decision API Queries
~~~~~~~~~~~~~~~~~~~~~~~~~~

Decision API queries are implemented with a POST operation with a JSON
body that specifies the filter for the policies to be returned. The JSON
body must comply with the schema sepcified in Section 3.4.1.

*https:{url}:{port}/decision/v1/ POST*

*
*\ Description of the JSON Payload for the decision API Call

================================================================================================================ ======= ======== ==========================================================================
**Field**                                                                                                        **R/O** **Type** **Description**
================================================================================================================ ======= ======== ==========================================================================
ONAPName                                                                                                         R       String   Name of the ONAP Project that is making the request.
ONAPComponent                                                                                                    O       String   Name of the ONAP Project component that is making the request.
ONAPInstance                                                                                                     O       String   Optional instance identification for that ONAP component.
action                                                                                                           R       String   The action that the ONAP component is performing on a resource.
                                                                                                                                 
                                                                                                                                  eg. "configure" → DCAE uS onap.Monitoring policy Decisions to configure uS
                                                                                                                                 
                                                                                                                                  "naming"
                                                                                                                                 
                                                                                                                                  "placement"
                                                                                                                                 
                                                                                                                                  "guard"
These sub metadata structures are used to refine which resource the ONAP component is performing an action upon.                 
                                                                                                                                 
At least one is required in order for Policy to return a Decision.                                                               
                                                                                                                                 
Multiple structures may be utilized to help refine a Decision.                                                                   
policy-type-name                                                                                                         String   The policy type name. This may be a regular expression.
policy-id                                                                                                                String   The policy id. This may be a regular expression or an exact value.
\                                                                                                                                
\                                                                                                                                
\                                                                                                                                
================================================================================================================ ======= ======== ==========================================================================

This example below shows the JSON body of a query for a specify
policy-id

**Decision API Call - Policy ID**

{

"ONAPName": "DCAE",

"ONAPComponent": "PolicyHandler",

"ONAPInstance": "622431a4-9dea-4eae-b443-3b2164639c64",

"action": "configure",

"resource": {

"policy-id": "onap.scaleout.tca"

}

}

**Decision Response - Single Policy ID query**

{

"policies": {

"onap.scaleout.tca": {

"type": "onap.policies.monitoring.cdap.tca.hi.lo.app",

"version": "1.0.0",

"metadata": {

"policy-id": "onap.scaleout.tca",

"policy-version": 1

},

"properties": {

"tca_policy": {

"domain": "measurementsForVfScaling",

"metricsPerEventName": [

{

"eventName": "vLoadBalancer",

"controlLoopSchemaType": "VNF",

"policyScope": "type=configuration",

"policyName": "onap.scaleout.tca",

"policyVersion": "v0.0.1",

"thresholds": [

{

"closedLoopControlName":
"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 500,

"direction": "LESS_OR_EQUAL",

"severity": "MAJOR"

},

{

"closedLoopControlName":
"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 5000,

"direction": "GREATER_OR_EQUAL",

"severity": "CRITICAL"

}

]

}

]

}

}

}

}

}

*
*

This example below shows the JSON body of a query for a multiple
policy-id's

**Decision API Call - Policy ID**

{

"ONAPName": "DCAE",

"ONAPComponent": "PolicyHandler",

"ONAPInstance": "622431a4-9dea-4eae-b443-3b2164639c64",

"action": "configure",

"resource": {

"policy-id": [

"onap.scaleout.tca",

"onap.restart.tca"

]

}

}

The following is the response object:

**Decision Response - Single Policy ID query**

{

"policies": {

"onap.scaleout.tca": {

"type": "onap.policies.monitoring.cdap.tca.hi.lo.app",

"version": "1.0.0",

"metadata": {

"policy-id": "onap.scaleout.tca"

},

"properties": {

"tca_policy": {

"domain": "measurementsForVfScaling",

"metricsPerEventName": [

{

"eventName": "vLoadBalancer",

"controlLoopSchemaType": "VNF",

"policyScope": "type=configuration",

"policyName": "onap.scaleout.tca",

"policyVersion": "v0.0.1",

"thresholds": [

{

"closedLoopControlName":
"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 500,

"direction": "LESS_OR_EQUAL",

"severity": "MAJOR"

},

{

"closedLoopControlName":
"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 5000,

"direction": "GREATER_OR_EQUAL",

"severity": "CRITICAL"

}

]

}

]

}

}

},

"onap.restart.tca": {

"type": "onap.policies.monitoring.cdap.tca.hi.lo.app",

"version": "1.0.0",

"metadata": {

"policy-id": "onap.restart.tca",

"policy-version": 1

},

"properties": {

"tca_policy": {

"domain": "measurementsForVfScaling",

"metricsPerEventName": [

{

"eventName": "Measurement_vGMUX",

"controlLoopSchemaType": "VNF",

"policyScope": "DCAE",

"policyName": "DCAE.Config_tca-hi-lo",

"policyVersion": "v0.0.1",

"thresholds": [

{

"closedLoopControlName":
"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",

"thresholdValue": 0,

"direction": "EQUAL",

"severity": "MAJOR",

"closedLoopEventStatus": "ABATED"

},

{

"closedLoopControlName":
"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",

"thresholdValue": 0,

"direction": "GREATER",

"severity": "CRITICAL",

"closedLoopEventStatus": "ONSET"

}

]

}

]

}

}

}

}

}

*
*

The simple draft example below shows the JSON body of a query in which
all the deployed policies for a specific policy type are returned.

{

"ONAPName": "DCAE",

"ONAPComponent": "PolicyHandler",

"ONAPInstance": "622431a4-9dea-4eae-b443-3b2164639c64",

"action": "configure",

"resource": {

"policy-type": "onap.policies.monitoring.cdap.tca.hi.lo.app"

}

}

The query above gives a response similar to the example shown below.

{

"policies": {

"onap.scaleout.tca": {

"type": "onap.policies.monitoring.cdap.tca.hi.lo.app",

"version": "1.0.0",

"metadata": {

"policy-id": "onap.scaleout.tca",

"policy-version": 1,

},

"properties": {

"tca_policy": {

"domain": "measurementsForVfScaling",

"metricsPerEventName": [

{

"eventName": "vLoadBalancer",

"controlLoopSchemaType": "VNF",

"policyScope": "type=configuration",

"policyName": "onap.scaleout.tca",

"policyVersion": "v0.0.1",

"thresholds": [

{

"closedLoopControlName":
"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 500,

"direction": "LESS_OR_EQUAL",

"severity": "MAJOR"

},

{

"closedLoopControlName":
"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 5000,

"direction": "GREATER_OR_EQUAL",

"severity": "CRITICAL"

}

]

}

]

}

}

},

"onap.restart.tca": {

"type": "onap.policies.monitoring.cdap.tca.hi.lo.app",

"version": "1.0.0",

"metadata": {

"policy-id": "onap.restart.tca",

"policy-version": 1

},

"properties": {

"tca_policy": {

"domain": "measurementsForVfScaling",

"metricsPerEventName": [

{

"eventName": "Measurement_vGMUX",

"controlLoopSchemaType": "VNF",

"policyScope": "DCAE",

"policyName": "DCAE.Config_tca-hi-lo",

"policyVersion": "v0.0.1",

"thresholds": [

{

"closedLoopControlName":
"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",

"thresholdValue": 0,

"direction": "EQUAL",

"severity": "MAJOR",

"closedLoopEventStatus": "ABATED"

},

{

"closedLoopControlName":
"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",

"thresholdValue": 0,

"direction": "GREATER",

"severity": "CRITICAL",

"closedLoopEventStatus": "ONSET"

}

]

}

]

}

}

},

"onap.vfirewall.tca": {

"type": "onap.policy.monitoring.cdap.tca.hi.lo.app",

"version": "1.0.0",

"metadata": {

"policy-id": "onap.vfirewall.tca",

"policy-version": 1

},

"properties": {

"tca_policy": {

"domain": "measurementsForVfScaling",

"metricsPerEventName": [

{

"eventName": "vLoadBalancer",

"controlLoopSchemaType": "VNF",

"policyScope": "resource=vLoadBalancer;type=configuration",

"policyName": "onap.vfirewall.tca",

"policyVersion": "v0.0.1",

"thresholds": [

{

"closedLoopControlName":
"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 500,

"direction": "LESS_OR_EQUAL",

"severity": "MAJOR"

},

{

"closedLoopControlName":
"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",

"closedLoopEventStatus": "ONSET",

"version": "1.0.2",

"fieldPath":
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",

"thresholdValue": 5000,

"direction": "GREATER_OR_EQUAL",

"severity": "CRITICAL"

}

]

}

]

}

}

}

}

}

4. Policy Framework Internal APIs
=================================

The Policy Framework uses the internal APIs documented in the
subsections below. The APIs in this section are used for internal
communication in the Policy Framework. The APIs are NOT supported for
use by components outside the Policy Framework and are subject to
revision and change at any time.

4.1 PAP to PDP API
------------------

This section describes the API between the PAP and PDPs. The APIs in
this section are implemented using `DMaaP
API <file://localhost/display/DW/DMaaP+API>`__ messaging. There are four
messages on the API:

1. PDP_STATUS: PDP→PAP, used by PDPs to report to the PAP

2. PDP_UPDATE: PAP→PDP, used by the PAP to update the policies running
   on PDPs, triggers a PDP_STATUS message with the result of the
   PDP_UPDATE operation

3. PDP_STATE_CHANGE: PAP→PDP, used by the PAP to change the state of
   PDPs, triggers a PDP_STATUS message with the result of the
   PDP_STATE_CHANGE operation

4. PDP_HEALTH_CHECK: PAP→PDP, used by the PAP to order a heakth check on
   PDPs, triggers a PDP_STATUS message with the result of the
   PDP_HEALTH_CHECK operation

The fields below are valid on API calls:

======================== ============================= ======== ======== ======= ====================================================================================================================================== ==================================================================================================================================================================================================
**Field**                **PDP                         **PDP    **PDP    **PDP   **Comment**                                                                                                                           
                         STATUS**                      UPDATE** STATE    HEALTH                                                                                                                                        
                                                                CHANGE** CHECK**                                                                                                                                       
======================== ============================= ======== ======== ======= ====================================================================================================================================== ==================================================================================================================================================================================================
(message_name)           M                             M        M        M       pdp_status, pdp_update, pdp_state_change, or pdp_health_check                                                                         
name                     M                             M        C        C       The name of the PDP, for state changes and health checks, the PDP group and subgroup can be used to specify the scope of the operation
version                  M                             N/A      N/A      N/A     The version of the PDP                                                                                                                
pdp_type                 M                             M        N/A      N/A     The type of the PDP, currently xacml, drools, or apex                                                                                 
state                    M                             N/A      M        N/A     The administrative state of the PDP group: PASSIVE, SAFE, TEST, ACTIVE, or TERMINATED                                                 
healthy                  M                             N/A      N/A      N/A     The result of the latest health check on the PDP: HEALTHY/NOT_HEALTHY/TEST_IN_PROGRESS                                                
description              O                             O        N/A      N/A     The description of the PDP                                                                                                            
pdp_group                O                             M        C        C       The PDP group to which the PDP belongs, the PDP group and subgroup can be used to specify the scope of the operation                  
pdp_subgroup             O                             M        C        C       The PDP subgroup to which the PDP belongs, the PDP group and subgroup can be used to specify the scope of the operation               
supported_policy_types   M                             N/A      N/A      N/A     A list of the policy types supported by the PDP                                                                                       
policies                 O                             M        N/A      N/A     The list of policies running on the PDP                                                                                               
\                        (name)                        O        M        N/A     N/A                                                                                                                                    The name of a TOSCA policy running on the PDP
\                        policy_type                   O        M        N/A     N/A                                                                                                                                    The TOSCA policy type of the policyWhen a PDP starts, it commences periodic sending of *PDP_STATUS* messages on DMaaP. The PAP receives these messages and acts in whatever manner is appropriate.
\                        policy_type_version           O        M        N/A     N/A                                                                                                                                    The version of the TOSCA policy type of the policy
\                        properties                    O        M        N/A     N/A                                                                                                                                    The properties of the policy for the XACML, Drools, or APEX PDP, see section 3.2 for details
instance                 M                             N/A      N/A      N/A     The instance ID of the PDP running in a Kuberenetes Pod                                                                               
deployment_instance_info M                             N/A      N/A      N/A     Information on the node running the PDP                                                                                               
properties               O                             O        N/A      N/A     Other properties specific to the PDP                                                                                                  
statistics               M                             N/A      N/A      N/A     Statistics on policy execution in the PDP                                                                                             
\                        policy_download_count         M        N/A      N/A     N/A                                                                                                                                    The number of policies downloaded into the PDP
\                        policy_download_success_count M        N/A      N/A     N/A                                                                                                                                    The number of policies successfully downloaded into the PDP
\                        policy_download_fail_count    M        N/A      N/A     N/A                                                                                                                                    The number of policies downloaded into the PDP where the download failed
\                        policy_executed_count         M        N/A      N/A     N/A                                                                                                                                    The number of policy executions on the PDP
\                        policy_executed_success_count M        N/A      N/A     N/A                                                                                                                                    The number of policy executions on the PDP that completed successfully
\                        policy_executed_fail_count    M        N/A      N/A     N/A                                                                                                                                    The number of policy executions on the PDP that failed
response                 O                             N/A      N/A      N/A     The response to the last operation that the PAP executed on the PDP                                                                   
\                        response_to                   M        N/A      N/A     N/A                                                                                                                                    The PAP to PDP message to which this is a response
\                        response_status               M        N/A      N/A     N/A                                                                                                                                    SUCCESS or FAIL
\                        response_message              O        N/A      N/A     N/A                                                                                                                                    Message giving further information on the successful or failed operation
======================== ============================= ======== ======== ======= ====================================================================================================================================== ==================================================================================================================================================================================================

YAML is used for illustrative purposes in the examples in this section.
JSON (application/json) is used as the content type in the
implementation of this API.

| Note: The PAP checks that the set of policy types supported in all
  PDPs in a PDP subgroup are identical and will not add a PDP to a PDP
  subgroup that has a different set of supported policy types
| Note: The PA checks that the set of policy loaded on all PDPs in a PDP
  subgroup are are identical and will not add a PDP to a PDP subgroup
  that has a different set of loaded policies

4.1.1 PAP API for PDPs
~~~~~~~~~~~~~~~~~~~~~~

The purpose of this API is for PDPs to provide heartbeat, status.
health, and statistical information to Policy Administration. There is a
single *PDP_STATUS* message on this API. PDPs send this message to the
PAP using the *POLICY_PDP_PAP* DMaaP topic. The PAP listens on this
topic for messages.

When a PDP starts, it commences periodic sending of *PDP_STATUS*
messages on DMaaP. The PAP receives these messages and acts in whatever
manner is appropriate. *PDP_UPDATE*, *PDP_STATE_CHANGE*, and
*PDP_HEALTH_CHECK* operations trigger a *PDP_STATUS* message as a
response.

The *PDP_STATUS* message is used for PDP heartbeat monitoring. A PDP
sends a *PDP_STATUS* message with a state of \ *TERMINATED* when it
terminates normally. If a \ *PDP_STATUS* message is not received from a
PDP in a certain configurable time, then the PAP assumes the PDP has
failed.

A PDP may be preconfigured with its PDP group, PDP subgroup, and
policies. If the PDP group, subgroup, or any policy sent to the PAP in a
*PDP_STATUS* message is unknown to the PAP, the PAP locks the PDP in
state PASSIVE.

**PDP_STATUS message from an XACML PDP running control loop policies**
 Expand source

pdp_status:

name: xacml_1

version: 1.2.3

pdp_type: xacml

state: active

healthy: true

 description: XACML PDP running control loop policies

pdp_group: onap.pdpgroup.controlloop.operational

pdp_subgroup: xacml

supported_policy_types:

- onap.policies.controlloop.guard.FrequencyLimiter

- onap.policies.controlloop.guard.BlackList

- onap.policies.controlloop.guard.MinMax

 policies:

- onap.policies.controlloop.guard.frequencylimiter.EastRegion:

policy_type: onap.policies.controlloop.guard.FrequencyLimiter

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

 - onap.policies.controlloop.guard.blacklist.eastRegion:

policy_type: onap.policies.controlloop.guard.BlackList

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

- onap.policies.controlloop.guard.minmax.eastRegion:

policy_type: onap.policies.controlloop.guard.MinMax

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

instance: xacml_1

deployment_instance_info:

node_address: xacml_1_pod

# Other deployment instance info

statistics:

policy_download_count: 0

policy_download_success_count: 0

policy_download_fail_count: 0

policy_executed_count: 123

policy_executed_success_count: 122

policy_executed_fail_count: 1

**PDP_STATUS message from a Drools PDP running control loop policies**
 Expand source

pdp_status:

name: drools_2

version: 2.3.4

pdp_type: drools

state: safe

healthy: true

 description: Drools PDP running control loop policies

pdp_group: onap.pdpgroup.controlloop.operational

pdp_subgroup: drools

supported_policy_types:

- onap.controllloop.operational.drools.vCPE

  - onap.controllloop.operational.drools.vFW

policies:

- onap.controllloop.operational.drools.vcpe.EastRegion:

policy_type: onap.controllloop.operational.drools.vCPE

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

- onap.controllloop.operational.drools.vfw.EastRegion:

policy_type: onap.controllloop.operational.drools.vFW

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

instance: drools_2

deployment_instance_info:

node_address: drools_2_pod

# Other deployment instance info

statistics:

policy_download_count: 3

policy_download_success_count: 3

policy_download_fail_count: 0

policy_executed_count: 123

policy_executed_success_count: 122

policy_executed_fail_count: 1

response:

response_to: PDP_HEALTH_CHECK

response_status: SUCCESS

**PDP_STATUS message from an APEX PDP running control loop policies**
 Expand source

pdp_status:

name: apex_3

version: 2.2.1

pdp_type: apex

state: test

healthy: true

 description: APEX PDP running control loop policies

pdp_group: onap.pdpgroup.controlloop.operational

pdp_subgroup: apex

supported_policy_types:

- onap.controllloop.operational.apex.BBS

- onap.controllloop.operational.apex.SampleDomain

policies:

- onap.controllloop.operational.apex.bbs.EastRegion:

policy_type: onap.controllloop.operational.apex.BBS

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

- onap.controllloop.operational.apex.sampledomain.EastRegion:

policy_type: onap.controllloop.operational.apex.SampleDomain

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

instance: apex_3

deployment_instance_info:node_address

node_address: apex_3_pod

# Other deployment instance info

statistics:

policy_download_count: 2

policy_download_success_count: 2

policy_download_fail_count: 0

policy_executed_count: 123

policy_executed_success_count: 122

policy_executed_fail_count: 1

response:

response_to: PDP_UPDATE

response_status: FAIL

response_message: policies specified in update message incompatible with
running policy state

**PDP_STATUS message from an XACML PDP running monitoring policies**
 Expand source

pdp_status:

  name: xacml_1

version: 1.2.3

pdp_type: xacml

state: active

healthy: true

 description: XACML PDP running monitoring policies

pdp_group: onap.pdpgroup.Monitoring

pdp_subgroup: xacml

supported_policy_types:

- onap.monitoring.cdap.tca.hi.lo.app

policies:

- onap.scaleout.tca:message

policy_type: onap.policies.monitoring.cdap.tca.hi.lo.app

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

instance: xacml_1

deployment_instance_info:

node_address: xacml_1_pod

# Other deployment instance info

statistics:

policy_download_count: 0

policy_download_success_count: 0

policy_download_fail_count: 0

policy_executed_count: 123

policy_executed_success_count: 122

policy_executed_fail_count: 1

4.1.2 PDP API for PAPs
~~~~~~~~~~~~~~~~~~~~~~

The purpose of this API is for the PAP to load and update policies on
PDPs and to change the state of PDPs. It also allows the PAP to order
health checks to run on PDPs. The PAP sends \ *PDP_UPDATE*, \ *PDP\_*
STATE_CHANGE, and *PDP_HEALTH_CHECK* messages to PDPs using the
*POLICY_PAP_PDP* DMaaP topic. PDPs listens on this topic for messages.

The PAP can set the scope of STATE_CHANGE, and *PDP_HEALTH_CHECK*
messages:

-  PDP Group: If a PDP group is specified in a message, then the PDPs in
   that PDP group respond to the message and all other PDPs ignore it.

-  PDP Group and subgroup: If a PDP group and subgroup are specified in
   a message, then only the PDPs of that subgroup in the PDP group
   respond to the message and all other PDPs ignore it.

-  Single PDP: If the name of a PDP is specified in a message, then only
   that PDP responds to the message and all other PDPs ignore it.

Note: *PDP_UPDATE* messages must be issued individually to PDPs because
the *PDP_UPDATE* operation can change the PDP group to which a PDP
belongs.

4.1.2.1 PDP Update
^^^^^^^^^^^^^^^^^^

The *PDP_UPDATE* operation allows the PAP to modify the PDP group to
which a PDP belongs and the policies in a PDP.  Only PDPs in state
PASSIVE accept this operation. The PAP must change the state of PDPs in
state ACTIVE, TEST, or SAFE to state PASSIVE before issuing a
*PDP_UPDATE* operation on a PDP.

The following examples illustrate how the operation is used.

**PDP_UPDATE message to upgrade XACML PDP control loop policies to
versino 1.0.1**  Expand source

pdp_update:

name: xacml_1

pdp_type: xacml

description: XACML PDP running control loop policies, Upgraded

pdp_group: onap.pdpgroup.controlloop.operational

pdp_subgroup: xacml

policies:

- onap.policies.controlloop.guard.frequencylimiter.EastRegion:

policy_type: onap.policies.controlloop.guard.FrequencyLimiter

policy_type_version: 1.0.1

properties:

# Omitted for brevity, see Section 3.2

- onap.policies.controlloop.guard.blackList.EastRegion:

policy_type: onap.policies.controlloop.guard.BlackList

policy_type_version: 1.0.1

properties:

# Omitted for brevity, see Section 3.2

- onap.policies.controlloop.guard.minmax.EastRegion:

policy_type: onap.policies.controlloop.guard.MinMax

policy_type_version: 1.0.1

properties:

# Omitted for brevity, see Section 3.2

**PDP_UPDATE message to a Drools PDP to add an extra control loop
policy**  Expand source

pdp_update:

name: drools_2

pdp_type: drools

description: Drools PDP running control loop policies, extra policy
added

pdp_group: onap.pdpgroup.controlloop.operational

pdp_subgroup: drools

policies:

- onap.controllloop.operational.drools.vcpe.EastRegion:

policy_type: onap.controllloop.operational.drools.vCPE

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

- onap.controllloop.operational.drools.vfw.EastRegion:

policy_type: onap.controllloop.operational.drools.vFW

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

- onap.controllloop.operational.drools.vfw.WestRegion:

policy_type: onap.controllloop.operational.drools.vFW

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

**PDP_UPDATE message to an APEX PDP to remove a control loop policy**
 Expand source

pdp_update:

name: apex_3

pdp_type: apex

 description: APEX PDP updated to remove a control loop policy

pdp_group: onap.pdpgroup.controlloop.operational

pdp_subgroup: apex

policies:

- onap.controllloop.operational.apex.bbs.EastRegion:

policy_type: onap.controllloop.operational.apex.BBS

policy_type_version: 1.0.0

properties:

# Omitted for brevity, see Section 3.2

4.1.2.2 PDP State Change
^^^^^^^^^^^^^^^^^^^^^^^^

The *PDP_STATE_CHANGE* operation allows the PAP to order state changes
on PDPs in PDP groups and subgroups. The following examples illustrate
how the operation is used.

**Change the state of all control loop Drools PDPs to ACTIVE**  Expand
source

pdp_state_change:

state: active

pdp_group: onap.pdpgroup.controlloop.Operational

pdp_subgroup: drools

**Change the state of all monitoring PDPs to SAFE**  Expand source

pdp_state_change:

state: safe

pdp_group: onap.pdpgroup.Monitoring

**Change the state of a single APEX PDP to TEST**  Expand source

pdp_state_change:

state: test

name: apex_3

4.1.2.3 PDP Health Check
^^^^^^^^^^^^^^^^^^^^^^^^

The *PDP_HEALTH_CHECK* operation allows the PAP to order health checks
on PDPs in PDP groups and subgroups. The following examples illustrate
how the operation is used.

**Perform a health check on all control loop Drools PDPs**  Expand
source

pdp_health_check:

pdp_group: onap.pdpgroup.controlloop.Operational

pdp_subgroup: drools

**perform a health check on all monitoring PDPs**  Expand source

pdp_health_check:

pdp_group: onap.pdpgroup.Monitoring

**Perform a health check on a single APEX PDP**  Expand source

pdp_health_check:

name: apex_3

4.2 Policy Type Implementations (Native Policies)
-------------------------------------------------

The policy Framework must have implementations for all Policy Type
entities that may be specified in TOSCA. Policy type implementations are
native policies for the various PDPs supported in the Policy Framework.
They may be predefined and preloaded into the Policy Framework. In
addition, they may also be added, modified, queried, or deleted using
this API during runtime.

The API supports CRUD of *PolicyTypeImpl* policy type implementations,
where the XACML, Drools, and APEX policy type implementations are
supplied as strings. This API is provided by the *PolicyDevelopment*
component of the Policy Framework, see `The ONAP Policy
Framework <file://localhost/display/DW/The+ONAP+Policy+Framework>`__
architecture.

| Note that client-side editing support for TOSCA *PolicyType*
  definitions or for *PolicyTypeImpl* implementations in XACML, Drools,
  or APEX is outside the current scope of the API.
| Note: Preloaded policy type implementations may only be queried over
  this API, modification or deletion of preloaded policy type
  implementations is disabled.
| Note: Policy type implementations that are in use (referenced by
  defined Policies) may not be deleted.

The fields below are valid on API calls:

=========== ======= ======== ========== ==========================================================================================================================
**Field**   **GET** **POST** **DELETE** **Comment**
=========== ======= ======== ========== ==========================================================================================================================
name        M       M        M          The name of the Policy Type implementation
version     O       M        C          The version of the Policy Type implementation
policy_type R       M        N/A        The TOSCA policy type that this policy type implementation implements
pdp_type    R       M        N/A        The PDP type of this policy type implementation, currently xacml, drools, or apex
description R       O        N/A        The description of the policy type implementation
writable    R       N/A      N/A        Writable flag, false for predefined policy type implementations, true for policy type implementations defined over the API
policy_body R       M        N/A        The body (source) of the policy type implementation
properties  R       O        N/A        Specific properties for the policy type implementation
=========== ======= ======== ========== ==========================================================================================================================

4.2.1 Policy Type Implementation Query
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This operation allows the PDP groups and subgroups to be listed together
with the policies that are deployed on each PDP group and subgroup.

*https:{url}:{port}/policy/api/v1/native/onap.policies.controlloop.operational/impls
GET*

**Policy Type Implementation Query Result**  Expand source

policy_type_impls:

- name: onap.policies.controlloop.operational.drools.Impl

version: 1.0.0

policy_type: onap.policies.controlloop.Operational

pdp_type: drools

description: Implementation of the drools control loop policies

writable: false

- name: onap.policies.controlloop.operational.apex.bbs.Impl

version: 1.0.0

policy_type: onap.policies.controlloop.operational.Apex

pdp_type: apex

description: Implementation of the APEX BBS control loop policy

writable: true

policy_body: "<policy body>"

- name: onap.policies.controlloop.operational.apex.sampledomain.Impl

version: 1.0.0

policy_type: onap.policies.controlloop.operational.Apex

pdp_type: apex

description: Implementation of the SampleDomain test APEX policy

writable: true

policy_body: "<policy body>"

The table below shows some more examples of GET operations

========================================================================================================================================================================= ==========================================================================================================================================================
**Example**                                                                                                                                                               **Description**
========================================================================================================================================================================= ==========================================================================================================================================================
*https:{url}:{port}/policy/api/v1/native/{policy type id}/impls*                                                                                                          Get all Policy Type implementations for the given policy type
                                                                                                                                                                         
| *eg.*                                                                                                                                                                  
| *https:{url}:{port}/policy/api/v1/native/onap.policies.monitoring/impls*                                                                                               
| *https:{url}:{port}/policy/api/v1/native/onap.policies.controlloop.operational.apex/impls*                                                                             
*https:{url}:{port}/policy/api/v1/native/{policy type id}/impls/{policy type impl id}*                                                                                    Get all Policy Type implementation versions that match the policy type and policy type implementation IDs specified
                                                                                                                                                                         
| *eg.*                                                                                                                                                                  
| *https:{url}:{port}/policy/api/v1/native/onap.policies.controlloop.operational/impls/onap.policies.controlloop.operational.drools.impl*                                
| *https:{url}:{port}/policy/api/v1/native/onap.policies.controlloop.operational.apex/impls/onap.policies.controlloop.operational.apex.sampledomain.impl*                
*https:{url}:{port}/policy/api/v1/native/{policy type id}/impls/{policy type impl id}/versions/{version id}*                                                              Get the specific Policy Type implementation with the specified name and version, if the version ID is specified a *latest*, the latest version is returned
                                                                                                                                                                         
| *eg.*                                                                                                                                                                  
| *https:{url}:{port}/policy/api/v1/native/onap.policies.controlloop.operational/impls/onap.policies.controlloop.operational.drools.impl/versions/1.2.3*                 
| *https:{url}:{port}/policy/api/v1/native/onap.policies.controlloop.operational.apex/impls/onap.policies.controlloop.operational.apex.sampledomain.impl/versions/latest*
========================================================================================================================================================================= ==========================================================================================================================================================

4.2.2 Policy Type Implementation Create/Update
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The API allows users (such as a policy editor or DevOps system) to
create or update a Policy Type implementation using a POST operation.
This API allows new Policy Type implementations to be created or
existing Policy Type implementations to be modified. POST operations
with a new name or a new version of an existing name are used to create
a new Policy Type implementation. POST operations with an existing name
and version are used to update an existing Policy Type implementations.
Many implementations can be created or updated in a single POST
operation by specifying more than one Policy Type implementation on the
*policy_type_impls* list.

For example, the POST operation below with the YAML body below is used
to create a new APEX Policy type implementation.

*https:{url}:{port}/policy/api/v1/native/onap.policies.controlloop.operational.apex/impls
POST*

**Create a new Policy Type Implementation**  Expand source

policy_type_impls:

- onap.policies.controlloop.operational.apex.bbs.Impl:

version: 1.0.0

policy_type: onap.policies.controlloop.operational.Apex

pdp_type: apex

description: Implementation of the APEX BBS control loop policy

policy_body: "<policy body>"

- onap.policies.controlloop.operational.apex.sampledomain.Impl:

version: 1.0.0

policy_type: onap.policies.controlloop.operational.Apex

pdp_type: apex

description: Implementation of the APEX SampleDomain control loop policy

policy_body: "<policy body>

Once this call is made, the Policy Type query in Section 3.1.2.1 returns
a result with the new Policy Type implementation defined.

4.2.3 Policy Type Implementation Delete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The API also allows Policy Type implementations to be deleted with a
DELETE operation. The format of the delete operation is as below:

*https:{url}:{port}/api/v1/native/onap.policies.controlloop.operational.apex/impls/onap.policies.apex.bbs.impl/versions/1.0.0
DELETE*

| Note: Predefined policy type implementations cannot be deleted
| Note: Policy type implementations that are in use (Parameterized by a
  TOSCA Policy) may not be deleted, the parameterizing TOSCA policies
  must be deleted first
| Note: The *version* parameter may be omitted on the DELETE operation
  if there is only one version of the policy type implementation in the
  system