mirror of
				https://github.com/Telecominfraproject/wlan-testing.git
				synced 2025-11-03 20:38:05 +00:00 
			
		
		
		
	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:
		@@ -436,6 +436,10 @@ class CloudSDK:
 | 
			
		||||
            url_base = cloudSDK_url + "/portal/profile/forCustomer" + "?customerId=" + customer_id
 | 
			
		||||
            return self.get_paged_url(bearer, url_base)
 | 
			
		||||
 | 
			
		||||
    def ping(self, cloudSDK_url, bearer):
 | 
			
		||||
        url_base = cloudSDK_url + "/ping"
 | 
			
		||||
        return [self.get_url(bearer, url_base)]
 | 
			
		||||
 | 
			
		||||
    # This is querys all and filters locally. Maybe there is better way to get cloud to
 | 
			
		||||
    # do the filtering?
 | 
			
		||||
    def get_customer_profile_by_name(self, cloudSDK_url, bearer, customer_id, name):
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,12 @@ APTTY=/dev/ttyAP1
 | 
			
		||||
MODEL=ecw5410
 | 
			
		||||
 | 
			
		||||
# cloud sdk profile dump
 | 
			
		||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com --sdk-user-password support --type profile --cmd get > /tmp/nola-$NOLANUM-profiles.txt
 | 
			
		||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
 | 
			
		||||
   --sdk-user-password support --type profile --cmd get > /tmp/nola-$NOLANUM-profiles.txt
 | 
			
		||||
 | 
			
		||||
# cloud version info
 | 
			
		||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
 | 
			
		||||
   --sdk-user-password support --type ping > /tmp/nola-$NOLANUM-sdk-ping.txt
 | 
			
		||||
 | 
			
		||||
# ovsdb-client dump
 | 
			
		||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "ovsdb-client dump" > /tmp/nola-$NOLANUM-ap.txt
 | 
			
		||||
@@ -20,6 +25,7 @@ MODEL=ecw5410
 | 
			
		||||
# interface info
 | 
			
		||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "iwinfo && brctl show" > /tmp/nola-$NOLANUM-ap-if.txt
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# TODO:  Add more things here as we learn what better provides debug info to cloud.
 | 
			
		||||
 | 
			
		||||
echo "Grab:  /tmp/nola-$NOLANUM-profiles.txt /tmp/nola-$NOLANUM-ap.txt /tmp/nola-$NOLANUM-ap-if.txt"
 | 
			
		||||
echo "Grab:  /tmp/nola-$NOLANUM-profiles.txt /tmp/nola-$NOLANUM-ap.txt /tmp/nola-$NOLANUM-ap-if.txt /tmp/nola-$NOLANUM-sdk-ping.txt"
 | 
			
		||||
 
 | 
			
		||||
@@ -5,15 +5,27 @@
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
NOLANUM=12
 | 
			
		||||
PORTAL=wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build
 | 
			
		||||
APPORT=8823
 | 
			
		||||
APTTY=/dev/ttyAP1
 | 
			
		||||
MODEL=wf188n
 | 
			
		||||
 | 
			
		||||
# cloud sdk profile dump
 | 
			
		||||
./query_sdk.py --testrail-user-id NONE --model ecw5410 --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build --sdk-user-id support@example.com --sdk-user-password support --type profile --cmd get > /tmp/nola-12-profiles.txt
 | 
			
		||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
 | 
			
		||||
   --sdk-user-password support --type profile --cmd get > /tmp/nola-$NOLANUM-profiles.txt
 | 
			
		||||
 | 
			
		||||
# cloud version info
 | 
			
		||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
 | 
			
		||||
   --sdk-user-password support --type ping > /tmp/nola-$NOLANUM-sdk-ping.txt
 | 
			
		||||
 | 
			
		||||
# ovsdb-client dump
 | 
			
		||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port 8823 --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 -m ecw5410 --cmd "ovsdb-client dump" > /tmp/nola-12-ap.txt
 | 
			
		||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "ovsdb-client dump" > /tmp/nola-$NOLANUM-ap.txt
 | 
			
		||||
 | 
			
		||||
# interface info
 | 
			
		||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port 8823 --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 -m ecw5410 --cmd "iwinfo && brctl show" > /tmp/nola-12-ap-if.txt
 | 
			
		||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "iwinfo && brctl show" > /tmp/nola-$NOLANUM-ap-if.txt
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# TODO:  Add more things here as we learn what better provides debug info to cloud.
 | 
			
		||||
 | 
			
		||||
echo "Grab:  /tmp/nola-12-profiles.txt /tmp/nola-12-ap.txt /tmp/nola-12-ap-if.txt"
 | 
			
		||||
echo "Grab:  /tmp/nola-$NOLANUM-profiles.txt /tmp/nola-$NOLANUM-ap.txt /tmp/nola-$NOLANUM-ap-if.txt /tmp/nola-$NOLANUM-sdk-ping.txt"
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user