@Override public TopologyLinkUp createNotification(final Link topoLink, final InstanceIdentifier<Link> path) { Preconditions.checkNotNull(topoLink); Preconditions.checkNotNull(path); final LinkBuilder linkBuilder = new LinkBuilder(topoLink); return new TopologyLinkUpImpl(linkBuilder.build(), linkBuilder.getLinkId()); }
@Override public NicNotification updateNotification(final Link topoLink, final InstanceIdentifier<Link> path) { Preconditions.checkNotNull(topoLink); Preconditions.checkNotNull(path); final LinkBuilder linkBuilder = new LinkBuilder(topoLink); return new TopologyLinkUpdatedImpl(linkBuilder.build(), linkBuilder.getLinkId()); }
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); } }
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); }
if (snh == null) { snh = getNode(srcNode); snh.addTp(srcTp, lb.getLinkId(), false); putNode(trans, snh); } else { snh.addTp(srcTp, lb.getLinkId(), false); final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(new NodeKey((NodeId) snh.getNodeId())); trans.put(LogicalDatastoreType.OPERATIONAL, nid.child(TerminationPoint.class, srcTp.getKey()), srcTp); if (dnh == null) { dnh = getNode(dstNode); dnh.addTp(dstTp, lb.getLinkId(), true); putNode(trans, dnh); } else { dnh.addTp(dstTp, lb.getLinkId(), true); final InstanceIdentifier<Node> nid = getInstanceIdentifier().child( org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.class, final InstanceIdentifier<Link> lid = buildLinkIdentifier(lb.getLinkId()); final Link link = lb.build();
public static List<Link> createLinks(NodeId srcNId, TpId srcTpId, NodeId dstNId, TpId dstTpId) { List<Link> links = new ArrayList(); LinkBuilder srcdst = new LinkBuilder()// .setSource(new SourceBuilder()// .setSourceNode(srcNId)// .setSourceTp(srcTpId).build())// .setDestination(new DestinationBuilder()// .setDestNode(dstNId).setDestTp(dstTpId).build())// .setLinkId(new LinkId(srcTpId.getValue() + "/" + dstTpId.getValue())); srcdst.setKey(new LinkKey(srcdst.getLinkId())); LinkBuilder dstsrc = new LinkBuilder()// .setSource(new SourceBuilder()// .setSourceNode(dstNId)// .setSourceTp(dstTpId).build())// .setDestination(new DestinationBuilder()// .setDestNode(srcNId).setDestTp(srcTpId).build())// .setLinkId(new LinkId(dstTpId.getValue() + "/" + srcTpId.getValue())); dstsrc.setKey(new LinkKey(dstsrc.getLinkId())); links.add(dstsrc.build()); links.add(srcdst.build()); return links; }