cloudsdk: Support 'ping' api, add to debug scripts.

Easy way to find out what cloud version we are running.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear
2021-02-10 11:33:10 -08:00
parent 3b9606d83e
commit ae80bc92a5
4 changed files with 40 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ parser = argparse.ArgumentParser(description="Query SDK Objects", add_help=False
parser.add_argument("--type", type=str, help="Type of thing to query",
choices=['profile', 'customer', 'location', 'equipment', 'portalUser',
'status', 'client-sessions', 'client-info', 'alarm', 'service-metric',
'event', 'firmware', 'all'],
'event', 'firmware', 'ping', 'all'],
default = "all")
parser.add_argument("--cmd", type=str, help="Operation to do, default is 'get'",
choices=['get', 'delete', 'child_of'],
@@ -97,6 +97,17 @@ if qtype == 'all' or qtype == 'customer':
logging.error(logging.traceback.format_exc())
print("Failed to read Customer %i"%(customer_id))
if qtype == 'all' or qtype == 'ping':
try:
rv = base.cloud.ping(base.cloudSDK_url, base.bearer)
print("Cloud Ping %s:"%(base.cloudSDK_url))
#jobj = json.load(ssids)
print(json.dumps(rv, indent=4, sort_keys=True))
except Exception as ex:
print(ex)
logging.error(logging.traceback.format_exc())
print("Failed to read Cloud Ping %i"%(base.cloudSDK_url))
if qtype == 'all' or qtype == 'firmware':
try:
rv = base.cloud.CloudSDK_images(base.command_line_args.model, base.cloudSDK_url, base.bearer)