22 lines
567 B
Python
22 lines
567 B
Python
import json
|
|
|
|
import switch_client
|
|
import todo
|
|
from extractors.xe_page import fetch_tables
|
|
|
|
PATH = "/PortSummary.html"
|
|
|
|
|
|
def get_port_summary(session) -> list[dict]:
|
|
"""Returns one dict per port (Interface, Physical Type, Port Status,
|
|
AutoNeg Status, Link Speed, MTU)."""
|
|
tables = fetch_tables(session, PATH)
|
|
return tables["Port Summary"]["rows"]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
session = switch_client.get_session()
|
|
ports = get_port_summary(session)
|
|
print(json.dumps(ports, indent=2))
|
|
todo.mark_implemented(switch_client.BASE_URL + PATH)
|