mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-11-01 03:07:49 +00:00
ulogin: Support show_logs
Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
@@ -56,7 +56,7 @@ assert_bad_response = True
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--ucentral_host', help="Specify ucentral host name/ip.", default="ucentral")
|
||||
parser.add_argument('--cert', help="Specify ucentral cert.", default="cert.pem")
|
||||
parser.add_argument("--action", help="Specify action: show_stats | blink | show_devices | show_capabilities | show_status | cfg | upgrade .", default="")
|
||||
parser.add_argument("--action", help="Specify action: show_stats | blink | show_devices | show_capabilities | show_status | show_logs | cfg | upgrade .", default="")
|
||||
parser.add_argument("--serno", help="Serial number of AP, used for some action.", default="")
|
||||
|
||||
parser.add_argument("--ssid24", help="Configure ssid for 2.4 Ghz.", default="ucentral-24")
|
||||
@@ -168,6 +168,18 @@ def show_status(serno):
|
||||
#pprint(cfg)
|
||||
#return cfg
|
||||
|
||||
def show_logs(serno):
|
||||
uri = build_uri("api/v1/device/" + serno + "/logs")
|
||||
resp = requests.get(uri, headers=make_headers(), verify=False)
|
||||
check_response("GET", resp, make_headers(), "", uri)
|
||||
#pprint(data)
|
||||
# Parse the config before pretty-printing to make it more legible
|
||||
data = resp.json()
|
||||
pprint(data)
|
||||
#cfg = data['configuration']
|
||||
#pprint(cfg)
|
||||
#return cfg
|
||||
|
||||
def list_devices(serno):
|
||||
if serno != "":
|
||||
uri = build_uri("api/v1/device/" + serno)
|
||||
@@ -390,6 +402,10 @@ elif args.action == "show_status":
|
||||
if args.serno == "":
|
||||
print("ERROR: show_status action needs serno set.\n")
|
||||
show_status(args.serno)
|
||||
elif args.action == "show_logs":
|
||||
if args.serno == "":
|
||||
print("ERROR: show_logs action needs serno set.\n")
|
||||
show_logs(args.serno)
|
||||
elif args.action == "upgrade":
|
||||
if args.serno == "":
|
||||
print("ERROR: upgrade action needs serno set.\n")
|
||||
|
||||
Reference in New Issue
Block a user