blob: 70818c9cdc624fca754b6734d615c2f830d31748 [file] [log] [blame]
Jonathan Hart0961fe82014-04-03 09:56:25 -07001package net.onrc.onos.apps.proxyarp;
Jonathan Hart5afde492013-10-01 12:30:53 +13002
3import java.util.List;
4
5import org.restlet.resource.Get;
6import org.restlet.resource.ServerResource;
7
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -07008/**
9 * REST resource to view the IP to MAC mappings in the ARP cache.
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070010 */
Jonathan Hart5afde492013-10-01 12:30:53 +130011public class ArpCacheResource extends ServerResource {
12
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070013 /**
14 * Handler for a REST call to retrieve the ARP cache.
Ray Milkey269ffb92014-04-03 14:43:30 -070015 *
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070016 * @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 Hart5afde492013-10-01 12:30:53 +130025
26}