blob: bb49126f2a66b4a5ae0a67a98da77f21757b38aa [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 ):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020019 """Create VPP Bond interface"""
Klement Sekerab9ef2732018-06-24 22:49:33 +020020 super(VppBondInterface, self).__init__(test)
Steven9cd2d7a2017-12-20 12:43:01 -080021 self.mode = mode
22 self.lb = lb
Zhiyong Yang751e3f32019-06-26 05:49:14 -040023 self.numa_only = numa_only
Steven Luongea717862020-07-30 07:31:40 -070024 self.enable_gso = enable_gso
Steven9cd2d7a2017-12-20 12:43:01 -080025 self.use_custom_mac = use_custom_mac
26 self.mac_address = mac_address
Steven Luongea717862020-07-30 07:31:40 -070027 self.id = id
Steven9cd2d7a2017-12-20 12:43:01 -080028
29 def add_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020030 r = self.test.vapi.bond_create2(
31 self.mode,
32 self.lb,
33 self.numa_only,
34 self.enable_gso,
35 self.use_custom_mac,
36 self.mac_address,
37 self.id,
38 )
Klement Sekerab9ef2732018-06-24 22:49:33 +020039 self.set_sw_if_index(r.sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080040
41 def remove_vpp_config(self):
42 self.test.vapi.bond_delete(self.sw_if_index)
43
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020044 def add_member_vpp_bond_interface(
45 self, sw_if_index, is_passive=0, is_long_timeout=0
46 ):
47 self.test.vapi.bond_add_member(
48 sw_if_index, self.sw_if_index, is_passive, is_long_timeout
49 )
Steven9cd2d7a2017-12-20 12:43:01 -080050
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020051 def detach_vpp_bond_interface(self, sw_if_index):
Steven Luong4c4223e2020-07-15 08:44:54 -070052 self.test.vapi.bond_detach_member(sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080053
54 def is_interface_config_in_dump(self, dump):
55 for i in dump:
56 if i.sw_if_index == self.sw_if_index:
57 return True
58 else:
59 return False