@Override public NodeUpdated createNotification(final FlowCapableNode o, final InstanceIdentifier<FlowCapableNode> ii) { Preconditions.checkArgument(o != null); Preconditions.checkArgument(ii != null); final FlowCapableNodeUpdatedBuilder flowNodeNotifBuilder = new FlowCapableNodeUpdatedBuilder(o); final NodeUpdatedBuilder notifBuilder = new NodeUpdatedBuilder(); notifBuilder.setId(ii.firstKeyOf(Node.class, NodeKey.class).getId()); notifBuilder.setNodeRef(new NodeRef(getNodeII(ii))); notifBuilder.addAugmentation(FlowCapableNodeUpdated.class, flowNodeNotifBuilder.build()); return notifBuilder.build(); }
public static NodeUpdatedBuilder nodeUpdatedBuilderFromDataPathId(final BigInteger datapathId) { NodeUpdatedBuilder builder = new NodeUpdatedBuilder(); builder.setId(nodeIdFromDatapathId(datapathId)); builder.setNodeRef(nodeRefFromNodeKey(new NodeKey(builder.getId()))); return builder; }
private NodeUpdated nodeAdded(final ModelDrivenSwitch sw, final GetFeaturesOutput features, final NodeRef nodeRef) { NodeUpdatedBuilder builder = new NodeUpdatedBuilder(); builder.setId(sw.getNodeId()); builder.setNodeRef(nodeRef); FlowCapableNodeUpdatedBuilder builder2 = new FlowCapableNodeUpdatedBuilder(); try { builder2.setIpAddress(getIpAddressOf(sw)); builder2.setPortNumber(getPortNumberOf(sw)); } catch (Exception e) { LOG.warn("IP address/Port Number of the node {} cannot be obtained.", sw.getNodeId(), e); } builder2.setSwitchFeatures(swFeaturesUtil.buildSwitchFeatures(features)); builder.addAugmentation(FlowCapableNodeUpdated.class, builder2.build()); return builder.build(); }
public NodeUpdated nodeAdded(ConnectionAdapter connectionAdapter) { NodeUpdatedBuilder builder = new NodeUpdatedBuilder(); BigInteger datapathId = this.connectionRegistry.getDatapathID(connectionAdapter); builder.setId(nodeIdFromDatapathId(datapathId)); InstanceIdentifier<Node> identifier = identifierFromDatapathId(datapathId); builder.setNodeRef(new NodeRef(identifier)); FlowCapableNodeUpdatedBuilder builder2 = new FlowCapableNodeUpdatedBuilder(); try { builder2.setIpAddress(getIpAddressOf(connectionAdapter)); } catch (Exception e) { LOG.warn("IP address of the node cannot be obtained."); } GetFeaturesOutput features = this.connectionRegistry.getFeaturesOutput(connectionAdapter); builder2.setSwitchFeatures(swFeaturesUtil.buildSwitchFeatures(features)); builder.addAugmentation(FlowCapableNodeUpdated.class, builder2.build()); return builder.build(); }
protected void add(InstanceIdentifier<Node> createKeyIdent, Node node) { FlowCapableNode fcn = node.getAugmentation(FlowCapableNode.class); if(fcn != null) { FlowCapableNodeUpdatedBuilder fcbnu = new FlowCapableNodeUpdatedBuilder(fcn); NodeUpdatedBuilder builder = new NodeUpdatedBuilder(); builder.setId(node.getId()); builder.setNodeRef(new NodeRef(createKeyIdent)); builder.setNodeConnector(node.getNodeConnector()); builder.addAugmentation(FlowCapableNodeUpdated.class, fcbnu.build()); adapter.onNodeUpdatedInternal(builder.build()); } }