3 # Update gateway mac to onos for l3 function
9 # Update gateway mac to onos for l3 function
10 # params: external CIDR, external gateway
11 function onos_update_gw_mac {
15 if [[ -z "$1" || -z "$2" ]]; then
22 if [ -z "$UNDERCLOUD" ]; then
23 #if not found then dnsmasq may be using leasefile-ro
24 instack_mac=$(virsh domiflist instack | grep default | \
25 grep -Eo "[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+")
26 UNDERCLOUD=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
28 # get controller ip address
29 controller_ip=$(ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
31 openstack server list | grep overcloud-controller-0 | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"
35 if [ -z "$controller_ip" ]; then
36 echo "ERROR: Failed to find controller_ip for overcloud-controller-0"
41 GW_MAC=$(arping ${GW_IP} -c 1 -I brbm2 | grep -Eo '([0-9a-fA-F]{2})(([/\s:-][0-9a-fA-F]{2}){5})')
43 if [ -z "$GW_MAC" ]; then
44 echo "ERROR: Failed to find gateway mac for ${GW_IP}"
48 # update gateway mac to onos
49 ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
50 ssh -T ${SSH_OPTIONS[@]} "heat-admin@${controller_ip}" <<EOF
51 echo "external gateway mac is ${GW_MAC}"
52 /opt/onos/bin/onos "externalgateway-update -m ${GW_MAC}"