Files
hp-iac/extractors/loop_protection_status.py

21 lines
611 B
Python

import json
import switch_client
import todo
from extractors.xe_page import fetch_tables
PATH = "/LoopProtectionStatus.html"
def get_loop_protection_status(session) -> list[dict]:
"""Returns one dict per port (Interface, Configured Action Taken,
Protection Feature Mode, Tx Mode, counters, Loop Detected)."""
tables = fetch_tables(session, PATH)
return tables["Loop Protection Status"]["rows"]
if __name__ == "__main__":
session = switch_client.get_session()
print(json.dumps(get_loop_protection_status(session), indent=2))
todo.mark_implemented(switch_client.BASE_URL + PATH)