public static LinkId getDefaultInstance(String defaultValue) { return new LinkId(defaultValue); }
public String id() { return this.link.getLinkId().getValue(); }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } LinkKey other = (LinkKey) obj; if (_linkId == null) { if (other._linkId != null) { return false; } } else if(!_linkId.equals(other._linkId)) { return false; } return true; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_linkRef == null) ? 0 : _linkRef.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_linkId == null) ? 0 : _linkId.hashCode()); return result; }
public static LinkId getDefaultInstance(String defaultValue) { return new LinkId(defaultValue); }
private void addExistingLinks(Topology topology) { log.info("Topology Null Check: " + (topology == null)); List<Link> linkList = topology.getLink(); log.info("Link List Null Check: " + (linkList == null)); if (topology != null && linkList != null) { for (int i = 0; i < linkList.size(); i++) { Link link = linkList.get(i); log.info("Processing link " + i + ", " + link.getLinkId().getValue()); linkService.addLink(link); } } } @Override
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SupportingLinkKey other = (SupportingLinkKey) obj; if (_linkRef == null) { if (other._linkRef != null) { return false; } } else if(!_linkRef.equals(other._linkRef)) { return false; } return true; }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_linkRef == null) ? 0 : _linkRef.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
private LinkId createGatewayLink(NodeId routerId, TpId gwPort) { return new LinkId(String.format("gateway:%s, router:%s", gwPort.getValue(), routerId)); }
/** * @param changedLink * Link that was updated/deleted * @return Identify which intents were affected */ public List<Intent> getAffectedIntents(Link changedLink) { List<Intent> affectedIntents = new ArrayList<>(); if (changedLink == null) return affectedIntents; for (final Intent key : ProtectedLinks.keySet()) { final List<List<Link>> linkss = ProtectedLinks.get(key); for (List<Link> list : linkss) { for (Link link : list) { if (link.getLinkId().getValue().equals(changedLink.getLinkId().getValue())) { if (!affectedIntents.contains(key)) affectedIntents.add(key); } } } } return affectedIntents; }
/** * @param currentLinks * Current links in topology * @param newLinks * New links in topology * @return Affected links by some change */ public List<Link> identifyChangedLink(List<Link> currentLinks, List<Link> newLinks) { List<Link> linksRemoved = new ArrayList<>(); // Identify if a link is affected in some protected Intent for (final Link link : currentLinks) { int value = 0; for (final Link linkk : newLinks) { if (link.getLinkId().equals(linkk.getLinkId())) { value++; break; } } if (value == 0) { // Topology hasChanged linksRemoved.add(link); } } return linksRemoved; }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_destination == null) ? 0 : _destination.hashCode()); result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_linkId == null) ? 0 : _linkId.hashCode()); result = prime * result + ((_source == null) ? 0 : _source.hashCode()); result = prime * result + ((_supportingLink == null) ? 0 : _supportingLink.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final NodeId node, final String name) { return topology.child(Link.class, new LinkKey(new LinkId(node.getValue() + "/lsp/" + name))); } }
String lidStr = (lid == null) ? null : lid.getValue(); NodeConnectorId peer = plink.getPeer(); String peerStr = (peer == null) ? null : peer.getValue();
return false; } else if(!_linkRef.equals(other.getLinkRef())) { return false;
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_destination == null) ? 0 : _destination.hashCode()); result = prime * result + ((_igpEventType == null) ? 0 : _igpEventType.hashCode()); result = prime * result + ((_igpLinkAttributes == null) ? 0 : _igpLinkAttributes.hashCode()); result = prime * result + ((_l3UnicastIgpTopology == null) ? 0 : _l3UnicastIgpTopology.hashCode()); result = prime * result + ((_linkId == null) ? 0 : _linkId.hashCode()); result = prime * result + ((_source == null) ? 0 : _source.hashCode()); result = prime * result + ((_supportingLink == null) ? 0 : _supportingLink.hashCode()); result = prime * result + ((_topologyRef == null) ? 0 : _topologyRef.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
/** * Create an instance identifier for the inter-switch link in the network * topology. * * @param pid The MD-SAL port identifier that specifies the source port * of the link. * @return An instance identifier for the specified link. */ public static InstanceIdentifier<Link> getLinkPath(String pid) { return getTopologyPathBuilder(). child(Link.class, new LinkKey(new LinkId(pid))). build(); }
@Override public void addLink(Link link) { synchronized (this) { this.linkIdIndexedLinks.put(link.getLinkId().getValue(), link); addLinkToTpIdIndexedLinks(srcTpIdIndexedLinks, link); addLinkToTpIdIndexedLinks(dstTpIdIndexedLinks, link); addLinkToNodeIdIndexedLinks(srcNodeIdIndexedLinks, link); addLinkToNodeIdIndexedLinks(dstNodeIdIndexedLinks, link); log.info("Adding link with source as " + link.getSource().getSourceTp().getValue() + " and link id as " + link.getLinkId().getValue()); } }
return false; } else if(!_linkId.equals(other.getLinkId())) { return false;