adding metal3 vm verifier
[icn.git] / deploy / metal3-vm / ubuntu_bridge_network_configuration.sh
1 #!/usr/bin/env bash
2
3 set -xe
4
5 # shellcheck disable=SC1091
6 source lib/logging.sh
7 # shellcheck disable=SC1091
8 source lib/common.sh
9
10 if [ "$MANAGE_PRO_BRIDGE" == "y" ]; then
11      # Adding an IP address in the libvirt definition for this network results in
12      # dnsmasq being run, we don't want that as we have our own dnsmasq, so set
13      # the IP address here
14      sudo brctl addbr provisioning
15      # sudo ifconfig provisioning 172.22.0.1 netmask 255.255.255.0 up
16      # Use ip command. ifconfig commands are deprecated now.
17      sudo ip addr add dev provisioning 172.22.0.1/24
18      sudo ip link set provisioning up
19
20      # Need to pass the provision interface for bare metal
21      if [ "$PRO_IF" ]; then
22        sudo brctl addif provisioning "$PRO_IF"
23      fi
24  fi
25
26  if [ "$MANAGE_INT_BRIDGE" == "y" ]; then
27      # Create the baremetal bridge
28      if ! [[  $(ip a show baremetal) ]]; then
29        sudo brctl addbr baremetal
30        # sudo ifconfig baremetal 192.168.111.1 netmask 255.255.255.0 up
31        # Use ip command. ifconfig commands are deprecated now.
32        sudo ip addr add dev baremetal 192.168.111.1/24
33        sudo ip link set baremetal up
34      fi
35
36      # Add the internal interface to it if requests, this may also be the interface providing
37      # external access so we need to make sure we maintain dhcp config if its available
38      if [ "$INT_IF" ]; then
39        sudo brctl addif "$INT_IF"
40      fi
41  fi
42
43  # restart the libvirt network so it applies an ip to the bridge
44  if [ "$MANAGE_BR_BRIDGE" == "y" ] ; then
45      sudo virsh net-destroy baremetal
46      sudo virsh net-start baremetal
47      if [ "$INT_IF" ]; then #Need to bring UP the NIC after destroying the libvirt network
48          sudo ifup "$INT_IF"
49      fi
50  fi