daemon: updates to network base to set default behavior for abstract function
This commit is contained in:
parent
e557b402b6
commit
074a2263ce
2 changed files with 12 additions and 1 deletions
|
@ -969,7 +969,15 @@ class CoreNetworkBase(NodeBase):
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def custom_iface(self, node: CoreNode, iface_data: InterfaceData) -> CoreInterface:
|
def custom_iface(self, node: CoreNode, iface_data: InterfaceData) -> CoreInterface:
|
||||||
|
"""
|
||||||
|
Defines custom logic for creating an interface, if required.
|
||||||
|
|
||||||
|
:param node: node to create interface for
|
||||||
|
:param iface_data: data for creating interface
|
||||||
|
:return: created interface
|
||||||
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_linked_iface(self, net: "CoreNetworkBase") -> Optional[CoreInterface]:
|
def get_linked_iface(self, net: "CoreNetworkBase") -> Optional[CoreInterface]:
|
||||||
|
|
|
@ -22,7 +22,7 @@ from core.emulator.enumerations import (
|
||||||
)
|
)
|
||||||
from core.errors import CoreCommandError, CoreError
|
from core.errors import CoreCommandError, CoreError
|
||||||
from core.executables import NFTABLES
|
from core.executables import NFTABLES
|
||||||
from core.nodes.base import CoreNetworkBase
|
from core.nodes.base import CoreNetworkBase, CoreNode
|
||||||
from core.nodes.interface import CoreInterface, GreTap, Veth
|
from core.nodes.interface import CoreInterface, GreTap, Veth
|
||||||
from core.nodes.netclient import get_net_client
|
from core.nodes.netclient import get_net_client
|
||||||
|
|
||||||
|
@ -436,6 +436,9 @@ class CoreNetwork(CoreNetworkBase):
|
||||||
for ip in ips:
|
for ip in ips:
|
||||||
self.net_client.create_address(self.brname, ip)
|
self.net_client.create_address(self.brname, ip)
|
||||||
|
|
||||||
|
def custom_iface(self, node: CoreNode, iface_data: InterfaceData) -> CoreInterface:
|
||||||
|
raise CoreError(f"{type(self).__name__} does not support, custom interfaces")
|
||||||
|
|
||||||
|
|
||||||
class GreTapBridge(CoreNetwork):
|
class GreTapBridge(CoreNetwork):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue