This commit is contained in:
romain
2025-07-10 13:33:56 +02:00
parent 6010d0999e
commit ddfbdffa3d
7 changed files with 1033 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
# models/hpe5130.py
from models.base_switch import Switch
from models.base_switch import Switch, normalize_port_name
from models.base_switch import Fan, PowerSupply, MACEntry, Port, VLAN
import re
@@ -78,7 +78,14 @@ class SwitchHPE5130(Switch):
mac = match.group(1).replace("-", ":").lower()
vlan = int(match.group(2))
port = match.group(3)
self.mac_table.append(MACEntry(mac, vlan, port, type_="dynamic"))
mac_entry = MACEntry(mac, vlan, port, type_="dynamic")
self.mac_table.append(mac_entry)
# 🔁 Ajout dans le bon port (nom normalisé)
normalized_port = normalize_port_name(port)
port_obj = next((p for p in self.ports if p.name.upper() == normalized_port), None)
if port_obj:
port_obj.mac_addresses.append(mac)
def _parse_display_interface(self, content: str):
pattern = re.compile(r"^(Bridge-Aggregation\d+|\S*Ethernet\d+/\d+/\d+|InLoopBack\d+|NULL\d+)$", re.MULTILINE)
@@ -220,4 +227,5 @@ class SwitchHPE5130(Switch):
block_lines.append(line)
if current_interface and block_lines:
self._apply_interface_config(current_interface, block_lines)
self._apply_interface_config(current_interface, block_lines)