From 059b0cc316b0d1b6a7f63d11814632c1fd82f759 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Thu, 21 Nov 2019 12:44:50 -0800 Subject: [PATCH] changes to fix session adding default emane configuration --- daemon/core/emulator/session.py | 6 +++--- daemon/tests/test_grpc.py | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/daemon/core/emulator/session.py b/daemon/core/emulator/session.py index 4852d026..d2d841e4 100644 --- a/daemon/core/emulator/session.py +++ b/daemon/core/emulator/session.py @@ -704,10 +704,10 @@ class Session: self.services.add_services(node, node.type, options.services) # ensure default emane configuration - if _type == NodeTypes.EMANE: - self.emane.set_model_config(_id, node.emane) + if isinstance(node, EmaneNet): + self.emane.set_model_config(_id, options.emane) # set default wlan config if needed - if _type == NodeTypes.WIRELESS_LAN: + if isinstance(node, WlanNode): self.mobility.set_model_config(_id, BasicRangeModel.name) # boot nodes after runtime, CoreNodes, Physical, and RJ45 are all nodes diff --git a/daemon/tests/test_grpc.py b/daemon/tests/test_grpc.py index 5f934b64..28005dbb 100644 --- a/daemon/tests/test_grpc.py +++ b/daemon/tests/test_grpc.py @@ -692,7 +692,9 @@ class TestGrpc: client = CoreGrpcClient() session = grpc_server.coreemu.create_session() session.set_location(47.57917, -122.13232, 2.00000, 1.0) - emane_network = session.add_node(_type=NodeTypes.EMANE) + options = NodeOptions() + options.emane = EmaneIeee80211abgModel.name + emane_network = session.add_node(_type=NodeTypes.EMANE, options=options) session.emane.set_model(emane_network, EmaneIeee80211abgModel) config_key = "platform_id_start" config_value = "2" @@ -716,7 +718,9 @@ class TestGrpc: client = CoreGrpcClient() session = grpc_server.coreemu.create_session() session.set_location(47.57917, -122.13232, 2.00000, 1.0) - emane_network = session.add_node(_type=NodeTypes.EMANE) + options = NodeOptions() + options.emane = EmaneIeee80211abgModel.name + emane_network = session.add_node(_type=NodeTypes.EMANE, options=options) session.emane.set_model(emane_network, EmaneIeee80211abgModel) config_key = "bandwidth" config_value = "900000" @@ -742,7 +746,9 @@ class TestGrpc: client = CoreGrpcClient() session = grpc_server.coreemu.create_session() session.set_location(47.57917, -122.13232, 2.00000, 1.0) - emane_network = session.add_node(_type=NodeTypes.EMANE) + options = NodeOptions() + options.emane = EmaneIeee80211abgModel.name + emane_network = session.add_node(_type=NodeTypes.EMANE, options=options) session.emane.set_model(emane_network, EmaneIeee80211abgModel) # then