removed is_net_node utility to leverage isinstance as other places are consistently
This commit is contained in:
parent
b14012e5e9
commit
bdf288ff1d
2 changed files with 3 additions and 16 deletions
|
@ -1,6 +1,5 @@
|
|||
from core.emane.nodes import EmaneNode
|
||||
from core.emulator.enumerations import LinkTypes
|
||||
from core.nodes.base import CoreNetworkBase
|
||||
from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress
|
||||
from core.nodes.physical import PhysicalNode
|
||||
|
||||
|
@ -14,17 +13,6 @@ class IdGen(object):
|
|||
return self.id
|
||||
|
||||
|
||||
def is_net_node(node):
|
||||
"""
|
||||
Convenience method for testing if a legacy core node is considered a network node.
|
||||
|
||||
:param object node: object to test against
|
||||
:return: True if object is an instance of a network node, False otherwise
|
||||
:rtype: bool
|
||||
"""
|
||||
return isinstance(node, CoreNetworkBase)
|
||||
|
||||
|
||||
def create_interface(node, network, interface_data):
|
||||
"""
|
||||
Create an interface for a node on a network using provided interface data.
|
||||
|
|
|
@ -25,7 +25,6 @@ from core.emulator.emudata import (
|
|||
LinkOptions,
|
||||
NodeOptions,
|
||||
create_interface,
|
||||
is_net_node,
|
||||
link_config,
|
||||
)
|
||||
from core.emulator.enumerations import EventTypes, ExceptionLevels, LinkTypes, NodeTypes
|
||||
|
@ -33,7 +32,7 @@ from core.emulator.sessionconfig import SessionConfig, SessionMetaData
|
|||
from core.location.corelocation import CoreLocation
|
||||
from core.location.event import EventLoop
|
||||
from core.location.mobility import MobilityManager
|
||||
from core.nodes.base import CoreNode, CoreNodeBase
|
||||
from core.nodes.base import CoreNetworkBase, CoreNode, CoreNodeBase
|
||||
from core.nodes.docker import DockerNode
|
||||
from core.nodes.ipaddress import MacAddress
|
||||
from core.nodes.lxd import LxcNode
|
||||
|
@ -217,14 +216,14 @@ class Session(object):
|
|||
else:
|
||||
node_two = None
|
||||
|
||||
if is_net_node(node_one):
|
||||
if isinstance(node_one, CoreNetworkBase):
|
||||
if not net_one:
|
||||
net_one = node_one
|
||||
else:
|
||||
net_two = node_one
|
||||
node_one = None
|
||||
|
||||
if is_net_node(node_two):
|
||||
if isinstance(node_two, CoreNetworkBase):
|
||||
if not net_one:
|
||||
net_one = node_two
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue