private InstanceIdentifier<Link> linkForLsp(final LinkId linkId) { return this.target.child(Link.class, new LinkKey(linkId)); }
LinkImpl(LinkBuilder base) { if (base.key() != null) { this.key = base.key(); } else { this.key = new LinkKey(base.getLinkId()); } this._linkId = key.getLinkId(); this._destination = base.getDestination(); this._source = base.getSource(); this._supportingLink = base.getSupportingLink(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }
@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; }
/** * Return a MD-SAL inter-switch link ID in the given instance identifier. * * @param path An {@link InstanceIdentifier} instance. * @return A MD-SAL inter-switch link ID if found. * {@code null} if not found. */ public static LinkId getLinkId(InstanceIdentifier<?> path) { LinkKey key = path.firstKeyOf(Link.class); return (key == null) ? null : key.getLinkId(); }
return false; } else if(!_key.equals(other.getKey())) { return false;
private InstanceIdentifier<Link> buildLinkIdentifier(final LinkId id) { return getInstanceIdentifier().child( org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link.class, new LinkKey(id)); }
private LinkImpl(LinkBuilder base) { if (base.getKey() == null) { this._key = new LinkKey( base.getLinkId() ); this._linkId = base.getLinkId(); } else { this._key = base.getKey(); this._linkId = _key.getLinkId(); } this._destination = base.getDestination(); this._source = base.getSource(); this._supportingLink = base.getSupportingLink(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final BaseTunnelInput input) { Preconditions.checkNotNull(input.getLinkId()); return topology.child(Link.class, new LinkKey(input.getLinkId())); } }
public LinkBuilder(Link base) { if (base.getKey() == null) { this._key = new LinkKey( base.getLinkId() ); this._linkId = base.getLinkId(); } else { this._key = base.getKey(); this._linkId = _key.getLinkId(); } this._destination = base.getDestination(); this._source = base.getSource(); this._supportingLink = base.getSupportingLink(); if (base instanceof LinkImpl) { LinkImpl impl = (LinkImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
public static InstanceIdentifier<Link> linkPath(InstanceIdentifier<Topology> topoPath, String linkIdStr) { LinkId linkId = new LinkId(linkIdStr); LinkKey linkKey = new LinkKey(linkId); InstanceIdentifierBuilder<Topology> topoPathBuilder = topoPath.builder(); InstanceIdentifierBuilder<Link> linkPathBuilder = topoPathBuilder.child(Link.class, linkKey); return linkPathBuilder.build(); }
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))); } }
/** * Generates an Instance Identifier by using a Link ID. The Link Id * is appended as a link key. * @param id The LinkId of a given Link. Similiar to a nodeId. * @return An Instance Identifier for a given Link */ public static InstanceIdentifier<Link> getEvcLinkIid(LinkId id) { InstanceIdentifier<Link> linkPath = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID)) .child(Link.class, new LinkKey(id)); return linkPath; }
private Link findGWLink(ReadWriteTransaction trans, FabricId fabricid, TpId tpid, NodeId routerid) { InstanceIdentifier<Link> linkIId = InstanceIdentifier.create(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(fabricid))) .child(Link.class, new LinkKey(this.createGatewayLink(routerid, tpid))); CheckedFuture<Optional<Link>,ReadFailedException> readFuture = trans.read(LogicalDatastoreType.OPERATIONAL, linkIId); try { Optional<Link> optional = readFuture.get(); if (optional.isPresent()) { return optional.get(); } else { return null; } } catch (InterruptedException | ExecutionException e) { LOG.error("", e); } return null; }
/** * 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(); }
public static InstanceIdentifier<Link> createInterFabricLinkIId(LinkId linkid) { return InstanceIdentifier.create(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(Constants.FABRICS_TOPOLOGY_ID))) .child(Link.class, new LinkKey(linkid)); }
public static InstanceIdentifier<Link> createLinkIId(FabricId fabricId, LinkId linkid) { return InstanceIdentifier.create(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(fabricId))) .child(Link.class, new LinkKey(linkid)); }
/** * Read a MD-SAL link which starts from the given port. * * @param sport A {@link SalPort} instance. * @return A {@link Link} instance if found. {@code null} if not found. * @throws VTNException An error occurred. */ private Link readMdLink(SalPort sport) throws VTNException { // The source port ID is used as the MD-SAL link ID. LinkId linkId = new LinkId(sport.toString()); InstanceIdentifier<Link> path = InstanceIdentifier. builder(NetworkTopology.class). child(Topology.class, OF_TOPOLOGY_KEY). child(Link.class, new LinkKey(linkId)). build(); LogicalDatastoreType oper = LogicalDatastoreType.OPERATIONAL; return DataStoreUtils.read(transaction, oper, path).orNull(); }
/** * @param linkId * @return iid of {@link Link} */ public static InstanceIdentifier<Link> linkPath(String linkId) { return InstanceIdentifier .builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(TOPOLOGY_NAME))) .child(Link.class, new LinkKey(new LinkId(linkId))) .build(); }
/** * @param linkId * @return iid of {@link Link} */ public static InstanceIdentifier<Link> linkPath(String linkId) { return InstanceIdentifier .builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(TOPOLOGY_NAME))) .child(Link.class, new LinkKey(new LinkId(linkId))) .build(); } }
private void createLogicLink(FabricId fabricid, NodeId routeId, NodeId swId, WriteTransaction trans, TpId tpid1, TpId tpid2, LinkId lid) { final LinkId linkid = lid == null ? new LinkId(UUID.randomUUID().toString()) : lid; LinkBuilder linkBuilder = new LinkBuilder(); linkBuilder.setLinkId(linkid); linkBuilder.setKey(new LinkKey(linkid)); SourceBuilder srcBuilder = new SourceBuilder(); srcBuilder.setSourceNode(routeId); srcBuilder.setSourceTp(tpid1); linkBuilder.setSource(srcBuilder.build()); DestinationBuilder destBuilder = new DestinationBuilder(); destBuilder.setDestNode(swId); destBuilder.setDestTp(tpid2); linkBuilder.setDestination(destBuilder.build()); InstanceIdentifier<Link> linkIId = MdSalUtils.createLinkIId(fabricid, linkid); trans.put(LogicalDatastoreType.OPERATIONAL,linkIId, linkBuilder.build()); }