Jonathan Hart | 472062d | 2014-04-03 10:56:48 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.topology.web; |
Jonathan Hart | 4701671 | 2014-02-07 12:41:35 -0800 | [diff] [blame] | 2 | |
Jonathan Hart | a99ec67 | 2014-04-03 11:30:34 -0700 | [diff] [blame] | 3 | import net.floodlightcontroller.restserver.RestletRoutable; |
| 4 | |
Jonathan Hart | 4701671 | 2014-02-07 12:41:35 -0800 | [diff] [blame] | 5 | import org.restlet.Context; |
| 6 | import org.restlet.Restlet; |
| 7 | import org.restlet.routing.Router; |
| 8 | |
Jonathan Hart | 4701671 | 2014-02-07 12:41:35 -0800 | [diff] [blame] | 9 | public class NetworkGraphWebRoutable implements RestletRoutable { |
| 10 | |
| 11 | @Override |
| 12 | public Restlet getRestlet(Context context) { |
| 13 | Router router = new Router(context); |
Yuta HIGUCHI | fe1ffe4 | 2014-03-26 10:31:46 -0700 | [diff] [blame] | 14 | // leaving old path there for compatibility |
| 15 | router.attach("/rc/switches/json", DatastoreSwitchesResource.class); |
| 16 | router.attach("/rc/links/json", DatastoreLinksResource.class); |
| 17 | router.attach("/rc/ports/json", DatastorePortsResource.class); |
| 18 | |
| 19 | // debug API to dump datastore content |
| 20 | router.attach("/ds/switches/json", DatastoreSwitchesResource.class); |
| 21 | router.attach("/ds/links/json", DatastoreLinksResource.class); |
| 22 | router.attach("/ds/ports/json", DatastorePortsResource.class); |
| 23 | |
Jonathan Hart | 891d050 | 2014-02-10 10:04:08 -0800 | [diff] [blame] | 24 | router.attach("/ng/switches/json", NetworkGraphSwitchesResource.class); |
| 25 | router.attach("/ng/links/json", NetworkGraphLinksResource.class); |
Pavlin Radoslavov | 97af90a | 2014-02-25 18:34:02 -0800 | [diff] [blame] | 26 | router.attach("/ng/shortest-path/{src-dpid}/{dst-dpid}/json", NetworkGraphShortestPathResource.class); |
Jonathan Hart | 49bfa4d | 2014-03-26 10:16:40 -0700 | [diff] [blame] | 27 | |
| 28 | // Old URLs for compatibility |
| 29 | router.attach("/topology/switches/json", NetworkGraphSwitchesResource.class); |
| 30 | router.attach("/topology/links/json", NetworkGraphLinksResource.class); |
| 31 | |
Jonathan Hart | 4701671 | 2014-02-07 12:41:35 -0800 | [diff] [blame] | 32 | return router; |
| 33 | } |
| 34 | |
| 35 | @Override |
| 36 | public String basePath() { |
Jonathan Hart | 891d050 | 2014-02-10 10:04:08 -0800 | [diff] [blame] | 37 | return "/wm/onos"; |
Jonathan Hart | 4701671 | 2014-02-07 12:41:35 -0800 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | } |