feat: add PoE config and power-cycle support for ProCurve REST API

Adds get_poe_status()/set_poe() to expose per-port PoE configuration
(enable state, priority, allocation method, allocated power) and allow
toggling it via the AOS-Switch REST API.
This commit is contained in:
Christian Manivong
2026-06-12 13:23:46 +02:00
parent 76a1939af9
commit ef544be540
2 changed files with 54 additions and 0 deletions
+13
View File
@@ -287,6 +287,19 @@ class ProcurveApiClient:
return {k: v for k, v in result.items() if v["ipv4"] or v["ipv6"]}
# ------------------------------------------------------------------
# PoE
# ------------------------------------------------------------------
def get_poe_ports(self) -> Dict[str, Dict]:
"""Return PoE configuration for all ports, keyed by port id."""
data = self.get("poe/ports")
return {p["port_id"]: p for p in data.get("port_poe", []) if p.get("port_id")}
def set_port_poe(self, port_id: str, payload: Dict[str, Any]) -> requests.Response:
"""PUT PoE configuration changes for a single port."""
return self.put(f"ports/{port_id}/poe", json=payload)
def get_arp_table(self, vrf: str = "") -> list:
"""Return NAPALM ARP table from the REST API."""
arp_data = self.get("arp")