#2085 - Added step metadata json file dumps to the environments. Fixed serialization issues in the Switch and ACLRule classes.

This commit is contained in:
Chris McCarthy
2023-12-01 16:37:58 +00:00
parent 32c13e06f6
commit cc04efb31d
4 changed files with 41 additions and 16 deletions

View File

@@ -66,9 +66,9 @@ class ACLRule(SimComponent):
state = super().describe_state()
state["action"] = self.action.value
state["protocol"] = self.protocol.value if self.protocol else None
state["src_ip_address"] = self.src_ip_address if self.src_ip_address else None
state["src_ip_address"] = str(self.src_ip_address) if self.src_ip_address else None
state["src_port"] = self.src_port.value if self.src_port else None
state["dst_ip_address"] = self.dst_ip_address if self.dst_ip_address else None
state["dst_ip_address"] = str(self.dst_ip_address) if self.dst_ip_address else None
state["dst_port"] = self.dst_port.value if self.dst_port else None
return state

View File

@@ -57,7 +57,7 @@ class Switch(Node):
state = super().describe_state()
state["ports"] = {port_num: port.describe_state() for port_num, port in self.switch_ports.items()}
state["num_ports"] = self.num_ports # redundant?
state["mac_address_table"] = {mac: port for mac, port in self.mac_address_table.items()}
state["mac_address_table"] = {mac: port.port_num for mac, port in self.mac_address_table.items()}
return state
def _add_mac_table_entry(self, mac_address: str, switch_port: SwitchPort):