Merge "Adding monitor operator to monitor edge resources"
[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 if [[ ! -f $HOME/.ssh/id_rsa.pub ]]; then
23     echo -e "\n\n\n" | ssh-keygen -t rsa -N ""
24 fi
25 populate_CSAR_vms_containers_vFW $csar_id
26
27 pushd ${CSAR_DIR}/${csar_id}
28 for net in $unprotected_private_net $protected_private_net $onap_private_net; do
29     echo "Create OVN Network $net network"
30     kubectl apply -f $net.yaml
31 done
32 for resource in onap-ovn4nfvk8s-network sink-service sink_configmap; do
33     kubectl apply -f $resource.yaml
34 done
35 setup $packetgen_deployment_name $firewall_deployment_name $sink_deployment_name
36 #kubectl port-forward deployment/$sink_deployment_name 667:667
37
38 # Test
39 for deployment_name in $packetgen_deployment_name $firewall_deployment_name; do
40     pod_name=$(kubectl get pods | grep  $deployment_name | awk '{print $1}')
41     vm=$(kubectl virt virsh list | grep ".*$deployment_name"  | awk '{print $2}')
42     echo "Pod name: $pod_name Virsh domain: $vm"
43     echo "ssh -i ~/.ssh/id_rsa.pub admin@$(kubectl get pods $pod_name -o jsonpath="{.status.podIP}")"
44     echo "kubectl attach -it $pod_name"
45     echo "=== Virtlet details ===="
46     echo "$(kubectl virt virsh dumpxml $vm | grep VIRTLET_)\n"
47 done
48
49 # Teardown
50 #teardown $packetgen_deployment_name $firewall_deployment_name $sink_deployment_name
51 #for net in $unprotected_private_net $protected_private_net $onap_private_net; do
52 #    kubectl delete -f $net.yaml
53 #done
54 popd