diff --git a/start-cassandra.sh b/start-cassandra.sh
index 3f92779..011c09d 100755
--- a/start-cassandra.sh
+++ b/start-cassandra.sh
@@ -2,19 +2,19 @@
 
 CASSANDRA_DIR=${HOME}/apache-cassandra-1.1.4
 LOGDIR=${HOME}/ONOS/onos-logs
-CASSANDRA_LOG=$LOGDIR/cassandara.onos1vpc.log
+CASSANDRA_LOG=$LOGDIR/cassandara.`hostname`.log
 
 function lotate {
-logfile=$1
-nr_max=$2
-if [ -f $logfile ]; then
-  for i in `seq $(expr 10 - 1) -1 1`; do
-    if [ -f ${logfile}.${i} ]; then
-      mv -f ${logfile}.${i} ${logfile}.`expr $i + 1`
+    logfile=$1
+    nr_max=${2:-10}
+    if [ -f $logfile ]; then
+	for i in `seq $(expr $nr_max - 1) -1 1`; do
+	    if [ -f ${logfile}.${i} ]; then
+		mv -f ${logfile}.${i} ${logfile}.`expr $i + 1`
+	    fi
+	done
+	mv $logfile $logfile.1
     fi
-  done
-  mv $logfile $logfile.1
-fi
 }
 
 function start {
diff --git a/start-onos.sh b/start-onos.sh
index a3c0c43..19834af 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -51,16 +51,16 @@
 #<appender-ref ref="STDOUT" />
 
 function lotate {
-logfile=$1
-nr_max=$2
-if [ -f $logfile ]; then
-for i in `seq $(expr 10 - 1) -1 1`; do
-if [ -f ${logfile}.${i} ]; then
-mv -f ${logfile}.${i} ${logfile}.`expr $i + 1`
-fi
-done
-mv $logfile $logfile.1
-fi
+    logfile=$1
+    nr_max=${2:-10}
+    if [ -f $logfile ]; then
+	for i in `seq $(expr $nr_max - 1) -1 1`; do
+	    if [ -f ${logfile}.${i} ]; then
+		mv -f ${logfile}.${i} ${logfile}.`expr $i + 1`
+	    fi
+	done
+	mv $logfile $logfile.1
+    fi
 }
 
 function start {
diff --git a/start-rest.sh b/start-rest.sh
new file mode 100755
index 0000000..28ea0f7
--- /dev/null
+++ b/start-rest.sh
@@ -0,0 +1,68 @@
+#! /bin/bash
+
+# Change this accordingly
+ONOSDIR=${HOME}/ONOS
+script_name="topology_rest.py"
+
+#######################
+WEBDIR=${ONOSDIR}/web
+restscript=${WEBDIR}/$script_name
+LOGDIR=${ONOSDIR}/onos-logs
+REST_LOG="${LOGDIR}/rest.`hostname`.log"
+#######################
+
+function lotate {
+    logfile=$1
+    nr_max=${2:-10}
+    if [ -f $logfile ]; then
+	for i in `seq $(expr $nr_max - 1) -1 1`; do
+	    if [ -f ${logfile}.${i} ]; then
+		mv -f ${logfile}.${i} ${logfile}.`expr $i + 1`
+	    fi
+	done
+	mv $logfile $logfile.1
+    fi
+}
+
+function stop {
+    pids=`ps -edalf |grep ${script_name} | grep python | grep -v grep | awk '{print $4}'`
+    for p in ${pids}; do
+	if [ x$p != "x" ]; then
+	    sudo kill -KILL $p
+	    echo "Killed existing prosess (pid: $p)"
+	fi
+    done
+}
+
+function status {
+    nr_process=`ps -edalf |grep ${script_name} | grep python | grep -v grep | wc -l` 
+    if [ x${nr_process} == "x" ] ; then
+      nr_process=0
+    fi
+    echo "${nr_process} instance of rest server is running"
+}
+
+function start {
+    lotate $REST_LOG 10 
+    cd $WEBDIR
+    $restscript > $REST_LOG 2>&1 &
+}
+
+case "$1" in
+  start)
+    stop
+    start 
+    ;;
+  stop)
+    stop
+    ;;
+  deldb)
+    deldb
+    ;;
+  status)
+    status
+    ;;
+  *)
+    echo "Usage: $0 {start|stop|restart|status}"
+    exit 1
+esac
diff --git a/web/js/onos-topology-route.js b/web/js/onos-topology-route.js
new file mode 100644
index 0000000..e94d1aa
--- /dev/null
+++ b/web/js/onos-topology-route.js
@@ -0,0 +1,390 @@
+function gui(data_source){
+    var width = 960,
+    height = 500;
+    var color = d3.scale.category20();
+
+    var svg = d3.select("body").append("svg:svg")
+	.attr("width", width)
+	.attr("height", height);
+
+    var force = d3.layout.force()
+	.charge(-500)
+	.linkDistance(100)
+	.size([width, height]);
+
+    var path = svg.selectAll("path");
+    var circle = svg.selectAll("circle");
+    var text = svg.selectAll("g");
+    var pathlen = 0;
+    var from;
+    var to;
+    var path_set = 0;
+
+
+    d3.json(data_source,init);
+
+    function init(json){
+        nodes = force.nodes();
+        links = force.links();
+
+	json.nodes.forEach(function(item) {
+            nodes.push(item);
+	});
+/*
+        nodes.sort(function(a,b) {
+            if (a.name > b.name) {return 1;}
+            else if (a.name < b.name) {return -1;}
+            else {return 0;}
+        });
+*/
+	json.links.forEach(function(item) {
+            links.push(item);
+	});
+	draw(nodes, links);
+    }
+
+    function update(json) {
+	Array.prototype.diff2 = function(arr) {
+	    return this.filter(function(i) {
+		for (var j = 0; j < arr.length ; j++) {
+		    if (arr[j].source === i.source.index && 
+			arr[j].target === i.target.index)
+			return false;
+		}
+		return true;
+	    });
+	};
+
+	Array.prototype.diff = function(arr) {
+	    return this.filter(function(i) {
+		for (var j = 0; j < arr.length ; j++) {
+		    if (arr[j].source.index === i.source && 
+			arr[j].target.index === i.target)
+			return false;
+		}
+		return true;
+	    });
+	};
+
+	Array.prototype.node_diff = function(arr) {
+	    return this.filter(function(i) {
+		for (var j = 0; j < arr.length ; j++) {
+		    if (arr[j].name === i.name)
+			return false;
+		}
+		return true;
+	    });
+	};
+
+
+        links.sort(function(a,b) {
+            if (a.source > b.source) {return 1;}
+            else if (a.source < b.source) {return -1;}
+            else {
+                if (a.target > b.target) {return 1;}
+                if (a.target < b.target) {return -1;}
+                else {return 0;}
+            }
+        });
+
+//        for (var i=0; i<links.length; i++) {
+//          if (i != 0 &&
+//            links[i].source == links[i-1].source &&
+//            links[i].target == links[i-1].target) {
+//            links[i].linknum = links[i-1].linknum + 1;
+//          }
+//          else {links[i].linknum = 1;};
+//        };
+
+
+	function cdiff(topo) {
+            var changed = false;
+
+            var n_adds = topo.nodes.node_diff(nodes);
+            var n_rems = nodes.node_diff(topo.nodes);
+            for (var i = 0; i < n_adds.length; i++) {
+		nodes.push(n_adds[i]);
+		changed = true;
+            }
+            for (var i = 0; i < n_rems.length; i++) {
+		for (var j = 0; j < nodes.length; j++) {
+		    if ( nodes[j].name == n_rems[i].name ){
+			nodes.splice(j,1);
+			changed = true;
+			break;
+		    }
+		}
+            }
+
+            var l_adds = [];
+            var l_rems = [];
+	    l_adds = added_links(topo, links, l_adds);
+            l_rems = gone_links(topo, links, l_rems);
+
+            for (var i = 0; i < l_rems.length ; i++) {
+		for (var j = 0; j < links.length; j++) {
+                    if (links[j].source.name == l_rems[i].source.name &&
+			links[j].target.name == l_rems[i].target.name) {
+			links.splice(j,1);
+			changed = true;
+			break;
+                    }
+		}
+            }
+            for (var i = 0; i < l_adds.length; i++) {
+		var s;
+		var t;
+		for (var j = 0; j < nodes.length; j++) {
+		    if ( json.nodes[l_adds[i].source].name == nodes[j].name ){
+			s = j;
+			break;
+		    }
+		}
+		for (var j = 0; j < nodes.length; j++) {
+		    if ( json.nodes[l_adds[i].target].name == nodes[j].name ){
+			t = j;
+			break;
+		    }
+		}
+		l_adds[i].source = s;
+		l_adds[i].target = t;
+		links.push(l_adds[i]);
+		changed = true;
+            }
+	    return changed
+	}
+
+
+	var changed = cdiff(json);
+
+        for (var i = 0; i < json.nodes.length; i++) {
+	    nodes[i].group = json.nodes[i].group
+	}
+	var rewrite = 0;
+	for (var i = 0; i < links.length; i++) {
+            for (var j = 0; j < json.links.length; j++) {
+	/*	
+		console.log("link" + i);
+		console.log(links[i].source.name + "->" + links[i].target.name);
+		console.log("type " + links[i].type);
+		console.log("json link" + j);
+		console.log(json.nodes[json.links[j].source].name + "->" + json.nodes[json.links[j].target].name);
+	*/
+		if (links[i].target.name == json.nodes[json.links[j].target].name && 
+		    links[i].source.name == json.nodes[json.links[j].source].name ){
+		    links[i].type = json.links[j].type;
+		    rewrite ++;
+		}
+	    }
+	}
+	console.log("changed?" + changed);
+	if (changed){
+	    console.log(nodes);
+	    console.log(links);
+            path = svg.selectAll("path").data(links)
+            circle = svg.selectAll("circle").data(nodes);
+	    text = svg.selectAll("text").data(nodes);
+
+	    force.stop();
+
+            path.enter().append("svg:path")
+		.attr("class", function(d) { return "link"; })
+		.attr("marker-end", function(d) {
+		    if(d.type == 1){
+			return "url(#TriangleRed)";
+		    } else {
+			return "url(#Triangle)";
+		    }
+		});
+
+            circle.enter().append("svg:circle")
+               .attr("r", 8)
+/*		.on("click", function(d,i) {
+		    if ( path_set == 0 || path_set == 2 ){
+			fm = d.name;
+			path_set = 1;
+			alert("from set to " + d.name);
+		    }else if ( path_set == 1 ){
+			to = d.name;
+			path_set = 2;
+			alert("to set to " + d.name);
+		    }
+		}) */
+               .call(force.drag);
+
+/*	    text.enter().append("svg:text")
+		.attr("x", 8)
+		.attr("y", ".31em")
+		.attr("class", "shadow")
+		.text(function(d) { return d.name.split(":")[7]; }); */
+
+	    text.enter().append("svg:text")
+		.attr("x", 8)
+		.attr("y", ".31em")
+		.text(function(d) { return d.name.split(":")[7]; }); 
+
+            circle.append("title")
+	      .text(function(d) { return d.name; });
+
+	    path.attr("stroke", function(d) {
+		if(d.type == 1){
+		    return "red"
+		} else {
+		    return "black"
+		}
+	    })
+	    .attr("stroke-width", function(d) {
+		if(d.type == 1){
+		    return "4px";
+		} else {
+		    return "1.5px";
+		}
+	    });
+
+
+	    path.exit().remove();
+            circle.exit().remove();
+            text.exit().remove();
+	    force.on("tick", tick);
+            force.start();
+	}
+    }
+    function draw(nodes, links){
+        path = svg.append("svg:g").selectAll("path").data(links)
+        circle = svg.append("svg:g").selectAll("circle").data(nodes);
+	text = svg.append("svg:g").selectAll("text").data(nodes);
+
+        path.enter().append("svg:path")
+	    .attr("class", function(d) { return "link"; })
+	    .attr("marker-end", function(d) {
+		if(d.type == 1){
+		    return "url(#TriangleRed)";
+		} else {
+		    return "url(#Triangle)";
+		}
+	    });
+
+	path.attr("stroke", function(d) {
+	    if(d.type == 1){
+		return "red"
+	    } else {
+		return "black"
+	    }
+	}).attr("stroke-width", function(d) {
+	    if(d.type == 1){
+		return "4px";
+	    } else {
+		return "1.5px";
+	    }
+	}).attr("marker-end", function(d) {
+	    if(d.type == 1){
+		return "url(#TriangleRed)";
+	    } else {
+		return "url(#Triangle)";
+	    }
+	});
+
+
+        circle.enter().append("svg:circle")
+          .attr("r", 8)
+/*	    .on("click", function(d,i) {
+		if ( path_set == 0 || path_set == 2 ){
+		    fm = d.name;
+		    path_set = 1;
+		    alert("from set to " + d.name);
+		}else if ( path_set == 1 ){
+		    to = d.name;
+		    path_set = 2;
+		    alert("to set to " + d.name);
+		}
+	    }) */
+          .call(force.drag);
+
+/*	text.enter().append("svg:text")
+	    .attr("x", 8)
+	    .attr("y", ".31em")
+	    .attr("class", "shadow")
+	    .text(function(d) { return d.name.split(":")[7]; }); */
+
+	text.enter().append("svg:text")
+	    .attr("x", 8)
+	    .attr("y", ".31em")
+	    .text(function(d) { return d.name.split(":")[7]; }); 
+
+	circle.append("title")
+	    .text(function(d) { return d.name; });
+
+	circle.attr("fill", function(d) {
+	    if (d.group == 1){return "red";}
+	    else if (d.group == 2){return "blue";}
+	    else if (d.group == 3){return "green";}
+	    else{ return "gray"; }
+	});
+
+
+	force.on("tick", tick);
+	path.exit().remove();
+        circle.exit().remove();
+//        text.exit().remove();
+
+	force.start();
+
+	setInterval(function() {
+            $.ajax({
+//		url: 'http://onosnat.onlab.us:8080/topology',
+		url: data_source,
+		success: function(json) {
+		    update(json)
+		},
+		dataType: "json"
+            });
+	}, 3000); 
+    }
+    function tick() {
+	path.attr("d", function(d) {
+	    var dx = d.target.x - d.source.x,
+	    dy = d.target.y - d.source.y,
+	    dr = 1/d.linknum;  //linknum is defined above
+	    dr = 300;
+	    return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
+	});
+
+	path
+	    .attr("stroke", function(d) {
+	    if(d.type == 1){
+		return "red"
+	    } else {
+		return "black"
+	    }
+	}).attr("stroke-width", function(d) {
+	    if(d.type == 1){
+		return "4px";
+	    } else {
+		return "1.5px";
+	    }
+	}).attr("marker-end", function(d) {
+	    if(d.type == 1){
+		return "url(#TriangleRed)";
+	    } else {
+		return "url(#Triangle)";
+	    }
+	});
+
+
+//	circle.attr("cx", function(d) { return d.x; }).attr("cy", function(d) { return d.y; });
+	circle.attr("transform", function(d) {
+	    return "translate(" + d.x + "," + d.y + ")";
+	})
+	circle.attr("fill", function(d) {
+	    if (d.group == 1){return "red";}
+	    else if (d.group == 2){return "blue";}
+	    else if (d.group == 3){return "green";}
+	    else{ return "gray"; }
+	});
+//	text.attr("x", function(d) { return d.x; }).attr("y", function(d) { return d.y; });
+//	text.attr("x", function(d) { return d.x; }).attr("y", function(d) { return d.y; });
+	text.attr("transform", function(d) {
+	    return "translate(" + d.x + "," + d.y + ")";
+	});
+    }
+}
diff --git a/web/js/onos-topology.js b/web/js/onos-topology.js
index aee3eaf..a5d84cc 100644
--- a/web/js/onos-topology.js
+++ b/web/js/onos-topology.js
@@ -16,8 +16,7 @@
     var circle = svg.selectAll("circle");
     var text = svg.selectAll("g");
 
