cleaner approach
diff --git a/xos/configurations/cord/dataplane/dataplane-bm.yaml b/xos/configurations/cord/dataplane/dataplane-bm.yaml
index 2fbbf6a..e1e78ee 100644
--- a/xos/configurations/cord/dataplane/dataplane-bm.yaml
+++ b/xos/configurations/cord/dataplane/dataplane-bm.yaml
@@ -5,11 +5,15 @@
- name: Create tunnel port on br-lan
openvswitch_port:
bridge=br-lan
- port={{ grename }}
+ port={{ item }}
state=present
+ with_items: "grenames.split(' ')"
- name: Set up GRE tunnel to vCPE
- shell: ovs-vsctl set Interface {{ grename }} type=gre options:remote_ip={{ bm_addr }}
+ shell: ovs-vsctl set Interface {{ item.0 }} type=gre options:remote_ip={{ item.1 }}
+ with_together:
+ - "grenames.split(' ')"
+ - "bm_ips.split(' ')"
- hosts: baremetal
diff --git a/xos/configurations/cord/dataplane/generate-bm.sh b/xos/configurations/cord/dataplane/generate-bm.sh
old mode 100755
new mode 100644
index 51504d1..8bd9a1b
--- a/xos/configurations/cord/dataplane/generate-bm.sh
+++ b/xos/configurations/cord/dataplane/generate-bm.sh
@@ -6,6 +6,9 @@
nova list --all-tenants|grep $LABEL|sed "s/^.*$NETWORK=//g"|sed 's/; .*$//g'|awk '{print $1}'
}
+GRENAMES=()
+BM_IPS=()
+
NODES=`sudo bash -c "source /root/setup/admin-openrc.sh ; nova hypervisor-list" |grep cloudlab|awk '{print $4}'`
I=1
for NODE in $NODES; do
@@ -13,19 +16,18 @@
IFS=. read BM_NAME BM_REMAINDER <<< $NODE
BM_IP=`grep -i $BM_NAME /root/setup/data-hosts.flat-lan-1 | awk '{print $1}'`
- echo switch_volt$I ansible_ssh_host=$( get_ip mysite_volt flat-lan-1-net) grename=gre-bm-$I bm_addr=$BM_IP
+ GRE_NAMES+=("gre-bm-$I")
+ BM_IPS+=("$BM_IP")
+
+ #echo switch_volt$I ansible_ssh_host=$( get_ip mysite_volt flat-lan-1-net) grename=gre-bm-$I bm_addr=$BM_IP
echo bm$I ansible_ssh_host=$BM_SSH_IP grename=gre-bm-$I volt_addr=$( get_ip mysite_volt flat-lan-1-net) ansible_ssh_private_key_file=/root/.ssh/id_rsa
I=$(( I+1 ))
done
-# a kludge for now -- just rerun the onos_volt step for each baremetal machine
+GRE_NAMES=${GRE_NAMES[@]}
+BM_IPS=${BM_IPS[@]}
-echo "[switch_volt]"
-I=1
-for NODE in $NODES; do
- echo switch_volt$I
- I=$((I+1))
-done
+echo switch_volt ansible_ssh_host=$( get_ip mysite_volt flat-lan-1-net) grenames=\"$GRE_NAMES\" bm_ips=\"$BM_IPS\"
echo "[baremetal]"
I=1