blob: ca1ec00f203674fe82e8949b127013b45632d889 [file] [log] [blame]
Naoki Shiota2a35b442013-11-26 19:17:38 -08001package net.onrc.onos.ofcontroller.flowprogrammer.web;
2
3import net.floodlightcontroller.core.IOFSwitch;
4
5import org.openflow.util.HexString;
6import org.restlet.resource.Get;
7
8/**
9 * FlowProgrammer REST API implementation: Resume sending message to switch.
10 *
11 * GET /wm/fprog/resume/{dpid}/json"
12 */
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() {
21 if (! init()) {
22 return false;
23 }
24
25 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
33 IOFSwitch sw = provider.getSwitches().get(dpid);
34 if (sw == null) {
35 log.error("Invalid dpid");
36 return false;
37 }
38
39 return pusher.resume(sw);
40 }
41}