diff options
-rwxr-xr-x | ci/03-maasdeploy.sh | 3 | ||||
-rwxr-xr-x | ci/deploy.sh | 26 | ||||
-rw-r--r-- | labconfig/orange/pod2/labconfig.yaml | 6 |
3 files changed, 31 insertions, 4 deletions
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 4307088f..04066c9b 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -558,9 +558,10 @@ if [ -e ./labconfig.json ]; then NODE_SYS_ID=$(maas $PROFILE nodes read | jq -r ".[] | select(.hostname==\"$NODE_NAME\")".system_id) echo ">>> Configuring node $NODE_NAME [$NODE_ID][$NODE_SYS_ID]" # Recover the network interfaces list and configure each one - # with sorting the list, we have hardware interface first the vlan interfaces + # with sorting the list, we have hardware interface first, than the vlan interfaces IF_LIST=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] ".ifname | sort -u) for IF_NAME in $IF_LIST; do + # get the space of the interface IF_SPACE=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] | select(.ifname==\"$IF_NAME\") ".spaces[]) case "$IF_SPACE" in 'data') SUBNET_CIDR=$SUBNETDATA_CIDR; IF_MODE='AUTO' ;; diff --git a/ci/deploy.sh b/ci/deploy.sh index 05fc462d..e1ec7a69 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -203,6 +203,32 @@ check_status echo "...... deployment finished ......." + +echo "...... configuring public access ......." + +# translate bundle.yaml to json +python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < bundles.yaml > bundles.json +# get services list having a public interface +srv_list=$(cat bundles.json | jq -r ".services | to_entries[] | {\"key\": .key, \"value\": .value[\"bindings\"]} | select (.value!=null) | select(.value[] | contains(\"public-api\"))".key) +# get cnt list from service list +cnt_list=$(for cnt in $srv_list; do juju status $cnt --format=json | jq -r ".machines[].containers | to_entries[]".key; done) +# get public network gateway (supposing it is the first ip of the network) +public_api_gw=$(cat labconfig.json | jq --raw-output ".opnfv.spaces[] | select(.type==\"public\")".gateway) +admin_gw=$(cat labconfig.json | jq --raw-output ".opnfv.spaces[] | select(.type==\"admin\")".gateway) +# set default gateway to public api gateway +for cnt in $cnt_list; do + echo "changing default gw on $cnt" + juju ssh $cnt "sudo ip r d default && sudo ip r a default via $public_api_gw"; + juju ssh $cnt "gw_dev=\$(ip r l | grep 'via $public_api_gw' | cut -d \ -f5) &&\ + sudo cp /etc/network/interfaces /etc/network/interfaces.bak &&\ + echo 'removing old default gateway' &&\ + sudo perl -i -pe 's/^\ *gateway $admin_gw\n$//' /etc/network/interfaces &&\ + sudo perl -i -pe \"s/iface \$gw_dev inet static/iface \$gw_dev inet static\\n gateway $public_api_gw/\" /etc/network/interfaces \ + "; +done + +echo "...... configure ......." + if [[ "$opnfvmodel" = "openstack" ]]; then ./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true diff --git a/labconfig/orange/pod2/labconfig.yaml b/labconfig/orange/pod2/labconfig.yaml index 7e19abca..c0d03daa 100644 --- a/labconfig/orange/pod2/labconfig.yaml +++ b/labconfig/orange/pod2/labconfig.yaml @@ -147,10 +147,10 @@ opnfv: - type: public bridge: brApi cidr: 10.2.1.0/24 - gateway: + gateway: 10.2.1.1 vlan: 2056 - type: floating bridge: brFloating - cidr: + cidr: gateway: - vlan: + vlan: |