From cb712cdd046bb3a516ab617c651bc20970eedf72 Mon Sep 17 00:00:00 2001 From: Gregor Michels Date: Thu, 26 Jun 2025 21:59:10 +0200 Subject: [PATCH] introduce API_CMD_IDS --- main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 7369aab..b2d537f 100755 --- a/main.py +++ b/main.py @@ -11,6 +11,13 @@ from enum import Enum IP = "192.168.42.100" +class API_CMD_IDS(Enum): + READ_PORTS = 768 + READ_VLANS = 1283 + READ_VLAN_PORTS = 1290 + READ_VLAN_PORT_CFG = 1293 # this needs vid as a parameter and is parsed by parse_vlan_ports + READ_STP_PORTS = 4098 + class VLAN_PORT_MODE(Enum): GENERAL = 0 @@ -140,6 +147,8 @@ if __name__ == "__main__": cookie = get_login_cookie(IP, "admin", os.environ.get("ADMIN_PW")) - print(dictify(extract_data_from_table(get_cmd(IP, cookie, 1283)), "VLAN ID")) - print(dictify(extract_data_from_table(get_cmd(IP, cookie, 1290)), "Port")) - print(parse_vlan_ports(get_cmd(IP, cookie, 1293, vid=2))) + print(dictify(extract_data_from_table(get_cmd(IP, cookie, API_CMD_IDS.READ_PORTS.value)), "Port")) + print(dictify(extract_data_from_table(get_cmd(IP, cookie, API_CMD_IDS.READ_VLANS.value)), "VLAN ID")) + print(dictify(extract_data_from_table(get_cmd(IP, cookie, API_CMD_IDS.READ_VLAN_PORTS.value)), "Port")) + print(dictify(extract_data_from_table(get_cmd(IP, cookie, API_CMD_IDS.READ_STP_PORTS.value)), "Port")) + print(parse_vlan_ports(get_cmd(IP, cookie, API_CMD_IDS.READ_VLAN_PORT_CFG.value, vid=2)))