Pavlin Radoslavov | 1366905 | 2014-05-13 10:33:39 -0700 | [diff] [blame^] | 1 | package net.onrc.onos.core.intent.runtime.web; |
| 2 | |
| 3 | import net.floodlightcontroller.restserver.RestletRoutable; |
| 4 | |
| 5 | import org.restlet.Context; |
| 6 | import org.restlet.Restlet; |
| 7 | import org.restlet.routing.Router; |
| 8 | |
| 9 | /** |
| 10 | * REST API implementation for the Intents. |
| 11 | */ |
| 12 | public class IntentWebRoutable implements RestletRoutable { |
| 13 | /** |
| 14 | * Creates the Restlet router and bind to the proper resources. |
| 15 | */ |
| 16 | @Override |
| 17 | public Restlet getRestlet(Context context) { |
| 18 | Router router = new Router(context); |
| 19 | // GET all high-level intents |
| 20 | // POST (create) a collection of high-level intents |
| 21 | // DELETE all intents (TODO: delete a collection of high-level intents) |
| 22 | router.attach("/high", IntentHighResource.class); |
| 23 | |
| 24 | // GET a high-level intent object |
| 25 | // PUT (update) a high-level intent object (entire object) (LATER?) |
| 26 | // DELETE a high-level intent object |
| 27 | router.attach("/high/{intent-id}", IntentHighObjectResource.class); |
| 28 | |
| 29 | // GET all low-level intents |
| 30 | router.attach("/low", IntentLowResource.class); |
| 31 | |
| 32 | // GET a low-level intent object |
| 33 | router.attach("/low/{intent-id}", IntentLowObjectResource.class); |
| 34 | |
| 35 | // GET a Shortest Path between two Switch DPIDs |
| 36 | router.attach("/path/switch/{src-dpid}/shortest-path/{dst-dpid}", |
| 37 | ShortestPathResource.class); |
| 38 | |
| 39 | return router; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Sets the base path for the Intents. |
| 44 | */ |
| 45 | @Override |
| 46 | public String basePath() { |
| 47 | return "/wm/onos/intent"; |
| 48 | } |
| 49 | } |