blob: f1cc8f769cea971b3adc3ad2e5cad0401fb0a208 [file] [log] [blame]
Jonathan Hart23701d12014-04-03 10:45:48 -07001package net.onrc.onos.core.devicemanager;
Jonathan Hartd857ad62013-12-14 18:08:17 -08002
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.Date;
6import java.util.HashMap;
TeruU80ce5062014-03-03 17:16:13 -08007import java.util.HashSet;
Jonathan Hartd857ad62013-12-14 18:08:17 -08008import java.util.List;
9import java.util.Map;
TeruU80ce5062014-03-03 17:16:13 -080010import java.util.Set;
11import java.util.concurrent.ConcurrentHashMap;
TeruUd1c5b652014-03-24 13:58:46 -070012import java.util.concurrent.CopyOnWriteArrayList;
TeruU80ce5062014-03-03 17:16:13 -080013import java.util.concurrent.Executors;
14import java.util.concurrent.ScheduledExecutorService;
15import java.util.concurrent.TimeUnit;
Jonathan Hartd857ad62013-12-14 18:08:17 -080016
17import net.floodlightcontroller.core.FloodlightContext;
18import net.floodlightcontroller.core.IFloodlightProviderService;
19import net.floodlightcontroller.core.IOFMessageListener;
20import net.floodlightcontroller.core.IOFSwitch;
21import net.floodlightcontroller.core.IUpdate;
22import net.floodlightcontroller.core.module.FloodlightModuleContext;
23import net.floodlightcontroller.core.module.FloodlightModuleException;
24import net.floodlightcontroller.core.module.IFloodlightModule;
25import net.floodlightcontroller.core.module.IFloodlightService;
Jonathan Hartd857ad62013-12-14 18:08:17 -080026import net.floodlightcontroller.util.MACAddress;
Jonathan Hart6df90172014-04-03 10:13:11 -070027import net.onrc.onos.core.datagrid.IDatagridService;
28import net.onrc.onos.core.datagrid.IEventChannel;
29import net.onrc.onos.core.datagrid.IEventChannelListener;
Jonathan Hartdeda0ba2014-04-03 11:14:12 -070030import net.onrc.onos.core.packet.ARP;
31import net.onrc.onos.core.packet.DHCP;
32import net.onrc.onos.core.packet.Ethernet;
33import net.onrc.onos.core.packet.IPv4;
34import net.onrc.onos.core.packet.UDP;
Jonathan Harte37e4e22014-05-13 19:12:02 -070035import net.onrc.onos.core.topology.ITopologyService;
36import net.onrc.onos.core.topology.Topology;
Jonathan Hartd857ad62013-12-14 18:08:17 -080037
38import org.openflow.protocol.OFMessage;
39import org.openflow.protocol.OFPacketIn;
40import org.openflow.protocol.OFType;
TeruU80ce5062014-03-03 17:16:13 -080041import org.slf4j.Logger;
42import org.slf4j.LoggerFactory;
Jonathan Hartd857ad62013-12-14 18:08:17 -080043
Pavlin Radoslavov902fe522014-03-31 10:11:31 -070044public class OnosDeviceManager implements IFloodlightModule,
Ray Milkey269ffb92014-04-03 14:43:30 -070045 IOFMessageListener,
46 IOnosDeviceService,
47 IEventChannelListener<Long, OnosDevice> {
TeruU28adcc32014-04-15 17:57:35 -070048
Ray Milkeyec838942014-04-09 11:28:43 -070049 private static final Logger log = LoggerFactory.getLogger(OnosDeviceManager.class);
TeruU28adcc32014-04-15 17:57:35 -070050 private static final long DEVICE_CLEANING_INITIAL_DELAY = 30;
51 private int cleanupSecondConfig = 60 * 60;
52 private int agingMillisecConfig = 60 * 60 * 1000;
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -070053
Ray Milkey269ffb92014-04-03 14:43:30 -070054 private CopyOnWriteArrayList<IOnosDeviceListener> deviceListeners;
55 private IFloodlightProviderService floodlightProvider;
Ray Milkeyec838942014-04-09 11:28:43 -070056 private static final ScheduledExecutorService EXECUTOR_SERVICE = Executors.newSingleThreadScheduledExecutor();
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -070057
Ray Milkey269ffb92014-04-03 14:43:30 -070058 private IDatagridService datagrid;
59 private IEventChannel<Long, OnosDevice> eventChannel;
60 private static final String DEVICE_CHANNEL_NAME = "onos.device";
Patrick Liuab1e6062014-05-05 11:12:13 -070061 private final Map<Long, OnosDevice> mapDevice = new ConcurrentHashMap<Long, OnosDevice>();
Jonathan Harte37e4e22014-05-13 19:12:02 -070062 private ITopologyService topologyService;
63 private Topology topology;
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -070064
TeruU80ce5062014-03-03 17:16:13 -080065 public enum OnosDeviceUpdateType {
66 ADD, DELETE, UPDATE;
67 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -070068
Ray Milkey269ffb92014-04-03 14:43:30 -070069 private class OnosDeviceUpdate implements IUpdate {
Patrick Liuab1e6062014-05-05 11:12:13 -070070 private final OnosDevice device;
71 private final OnosDeviceUpdateType type;
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -070072
Ray Milkey269ffb92014-04-03 14:43:30 -070073 public OnosDeviceUpdate(OnosDevice device, OnosDeviceUpdateType type) {
74 this.device = device;
75 this.type = type;
76 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -070077
Ray Milkey269ffb92014-04-03 14:43:30 -070078 @Override
79 public void dispatch() {
80 if (type == OnosDeviceUpdateType.ADD) {
81 for (IOnosDeviceListener listener : deviceListeners) {
82 listener.onosDeviceAdded(device);
83 }
84 } else if (type == OnosDeviceUpdateType.DELETE) {
85 for (IOnosDeviceListener listener : deviceListeners) {
86 listener.onosDeviceRemoved(device);
87 }
88 }
89 }
90 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -070091
Ray Milkey269ffb92014-04-03 14:43:30 -070092 @Override
93 public String getName() {
94 return "onosdevicemanager";
95 }
Jonathan Hartd857ad62013-12-14 18:08:17 -080096
Ray Milkey269ffb92014-04-03 14:43:30 -070097 @Override
98 public boolean isCallbackOrderingPrereq(OFType type, String name) {
99 // We want link discovery to consume LLDP first otherwise we'll
100 // end up reading bad device info from LLDP packets
101 return type == OFType.PACKET_IN && "linkdiscovery".equals(name);
102 }
Jonathan Hartd857ad62013-12-14 18:08:17 -0800103
Ray Milkey269ffb92014-04-03 14:43:30 -0700104 @Override
105 public boolean isCallbackOrderingPostreq(OFType type, String name) {
106 return type == OFType.PACKET_IN &&
107 ("proxyarpmanager".equals(name) || "onosforwarding".equals(name));
108 }
Jonathan Hartd857ad62013-12-14 18:08:17 -0800109
Ray Milkey269ffb92014-04-03 14:43:30 -0700110 @Override
111 public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
Pavlin Radoslavov0b88a262014-04-10 15:43:27 -0700112 if (msg.getType().equals(OFType.PACKET_IN) &&
Patrick Liuab1e6062014-05-05 11:12:13 -0700113 (msg instanceof OFPacketIn)) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700114 OFPacketIn pi = (OFPacketIn) msg;
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700115
Ray Milkey269ffb92014-04-03 14:43:30 -0700116 Ethernet eth = IFloodlightProviderService.bcStore.
117 get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700118
Ray Milkey269ffb92014-04-03 14:43:30 -0700119 return processPacketIn(sw, pi, eth);
120 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700121
Ray Milkey269ffb92014-04-03 14:43:30 -0700122 return Command.CONTINUE;
123 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700124
TeruU28adcc32014-04-15 17:57:35 -0700125 //This "protected" modifier is for unit test.
126 //The above "receive" method couldn't be tested
127 //because of IFloodlightProviderService static final field.
128 protected Command processPacketIn(IOFSwitch sw, OFPacketIn pi, Ethernet eth) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700129 long dpid = sw.getId();
TeruU80ce5062014-03-03 17:16:13 -0800130 short portId = pi.getInPort();
131 Long mac = eth.getSourceMAC().toLong();
132
Jonathan Hartd857ad62013-12-14 18:08:17 -0800133 OnosDevice srcDevice =
TeruU80ce5062014-03-03 17:16:13 -0800134 getSourceDeviceFromPacket(eth, dpid, portId);
135
Ray Milkey269ffb92014-04-03 14:43:30 -0700136 if (srcDevice == null) {
137 return Command.STOP;
TeruU80ce5062014-03-03 17:16:13 -0800138 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700139
TeruU80ce5062014-03-03 17:16:13 -0800140 //We check if it is the same device in datagrid to suppress the device update
Ray Milkeyb6e0ac82014-04-09 13:21:42 -0700141 OnosDevice exDev = mapDevice.get(mac);
142 if (exDev != null) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700143 if (exDev.equals(srcDevice)) {
144 //There is the same existing device. Update only ActiveSince time.
145 exDev.setLastSeenTimestamp(new Date());
146 if (log.isTraceEnabled()) {
TeruU28adcc32014-04-15 17:57:35 -0700147 log.trace("In the local cache, there is the same device."
148 + "Only update last seen time: dpid {}, port {}, mac {}, ip {}, lastSeenTime {}",
Ray Milkey269ffb92014-04-03 14:43:30 -0700149 dpid, portId, srcDevice.getMacAddress(), srcDevice.getIpv4Address(), srcDevice.getLastSeenTimestamp().getTime());
150 }
151 return Command.CONTINUE;
152 } else if (srcDevice.getIpv4Address() == null &&
153 exDev.getSwitchDPID().equals(srcDevice.getSwitchDPID()) &&
154 exDev.getSwitchPort() == srcDevice.getSwitchPort()) {
155 //Vlan should be handled based on the Onos spec. Until then, don't handle it.
156 //Device attachment point and mac address are the same
157 //but the packet does not have an ip address.
158 exDev.setLastSeenTimestamp(new Date());
159 if (log.isTraceEnabled()) {
TeruU28adcc32014-04-15 17:57:35 -0700160 log.trace("In the local cache, there is the same mac device and got no ip addr packet-in."
161 + "Only update last seen time. dpid {}, port {}, mac {}, ip {} lastSeenTime {}",
Ray Milkey269ffb92014-04-03 14:43:30 -0700162 dpid, portId, srcDevice.getMacAddress(), exDev.getIpv4Address(), srcDevice.getLastSeenTimestamp().getTime());
163 }
164 return Command.CONTINUE;
165 }
166 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700167
TeruU80ce5062014-03-03 17:16:13 -0800168 //If the switch port we try to attach a new device already has a link, then stop adding device
Jonathan Harte37e4e22014-05-13 19:12:02 -0700169 if (topology.getOutgoingLink(dpid, (long) portId) != null) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700170 if (log.isTraceEnabled()) {
TeruU28adcc32014-04-15 17:57:35 -0700171 log.trace("Stop adding OnosDevice {} due to there is a link to: dpid {} port {}",
Ray Milkey269ffb92014-04-03 14:43:30 -0700172 srcDevice.getMacAddress(), dpid, portId);
173 }
174 return Command.CONTINUE;
TeruU80ce5062014-03-03 17:16:13 -0800175 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700176
TeruU80ce5062014-03-03 17:16:13 -0800177 addOnosDevice(mac, srcDevice);
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700178
Ray Milkey269ffb92014-04-03 14:43:30 -0700179 if (log.isTraceEnabled()) {
TeruU28adcc32014-04-15 17:57:35 -0700180 log.trace("Add device info: dpid {}, port {}, mac {}, ip {}, lastSeenTime {}",
Ray Milkey269ffb92014-04-03 14:43:30 -0700181 dpid, portId, srcDevice.getMacAddress(), srcDevice.getIpv4Address(), srcDevice.getLastSeenTimestamp().getTime());
TeruU80ce5062014-03-03 17:16:13 -0800182 }
Jonathan Hartd857ad62013-12-14 18:08:17 -0800183 return Command.CONTINUE;
Ray Milkey269ffb92014-04-03 14:43:30 -0700184 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700185
Ray Milkey269ffb92014-04-03 14:43:30 -0700186 //Thread to delete devices periodically.
187 //Remove all devices from the map first and then finally delete devices from the DB.
188 private class CleanDevice implements Runnable {
189 @Override
190 public void run() {
191 log.debug("called CleanDevice");
192 try {
193 Set<OnosDevice> deleteSet = new HashSet<OnosDevice>();
194 for (OnosDevice dev : mapDevice.values()) {
195 long now = new Date().getTime();
TeruU28adcc32014-04-15 17:57:35 -0700196 if ((now - dev.getLastSeenTimestamp().getTime() > agingMillisecConfig)) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700197 if (log.isTraceEnabled()) {
TeruU28adcc32014-04-15 17:57:35 -0700198 log.debug("Remove device info in the datagrid: dpid {}, port {}, mac {}, ip {}, lastSeenTime {}, diff {}",
Ray Milkey269ffb92014-04-03 14:43:30 -0700199 dev.getSwitchDPID(), dev.getSwitchPort(), dev.getMacAddress(), dev.getIpv4Address(),
200 dev.getLastSeenTimestamp().getTime(), now - dev.getLastSeenTimestamp().getTime());
201 }
202 deleteSet.add(dev);
203 }
204 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700205
Ray Milkey269ffb92014-04-03 14:43:30 -0700206 for (OnosDevice dev : deleteSet) {
207 deleteOnosDevice(dev);
208 }
209 } catch (Exception e) {
210 log.error("Error:", e);
211 }
212 }
213 }
TeruU80ce5062014-03-03 17:16:13 -0800214
Jonathan Hartd857ad62013-12-14 18:08:17 -0800215 /**
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700216 * Get IP address from packet if the packet is either an ARP
Ray Milkeyb41100a2014-04-10 10:42:15 -0700217 * or a DHCP packet.
Ray Milkey269ffb92014-04-03 14:43:30 -0700218 *
Jonathan Hartd857ad62013-12-14 18:08:17 -0800219 * @param eth
220 * @param dlAddr
221 * @return
222 */
223 private int getSrcNwAddr(Ethernet eth, long dlAddr) {
224 if (eth.getPayload() instanceof ARP) {
225 ARP arp = (ARP) eth.getPayload();
226 if ((arp.getProtocolType() == ARP.PROTO_TYPE_IP) &&
227 (Ethernet.toLong(arp.getSenderHardwareAddress()) == dlAddr)) {
228 return IPv4.toIPv4Address(arp.getSenderProtocolAddress());
229 }
230 } else if (eth.getPayload() instanceof IPv4) {
231 IPv4 ipv4 = (IPv4) eth.getPayload();
232 if (ipv4.getPayload() instanceof UDP) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700233 UDP udp = (UDP) ipv4.getPayload();
Jonathan Hartd857ad62013-12-14 18:08:17 -0800234 if (udp.getPayload() instanceof DHCP) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700235 DHCP dhcp = (DHCP) udp.getPayload();
Jonathan Hartd857ad62013-12-14 18:08:17 -0800236 if (dhcp.getOpCode() == DHCP.OPCODE_REPLY) {
237 return ipv4.getSourceAddress();
238 }
239 }
240 }
241 }
242 return 0;
243 }
244
245 /**
246 * Parse an entity from an {@link Ethernet} packet.
Ray Milkey269ffb92014-04-03 14:43:30 -0700247 *
Jonathan Hartd857ad62013-12-14 18:08:17 -0800248 * @param eth the packet to parse
Ray Milkey269ffb92014-04-03 14:43:30 -0700249 * @param sw the switch on which the packet arrived
250 * @param pi the original packetin
Jonathan Hartd857ad62013-12-14 18:08:17 -0800251 * @return the entity from the packet
252 */
Patrick Liuab1e6062014-05-05 11:12:13 -0700253 protected OnosDevice getSourceDeviceFromPacket(Ethernet eth,
254 long swdpid,
255 short port) {
Jonathan Hartd857ad62013-12-14 18:08:17 -0800256 byte[] dlAddrArr = eth.getSourceMACAddress();
257 long dlAddr = Ethernet.toLong(dlAddrArr);
258
Patrick Liuab1e6062014-05-05 11:12:13 -0700259 /*
260 * Ignore broadcast/multicast source
261 */
262 if (eth.isMulticast() || eth.isBroadcast()) {
Jonathan Hartd857ad62013-12-14 18:08:17 -0800263 return null;
Ray Milkeyb29e6262014-04-09 16:02:14 -0700264 }
Jonathan Hartd857ad62013-12-14 18:08:17 -0800265
266 short vlan = eth.getVlanID();
267 int nwSrc = getSrcNwAddr(eth, dlAddr);
268 return new OnosDevice(MACAddress.valueOf(dlAddr),
Ray Milkey269ffb92014-04-03 14:43:30 -0700269 ((vlan >= 0) ? vlan : null),
270 ((nwSrc != 0) ? nwSrc : null),
271 swdpid,
272 port,
273 new Date());
Jonathan Hartd857ad62013-12-14 18:08:17 -0800274 }
275
Ray Milkey269ffb92014-04-03 14:43:30 -0700276 @Override
277 public Collection<Class<? extends IFloodlightService>> getModuleServices() {
278 List<Class<? extends IFloodlightService>> services =
279 new ArrayList<Class<? extends IFloodlightService>>();
280 services.add(IOnosDeviceService.class);
281 return services;
282 }
Jonathan Hartd857ad62013-12-14 18:08:17 -0800283
TeruUd1c5b652014-03-24 13:58:46 -0700284 @Override
Ray Milkey269ffb92014-04-03 14:43:30 -0700285 public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
286 Map<Class<? extends IFloodlightService>, IFloodlightService> impls =
287 new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
288 impls.put(IOnosDeviceService.class, this);
289 return impls;
290 }
291
TeruUd1c5b652014-03-24 13:58:46 -0700292 @Override
Ray Milkey269ffb92014-04-03 14:43:30 -0700293 public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
294 List<Class<? extends IFloodlightService>> dependencies =
295 new ArrayList<Class<? extends IFloodlightService>>();
296 dependencies.add(IFloodlightProviderService.class);
Jonathan Harte37e4e22014-05-13 19:12:02 -0700297 dependencies.add(ITopologyService.class);
Ray Milkey269ffb92014-04-03 14:43:30 -0700298 dependencies.add(IDatagridService.class);
299 return dependencies;
300 }
Yuta HIGUCHIe7eac182014-03-19 19:18:30 -0700301
Ray Milkey269ffb92014-04-03 14:43:30 -0700302 @Override
303 public void init(FloodlightModuleContext context)
304 throws FloodlightModuleException {
305 floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
Ray Milkey269ffb92014-04-03 14:43:30 -0700306 deviceListeners = new CopyOnWriteArrayList<IOnosDeviceListener>();
307 datagrid = context.getServiceImpl(IDatagridService.class);
Jonathan Harte37e4e22014-05-13 19:12:02 -0700308 topologyService = context.getServiceImpl(ITopologyService.class);
309 topology = topologyService.getTopology();
TeruU28adcc32014-04-15 17:57:35 -0700310
311 setOnosDeviceManagerProperty(context);
Ray Milkey269ffb92014-04-03 14:43:30 -0700312 }
TeruU80ce5062014-03-03 17:16:13 -0800313
Ray Milkey269ffb92014-04-03 14:43:30 -0700314 @Override
315 public void startUp(FloodlightModuleContext context) {
316 floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
317 eventChannel = datagrid.addListener(DEVICE_CHANNEL_NAME, this,
318 Long.class,
319 OnosDevice.class);
TeruU28adcc32014-04-15 17:57:35 -0700320 EXECUTOR_SERVICE.scheduleAtFixedRate(new CleanDevice(), DEVICE_CLEANING_INITIAL_DELAY, cleanupSecondConfig, TimeUnit.SECONDS);
Ray Milkey269ffb92014-04-03 14:43:30 -0700321 }
TeruUd1c5b652014-03-24 13:58:46 -0700322
Ray Milkey269ffb92014-04-03 14:43:30 -0700323 @Override
324 public void deleteOnosDevice(OnosDevice dev) {
325 Long mac = dev.getMacAddress().toLong();
326 eventChannel.removeEntry(mac);
327 floodlightProvider.publishUpdate(new OnosDeviceUpdate(dev, OnosDeviceUpdateType.DELETE));
328 }
TeruUd1c5b652014-03-24 13:58:46 -0700329
Ray Milkey269ffb92014-04-03 14:43:30 -0700330 @Override
331 public void deleteOnosDeviceByMac(MACAddress mac) {
Pavlin Radoslavov63607792014-04-09 16:56:28 -0700332 OnosDevice deleteDevice = mapDevice.get(mac.toLong());
Ray Milkey269ffb92014-04-03 14:43:30 -0700333 deleteOnosDevice(deleteDevice);
334 }
335
336 @Override
337 public void addOnosDevice(Long mac, OnosDevice dev) {
338 eventChannel.addEntry(mac, dev);
339 floodlightProvider.publishUpdate(new OnosDeviceUpdate(dev, OnosDeviceUpdateType.ADD));
340 }
341
342 @Override
343 public void entryAdded(OnosDevice dev) {
344 Long mac = dev.getMacAddress().toLong();
345 mapDevice.put(mac, dev);
TeruU28adcc32014-04-15 17:57:35 -0700346 log.debug("Device added into local Cache: device mac {}", mac);
Ray Milkey269ffb92014-04-03 14:43:30 -0700347 }
348
349 @Override
350 public void entryRemoved(OnosDevice dev) {
351 Long mac = dev.getMacAddress().toLong();
352 mapDevice.remove(mac);
TeruU28adcc32014-04-15 17:57:35 -0700353 log.debug("Device removed into local Cache: device mac {}", mac);
Ray Milkey269ffb92014-04-03 14:43:30 -0700354 }
355
356 @Override
357 public void entryUpdated(OnosDevice dev) {
358 Long mac = dev.getMacAddress().toLong();
359 mapDevice.put(mac, dev);
TeruU28adcc32014-04-15 17:57:35 -0700360 log.debug("Device updated into local Cache: device mac {}", mac);
Ray Milkey269ffb92014-04-03 14:43:30 -0700361 }
362
363 @Override
364 public void addOnosDeviceListener(IOnosDeviceListener listener) {
365 deviceListeners.add(listener);
366 }
367
368 @Override
369 public void deleteOnosDeviceListener(IOnosDeviceListener listener) {
370 deviceListeners.remove(listener);
371 }
TeruU28adcc32014-04-15 17:57:35 -0700372
373 private void setOnosDeviceManagerProperty(FloodlightModuleContext context) {
374 Map<String, String> configOptions = context.getConfigParams(this);
375 String cleanupsec = configOptions.get("cleanupsec");
376 String agingmsec = configOptions.get("agingmsec");
377 if (cleanupsec != null) {
378 cleanupSecondConfig = Integer.parseInt(cleanupsec);
379 log.debug("CLEANUP_SECOND is set to {}", cleanupSecondConfig);
380 }
381
382 if (agingmsec != null) {
383 agingMillisecConfig = Integer.parseInt(agingmsec);
384 log.debug("AGEING_MILLSEC is set to {}", agingMillisecConfig);
385 }
386 }
Jonathan Hartd857ad62013-12-14 18:08:17 -0800387}