removed node map file and utilities, added formal class methods to session objects and added checks for specific classes where needed
This commit is contained in:
parent
8c348b5ab1
commit
b14012e5e9
24 changed files with 161 additions and 264 deletions
|
@ -8,6 +8,7 @@ import socket
|
|||
from future.moves.urllib.parse import urlparse
|
||||
|
||||
from core import CoreError, constants
|
||||
from core.emane.nodes import EmaneNode
|
||||
from core.emulator.enumerations import (
|
||||
EventTypes,
|
||||
LinkTlvs,
|
||||
|
@ -17,8 +18,8 @@ from core.emulator.enumerations import (
|
|||
NodeTlvs,
|
||||
NodeTypes,
|
||||
)
|
||||
from core.nodes import nodeutils
|
||||
from core.nodes.base import CoreNetworkBase, NodeBase
|
||||
from core.nodes.network import WlanNode
|
||||
|
||||
|
||||
# TODO: A named tuple may be more appropriate, than abusing a class dict like this
|
||||
|
@ -27,14 +28,13 @@ class Bunch(object):
|
|||
Helper class for recording a collection of attributes.
|
||||
"""
|
||||
|
||||
def __init__(self, **kwds):
|
||||
def __init__(self, **kwargs):
|
||||
"""
|
||||
Create a Bunch instance.
|
||||
|
||||
:param dict kwds: keyword arguments
|
||||
:return:
|
||||
:param dict kwargs: keyword arguments
|
||||
"""
|
||||
self.__dict__.update(kwds)
|
||||
self.__dict__.update(kwargs)
|
||||
|
||||
|
||||
class Sdt(object):
|
||||
|
@ -365,9 +365,7 @@ class Sdt(object):
|
|||
for net in nets:
|
||||
all_links = net.all_link_data(flags=MessageFlags.ADD.value)
|
||||
for link_data in all_links:
|
||||
is_wireless = nodeutils.is_node(
|
||||
net, (NodeTypes.WIRELESS_LAN, NodeTypes.EMANE)
|
||||
)
|
||||
is_wireless = isinstance(net, (WlanNode, EmaneNode))
|
||||
wireless_link = link_data.message_type == LinkTypes.WIRELESS.value
|
||||
if is_wireless and link_data.node1_id == net.id:
|
||||
continue
|
||||
|
@ -401,7 +399,7 @@ class Sdt(object):
|
|||
def handlenodemsg(self, msg):
|
||||
"""
|
||||
Process a Node Message to add/delete or move a node on
|
||||
the SDT display. Node properties are found in session._objs or
|
||||
the SDT display. Node properties are found in a session or
|
||||
self.remotes for remote nodes (or those not yet instantiated).
|
||||
|
||||
:param msg: node message to handle
|
||||
|
@ -430,7 +428,8 @@ class Sdt(object):
|
|||
model = "router"
|
||||
nodetype = model
|
||||
elif nodetype is not None:
|
||||
nodetype = nodeutils.get_node_class(NodeTypes(nodetype)).type
|
||||
nodetype = NodeTypes(nodetype)
|
||||
nodetype = self.session.get_node_class(nodetype).type
|
||||
net = True
|
||||
else:
|
||||
nodetype = None
|
||||
|
@ -509,6 +508,6 @@ class Sdt(object):
|
|||
n = self.session.get_node(nodenum)
|
||||
except CoreError:
|
||||
return False
|
||||
if nodeutils.is_node(n, (NodeTypes.WIRELESS_LAN, NodeTypes.EMANE)):
|
||||
if isinstance(n, (WlanNode, EmaneNode)):
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue