blob: c59fc0d093cf93bd67daf61db2e51df60640eab5 [file] [log] [blame]
Jonathan Hart23701d12014-04-03 10:45:48 -07001package net.onrc.onos.core.flowprogrammer.web;
Naoki Shiota2a35b442013-11-26 19:17:38 -08002
Jonathan Hart5302b6c2014-08-13 15:57:59 -07003import net.onrc.onos.core.util.Dpid;
Naoki Shiota2a35b442013-11-26 19:17:38 -08004
Jonathan Hartc78b8f62014-08-07 22:31:09 -07005import org.projectfloodlight.openflow.util.HexString;
Naoki Shiota2a35b442013-11-26 19:17:38 -08006import org.restlet.resource.Get;
7
8/**
9 * FlowProgrammer REST API implementation: Resume sending message to switch.
Ray Milkey8e5170e2014-04-02 12:09:55 -070010 * <p/>
11 * GET /wm/fprog/pusher/resume/{dpid}/json"
Naoki Shiota2a35b442013-11-26 19:17:38 -080012 */
13public class ResumePusherResource extends PusherResource {
14 /**
15 * Implement the API.
16 *
17 * @return true if succeeded, false if failed.
18 */
19 @Get("json")
20 public boolean retrieve() {
Ray Milkey8e5170e2014-04-02 12:09:55 -070021 if (!init()) {
22 return false;
23 }
Naoki Shiota2a35b442013-11-26 19:17:38 -080024
Ray Milkey8e5170e2014-04-02 12:09:55 -070025 long dpid;
26 try {
27 dpid = HexString.toLong((String) getRequestAttributes().get("dpid"));
28 } catch (NumberFormatException e) {
29 log.error("Invalid number format");
30 return false;
31 }
32
Jonathan Hart5302b6c2014-08-13 15:57:59 -070033 return pusher.resume(new Dpid(dpid));
Naoki Shiota2a35b442013-11-26 19:17:38 -080034 }
35}