ignoring control networks on join, fixed emane links on join being wireless, fixed setting emane model being set when configuring emane

This commit is contained in:
Blake Harnden 2019-11-25 15:40:09 -08:00
parent 6fd38c4195
commit cdc48a765a
4 changed files with 19 additions and 6 deletions

View file

@ -184,6 +184,15 @@ class CoreClient:
self.emane_config = response.config
# get emane model config
response = self.client.get_emane_model_configs(self.session_id)
for _id in response.configs:
config = response.configs[_id]
interface = None
node_id = _id
if _id >= 1000:
interface = _id % 1000
node_id = int(_id / 1000)
self.set_emane_model_config(node_id, config.model, config.config, interface)
# draw session
self.app.canvas.reset_and_redraw(session)
@ -249,7 +258,6 @@ class CoreClient:
dialog.show()
response = self.client.get_service_defaults(self.session_id)
logging.debug("get service defaults: %s", response)
self.default_services = {
x.node_type: set(x.services) for x in response.defaults
}
@ -609,6 +617,7 @@ class CoreClient:
return config
def get_emane_model_config(self, node_id, model, interface=None):
logging.info("getting emane model config: %s %s %s", node_id, model, interface)
config = self.emane_model_configs.get((node_id, model, interface))
if not config:
if interface is None:
@ -620,4 +629,6 @@ class CoreClient:
return config
def set_emane_model_config(self, node_id, model, config, interface=None):
logging.info("setting emane model config: %s %s %s", node_id, model, interface)
logging.info("model config: %s", config)
self.emane_model_configs[(node_id, model, interface)] = config

View file

@ -95,10 +95,7 @@ class EmaneConfigDialog(Dialog):
self.radiovar = tk.IntVar()
self.radiovar.set(1)
self.emane_models = [x.split("_")[1] for x in self.app.core.emane_models]
emane_model = None
if self.emane_models:
emane_model = self.emane_models[0]
self.emane_model = tk.StringVar(value=emane_model)
self.emane_model = tk.StringVar(value=self.node.emane.split("_")[1])
self.emane_model_button = None
self.draw()

View file

@ -163,7 +163,7 @@ class CanvasGraph(tk.Canvas):
# draw existing nodes
for core_node in session.nodes:
# peer to peer node is not drawn on the GUI
if core_node.type == core_pb2.NodeType.PEER_TO_PEER:
if NodeUtils.is_ignore_node(core_node.type):
continue
# draw nodes on the canvas

View file

@ -47,8 +47,13 @@ class NodeUtils:
CONTAINER_NODES = {NodeType.DEFAULT, NodeType.DOCKER, NodeType.LXC}
IMAGE_NODES = {NodeType.DOCKER, NodeType.LXC}
WIRELESS_NODES = {NodeType.WIRELESS_LAN, NodeType.EMANE}
IGNORE_NODES = {NodeType.CONTROL_NET, NodeType.PEER_TO_PEER}
NODE_MODELS = {"router", "host", "PC", "mdr", "prouter"}
@classmethod
def is_ignore_node(cls, node_type):
return node_type in cls.IGNORE_NODES
@classmethod
def is_container_node(cls, node_type):
return node_type in cls.CONTAINER_NODES