blob: 5fb9714cdedb0cd79fa59524e63eab89bad1f822 [file] [log] [blame]
Komal Shah399a2922014-05-28 01:57:40 -07001package net.onrc.onos.apps.sdnip.web;
2
3import net.onrc.onos.apps.sdnip.ISdnIpService;
4
5import org.restlet.resource.Get;
6import org.restlet.resource.ServerResource;
7
8/**
9 * REST call to start SDN-IP routing.
10 */
11public class SdnIpSetup extends ServerResource {
12 @Get("json")
13 public String sdnipSetupMethod() {
14 ISdnIpService sdnIp = (ISdnIpService) getContext()
15 .getAttributes().get(ISdnIpService.class.getCanonicalName());
pingping-linaea385b2014-09-04 18:15:19 -070016 String version = (String) getRequestAttributes().get("version");
17 if (version.equals("new")) {
18 sdnIp.beginRoutingWithNewIntent();
19 return "SdnIp SetupBgpPaths Succeeded with New intent";
20 } else if (version.equals("old")) {
21
22 sdnIp.beginRouting();
23 return "SdnIp SetupBgpPaths Succeeded";
24 }
25
26 return "URL is wrong!";
Komal Shah399a2922014-05-28 01:57:40 -070027 }
28
29}