Moved old REST APIs to point to the new network graph/topology implementation.
Switches URL is now /wm/onos/topology/switches/json (all/active/inactive filter has been dropped).
Change-Id: I6466bd303f2c352f42f6a47d425990fdfd45de63
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/web/NetworkGraphWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/web/NetworkGraphWebRoutable.java
index e245801..af3f1e3 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/web/NetworkGraphWebRoutable.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/web/NetworkGraphWebRoutable.java
@@ -22,7 +22,6 @@
@Override
public String basePath() {
- // TODO Auto-generated method stub
return "/wm/onos";
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/web/OnosTopologyWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/topology/web/OnosTopologyWebRoutable.java
index 90eed9a..987fd69 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/web/OnosTopologyWebRoutable.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/web/OnosTopologyWebRoutable.java
@@ -1,22 +1,22 @@
package net.onrc.onos.ofcontroller.topology.web;
+import net.floodlightcontroller.restserver.RestletRoutable;
+import net.onrc.onos.graph.web.TopoDevicesResource;
+import net.onrc.onos.ofcontroller.networkgraph.web.NetworkGraphLinksResource;
+import net.onrc.onos.ofcontroller.networkgraph.web.NetworkGraphSwitchesResource;
+
import org.restlet.Context;
import org.restlet.Restlet;
import org.restlet.routing.Router;
-import net.floodlightcontroller.restserver.RestletRoutable;
-import net.onrc.onos.graph.web.TopoDevicesResource;
-import net.onrc.onos.ofcontroller.core.web.TopoLinksResource;
-import net.onrc.onos.ofcontroller.core.web.TopoSwitchesResource;
-
public class OnosTopologyWebRoutable implements RestletRoutable {
@Override
public Restlet getRestlet(Context context) {
Router router = new Router(context);
router.attach("/route/{src-dpid}/{src-port}/{dst-dpid}/{dst-port}/json", RouteResource.class);
- router.attach("/switches/{filter}/json", TopoSwitchesResource.class);
- router.attach("/links/json", TopoLinksResource.class);
+ router.attach("/switches/json", NetworkGraphSwitchesResource.class);
+ router.attach("/links/json", NetworkGraphLinksResource.class);
router.attach("/devices/json", TopoDevicesResource.class);
return router;
}
diff --git a/web/get_network_graph.py b/web/get_network_graph.py
index 375e5ff..c4b880d 100755
--- a/web/get_network_graph.py
+++ b/web/get_network_graph.py
@@ -37,8 +37,8 @@
if DEBUG:
print '%s' % (txt)
-# @app.route("/wm/onos/ng/links/json ")
-# @app.route("/wm/onos/ng/switches/json ")
+# @app.route("/wm/onos/topology/links/json ")
+# @app.route("/wm/onos/topology/switches/json ")
# @app.route("/wm/onos/ng/shortest-path/<src-dpid>/<dst-dpid>/json ")
# Sample output:
@@ -47,7 +47,7 @@
def get_network_switches():
try:
- command = "curl -s \"http://%s:%s/wm/onos/ng/switches/json\"" % (ControllerIP, ControllerPort)
+ command = "curl -s \"http://%s:%s/wm/onos/topology/switches/json\"" % (ControllerIP, ControllerPort)
debug("get_network_switches %s" % command)
result = os.popen(command).read()
@@ -68,7 +68,7 @@
def get_network_links():
try:
- command = "curl -s \"http://%s:%s/wm/onos/ng/links/json\"" % (ControllerIP, ControllerPort)
+ command = "curl -s \"http://%s:%s/wm/onos/topology/links/json\"" % (ControllerIP, ControllerPort)
debug("get_network_links %s" % command)
result = os.popen(command).read()
diff --git a/web/ons-demo/js/model.js b/web/ons-demo/js/model.js
index bb1aaea..832cd99 100644
--- a/web/ons-demo/js/model.js
+++ b/web/ons-demo/js/model.js
@@ -62,7 +62,7 @@
var urls = {
links: '/wm/onos/topology/links/json',
- switches: '/wm/onos/topology/switches/all/json',
+ switches: '/wm/onos/topology/switches/json',
flows: '/wm/onos/flows/getsummary/0/0/json?proxy',
activeControllers: '/wm/onos/registry/controllers/json',
controllers: 'data/controllers.json',
@@ -82,7 +82,7 @@
var proxyURLs = {
links: '/wm/onos/topology/links/json?proxy',
- switches: '/wm/onos/topology/switches/all/json?proxy',
+ switches: '/wm/onos/topology/switches/json?proxy',
flows: '/wm/onos/flows/getsummary/0/0/json?proxy',
activeControllers: '/wm/onos/registry/controllers/json?proxy',
controllers: 'data/controllers.json',
diff --git a/web/rest-test.sh b/web/rest-test.sh
index c6c870b..0347f41 100755
--- a/web/rest-test.sh
+++ b/web/rest-test.sh
@@ -2,7 +2,7 @@
rm -f rest.json
touch rest.json
-urls="http://localhost:8080/wm/onos/topology/switches/all/json http://localhost:8080/wm/onos/linkdiscovery/links/json http://localhost:8080/wm/onos/registry/controllers/json http://localhost:8080/wm/onos/registry/switches/json"
+urls="http://localhost:8080/wm/onos/topology/switches/json http://localhost:8080/wm/onos/linkdiscovery/links/json http://localhost:8080/wm/onos/registry/controllers/json http://localhost:8080/wm/onos/registry/switches/json"
for url in $urls; do
echo "---REST CALL---" >> rest.json
diff --git a/web/restapi2.py b/web/restapi2.py
index 050d8a4..a84140b 100755
--- a/web/restapi2.py
+++ b/web/restapi2.py
@@ -57,7 +57,7 @@
ONOS_GUI3_HOST="http://gui3.onlab.us:8080"
ONOS_LOCAL_HOST="http://localhost:8080" ;# for Amazon EC2
-@app.route("/wm/onos/topology/switches/all/json")
+@app.route("/wm/onos/topology/switches/json")
def switches():
if request.args.get('proxy') == None:
host = ONOS_LOCAL_HOST
@@ -65,7 +65,7 @@
host = ONOS_GUI3_HOST
try:
- command = "curl -s %s/wm/onos/topology/switches/all/json" % (host)
+ command = "curl -s %s/wm/onos/topology/switches/json" % (host)
print command
result = os.popen(command).read()
except:
diff --git a/web/topology_rest.py b/web/topology_rest.py
index 0b0ab01..6cb5726 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -273,14 +273,14 @@
return "http://" + host + ":8080"
## Switch ##
-@app.route("/wm/onos/topology/switches/all/json")
+@app.route("/wm/onos/topology/switches/json")
def switches():
if request.args.get('proxy') == None:
host = pick_host()
else:
host = ONOS_GUI3_HOST
- url ="%s/wm/onos/topology/switches/all/json" % (host)
+ url ="%s/wm/onos/topology/switches/json" % (host)
(code, result) = get_json(url)
resp = Response(result, status=code, mimetype='application/json')
@@ -354,7 +354,7 @@
@app.route('/topology', methods=['GET'])
def topology_for_gui():
try:
- url="http://%s:%s/wm/onos/topology/switches/all/json" % (RestIP, RestPort)
+ url="http://%s:%s/wm/onos/topology/switches/json" % (RestIP, RestPort)
(code, result) = get_json(url)
parsedResult = json.loads(result)
except:
@@ -436,7 +436,7 @@
@app.route("/wm/floodlight/topology/toporoute/<v1>/<p1>/<v2>/<p2>/json")
def shortest_path(v1, p1, v2, p2):
try:
- url = "http://%s:%s/wm/onos/topology/switches/all/json" % (RestIP, RestPort)
+ url = "http://%s:%s/wm/onos/topology/switches/json" % (RestIP, RestPort)
(code, result) = get_json(url)
parsedResult = json.loads(result)
except:
@@ -519,7 +519,7 @@
@app.route("/wm/floodlight/core/controller/switches/json")
def query_switch():
try:
- url = "http://%s:%s/wm/onos/topology/switches/all/json" % (RestIP, RestPort)
+ url = "http://%s:%s/wm/onos/topology/switches/json" % (RestIP, RestPort)
(code, result) = get_json(url)
parsedResult = json.loads(result)
except: