blob: 4bd7cb8235cb70eaeda1d8db3ff8b9ecde0cd800 [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 """
12 self._test = test
13 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)
23 self._sw_if_index = r.sw_if_index
Klement Sekerac798bc52018-05-23 20:22:20 +020024 super(VppBondInterface, self).__init__(self._test)
Steven9cd2d7a2017-12-20 12:43:01 -080025
26 def remove_vpp_config(self):
27 self.test.vapi.bond_delete(self.sw_if_index)
28
29 def enslave_vpp_bond_interface(self,
30 sw_if_index,
31 is_passive,
32 is_long_timeout):
33 self.test.vapi.bond_enslave(sw_if_index,
34 self.sw_if_index,
35 is_passive,
36 is_long_timeout)
37
38 def detach_vpp_bond_interface(self,
39 sw_if_index):
40 self.test.vapi.bond_detach_slave(sw_if_index)
41
42 def is_interface_config_in_dump(self, dump):
43 for i in dump:
44 if i.sw_if_index == self.sw_if_index:
45 return True
46 else:
47 return False