blob: 60c1ac1557b7bb81777ee3388a976da0334cdfaf [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
Steven Luongea717862020-07-30 07:31:40 -07008 def __init__(self, test, mode, lb=0, numa_only=0, enable_gso=0,
9 use_custom_mac=0, mac_address='', id=0xFFFFFFFF):
Steven9cd2d7a2017-12-20 12:43:01 -080010
11 """ Create VPP Bond interface """
Klement Sekerab9ef2732018-06-24 22:49:33 +020012 super(VppBondInterface, self).__init__(test)
Steven9cd2d7a2017-12-20 12:43:01 -080013 self.mode = mode
14 self.lb = lb
Zhiyong Yang751e3f32019-06-26 05:49:14 -040015 self.numa_only = numa_only
Steven Luongea717862020-07-30 07:31:40 -070016 self.enable_gso = enable_gso
Steven9cd2d7a2017-12-20 12:43:01 -080017 self.use_custom_mac = use_custom_mac
18 self.mac_address = mac_address
Steven Luongea717862020-07-30 07:31:40 -070019 self.id = id
Steven9cd2d7a2017-12-20 12:43:01 -080020
21 def add_vpp_config(self):
Steven Luongea717862020-07-30 07:31:40 -070022 r = self.test.vapi.bond_create2(self.mode,
23 self.lb,
24 self.numa_only,
25 self.enable_gso,
26 self.use_custom_mac,
27 self.mac_address,
28 self.id)
Klement Sekerab9ef2732018-06-24 22:49:33 +020029 self.set_sw_if_index(r.sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080030
31 def remove_vpp_config(self):
32 self.test.vapi.bond_delete(self.sw_if_index)
33
Steven Luong4c4223e2020-07-15 08:44:54 -070034 def add_member_vpp_bond_interface(self,
35 sw_if_index,
36 is_passive=0,
37 is_long_timeout=0):
38 self.test.vapi.bond_add_member(sw_if_index,
39 self.sw_if_index,
40 is_passive,
41 is_long_timeout)
Steven9cd2d7a2017-12-20 12:43:01 -080042
43 def detach_vpp_bond_interface(self,
44 sw_if_index):
Steven Luong4c4223e2020-07-15 08:44:54 -070045 self.test.vapi.bond_detach_member(sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080046
47 def is_interface_config_in_dump(self, dump):
48 for i in dump:
49 if i.sw_if_index == self.sw_if_index:
50 return True
51 else:
52 return False