- maas $PROFILE vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True primary_rack=$PRIMARY_RACK_CONTROLLER || true
-
- MY_GATEWAY=`cat deployconfig.json | jq '.opnfv.admNetgway' | cut -d \" -f 2`
- MY_NAMESERVER=`cat deployconfig.json | jq '.opnfv.upstream_dns' | cut -d \" -f 2`
- maas $PROFILE subnet update $SUBNET_CIDR gateway_ip=$MY_GATEWAY || true
- maas $PROFILE subnet update $SUBNET_CIDR dns_servers=$MY_NAMESERVER || true
-
- #below command will enable the interface with internal-api space.
-
- SPACEID=$(maas $PROFILE space read internal-api | jq '.id')
- maas $PROFILE subnet update $SUBNET_CIDR space=$SPACEID || true
-
+ if [ "$space" == "admin" ]; then
+ MY_GATEWAY=`cat labconfig.json | jq '.opnfv.spaces[] | select(.type=="admin")'.gateway | cut -d \" -f 2 `
+ #MY_NAMESERVER=`cat deployconfig.json | jq '.opnfv.upstream_dns' | cut -d \" -f 2`
+ maas $PROFILE subnet update $TEMP_CIDR gateway_ip=$MY_GATEWAY || true
+ #maas $PROFILE subnet update $TEMP_CIDR dns_servers=$MY_NAMESERVER || true
+ #below command will enable the interface with internal-api space.
+ SPACEID=$(maas $PROFILE space read internal-api | jq '.id')
+ maas $PROFILE subnet update $TEMP_CIDR space=$SPACEID || true
+ if [ "$enabledhcp" == "true" ]; then
+ maas $PROFILE vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True primary_rack=$PRIMARY_RACK_CONTROLLER || true
+ fi
+ elif [ "$space" == "data" ]; then
+ MY_GATEWAY=`cat labconfig.json | jq '.opnfv.spaces[] | select(.type=="data")'.gateway | cut -d \" -f 2 `
+ if [ $MY_GATEWAY ]; then
+ maas $PROFILE subnet update $TEMP_CIDR gateway_ip=$MY_GATEWAY || true
+ fi
+ #below command will enable the interface with data-api space for data network.
+ SPACEID=$(maas $PROFILE space read data-api | jq '.id')
+ maas $PROFILE subnet update $TEMP_CIDR space=$SPACEID || true
+ if [ "$enabledhcp" == "true" ]; then
+ maas $PROFILE vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True primary_rack=$PRIMARY_RACK_CONTROLLER || true
+ fi
+ elif [ "$space" == "public" ]; then
+ MY_GATEWAY=`cat labconfig.json | jq '.opnfv.spaces[] | select(.type=="data")'.public | cut -d \" -f 2 `
+ if [ $MY_GATEWAY ]; then
+ maas $PROFILE subnet update $TEMP_CIDR gateway_ip=$MY_GATEWAY || true
+ fi
+ #below command will enable the interface with public-api space for data network.
+ SPACEID=$(maas $PROFILE space read public-api | jq '.id')
+ maas $PROFILE subnet update $TEMP_CIDR space=$SPACEID || true
+ if [ "$enabledhcp" == "true" ]; then
+ maas $PROFILE vlan update $FABRIC_ID $VLAN_TAG dhcp_on=True primary_rack=$PRIMARY_RACK_CONTROLLER || true
+ fi
+ fi