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
|
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
source _functions.sh
base_url_clm=${base_url_clm:-"http://10.10.10.6:31856/v2"}
base_url_ncm=${base_url_ncm:-"http://10.10.10.6:32737/v2"}
base_url_orchestrator=${base_url_orchestrator:-"http://10.10.10.6:31298/v2"}
base_url_ovnaction=${base_url_ovnaction:-"http://10.10.10.6:31181/v2"}
# add clusters to clm
# TODO one is added by default, add more if vfw demo is
# extended to multiple clusters
clusterprovidername="vfw-cluster-provider"
clusterproviderdata="$(cat<<EOF
{
"metadata": {
"name": "$clusterprovidername",
"description": "description of $clusterprovidername",
"userData1": "$clusterprovidername user data 1",
"userData2": "$clusterprovidername user data 2"
}
}
EOF
)"
clustername="edge01"
clusterdata="$(cat<<EOF
{
"metadata": {
"name": "$clustername",
"description": "description of $clustername",
"userData1": "$clustername user data 1",
"userData2": "$clustername user data 2"
}
}
EOF
)"
# set $kubeconfigfile before running script to point to the desired config file
kubeconfigfile=${kubeconfigfile:-"oops"}
# TODO consider demo of cluster label based placement
# could use to onboard multiple clusters for vfw
# but still deploy to just 1 cluster based on label
labelname="LabelA"
labeldata="$(cat<<EOF
{"label-name": "$labelname"}
EOF
)"
clustername2="edge02"
clusterdata2="$(cat<<EOF
{
"metadata": {
"name": "$clustername2",
"description": "description of $clustername2",
"userData1": "$clustername2 user data 1",
"userData2": "$clustername2 user data 2"
}
}
EOF
)"
# set $kubeconfigfile2 before running script to point to the desired config file
kubeconfigfile2=${kubeconfigfile2:-"oops"}
# TODO consider demo of cluster label based placement
# could use to onboard multiple clusters for vfw
# but still deploy to just 1 cluster based on label
labelname2="LabelA"
labeldata2="$(cat<<EOF
{"label-name": "$labelname"}
EOF
)"
# add the rsync controller entry
rsynccontrollername="rsync"
rsynccontrollerdata="$(cat<<EOF
{
"metadata": {
"name": "rsync",
"description": "description of $rsynccontrollername controller",
"userData1": "user data 1 for $rsynccontrollername",
"userData2": "user data 2 for $rsynccontrollername"
},
"spec": {
"host": "${rsynccontrollername}",
"port": 9041
}
}
EOF
)"
# add the rsync controller entry
ovnactioncontrollername="ovnaction"
ovnactioncontrollerdata="$(cat<<EOF
{
"metadata": {
"name": "$ovnactioncontrollername",
"description": "description of $ovnactioncontrollername controller",
"userData1": "user data 2 for $ovnactioncontrollername",
"userData2": "user data 2 for $ovnactioncontrollername"
},
"spec": {
"host": "${ovnactioncontrollername}",
"type": "action",
"priority": 1,
"port": 9053
}
}
EOF
)"
# define networks and providernetworks intents to ncm for the clusters
# define emco-private-net and unprotexted-private-net as provider networks
emcoprovidernetworkname="emco-private-net"
emcoprovidernetworkdata="$(cat<<EOF
{
"metadata": {
"name": "$emcoprovidernetworkname",
"description": "description of $emcoprovidernetworkname",
"userData1": "user data 1 for $emcoprovidernetworkname",
"userData2": "user data 2 for $emcoprovidernetworkname"
},
"spec": {
"cniType": "ovn4nfv",
"ipv4Subnets": [
{
"subnet": "10.10.20.0/24",
"name": "subnet1",
"gateway": "10.10.20.1/24"
}
],
"providerNetType": "VLAN",
"vlan": {
"vlanId": "102",
"providerInterfaceName": "eth1",
"logicalInterfaceName": "eth1.102",
"vlanNodeSelector": "specific",
"nodeLabelList": [
"kubernetes.io/hostname=localhost"
]
}
}
}
EOF
)"
unprotectedprovidernetworkname="unprotected-private-net"
unprotectedprovidernetworkdata="$(cat<<EOF
{
"metadata": {
"name": "$unprotectedprovidernetworkname",
"description": "description of $unprotectedprovidernetworkname",
"userData1": "user data 2 for $unprotectedprovidernetworkname",
"userData2": "user data 2 for $unprotectedprovidernetworkname"
},
"spec": {
"cniType": "ovn4nfv",
"ipv4Subnets": [
{
"subnet": "192.168.10.0/24",
"name": "subnet1",
"gateway": "192.168.10.1/24"
}
],
"providerNetType": "VLAN",
"vlan": {
"vlanId": "100",
"providerInterfaceName": "eth1",
"logicalInterfaceName": "eth1.100",
"vlanNodeSelector": "specific",
"nodeLabelList": [
"kubernetes.io/hostname=localhost"
]
}
}
}
EOF
)"
protectednetworkname="protected-private-net"
protectednetworkdata="$(cat<<EOF
{
"metadata": {
"name": "$protectednetworkname",
"description": "description of $protectednetworkname",
"userData1": "user data 1 for $protectednetworkname",
"userData2": "user data 1 for $protectednetworkname"
},
"spec": {
"cniType": "ovn4nfv",
"ipv4Subnets": [
{
"subnet": "192.168.20.0/24",
"name": "subnet1",
"gateway": "192.168.20.100/32"
}
]
}
}
EOF
)"
# define a project
projectname="testvfw"
projectdata="$(cat<<EOF
{
"metadata": {
"name": "$projectname",
"description": "description of $projectname controller",
"userData1": "$projectname user data 1",
"userData2": "$projectname user data 2"
}
}
EOF
)"
# define a composite application
vfw_compositeapp_name="compositevfw"
vfw_compositeapp_version="v1"
vfw_compositeapp_data="$(cat <<EOF
{
"metadata": {
"name": "${vfw_compositeapp_name}",
"description": "description of ${vfw_compositeapp_name}",
"userData1": "user data 1 for ${vfw_compositeapp_name}",
"userData2": "user data 2 for ${vfw_compositeapp_name}"
},
"spec":{
"version":"${vfw_compositeapp_version}"
}
}
EOF
)"
# define app entries for the composite application
# includes the multipart tgz of the helm chart for vfw
# BEGIN: Create entries for app1&app2 in the database
packetgen_app_name="packetgen"
packetgen_helm_chart=${packetgen_helm_path:-"oops"}
packetgen_app_data="$(cat <<EOF
{
"metadata": {
"name": "${packetgen_app_name}",
"description": "description for app ${packetgen_app_name}",
"userData1": "user data 2 for ${packetgen_app_name}",
"userData2": "user data 2 for ${packetgen_app_name}"
}
}
EOF
)"
firewall_app_name="firewall"
firewall_helm_chart=${firewall_helm_path:-"oops"}
firewall_app_data="$(cat <<EOF
{
"metadata": {
"name": "${firewall_app_name}",
"description": "description for app ${firewall_app_name}",
"userData1": "user data 2 for ${firewall_app_name}",
"userData2": "user data 2 for ${firewall_app_name}"
}
}
EOF
)"
sink_app_name="sink"
sink_helm_chart=${sink_helm_path:-"oops"}
sink_app_data="$(cat <<EOF
{
"metadata": {
"name": "${sink_app_name}",
"description": "description for app ${sink_app_name}",
"userData1": "user data 2 for ${sink_app_name}",
"userData2": "user data 2 for ${sink_app_name}"
}
}
EOF
)"
# Add the composite profile
vfw_composite_profile_name="vfw_composite-profile"
vfw_composite_profile_data="$(cat <<EOF
{
"metadata":{
"name":"${vfw_composite_profile_name}",
"description":"description of ${vfw_composite_profile_name}",
"userData1":"user data 1 for ${vfw_composite_profile_name}",
"userData2":"user data 2 for ${vfw_composite_profile_name}"
}
}
EOF
)"
# define the packetgen profile data
packetgen_profile_name="packetgen-profile"
packetgen_profile_file=${packetgen_profile_targz:-"oops"}
packetgen_profile_data="$(cat <<EOF
{
"metadata":{
"name":"${packetgen_profile_name}",
"description":"description of ${packetgen_profile_name}",
"userData1":"user data 1 for ${packetgen_profile_name}",
"userData2":"user data 2 for ${packetgen_profile_name}"
},
"spec":{
"app-name": "${packetgen_app_name}"
}
}
EOF
)"
# define the firewall profile data
firewall_profile_name="firewall-profile"
firewall_profile_file=${firewall_profile_targz:-"oops"}
firewall_profile_data="$(cat <<EOF
{
"metadata":{
"name":"${firewall_profile_name}",
"description":"description of ${firewall_profile_name}",
"userData1":"user data 1 for ${firewall_profile_name}",
"userData2":"user data 2 for ${firewall_profile_name}"
},
"spec":{
"app-name": "${firewall_app_name}"
}
}
EOF
)"
# define the sink profile data
sink_profile_name="sink-profile"
sink_profile_file=${sink_profile_targz:-"oops"}
sink_profile_data="$(cat <<EOF
{
"metadata":{
"name":"${sink_profile_name}",
"description":"description of ${sink_profile_name}",
"userData1":"user data 1 for ${sink_profile_name}",
"userData2":"user data 2 for ${sink_profile_name}"
},
"spec":{
"app-name": "${sink_app_name}"
}
}
EOF
)"
# define the generic placement intent
generic_placement_intent_name="generic-placement-intent"
generic_placement_intent_data="$(cat <<EOF
{
"metadata":{
"name":"${generic_placement_intent_name}",
"description":"${generic_placement_intent_name}",
"userData1":"${generic_placement_intent_name}",
"userData2":"${generic_placement_intent_name}"
}
}
EOF
)"
# define app placement intent for packetgen
packetgen_placement_intent_name="packetgen-placement-intent"
packetgen_placement_intent_data="$(cat <<EOF
{
"metadata":{
"name":"${packetgen_placement_intent_name}",
"description":"description of ${packetgen_placement_intent_name}",
"userData1":"user data 1 for ${packetgen_placement_intent_name}",
"userData2":"user data 2 for ${packetgen_placement_intent_name}"
},
"spec":{
"app-name":"${packetgen_app_name}",
"intent":{
"allOf":[
{ "provider-name":"${clusterprovidername}",
"cluster-label-name":"${labelname}"
}
]
}
}
}
EOF
)"
# define app placement intent for firewall
firewall_placement_intent_name="firewall-placement-intent"
firewall_placement_intent_data="$(cat <<EOF
{
"metadata":{
"name":"${firewall_placement_intent_name}",
"description":"description of ${firewall_placement_intent_name}",
"userData1":"user data 1 for ${firewall_placement_intent_name}",
"userData2":"user data 2 for ${firewall_placement_intent_name}"
},
"spec":{
"app-name":"${firewall_app_name}",
"intent":{
"allOf":[
{ "provider-name":"${clusterprovidername}",
"cluster-label-name":"${labelname}"
}
]
}
}
}
EOF
)"
# define app placement intent for sink
sink_placement_intent_name="sink-placement-intent"
sink_placement_intent_data="$(cat <<EOF
{
"metadata":{
"name":"${sink_placement_intent_name}",
"description":"description of ${sink_placement_intent_name}",
"userData1":"user data 1 for ${sink_placement_intent_name}",
"userData2":"user data 2 for ${sink_placement_intent_name}"
},
"spec":{
"app-name":"${sink_app_name}",
"intent":{
"allOf":[
{ "provider-name":"${clusterprovidername}",
"cluster-label-name":"${labelname}"
}
]
}
}
}
EOF
)"
# define a deployment intent group
release="fw0"
deployment_intent_group_name="vfw_deployment_intent_group"
deployment_intent_group_data="$(cat <<EOF
{
"metadata":{
"name":"${deployment_intent_group_name}",
"description":"descriptiont of ${deployment_intent_group_name}",
"userData1":"user data 1 for ${deployment_intent_group_name}",
"userData2":"user data 2 for ${deployment_intent_group_name}"
},
"spec":{
"profile":"${vfw_composite_profile_name}",
"version":"${release}",
"logical-cloud":"unused_logical_cloud",
"override-values":[
{
"app-name":"${packetgen_app_name}",
"values": {
".Values.service.ports.nodePort":"30888"
}
},
{
"app-name":"${firewall_app_name}",
"values": {
".Values.global.dcaeCollectorIp":"1.2.3.4",
".Values.global.dcaeCollectorPort":"8888"
}
},
{
"app-name":"${sink_app_name}",
"values": {
".Values.service.ports.nodePort":"30677"
}
}
]
}
}
EOF
)"
# define the network-control-intent for the vfw composite app
vfw_ovnaction_intent_name="vfw_ovnaction_intent"
vfw_ovnaction_intent_data="$(cat <<EOF
{
"metadata":{
"name":"${vfw_ovnaction_intent_name}",
"description":"descriptionf of ${vfw_ovnaction_intent_name}",
"userData1":"user data 1 for ${vfw_ovnaction_intent_name}",
"userData2":"user data 2 for ${vfw_ovnaction_intent_name}"
}
}
EOF
)"
# define the network workload intent for packetgen app
packetgen_workload_intent_name="packetgen_workload_intent"
packetgen_workload_intent_data="$(cat <<EOF
{
"metadata": {
"name": "${packetgen_workload_intent_name}",
"description": "description of ${packetgen_workload_intent_name}",
"userData1": "useer data 2 for ${packetgen_workload_intent_name}",
"userData2": "useer data 2 for ${packetgen_workload_intent_name}"
},
"spec": {
"application-name": "${packetgen_app_name}",
"workload-resource": "${release}-${packetgen_app_name}",
"type": "Deployment"
}
}
EOF
)"
# define the network workload intent for firewall app
firewall_workload_intent_name="firewall_workload_intent"
firewall_workload_intent_data="$(cat <<EOF
{
"metadata": {
"name": "${firewall_workload_intent_name}",
"description": "description of ${firewall_workload_intent_name}",
"userData1": "useer data 2 for ${firewall_workload_intent_name}",
"userData2": "useer data 2 for ${firewall_workload_intent_name}"
},
"spec": {
"application-name": "${firewall_app_name}",
"workload-resource": "${release}-${firewall_app_name}",
"type": "Deployment"
}
}
EOF
)"
# define the network workload intent for sink app
sink_workload_intent_name="sink_workload_intent"
sink_workload_intent_data="$(cat <<EOF
{
"metadata": {
"name": "${sink_workload_intent_name}",
"description": "description of ${sink_workload_intent_name}",
"userData1": "useer data 2 for ${sink_workload_intent_name}",
"userData2": "useer data 2 for ${sink_workload_intent_name}"
},
"spec": {
"application-name": "${sink_app_name}",
"workload-resource": "${release}-${sink_app_name}",
"type": "Deployment"
}
}
EOF
)"
# define the network interface intents for the packetgen workload intent
packetgen_unprotected_interface_name="packetgen_unprotected_if"
packetgen_unprotected_interface_data="$(cat <<EOF
{
"metadata": {
"name": "${packetgen_unprotected_interface_name}",
"description": "description of ${packetgen_unprotected_interface_name}",
"userData1": "useer data 2 for ${packetgen_unprotected_interface_name}",
"userData2": "useer data 2 for ${packetgen_unprotected_interface_name}"
},
"spec": {
"interface": "eth1",
"name": "${unprotectedprovidernetworkname}",
"defaultGateway": "false",
"ipAddress": "192.168.10.2"
}
}
EOF
)"
packetgen_emco_interface_name="packetgen_emco_if"
packetgen_emco_interface_data="$(cat <<EOF
{
"metadata": {
"name": "${packetgen_emco_interface_name}",
"description": "description of ${packetgen_emco_interface_name}",
"userData1": "useer data 2 for ${packetgen_emco_interface_name}",
"userData2": "useer data 2 for ${packetgen_emco_interface_name}"
},
"spec": {
"interface": "eth2",
"name": "${emcoprovidernetworkname}",
"defaultGateway": "false",
"ipAddress": "10.10.20.2"
}
}
EOF
)"
# define the network interface intents for the firewall workload intent
firewall_unprotected_interface_name="firewall_unprotected_if"
firewall_unprotected_interface_data="$(cat <<EOF
{
"metadata": {
"name": "${firewall_unprotected_interface_name}",
"description": "description of ${firewall_unprotected_interface_name}",
"userData1": "useer data 2 for ${firewall_unprotected_interface_name}",
"userData2": "useer data 2 for ${firewall_unprotected_interface_name}"
},
"spec": {
"interface": "eth1",
"name": "${unprotectedprovidernetworkname}",
"defaultGateway": "false",
"ipAddress": "192.168.10.3"
}
}
EOF
)"
firewall_protected_interface_name="firewall_protected_if"
firewall_protected_interface_data="$(cat <<EOF
{
"metadata": {
"name": "${firewall_protected_interface_name}",
"description": "description of ${firewall_protected_interface_name}",
"userData1": "useer data 2 for ${firewall_protected_interface_name}",
"userData2": "useer data 2 for ${firewall_protected_interface_name}"
},
"spec": {
"interface": "eth2",
"name": "${protectednetworkname}",
"defaultGateway": "false",
"ipAddress": "192.168.20.2"
}
}
EOF
)"
firewall_emco_interface_name="firewall_emco_if"
firewall_emco_interface_data="$(cat <<EOF
{
"metadata": {
"name": "${firewall_emco_interface_name}",
"description": "description of ${firewall_emco_interface_name}",
"userData1": "useer data 2 for ${firewall_emco_interface_name}",
"userData2": "useer data 2 for ${firewall_emco_interface_name}"
},
"spec": {
"interface": "eth3",
"name": "${emcoprovidernetworkname}",
"defaultGateway": "false",
"ipAddress": "10.10.20.3"
}
}
EOF
)"
# define the network interface intents for the sink workload intent
sink_protected_interface_name="sink_protected_if"
sink_protected_interface_data="$(cat <<EOF
{
"metadata": {
"name": "${sink_protected_interface_name}",
"description": "description of ${sink_protected_interface_name}",
"userData1": "useer data 2 for ${sink_protected_interface_name}",
"userData2": "useer data 2 for ${sink_protected_interface_name}"
},
"spec": {
"interface": "eth1",
"name": "${protectednetworkname}",
"defaultGateway": "false",
"ipAddress": "192.168.20.3"
}
}
EOF
)"
sink_emco_interface_name="sink_emco_if"
sink_emco_interface_data="$(cat <<EOF
{
"metadata": {
"name": "${sink_emco_interface_name}",
"description": "description of ${sink_emco_interface_name}",
"userData1": "useer data 2 for ${sink_emco_interface_name}",
"userData2": "useer data 2 for ${sink_emco_interface_name}"
},
"spec": {
"interface": "eth2",
"name": "${emcoprovidernetworkname}",
"defaultGateway": "false",
"ipAddress": "10.10.20.4"
}
}
EOF
)"
# define the intents to be used by the group
deployment_intents_in_group_name="vfw_deploy_intents"
deployment_intents_in_group_data="$(cat <<EOF
{
"metadata":{
"name":"${deployment_intents_in_group_name}",
"description":"descriptionf of ${deployment_intents_in_group_name}",
"userData1":"user data 1 for ${deployment_intents_in_group_name}",
"userData2":"user data 2 for ${deployment_intents_in_group_name}"
},
"spec":{
"intent":{
"genericPlacementIntent":"${generic_placement_intent_name}",
"ovnaction" : "${vfw_ovnaction_intent_name}"
}
}
}
EOF
)"
function createOvnactionData {
call_api -d "${vfw_ovnaction_intent_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent"
call_api -d "${packetgen_workload_intent_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents"
call_api -d "${firewall_workload_intent_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents"
call_api -d "${sink_workload_intent_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents"
call_api -d "${packetgen_emco_interface_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}/interfaces"
call_api -d "${packetgen_unprotected_interface_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}/interfaces"
call_api -d "${firewall_emco_interface_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces"
call_api -d "${firewall_unprotected_interface_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces"
call_api -d "${firewall_protected_interface_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces"
call_api -d "${sink_emco_interface_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}/interfaces"
call_api -d "${sink_protected_interface_data}" \
"${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}/interfaces"
}
function createOrchData {
print_msg "creating controller entries"
call_api -d "${rsynccontrollerdata}" "${base_url_orchestrator}/controllers"
call_api -d "${ovnactioncontrollerdata}" "${base_url_orchestrator}/controllers"
print_msg "creating project entry"
call_api -d "${projectdata}" "${base_url_orchestrator}/projects"
print_msg "creating vfw composite app entry"
call_api -d "${vfw_compositeapp_data}" "${base_url_orchestrator}/projects/${projectname}/composite-apps"
print_msg "adding vfw apps to the composite app"
call_api -F "metadata=${packetgen_app_data}" \
-F "file=@${packetgen_helm_chart}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps"
call_api -F "metadata=${firewall_app_data}" \
-F "file=@${firewall_helm_chart}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps"
call_api -F "metadata=${sink_app_data}" \
-F "file=@${sink_helm_chart}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps"
print_msg "creating vfw composite profile entry"
call_api -d "${vfw_composite_profile_data}" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles"
print_msg "adding vfw app profiles to the composite profile"
call_api -F "metadata=${packetgen_profile_data}" \
-F "file=@${packetgen_profile_file}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles"
call_api -F "metadata=${firewall_profile_data}" \
-F "file=@${firewall_profile_file}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles"
call_api -F "metadata=${sink_profile_data}" \
-F "file=@${sink_profile_file}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles"
print_msg "create the deployment intent group"
call_api -d "${deployment_intent_group_data}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups"
call_api -d "${deployment_intents_in_group_data}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/intents"
print_msg "create the generic placement intent"
call_api -d "${generic_placement_intent_data}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents"
print_msg "add the vfw app placement intents to the generic placement intent"
call_api -d "${packetgen_placement_intent_data}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents"
call_api -d "${firewall_placement_intent_data}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents"
call_api -d "${sink_placement_intent_data}" \
"${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents"
createOvnactionData
}
function createNcmData {
print_msg "Creating cluster provider and cluster"
call_api -d "${clusterproviderdata}" "${base_url_clm}/cluster-providers"
call_api -H "Content-Type: multipart/form-data" -F "metadata=$clusterdata" -F "file=@$kubeconfigfile" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters"
call_api -d "${labeldata}" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/labels"
call_api -H "Content-Type: multipart/form-data" -F "metadata=$clusterdata2" -F "file=@$kubeconfigfile2" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters"
call_api -d "${labeldata}" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/labels"
print_msg "Creating provider network and network intents"
call_api -d "${emcoprovidernetworkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks"
call_api -d "${unprotectedprovidernetworkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks"
call_api -d "${protectednetworkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/networks"
call_api -d "${emcoprovidernetworkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/provider-networks"
call_api -d "${unprotectedprovidernetworkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/provider-networks"
call_api -d "${protectednetworkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/networks"
}
function createData {
createNcmData
createOrchData # this will call createOvnactionData
}
function getOvnactionData {
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}/interfaces/${packetgen_emco_interface_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}/interfaces/${packetgen_unprotected_interface_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces/${firewall_emco_interface_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces/${firewall_unprotected_interface_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces/${firewall_protected_interface_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}/interfaces/${sink_emco_interface_name}"
call_api_nox "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}/interfaces/${sink_protected_interface_name}"
}
function getOrchData {
call_api_nox "${base_url_orchestrator}/controllers/${rsynccontrollername}"
call_api_nox "${base_url_orchestrator}/controllers/${ovnactioncontrollername}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}"
call_api_nox -H "Accept: application/json" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps/${packetgen_app_name}"
call_api_nox -H "Accept: application/json" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps/${firewall_app_name}"
call_api_nox -H "Accept: application/json" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps/${sink_app_name}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}"
call_api_nox -H "Accept: application/json" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles/${packetgen_profile_name}"
call_api_nox -H "Accept: application/json" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles/${firewall_profile_name}"
call_api_nox -H "Accept: application/json" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles/${sink_profile_name}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents/${packetgen_placement_intent_name}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents/${firewall_placement_intent_name}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents/${sink_placement_intent_name}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}"
call_api_nox "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/intents/${deployment_intents_in_group_name}"
}
function getNcmData {
call_api_nox "${base_url_clm}/cluster-providers/${clusterprovidername}"
call_api_nox -H "Accept: application/json" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}"
call_api_nox -H "Accept: application/json" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}"
call_api_nox "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/labels/${labelname}"
call_api_nox "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters?label=${labelname}"
call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks/${emcoprovidernetworkname}"
call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks/${unprotectedprovidernetworkname}"
call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/networks/${protectednetworkname}"
call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/provider-networks/${emcoprovidernetworkname}"
call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/provider-networks/${unprotectedprovidernetworkname}"
call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/networks/${protectednetworkname}"
}
function getData {
getNcmData
getOrchData
getOvnactionData
}
function deleteOvnactionData {
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}/interfaces/${sink_protected_interface_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}/interfaces/${sink_emco_interface_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces/${firewall_protected_interface_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces/${firewall_unprotected_interface_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}/interfaces/${firewall_emco_interface_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}/interfaces/${packetgen_unprotected_interface_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}/interfaces/${packetgen_emco_interface_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${sink_workload_intent_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${firewall_workload_intent_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}/workload-intents/${packetgen_workload_intent_name}"
delete_resource "${base_url_ovnaction}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/network-controller-intent/${vfw_ovnaction_intent_name}"
}
function deleteOrchData {
delete_resource "${base_url_orchestrator}/controllers/${rsynccontrollername}"
delete_resource "${base_url_orchestrator}/controllers/${ovnactioncontrollername}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents/${sink_placement_intent_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents/${firewall_placement_intent_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}/app-intents/${packetgen_placement_intent_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/generic-placement-intents/${generic_placement_intent_name}"
deleteOvnactionData
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/intents/${deployment_intents_in_group_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles/${sink_profile_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles/${firewall_profile_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}/profiles/${packetgen_profile_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/composite-profiles/${vfw_composite_profile_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps/${sink_app_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps/${firewall_app_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/apps/${packetgen_app_name}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}"
delete_resource "${base_url_orchestrator}/projects/${projectname}"
}
function deleteNcmData {
delete_resource "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/networks/${protectednetworkname}"
delete_resource "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks/${unprotectedprovidernetworkname}"
delete_resource "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks/${emcoprovidernetworkname}"
delete_resource "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/labels/${labelname}"
delete_resource "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}"
delete_resource "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/networks/${protectednetworkname}"
delete_resource "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/provider-networks/${unprotectedprovidernetworkname}"
delete_resource "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/provider-networks/${emcoprovidernetworkname}"
delete_resource "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/labels/${labelname}"
delete_resource "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}"
delete_resource "${base_url_clm}/cluster-providers/${clusterprovidername}"
}
function deleteData {
deleteNcmData
deleteOrchData
}
# apply the network and providernetwork to an appcontext and instantiate with rsync
function applyNcmData {
call_api -d "{ }" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/apply"
call_api -d "{ }" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/apply"
}
# deletes the network resources from the clusters and the associated appcontext entries
function terminateNcmData {
call_api -d "{ }" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/terminate"
call_api -d "{ }" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername2}/terminate"
}
# terminates the vfw resources
function terminateOrchData {
call_api -d "{ }" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/terminate"
}
# terminates the vfw and ncm resources
function terminateVfw {
terminateOrchData
terminateNcmData
}
function instantiateVfw {
call_api -d "{ }" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/approve"
call_api -d "{ }" "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/instantiate"
}
function statusVfw {
call_api "${base_url_orchestrator}/projects/${projectname}/composite-apps/${vfw_compositeapp_name}/${vfw_compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/status${query}"
}
function usage {
echo "Usage: $0 create|get|delete|apply|terminate|instantiate"
echo " create - creates all ncm, ovnaction, clm resources needed for vfw"
echo " following env variables need to be set for create:"
echo " kubeconfigfile=<path of kubeconfig file for destination cluster>"
echo " kubeconfigfile2=<path of kubeconfig file for second destination cluster>"
echo " packetgen_helm_path=<path to helm chart file for the packet generator>"
echo " firewall_helm_path=<path to helm chart file for the firewall>"
echo " sink_helm_path=<path to helm chart file for the sink>"
echo " packetgen_profile_targz=<path to profile tar.gz file for the packet generator>"
echo " firewall_profile_targz=<path to profile tar.gz file for the firewall>"
echo " sink_profile_targz=<path to profile tar.gz file for the sink>"
echo " get - queries all resources in ncm, ovnaction, clm resources created for vfw"
echo " delete - deletes all resources in ncm, ovnaction, clm resources created for vfw"
echo " apply - applys the network intents - e.g. networks created in ncm"
echo " instantiate - approves and instantiates the composite app via the generic deployment intent"
echo " status - get status of deployed resources"
echo " terminate - remove the vFW composite app resources and network resources create by 'instantiate' and 'apply'"
echo ""
echo " a reasonable test sequence:"
echo " 1. create"
echo " 2. apply"
echo " 3. instantiate"
echo " 4. status"
echo " 5. terminate"
exit
}
function check_for_env_settings {
ok=""
if [ "${kubeconfigfile}" == "oops" ] ; then
echo -e "ERROR - kubeconfigfile environment variable needs to be set"
ok="no"
fi
if [ "${kubeconfigfile2}" == "oops" ] ; then
echo -e "ERROR - kubeconfigfile2 environment variable needs to be set"
ok="no"
fi
if [ "${packetgen_helm_chart}" == "oops" ] ; then
echo -e "ERROR - packetgen_helm_path environment variable needs to be set"
ok="no"
fi
if [ "${firewall_helm_chart}" == "oops" ] ; then
echo -e "ERROR - firewall_helm_path environment variable needs to be set"
ok="no"
fi
if [ "${sink_helm_chart}" == "oops" ] ; then
echo -e "ERROR - sink_helm_path environment variable needs to be set"
ok="no"
fi
if [ "${packetgen_profile_file}" == "oops" ] ; then
echo -e "ERROR - packetgen_profile_targz environment variable needs to be set"
ok="no"
fi
if [ "${firewall_profile_file}" == "oops" ] ; then
echo -e "ERROR - firewall_profile_targz environment variable needs to be set"
ok="no"
fi
if [ "${sink_profile_file}" == "oops" ] ; then
echo -e "ERROR - sink_profile_targz environment variable needs to be set"
ok="no"
fi
if [ "${ok}" == "no" ] ; then
echo ""
usage
fi
}
if [ "$#" -lt 1 ] ; then
usage
fi
case "$1" in
"create" )
check_for_env_settings
createData
;;
"get" ) getData ;;
"delete" ) deleteData ;;
"apply" ) applyNcmData ;;
"instantiate" ) instantiateVfw ;;
"terminate" ) terminateVfw ;;
"status" )
query=""
if [ "$#" -eq 2 ] ; then
query="?$2"
fi
statusVfw ${query} ;;
*) usage ;;
esac
|