updates to session.clear to clear out all configuration data as well, updated session.shutdown to use clear, updated tests to account for this
This commit is contained in:
parent
dc27fadb10
commit
5c12651e4e
5 changed files with 18 additions and 26 deletions
|
@ -1092,10 +1092,14 @@ class CoreHandler(socketserver.BaseRequestHandler):
|
|||
|
||||
if message_type == ConfigFlags.RESET:
|
||||
node_id = config_data.node
|
||||
self.session.location.reset()
|
||||
self.session.services.reset()
|
||||
self.session.mobility.config_reset(node_id)
|
||||
self.session.emane.config_reset(node_id)
|
||||
if node_id is not None:
|
||||
self.session.mobility.config_reset(node_id)
|
||||
self.session.emane.config_reset(node_id)
|
||||
else:
|
||||
self.session.location.reset()
|
||||
self.session.services.reset()
|
||||
self.session.mobility.config_reset()
|
||||
self.session.emane.config_reset()
|
||||
else:
|
||||
raise Exception(f"cant handle config all: {message_type}")
|
||||
|
||||
|
|
|
@ -376,7 +376,6 @@ class EmaneManager(ModelManager):
|
|||
with self._emane_node_lock:
|
||||
self._emane_nets.clear()
|
||||
|
||||
# don't clear self._ifccounts here; NEM counts are needed for buildxml
|
||||
self.platformport = self.session.options.get_config_int(
|
||||
"emane_platform_port", 8100
|
||||
)
|
||||
|
|
|
@ -876,10 +876,15 @@ class Session:
|
|||
|
||||
:return: nothing
|
||||
"""
|
||||
self.emane.shutdown()
|
||||
self.delete_nodes()
|
||||
self.distributed.shutdown()
|
||||
self.del_hooks()
|
||||
self.emane.reset()
|
||||
self.emane.config_reset()
|
||||
self.location.reset()
|
||||
self.services.reset()
|
||||
self.mobility.config_reset()
|
||||
|
||||
def start_events(self):
|
||||
"""
|
||||
|
@ -919,13 +924,11 @@ class Session:
|
|||
self.set_state(EventTypes.DATACOLLECT_STATE, send_event=True)
|
||||
self.set_state(EventTypes.SHUTDOWN_STATE, send_event=True)
|
||||
|
||||
# shutdown/cleanup feature helpers
|
||||
self.emane.shutdown()
|
||||
self.sdt.shutdown()
|
||||
# clear out current core session
|
||||
self.clear()
|
||||
|
||||
# remove and shutdown all nodes and tunnels
|
||||
self.delete_nodes()
|
||||
self.distributed.shutdown()
|
||||
# shutdown sdt
|
||||
self.sdt.shutdown()
|
||||
|
||||
# remove this sessions working directory
|
||||
preserve = self.options.get_config("preservedir") == "1"
|
||||
|
|
|
@ -120,10 +120,6 @@ def session(global_session):
|
|||
global_session.set_state(EventTypes.CONFIGURATION_STATE)
|
||||
yield global_session
|
||||
global_session.clear()
|
||||
global_session.location.reset()
|
||||
global_session.services.reset()
|
||||
global_session.mobility.config_reset()
|
||||
global_session.emane.config_reset()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -133,11 +129,6 @@ def coretlv(module_coretlv):
|
|||
coreemu.sessions[session.id] = session
|
||||
yield module_coretlv
|
||||
coreemu.shutdown()
|
||||
session.clear()
|
||||
session.location.reset()
|
||||
session.services.reset()
|
||||
session.mobility.config_reset()
|
||||
session.emane.config_reset()
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
|
|
|
@ -645,14 +645,9 @@ class TestGui:
|
|||
assert len(coretlv.session.nodes) == 1
|
||||
|
||||
def test_config_all(self, coretlv):
|
||||
node = coretlv.session.add_node()
|
||||
message = coreapi.CoreConfMessage.create(
|
||||
MessageFlags.ADD.value,
|
||||
[
|
||||
(ConfigTlvs.OBJECT, "all"),
|
||||
(ConfigTlvs.NODE, node.id),
|
||||
(ConfigTlvs.TYPE, ConfigFlags.RESET.value),
|
||||
],
|
||||
[(ConfigTlvs.OBJECT, "all"), (ConfigTlvs.TYPE, ConfigFlags.RESET.value)],
|
||||
)
|
||||
coretlv.session.location.refxyz = (10, 10, 10)
|
||||
|
||||
|
|
Loading…
Reference in a new issue