#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):
|
def reset_component_for_episode(self, episode: int):
|
||||||
"""Reset the original state of the SimComponent."""
|
"""Reset the original state of the SimComponent."""
|
||||||
print(f"Resetting node state for {self.hostname}")
|
print(f"Resetting node state for {self.hostname}")
|
||||||
|
super().reset_component_for_episode(episode)
|
||||||
|
|
||||||
# Reset ARP Cache
|
# Reset ARP Cache
|
||||||
self.arp.clear()
|
self.arp.clear()
|
||||||
|
|
||||||
@@ -1030,17 +1032,11 @@ class Node(SimComponent):
|
|||||||
# Reset Session Manager
|
# Reset Session Manager
|
||||||
self.session_manager.clear()
|
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
|
# Reset File System
|
||||||
self.file_system.reset_component_for_episode(episode)
|
self.file_system.reset_component_for_episode(episode)
|
||||||
|
|
||||||
|
self.power_on()
|
||||||
|
|
||||||
# Reset all Nics
|
# Reset all Nics
|
||||||
for nic in self.nics.values():
|
for nic in self.nics.values():
|
||||||
nic.reset_component_for_episode(episode)
|
nic.reset_component_for_episode(episode)
|
||||||
@@ -1049,9 +1045,14 @@ class Node(SimComponent):
|
|||||||
self.sys_log.current_episode = episode
|
self.sys_log.current_episode = episode
|
||||||
self.sys_log.setup_logger()
|
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():
|
for nic in self.nics.values():
|
||||||
nic.enable()
|
nic.enable()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user