blob: 242543cc65735e7a2eb3f1bef1ea614de1442f54 [file] [log] [blame]
Jonathan Hart5afde492013-10-01 12:30:53 +13001package net.onrc.onos.ofcontroller.proxyarp;
2
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.
10 *
11 */
Jonathan Hart5afde492013-10-01 12:30:53 +130012public class ArpCacheResource extends ServerResource {
13
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070014 /**
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 Hart5afde492013-10-01 12:30:53 +130025
26}