@Test public void testDeleteLink() throws Exception { LinkDiscoveryManager linkDiscovery = getLinkDiscoveryManager(); Link lt = new Link(1L, 2, 2L, 1); LinkInfo info = new LinkInfo(System.currentTimeMillis(), System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); linkDiscovery.deleteLinks(Collections.singletonList(lt), "Test"); assertNull(linkDiscovery.switchLinks.get(lt.getSrc())); assertNull(linkDiscovery.switchLinks.get(lt.getDst())); assertNull(linkDiscovery.portLinks.get(lt.getSrc())); assertNull(linkDiscovery.portLinks.get(lt.getDst())); assertTrue(linkDiscovery.links.isEmpty()); }
protected void deleteLink(Link link, String reason) { if (link == null) return; List<Link> linkList = new ArrayList<Link>(); linkList.add(link); deleteLinks(linkList, reason); }
LinkDiscoveryManager implements IOFMessageListener,
    IOFSwitchListener, IStorageSourceListener, ILinkDiscoveryService,
    IFloodlightModule, IInfoProvider { protected void deleteLink(Link link, String reason) { if (link == null) return; List<Link> linkList = new ArrayList<Link>(); linkList.add(link); deleteLinks(linkList, reason); } }
LinkDiscoveryManager implements IOFMessageListener,
    IOFSwitchListener, IStorageSourceListener, ILinkDiscoveryService,
    IFloodlightModule, IInfoProvider { protected void deleteLink(Link link, String reason) { if (link == null) return; List<Link> linkList = new ArrayList<Link>(); linkList.add(link); deleteLinks(linkList, reason); }  }
LinkDiscoveryManager implements IOFMessageListener,
    IOFSwitchListener, IStorageSourceListener, ILinkDiscoveryService,
    IFloodlightModule, IInfoProvider { protected void deleteLink(Link link, String reason) { if (link == null) return; List<Link> linkList = new ArrayList<Link>(); linkList.add(link); deleteLinks(linkList, reason); }  @Override OFPacketOut generateLLDPMessage(long sw, short port,
                                       boolean isStandard, boolean isReverse); int getLldpFrequency(); int getLldpTimeout(); @Override Map<NodePortTuple, Set<Link>> getPortLinks(); @Override Set<NodePortTuple> getSuppressLLDPsInfo(); @Override void AddToSuppressLLDPs(long sw, short port); @Override void RemoveFromSuppressLLDPs(long sw, short port); boolean isShuttingDown(); @Override boolean isTunnelPort(long sw, short port); @Override ILinkDiscovery.LinkType getLinkType(Link lt, LinkInfo info); @Override Set<Short> getQuarantinedPorts(long sw); @Override Map<Long, Set<Link>> getSwitchLinks(); @Override void addMACToIgnoreList(long mac, int ignoreBits); @Override boolean isAutoPortFastFeature(); @Override void setAutoPortFastFeature(boolean autoPortFastFeature); @Override void addListener(ILinkDiscoveryListener listener); @Override Map<Link, LinkInfo> getLinks(); @Override LinkInfo getLinkInfo(Link link); @Override String getName(); @Override Command receive(IOFSwitch sw, OFMessage msg,
                           FloodlightContext cntx); @Override boolean isCallbackOrderingPrereq(OFType type, String name); @Override boolean isCallbackOrderingPostreq(OFType type, String name); @Override void switchPortChanged(long switchId,
            ImmutablePort port,
            IOFSwitch.PortChangeType type); @Override void switchAdded(long switchId); @Override void switchRemoved(long sw); @Override void switchActivated(long switchId); @Override void switchChanged(long switchId); void setStorageSource(IStorageSourceService storageSource); IStorageSourceService getStorageSource(); @Override void rowsModified(String tableName, Set<Object> rowKeys); @Override void rowsDeleted(String tableName, Set<Object> rowKeys); Long readLinkValidTime(Link lt); @Override Collection<Class<? extends IFloodlightService>> getModuleServices(); @Override Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls(); @Override Collection<Class<? extends IFloodlightService>> getModuleDependencies(); @Override void init(FloodlightModuleContext context); @Override @LogMessageDocs({ @LogMessageDoc(level = "ERROR", message = "No storage source found.", explanation = "Storage source was not initialized; cannot initialize " + "link discovery.", recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG), @LogMessageDoc(level = "ERROR", message = "Error in installing listener for " + "switch config table {table}", explanation = "Failed to install storage notification for the " + "switch config table", recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG), @LogMessageDoc(level = "ERROR", message = "No storage source found.", explanation = "Storage source was not initialized; cannot initialize " + "link discovery.", recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG), @LogMessageDoc(level = "ERROR", message = "Exception in LLDP send timer.", explanation = "An unknown error occured while sending LLDP " + "messages to switches.", recommendation = LogMessageDoc.CHECK_SWITCH) }) void startUp(FloodlightModuleContext context); @Override Map<String, Object> getInfo(String type); }
