Change the nmne clear to happen at apply_timestep instead of within describe_state

This commit is contained in:
Marek Wolan
2024-03-07 14:44:44 +00:00
parent a900d59f7b
commit 76752fd9af
2 changed files with 18 additions and 1 deletions

View File

@@ -137,7 +137,6 @@ class NetworkInterface(SimComponent, ABC):
)
if CAPTURE_NMNE:
state.update({"nmne": {k: v for k, v in self.nmne.items()}})
self.nmne.clear()
return state
@abstractmethod
@@ -254,6 +253,15 @@ class NetworkInterface(SimComponent, ABC):
"""
return f"Port {self.port_name if self.port_name else self.port_num}: {self.mac_address}"
def apply_timestep(self, timestep: int) -> None:
"""
Apply a timestep evolution to this component.
This just clears the nmne count back to 0.tests/integration_tests/network/test_capture_nmne.py
"""
super().apply_timestep(timestep=timestep)
self.nmne.clear()
class WiredNetworkInterface(NetworkInterface, ABC):
"""
@@ -884,6 +892,9 @@ class Node(SimComponent):
"""
super().apply_timestep(timestep=timestep)
for network_interface in self.network_interfaces.values():
network_interface.apply_timestep(timestep=timestep)
# count down to boot up
if self.start_up_countdown > 0:
self.start_up_countdown -= 1