Improvement in 'show tunnel' command
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index 06ea46a..603089a 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -100,7 +100,7 @@
         url_str = "http://%s/rest/v1/tunnel/" % (sdnsh.controller)
         obj_data = {}
         obj_data['tunnel_id']=tunnel_id
-        obj_data['label_path']=entries
+        obj_data['tunnel_path']=entries
         data = sdnsh.store.rest_post_request(url_str,obj_data)
         # LOOK! successful stuff should be returned in json too.
         if data != "success":
@@ -117,7 +117,7 @@
     tunnel_id=data['tunnel-id']
     url_str = "http://%s/rest/v1/tunnel/" % (sdnsh.controller)
     obj_data = {}
-    obj_data['tunnel_id']=data['tunnel-id']
+    obj_data['tunnel-id']=data['tunnel_id']
     data = sdnsh.store.rest_post_request(url_str,obj_data,'DELETE')
     if data != "deleted":
         result = json.loads(data)
@@ -131,7 +131,7 @@
         print "policy_create:" , data
     if data.has_key('policy-id'):
         policy_obj_data['policy_id'] = data['policy-id']
-    if data.has_key('src_ip'):
+    if data.has_key('src-ip'):
         for key in data:
             policy_obj_data[key] = data[key]
     if data.has_key('priority'):
@@ -164,7 +164,7 @@
     policy_id=data['policy-id']
     url_str = "http://%s/rest/v1/policy/" % (sdnsh.controller)
     obj_data = {}
-    obj_data['policy_id']=data['policy-id']
+    obj_data['policy-id']=data['policy-id']
     data = sdnsh.store.rest_post_request(url_str,obj_data,'DELETE')
     if data != "deleted":
         result = json.loads(data)
@@ -2132,26 +2132,25 @@
                                })
         entries = combResult
 
-
-    if 'showtunnel' in data  and data['showtunnel'] == 'tunnel':
-        #raise error.ArgumentValidationError('\n\n\n %s' % (entries))
+    if 'showtunnel' in data  and (data['showtunnel'] == 'tunnel' or data['showtunnel'] == 'details'):
+        #eraise error.ArgumentValidationError('\n\n\n %s' % (entries))
         combResult = []
         tunnelList = entries
         for tunnel in tunnelList:
             labelStack = str(tunnel.get('labelStack'))
             labelStack = remove_unicodes(labelStack)
             tunnelId = tunnel.get('tunnelId')
+            dpidGroup = str(tunnel.get('dpidGroup'))
             #nodes = ''
             #for node in tunnel.get("nodes"):
             #    nodes += (node.get('value') + ',')
             #if nodes != '':
             #    nodes = nodes[:-1]
-            #portNo = portData.get("portNumber")
-            #subnetIp = port.get("subnetIp")
             combResult.append({
                                'tunnelId'         : tunnelId,
                                #'nodes'           : nodes,
                                'labelStack'      :labelStack,
+                               'dpidGroup'      :dpidGroup,
                                })
         entries = combResult
 
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 4100f7c..fc4d2d8 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -2414,9 +2414,16 @@
 SHOW_TUNNEL_FORMAT = {
     'show_tunnel' : {
         'field-orderings' : {
-            'default' : [ 'Idx', 'tunnelId', 'labelStack', 'Group/DIPD',],
-            'scoped' : [ 'Idx', 'tunnelId', 'labelStack', 'Group/DIPD',],
+            'default' : [ 'Idx', 'tunnelId', 'labelStack',],
+            'details' : [ 'Idx', 'tunnelId', 'labelStack', 'dpidGroup',],
+            'scoped' : [ 'Idx', 'tunnelId', 'labelStack', 'dpidGroup',],
             },
+       # 'fields': {
+       #     'tunnelId'         : { 'verbose-name' : 'Id',
+       #                        },
+       #     'dpidGroup'         : { 'verbose-name' : 'dpid/Group',
+       #                        },
+        #           }
         },
 }
 
diff --git a/cli/cli/desc/version200/tunnel.py b/cli/cli/desc/version200/tunnel.py
index 7928ba8..c32ad89 100644
--- a/cli/cli/desc/version200/tunnel.py
+++ b/cli/cli/desc/version200/tunnel.py
@@ -19,5 +19,19 @@
                        ],
             'format' : 'show_tunnel',
         },
+              {
+            'choices' : (
+                {
+                 'field'      : 'showtunnel',
+                 'type'       : 'enum',
+                 'values'     : ('details',),
+                 'action'     : 'display-rest',
+                 'url'        : 'showtunnel',
+                 'optional'   : True,
+                 'format' : 'show_tunnel',
+                 'doc'        : 'switch|show-switch-format-+',
+                },
+                         ),
+               }
     )
 }
\ No newline at end of file
diff --git a/conf/onos.properties b/conf/onos.properties
index c86d9f7..60283c8 100644
--- a/conf/onos.properties
+++ b/conf/onos.properties
@@ -23,5 +23,5 @@
 # Uncomment and list all the ZooKeeper instances after localhost on multi-instance deployment.
 #net.onrc.onos.core.registry.ZookeeperRegistry.connectionString = localhost:2181,otherhost:2181
 # Specify a network configuration file to be used by the NetworkConfigManager
-net.onrc.onos.core.configmanager.NetworkConfigManager.networkConfigFile = conf/sr-3node.conf
+net.onrc.onos.core.configmanager.NetworkConfigManager.networkConfigFile = conf/sr-ecmp10.conf
 
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/ISegmentRoutingService.java b/src/main/java/net/onrc/onos/apps/segmentrouting/ISegmentRoutingService.java
index 9a887ae..add898f 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/ISegmentRoutingService.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/ISegmentRoutingService.java
@@ -66,4 +66,15 @@
      */
 
     public Collection<TunnelInfo> getTunnelTable();
+    /**
+     * Get the first group ID for the tunnel for specific source router
+     * If Segment Stitching was required to create the tunnel, there are
+     * mutiple source routers.
+     *
+     * @param tunnelId ID for the tunnel
+     * @param dpid source router DPID
+     * @return the first group ID of the tunnel and -1 if sw with specifed
+     * dpid is not found
+     */
+    public int getTunnelGroupId(String tunnelId, String dpid);
 }
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
index f8bfc11..3ed4bdf 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
@@ -215,7 +215,7 @@
         });
 
         testMode = POLICY_ADD1;
-        //testTask.reschedule(20, TimeUnit.SECONDS);
+        testTask.reschedule(20, TimeUnit.SECONDS);
     }
 
     @Override
@@ -949,13 +949,6 @@
         private String tunnelId;
         private int type;
 
-        public PolicyInfo(String pid, PacketMatch match, int priority, String tid) {
-            this.policyId = pid;
-            this.match = match;
-            this.priority = priority;
-            this.tunnelId = tid;
-        }
-
         public PolicyInfo(String pid, int type, PacketMatch match, int priority,
                 String tid) {
             this.policyId = pid;
@@ -964,6 +957,29 @@
             this.tunnelId = tid;
             this.type = type;
         }
+        
+        public PolicyInfo(String pid, PacketMatch match, int priority,
+                String tid) {
+            this.policyId = pid;
+            this.match = match;
+            this.priority = priority;
+            this.tunnelId = tid;
+        }
+        public String getPolicyId(){
+            return this.policyId;
+        }
+        public PacketMatch getMatch(){
+            return this.match;
+        }
+        public int getPriority(){
+            return this.priority;
+        }
+        public String getTunnelId(){
+            return this.tunnelId;
+        }
+        public int getType(){
+            return this.type;
+        }
     }
 
     public class TunnelInfo {
@@ -1211,6 +1227,9 @@
             routeInfo.setSrcDpid(srcSw.getDpid().toString());
             String nodeId = route.get(1);
             List<Dpid> fwdSwDpids = getForwardingSwitchForNodeId(srcSw, nodeId);
+            if (fwdSwDpids == null){
+                return null;
+            }
             for (Dpid dpid: fwdSwDpids) {
                 if (getMplsLabel(dpid.toString()).toString().equals(nodeId)) {
                     List<Dpid> fwdSws = new ArrayList<Dpid>();
@@ -1718,8 +1737,8 @@
                 this.createPolicy("2", null, null, Ethernet.TYPE_IPV4, srcIp,
                         dstIp, IPv4.PROTOCOL_ICMP, (short)-1, (short)-1, 20000,
                         "2");
-                testMode = POLICY_REMOVE2;
-                testTask.reschedule(5, TimeUnit.SECONDS);
+                //testMode = POLICY_REMOVE2;
+                //testTask.reschedule(5, TimeUnit.SECONDS);
             }
             else {
                 log.debug("Retry it");
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelInfo.java b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelInfo.java
index cd6f9be..4c6457a 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelInfo.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelInfo.java
@@ -1,30 +1,28 @@
 package net.onrc.onos.apps.segmentrouting.web;
 
 import java.util.List;
-
 /**
  * This class contains tunnel info of ONOS Segement Routing App
  * Used for rest API
  */
 public class SegmentRouterTunnelInfo {
     private String tunnelId;
-    // private List<Dpid> nodes;
     private List<List<String>> labelStack;
-
-    public SegmentRouterTunnelInfo(String tId, /*List<Dpid> dpids,*/
-            List<List<String>> tunnelRoutes){
+    private List<String> dpidGroup;
+    
+    public SegmentRouterTunnelInfo (String tId,
+            List<List<String>> tunnelRoutes, List<String> dpidsWithGroup){
         this.tunnelId = tId;
-        // this.nodes = dpids;
         this.labelStack = tunnelRoutes;
+        this.dpidGroup = dpidsWithGroup;
     }
     public String getTunnelId (){
         return this.tunnelId;
     }
-
-    /*public List<Dpid> getnodes (){
-        return this.nodes;
-    }*/
     public List<List<String>> getLabelStack (){
         return this.labelStack;
     }
+    public List<String> getDpidGroup (){
+        return this.dpidGroup;
+    }
 }
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelResource.java b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelResource.java
index bf3a084..d391082 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelResource.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterTunnelResource.java
@@ -73,7 +73,6 @@
 
     @Get("json")
     public Object getTunnel() {
-        System.out.println("Got into getTunnel");
         ISegmentRoutingService segmentRoutingService =
                 (ISegmentRoutingService) getContext().getAttributes().
                         get(ISegmentRoutingService.class.getCanonicalName());
@@ -83,19 +82,19 @@
            TunnelInfo tunnelInfo = ttI.next();
            Iterator<TunnelRouteInfo>trI = tunnelInfo.getRoutes().iterator();
            List<List<String>> labelStack = new ArrayList<List<String>>();
+           List<String> dpidGroup = new ArrayList<String>();
            while(trI.hasNext()){
                TunnelRouteInfo label = trI.next();
                labelStack.add(label.getRoute());
+               Integer gId = segmentRoutingService.getTunnelGroupId(tunnelInfo.getTunnelId(), 
+                       label.getSrcSwDpid());
+               dpidGroup.add(label.getSrcSwDpid() + "/"+ gId);
            }
            SegmentRouterTunnelInfo info = new SegmentRouterTunnelInfo(tunnelInfo.getTunnelId(),
-                    /*tunnelInfo.getDpids(),*/labelStack);
+                    labelStack, dpidGroup);
            infoList.add(info);
-           //TODO Add Group/DPID
-
         }
         log.debug("getTunnel with params");
-        Map <String,List<SegmentRouterTunnelInfo>>result = new HashMap<String,List<SegmentRouterTunnelInfo>>();
-        result.put("tunnels", infoList);
         return infoList;
     }
 }