#1859 - Re-ordered the node reset function
This commit is contained in:
@@ -1021,6 +1021,8 @@ class Node(SimComponent):
|
||||
def reset_component_for_episode(self, episode: int):
|
||||
"""Reset the original state of the SimComponent."""
|
||||
print(f"Resetting node state for {self.hostname}")
|
||||
super().reset_component_for_episode(episode)
|
||||
|
||||
# Reset ARP Cache
|
||||
self.arp.clear()
|
||||
|
||||
@@ -1030,17 +1032,11 @@ class Node(SimComponent):
|
||||
# Reset Session Manager
|
||||
self.session_manager.clear()
|
||||
|
||||
# Reset software
|
||||
for software in self.software_manager.software.values():
|
||||
software.reset_component_for_episode(episode)
|
||||
if isinstance(software, Service):
|
||||
software.start()
|
||||
elif isinstance(software, Application):
|
||||
software.run()
|
||||
|
||||
# Reset File System
|
||||
self.file_system.reset_component_for_episode(episode)
|
||||
|
||||
self.power_on()
|
||||
|
||||
# Reset all Nics
|
||||
for nic in self.nics.values():
|
||||
nic.reset_component_for_episode(episode)
|
||||
@@ -1049,9 +1045,14 @@ class Node(SimComponent):
|
||||
self.sys_log.current_episode = episode
|
||||
self.sys_log.setup_logger()
|
||||
|
||||
super().reset_component_for_episode(episode)
|
||||
# Reset software
|
||||
for software in self.software_manager.software.values():
|
||||
software.reset_component_for_episode(episode)
|
||||
if isinstance(software, Service):
|
||||
software.start()
|
||||
elif isinstance(software, Application):
|
||||
software.run()
|
||||
|
||||
self.power_on()
|
||||
for nic in self.nics.values():
|
||||
nic.enable()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user