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:
bharnden 2019-10-24 13:05:02 -07:00
parent dc27fadb10
commit 5c12651e4e
5 changed files with 18 additions and 26 deletions

View file

@ -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}")

View file

@ -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
)

View file

@ -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"