blob: 636315cfce2936d44605615157c4871269beaf6b [file] [log] [blame]
Steven9cd2d7a2017-12-20 12:43:01 -08001from vpp_object import VppObject
2from vpp_interface import VppInterface
3
4
5class VppBondInterface(VppInterface):
6 """VPP bond interface."""
7
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02008 def __init__(
9 self,
10 test,
11 mode,
12 lb=0,
13 numa_only=0,
14 enable_gso=0,
15 use_custom_mac=0,
16 mac_address="",
17 id=0xFFFFFFFF,
18 ):
Steven9cd2d7a2017-12-20 12:43:01 -080019
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020020 """Create VPP Bond interface"""
Klement Sekerab9ef2732018-06-24 22:49:33 +020021 super(VppBondInterface, self).__init__(test)
Steven9cd2d7a2017-12-20 12:43:01 -080022 self.mode = mode
23 self.lb = lb
Zhiyong Yang751e3f32019-06-26 05:49:14 -040024 self.numa_only = numa_only
Steven Luongea717862020-07-30 07:31:40 -070025 self.enable_gso = enable_gso
Steven9cd2d7a2017-12-20 12:43:01 -080026 self.use_custom_mac = use_custom_mac
27 self.mac_address = mac_address
Steven Luongea717862020-07-30 07:31:40 -070028 self.id = id
Steven9cd2d7a2017-12-20 12:43:01 -080029
30 def add_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020031 r = self.test.vapi.bond_create2(
32 self.mode,
33 self.lb,
34 self.numa_only,
35 self.enable_gso,
36 self.use_custom_mac,
37 self.mac_address,
38 self.id,
39 )
Klement Sekerab9ef2732018-06-24 22:49:33 +020040 self.set_sw_if_index(r.sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080041
42 def remove_vpp_config(self):
43 self.test.vapi.bond_delete(self.sw_if_index)
44
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020045 def add_member_vpp_bond_interface(
46 self, sw_if_index, is_passive=0, is_long_timeout=0
47 ):
48 self.test.vapi.bond_add_member(
49 sw_if_index, self.sw_if_index, is_passive, is_long_timeout
50 )
Steven9cd2d7a2017-12-20 12:43:01 -080051
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020052 def detach_vpp_bond_interface(self, sw_if_index):
Steven Luong4c4223e2020-07-15 08:44:54 -070053 self.test.vapi.bond_detach_member(sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080054
55 def is_interface_config_in_dump(self, dump):
56 for i in dump:
57 if i.sw_if_index == self.sw_if_index:
58 return True
59 else:
60 return False