private LinkDiscoveredImpl(LinkDiscoveredBuilder 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.LinkDiscovered>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered>> 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.LinkDiscovered>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public LinkDiscoveredBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
@Override public void onPacketReceived(PacketReceived lldp) { NodeConnectorRef src = LLDPDiscoveryUtils.lldpToNodeConnectorRef(lldp.getPayload(), true); if(src != null) { LinkDiscoveredBuilder ldb = new LinkDiscoveredBuilder(); ldb.setDestination(lldp.getIngress()); ldb.setSource(new NodeConnectorRef(src)); LinkDiscovered ld = ldb.build(); manager.getNotificationService().publish(ld); LLDPLinkAger.getInstance().put(ld); } }
private LinkDiscovered makeAddLink(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); LinkDiscoveredBuilder ldb = new LinkDiscoveredBuilder(); ldb.setSource(remoteNodeConnectorRef); ldb.setDestination(localNodeConnectorRef); return((ldb.build())); }