/** * check the node has same id with the specified id * * @param id * a node id * @param node * a node * @return if the node has same id with the specified id then return * true,other wise return false */ public synchronized boolean sameNodeId(String id, Node node) { return id.equals(node.getNodeId().getValue()); }
public NodeBuilder(Node base) { if (base.getKey() == null) { this._key = new NodeKey( base.getNodeId() ); this._nodeId = base.getNodeId(); } else { this._key = base.getKey(); this._nodeId = _key.getNodeId(); } this._nodeType = base.getNodeType(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) 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.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Node> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Node>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
return false; if (!Objects.equals(_nodeId, other.getNodeId())) { return false;
ChannelKey channelKey = new ChannelKey(channelId); SourceBuilder sourceBuilder = new SourceBuilder(); sourceBuilder.setSourceNode(source.getNodeId()); DestinationBuilder destinationBuilder = new DestinationBuilder(); destinationBuilder.setDestNode(destination.getNodeId()); ChannelBuilder channelBuilder = new ChannelBuilder(); channelBuilder.setChannelId(channelId);
@Override public void handle(UscEvent event) { if (topoService == null) { topoService = UscServiceUtils.getService(UscTopologyService.class); if (topoService == null) { LOG.error("Failed to get UscTopologyService!"); return; } } if (event instanceof UscChannelCreateEvent) { UscChannelCreateEvent evt = (UscChannelCreateEvent) event; Node deviceNode = UscTopologyFactory.createNode(evt.getDeviceId(), UscTopologyService.NODE_TYPE_NETWORK_DEVICE); String key = UscTopologyService.NODE_TYPE_CONTROLLER + ":" + topoService.getLocalController().getNodeId().getValue() + "-" + UscTopologyService.NODE_TYPE_NETWORK_DEVICE + ":" + evt.getDeviceId() + '-' + UscTopologyService.Channel_TYPE + ":" + evt.getType(); Channel channel = UscTopologyFactory.createChannel(topoService.getLocalController(), deviceNode, key, evt.getType(), evt.isCallHome()); topoService.addChannel(channel); } else if (event instanceof UscChannelCloseEvent) { UscChannelCloseEvent evt = (UscChannelCloseEvent) event; topoService.removeChannel(evt.getDeviceId(), evt.getType()); } else if (event instanceof UscChannelErrorEvent) { UscChannelErrorEvent evt = (UscChannelErrorEvent) event; ChannelAlarm alarm = UscTopologyFactory.createChannelAlram(evt.getErrorId(), evt.getErrorCode() + "", evt.getMessage()); topoService.addChannelError(evt.getDeviceId(), evt.getType(), alarm); } }