daemon: fixed mobility checks to allow both wlan/emane, pygui: enabled emane nodes to configure mobility

This commit is contained in:
Blake Harnden 2020-07-29 16:55:42 -07:00
parent 787f02f024
commit d30778b238
6 changed files with 65 additions and 42 deletions

View file

@ -538,7 +538,7 @@ class CoreClient:
def show_mobility_players(self) -> None:
for node in self.session.nodes.values():
if node.type != NodeType.WIRELESS_LAN:
if not NodeUtils.is_mobility(node):
continue
if node.mobility_config:
mobility_player = MobilityPlayer(self.app, node)
@ -927,7 +927,7 @@ class CoreClient:
def get_mobility_configs_proto(self) -> List[mobility_pb2.MobilityConfig]:
configs = []
for node in self.session.nodes.values():
if node.type != NodeType.WIRELESS_LAN:
if not NodeUtils.is_mobility(node):
continue
if not node.mobility_config:
continue

View file

@ -206,6 +206,7 @@ class CanvasNode:
self.context.delete(0, tk.END)
is_wlan = self.core_node.type == NodeType.WIRELESS_LAN
is_emane = self.core_node.type == NodeType.EMANE
is_mobility = is_wlan or is_emane
if self.app.core.is_runtime():
self.context.add_command(label="Configure", command=self.show_config)
if is_emane:
@ -216,7 +217,7 @@ class CanvasNode:
self.context.add_command(
label="WLAN Config", command=self.show_wlan_config
)
if is_wlan and self.core_node.id in self.app.core.mobility_players:
if is_mobility and self.core_node.id in self.app.core.mobility_players:
self.context.add_command(
label="Mobility Player", command=self.show_mobility_player
)
@ -235,6 +236,7 @@ class CanvasNode:
self.context.add_command(
label="WLAN Config", command=self.show_wlan_config
)
if is_mobility:
self.context.add_command(
label="Mobility Config", command=self.show_mobility_config
)

View file

@ -63,10 +63,15 @@ class NodeUtils:
WIRELESS_NODES: Set[NodeType] = {NodeType.WIRELESS_LAN, NodeType.EMANE}
RJ45_NODES: Set[NodeType] = {NodeType.RJ45}
IGNORE_NODES: Set[NodeType] = {NodeType.CONTROL_NET}
MOBILITY_NODES: Set[NodeType] = {NodeType.WIRELESS_LAN, NodeType.EMANE}
NODE_MODELS: Set[str] = {"router", "host", "PC", "mdr", "prouter"}
ROUTER_NODES: Set[str] = {"router", "mdr"}
ANTENNA_ICON: PhotoImage = None
@classmethod
def is_mobility(cls, node: Node) -> bool:
return node.type in cls.MOBILITY_NODES
@classmethod
def is_router_node(cls, node: Node) -> bool:
return cls.is_model_node(node.type) and node.model in cls.ROUTER_NODES