added type hints for emulator and session files

This commit is contained in:
Blake Harnden 2020-01-10 22:37:19 -08:00
parent 0e74212c43
commit 5583b7edfc
4 changed files with 211 additions and 128 deletions

View file

@ -948,6 +948,29 @@ class CoreNetworkBase(NodeBase):
"""
raise NotImplementedError
def linknet(self, net):
"""
Link network to another.
:param core.nodes.base.CoreNetworkBase net: network to link with
:return: created interface
:rtype: core.nodes.interface.Veth
"""
pass
def getlinknetif(self, net):
"""
Return the interface of that links this net with another net.
:param core.nodes.base.CoreNetworkBase net: interface to get link for
:return: interface the provided network is linked to
:rtype: core.nodes.interface.CoreInterface
"""
for netif in self.netifs():
if hasattr(netif, "othernet") and netif.othernet == net:
return netif
return None
def attach(self, netif):
"""
Attach network interface.

View file

@ -525,9 +525,9 @@ class CoreNetwork(CoreNetworkBase):
Link this bridge with another by creating a veth pair and installing
each device into each bridge.
:param core.netns.vnet.LxBrNet net: network to link with
:param core.nodes.base.CoreNetworkBase net: network to link with
:return: created interface
:rtype: Veth
:rtype: core.nodes.interface.Veth
"""
sessionid = self.session.short_session_id()
try: