CLI tab completion for node adjacency Ids
diff --git a/cli/cli/desc/version200/policy.py b/cli/cli/desc/version200/policy.py
index 9bf94df..1ddd33c 100644
--- a/cli/cli/desc/version200/policy.py
+++ b/cli/cli/desc/version200/policy.py
@@ -114,7 +114,7 @@
                 #'dest-ip'      : 'src-ip',
                 #'dest-netmask' : 'src-ip-mask',
                 'data'         : {
-                                  'dst_ip'      : '0.0.0.0/32',
+                                  'dst_ip'      : '0.0.0.0/0',
                                  },
                 'doc'          : 'vns|vns-access-list-cidr-range',
             }
@@ -123,8 +123,8 @@
             {
                 'token'  : 'any',
                 'data'   : {
-                              'src_ip'      : '0.0.0.0/32',
-                              'dst_ip'      : '0.0.0.0/32',
+                              'src_ip'      : '0.0.0.0/0',
+                              'dst_ip'      : '0.0.0.0/0',
                            },
                 'doc'    : 'vns|vns-access-list-ip-any',
             }
@@ -178,7 +178,7 @@
             {
                 'token'  : 'any',
                 'data'   : {
-                              'dst_ip'      : '0.0.0.0/32',
+                              'dst_ip'      : '0.0.0.0/0',
                            },
                 'doc'    : 'vns|vns-access-list-ip-any',
             }
diff --git a/cli/cli/desc/version200/tunnel.py b/cli/cli/desc/version200/tunnel.py
index 29f1044..67a37ab 100644
--- a/cli/cli/desc/version200/tunnel.py
+++ b/cli/cli/desc/version200/tunnel.py
@@ -66,23 +66,20 @@
 
 def tunnel_adjacency_label_completion(prefix, data, completions):
     #print "tunnel_adjacency_label_completion:",prefix,data,completions
-    query_url = "http://127.0.0.1:8000/rest/v1/switches"
-    result = command.sdnsh.store.rest_simple_request(query_url)
-    entries = json.loads(result)
-    for entry in entries:
-        if (int(entry['stringAttributes']['nodeSid']) != int(data['node-label'])):
-            continue
-        adjacencySids = entry['stringAttributes']['adjacencySids']
-        #print "adjacencySids=",adjacencySids
-        for subs in adjacencySids.split('}'):
-            pair = subs.split('adjSid\":')
-            if len(pair) < 2:
-                continue
-            adjacency_label = pair[1]
-            #adjacency_label = entry['stringAttributes']['nodeSid'] + ':' + pair[1]
-            #print "adjacency_label=",adjacency_label 
-            if adjacency_label.startswith(prefix):
-                completions[adjacency_label+' '] = adjacency_label
+    query_url1 = "http://127.0.0.1:8000/rest/v1/switches"
+    result1 = command.sdnsh.store.rest_simple_request(query_url1)
+    entries1 = json.loads(result1)
+    node_dpid = None
+    for entry in entries1:
+        if (int (entry['stringAttributes']['nodeSid']) == int(data['node-label'])):
+            node_dpid = entry['dpid']
+    if (node_dpid != None):
+        query_url2 = "http://127.0.0.1:8000/rest/v1/router/"+node_dpid+"/adjacency"
+        result2 = command.sdnsh.store.rest_simple_request(query_url2)
+        entries2 = json.loads(result2)
+        for entry in entries2:
+            if str(entry.get("adjacencySid")).startswith(prefix):
+                completions[str(entry.get("adjacencySid"))+' '] = entry.get("adjacencySid")
     return
 
 command.add_completion('tunnel-adjacency-label-completion', tunnel_adjacency_label_completion,
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java
index 6c24901..f1ad1ec 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java
@@ -53,10 +53,13 @@
                 createParams.getSrc_tp_port(), createParams.getDst_tp_port(),
                 createParams.getPriority(), createParams.getTunnel_id());
 
+        IPv4Net src_ip = (createParams.getSrc_ip() != null) ?
+                new IPv4Net(createParams.getSrc_ip()) : null;
+        IPv4Net dst_ip = (createParams.getDst_ip() != null) ?
+                new IPv4Net(createParams.getDst_ip()) : null;
         boolean result = segmentRoutingService.createPolicy(
                 createParams.getPolicy_id(), null, null, null,
-                new IPv4Net(createParams.getSrc_ip()),
-                new IPv4Net(createParams.getDst_ip()),
+                src_ip, dst_ip,
                 getProtoTypeByte(createParams.getProto_type()),
                 createParams.getSrc_tp_port(),
                 createParams.getDst_tp_port(),
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterResource.java b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterResource.java
index 621a6cd..0dc9b78 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterResource.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterResource.java
@@ -47,7 +47,7 @@
         try {
             if (routerId == null && statsType == null){
                 return eval(toRepresentation(mutableTopology.getSwitches(), null));
-        }
+            }
             else if(routerId != null && statsType.equals("port")){
                 Switch sw = mutableTopology
                 .getSwitch(new Dpid(HexString.toLong(routerId)));