removed usage of brctl and dependency on bridge-utils library as it is deprecated, replaced with using iproute instead

This commit is contained in:
Blake Harnden 2019-12-23 14:48:56 -08:00
parent 8029a27bb4
commit fe8bc6f10e
8 changed files with 30 additions and 44 deletions

View file

@ -60,7 +60,6 @@ fpm -s dir -t rpm -n core \
-d "tk" \
-d "procps-ng" \
-d "bash >= 3.0" \
-d "bridge-utils" \
-d "ebtables" \
-d "iproute" \
-d "libev" \
@ -88,7 +87,6 @@ fpm -s dir -t deb -n core \
-d "procps" \
-d "libc6 >= 2.14" \
-d "bash >= 3.0" \
-d "bridge-utils" \
-d "ebtables" \
-d "iproute2" \
-d "libev4" \
@ -128,7 +126,6 @@ $(info creating file $1 from $1.in)
-e 's,[@]CORE_DATA_DIR[@],$(CORE_DATA_DIR),g' \
-e 's,[@]CORE_CONF_DIR[@],$(CORE_CONF_DIR),g' \
-e 's,[@]CORE_GUI_CONF_DIR[@],$(CORE_GUI_CONF_DIR),g' \
-e 's,[@]brctl_path[@],$(brctl_path),g' \
-e 's,[@]sysctl_path[@],$(sysctl_path),g' \
-e 's,[@]ip_path[@],$(ip_path),g' \
-e 's,[@]tc_path[@],$(tc_path),g' \

View file

@ -113,11 +113,6 @@ if test "x$enable_daemon" = "xyes"; then
AM_PATH_PYTHON(3.6)
AS_IF([$PYTHON -m grpc_tools.protoc -h &> /dev/null], [], [AC_MSG_ERROR([please install python grpcio-tools])])
AC_CHECK_PROG(brctl_path, brctl, $as_dir, no, $SEARCHPATH)
if test "x$brctl_path" = "xno" ; then
AC_MSG_ERROR([Could not locate brctl (from bridge-utils package).])
fi
AC_CHECK_PROG(sysctl_path, sysctl, $as_dir, no, $SEARCHPATH)
if test "x$sysctl_path" = "xno" ; then
AC_MSG_ERROR([Could not locate sysctl (from procps package).])

View file

@ -8,7 +8,6 @@ FRR_STATE_DIR = "@CORE_STATE_DIR@/run/frr"
VNODED_BIN = which("vnoded", required=True)
VCMD_BIN = which("vcmd", required=True)
BRCTL_BIN = which("brctl", required=True)
SYSCTL_BIN = which("sysctl", required=True)
IP_BIN = which("ip", required=True)
ETHTOOL_BIN = which("ethtool", required=True)

View file

