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 ##############################################################################
16 TEARDOWN_ACTION=preserve
22 echo "Usage: $0 [--cleanup]"
23 echo "Run integration testcase on KUD deployment"
24 echo "deploying vFW demo on hybrid container-VM"
25 echo "setup. Script by default preserves environment."
26 echo "If you want it to be cleaned, launch script"
27 echo "with --cleanup flag"
32 TEARDOWN_ACTION=cleanup
43 source _common_test.sh
46 csar_id=aa443e7e-c8ba-11e8-8877-525400b164ff
49 if [[ ! -f $HOME/.ssh/id_rsa.pub ]]; then
50 echo -e "\n\n\n" | ssh-keygen -t rsa -N ""
52 populate_CSAR_vms_containers_vFW $csar_id
53 pushd ${CSAR_DIR}/${csar_id}
56 print_msg "Cleanup scenario leftovers"
57 teardown $packetgen_deployment_name $firewall_deployment_name $sink_deployment_name
58 for item in $unprotected_private_net $protected_private_net $onap_private_net sink-service sink_configmap; do
59 kubectl delete -f $item.yaml --ignore-not-found
63 print_msg "Instantiate vcFW"
64 for net in $unprotected_private_net $protected_private_net $onap_private_net; do
65 echo "Create OVN Network $net network"
66 kubectl apply -f $net.yaml
68 for resource in onap-ovn4nfvk8s-network sink-service sink_configmap; do
69 kubectl apply -f $resource.yaml
71 setup $packetgen_deployment_name $firewall_deployment_name $sink_deployment_name
74 print_msg "Verify integration functionality"
75 for deployment_name in $packetgen_deployment_name $firewall_deployment_name; do
76 pod_name=$(kubectl get pods | grep $deployment_name | awk '{print $1}')
77 vm=$(kubectl virt virsh list | grep ".*$deployment_name" | awk '{print $2}')
78 echo "Pod name: $pod_name Virsh domain: $vm"
79 echo "ssh -i ~/.ssh/id_rsa admin@$(kubectl get pods $pod_name -o jsonpath="{.status.podIP}")"
80 echo "kubectl attach -it $pod_name"
81 echo "=== Virtlet details ===="
82 echo "$(kubectl virt virsh dumpxml $vm | grep VIRTLET_)\n"
86 if [ "${TEARDOWN_ACTION}" == "cleanup" ]; then
87 print_msg "Teardown integration scenario"
88 teardown $packetgen_deployment_name $firewall_deployment_name $sink_deployment_name
89 for item in $unprotected_private_net $protected_private_net $onap_private_net sink-service sink_configmap; do
90 kubectl delete -f $item.yaml
93 print_msg "Integration scenario access"
94 echo "You can access darkstat service on your pc by (for example) port forwarding sink service"
95 echo '`kubectl port-forward svc/sink-service 667`'
96 echo "or by direct access to any k8s node under port $(kubectl get svc sink-service -o jsonpath='{.spec.ports[0].nodePort}')"