Jonathan Hart | 5afde49 | 2013-10-01 12:30:53 +1300 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.proxyarp; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import org.restlet.resource.Get; |
| 6 | import org.restlet.resource.ServerResource; |
| 7 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 8 | /** |
| 9 | * REST resource to view the IP to MAC mappings in the ARP cache. |
| 10 | * |
| 11 | */ |
Jonathan Hart | 5afde49 | 2013-10-01 12:30:53 +1300 | [diff] [blame] | 12 | public class ArpCacheResource extends ServerResource { |
| 13 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 14 | /** |
| 15 | * Handler for a REST call to retrieve the ARP cache. |
| 16 | * @return list of mappings formatted as a human-readable string. |
| 17 | */ |
| 18 | @Get("json") |
| 19 | public List<String> getArpCache() { |
| 20 | IProxyArpService arp = (IProxyArpService) getContext().getAttributes() |
| 21 | .get(IProxyArpService.class.getCanonicalName()); |
| 22 | |
| 23 | return arp.getMappings(); |
| 24 | } |
Jonathan Hart | 5afde49 | 2013-10-01 12:30:53 +1300 | [diff] [blame] | 25 | |
| 26 | } |