private LinkRemovedImpl(LinkRemovedBuilder base) { this._destination = base.getDestination(); this._source = base.getSource(); 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.opendaylight.flow.topology.discovery.rev130819.LinkRemoved>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public LinkRemovedBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
private LinkRemoved makeRemoveLink(Edge edge){ String headNodeIdStr = null, tailNodeIdStr = null, headNcIdStr = null, tailNcIdStr = null; boolean bool = TopologyServiceUtil.getNodeAndNcIdString(edge, headNodeIdStr, tailNodeIdStr, headNcIdStr, tailNcIdStr); if(bool == false){ logger.debug("ERROR: makeAddLink(): given Edge {}, call TopologyServiceUtil.getNodeAndNcIdString() fail", edge); return null; } NodeId localNodeId = new NodeId(headNodeIdStr); NodeConnectorId localNodeConnectorId = new NodeConnectorId(headNcIdStr); InstanceIdentifier<NodeConnector> localInstanceIdentifier = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(localNodeId)) .child(NodeConnector.class, new NodeConnectorKey(localNodeConnectorId)).toInstance(); NodeConnectorRef localNodeConnectorRef = new NodeConnectorRef(localInstanceIdentifier); NodeId remoteNodeId = new NodeId(tailNodeIdStr); NodeConnectorId remoteNodeConnectorId = new NodeConnectorId(tailNcIdStr); InstanceIdentifier<NodeConnector> remoteInstanceIdentifier = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(remoteNodeId)) .child(NodeConnector.class, new NodeConnectorKey(remoteNodeConnectorId)).toInstance(); NodeConnectorRef remoteNodeConnectorRef = new NodeConnectorRef(remoteInstanceIdentifier); LinkRemovedBuilder ldb = new LinkRemovedBuilder(); ldb.setSource(remoteNodeConnectorRef); ldb.setDestination(localNodeConnectorRef); return((ldb.build())); }
@Override public void run() { for (Entry<LinkDiscovered,Date> entry : linkToDate.entrySet()) { LinkDiscovered link = entry.getKey(); Date expires = entry.getValue(); Date now = new Date(); if(now.after(expires)) { if(getInstance().getManager() != null) { LinkRemovedBuilder lrb = new LinkRemovedBuilder(link); getInstance().getManager().getNotificationService().publish(lrb.build()); linkToDate.remove(link); } } } }