Improved CLI. Still need to edit submitted code
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index e445315..d90acae 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -1546,6 +1546,12 @@
             result = []
             if (onos == 1) and (url == 'links'):
                 for entry in entries:
+                    src = entry.get('src')
+                    dst = entry.get('dst')
+                    for tempEntry in entries:
+                        if cmp(src, tempEntry.get('dst')) == 0:
+                            if cmp(dst, tempEntry.get('src')) == 0:
+                                entries.remove(tempEntry)
                     result.append({
                        'src-switch'          : entry['src']['dpid'],
                        'src-port'            : entry['src']['portNumber'],
diff --git a/cli/cli/desc/version200/switch.py b/cli/cli/desc/version200/switch.py
index 6a814f3..c8f65ed 100755
--- a/cli/cli/desc/version200/switch.py
+++ b/cli/cli/desc/version200/switch.py
@@ -951,11 +951,10 @@
     'switch' : {
         'field-orderings' : {
             'default' : [ 'Idx', '@', 'switch-alias', 'connected-since',
-                          'ip-address', 'type'],
+                          'ip-address', 'type', 'controller'],
             'details' : [ 'Idx','@', 'switch-alias', 'connected-since',
-                          'ip-address', 'type'],
-            'brief'   : [ 'Idx', '@', 'switch-alias', 'connected-since',
-                          'ip-address', ],
+                          'ip-address', 'type', 'controller'],
+            'brief'   : [ 'Idx', '@', 'switch-alias', 'controller'],
             },
         'fields' : {
             '@'                  : {
@@ -978,13 +977,14 @@
                                      'formatter' : fmtcnv.decode_switch_actions,
                                    },
             'ip-address'         : {
-                                     'verbose-name' : 'IP Address',
+                                     'verbose-name' : 'Connected At',
                                    },
             'socket-address'     : {
                                    },
             'buffers'            : {
                                    },
             'controller'         : {
+                                     'verbose-name' : 'Controller',
                                    },
             'tables'             : {
                                    },
diff --git a/cli/cli/rest_to_model.py b/cli/cli/rest_to_model.py
index 4c37c87..34506ce 100755
--- a/cli/cli/rest_to_model.py
+++ b/cli/cli/rest_to_model.py
@@ -410,7 +410,23 @@
 
         # this synthetic obj_type's name is 'switches' in an attempt
         # to disabigutate it from 'class Switch'
+        #TODO: Need figure out a better way to get url (Through sdncon framework)
+        url = "http://%s/rest/v1/mastership" % sdnsh.controller
+        try:
+            result2 = sdnsh.store.rest_simple_request(url)
+            check_rest_result(result2)
+            mastership_data = json.loads(result2)
+        except Exception, e:
+            if sdnsh.description:   # description debugging
+                print "get_model_from_url: failed request %s: '%s'" % (url, e)
+            entries = []
         for entry in entries:
+            dpid = entry.get('dpid')
+            if(dpid in mastership_data.keys()):
+                #As there is only one master for switch
+                controller = mastership_data[dpid][0].get('controllerId')
+            else:
+                controller = None
             if switch_match and switch_match != entry['dpid']:
                 continue
             if switch_prefix and not entry['dpid'].startswith(switch_prefix):
@@ -418,9 +434,11 @@
             if onos == 1:
                 result.append({
                    'dpid'                : entry['dpid'],
+                   'switch-alias'        : entry['stringAttributes']['name'],
                    'connected-since'     : entry['stringAttributes']['ConnectedSince'],
-                   'ip-address'          : 0,
-                   'type'                : entry['stringAttributes']['type']
+                   'ip-address'          : entry['stringAttributes']['remoteAddress'],
+                   'type'                : entry['stringAttributes']['type'],
+                   'controller'          : controller
                 })
             else:
                 attrs = entry['attributes']
@@ -476,8 +494,7 @@
                         sw['tcp-port'] = ''
                         sw['connected-since'] = ''
                         result.append(sw)
-                else:
-                    known_dpids[dpid].update(sw)
+                [dpid].update(sw)
     elif obj_type == 'interfaces':
 
         # These are called interfaces because the primary
diff --git a/cli/sdncon/rest/views.py b/cli/sdncon/rest/views.py
index 260933e..7a45dbb 100755
--- a/cli/sdncon/rest/views.py
+++ b/cli/sdncon/rest/views.py
@@ -702,6 +702,15 @@
     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"
+    if request.META['QUERY_STRING']:
+        url += '?' + request.META['QUERY_STRING']
+    return get_sdnplatform_response(url) 
+#'''
+
+@safe_rest_view
 def do_links(request):
     if onos == 0:
         url = controller_url("topology", "links", "json")
diff --git a/cli/sdncon/urls.py b/cli/sdncon/urls.py
index 2abf2bd..b06bd39 100755
--- a/cli/sdncon/urls.py
+++ b/cli/sdncon/urls.py
@@ -38,7 +38,6 @@
     (r'ui/show_link', 'sdncon.ui.views.show_link'),
     (r'ui/show_tunnel', 'sdncon.ui.views.show_tunnel'),
     (r'ui/build_topology', 'sdncon.ui.views.build_topology'),
-    
     # Uncomment the next line to enable the admin:
     (r'^admin/', include(admin.site.urls)),
     (r'accounts/login/$', 'django.contrib.auth.views.login'),
@@ -70,6 +69,7 @@
     (r'^rest/v1/device', 'sdncon.rest.views.do_device'),
     (r'^rest/v1/switches', 'sdncon.rest.views.do_switches'),
     (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'),
     (r'^rest/v1/vns/interface', 'sdncon.rest.views.do_vns_interface'),
     (r'^rest/v1/vns/realtimestats/flow/(?P<vnsName>[A-Za-z0-9_:.|\-]+)/?$', 'sdncon.rest.views.do_vns_realtimestats_flow', {'category': 'vns'}),