2017-12-20 12:43:01 -08:00
|
|
|
from vpp_object import VppObject
|
|
|
|
from vpp_interface import VppInterface
|
|
|
|
|
|
|
|
|
|
|
|
class VppBondInterface(VppInterface):
|
|
|
|
"""VPP bond interface."""
|
|
|
|
|
2019-06-26 05:49:14 -04:00
|
|
|
def __init__(self, test, mode, lb=0, numa_only=0,
|
2017-12-20 12:43:01 -08:00
|
|
|
use_custom_mac=0, mac_address=''):
|
|
|
|
|
|
|
|
""" Create VPP Bond interface """
|
2018-06-24 22:49:33 +02:00
|
|
|
super(VppBondInterface, self).__init__(test)
|
2017-12-20 12:43:01 -08:00
|
|
|
self.mode = mode
|
|
|
|
self.lb = lb
|
2019-06-26 05:49:14 -04:00
|
|
|
self.numa_only = numa_only
|
2017-12-20 12:43:01 -08:00
|
|
|
self.use_custom_mac = use_custom_mac
|
|
|
|
self.mac_address = mac_address
|
|
|
|
|
|
|
|
def add_vpp_config(self):
|
|
|
|
r = self.test.vapi.bond_create(self.mode,
|
|
|
|
self.lb,
|
2019-06-26 05:49:14 -04:00
|
|
|
self.numa_only,
|
2017-12-20 12:43:01 -08:00
|
|
|
self.use_custom_mac,
|
|
|
|
self.mac_address)
|
2018-06-24 22:49:33 +02:00
|
|
|
self.set_sw_if_index(r.sw_if_index)
|
2017-12-20 12:43:01 -08:00
|
|
|
|
|
|
|
def remove_vpp_config(self):
|
|
|
|
self.test.vapi.bond_delete(self.sw_if_index)
|
|
|
|
|
|
|
|
def enslave_vpp_bond_interface(self,
|
|
|
|
sw_if_index,
|
|
|
|
is_passive,
|
|
|
|
is_long_timeout):
|
|
|
|
self.test.vapi.bond_enslave(sw_if_index,
|
|
|
|
self.sw_if_index,
|
|
|
|
is_passive,
|
|
|
|
is_long_timeout)
|
|
|
|
|
|
|
|
def detach_vpp_bond_interface(self,
|
|
|
|
sw_if_index):
|
|
|
|
self.test.vapi.bond_detach_slave(sw_if_index)
|
|
|
|
|
|
|
|
def is_interface_config_in_dump(self, dump):
|
|
|
|
for i in dump:
|
|
|
|
if i.sw_if_index == self.sw_if_index:
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|