Added frontend for 'show policy' & 'show tunnel'
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index 9f99f3d..26499aa 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -2070,7 +2070,6 @@
     check_rest_result(result)
     if sdnsh.description:   # description debugging
         print "command_display_rest: result ", result
-
     entries = json.loads(result)
         #rest_type = None
         #raise error.ArgumentValidationError('\n\n\n %s' % (attributes))
@@ -2134,6 +2133,38 @@
         entries = combResult
 
 
+    if 'showtunnel' in data  and data['showtunnel'] == 'tunnel':
+        #raise error.ArgumentValidationError('\n\n\n %s' % (data))
+        combResult = []
+        '''portList = entries
+        for port in portList:
+            portData = port.get("port")
+            name = portData.get("stringAttributes").get('name')
+            portNo = portData.get("portNumber")
+            subnetIp = port.get("subnetIp")
+            combResult.append({
+                               'name'            :name,
+                               'portNo'           : portNo,
+                               'subnetIp'         : subnetIp,
+                               })
+        entries = combResult'''
+
+    if 'showpolicy' in data  and data['showpolicy'] == 'policy':
+        #raise error.ArgumentValidationError('\n\n\n %s' % (data))
+        combResult = []
+        '''portList = entries
+        for port in portList:
+            portData = port.get("port")
+            name = portData.get("stringAttributes").get('name')
+            portNo = portData.get("portNumber")
+            subnetIp = port.get("subnetIp")
+            combResult.append({
+                               'name'            :name,
+                               'portNo'           : portNo,
+                               'subnetIp'         : subnetIp,
+                               })
+        entries = combResult'''
+
     if 'realtimestats' in data and 'tabletype' in data and data['realtimestats'] == 'table':
         combResult = []
         if data['tabletype'] == 'ip':
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 84a0e3f..385476d 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -2411,6 +2411,23 @@
         },
 }
 