-
-    d3.json(data_source,init);
+    d3.json(data_source, init);
 
     function init(json){
         nodes = force.nodes();
@@ -31,6 +30,38 @@
 	});
 	draw(nodes, links);
     }
+    function gone_links (json, links, gone) {
+	for (var i = 0; i < links.length ; i ++){
+	    var found = 0;
+	    for (var j = 0; j < json.links.length ; j ++){
+		if (links[i].source.name == json.nodes[json.links[j].source].name && 
+		    links[i].target.name == json.nodes[json.links[j].target].name ){
+		    found = 1;
+		    break;
+		}
+	    }
+	    if ( found == 0 ){
+		gone.push(links[i]);
+	    }
+	}
+	return gone;
+    }
+    function added_links (json, links, added) {
+	for (var j = 0; j < json.links.length ; j ++){
+	    var found = 0;
+	    for (var i = 0; i < links.length ; i ++){
+		if (links[i].source.name == json.nodes[json.links[j].source].name && 
+		    links[i].target.name == json.nodes[json.links[j].target].name ){
+		    found = 1;
+		    break;
+		}
+	    }
+	    if ( found == 0 ){
+		added.push(json.links[j]);
+	    }
+	}
+	return added;
+    }
 
     function update(json) {
 	Array.prototype.diff2 = function(arr) {
@@ -84,28 +115,13 @@
 //          else {links[i].linknum = 1;};
 //        };
 
-
-
 	function cdiff(topo) {
             var changed = false;
-            var l_adds = topo.links.diff(links);
-            var l_rems = links.diff2(topo.links);
 
             var n_adds = topo.nodes.node_diff(nodes);
             var n_rems = nodes.node_diff(topo.nodes);
-
-            for (var i = 0; i < l_rems.length ; i++) {
-		for (var j = 0; j < links.length; j++) {
-                    if (links[j].source.index == l_rems[i].source.index &&
-			links[j].target.index == l_rems[i].target.index) {
-			links.splice(j,1);
-			changed = true;
-			break;
-                    }
-		}
-            }
-            for (var i = 0; i < l_adds.length; i++) {
-		links.push(l_adds[i]);
+            for (var i = 0; i < n_adds.length; i++) {
+		nodes.push(n_adds[i]);
 		changed = true;
             }
             for (var i = 0; i < n_rems.length; i++) {
@@ -117,25 +133,59 @@
 		    }
 		}
             }
-            for (var i = 0; i < n_adds.length; i++) {
-		nodes.push(n_adds[i]);
+
+            var l_adds = [];
+            var l_rems = [];
+	    l_adds = added_links(topo, links, l_adds);
+            l_rems = gone_links(topo, links, l_rems);
+
+            for (var i = 0; i < l_rems.length ; i++) {
+		for (var j = 0; j < links.length; j++) {
+                    if (links[j].source.name == l_rems[i].source.name &&
+			links[j].target.name == l_rems[i].target.name) {
+			links.splice(j,1);
+			changed = true;
+			break;
+                    }
+		}
+            }
+            for (var i = 0; i < l_adds.length; i++) {
+		var s;
+		var t;
+		for (var j = 0; j < nodes.length; j++) {
+		    if ( json.nodes[l_adds[i].source].name == nodes[j].name ){
+			s = j;
+			break;
+		    }
+		}
+		for (var j = 0; j < nodes.length; j++) {
+		    if ( json.nodes[l_adds[i].target].name == nodes[j].name ){
+			t = j;
+			break;
+		    }
+		}
+		l_adds[i].source = s;
+		l_adds[i].target = t;
+		links.push(l_adds[i]);
 		changed = true;
             }
 	    return changed
 	}
 
- 
 
 	var changed = cdiff(json);
-        for (var i = 0; i < json.nodes.length; i++) {
-	    nodes[i].group = json.nodes[i].group
+        for (var i = 0; i < nodes.length; i++) {
+            for (var j = 0; j < json.nodes.length; j++) {
+		if ( nodes[i].name == json.nodes[j].name ){
+		    nodes[i].group = json.nodes[j].group
+		}
+	    }
 	}
 
-	console.log(circle);
+//	console.log(nodes);
+//	console.log(links);
 
-	console.log("changed?");
-	console.log(changed);
-
+	console.log("changed? " + changed);
 
 	if (changed){
             path = svg.selectAll("path").data(links)
@@ -143,14 +193,13 @@
 	    text = svg.selectAll("text").data(nodes);
 
 	    force.stop();
-
             path.enter().append("svg:path")
 		.attr("class", function(d) { return "link"; })
 		.attr("marker-end", "url(#Triangle)");
 
             circle.enter().append("svg:circle")
-               .attr("r", 6)
-               .call(force.drag);
+		.attr("r", 6)
+                .call(force.drag);
 
 /*	    text.enter().append("svg:text")
 		.attr("x", 8)
@@ -166,10 +215,21 @@
             circle.append("title")
 	      .text(function(d) { return d.name; });
 
+	    circle.attr("fill", function(d) {
+		if (d.group == 1){return "red";}
+		else if (d.group == 2){return "blue";}
+		else if (d.group == 3){return "green";}
+		else{ return "gray"; }
+	    });
+
+
 	    path.exit().remove();
             circle.exit().remove();
             text.exit().remove();
 
+	    console.log(nodes);
+	    console.log(links);
+
 	    force.on("tick", tick);
             force.start();
 	}
@@ -184,8 +244,8 @@
 	    .attr("marker-end", "url(#Triangle)");
 
         circle.enter().append("svg:circle")
-          .attr("r", 8)
-          .call(force.drag);
+            .attr("r", 8)
+            .call(force.drag);
 
 /*	text.enter().append("svg:text")
 	    .attr("x", 8)
@@ -226,6 +286,28 @@
             });
 	}, 3000); 
     }
+
+/*
+    $("#more").click( function() {
+        $.ajax({
+	    url: 'http://onosnat.onlab.us:8080/topology_more',
+	    success: function(json) {
+		update(json)
+	    },
+	    dataType: "json"
+        });
+    });
+    $("#less").click( function() {
+        $.ajax({
+	    url: 'http://onosnat.onlab.us:8080/topology_less',
+	    success: function(json) {
+		update(json)
+	    },
+	    dataType: "json"
+        });
+    });
+*/
+
     function tick() {
 	path.attr("d", function(d) {
 	    var dx = d.target.x - d.source.x,
diff --git a/web/onos-topology-route.html b/web/onos-topology-route.html
new file mode 100644
index 0000000..860a096
--- /dev/null
+++ b/web/onos-topology-route.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+path.link {
+  fill: none;
+}
+circle {
+  stroke: #333;
+  stroke-width: 1.5px;
+}
+
+text {
+  font: 20px sans-serif;
+  pointer-events: none;
+}
+</style>
+<head>
+<title>ONOS GUI</title>
+<script src="http://d3js.org/d3.v3.min.js"></script>
+<script type="text/javascript" src="js/onos-topology-route.js"></script>
+<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
+</head>
+<body>
+<svg width="4in" height="2in" 
+     viewBox="0 0 4000 2000" version="1.1"
+     xmlns="http://www.w3.org/2000/svg">
+  <defs>
+    <marker id="Triangle"
+      viewBox="0 -5 10 10" refX="15" refY="-1.5" 
+      markerUnits="strokeWidth"
+      markerWidth="6" markerHeight="6"
+      orient="auto">
+      <path d="M0,-5L10,0L0,5"/>
+    </marker>
+    <marker id="TriangleRed"
+      viewBox="0 -5 10 10" refX="10" refY="-0.2" 
+      markerUnits="strokeWidth"
+      markerWidth="6" markerHeight="6"
+      orient="auto">
+      <path d="M0,-5L10,0L0,5" fill="red" stroke="red"/>
+    </marker>
+  </defs>
+<script type="text/javascript">
+gui("http://onosnat.onlab.us:8080/wm/topology/toporoute/00:00:00:00:00:a1/2/00:00:00:00:00:c1/3/json");
+</script>
+</svg>
+</body>
+</html>
diff --git a/web/onos-topology.html b/web/onos-topology.html
index 1edbaee..5297871 100644
--- a/web/onos-topology.html
+++ b/web/onos-topology.html
@@ -25,6 +25,8 @@
 <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
 </head>
 <body>
+<button id="more">more</button>
+<button id="less">lesse</button>
 <svg width="4in" height="2in" 
      viewBox="0 0 4000 2000" version="1.1"
      xmlns="http://www.w3.org/2000/svg">
diff --git a/web/topology_rest.py b/web/topology_rest.py
index cdc8a4d..a91bd7c 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -122,9 +122,15 @@
       sw = {}
       sw['name']=dpid
       if str(v['state']) == "ACTIVE":
-         sw['group']=0
-      if str(v['state']) == "INACTIVE":
+        if dpid[-2:-1] == "a":
          sw['group']=1
+        if dpid[-2:-1] == "b":
+         sw['group']=2
+        if dpid[-2:-1] == "c":
+         sw['group']=3
+      if str(v['state']) == "INACTIVE":
+         sw['group']=0
+
 
       switches.append(sw)
   
