Merge "Install jq as an dependency for yq"
[multicloud/k8s.git] / kud / tests / integration_vcFW.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018
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 ##############################################################################
10
11 set -o errexit
12 set -o nounset
13 set -o pipefail
14
15 source _common.sh
16 source _common_test.sh
17 source _functions.sh
18
19 csar_id=aa443e7e-c8ba-11e8-8877-525400b164ff
20
21 # Setup
22 install_ovn_deps
23 if [[ ! -f $HOME/.ssh/id_rsa.pub ]]; then
24     echo -e "\n\n\n" | ssh-keygen -t rsa -N ""
25 fi
26 populate_CSAR_vms_containers_vFW $csar_id
27
28 pushd ${CSAR_DIR}/${csar_id}
29 for net in $unprotected_private_net $protected_private_net $onap_private_net; do
30     cleanup_network $net.yaml
31     echo "Create OVN Network $net network"
32     init_network $net.yaml
33 done
34 for resource in onap-ovn4nfvk8s-network sink-service sink_configmap; do
35     kubectl apply -f $resource.yaml
36 done
37 setup $packetgen_deployment_name $firewall_deployment_name $sink_deployment_name
38 #kubectl port-forward deployment/$sink_deployment_name 667:667
39
40 # Test
41 for deployment_name in $packetgen_deployment_name $firewall_deployment_name; do
42     pod_name=$(kubectl get pods | grep  $deployment_name | awk '{print $1}')
43     vm=$(kubectl virt virsh list | grep ".*$deployment_name"  | awk '{print $2}')
44     echo "Pod name: $pod_name Virsh domain: $vm"
45     echo "ssh -i ~/.ssh/id_rsa.pub admin@$(kubectl get pods $pod_name -o jsonpath="{.status.podIP}")"
46     echo "kubectl attach -it $pod_name"
47     echo "=== Virtlet details ===="
48     echo "$(kubectl virt virsh dumpxml $vm | grep VIRTLET_)\n"
49 done
50
51 # Teardown
52 #teardown $packetgen_deployment_name $firewall_deployment_name $sink_deployment_name
53 #for net in $unprotected_private_net $protected_private_net $onap_private_net; do
54 #    cleanup_network $net.yaml
55 #done
56 popd