LinkDiscoveryManager implements IOFMessageListener,
    IOFSwitchListener, IStorageSourceListener, ILinkDiscoveryService,
    IFloodlightModule, IInfoProvider { protected void deleteLink(Link link, String reason) { if (link == null) return; List<Link> linkList = new ArrayList<Link>(); linkList.add(link); deleteLinks(linkList, reason); }  @Override OFPacketOut generateLLDPMessage(long sw, short port,
                                       boolean isStandard, boolean isReverse); int getLldpFrequency(); int getLldpTimeout(); @Override Map<NodePortTuple, Set<Link>> getPortLinks(); @Override Set<NodePortTuple> getSuppressLLDPsInfo(); @Override void AddToSuppressLLDPs(long sw, short port); @Override void RemoveFromSuppressLLDPs(long sw, short port); boolean isShuttingDown(); @Override boolean isTunnelPort(long sw, short port); @Override ILinkDiscovery.LinkType getLinkType(Link lt, LinkInfo info); @Override Set<Short> getQuarantinedPorts(long sw); @Override Map<Long, Set<Link>> getSwitchLinks(); @Override void addMACToIgnoreList(long mac, int ignoreBits); @Override boolean isAutoPortFastFeature(); @Override void setAutoPortFastFeature(boolean autoPortFastFeature); @Override void addListener(ILinkDiscoveryListener listener); @Override Map<Link, LinkInfo> getLinks(); @Override LinkInfo getLinkInfo(Link link); @Override String getName(); @Override Command receive(IOFSwitch sw, OFMessage msg,
                           FloodlightContext cntx); @Override boolean isCallbackOrderingPrereq(OFType type, String name); @Override boolean isCallbackOrderingPostreq(OFType type, String name); @Override void switchPortChanged(long switchId,
            ImmutablePort port,
            IOFSwitch.PortChangeType type); @Override void switchAdded(long switchId); @Override void switchRemoved(long sw); @Override void switchActivated(long switchId); @Override void switchChanged(long switchId); void setStorageSource(IStorageSourceService storageSource); IStorageSourceService getStorageSource(); @Override void rowsModified(String tableName, Set<Object> rowKeys); @Override void rowsDeleted(String tableName, Set<Object> rowKeys); Long readLinkValidTime(Link lt); @Override Collection<Class<? extends IFloodlightService>> getModuleServices(); @Override Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls(); @Override Collection<Class<? extends IFloodlightService>> getModuleDependencies(); @Override void init(FloodlightModuleContext context); @Override @LogMessageDocs({ @LogMessageDoc(level = "ERROR", message = "No storage source found.", explanation = "Storage source was not initialized; cannot initialize " + "link discovery.", recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG), @LogMessageDoc(level = "ERROR", message = "Error in installing listener for " + "switch config table {table}", explanation = "Failed to install storage notification for the " + "switch config table", recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG), @LogMessageDoc(level = "ERROR", message = "No storage source found.", explanation = "Storage source was not initialized; cannot initialize " + "link discovery.", recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG), @LogMessageDoc(level = "ERROR", message = "Exception in LLDP send timer.", explanation = "An unknown error occured while sending LLDP " + "messages to switches.", recommendation = LogMessageDoc.CHECK_SWITCH) }) void startUp(FloodlightModuleContext context); @Override Map<String, Object> getInfo(String type); static final String MODULE_NAME; }