+SHOW_TUNNEL_FORMAT = {
+    'show_tunnel' : {
+        'field-orderings' : {
+            'default' : [ 'Idx', 'tunnelId', 'nodes', 'LabelStack', 'Group//DIPD',]
+            },
+        },
+}
+
+SHOW_TUNNEL_FORMAT = {
+    'show_policy' : {
+        'field-orderings' : {
+            'default' : [ 'Idx', 'policyId', 'tunnelId', 'flowEntries']
+            },
+        },
+}
+
+
 
 REALTIME_FEATURES_FORMAT = {
     'realtime_features' : {
diff --git a/cli/cli/desc/version200/policy.py b/cli/cli/desc/version200/policy.py
new file mode 100644
index 0000000..c5174d4
--- /dev/null
+++ b/cli/cli/desc/version200/policy.py
@@ -0,0 +1,23 @@
+#import fmtcnv
+SWITCH_TUNNEL_COMMAND_DESCRIPTION = {
+    'name'                : 'show',
+    'mode'                : 'login',
+    'command-type'        : 'display-table',
+    'all-help'            : 'Show switch information',
+    'short-help'          : 'Show switch summary',
+    #'obj-type'            : 'switches',
+    'doc'                 : 'switch|show',
+    'doc-example'         : 'switch|show-example',
+    'args' : (
+        {
+            'token'  : 'policy',
+            'field'  : 'showpolicy',
+            'action' : 'display-rest',
+            'doc'    : 'switch|show',
+            'url'    : [
+                        'showpolicy',
+                       ],
+            'format' : 'show_policy',
+        },
+    )
+}
\ No newline at end of file
diff --git a/cli/cli/desc/version200/router.py b/cli/cli/desc/version200/router.py
index c68f3cc..f8e14bb 100644
--- a/cli/cli/desc/version200/router.py
+++ b/cli/cli/desc/version200/router.py
@@ -20,7 +20,7 @@
     'command-type'        : 'display-table',
     'all-help'            : 'Show switch information',
     'short-help'          : 'Show switch summary',
-    'obj-type'            : 'switches',
+    #'obj-type'            : 'switches',
     'doc'                 : 'switch|show',
     'doc-example'         : 'switch|show-example',
     'args' : (
diff --git a/cli/cli/desc/version200/tunnel.py b/cli/cli/desc/version200/tunnel.py
old mode 100755
new mode 100644
index 0a3f5ba..7928ba8
--- a/cli/cli/desc/version200/tunnel.py
+++ b/cli/cli/desc/version200/tunnel.py
@@ -1,108 +1,23 @@
-#
-# Copyright (c) 2013 Big Switch Networks, Inc.
-#
-# Licensed under the Eclipse Public License, Version 1.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-#      http://www.eclipse.org/legal/epl-v10.html
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-#
-
 import fmtcnv
-"""
-TUNNEL_COMMAND_DESCRIPTION = {
-    'name'          : 'tunnel-link',
-    'feature'      : 'vns',
-    'mode'          : 'login',
-    'command-type'  : 'display-table',
-    'doc'           : 'tunnel-link|verify-example',
-    'obj-type'      : None,
-    'args'  : {
-        'choices': (
-            (
-                 {
-                     'token'         : 'verify',
-                     'short-help'    : 'Verify status of tunnel between two switches',
-                     'action'        : 'display-rest',
-                     'format'        : 'tunnel-event',
-                     'url'           : [
-                                        'realtimestatus/network/tunnelverify/%(src-dpid)s/%(dst-dpid)s/',
-                                        ],
-                 },
-                 {
-                     'field'         : 'src-dpid',
-                     'type'          : 'dpid',
-                     'completion'    : 'complete-from-another',
-                     'other'         : 'switches|dpid',
-                     'data-handler'  : 'alias-to-value',
-                     'help-name'     : 'switch dpid or alias',
-                 },
-                 {
-                     'field'         : 'dst-dpid',
-                     'type'          : 'dpid',
-                     'completion'    : 'complete-from-another',
-                     'other'         : 'switches|dpid',
-                     'data-handler'  : 'alias-to-value',
-                     'help-name'     : 'switch dpid or alias',
-                 }
-            ),
-        )
-    }
-}
-
-TUNNEL_LINK_FAILURES_SHOW_COMMAND_DESCRIPTION = {
-    'name'         : 'show',
-    'mode'         : 'login',
-    'feature'      : 'vns',
-    'short-help'   : 'Show tunnel link failures',
-    'command-type' : 'display-table',
-    'url'          : 'realtimestatus/network/tunnelstatus/all/all',
-    'obj-type'     : None,
-    'format'       : 'tunnel-event',
-    'action'       : 'display-rest',
-    'args'  : (
-        'tunnel-link-failures',
-    ),
-}
-
-TUNNEL_EVENT_FORMAT = {
-    'tunnel-event' : {
-        'source'        : 'controller',
-        'url'           : 'tunnel-event',
-        'field-orderings': {
-                 'default' : [ 'Idx', 'src-dpid', 'dst-dpid', 'status', 'last-verified' ],
+SWITCH_TUNNEL_COMMAND_DESCRIPTION = {
+    'name'                : 'show',
+    'mode'                : 'login',
+    'command-type'        : 'display-table',
+    'all-help'            : 'Show switch information',
+    'short-help'          : 'Show switch summary',
+    #'obj-type'            : 'switches',
+    'doc'                 : 'switch|show',
+    'doc-example'         : 'switch|show-example',
+    'args' : (
+        {
+            'token'  : 'tunnel',
+            'field'  : 'showtunnel',
+            'action' : 'display-rest',
+            'doc'    : 'switch|show',
+            'url'    : [
+                        'showtunnel',
+                       ],
+            'format' : 'show_tunnel',
         },
-        'fields' : {
-            'Idx' : {
-                     'verbose-name': '#',
-                     'edit' : False,
-                     'type' : 'CharField',
-                     'primary-key': True,
-                  },
-            'src-dpid':{
-                'verbose-name': 'Src DPID',
-                'json_serialize_string': True,
-                'type': 'CharField',
-                },
-            'dst-dpid': {'json_serialize_string': True,
-                'verbose-name': 'Dst DPID',
-                'type': 'CharField',
-                },
-            'status': {
-                'json_serialize_string': True,
-                'type': 'CharField',
-                },
-            'last-verified': {
-                'verbose-name': 'Last Verified',
-                'formatter' : fmtcnv.print_time_since_utc,
-                }
-            }
-        },
-}
-"""
\ No newline at end of file
+    )
+}
\ No newline at end of file
diff --git a/cli/cli/desc/version200/tunnelOld.py b/cli/cli/desc/version200/tunnelOld.py
new file mode 100755
index 0000000..0a3f5ba
--- /dev/null
+++ b/cli/cli/desc/version200/tunnelOld.py
@@ -0,0 +1,108 @@
+#
+# Copyright (c) 2013 Big Switch Networks, Inc.
+#
+# Licensed under the Eclipse Public License, Version 1.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+#      http://www.eclipse.org/legal/epl-v10.html
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
+import fmtcnv
+"""
+TUNNEL_COMMAND_DESCRIPTION = {
+    'name'          : 'tunnel-link',
+    'feature'      : 'vns',
+    'mode'          : 'login',
+    'command-type'  : 'display-table',
+    'doc'           : 'tunnel-link|verify-example',
+    'obj-type'      : None,
+    'args'  : {
+        'choices': (
+            (
+                 {
+                     'token'         : 'verify',
+                     'short-help'    : 'Verify status of tunnel between two switches',
+                     'action'        : 'display-rest',
+                     'format'        : 'tunnel-event',
+                     'url'           : [
+                                        'realtimestatus/network/tunnelverify/%(src-dpid)s/%(dst-dpid)s/',
+                                        ],
+                 },
+                 {
+                     'field'         : 'src-dpid',
+                     'type'          : 'dpid',
+                     'completion'    : 'complete-from-another',
+                     'other'         : 'switches|dpid',
+                     'data-handler'  : 'alias-to-value',
+                     'help-name'     : 'switch dpid or alias',
+                 },
+                 {
+                     'field'         : 'dst-dpid',
+                     'type'          : 'dpid',
+                     'completion'    : 'complete-from-another',
+                     'other'         : 'switches|dpid',
+                     'data-handler'  : 'alias-to-value',
+                     'help-name'     : 'switch dpid or alias',
+                 }
+            ),
+        )
+    }
+}
+
+TUNNEL_LINK_FAILURES_SHOW_COMMAND_DESCRIPTION = {
+    'name'         : 'show',
+    'mode'         : 'login',
+    'feature'      : 'vns',
+    'short-help'   : 'Show tunnel link failures',
+    'command-type' : 'display-table',
+    'url'          : 'realtimestatus/network/tunnelstatus/all/all',
+    'obj-type'     : None,
+    'format'       : 'tunnel-event',
+    'action'       : 'display-rest',
+    'args'  : (
+        'tunnel-link-failures',
+    ),
+}
+
+TUNNEL_EVENT_FORMAT = {
+    'tunnel-event' : {
+        'source'        : 'controller',
+        'url'           : 'tunnel-event',
+        'field-orderings': {
+                 'default' : [ 'Idx', 'src-dpid', 'dst-dpid', 'status', 'last-verified' ],
+        },
+        'fields' : {
+            'Idx' : {
+                     'verbose-name': '#',
+                     'edit' : False,
+                     'type' : 'CharField',
+                     'primary-key': True,
+                  },
+            'src-dpid':{
+                'verbose-name': 'Src DPID',
+                'json_serialize_string': True,
+                'type': 'CharField',
+                },
+            'dst-dpid': {'json_serialize_string': True,
+                'verbose-name': 'Dst DPID',
+                'type': 'CharField',
+                },
+            'status': {
+                'json_serialize_string': True,
+                'type': 'CharField',
+                },
+            'last-verified': {
+                'verbose-name': 'Last Verified',
+                'formatter' : fmtcnv.print_time_since_utc,
+                }
+            }
+        },
+}
+"""
\ No newline at end of file
diff --git a/cli/sdncon/rest/views.py b/cli/sdncon/rest/views.py
index 66ec9d7..41b0acb 100755
--- a/cli/sdncon/rest/views.py
+++ b/cli/sdncon/rest/views.py
@@ -2171,3 +2171,23 @@
     response = HttpResponse(response_text, JSON_CONTENT_TYPE)
     
     return response
+
+@safe_rest_view
+def do_show_tunnel(request):    
+    #if request.method != 'GET':
+    #    raise RestInvalidMethodException()
+
+    url = controller_url('onos', 'segmentrouting','tunnel')
+    if request.META['QUERY_STRING']:
+        url += '?' + request.META['QUERY_STRING']
+    return get_sdnplatform_response(url)
+
+@safe_rest_view
+def do_show_policy(request):    
+    #if request.method != 'GET':
+    #    raise RestInvalidMethodException()
+
+    url = controller_url('onos', 'segmentrouting','policy')
+    if request.META['QUERY_STRING']:
+        url += '?' + request.META['QUERY_STRING']
+    return get_sdnplatform_response(url)
\ No newline at end of file
diff --git a/cli/sdncon/urls.py b/cli/sdncon/urls.py
index 9857de0..211f3d0 100755
--- a/cli/sdncon/urls.py
+++ b/cli/sdncon/urls.py
@@ -170,7 +170,9 @@
     
     # REST APIs for SR tunnel 
     (r'^rest/v1/tunnel/?$', 'sdncon.rest.views.do_sdnplatform_tunnel_config'),
+    (r'^rest/v1/showtunnel/?$', 'sdncon.rest.views.do_show_tunnel'),
     # REST APIs for SR policy 
+    (r'^rest/v1/showpolicy/?$', 'sdncon.rest.views.do_show_policy'),
     (r'^rest/v1/policy/?$', 'sdncon.rest.views.do_sdnplatform_policy_config'),
 
 )