added 'show router' command in CLI
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index ad709f4..a9ebf0a 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -1974,10 +1974,26 @@
print "command_display_rest: result ", result
entries = json.loads(result)
-
+ if 'router' in data and data['router'] == 'router':
+ combResult = []
+ for entry in entries:
+ attributes = entry.get('stringAttributes')
+ #raise error.ArgumentValidationError('\n\n\n %s' % (attributes))
+ combResult.append({
+ 'dpid' : entry.get('dpid'),
+ 'routerIP' : attributes['routerIp'],
+ 'name' : attributes['name'],
+ 'isEdgeRouter' : attributes['isEdgeRouter'],
+ 'routerMac' : attributes['routerMac'],
+ 'nodeSId' : attributes['nodeSid'],
+ })
+ entries = combResult
+ #raise error.ArgumentValidationError('\n\n\n %s' % (attributes))
#if 'realtimestats' in data and data['realtimestats'] == 'group':
entries2 = None
+
+
if 'realtimestats' in data and data['realtimestats'] == 'group':
url2 = "http://%s/rest/v1/" % sdnsh.controller + ("realtimestats/groupdesc/%(dpid)s/" % data)
result2 = sdnsh.store.rest_simple_request(url2)
@@ -2024,7 +2040,6 @@
'actions' : actions,
})
elif data['tabletype'] == 'mpls':
- import unicodedata
for ipTableEntry in entries:
match = ipTableEntry['match']
mplsTc = '*'
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 0973daf..3c799f7 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -2494,6 +2494,37 @@
},
}
+
+
+
+ROUTER_FORMAT = {
+ 'router' : {
+ 'field-orderings' : {
+ 'default' : ['dpid','name', 'routerIP','routerMac','isEdgeRouter','nodeSId'
+ ],
+ },
+ 'fields': {
+ 'dpid' : { 'verbose-name' : 'RouterDPID',
+ #'formatter' : fmtcnv.replace_switch_with_alias
+ },
+ 'name' : { 'verbose-name' : 'RouterName',
+ #'formatter' : fmtcnv.decode_port_counter
+ },
+ 'routerIP' : { 'verbose-name' : 'RouterIP',
+ },
+ 'routerMac' : { 'verbose-name' : 'RouterMac',
+ #'formatter' : fmtcnv.decode_port_counter
+ },
+ 'isEdgeRouter' : { 'verbose-name' : 'isEdgeRouter',
+ #'formatter' : fmtcnv.decode_port_counter
+ },
+ 'nodeSId' : { 'verbose-name' : 'nodeSId',
+ #'formatter' : fmtcnv.decode_port_counter
+ },
+ }
+ },
+}
+
"""
SWITCH_CLUSTER_FORMAT = {
'switch-cluster' : {
diff --git a/cli/sdncon/rest/views.py b/cli/sdncon/rest/views.py
index 545fe98..78f88d2 100755
--- a/cli/sdncon/rest/views.py
+++ b/cli/sdncon/rest/views.py
@@ -722,6 +722,16 @@
return get_sdnplatform_response(url)
@safe_rest_view
+def do_routers(request):
+ if onos == 0:
+ url = controller_url("core", "controller", "switches", "json")
+ else:
+ url = controller_url("onos","segmentrouting", "routers")
+ if request.META['QUERY_STRING']:
+ url += '?' + request.META['QUERY_STRING']
+ return get_sdnplatform_response(url)
+
+@safe_rest_view
def do_mastership(request):
url = controller_url("onos", "registry", "switches" ,"json")
#url = "http://127.0.0.1:8080/wm/onos/registry/switches/json"
diff --git a/cli/sdncon/urls.py b/cli/sdncon/urls.py
index 5d522de..a850a10 100755
--- a/cli/sdncon/urls.py
+++ b/cli/sdncon/urls.py
@@ -70,6 +70,7 @@
# REST API VNS/device information
(r'^rest/v1/device', 'sdncon.rest.views.do_device'),
(r'^rest/v1/switches', 'sdncon.rest.views.do_switches'),
+ (r'^rest/v1/routers', 'sdncon.rest.views.do_routers'),
(r'^rest/v1/links', 'sdncon.rest.views.do_links'),
(r'^rest/v1/mastership', 'sdncon.rest.views.do_mastership'),
(r'^rest/v1/vns/device-interface', 'sdncon.rest.views.do_vns_device_interface'),