Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.provider.lldp.impl; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 17 | |
Thomas Vachuska | 6f94ded | 2015-02-21 14:02:38 -0800 | [diff] [blame] | 18 | import com.google.common.collect.ImmutableMap; |
| 19 | import com.google.common.collect.ImmutableSet; |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 20 | import com.google.common.collect.Maps; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 21 | import org.apache.felix.scr.annotations.Activate; |
| 22 | import org.apache.felix.scr.annotations.Component; |
| 23 | import org.apache.felix.scr.annotations.Deactivate; |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 24 | import org.apache.felix.scr.annotations.Modified; |
| 25 | import org.apache.felix.scr.annotations.Property; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 26 | import org.apache.felix.scr.annotations.Reference; |
| 27 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
Pavlin Radoslavov | d36a74b | 2015-01-09 11:59:07 -0800 | [diff] [blame] | 28 | import org.onlab.packet.Ethernet; |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 29 | import org.onosproject.cfg.ComponentConfigService; |
Pavlin Radoslavov | d36a74b | 2015-01-09 11:59:07 -0800 | [diff] [blame] | 30 | import org.onosproject.core.ApplicationId; |
| 31 | import org.onosproject.core.CoreService; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 32 | import org.onosproject.mastership.MastershipEvent; |
| 33 | import org.onosproject.mastership.MastershipListener; |
| 34 | import org.onosproject.mastership.MastershipService; |
| 35 | import org.onosproject.net.ConnectPoint; |
| 36 | import org.onosproject.net.Device; |
| 37 | import org.onosproject.net.DeviceId; |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 38 | import org.onosproject.net.LinkKey; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 39 | import org.onosproject.net.Port; |
| 40 | import org.onosproject.net.device.DeviceEvent; |
| 41 | import org.onosproject.net.device.DeviceListener; |
| 42 | import org.onosproject.net.device.DeviceService; |
Pavlin Radoslavov | d36a74b | 2015-01-09 11:59:07 -0800 | [diff] [blame] | 43 | import org.onosproject.net.flow.DefaultTrafficSelector; |
Pavlin Radoslavov | d36a74b | 2015-01-09 11:59:07 -0800 | [diff] [blame] | 44 | import org.onosproject.net.flow.TrafficSelector; |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 45 | import org.onosproject.net.link.DefaultLinkDescription; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 46 | import org.onosproject.net.link.LinkProvider; |
| 47 | import org.onosproject.net.link.LinkProviderRegistry; |
| 48 | import org.onosproject.net.link.LinkProviderService; |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 49 | import org.onosproject.net.link.LinkService; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 50 | import org.onosproject.net.packet.PacketContext; |
Jonathan Hart | 3cfce8e | 2015-01-14 16:43:27 -0800 | [diff] [blame] | 51 | import org.onosproject.net.packet.PacketPriority; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 52 | import org.onosproject.net.packet.PacketProcessor; |
| 53 | import org.onosproject.net.packet.PacketService; |
| 54 | import org.onosproject.net.provider.AbstractProvider; |
| 55 | import org.onosproject.net.provider.ProviderId; |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 56 | import org.osgi.service.component.ComponentContext; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 57 | import org.slf4j.Logger; |
| 58 | |
Thomas Vachuska | 6f94ded | 2015-02-21 14:02:38 -0800 | [diff] [blame] | 59 | import java.io.IOException; |
| 60 | import java.util.Dictionary; |
| 61 | import java.util.EnumSet; |
| 62 | import java.util.Map; |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 63 | import java.util.Properties; |
Thomas Vachuska | 6f94ded | 2015-02-21 14:02:38 -0800 | [diff] [blame] | 64 | import java.util.concurrent.ConcurrentHashMap; |
| 65 | import java.util.concurrent.ScheduledExecutorService; |
| 66 | |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 67 | import static com.google.common.base.Strings.isNullOrEmpty; |
Thomas Vachuska | 6f94ded | 2015-02-21 14:02:38 -0800 | [diff] [blame] | 68 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
| 69 | import static java.util.concurrent.TimeUnit.SECONDS; |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 70 | import static org.onlab.util.Tools.get; |
Thomas Vachuska | 6f94ded | 2015-02-21 14:02:38 -0800 | [diff] [blame] | 71 | import static org.onlab.util.Tools.groupedThreads; |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 72 | import static org.onosproject.net.Link.Type.DIRECT; |
Thomas Vachuska | 6f94ded | 2015-02-21 14:02:38 -0800 | [diff] [blame] | 73 | import static org.slf4j.LoggerFactory.getLogger; |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 74 | |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 75 | /** |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 76 | * Provider which uses LLDP and BDDP packets to detect network infrastructure links. |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 77 | */ |
| 78 | @Component(immediate = true) |
| 79 | public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 80 | |
Thomas Vachuska | fc52fec | 2015-05-18 19:13:56 -0700 | [diff] [blame] | 81 | private static final String PROVIDER_NAME = "org.onosproject.provider.lldp"; |
| 82 | |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 83 | private static final String FORMAT = |
| 84 | "Settings: enabled={}, useBDDP={}, probeRate={}, " + |
| 85 | "staleLinkAge={}, lldpSuppression={}"; |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 86 | |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 87 | private final Logger log = getLogger(getClass()); |
| 88 | |
Pavlin Radoslavov | d36a74b | 2015-01-09 11:59:07 -0800 | [diff] [blame] | 89 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 90 | protected CoreService coreService; |
| 91 | |
| 92 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 93 | protected LinkProviderRegistry providerRegistry; |
| 94 | |
| 95 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 96 | protected DeviceService deviceService; |
| 97 | |
| 98 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 99 | protected LinkService linkService; |
| 100 | |
| 101 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Marc De Leenheer | 8b3e80b | 2015-03-06 14:27:03 -0800 | [diff] [blame] | 102 | protected PacketService packetService; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 103 | |
alshabib | 875d626 | 2014-10-17 16:19:40 -0700 | [diff] [blame] | 104 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 105 | protected MastershipService masterService; |
| 106 | |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 107 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 108 | protected ComponentConfigService cfgService; |
| 109 | |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 110 | private LinkProviderService providerService; |
| 111 | |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 112 | private ScheduledExecutorService executor; |
| 113 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 114 | // TODO: Add sanity checking for the configurable params based on the delays |
| 115 | private static final long DEVICE_SYNC_DELAY = 5; |
| 116 | private static final long LINK_PRUNER_DELAY = 3; |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 117 | |
| 118 | private static final String PROP_ENABLED = "enabled"; |
| 119 | @Property(name = PROP_ENABLED, boolValue = true, |
| 120 | label = "If false, link discovery is disabled") |
| 121 | private boolean enabled = false; |
| 122 | |
| 123 | private static final String PROP_USE_BDDP = "useBDDP"; |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 124 | @Property(name = PROP_USE_BDDP, boolValue = true, |
| 125 | label = "Use BDDP for link discovery") |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 126 | private boolean useBDDP = true; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 127 | |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 128 | private static final String PROP_PROBE_RATE = "probeRate"; |
| 129 | private static final int DEFAULT_PROBE_RATE = 3_000; |
| 130 | @Property(name = PROP_PROBE_RATE, intValue = DEFAULT_PROBE_RATE, |
| 131 | label = "LLDP and BDDP probe rate specified in millis") |
| 132 | private int probeRate = DEFAULT_PROBE_RATE; |
Saurav Das | c313c40 | 2015-02-27 10:09:47 -0800 | [diff] [blame] | 133 | |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 134 | private static final String PROP_STALE_LINK_AGE = "staleLinkAge"; |
| 135 | private static final int DEFAULT_STALE_LINK_AGE = 10_000; |
| 136 | @Property(name = PROP_STALE_LINK_AGE, intValue = DEFAULT_STALE_LINK_AGE, |
| 137 | label = "Number of millis beyond which links will be considered stale") |
| 138 | private int staleLinkAge = DEFAULT_STALE_LINK_AGE; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 139 | |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 140 | // FIXME: convert to use network config subsystem instead |
| 141 | private static final String PROP_LLDP_SUPPRESSION = "lldpSuppression"; |
| 142 | private static final String DEFAULT_LLDP_SUPPRESSION_CONFIG = "../config/lldp_suppression.json"; |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 143 | @Property(name = PROP_LLDP_SUPPRESSION, value = DEFAULT_LLDP_SUPPRESSION_CONFIG, |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 144 | label = "Path to LLDP suppression configuration file") |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 145 | private String lldpSuppression = DEFAULT_LLDP_SUPPRESSION_CONFIG; |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 146 | |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 147 | private final DiscoveryContext context = new InternalDiscoveryContext(); |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 148 | private final InternalRoleListener roleListener = new InternalRoleListener(); |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 149 | private final InternalDeviceListener deviceListener = new InternalDeviceListener(); |
| 150 | private final InternalPacketProcessor packetProcessor = new InternalPacketProcessor(); |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 151 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 152 | // Device link discovery helpers. |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 153 | protected final Map<DeviceId, LinkDiscovery> discoverers = new ConcurrentHashMap<>(); |
| 154 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 155 | // Most recent time a tracked link was seen; links are tracked if their |
| 156 | // destination connection point is mastered by this controller instance. |
| 157 | private final Map<LinkKey, Long> linkTimes = Maps.newConcurrentMap(); |
| 158 | |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 159 | private SuppressionRules rules; |
Pavlin Radoslavov | d36a74b | 2015-01-09 11:59:07 -0800 | [diff] [blame] | 160 | private ApplicationId appId; |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 161 | |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 162 | /** |
| 163 | * Creates an OpenFlow link provider. |
| 164 | */ |
| 165 | public LLDPLinkProvider() { |
Thomas Vachuska | fc52fec | 2015-05-18 19:13:56 -0700 | [diff] [blame] | 166 | super(new ProviderId("lldp", PROVIDER_NAME)); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | @Activate |
Saurav Das | c313c40 | 2015-02-27 10:09:47 -0800 | [diff] [blame] | 170 | public void activate(ComponentContext context) { |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 171 | cfgService.registerProperties(getClass()); |
Thomas Vachuska | fc52fec | 2015-05-18 19:13:56 -0700 | [diff] [blame] | 172 | appId = coreService.registerApplication(PROVIDER_NAME); |
Saurav Das | c313c40 | 2015-02-27 10:09:47 -0800 | [diff] [blame] | 173 | modified(context); |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 174 | log.info("Started"); |
| 175 | } |
| 176 | |
| 177 | @Deactivate |
| 178 | public void deactivate() { |
| 179 | cfgService.unregisterProperties(getClass(), false); |
| 180 | disable(); |
| 181 | log.info("Stopped"); |
| 182 | } |
| 183 | |
| 184 | @Modified |
| 185 | public void modified(ComponentContext context) { |
| 186 | Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties(); |
| 187 | |
| 188 | boolean newEnabled, newUseBddp; |
| 189 | int newProbeRate, newStaleLinkAge; |
| 190 | String newLldpSuppression; |
| 191 | try { |
| 192 | String s = get(properties, PROP_ENABLED); |
| 193 | newEnabled = isNullOrEmpty(s) || Boolean.parseBoolean(s.trim()); |
| 194 | |
| 195 | s = get(properties, PROP_USE_BDDP); |
| 196 | newUseBddp = isNullOrEmpty(s) || Boolean.parseBoolean(s.trim()); |
| 197 | |
| 198 | s = get(properties, PROP_PROBE_RATE); |
| 199 | newProbeRate = isNullOrEmpty(s) ? probeRate : Integer.parseInt(s.trim()); |
| 200 | |
| 201 | s = get(properties, PROP_STALE_LINK_AGE); |
| 202 | newStaleLinkAge = isNullOrEmpty(s) ? staleLinkAge : Integer.parseInt(s.trim()); |
| 203 | |
| 204 | s = get(properties, PROP_LLDP_SUPPRESSION); |
| 205 | newLldpSuppression = isNullOrEmpty(s) ? DEFAULT_LLDP_SUPPRESSION_CONFIG : s; |
| 206 | |
| 207 | } catch (NumberFormatException e) { |
| 208 | log.warn(e.getMessage()); |
| 209 | newEnabled = enabled; |
| 210 | newUseBddp = useBDDP; |
| 211 | newProbeRate = probeRate; |
| 212 | newStaleLinkAge = staleLinkAge; |
| 213 | newLldpSuppression = lldpSuppression; |
Saurav Das | c313c40 | 2015-02-27 10:09:47 -0800 | [diff] [blame] | 214 | } |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 215 | |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 216 | boolean wasEnabled = enabled; |
| 217 | |
| 218 | enabled = newEnabled; |
| 219 | useBDDP = newUseBddp; |
| 220 | probeRate = newProbeRate; |
| 221 | staleLinkAge = newStaleLinkAge; |
| 222 | lldpSuppression = newLldpSuppression; |
| 223 | |
| 224 | if (!wasEnabled && enabled) { |
| 225 | enable(); |
| 226 | } else if (wasEnabled && !enabled) { |
| 227 | disable(); |
| 228 | } |
| 229 | |
| 230 | log.info(FORMAT, enabled, useBDDP, probeRate, staleLinkAge, lldpSuppression); |
| 231 | } |
| 232 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 233 | /** |
| 234 | * Enables link discovery processing. |
| 235 | */ |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 236 | private void enable() { |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 237 | providerService = providerRegistry.register(this); |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 238 | masterService.addListener(roleListener); |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 239 | deviceService.addListener(deviceListener); |
| 240 | packetService.addProcessor(packetProcessor, PacketProcessor.advisor(0)); |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 241 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 242 | loadDevices(); |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 243 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 244 | executor = newSingleThreadScheduledExecutor(groupedThreads("onos/link", "discovery-%d")); |
| 245 | executor.scheduleAtFixedRate(new SyncDeviceInfoTask(), |
| 246 | DEVICE_SYNC_DELAY, DEVICE_SYNC_DELAY, SECONDS); |
| 247 | executor.scheduleAtFixedRate(new LinkPrunerTask(), |
| 248 | LINK_PRUNER_DELAY, LINK_PRUNER_DELAY, SECONDS); |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 249 | |
| 250 | loadSuppressionRules(); |
| 251 | requestIntercepts(); |
| 252 | } |
| 253 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 254 | /** |
| 255 | * Disables link discovery processing. |
| 256 | */ |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 257 | private void disable() { |
| 258 | withdrawIntercepts(); |
| 259 | |
| 260 | providerRegistry.unregister(this); |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 261 | masterService.removeListener(roleListener); |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 262 | deviceService.removeListener(deviceListener); |
| 263 | packetService.removeProcessor(packetProcessor); |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 264 | |
| 265 | if (executor != null) { |
| 266 | executor.shutdownNow(); |
| 267 | } |
| 268 | discoverers.values().forEach(LinkDiscovery::stop); |
| 269 | discoverers.clear(); |
| 270 | |
| 271 | providerService = null; |
| 272 | } |
| 273 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 274 | /** |
| 275 | * Loads available devices and registers their ports to be probed. |
| 276 | */ |
| 277 | private void loadDevices() { |
alshabib | 5dc5a34 | 2014-12-03 14:11:16 -0800 | [diff] [blame] | 278 | for (Device device : deviceService.getAvailableDevices()) { |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 279 | if (rules.isSuppressed(device)) { |
| 280 | log.debug("LinkDiscovery from {} disabled by configuration", device.id()); |
| 281 | continue; |
| 282 | } |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 283 | LinkDiscovery ld = new LinkDiscovery(device, context); |
alshabib | dfc7afb | 2014-10-21 20:13:27 -0700 | [diff] [blame] | 284 | discoverers.put(device.id(), ld); |
Jonathan Hart | 45066bc | 2015-07-28 11:18:34 -0700 | [diff] [blame] | 285 | addPorts(ld, device.id()); |
alshabib | dfc7afb | 2014-10-21 20:13:27 -0700 | [diff] [blame] | 286 | } |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 287 | } |
| 288 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 289 | /** |
| 290 | * Adds ports of the specified device to the specified discovery helper. |
| 291 | */ |
Jonathan Hart | 45066bc | 2015-07-28 11:18:34 -0700 | [diff] [blame] | 292 | private void addPorts(LinkDiscovery discoverer, DeviceId deviceId) { |
| 293 | for (Port p : deviceService.getPorts(deviceId)) { |
| 294 | if (rules.isSuppressed(p)) { |
| 295 | continue; |
| 296 | } |
| 297 | if (!p.number().isLogical()) { |
| 298 | discoverer.addPort(p); |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 303 | |
| 304 | /** |
| 305 | * Loads LLDP suppression rules. |
| 306 | */ |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 307 | private void loadSuppressionRules() { |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 308 | // FIXME: convert to use network configuration |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 309 | SuppressionRulesStore store = new SuppressionRulesStore(lldpSuppression); |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 310 | try { |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 311 | log.info("Reading suppression rules from {}", lldpSuppression); |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 312 | rules = store.read(); |
| 313 | } catch (IOException e) { |
Thomas Vachuska | 6519e6f | 2015-03-11 02:29:31 -0700 | [diff] [blame] | 314 | log.info("Failed to load {}, using built-in rules", lldpSuppression); |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 315 | // default rule to suppress ROADM to maintain compatibility |
| 316 | rules = new SuppressionRules(ImmutableSet.of(), |
| 317 | EnumSet.of(Device.Type.ROADM), |
| 318 | ImmutableMap.of()); |
| 319 | } |
| 320 | |
| 321 | // should refresh discoverers when we need dynamic reconfiguration |
| 322 | } |
| 323 | |
Charles M.C. Chan | e148de8 | 2015-05-06 12:38:21 +0800 | [diff] [blame] | 324 | /** |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 325 | * Requests packet intercepts. |
Charles M.C. Chan | e148de8 | 2015-05-06 12:38:21 +0800 | [diff] [blame] | 326 | */ |
Thomas Vachuska | 27bee09 | 2015-06-23 19:03:10 -0700 | [diff] [blame] | 327 | private void requestIntercepts() { |
| 328 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
| 329 | selector.matchEthType(Ethernet.TYPE_LLDP); |
| 330 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); |
Jonathan Hart | 3cfce8e | 2015-01-14 16:43:27 -0800 | [diff] [blame] | 331 | |
Thomas Vachuska | 27bee09 | 2015-06-23 19:03:10 -0700 | [diff] [blame] | 332 | selector.matchEthType(Ethernet.TYPE_BSN); |
Jonathan Hart | 3cfce8e | 2015-01-14 16:43:27 -0800 | [diff] [blame] | 333 | if (useBDDP) { |
Thomas Vachuska | 27bee09 | 2015-06-23 19:03:10 -0700 | [diff] [blame] | 334 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); |
| 335 | } else { |
| 336 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); |
Pavlin Radoslavov | d36a74b | 2015-01-09 11:59:07 -0800 | [diff] [blame] | 337 | } |
| 338 | } |
| 339 | |
Thomas Vachuska | 27bee09 | 2015-06-23 19:03:10 -0700 | [diff] [blame] | 340 | /** |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 341 | * Withdraws packet intercepts. |
Thomas Vachuska | 27bee09 | 2015-06-23 19:03:10 -0700 | [diff] [blame] | 342 | */ |
| 343 | private void withdrawIntercepts() { |
| 344 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
| 345 | selector.matchEthType(Ethernet.TYPE_LLDP); |
| 346 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); |
| 347 | selector.matchEthType(Ethernet.TYPE_BSN); |
| 348 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); |
| 349 | } |
| 350 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 351 | /** |
| 352 | * Processes device mastership role changes. |
| 353 | */ |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 354 | private class InternalRoleListener implements MastershipListener { |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 355 | @Override |
| 356 | public void event(MastershipEvent event) { |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 357 | if (MastershipEvent.Type.BACKUPS_CHANGED.equals(event.type())) { |
| 358 | // only need new master events |
| 359 | return; |
| 360 | } |
| 361 | |
| 362 | DeviceId deviceId = event.subject(); |
| 363 | Device device = deviceService.getDevice(deviceId); |
| 364 | if (device == null) { |
Thomas Vachuska | 3358af2 | 2015-05-19 18:40:34 -0700 | [diff] [blame] | 365 | log.debug("Device {} doesn't exist, or isn't there yet", deviceId); |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 366 | return; |
| 367 | } |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 368 | if (rules.isSuppressed(device)) { |
| 369 | return; |
| 370 | } |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 371 | discoverers.computeIfAbsent(deviceId, k -> new LinkDiscovery(device, context)); |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 372 | } |
| 373 | |
| 374 | } |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 375 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 376 | /** |
| 377 | * Processes device events. |
| 378 | */ |
| 379 | private class InternalDeviceListener implements DeviceListener { |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 380 | @Override |
| 381 | public void event(DeviceEvent event) { |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 382 | LinkDiscovery ld; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 383 | Device device = event.subject(); |
alshabib | acd9183 | 2014-10-17 14:38:41 -0700 | [diff] [blame] | 384 | Port port = event.port(); |
alshabib | dfc7afb | 2014-10-21 20:13:27 -0700 | [diff] [blame] | 385 | if (device == null) { |
| 386 | log.error("Device is null."); |
| 387 | return; |
| 388 | } |
Yuta HIGUCHI | eb24e9d | 2014-10-26 19:34:20 -0700 | [diff] [blame] | 389 | log.trace("{} {} {}", event.type(), event.subject(), event); |
Yuta HIGUCHI | d19f670 | 2014-10-31 15:23:25 -0700 | [diff] [blame] | 390 | final DeviceId deviceId = device.id(); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 391 | switch (event.type()) { |
| 392 | case DEVICE_ADDED: |
Yuta HIGUCHI | eb24e9d | 2014-10-26 19:34:20 -0700 | [diff] [blame] | 393 | case DEVICE_UPDATED: |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 394 | synchronized (discoverers) { |
| 395 | ld = discoverers.get(deviceId); |
| 396 | if (ld == null) { |
| 397 | if (rules.isSuppressed(device)) { |
| 398 | log.debug("LinkDiscovery from {} disabled by configuration", device.id()); |
| 399 | return; |
| 400 | } |
Thomas Vachuska | 96f3ea7 | 2015-09-08 13:50:12 -0700 | [diff] [blame] | 401 | log.debug("Device added ({}) {}", event.type(), deviceId); |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 402 | discoverers.put(deviceId, new LinkDiscovery(device, context)); |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 403 | } else { |
| 404 | if (ld.isStopped()) { |
Thomas Vachuska | 96f3ea7 | 2015-09-08 13:50:12 -0700 | [diff] [blame] | 405 | log.debug("Device restarted ({}) {}", event.type(), deviceId); |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 406 | ld.start(); |
| 407 | } |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 408 | } |
Yuta HIGUCHI | eb24e9d | 2014-10-26 19:34:20 -0700 | [diff] [blame] | 409 | } |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 410 | break; |
| 411 | case PORT_ADDED: |
| 412 | case PORT_UPDATED: |
Yuta HIGUCHI | f672588 | 2014-10-29 15:25:51 -0700 | [diff] [blame] | 413 | if (port.isEnabled()) { |
Yuta HIGUCHI | d19f670 | 2014-10-31 15:23:25 -0700 | [diff] [blame] | 414 | ld = discoverers.get(deviceId); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 415 | if (ld == null) { |
| 416 | return; |
| 417 | } |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 418 | if (rules.isSuppressed(port)) { |
| 419 | log.debug("LinkDiscovery from {}@{} disabled by configuration", |
| 420 | port.number(), device.id()); |
| 421 | return; |
| 422 | } |
Yuta HIGUCHI | 00b476f | 2014-10-25 21:33:07 -0700 | [diff] [blame] | 423 | if (!port.number().isLogical()) { |
Yuta HIGUCHI | eb24e9d | 2014-10-26 19:34:20 -0700 | [diff] [blame] | 424 | log.debug("Port added {}", port); |
Yuta HIGUCHI | 00b476f | 2014-10-25 21:33:07 -0700 | [diff] [blame] | 425 | ld.addPort(port); |
| 426 | } |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 427 | } else { |
Yuta HIGUCHI | f672588 | 2014-10-29 15:25:51 -0700 | [diff] [blame] | 428 | log.debug("Port down {}", port); |
Thomas Vachuska | 96f3ea7 | 2015-09-08 13:50:12 -0700 | [diff] [blame] | 429 | ConnectPoint point = new ConnectPoint(deviceId, port.number()); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 430 | providerService.linksVanished(point); |
| 431 | } |
| 432 | break; |
| 433 | case PORT_REMOVED: |
Yuta HIGUCHI | eb24e9d | 2014-10-26 19:34:20 -0700 | [diff] [blame] | 434 | log.debug("Port removed {}", port); |
Thomas Vachuska | 96f3ea7 | 2015-09-08 13:50:12 -0700 | [diff] [blame] | 435 | ConnectPoint point = new ConnectPoint(deviceId, port.number()); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 436 | providerService.linksVanished(point); |
alshabib | 4785eec | 2014-12-04 16:45:45 -0800 | [diff] [blame] | 437 | |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 438 | break; |
| 439 | case DEVICE_REMOVED: |
| 440 | case DEVICE_SUSPENDED: |
Yuta HIGUCHI | d19f670 | 2014-10-31 15:23:25 -0700 | [diff] [blame] | 441 | log.debug("Device removed {}", deviceId); |
| 442 | ld = discoverers.get(deviceId); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 443 | if (ld == null) { |
| 444 | return; |
| 445 | } |
| 446 | ld.stop(); |
Yuta HIGUCHI | d19f670 | 2014-10-31 15:23:25 -0700 | [diff] [blame] | 447 | providerService.linksVanished(deviceId); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 448 | break; |
| 449 | case DEVICE_AVAILABILITY_CHANGED: |
Yuta HIGUCHI | d19f670 | 2014-10-31 15:23:25 -0700 | [diff] [blame] | 450 | ld = discoverers.get(deviceId); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 451 | if (ld == null) { |
| 452 | return; |
| 453 | } |
Yuta HIGUCHI | d19f670 | 2014-10-31 15:23:25 -0700 | [diff] [blame] | 454 | if (deviceService.isAvailable(deviceId)) { |
| 455 | log.debug("Device up {}", deviceId); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 456 | ld.start(); |
| 457 | } else { |
Yuta HIGUCHI | d19f670 | 2014-10-31 15:23:25 -0700 | [diff] [blame] | 458 | providerService.linksVanished(deviceId); |
| 459 | log.debug("Device down {}", deviceId); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 460 | ld.stop(); |
| 461 | } |
| 462 | break; |
Jonathan Hart | 9de692c | 2015-04-23 11:45:47 -0700 | [diff] [blame] | 463 | case PORT_STATS_UPDATED: |
| 464 | break; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 465 | default: |
| 466 | log.debug("Unknown event {}", event); |
| 467 | } |
| 468 | } |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 469 | } |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 470 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 471 | /** |
| 472 | * Processes incoming packets. |
| 473 | */ |
| 474 | private class InternalPacketProcessor implements PacketProcessor { |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 475 | @Override |
| 476 | public void process(PacketContext context) { |
alshabib | 4a179dc | 2014-10-17 17:17:01 -0700 | [diff] [blame] | 477 | if (context == null) { |
| 478 | return; |
| 479 | } |
Thomas Vachuska | 96f3ea7 | 2015-09-08 13:50:12 -0700 | [diff] [blame] | 480 | LinkDiscovery ld = discoverers.get(context.inPacket().receivedFrom().deviceId()); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 481 | if (ld == null) { |
| 482 | return; |
| 483 | } |
| 484 | |
| 485 | if (ld.handleLLDP(context)) { |
| 486 | context.block(); |
| 487 | } |
| 488 | } |
| 489 | } |
| 490 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 491 | /** |
| 492 | * Auxiliary task to keep device ports up to date. |
| 493 | */ |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 494 | private final class SyncDeviceInfoTask implements Runnable { |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 495 | @Override |
| 496 | public void run() { |
| 497 | if (Thread.currentThread().isInterrupted()) { |
| 498 | log.info("Interrupted, quitting"); |
| 499 | return; |
| 500 | } |
| 501 | // check what deviceService sees, to see if we are missing anything |
| 502 | try { |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 503 | for (Device dev : deviceService.getDevices()) { |
Yuta HIGUCHI | 4128938 | 2014-12-19 17:47:12 -0800 | [diff] [blame] | 504 | if (rules.isSuppressed(dev)) { |
| 505 | continue; |
| 506 | } |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 507 | DeviceId did = dev.id(); |
| 508 | synchronized (discoverers) { |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 509 | LinkDiscovery ld = discoverers |
| 510 | .computeIfAbsent(did, k -> new LinkDiscovery(dev, context)); |
| 511 | addPorts(ld, did); |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 512 | } |
| 513 | } |
| 514 | } catch (Exception e) { |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 515 | // Catch all exceptions to avoid task being suppressed |
Ayaka Koshibe | ccfa94c | 2014-11-20 11:15:52 -0800 | [diff] [blame] | 516 | log.error("Exception thrown during synchronization process", e); |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 521 | /** |
| 522 | * Auxiliary task for pruning stale links. |
| 523 | */ |
| 524 | private class LinkPrunerTask implements Runnable { |
| 525 | @Override |
| 526 | public void run() { |
| 527 | if (Thread.currentThread().isInterrupted()) { |
| 528 | log.info("Interrupted, quitting"); |
| 529 | return; |
| 530 | } |
| 531 | |
| 532 | try { |
| 533 | // TODO: There is still a slight possibility of mastership |
| 534 | // change occurring right with link going stale. This will |
| 535 | // result in the stale link not being pruned. |
| 536 | Maps.filterEntries(linkTimes, e -> { |
| 537 | if (!masterService.isLocalMaster(e.getKey().dst().deviceId())) { |
| 538 | return true; |
| 539 | } |
| 540 | if (isStale(e.getValue())) { |
| 541 | providerService.linkVanished(new DefaultLinkDescription(e.getKey().src(), |
| 542 | e.getKey().dst(), |
| 543 | DIRECT)); |
| 544 | return true; |
| 545 | } |
| 546 | return false; |
| 547 | }).clear(); |
| 548 | |
| 549 | } catch (Exception e) { |
| 550 | // Catch all exceptions to avoid task being suppressed |
| 551 | log.error("Exception thrown during link pruning process", e); |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | private boolean isStale(long lastSeen) { |
| 556 | return lastSeen < System.currentTimeMillis() - staleLinkAge; |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * Provides processing context for the device link discovery helpers. |
| 562 | */ |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 563 | private class InternalDiscoveryContext implements DiscoveryContext { |
| 564 | @Override |
| 565 | public MastershipService mastershipService() { |
| 566 | return masterService; |
| 567 | } |
| 568 | |
| 569 | @Override |
| 570 | public LinkProviderService providerService() { |
| 571 | return providerService; |
| 572 | } |
| 573 | |
| 574 | @Override |
| 575 | public PacketService packetService() { |
| 576 | return packetService; |
| 577 | } |
| 578 | |
| 579 | @Override |
| 580 | public long probeRate() { |
| 581 | return probeRate; |
| 582 | } |
| 583 | |
| 584 | @Override |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 585 | public boolean useBDDP() { |
| 586 | return useBDDP; |
| 587 | } |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 588 | |
| 589 | @Override |
| 590 | public void touchLink(LinkKey key) { |
| 591 | linkTimes.put(key, System.currentTimeMillis()); |
| 592 | } |
Thomas Vachuska | 05453c9 | 2015-09-09 14:40:49 -0700 | [diff] [blame] | 593 | } |
Thomas Vachuska | e4ebac9 | 2015-09-10 11:39:05 -0700 | [diff] [blame^] | 594 | |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 595 | } |