blob: 9a08fcf6eaff596b37bb7ae8736ec4a665a543bd [file] [log] [blame]
Steven9cd2d7a2017-12-20 12:43:01 -08001from vpp_interface import VppInterface
2
3
4class VppBondInterface(VppInterface):
5 """VPP bond interface."""
6
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02007 def __init__(
8 self,
9 test,
10 mode,
11 lb=0,
12 numa_only=0,
13 enable_gso=0,
14 use_custom_mac=0,
15 mac_address="",
16 id=0xFFFFFFFF,
17 ):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020018 """Create VPP Bond interface"""
Klement Sekerab9ef2732018-06-24 22:49:33 +020019 super(VppBondInterface, self).__init__(test)
Steven9cd2d7a2017-12-20 12:43:01 -080020 self.mode = mode
21 self.lb = lb
Zhiyong Yang751e3f32019-06-26 05:49:14 -040022 self.numa_only = numa_only
Steven Luongea717862020-07-30 07:31:40 -070023 self.enable_gso = enable_gso
Steven9cd2d7a2017-12-20 12:43:01 -080024 self.use_custom_mac = use_custom_mac
25 self.mac_address = mac_address
Steven Luongea717862020-07-30 07:31:40 -070026 self.id = id
Steven9cd2d7a2017-12-20 12:43:01 -080027
28 def add_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020029 r = self.test.vapi.bond_create2(
30 self.mode,
31 self.lb,
32 self.numa_only,
33 self.enable_gso,
34 self.use_custom_mac,
35 self.mac_address,
36 self.id,
37 )
Klement Sekerab9ef2732018-06-24 22:49:33 +020038 self.set_sw_if_index(r.sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080039
40 def remove_vpp_config(self):
41 self.test.vapi.bond_delete(self.sw_if_index)
42
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020043 def add_member_vpp_bond_interface(
44 self, sw_if_index, is_passive=0, is_long_timeout=0
45 ):
46 self.test.vapi.bond_add_member(
47 sw_if_index, self.sw_if_index, is_passive, is_long_timeout
48 )
Steven9cd2d7a2017-12-20 12:43:01 -080049
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020050 def detach_vpp_bond_interface(self, sw_if_index):
Steven Luong4c4223e2020-07-15 08:44:54 -070051 self.test.vapi.bond_detach_member(sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080052
53 def is_interface_config_in_dump(self, dump):
54 for i in dump:
55 if i.sw_if_index == self.sw_if_index:
56 return True
57 else:
58 return False