blob: 153f1142c5c6a10b05a19d9a12e0cc49bbeff20b [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
8 def __init__(self, test, mode, lb=0,
9 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
15 self.use_custom_mac = use_custom_mac
16 self.mac_address = mac_address
Steven9cd2d7a2017-12-20 12:43:01 -080017
18 def add_vpp_config(self):
19 r = self.test.vapi.bond_create(self.mode,
20 self.lb,
21 self.use_custom_mac,
22 self.mac_address)
Klement Sekerab9ef2732018-06-24 22:49:33 +020023 self.set_sw_if_index(r.sw_if_index)
Steven9cd2d7a2017-12-20 12:43:01 -080024
25 def remove_vpp_config(self):
26 self.test.vapi.bond_delete(self.sw_if_index)
27
28 def enslave_vpp_bond_interface(self,
29 sw_if_index,
30 is_passive,
31 is_long_timeout):
32 self.test.vapi.bond_enslave(sw_if_index,
33 self.sw_if_index,
34 is_passive,
35 is_long_timeout)
36
37 def detach_vpp_bond_interface(self,
38 sw_if_index):
39 self.test.vapi.bond_detach_slave(sw_if_index)
40
41 def is_interface_config_in_dump(self, dump):
42 for i in dump:
43 if i.sw_if_index == self.sw_if_index:
44 return True
45 else:
46 return False