# We have no vlan specified on spaces, but we have a vlan subinterface
IF_VLAN = ${IF_NAME##*.}; fi
+ # in case of interface renaming
+ IF_NEWNAME=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] | select(.ifname==\"$IF_NAME\") ".rename)
+
# In case of a VLAN interface
if ([ $IF_VLAN ] && [ "$IF_VLAN" != "null" ]); then
echo " >>> Configuring VLAN $IF_VLAN"
if [[ -z $INTERFACE ]]; then
# parent interface is not set because it does not have a SUBNET_CIDR
PARENT_VLANID=$(maas $PROFILE fabrics read | jq ".[].vlans[] | select(.fabric_id==$FABRICID and .name==\"untagged\")".id)
+ # If we need to rename the interface, use new interface name
+ if ([ $IF_NEWNAME ] && [ "$IF_NEWNAME" != "null" ]); then
+ PARENT_IF_NAME=${IF_NEWNAME%%.*}
+ IF_NAME=$IF_NEWNAME
+ else
+ PARENT_IF_NAME=${IF_NAME%%.*}
+ fi
# We set the physical interface to the targeted fabric
- PARENT_IF_NAME=${IF_NAME%%.*}
maas $PROFILE interface update $NODE_SYS_ID $PARENT_IF_NAME vlan=$PARENT_VLANID
- sleep 3
+ sleep 2
INTERFACE=$(maas $PROFILE interfaces read $NODE_SYS_ID | jq ".[] | select(.vlan.fabric_id==$FABRICID)".id)
fi
maas $PROFILE interfaces create-vlan $NODE_SYS_ID vlan=$VLANID parent=$INTERFACE || true
+ elif ([ $IF_NEWNAME ] && [ "$IF_NEWNAME" != "null" ]); then
+ # rename interface if needed
+ maas $PROFILE interface update $NODE_SYS_ID $IF_NAME name=$IF_NEWNAME
+ IF_NAME=$IF_NEWNAME
fi
-
# Configure the interface
if ([ $SUBNET_CIDR ] && [ "$SUBNET_CIDR" != "null" ]); then
VLANID=$(maas $PROFILE subnet read $SUBNET_CIDR | jq -r '.vlan.id')
- maas $PROFILE interface update $NODE_SYS_ID $IF_NAME vlan=$VLANID
+ if !([ $IF_VLAN ] && [ "$IF_VLAN" != "null" ]); then
+ # If this interface is not a VLAN (done withe create-vlan)
+ maas $PROFILE interface update $NODE_SYS_ID $IF_NAME vlan=$VLANID
+ fi
maas $PROFILE interface link-subnet $NODE_SYS_ID $IF_NAME mode=$IF_MODE subnet=$SUBNET_CIDR || true
- sleep 5
+ sleep 2
else
echo " >>> Not configuring, we have an empty Subnet CIDR"
fi
+
done
done
fi
spaces: [admin]
mac: ["1c:98:ec:11:ad:08"]
- ifname: eno2.2056
+ rename: eno99.2056
spaces: [public]
mac: ["1c:98:ec:11:ad:09"]
- ifname: eno2
+ rename: eno99
spaces: [floating]
mac: ["1c:98:ec:11:ad:09"]
- ifname: eno3
spaces: [admin]
mac: ["1c:98:ec:11:c2:c4"]
- ifname: eno2.2056
+ rename: eno99.2056
spaces: [public]
mac: ["1c:98:ec:11:c2:c5"]
- ifname: eno2
+ rename: eno99
spaces: [floating]
mac: ["1c:98:ec:11:c2:c5"]
- ifname: eno3
spaces: [admin]
mac: ["1c:98:ec:11:9d:c4"]
- ifname: eno2.2056
+ rename: eno99.2056
spaces: [public]
mac: ["1c:98:ec:11:9c:c5"]
- ifname: eno2
+ rename: eno99
spaces: [floating]
mac: ["1c:98:ec:11:9c:c5"]
- ifname: eno3
spaces: [admin]
mac: ["1c:98:ec:1c:5d:88"]
- ifname: ens3f0.2056
+ rename: eno99.2056
spaces: [public]
mac: ["a0:36:9f:1f:67:1c"]
- ifname: ens3f0
+ rename: eno99
spaces: [floating]
mac: ["a0:36:9f:1f:67:1c"]
- ifname: ens3f1
spaces: [admin]
mac: ["1c:98:ec:1d:84:7c"]
- ifname: ens3f0.2056
+ rename: eno99.2056
spaces: [public]
mac: ["a0:36:9f:1f:66:a4"]
- ifname: ens3f0
+ rename: eno99
spaces: [floating]
mac: ["a0:36:9f:1f:66:a4"]
- ifname: ens3f1
user: Administrator
pass: opnfv2017
floating-ip-range: 161.105.231.4,161.105.231.62,161.105.231.1,161.105.231.0/26
- ext-port: "ens3f0"
+ ext-port: "eno99"
dns: 10.2.0.1
osdomainname:
opnfv:
vlan: 2056
- type: floating
bridge: brFloating
- cidr:
+ cidr:
gateway:
- vlan:
+ vlan: