Sync Phase: Implement bondethernets

Include special caveat on LCP MAC changes, for which I'll put in a
TODO for now with a VPP comment {} with the to be run command.

Also make the user aware of a quick in BondEthernets not being able
to have link_mtu != 9000 so if a packet MTU > 9000 is set, this will
work but is an undesirable configuration. Issue a warning in this
case.
This commit is contained in:
Pim van Pelt
2022-03-26 15:14:49 +00:00
parent f2784ce5d0
commit e9bbd47407
3 changed files with 110 additions and 17 deletions

View File

@ -19,7 +19,7 @@ class VPPApi():
self.clientname = clientname
self.vpp = None
self.config = self.clearconfig()
self.config_read = False
def connect(self):
if self.connected:
@ -60,6 +60,7 @@ class VPPApi():
return True
def clearconfig(self):
self.config_read = False
return {"lcps": {}, "interface_names": {}, "interfaces": {}, "interface_addresses": {},
"bondethernets": {}, "bondethernet_members": {},
"bridgedomains": {}, "vxlan_tunnels": {}, "l2xcs": {}}
@ -133,12 +134,12 @@ class VPPApi():
self.config['bondethernets'].pop(iface.sw_if_index, None)
return True
def readconfig(self):
if not self.connected and not self.connect():
self.logger.error("Could not connect to VPP")
return False
self.config_read = False
self.logger.debug("Retrieving LCPs")
r = self.vpp.api.lcp_itf_pair_get()
if isinstance(r, tuple) and r[0].retval == 0:
@ -183,7 +184,8 @@ class VPPApi():
for l2xc in r:
self.config['l2xcs'][l2xc.rx_sw_if_index] = l2xc
return True
self.config_read = True
return self.config_read
def get_encapsulation(self, iface):
""" Return a string with the encapsulation of a subint """