Change the nmne clear to happen at apply_timestep instead of within describe_state
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user