@Test public final void testRemoveLink() { final ConnectPoint d1P1 = new ConnectPoint(DID1, P1); final ConnectPoint d2P2 = new ConnectPoint(DID2, P2); LinkKey linkId1 = LinkKey.linkKey(d1P1, d2P2); LinkKey linkId2 = LinkKey.linkKey(d2P2, d1P1); putLink(linkId1, DIRECT, A1); putLink(linkId2, DIRECT, A2); LinkEvent event = linkStore.removeLink(d1P1, d2P2); assertEquals(LINK_REMOVED, event.type()); assertAnnotationsEquals(event.subject().annotations(), A1); LinkEvent event2 = linkStore.removeLink(d1P1, d2P2); assertNull(event2); assertLink(linkId2, DIRECT, linkStore.getLink(d2P2, d1P1)); assertAnnotationsEquals(linkStore.getLink(d2P2, d1P1).annotations(), A2); putLink(linkId1, DIRECT); assertLink(linkId1, DIRECT, linkStore.getLink(d1P1, d2P2)); assertAnnotationsEquals(linkStore.getLink(d1P1, d2P2).annotations()); }
@Override public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) { final LinkKey linkKey = LinkKey.linkKey(src, dst); ProviderId primaryProviderId = getBaseProviderId(linkKey); if (primaryProviderId == null) { return null; } LinkDescription removedLinkDescription = linkDescriptions.remove(new Provided<>(linkKey, primaryProviderId)); if (removedLinkDescription != null) { return purgeLinkCache(linkKey); } return null; }
ECLinkStore extends AbstractStore<LinkEvent, LinkStoreDelegate> implements LinkStore { @Override public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) { final LinkKey linkKey = LinkKey.linkKey(src, dst); ProviderId primaryProviderId = getBaseProviderId(linkKey); if (primaryProviderId == null) { return null; } LinkDescription removedLinkDescription = linkDescriptions.remove(new Provided<>(linkKey, primaryProviderId)); if (removedLinkDescription != null) { return purgeLinkCache(linkKey); } return null; } }
ECLinkStore extends AbstractStore<LinkEvent, LinkStoreDelegate> implements LinkStore { @Override public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) { final LinkKey linkKey = LinkKey.linkKey(src, dst); ProviderId primaryProviderId = getBaseProviderId(linkKey); if (primaryProviderId == null) { return null; } LinkDescription removedLinkDescription = linkDescriptions.remove(new Provided<>(linkKey, primaryProviderId)); if (removedLinkDescription != null) { return purgeLinkCache(linkKey); } return null; }  }
ECLinkStore extends AbstractStore<LinkEvent, LinkStoreDelegate> implements LinkStore { @Override public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) { final LinkKey linkKey = LinkKey.linkKey(src, dst); ProviderId primaryProviderId = getBaseProviderId(linkKey); if (primaryProviderId == null) { return null; } LinkDescription removedLinkDescription = linkDescriptions.remove(new Provided<>(linkKey, primaryProviderId)); if (removedLinkDescription != null) { return purgeLinkCache(linkKey); } return null; }  @Activate void activate(); @Deactivate void deactivate(); @Override int getLinkCount(); @Override Iterable<Link> getLinks(); @Override Set<Link> getDeviceEgressLinks(DeviceId deviceId); @Override Set<Link> getDeviceIngressLinks(DeviceId deviceId); @Override Link getLink(ConnectPoint src, ConnectPoint dst); @Override Set<Link> getEgressLinks(ConnectPoint src); @Override Set<Link> getIngressLinks(ConnectPoint dst); @Override LinkEvent createOrUpdateLink(ProviderId providerId,
                                        LinkDescription linkDescription); @Override LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst); @Override LinkEvent removeLink(ConnectPoint src, ConnectPoint dst); }
ECLinkStore extends AbstractStore<LinkEvent, LinkStoreDelegate> implements LinkStore { @Override public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) { final LinkKey linkKey = LinkKey.linkKey(src, dst); ProviderId primaryProviderId = getBaseProviderId(linkKey); if (primaryProviderId == null) { return null; } LinkDescription removedLinkDescription = linkDescriptions.remove(new Provided<>(linkKey, primaryProviderId)); if (removedLinkDescription != null) { return purgeLinkCache(linkKey); } return null; }  @Activate void activate(); @Deactivate void deactivate(); @Override int getLinkCount(); @Override Iterable<Link> getLinks(); @Override Set<Link> getDeviceEgressLinks(DeviceId deviceId); @Override Set<Link> getDeviceIngressLinks(DeviceId deviceId); @Override Link getLink(ConnectPoint src, ConnectPoint dst); @Override Set<Link> getEgressLinks(ConnectPoint src); @Override Set<Link> getIngressLinks(ConnectPoint dst); @Override LinkEvent createOrUpdateLink(ProviderId providerId,
                                        LinkDescription linkDescription); @Override LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst); @Override LinkEvent removeLink(ConnectPoint src, ConnectPoint dst);  }