Remove /json from topology-related REST URLs

The /json suffix in topology-related REST URLs was removed at
https://gerrit.onos.onlab.us/707
Remove /json suffix in scripts and files that use those REST URLs.

This modification also fixes ONOS-1333

Change-Id: I14b36b2076b9280758585971c0ebfef5588eac03
diff --git a/old-scripts/web/restapi2.py b/old-scripts/web/restapi2.py
index a84140b..b7bc05f 100755
--- a/old-scripts/web/restapi2.py
+++ b/old-scripts/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/json")
+@app.route("/wm/onos/topology/switches")
 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/json" % (host)
+    command = "curl -s %s/wm/onos/topology/switches" % (host)
     print command
     result = os.popen(command).read()
   except:
@@ -75,7 +75,7 @@
   resp = Response(result, status=200, mimetype='application/json')
   return resp
 
-@app.route("/wm/onos/topology/links/json")
+@app.route("/wm/onos/topology/links")
 def links():
   if request.args.get('proxy') == None:
     host = ONOS_LOCAL_HOST
@@ -83,7 +83,7 @@
     host = ONOS_GUI3_HOST
 
   try:
-    command = "curl -s %s/wm/onos/topology/links/json" % (host)
+    command = "curl -s %s/wm/onos/topology/links" % (host)
     print command
     result = os.popen(command).read()
   except:
diff --git a/sample/ONS2014demo/scripts/topology_rest.py b/sample/ONS2014demo/scripts/topology_rest.py
index 9871057..288692c 100755
--- a/sample/ONS2014demo/scripts/topology_rest.py
+++ b/sample/ONS2014demo/scripts/topology_rest.py
@@ -275,28 +275,28 @@
   return "http://" + host + ":8080"
 
 ## Switch ##
-@app.route("/wm/onos/topology/switches/json")
+@app.route("/wm/onos/topology/switches")
 def switches():
   if request.args.get('proxy') == None:
     host = pick_host()
   else:
     host = ONOS_GUI3_HOST
 
-  url ="%s/wm/onos/topology/switches/json" % (host)
+  url ="%s/wm/onos/topology/switches" % (host)
   (code, result) = get_json(url)
 
   resp = Response(result, status=code, mimetype='application/json')
   return resp
 
 ## Link ##
-@app.route("/wm/onos/topology/links/json")
+@app.route("/wm/onos/topology/links")
 def links():
   if request.args.get('proxy') == None:
     host = pick_host()
   else:
     host = ONOS_GUI3_HOST
 
-  url ="%s/wm/onos/topology/links/json" % (host)
+  url ="%s/wm/onos/topology/links" % (host)
   (code, result) = get_json(url)
 
   resp = Response(result, status=code, mimetype='application/json')
@@ -356,7 +356,7 @@
 @app.route('/topology', methods=['GET'])
 def topology_for_gui():
   try:
-    url="http://%s:%s/wm/onos/topology/switches/json" % (RestIP, RestPort)
+    url="http://%s:%s/wm/onos/topology/switches" % (RestIP, RestPort)
     (code, result) = get_json(url)
     parsedResult = json.loads(result)
   except:
@@ -399,7 +399,7 @@
         switches[sw_id]['group'] = controllers.index(ctrl) + 1
 
   try:
-    url = "http://%s:%s/wm/onos/topology/links/json" % (RestIP, RestPort)
+    url = "http://%s:%s/wm/onos/topology/links" % (RestIP, RestPort)
     (code, result) = get_json(url)
     parsedResult = json.loads(result)
   except:
@@ -438,7 +438,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/json" % (RestIP, RestPort)
+    url = "http://%s:%s/wm/onos/topology/switches" % (RestIP, RestPort)
     (code, result) = get_json(url)
     parsedResult = json.loads(result)
   except:
@@ -484,7 +484,7 @@
       path.append( (sdpid, ddpid))
 
   try:
-    url = "http://%s:%s/wm/onos/topology/links/json" % (RestIP, RestPort)
+    url = "http://%s:%s/wm/onos/topology/links" % (RestIP, RestPort)
     (code, result) = get_json(url)
     parsedResult = json.loads(result)
   except:
