blob: f05a07b0ce2f5014d8ab5b7f870c66167819f1e9 [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
Zhiyong Yang751e3f32019-06-26 05:49:14 -04008 def __init__(self, test, mode, lb=0, numa_only=0,
Steven9cd2d7a2017-12-20 12:43:01 -08009 use_custom_mac=0, mac_address=''):
10
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
Steven9cd2d7a2017-12-20 12:43:01 -080016 self.use_custom_mac = use_custom_mac
17 self.mac_address = mac_address
Steven9cd2d7a2017-12-20 12:43:01 -080018
19 def add_vpp_config(self):
20 r = self.test.vapi.bond_create(self.mode,
21 self.lb,
Zhiyong Yang751e3f32019-06-26 05:49:14 -040022 self.numa_only,
Steven9cd2d7a2017-12-20 12:43:01 -080023 self.use_custom_mac,
24 self.mac_address)
Klement Sekerab9ef2732018-06-24 22:49:33 +020025 self.set_sw_if_index(r.sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080026
27 def remove_vpp_config(self):
28 self.test.vapi.bond_delete(self.sw_if_index)
29
30 def enslave_vpp_bond_interface(self,
31 sw_if_index,
32 is_passive,
33 is_long_timeout):
34 self.test.vapi.bond_enslave(sw_if_index,
35 self.sw_if_index,
36 is_passive,
37 is_long_timeout)
38
39 def detach_vpp_bond_interface(self,
40 sw_if_index):
41 self.test.vapi.bond_detach_slave(sw_if_index)
42
43 def is_interface_config_in_dump(self, dump):
44 for i in dump:
45 if i.sw_if_index == self.sw_if_index:
46 return True
47 else:
48 return False