@ -1,8 +1,9 @@
"""
Clients for dealing with bridge/interface commands.
"""
import json
from core.constants import BRCTL_BIN, ETHTOOL_BIN, IP_BIN, OVS_BIN, TC_BIN
from core.constants import ETHTOOL_BIN, IP_BIN, OVS_BIN, TC_BIN
def get_net_client(use_ovs, run):
@ -231,17 +232,12 @@ class LinuxNetClient:
:param str name: bridge name
:return: nothing
"""
self.run(f"{BRCTL_BIN} addbr {name}")
self.run(f"{BRCTL_BIN} stp {name} off")
self.run(f"{BRCTL_BIN} setfd {name} 0")
self.run(f"{IP_BIN} link add name {name} type bridge")
self.run(f"{IP_BIN} link set {name} type bridge stp_state 0")
self.run(f"{IP_BIN} link set {name} type bridge forward_delay 0")
self.run(f"{IP_BIN} link set {name} type bridge mcast_snooping 0")
self.device_up(name)
# turn off multicast snooping so forwarding occurs w/o IGMP joins
snoop_file = "multicast_snooping"
snoop = f"/sys/devices/virtual/net/{name}/bridge/{snoop_file}"
self.run(f"echo 0 > /tmp/{snoop_file}", shell=True)
self.run(f"cp /tmp/{snoop_file} {snoop}")
def delete_bridge(self, name):
"""
Bring down and delete a Linux bridge.
@ -250,7 +246,7 @@ class LinuxNetClient:
:return: nothing
"""
self.device_down(name)
self.run(f"{BRCTL_BIN} delbr {name}")
self.run(f"{IP_BIN} link delete {name} type bridge")
def create_interface(self, bridge_name, interface_name):
"""
@ -260,7 +256,7 @@ class LinuxNetClient:
:param str interface_name: interface name
:return: nothing
"""
self.run(f"{BRCTL_BIN} addif {bridge_name} {interface_name}")
self.run(f"{IP_BIN} link set dev {interface_name} master {bridge_name}")
self.device_up(interface_name)
def delete_interface(self, bridge_name, interface_name):
@ -271,7 +267,7 @@ class LinuxNetClient:
:param str interface_name: interface name
:return: nothing
"""
self.run(f"{BRCTL_BIN} delif {bridge_name} {interface_name}")
self.run(f"{IP_BIN} link set dev {interface_name} nomaster")
def existing_bridges(self, _id):
"""
@ -279,11 +275,10 @@ class LinuxNetClient:
:param _id: node id to check bridges for
"""
output = self.run(f"{BRCTL_BIN} show")
lines = output.split("\n")
for line in lines[1:]:
columns = line.split()
name = columns[0]
output = self.run(f"{IP_BIN} -j link show type bridge")
bridges = json.loads(output)
for bridge in bridges:
name = bridge["ifname"]
fields = name.split(".")
if len(fields) != 3:
continue
@ -298,7 +293,7 @@ class LinuxNetClient:
:param str name: bridge name
:return: nothing
"""
self.run(f"{BRCTL_BIN} setageing {name} 0")
self.run(f"{IP_BIN} link set {name} type bridge ageing_time 0")
class OvsNetClient(LinuxNetClient):

View file

@ -26,7 +26,7 @@ the core-daemon for development based on Ubuntu 18.04.
### Install Dependencies
```shell
sudo apt install -y automake pkg-config gcc libev-dev bridge-utils ebtables gawk \
sudo apt install -y automake pkg-config gcc libev-dev ebtables gawk \
python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf
```
@ -188,7 +188,7 @@ Here are some other Linux commands that are useful for managing the Linux networ
```shell
# view the Linux bridging setup
brctl show
ip link show type bridge
# view the netem rules used for applying link effects
tc qdisc show
# view the rules that make the wireless LAN work

View file

@ -218,26 +218,26 @@ python3 -m pip install grpcio-tools
### Ubuntu 18.04 Requirements
```shell
sudo apt install automake pkg-config gcc libev-dev bridge-utils ebtables python3-dev python3-setuptools tk libtk-img ethtool
sudo apt install automake pkg-config gcc libev-dev ebtables python3-dev python3-setuptools tk libtk-img ethtool
```
### Ubuntu 16.04 Requirements
```shell
sudo apt-get install automake bridge-utils ebtables python3-dev libev-dev python3-setuptools libtk-img ethtool
sudo apt-get install automake ebtables python3-dev libev-dev python3-setuptools libtk-img ethtool
```
### CentOS 7 with Gnome Desktop Requirements
```shell
sudo yum -y install automake gcc python3-devel python3-devel libev-devel tk ethtool
sudo yum -y install automake gcc python36 python36-devel libev-devel tk ethtool
```
## Build and Install
```shell
./bootstrap.sh
PYTHON=python3 ./configure
./configure
make
sudo make install
```
@ -251,7 +251,7 @@ sudo apt install python3-sphinx
sudo yum install python3-sphinx
./bootstrap.sh
PYTHON=python3 ./configure
./configure
make doc
```
@ -264,7 +264,7 @@ Build package commands, DESTDIR is used to make install into and then for packag
```shell
./bootstrap.sh
PYTHON=python3 ./configure
./configure
make
mkdir /tmp/core-build
make fpm DESTDIR=/tmp/core-build

View file

@ -464,7 +464,7 @@ to **dummy0**, and link this to a node in your scenario. After starting the
session, configure an address on the host.
```shell
sudo brctl show
sudo ip link show type bridge
# determine bridge name from the above command
# assign an IP address on the same network as the linked node
sudo ip addr add 10.0.1.2/24 dev b.48304.34658

View file

@ -70,7 +70,7 @@ shift $((OPTIND - 1))
case ${os} in
"ubuntu")
echo "Installing CORE for Ubuntu"
sudo apt install -y automake pkg-config gcc libev-dev bridge-utils ebtables gawk iproute2 \
sudo apt install -y automake pkg-config gcc libev-dev ebtables gawk iproute2 \
python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf
install_ospf_mdr
if [[ -z ${dev} ]]; then
@ -86,7 +86,7 @@ case ${os} in
fi
;;
"centos")
sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ libev-devel bridge-utils iptables-ebtables iproute \
sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ libev-devel iptables-ebtables iproute \
python36 python36-devel python3-pip python3-tkinter tk ethtool libtool readline-devel autoconf gawk
install_ospf_mdr
if [[ -z ${dev} ]]; then