#1859 - Made some fixes to resets. Still an issue with the Router reset.

This commit is contained in:
Chris McCarthy
2023-11-28 00:21:41 +00:00
parent 58e9033a4c
commit 39dfbb741f
4 changed files with 17 additions and 2 deletions

View File

@@ -28,10 +28,21 @@ class DNSServer(Service):
super().__init__(**kwargs)
self.start()
def set_original_state(self):
"""Sets the original state."""
super().set_original_state()
vals_to_include = {"dns_table"}
self._original_state["dns_table_orig"] = self.model_dump(include=vals_to_include)["dns_table"]
def reset_component_for_episode(self, episode: int):
"""Reset the original state of the SimComponent."""
print("dns reset")
print("DNSServer original state", self._original_state)
self.dns_table.clear()
for key, value in self._original_state["dns_table_orig"].items():
self.dns_table[key] = value
super().reset_component_for_episode(episode)
self.show()
def describe_state(self) -> Dict:
"""