From 6f374141466640655cc57277b4b49d6deffa9092 Mon Sep 17 00:00:00 2001 From: Dimitrios Markou Date: Wed, 21 Mar 2018 16:09:58 +0200 Subject: Add pod.yaml files for Apex JIRA: YARDSTICK-1097 Change-Id: If116174c562bc08c0b7602324599bc85d8c60be0 Signed-off-by: Dimitrios Markou --- etc/yardstick/nodes/apex_baremetal/pod.yaml | 46 ++++++++++++++++++++ etc/yardstick/nodes/apex_virtual/pod.yaml | 40 +++++++++++++++++ tests/ci/prepare_env.sh | 67 +++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 etc/yardstick/nodes/apex_baremetal/pod.yaml create mode 100644 etc/yardstick/nodes/apex_virtual/pod.yaml diff --git a/etc/yardstick/nodes/apex_baremetal/pod.yaml b/etc/yardstick/nodes/apex_baremetal/pod.yaml new file mode 100644 index 000000000..4b058c499 --- /dev/null +++ b/etc/yardstick/nodes/apex_baremetal/pod.yaml @@ -0,0 +1,46 @@ +############################################################################## +# Copyright (c) 2018 Intracom Telecom and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +nodes: +- + name: node1 + role: Controller + ip: ip1 + user: heat-admin + key_filename: node_keyfile +- + name: node2 + role: Controller + ip: ip2 + user: heat-admin + key_filename: node_keyfile +- + name: node3 + role: Controller + ip: ip3 + user: heat-admin + key_filename: node_keyfile +- + name: node4 + role: Compute + ip: ip4 + user: heat-admin + key_filename: node_keyfile +- + name: node5 + role: Compute + ip: ip5 + user: heat-admin + key_filename: node_keyfile +- + name: node6 + role: Opendaylight-Cluster-Leader + ip: ip6 + user: heat-admin + key_filename: node_keyfile diff --git a/etc/yardstick/nodes/apex_virtual/pod.yaml b/etc/yardstick/nodes/apex_virtual/pod.yaml new file mode 100644 index 000000000..59b51d224 --- /dev/null +++ b/etc/yardstick/nodes/apex_virtual/pod.yaml @@ -0,0 +1,40 @@ +############################################################################## +# Copyright (c) 2018 Intracom Telecom and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +nodes: +- + name: node1 + role: Controller + ip: 192.0.2.15 + user: heat-admin + key_filename: /root/.ssh/id_rsa +- + name: node2 + role: Controller + ip: 192.0.2.4 + user: heat-admin + key_filename: /root/.ssh/id_rsa +- + name: node3 + role: Controller + ip: 192.0.2.6 + user: heat-admin + key_filename: /root/.ssh/id_rsa +- + name: node4 + role: Compute + ip: 192.0.2.10 + user: heat-admin + key_filename: /root/.ssh/id_rsa +- + name: node5 + role: Compute + ip: 192.0.2.14 + user: heat-admin + key_filename: /root/.ssh/id_rsa diff --git a/tests/ci/prepare_env.sh b/tests/ci/prepare_env.sh index d7c60d48f..8b9f887b2 100755 --- a/tests/ci/prepare_env.sh +++ b/tests/ci/prepare_env.sh @@ -16,6 +16,7 @@ : ${EXTERNAL_NETWORK:='admin_floating_net'} : ${USER_NAME:='ubuntu'} : ${SSH_KEY:='/root/.ssh/id_rsa'} +: ${DEPLOY_SCENARIO:='unknown'} # Extract network name from EXTERNAL_NETWORK # e.g. EXTERNAL_NETWORK='ext-net;flat;192.168.0.2;192.168.0.253;192.168.0.1;192.168.0.0/24' @@ -62,7 +63,73 @@ verify_connectivity() { } ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" +if [ "$INSTALLER_TYPE" == "apex" ]; then + # check the connection + verify_connectivity "${INSTALLER_IP}" + + pod_yaml="$YARDSTICK_REPO_DIR/etc/yardstick/nodes/apex_baremetal/pod.yaml" + + # update "ip" according to the CI env + ssh -l root "${INSTALLER_IP}" -i ${SSH_KEY} ${ssh_options} \ + "source /home/stack/stackrc && openstack server list -f yaml" > node_info + + controller_ips=($(awk '/control/{getline; {print $2}}' < node_info | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}')) + compute_ips=($(awk '/compute/{getline; {print $2}}' < node_info | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}')) + odl_ip="" + # Get ODL's cluster default module-shard Leader IP in HA scenario + if [[ ${DEPLOY_SCENARIO} == os-odl-*-ha ]]; then + for ip in "${controller_ips[@]}"; + do + if [[ "$odl_ip" ]]; then + break + fi + for ((i=0; i<${#controller_ips[@]}; i++)); + do + ODL_STATE=$(curl -s -u admin:admin -H "Accept: application/json" -H "Content-Type: application/json" \ + "http://"${ip}":8081/jolokia/read/org.opendaylight.controller:Category=Shards,name=member-"${i}"-shard-default-operational,type=DistributedOperationalDatastore" \ + | grep -o \"RaftState\"\:\"Leader\" | tr ":" "\n" | sed -n '2p' | sed 's/\"//g'); + + if [[ ${ODL_STATE} == "Leader" ]]; then + odl_ip=${ip} + break + fi + done; + done + + if [[ -z "$odl_ip" ]]; then + echo "ERROR: Opendaylight Leader IP is emtpy" + exit 1 + fi + + elif [[ ${DEPLOY_SCENARIO} == *"odl"* ]]; then + odl_ip=${controller_ips[0]} + fi + + if [[ ${controller_ips[0]} ]]; then + sed -i "s|ip1|${controller_ips[0]}|" "${pod_yaml}" + fi + if [[ ${controller_ips[1]} ]]; then + sed -i "s|ip2|${controller_ips[1]}|" "${pod_yaml}" + fi + if [[ ${controller_ips[2]} ]]; then + sed -i "s|ip3|${controller_ips[2]}|" "${pod_yaml}" + fi + if [[ ${compute_ips[0]} ]]; then + sed -i "s|ip4|${compute_ips[0]}|" "${pod_yaml}" + fi + if [[ ${compute_ips[1]} ]]; then + sed -i "s|ip5|${compute_ips[1]}|" "${pod_yaml}" + fi + if [[ ${odl_ip} ]]; then + sed -i "s|ip6|${odl_ip}|" "${pod_yaml}" + fi + + + # update 'key_filename' according to the CI env + sed -i "s|node_keyfile|${SSH_KEY}|" "${pod_yaml}" + +fi if [ "$INSTALLER_TYPE" == "fuel" ]; then # check the connection -- cgit 1.2.3-korg