Use Vagrantfile to build virtual site
[icn.git] / deploy / metal3-vm / ubuntu_bridge_network_configuration.sh
index dffa678..60875cb 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/env bash
-
-set -xe
+set -eux -o pipefail
 
 # shellcheck disable=SC1091
 source lib/logging.sh
@@ -11,24 +10,20 @@ if [ "$MANAGE_PRO_BRIDGE" == "y" ]; then
      # Adding an IP address in the libvirt definition for this network results in
      # dnsmasq being run, we don't want that as we have our own dnsmasq, so set
      # the IP address here
-     sudo brctl addbr provisioning
-     # sudo ifconfig provisioning 172.22.0.1 netmask 255.255.255.0 up
-     # Use ip command. ifconfig commands are deprecated now.
+     sudo ip link add dev provisioning type bridge
      sudo ip addr add dev provisioning 172.22.0.1/24
      sudo ip link set provisioning up
 
      # Need to pass the provision interface for bare metal
      if [ "$PRO_IF" ]; then
-       sudo brctl addif provisioning "$PRO_IF"
+       sudo ip link set dev "$PRO_IF" master provisioning
      fi
  fi
 
  if [ "$MANAGE_INT_BRIDGE" == "y" ]; then
      # Create the baremetal bridge
      if ! [[  $(ip a show baremetal) ]]; then
-       sudo brctl addbr baremetal
-       # sudo ifconfig baremetal 192.168.111.1 netmask 255.255.255.0 up
-       # Use ip command. ifconfig commands are deprecated now.
+       sudo ip link add dev baremetal type bridge
        sudo ip addr add dev baremetal 192.168.111.1/24
        sudo ip link set baremetal up
      fi
@@ -36,7 +31,7 @@ if [ "$MANAGE_PRO_BRIDGE" == "y" ]; then
      # Add the internal interface to it if requests, this may also be the interface providing
      # external access so we need to make sure we maintain dhcp config if its available
      if [ "$INT_IF" ]; then
-       sudo brctl addif "$INT_IF"
+       sudo ip link set dev "$INT_IF" master baremetal
      fi
  fi
 
@@ -45,6 +40,6 @@ if [ "$MANAGE_PRO_BRIDGE" == "y" ]; then
      sudo virsh net-destroy baremetal
      sudo virsh net-start baremetal
      if [ "$INT_IF" ]; then #Need to bring UP the NIC after destroying the libvirt network
-         sudo ifup "$INT_IF"
+         sudo ip link set dev "$INT_IF" up
      fi
  fi