Skip to content
Snippets Groups Projects
Commit eb3d09f6 authored by Colin Dixon's avatar Colin Dixon
Browse files

updated CLI

parent 10b5c915
No related branches found
No related tags found
No related merge requests found
...@@ -46,45 +46,51 @@ class RestApi(object): ...@@ -46,45 +46,51 @@ class RestApi(object):
usage_desc = """ usage_desc = """
Command descriptions: Command descriptions:
host <MAC> host [debug]
link [tunnellinks]
link port <blocked | broadcast>
memory memory
switch switch
switchclusters
switch_stats [port, queue, flow, aggregate, desc, table, features, host] counter [DPID] <name>
switch_stats [DPID] <port | queue | flow | aggregate | desc | table | features | host>
per_switch_stats [DPID] [port, queue, flow, aggregate, desc, table, features, host] """
"""
def lookupPath(cmd): def lookupPath(cmd):
path = '' path = ''
numargs = len(args.otherargs) numargs = len(args.otherargs)
if args.cmd == 'switch_stats' and numargs == 1: if args.cmd == 'switch_stats':
path = '/wm/core/switch/all/'+args.otherargs[0]+'/json' if numargs == 1:
elif args.cmd == 'per_switch_stats' and numargs == 2: path = '/wm/core/switch/all/'+args.otherargs[0]+'/json'
path = '/wm/core/switch/'+args.ortherargs[0]+'/'+args.otherargs[1]+'/json' elif numargs == 2:
path = '/wm/core/switch/'+args.otherargs[0]+'/'+args.otherargs[1]+'/json'
elif args.cmd == 'switch': elif args.cmd == 'switch':
path = '/wm/core/controller/switches/json' path = '/wm/core/controller/switches/json'
elif args.cmd == 'counter' and numargs == 1: elif args.cmd == 'counter':
path = '/wm/core/counter/'+args.otherargs[0]+'/json' if numargs == 1:
elif args.cmd == 'switch_counter' and numargs == 2: path = '/wm/core/counter/'+args.otherargs[0]+'/json'
path = '/wm/core/counter/'+args.otherargs[0]+'/'+otherargs[1]+'/json' elif numargs == 2:
path = '/wm/core/counter/'+args.otherargs[0]+'/'+args.otherargs[1]+'/json'
elif args.cmd == 'memory': elif args.cmd == 'memory':
path = '/wm/core/memory/json' path = '/wm/core/memory/json'
elif args.cmd == 'link': elif args.cmd == 'link':
path = '/wm/topology/links/json' if numargs == 0:
path = '/wm/topology/links/json'
elif numargs == 1:
path = '/wm/topology/'+args.otherargs[0]+'/json'
elif args.cmd == 'port' and numargs == 1:
if args.otherargs[0] == "blocked":
path = '/wm/topology/blockedports/json'
elif args.otherargs[0] == "broadcast":
path = '/wm/topology/broadcastdomainports/json'
elif args.cmd == 'switchclusters': elif args.cmd == 'switchclusters':
path = '/wm/topology/switchclusters/json' path = '/wm/topology/switchclusters/json'
elif args.cmd == 'host': elif args.cmd == 'host':
if len(args.otherargs) == 0: path = '/wm/device/'
args.otherargs.append("all") if len(args.otherargs) == 1 and args.otherargs[0] == 'debug':
path = '/wm/devicemanager/device/'+args.otherargs[0]+'/json' path = '/wm/device/debug'
else: else:
print usage_desc print usage_desc
path = '' path = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment