Replace brctl command with ip

Message ID 20240203-brctl-v1-1-e3dbcc8f2152@daynix.com (mailing list archive)
State New
Headers
Series Replace brctl command with ip |

Commit Message

Akihiko Odaki Feb. 3, 2024, 10:25 a.m. UTC
  README of bridge-utils v1.7.1 says:
> This utility is DEPRECATED. No new features will ever be added.
> Instead use the bridge command from the iproute2 package which
> supports more features.
https://git.kernel.org/pub/scm/network/bridge/bridge-utils.git/tree/README?h=v1.7.1

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 framework/qemu_kvm.py                       | 2 +-
 framework/qemu_libvirt.py                   | 2 +-
 test_plans/sriov_kvm_test_plan.rst          | 2 +-
 test_plans/vf_port_start_stop_test_plan.rst | 2 +-
 tests/TestSuite_ip_pipeline.py              | 6 +++---
 5 files changed, 7 insertions(+), 7 deletions(-)


---
base-commit: 427e7c3f37bbb1263d81c466d7a83e9193013321
change-id: 20240203-brctl-8fdbef4c69be

Best regards,
  

Patch

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index b656675c..7f6df7c2 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -68,7 +68,7 @@  class QEMUKvm(VirtBase):
         + "   tunctl -t $1\n"
         + "   ip link set $1 up\n"
         + "   sleep 0.5s\n"
-        + "   brctl addif $switch $1\n"
+        + "   ip link set $1 master $switch\n"
         + "   exit 0\n"
         + "else\n"
         + "   echo 'Error: no interface specified'\n"
diff --git a/framework/qemu_libvirt.py b/framework/qemu_libvirt.py
index e99ce8fb..22214481 100644
--- a/framework/qemu_libvirt.py
+++ b/framework/qemu_libvirt.py
@@ -30,7 +30,7 @@  class LibvirtKvm(VirtBase):
         + "   tunctl -t $1\n"
         + "   ip link set $1 up\n"
         + "   sleep 0.5s\n"
-        + "   brctl addif $switch $1\n"
+        + "   ip link set $1 master $switch\n"
         + "   exit 0\n"
         + "else\n"
         + "   echo 'Error: no interface specified'\n"
diff --git a/test_plans/sriov_kvm_test_plan.rst b/test_plans/sriov_kvm_test_plan.rst
index c9085dd9..42d3c059 100644
--- a/test_plans/sriov_kvm_test_plan.rst
+++ b/test_plans/sriov_kvm_test_plan.rst
@@ -47,7 +47,7 @@  The /etc/qemu-ifup can be below script, need you to create first::
         /usr/sbin/tunctl -u `whoami` -t $1
         /sbin/ip link set $1 up
         sleep 0.5s
-        /usr/sbin/brctl addif $switch $1
+        /sbin/ip link set $1 master $switch
         exit 0
     else
         echo "Error: no interface specified"
diff --git a/test_plans/vf_port_start_stop_test_plan.rst b/test_plans/vf_port_start_stop_test_plan.rst
index 502afa6c..618fcb99 100644
--- a/test_plans/vf_port_start_stop_test_plan.rst
+++ b/test_plans/vf_port_start_stop_test_plan.rst
@@ -72,7 +72,7 @@  Create Two VF interfaces from two kernel PF interfaces, and then attach them to
           /usr/sbin/tunctl -u `whoami` -t $1
           /sbin/ip link set $1 up
           sleep 0.5s
-          /usr/sbin/brctl addif $switch $1
+          /sbin/ip link set $1 master $switch
           exit 0
       else
           echo "Error: no interface specified"
diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index 19b297de..44dfaf5f 100644
--- a/tests/TestSuite_ip_pipeline.py
+++ b/tests/TestSuite_ip_pipeline.py
@@ -832,9 +832,9 @@  class TestIpPipeline(TestCase):
         self.dut.send_expect(cmd, "fwd port 3", 60)
 
         tap_session = self.dut.new_session()
-        cmd = "ip link set br1 down; brctl delbr br1"
+        cmd = "ip link set br1 down; ip link delete br1"
         tap_session.send_expect(cmd, "# ", 20)
-        cmd = "brctl addbr br1; brctl addif br1 TAP0; brctl addif br1 TAP1"
+        cmd = "ip link add br1 type bridge; ip link set TAP0 master br1; ip link set TAP1 master br1"
         tap_session.send_expect(cmd, "# ", 20)
         cmd = "ifconfig TAP0 up;  ifconfig TAP1 up; ifconfig br1 up"
         tap_session.send_expect(cmd, "# ", 20)
@@ -874,7 +874,7 @@  class TestIpPipeline(TestCase):
         cmd = "^C"
         self.dut.send_expect(cmd, "# ", 20)
 
-        cmd = "ip link set br1 down; brctl delbr br1"
+        cmd = "ip link set br1 down; ip link delete br1"
         tap_session.send_expect(cmd, "# ", 20)
         self.dut.close_session(tap_session)