@@ -521,7 +521,7 @@
 @app.route("/wm/floodlight/core/controller/switches/json")
 def query_switch():
   try:
-    url = "http://%s:%s/wm/onos/topology/switches/json" % (RestIP, RestPort)
+    url = "http://%s:%s/wm/onos/topology/switches" % (RestIP, RestPort)
     (code, result) = get_json(url)
     parsedResult = json.loads(result)
   except:
diff --git a/sample/ONS2014demo/web/js/model.js b/sample/ONS2014demo/web/js/model.js
index 832cd99..2e08370 100644
--- a/sample/ONS2014demo/web/js/model.js
+++ b/sample/ONS2014demo/web/js/model.js
@@ -61,8 +61,8 @@
 }
 
 var urls = {
-	links: '/wm/onos/topology/links/json',
-	switches: '/wm/onos/topology/switches/json',
+	links: '/wm/onos/topology/links',
+	switches: '/wm/onos/topology/switches',
 	flows: '/wm/onos/flows/getsummary/0/0/json?proxy',
 	activeControllers: '/wm/onos/registry/controllers/json',
 	controllers: 'data/controllers.json',
@@ -81,8 +81,8 @@
 }
 
 var proxyURLs = {
-	links: '/wm/onos/topology/links/json?proxy',
-	switches: '/wm/onos/topology/switches/json?proxy',
+	links: '/wm/onos/topology/links?proxy',
+	switches: '/wm/onos/topology/switches?proxy',
 	flows: '/wm/onos/flows/getsummary/0/0/json?proxy',
 	activeControllers: '/wm/onos/registry/controllers/json?proxy',
 	controllers: 'data/controllers.json',
diff --git a/scripts/get_network_graph.py b/scripts/get_network_graph.py
index 4a85192..d7df070 100755
--- a/scripts/get_network_graph.py
+++ b/scripts/get_network_graph.py
@@ -36,8 +36,8 @@
   if DEBUG:
     print '%s' % (txt)
 
-# @app.route("/wm/onos/topology/links/json ")
-# @app.route("/wm/onos/topology/switches/json ")
+# @app.route("/wm/onos/topology/links ")
+# @app.route("/wm/onos/topology/switches ")
 # Sample output:
 
 def print_parsed_result(parsedResult):
@@ -45,7 +45,7 @@
 
 def get_network_switches():
   try:
-    command = "curl -s \"http://%s:%s/wm/onos/topology/switches/json\"" % (ControllerIP, ControllerPort)
+    command = "curl -s \"http://%s:%s/wm/onos/topology/switches\"" % (ControllerIP, ControllerPort)
     debug("get_network_switches %s" % command)
 
     result = os.popen(command).read()
@@ -66,7 +66,7 @@
 
 def get_network_links():
   try:
-    command = "curl -s \"http://%s:%s/wm/onos/topology/links/json\"" % (ControllerIP, ControllerPort)
+    command = "curl -s \"http://%s:%s/wm/onos/topology/links\"" % (ControllerIP, ControllerPort)
     debug("get_network_links %s" % command)
 
     result = os.popen(command).read()
diff --git a/scripts/rest-test.sh b/scripts/rest-test.sh
index 0347f41..8a8aab6 100755
--- a/scripts/rest-test.sh
+++ b/scripts/rest-test.sh
@@ -2,7 +2,7 @@
 rm -f rest.json
 touch rest.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"
+urls="http://localhost:8080/wm/onos/topology/switches 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/simple-topo.html b/web/simple-topo.html
index 053c67c..fd1f27d 100644
--- a/web/simple-topo.html
+++ b/web/simple-topo.html
@@ -53,7 +53,7 @@
 <script type="text/javascript" src="js/ctrl.js"></script>
 <script type="text/javascript">
 controller_status("wm/onos/registry/switches/json"); 
-gui("wm/onos/topology/switches/json","wm/onos/topology/links/json","wm/onos/registry/switches/json"); 
+gui("wm/onos/topology/switches","wm/onos/topology/links","wm/onos/registry/switches/json");
 </script>
 </svg>
 </body>