Updates for TAP device management.

master
Ken Subratie 2023-03-30 12:12:54 -04:00
parent 71695a0f10
commit dfd6732d07
2 changed files with 18 additions and 19 deletions

View File

@ -133,9 +133,9 @@ class LinkManager(ControllerModule):
return tap_name
def _get_ignored_tap_names(self, overlay_id, new_inf_name=None):
ign_tap_names = set()
ign_netinf = set()
if new_inf_name:
ign_tap_names.add(new_inf_name)
ign_netinf.add(new_inf_name)
if not self.config["Overlays"][overlay_id].get(
"AllowRecursiveTunneling", False
@ -143,12 +143,12 @@ class LinkManager(ControllerModule):
# Ignore ALL the evio tap devices (regardless of their overlay id/link id)
for tnlid in self._tunnels:
if self._tunnels[tnlid].tap_name:
ign_tap_names.add(self._tunnels[tnlid].tap_name)
for tap_name in self._ignored_net_interfaces.values():
ign_tap_names |= tap_name
else:
ign_tap_names |= self._ignored_net_interfaces[overlay_id]
return ign_tap_names
ign_netinf.add(self._tunnels[tnlid].tap_name)
# add the global ignore list
ign_netinf.update(self.config.get("IgnoredNetInterfaces", []))
# add the overlay specifc list
ign_netinf |= self._ignored_net_interfaces[overlay_id]
return ign_netinf
def is_complete_link(self, tnlid):
is_complete = (

View File

@ -32,8 +32,7 @@ from threading import Thread
import broker
from broker.controller_module import ControllerModule
from broker.version import EVIO_VER_CTL
# from pyroute2 import IPRoute
from pyroute2 import IPRoute
MAX_READ_SIZE = 65507 # Max buffer size for Tincan Messages
SOCKET_READ_WAIT_TIME = 15 # Socket read wait time for Tincan Messages
@ -214,16 +213,16 @@ class TincanTunnel(ControllerModule):
req = ctl["EVIO"]["Request"]
req["OverlayId"] = msg["OverlayId"]
req["TunnelId"] = msg["TunnelId"]
self.send_control(json.dumps(ctl))
# if "TapName" in msg and msg["TapName"]:
# with IPRoute() as ipr:
# idx = ipr.link_lookup(ifname="port_name")
# if len(idx) > 0:
# idx = idx[0]
# ipr.link("set", index=idx, state="down")
# ipr.link("set", index=idx, master=0)
# ipr.link("del", index=idx)
if "TapName" in msg and msg["TapName"]:
with IPRoute() as ipr:
idx = ipr.link_lookup(ifname="port_name")
if len(idx) > 0:
idx = idx[0]
ipr.link("set", index=idx, state="down")
ipr.link("set", index=idx, master=0)
ipr.link("del", index=idx)
# broker.runshell([self.iptool, "link", "del", "dev", msg["TapName"]])
self.send_control(json.dumps(ctl))
def req_handler_remove_link(self, cbt):
msg = cbt.request.params