dicitfy read_ commands
This commit is contained in:
parent
194540ccd4
commit
510d8c7321
1 changed files with 22 additions and 15 deletions
37
main.py
37
main.py
|
@ -312,28 +312,41 @@ def update_port_vlan(host: str, cookie: str, port: str):
|
|||
|
||||
|
||||
def read_ports(host: str, xssid: str) -> dict:
|
||||
return extract_data_from_table(get_cmd(host, xssid, API_CMD_IDS.READ_PORTS.value))
|
||||
return dictify(
|
||||
extract_data_from_table(get_cmd(host, xssid, API_CMD_IDS.READ_PORTS.value)),
|
||||
"Port",
|
||||
)
|
||||
|
||||
|
||||
def read_vlans(host: str, xssid: str) -> dict:
|
||||
return extract_data_from_table(get_cmd(host, xssid, API_CMD_IDS.READ_VLANS.value))
|
||||
return dictify(
|
||||
extract_data_from_table(get_cmd(host, xssid, API_CMD_IDS.READ_VLANS.value)),
|
||||
"VLAN ID",
|
||||
)
|
||||
|
||||
|
||||
def read_vlan_ports(host: str, xssid: str) -> dict:
|
||||
return extract_data_from_table(
|
||||
get_cmd(host, xssid, API_CMD_IDS.READ_VLAN_PORTS.value)
|
||||
return dictify(
|
||||
extract_data_from_table(
|
||||
get_cmd(host, xssid, API_CMD_IDS.READ_VLAN_PORTS.value)
|
||||
),
|
||||
"Port",
|
||||
)
|
||||
|
||||
|
||||
def read_stp_ports(host: str, xssid: str) -> dict:
|
||||
return extract_data_from_table(
|
||||
get_cmd(host, xssid, API_CMD_IDS.READ_STP_PORTS.value)
|
||||
return dictify(
|
||||
extract_data_from_table(get_cmd(host, xssid, API_CMD_IDS.READ_STP_PORTS.value)),
|
||||
"Port",
|
||||
)
|
||||
|
||||
|
||||
def read_vlan_port_cfg(host: str, xssid: str, vid: int) -> dict:
|
||||
return parse_vlan_ports(
|
||||
get_cmd(host, xssid, API_CMD_IDS.READ_VLAN_PORT_CFG.value, vid=vid)
|
||||
return dictify(
|
||||
parse_vlan_ports(
|
||||
get_cmd(host, xssid, API_CMD_IDS.READ_VLAN_PORT_CFG.value, vid=vid)
|
||||
),
|
||||
"VLAN",
|
||||
)
|
||||
|
||||
|
||||
|
@ -341,10 +354,4 @@ if __name__ == "__main__":
|
|||
IP = "192.168.42.100"
|
||||
cookie = get_login_cookie(IP, "admin", os.environ.get("ADMIN_PW"))
|
||||
|
||||
# print(delete_vlan(IP, cookie, 423))
|
||||
# print(delete_vlan(IP, cookie, 111))
|
||||
# print(delete_vlan(IP, cookie, 666))
|
||||
#
|
||||
# print(update_vlan_name(IP, cookie, 2009, "customer_2009"))
|
||||
|
||||
print(read_vlan_port_cfg(IP, cookie, 2))
|
||||
print(read_stp_ports(IP, cookie))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue