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, than the vlan interfaces
- IF_LIST=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] ".ifname | sort -u)
+ IF_LIST=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] ".ifname )
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[])
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)
+ IF_NEWNAME=$IF_NAME
+
+ if ([ $IF_NEWNAME ] && [ "$IF_NEWNAME" != "null" ]); then
+ # rename interface if needed
+ IF_MACLOWER=$( cat labconfig.json | jq ".lab.racks[0].nodes[$NODE_ID].nics[] | select(.ifname==\"$IF_NEWNAME\")".mac[0])
+ IF_MAC=(${IF_MACLOWER,,})
+ IF_ID=$( maas ubuntu interfaces read $NODE_SYS_ID | jq ".[] | select(.mac_address==$IF_MAC)".id)
+ maas $PROFILE interface update $NODE_SYS_ID $IF_ID name=$IF_NEWNAME
+ IF_NAME=$IF_NEWNAME
+ fi
# In case of a VLAN interface
if ([ $IF_VLAN ] && [ "$IF_VLAN" != "null" ]); then
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
architecture: x86_64
roles: [network,control]
nics:
- - ifname: enp11s0
+ - ifname: intf100
spaces: [admin]
mac: ["00:A0:A5:90:89:66"]
- - ifname: enp12s0
+ - ifname: intf101
spaces: [floating]
mac: ["00:A0:A5:90:89:67"]
- - ifname: enp3s0f1
+ - ifname: intf102
spaces: [data]
mac: ["00:A0:A5:90:89:65"]
power:
architecture: x86_64
roles: [compute,control,storage]
nics:
- - ifname: enp11s0
+ - ifname: intf100
spaces: [admin]
mac: ["00:A0:A5:90:89:A8"]
- - ifname: enp12s0
+ - ifname: intf101
spaces: [floating]
mac: ["00:A0:A5:90:89:A9"]
- - ifname: enp3s0f1
+ - ifname: intf102
spaces: [data]
mac: ["00:A0:A5:90:89:A7"]
power:
architecture: x86_64
roles: [compute,control,storage]
nics:
- - ifname: enp11s0
+ - ifname: intf100
spaces: [admin]
mac: ["00:A0:A5:90:89:28"]
- - ifname: enp12s0
+ - ifname: intf101
spaces: [floating]
mac: ["00:A0:A5:90:89:29"]
- - ifname: enp3s0f1
+ - ifname: intf102
spaces: [data]
mac: ["00:A0:A5:90:89:27"]
power:
architecture: x86_64
roles: [compute,storage]
nics:
- - ifname: enp11s0
+ - ifname: intf100
spaces: [admin]
mac: ["00:A0:A5:89:30:C6"]
- - ifname: enp12s0
+ - ifname: intf101
spaces: [floating]
mac: ["00:A0:A5:89:30:C7"]
- - ifname: enp3s0f1
+ - ifname: intf102
spaces: [data]
mac: ["00:A0:A5:89:30:C5"]
power:
architecture: x86_64
roles: [compute,storage]
nics:
- - ifname: enp11s0
+ - ifname: intf100
spaces: [admin]
mac: ["00:A0:A5:90:89:94"]
- - ifname: enp12s0
+ - ifname: intf101
spaces: [floating]
mac: ["00:A0:A5:90:89:95"]
- - ifname: enp3s0f1
+ - ifname: intf102
spaces: [data]
mac: ["00:A0:A5:90:89:93"]
power:
user: admin
pass: admin
floating-ip-range: 10.21.6.6,10.21.6.250,10.21.6.254,10.21.6.0/24
- ext-port: "enp12s0"
+ ext-port: "intf101"
dns: 8.8.8.8
osdomainname:
opnfv:
bridge: brData
cidr: 192.168.20.0/24
gateway: 192.168.20.254
- vlan:
\ No newline at end of file
+ vlan: