Fix software reset issues
This commit is contained in:
@@ -58,21 +58,19 @@ class Network(SimComponent):
|
||||
node.reset_component_for_episode(episode)
|
||||
for link in self.links.values():
|
||||
link.reset_component_for_episode(episode)
|
||||
|
||||
|
||||
for node in self.nodes.values():
|
||||
node.power_on()
|
||||
|
||||
for nic in node.nics.values():
|
||||
nic.enable()
|
||||
# Reset software
|
||||
for software in node.software_manager.software.values():
|
||||
software.reset_component_for_episode(episode)
|
||||
if isinstance(software, Service):
|
||||
software.start()
|
||||
elif isinstance(software, Application):
|
||||
software.run()
|
||||
|
||||
for nic in node.nics.values():
|
||||
nic.enable()
|
||||
|
||||
def _init_request_manager(self) -> RequestManager:
|
||||
rm = super()._init_request_manager()
|
||||
self._node_request_manager = RequestManager()
|
||||
|
||||
@@ -993,7 +993,6 @@ class Node(SimComponent):
|
||||
|
||||
def set_original_state(self):
|
||||
"""Sets the original state."""
|
||||
print(f"Setting node original state for {self.hostname}")
|
||||
for software in self.software_manager.software.values():
|
||||
software.set_original_state()
|
||||
|
||||
@@ -1020,7 +1019,6 @@ 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
|
||||
@@ -1039,11 +1037,13 @@ class Node(SimComponent):
|
||||
for nic in self.nics.values():
|
||||
nic.reset_component_for_episode(episode)
|
||||
|
||||
for software in self.software_manager.software.values():
|
||||
software.reset_component_for_episode(episode)
|
||||
|
||||
if episode and self.sys_log:
|
||||
self.sys_log.current_episode = episode
|
||||
self.sys_log.setup_logger()
|
||||
|
||||
|
||||
def _init_request_manager(self) -> RequestManager:
|
||||
# TODO: I see that this code is really confusing and hard to read right now... I think some of these things will
|
||||
# need a better name and better documentation.
|
||||
|
||||
Reference in New Issue
Block a user