2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
15 packetgen_deployment_name=packetgen
16 sink_deployment_name=sink
17 firewall_deployment_name=firewall
18 image_name=virtlet.cloud/ubuntu/16.04
19 multus_deployment_name=multus-deployment
20 virtlet_image=virtlet.cloud/fedora
21 virtlet_deployment_name=virtlet-deployment
22 plugin_deployment_name=plugin-deployment
23 plugin_service_name=plugin-service
24 ovn4nfv_deployment_name=ovn4nfv-deployment
25 onap_private_net=onap-private-net
26 unprotected_private_net=unprotected-private-net
27 protected_private_net=protected-private-net
28 ovn_multus_network_name=ovn-networkobj
29 rbd_metadata=rbd_metatada.json
30 rbp_metadata=rbp_metatada.json
31 rbp_instance=rbp_instance.json
34 demo_artifacts_version=1.5.0
35 vfw_private_ip_0='192.168.10.3'
36 vfw_private_ip_1='192.168.20.2'
37 vfw_private_ip_2='10.10.100.3'
38 vpg_private_ip_0='192.168.10.2'
39 vpg_private_ip_1='10.0.100.2'
40 vsn_private_ip_0='192.168.20.3'
41 vsn_private_ip_1='10.10.100.4'
42 dcae_collector_ip='10.0.4.1'
43 dcae_collector_port='8081'
44 protected_net_gw='192.168.20.100'
45 protected_net_cidr='192.168.20.0/24'
46 protected_private_net_cidr='192.168.10.0/24'
47 onap_private_net_cidr='10.10.0.0/16'
48 sink_ipaddr='192.168.20.250'
50 # populate_CSAR_containers_vFW() - This function creates the content of CSAR file
51 # required for vFirewal using only containers
52 function populate_CSAR_containers_vFW {
56 pushd ${CSAR_DIR}/${csar_id}
58 cat << META > metadata.yaml
61 - $unprotected_private_net.yaml
62 - $protected_private_net.yaml
63 - $onap_private_net.yaml
65 - $packetgen_deployment_name.yaml
66 - $firewall_deployment_name.yaml
67 - $sink_deployment_name.yaml
70 cat << NET > $unprotected_private_net.yaml
71 apiVersion: "k8s.cni.cncf.io/v1"
72 kind: NetworkAttachmentDefinition
74 name: $unprotected_private_net
77 "name": "unprotected",
81 "subnet": "$protected_private_net_cidr"
86 cat << NET > $protected_private_net.yaml
87 apiVersion: "k8s.cni.cncf.io/v1"
88 kind: NetworkAttachmentDefinition
90 name: $protected_private_net
97 "subnet": "$protected_net_cidr"
102 cat << NET > $onap_private_net.yaml
103 apiVersion: "k8s.cni.cncf.io/v1"
104 kind: NetworkAttachmentDefinition
106 name: $onap_private_net
112 "type": "host-local",
113 "subnet": "$onap_private_net_cidr"
118 cat << DEPLOYMENT > $packetgen_deployment_name.yaml
122 name: $packetgen_deployment_name
135 k8s.v1.cni.cncf.io/networks: '[
136 { "name": "$unprotected_private_net", "interfaceRequest": "eth1" },
137 { "name": "$onap_private_net", "interfaceRequest": "eth2" }
141 - name: $packetgen_deployment_name
142 image: electrocucaracha/packetgen
143 imagePullPolicy: IfNotPresent
151 cat << DEPLOYMENT > $firewall_deployment_name.yaml
155 name: $firewall_deployment_name
168 k8s.v1.cni.cncf.io/networks: '[
169 { "name": "$unprotected_private_net", "interfaceRequest": "eth1" },
170 { "name": "$protected_private_net", "interfaceRequest": "eth2" },
171 { "name": "$onap_private_net", "interfaceRequest": "eth3" }
175 - name: $firewall_deployment_name
176 image: electrocucaracha/firewall
177 imagePullPolicy: IfNotPresent
182 cat << DEPLOYMENT > $sink_deployment_name.yaml
186 name: $sink_deployment_name
201 k8s.v1.cni.cncf.io/networks: '[
202 { "name": "$protected_private_net", "interfaceRequest": "eth1" },
203 { "name": "$onap_private_net", "interfaceRequest": "eth2" }
207 - name: $sink_deployment_name
208 image: electrocucaracha/sink
209 imagePullPolicy: IfNotPresent
215 image: electrocucaracha/darkstat
216 imagePullPolicy: IfNotPresent
225 # populate_CSAR_vms_containers_vFW() - This function creates the content of CSAR file
226 # required for vFirewal using an hybrid combination between virtual machines and
228 function populate_CSAR_vms_containers_vFW {
230 ssh_key=$(cat $HOME/.ssh/id_rsa.pub)
232 _checks_args $csar_id
233 pushd ${CSAR_DIR}/${csar_id}
235 cat << META > metadata.yaml
238 - onap-ovn4nfvk8s-network.yaml
240 - $unprotected_private_net.yaml
241 - $protected_private_net.yaml
242 - $onap_private_net.yaml
244 - $packetgen_deployment_name.yaml
245 - $firewall_deployment_name.yaml
246 - $sink_deployment_name.yaml
251 cat << SERVICE > sink-service.yaml
266 cat << MULTUS_NET > onap-ovn4nfvk8s-network.yaml
267 apiVersion: "k8s.cni.cncf.io/v1"
268 kind: NetworkAttachmentDefinition
270 name: $ovn_multus_network_name
273 "cniVersion": "0.3.1",
274 "name": "ovn4nfv-k8s-plugin",
275 "type": "ovn4nfvk8s-cni"
279 cat << NET > $unprotected_private_net.yaml
283 name: $unprotected_private_net
286 name: $unprotected_private_net
287 subnet: $protected_private_net_cidr
288 gateway: 192.168.10.1/24
291 cat << NET > $protected_private_net.yaml
295 name: $protected_private_net
298 name: $protected_private_net
299 subnet: $protected_net_cidr
300 gateway: $protected_net_gw/24
303 cat << NET > $onap_private_net.yaml
307 name: $onap_private_net
310 name: $onap_private_net
311 subnet: $onap_private_net_cidr
312 gateway: 10.10.0.1/16
317 - export demo_artifacts_version=$demo_artifacts_version
318 - export vfw_private_ip_0=$vfw_private_ip_0
319 - export vsn_private_ip_0=$vsn_private_ip_0
320 - export protected_net_cidr=$protected_net_cidr
321 - export dcae_collector_ip=$dcae_collector_ip
322 - export dcae_collector_port=$dcae_collector_port
323 - export protected_net_gw=$protected_net_gw
324 - export protected_private_net_cidr=$protected_private_net_cidr
325 - export sink_ipaddr=$sink_ipaddr
327 if [[ -n "${http_proxy+x}" ]]; then
329 http_proxy: $http_proxy"
331 - export http_proxy=$http_proxy"
333 if [[ -n "${https_proxy+x}" ]]; then
335 https_proxy: $https_proxy"
337 - export https_proxy=$https_proxy"
339 if [[ -n "${no_proxy+x}" ]]; then
341 - export no_proxy=$no_proxy"
344 cat << DEPLOYMENT > $packetgen_deployment_name.yaml
348 name: $packetgen_deployment_name
361 VirtletLibvirtCPUSetting: |
363 VirtletCloudInitUserData: |
370 sudo: ALL=(ALL) NOPASSWD:ALL
372 # the password is "admin"
373 passwd: "\$6\$rounds=4096\$QA5OCKHTE41\$jRACivoPMJcOjLRgxl3t.AMfU7LhCFwOWv2z66CQX.TSxBy50JoYtycJXSPr2JceG.8Tq/82QN9QYt3euYEZW/"
379 - wget -O - https://git.onap.org/multicloud/k8s/plain/kud/tests/vFW/$packetgen_deployment_name | sudo -E bash
382 VirtletRootVolumeSize: 5Gi
383 k8s.v1.cni.cncf.io/networks: '[{ "name": "$ovn_multus_network_name"}]'
385 { "name": "$unprotected_private_net", "ipAddress": "$vpg_private_ip_0", "interface": "eth1" , "defaultGateway": "false"},
386 { "name": "$onap_private_net", "ipAddress": "$vpg_private_ip_1", "interface": "eth2" , "defaultGateway": "false"}
388 kubernetes.io/target-runtime: virtlet.cloud
392 requiredDuringSchedulingIgnoredDuringExecution:
400 - name: $packetgen_deployment_name
402 imagePullPolicy: IfNotPresent
406 - containerPort: 8183
412 cat << DEPLOYMENT > $firewall_deployment_name.yaml
416 name: $firewall_deployment_name
429 VirtletLibvirtCPUSetting: |
431 VirtletCloudInitUserData: |
438 sudo: ALL=(ALL) NOPASSWD:ALL
440 # the password is "admin"
441 passwd: "\$6\$rounds=4096\$QA5OCKHTE41\$jRACivoPMJcOjLRgxl3t.AMfU7LhCFwOWv2z66CQX.TSxBy50JoYtycJXSPr2JceG.8Tq/82QN9QYt3euYEZW/"
447 - wget -O - https://git.onap.org/multicloud/k8s/plain/kud/tests/vFW/$firewall_deployment_name | sudo -E bash
450 VirtletRootVolumeSize: 5Gi
451 k8s.v1.cni.cncf.io/networks: '[{ "name": "$ovn_multus_network_name"}]'
453 { "name": "$unprotected_private_net", "ipAddress": "$vfw_private_ip_0", "interface": "eth1" , "defaultGateway": "false"},
454 { "name": "$protected_private_net", "ipAddress": "$vfw_private_ip_1", "interface": "eth2", "defaultGateway": "false" },
455 { "name": "$onap_private_net", "ipAddress": "$vfw_private_ip_2", "interface": "eth3" , "defaultGateway": "false"}
457 kubernetes.io/target-runtime: virtlet.cloud
461 requiredDuringSchedulingIgnoredDuringExecution:
469 - name: $firewall_deployment_name
471 imagePullPolicy: IfNotPresent
479 cat << CONFIGMAP > sink_configmap.yaml
485 protected_net_gw: $protected_net_gw
486 protected_private_net_cidr: $protected_private_net_cidr
489 cat << DEPLOYMENT > $sink_deployment_name.yaml
493 name: $sink_deployment_name
508 k8s.v1.cni.cncf.io/networks: '[{ "name": "$ovn_multus_network_name"}]'
510 { "name": "$protected_private_net", "ipAddress": "$vsn_private_ip_0", "interface": "eth1", "defaultGateway": "false" },
511 { "name": "$onap_private_net", "ipAddress": "$vsn_private_ip_1", "interface": "eth2" , "defaultGateway": "false"}
515 - name: $sink_deployment_name
516 image: rtsood/onap-vfw-demo-sink:0.2.0
520 imagePullPolicy: Always
527 image: electrocucaracha/darkstat
528 imagePullPolicy: IfNotPresent
537 # populate_CSAR_vms_vFW() - This function creates the content of CSAR file
538 # required for vFirewal using only virtual machines
539 function populate_CSAR_vms_vFW {
541 ssh_key=$(cat $HOME/.ssh/id_rsa.pub)
543 _checks_args $csar_id
544 pushd ${CSAR_DIR}/${csar_id}
546 cat << META > metadata.yaml
549 - $unprotected_private_net.yaml
550 - $protected_private_net.yaml
551 - $onap_private_net.yaml
553 - $packetgen_deployment_name.yaml
554 - $firewall_deployment_name.yaml
555 - $sink_deployment_name.yaml
558 cat << NET > $unprotected_private_net.yaml
559 apiVersion: "k8s.cni.cncf.io/v1"
560 kind: NetworkAttachmentDefinition
562 name: $unprotected_private_net
565 "name": "unprotected",
568 "type": "host-local",
569 "subnet": "$protected_private_net_cidr"
574 cat << NET > $protected_private_net.yaml
575 apiVersion: "k8s.cni.cncf.io/v1"
576 kind: NetworkAttachmentDefinition
578 name: $protected_private_net
584 "type": "host-local",
585 "subnet": "$protected_net_cidr"
590 cat << NET > $onap_private_net.yaml
591 apiVersion: "k8s.cni.cncf.io/v1"
592 kind: NetworkAttachmentDefinition
594 name: $onap_private_net
600 "type": "host-local",
601 "subnet": "$onap_private_net_cidr"
608 - export demo_artifacts_version=$demo_artifacts_version
609 - export vfw_private_ip_0=$vfw_private_ip_0
610 - export vsn_private_ip_0=$vsn_private_ip_0
611 - export protected_net_cidr=$protected_net_cidr
612 - export dcae_collector_ip=$dcae_collector_ip
613 - export dcae_collector_port=$dcae_collector_port
614 - export protected_net_gw=$protected_net_gw
615 - export protected_private_net_cidr=$protected_private_net_cidr
617 if [[ -n "${http_proxy+x}" ]]; then
619 http_proxy: $http_proxy"
621 - export http_proxy=$http_proxy"
623 if [[ -n "${https_proxy+x}" ]]; then
625 https_proxy: $https_proxy"
627 - export https_proxy=$https_proxy"
629 if [[ -n "${no_proxy+x}" ]]; then
631 - export no_proxy=$no_proxy"
634 cat << DEPLOYMENT > $packetgen_deployment_name.yaml
638 name: $packetgen_deployment_name
651 VirtletLibvirtCPUSetting: |
653 VirtletCloudInitUserData: |
660 sudo: ALL=(ALL) NOPASSWD:ALL
662 # the password is "admin"
663 passwd: "\$6\$rounds=4096\$QA5OCKHTE41\$jRACivoPMJcOjLRgxl3t.AMfU7LhCFwOWv2z66CQX.TSxBy50JoYtycJXSPr2JceG.8Tq/82QN9QYt3euYEZW/"
669 - wget -O - https://git.onap.org/multicloud/k8s/plain/kud/tests/vFW/$packetgen_deployment_name | sudo -E bash
672 VirtletRootVolumeSize: 5Gi
673 k8s.v1.cni.cncf.io/networks: '[
674 { "name": "$unprotected_private_net", "interfaceRequest": "eth1" },
675 { "name": "$onap_private_net", "interfaceRequest": "eth2" }
677 kubernetes.io/target-runtime: virtlet.cloud
681 requiredDuringSchedulingIgnoredDuringExecution:
689 - name: $packetgen_deployment_name
691 imagePullPolicy: IfNotPresent
695 - containerPort: 8183
701 cat << DEPLOYMENT > $firewall_deployment_name.yaml
705 name: $firewall_deployment_name
718 VirtletLibvirtCPUSetting: |
720 VirtletCloudInitUserData: |
727 sudo: ALL=(ALL) NOPASSWD:ALL
729 # the password is "admin"
730 passwd: "\$6\$rounds=4096\$QA5OCKHTE41\$jRACivoPMJcOjLRgxl3t.AMfU7LhCFwOWv2z66CQX.TSxBy50JoYtycJXSPr2JceG.8Tq/82QN9QYt3euYEZW/"
736 - wget -O - https://git.onap.org/multicloud/k8s/plain/kud/tests/vFW/$firewall_deployment_name | sudo -E bash
739 VirtletRootVolumeSize: 5Gi
740 k8s.v1.cni.cncf.io/networks: '[
741 { "name": "$unprotected_private_net", "interfaceRequest": "eth1" },
742 { "name": "$protected_private_net", "interfaceRequest": "eth2" },
743 { "name": "$onap_private_net", "interfaceRequest": "eth3" }
745 kubernetes.io/target-runtime: virtlet.cloud
749 requiredDuringSchedulingIgnoredDuringExecution:
757 - name: $firewall_deployment_name
759 imagePullPolicy: IfNotPresent
767 cat << DEPLOYMENT > $sink_deployment_name.yaml
771 name: $sink_deployment_name
784 VirtletLibvirtCPUSetting: |
786 VirtletCloudInitUserData: |
793 sudo: ALL=(ALL) NOPASSWD:ALL
795 # the password is "admin"
796 passwd: "\$6\$rounds=4096\$QA5OCKHTE41\$jRACivoPMJcOjLRgxl3t.AMfU7LhCFwOWv2z66CQX.TSxBy50JoYtycJXSPr2JceG.8Tq/82QN9QYt3euYEZW/"
802 - wget -O - https://git.onap.org/multicloud/k8s/plain/kud/tests/vFW/$sink_deployment_name | sudo -E bash
805 VirtletRootVolumeSize: 5Gi
806 k8s.v1.cni.cncf.io/networks: '[
807 { "name": "$protected_private_net", "interfaceRequest": "eth1" },
808 { "name": "$onap_private_net", "interfaceRequest": "eth2" }
810 kubernetes.io/target-runtime: virtlet.cloud
814 requiredDuringSchedulingIgnoredDuringExecution:
822 - name: $sink_deployment_name
824 imagePullPolicy: IfNotPresent
836 # populate_CSAR_multus() - This function creates the content of CSAR file
837 # required for testing Multus feature
838 function populate_CSAR_multus {
841 _checks_args $csar_id
842 pushd ${CSAR_DIR}/${csar_id}
844 cat << META > metadata.yaml
847 - bridge-network.yaml
849 - $multus_deployment_name.yaml
852 cat << NET > bridge-network.yaml
853 apiVersion: "k8s.cni.cncf.io/v1"
854 kind: NetworkAttachmentDefinition
859 "cniVersion": "0.3.0",
863 "type": "host-local",
864 "subnet": "$onap_private_net_cidr"
869 cat << DEPLOYMENT > $multus_deployment_name.yaml
873 name: $multus_deployment_name
886 k8s.v1.cni.cncf.io/networks: '[
887 { "name": "bridge-conf", "interfaceRequest": "eth1" },
888 { "name": "bridge-conf", "interfaceRequest": "eth2" }
892 - name: $multus_deployment_name
901 # populate_CSAR_virtlet() - This function creates the content of CSAR file
902 # required for testing Virtlet feature
903 function populate_CSAR_virtlet {
906 _checks_args $csar_id
907 pushd ${CSAR_DIR}/${csar_id}
909 cat << META > metadata.yaml
912 - $virtlet_deployment_name.yaml
915 cat << DEPLOYMENT > $virtlet_deployment_name.yaml
919 name: $virtlet_deployment_name
932 VirtletLibvirtCPUSetting: |
933 mode: host-passthrough
934 # This tells CRI Proxy that this pod belongs to Virtlet runtime
935 kubernetes.io/target-runtime: virtlet.cloud
936 VirtletCloudInitUserData: |
941 primary-group: testuser
945 # the password is "testuser"
946 passwd: "\$6\$rounds=4096\$wPs4Hz4tfs\$a8ssMnlvH.3GX88yxXKF2cKMlVULsnydoOKgkuStTErTq2dzKZiIx9R/pPWWh5JLxzoZEx7lsSX5T2jW5WISi1"
947 sudo: ALL=(ALL) NOPASSWD:ALL
953 requiredDuringSchedulingIgnoredDuringExecution:
961 - name: $virtlet_deployment_name
962 # This specifies the image to use.
963 # virtlet.cloud/ prefix is used by CRI proxy, the remaining part
964 # of the image name is prepended with https:// and used to download the image
965 image: $virtlet_image
966 imagePullPolicy: IfNotPresent
967 # tty and stdin required for "kubectl attach -t" to work
972 # This memory limit is applied to the libvirt domain definition
978 # populate_CSAR_plugin()- Creates content used for Plugin functional tests
979 function populate_CSAR_plugin {
982 _checks_args $csar_id
983 pushd ${CSAR_DIR}/${csar_id}
985 cat << META > metadata.yaml
988 - $plugin_deployment_name.yaml
993 cat << DEPLOYMENT > $plugin_deployment_name.yaml
997 name: $plugin_deployment_name
1009 - name: $plugin_deployment_name
1016 cat << SERVICE > service.yaml
1020 name: $plugin_service_name
1031 # populate_CSAR_ovn4nfv() - Create content used for OVN4NFV functional test
1032 function populate_CSAR_ovn4nfv {
1035 _checks_args $csar_id
1036 pushd ${CSAR_DIR}/${csar_id}
1038 cat << META > metadata.yaml
1044 - onap-ovn4nfvk8s-network.yaml
1046 - $ovn4nfv_deployment_name.yaml
1049 cat << MULTUS_NET > onap-ovn4nfvk8s-network.yaml
1050 apiVersion: "k8s.cni.cncf.io/v1"
1051 kind: NetworkAttachmentDefinition
1053 name: $ovn_multus_network_name
1056 "cniVersion": "0.3.1",
1057 "name": "ovn4nfv-k8s-plugin",
1058 "type": "ovn4nfvk8s-cni"
1062 cat << NETWORK > ovn-port-net.yaml
1067 cnitype : ovn4nfvk8s
1070 subnet: 172.16.33.0/24
1071 gateway: 172.16.33.1/24
1074 cat << NETWORK > ovn-priv-net.yaml
1079 cnitype : ovn4nfvk8s
1082 subnet: 172.16.44.0/24
1083 gateway: 172.16.44.1/24
1086 cat << DEPLOYMENT > $ovn4nfv_deployment_name.yaml
1090 name: $ovn4nfv_deployment_name
1103 k8s.v1.cni.cncf.io/networks: '[{ "name": "$ovn_multus_network_name"}]'
1104 ovnNetwork: '[{ "name": "ovn-port-net", "interface": "net0" , "defaultGateway": "false"},
1105 { "name": "ovn-priv-net", "interface": "net1" , "defaultGateway": "false"}]'
1108 - name: $ovn4nfv_deployment_name
1117 # populate_CSAR_rbdefinition() - Function that populates CSAR folder
1118 # for testing resource bundle definition
1119 function populate_CSAR_rbdefinition {
1121 pushd "${CSAR_DIR}/$1"
1122 print_msg "Create Helm Chart Archives"
1124 tar -czf rb_profile.tar.gz -C $test_folder/vnfs/testrb/helm/profile .
1125 #Creates vault-consul-dev-0.0.0.tgz
1126 helm package $test_folder/vnfs/testrb/helm/vault-consul-dev --version 0.0.0
1130 # populate_CSAR_edgex_rbdefinition() - Function that populates CSAR folder
1131 # for testing resource bundle definition of edgex scenario
1132 function populate_CSAR_edgex_rbdefinition {
1134 pushd "${CSAR_DIR}/$1"
1135 print_msg "Create Helm Chart Archives"
1137 tar -czf rb_profile.tar.gz -C $test_folder/vnfs/edgex/profile .
1138 tar -czf rb_definition.tar.gz -C $test_folder/vnfs/edgex/helm edgex