Komal Shah | 399a292 | 2014-05-28 01:57:40 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.sdnip.web; |
| 2 | |
| 3 | import net.onrc.onos.apps.sdnip.ISdnIpService; |
| 4 | |
| 5 | import org.restlet.resource.Get; |
| 6 | import org.restlet.resource.ServerResource; |
| 7 | |
| 8 | /** |
| 9 | * REST call to start SDN-IP routing. |
| 10 | */ |
| 11 | public class SdnIpSetup extends ServerResource { |
| 12 | @Get("json") |
| 13 | public String sdnipSetupMethod() { |
| 14 | ISdnIpService sdnIp = (ISdnIpService) getContext() |
| 15 | .getAttributes().get(ISdnIpService.class.getCanonicalName()); |
pingping-lin | aea385b | 2014-09-04 18:15:19 -0700 | [diff] [blame^] | 16 | 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 Shah | 399a292 | 2014-05-28 01:57:40 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | } |