3 # launch eth on computer nodes and remove default gw route
4 # Update gateway mac to onos for l3 function
6 # author: York(Yuanyou)
7 # set the gateway ip and cidr and compute-node eth name.
41 # launch eth on computer nodes and remove default gw route
43 computer_list=$(juju status --format short | grep -Eo 'nodes-compute/[0-9]')
44 for node in $computer_list; do
45 echo "node name is ${node}"
46 juju ssh $node "sudo ifconfig $COMPUTE_ETH up"
47 juju ssh $node "sudo route del default gw $GW_IP"
51 # create external network and subnet in openstack
52 create_ext_network() {
53 keystoneIp=$(juju status --format short | grep keystone/0 | grep -v ha | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')
54 configOpenrc admin openstack admin http://$keystoneIp:5000/v2.0 Canonical
55 juju scp ./admin-openrc nova-cloud-controller/0:
56 juju ssh nova-cloud-controller/0 "source admin-openrc;neutron net-create ext-net --shared --router:external=True;neutron subnet-create ext-net --name ext-subnet $CIDR"
61 echo " " > ./admin-openrc
62 echo "export OS_USERNAME=$1" >> ./admin-openrc
63 echo "export OS_PASSWORD=$2" >> ./admin-openrc
64 echo "export OS_TENANT_NAME=$3" >> ./admin-openrc
65 echo "export OS_AUTH_URL=$4" >> ./admin-openrc
66 echo "export OS_REGION_NAME=$5" >> ./admin-openrc
69 # Update gateway mac to onos for l3 function
72 GW_MAC=$(juju ssh nova-compute/0 "arp -a ${GW_IP} | grep -Eo '([0-9a-fA-F]{2})(([/\s:-][0-9a-fA-F]{2}){5})'")
73 ## set external gateway mac in onos
74 juju set onos-controller gateway-mac=$GW_MAC