diff options
Diffstat (limited to 'deployment/heat/onap-oom/scripts')
-rwxr-xr-x | deployment/heat/onap-oom/scripts/deploy.sh | 22 | ||||
-rwxr-xr-x | deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh | 68 |
2 files changed, 81 insertions, 9 deletions
diff --git a/deployment/heat/onap-oom/scripts/deploy.sh b/deployment/heat/onap-oom/scripts/deploy.sh index 056174d28..8ab79a2c8 100755 --- a/deployment/heat/onap-oom/scripts/deploy.sh +++ b/deployment/heat/onap-oom/scripts/deploy.sh @@ -12,6 +12,9 @@ ENV_FILE=$1 source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh +SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f +export OS_PASSWORD_ENCRYPTED=$(echo -n "$OS_PASSWORD" | openssl aes-128-ecb -e -K "$SO_ENCRYPTION_KEY" -nosalt | xxd -c 256 -p) + for n in $(seq 1 5); do $WORKSPACE/test/ete/scripts/teardown-onap.sh @@ -21,31 +24,32 @@ for n in $(seq 1 5); do for i in $(seq 1 30); do sleep 30 - K8S_IP=$(openstack stack output show onap-oom k8s_vm_ip -c output_value -f value) RANCHER_IP=$(openstack stack output show onap-oom rancher_vm_ip -c output_value -f value) - timeout 1 ping -c 1 "$K8S_IP" && timeout 1 ping -c 1 "$RANCHER_IP" && break + timeout 1 ping -c 1 "$RANCHER_IP" && break done - timeout 1 ping -c 1 "$K8S_IP" && timeout 1 ping -c 1 "$RANCHER_IP" && break + timeout 1 ping -c 1 "$RANCHER_IP" && break - echo Error: OpenStack infrastructure issue: unable to reach both rancher "$RANCHER_IP" and k8s "$K8S_IP" + echo Error: OpenStack infrastructure issue: unable to reach rancher "$RANCHER_IP" sleep 10 done -if ! timeout 1 ping -c 1 "$K8S_IP" || ! timeout 1 ping -c 1 "$RANCHER_IP"; then +if ! timeout 1 ping -c 1 "$RANCHER_IP"; then exit 2 fi -ssh-keygen -R $K8S_IP +ssh-keygen -R $RANCHER_IP for n in $(seq 1 10); do - timeout 15m ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$K8S_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap health"' + timeout 15m ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap health"' RESULT=$? if [ $RESULT -eq 0 ]; then break fi sleep 15m done -ROBOT_POD=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$K8S_IP 'sudo su -c "kubectl --namespace onap get pods"' | grep robot | sed 's/ .*//') -LOG_DIR=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$K8S_IP "sudo su -c \"kubectl exec $ROBOT_POD --namespace onap -- ls -1t /share/logs | head -1\"") +ROBOT_POD=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP 'sudo su -c "kubectl --namespace onap get pods"' | grep robot | sed 's/ .*//') +LOG_DIR=$(ssh -o StrictHostKeychecking=no -i ~/.ssh/onap_key ubuntu@$RANCHER_IP "sudo su -c \"kubectl exec $ROBOT_POD --namespace onap -- ls -1t /share/logs | head -1\"") + +K8S_IP=$(openstack stack output show onap-oom k8s_1_vm_ip -c output_value -f value) wget --user=robot --password=robot -r -np -nH --cut-dirs=2 -R "index.html*" -P $WORKSPACE/archives/ http://$K8S_IP:30209/logs/$LOG_DIR/ exit 0 diff --git a/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh new file mode 100755 index 000000000..19e7b60b1 --- /dev/null +++ b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +NUM_K8S_VMS=7 + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=`git rev-parse --show-toplevel` +fi +PARTS_DIR=$WORKSPACE/deployment/heat/onap-oom/parts + +cat <<EOF +# +# Generated by scripts/gen-onap-oom-yaml.sh; MANUAL CHANGES WILL BE LOST +# +EOF + +cat $PARTS_DIR/onap-oom-1.yaml + +cat <<EOF + rancher_vm: + type: OS::Nova::Server + properties: + name: rancher + image: { get_param: ubuntu_1604_image } + flavor: { get_param: rancher_vm_flavor } + key_name: onap_key + networks: + - port: { get_resource: rancher_private_port } + user_data_format: RAW + user_data: + str_replace: + template: + get_file: rancher_vm_entrypoint.sh + params: + __docker_proxy__: { get_param: docker_proxy } + __apt_proxy__: { get_param: apt_proxy } + __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] } + __integration_override_yaml__: { get_param: integration_override_yaml } + __oam_network_id__: { get_resource: oam_network } + __oam_subnet_id__: { get_resource: oam_subnet } + __k8s_vm_ips__: [ +EOF + +for VM_NUM in $(seq $NUM_K8S_VMS); do + K8S_VM_NAME=k8s_$VM_NUM + cat <<EOF + get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address], +EOF +done + +cat <<EOF + ] +EOF + +for VM_NUM in $(seq $NUM_K8S_VMS); do + K8S_VM_NAME=k8s_$VM_NUM envsubst < $PARTS_DIR/onap-oom-2.yaml +done + +cat $PARTS_DIR/onap-oom-3.yaml + +for VM_NUM in $(seq $NUM_K8S_VMS); do + K8S_VM_NAME=k8s_$VM_NUM + cat <<EOF + ${K8S_VM_NAME}_vm_ip: + description: The IP address of the ${K8S_VM_NAME} instance + value: { get_attr: [${K8S_VM_NAME}_floating_ip, floating_ip_address] } + +EOF +done |