@Override public NodeUp createNotification(final FlowCapableNode object, final InstanceIdentifier<FlowCapableNode> ii) { Preconditions.checkArgument(object != null); Preconditions.checkArgument(ii != null); final FlowCapableNodeUpdatedBuilder flowNodeNotifBuilder = new FlowCapableNodeUpdatedBuilder(object); FlowCapableNodeUpdated flowCapableNodeUpdated = flowNodeNotifBuilder.build(); //TODO: Create a builder for NodeUp notification NodeUp nodeUpNotif = new NodeUpImpl(flowCapableNodeUpdated.getIpAddress(), IidFactory.getNodeId(ii)); LOG.info("NicNotification created for Node up: IP", nodeUpNotif.getIp()); return nodeUpNotif; }
private FlowCapableNodeUpdatedImpl(FlowCapableNodeUpdatedBuilder base) { this._description = base.getDescription(); this._group = base.getGroup(); this._hardware = base.getHardware(); this._ipAddress = base.getIpAddress(); this._manufacturer = base.getManufacturer(); this._meter = base.getMeter(); this._portNumber = base.getPortNumber(); this._serialNumber = base.getSerialNumber(); this._software = base.getSoftware(); this._staleGroup = base.getStaleGroup(); this._staleMeter = base.getStaleMeter(); this._supportedActions = base.getSupportedActions(); this._supportedInstructions = base.getSupportedInstructions(); this._supportedMatchTypes = base.getSupportedMatchTypes(); this._switchFeatures = base.getSwitchFeatures(); this._table = base.getTable(); this._tableFeatures = base.getTableFeatures(); }
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(); }
@Override public List<DataObject> translate(SwitchConnectionDistinguisher cookie, SessionContext sc, OfHeader msg) { if(msg instanceof MultipartReply && ((MultipartReply) msg).getType() == MultipartType.OFPMPDESC) { LOG.debug("MultipartReplyMessage - MultipartReplyDesc Being translated to NodeUpdated "); MultipartReplyMessage message = (MultipartReplyMessage) msg; List<DataObject> list = new CopyOnWriteArrayList<DataObject>(); BigInteger datapathId = sc.getFeatures().getDatapathId(); NodeUpdatedBuilder builder = InventoryDataServiceUtil.nodeUpdatedBuilderFromDataPathId(datapathId); FlowCapableNodeUpdatedBuilder fnub = new FlowCapableNodeUpdatedBuilder(); MultipartReplyDescCase caseBody = (MultipartReplyDescCase) message.getMultipartReplyBody(); MultipartReplyDesc body = caseBody.getMultipartReplyDesc(); fnub.setHardware(body.getHwDesc()); fnub.setManufacturer(body.getMfrDesc()); fnub.setSerialNumber(body.getSerialNum()); fnub.setDescription(body.getDpDesc()); fnub.setSoftware(body.getSwDesc()); builder.addAugmentation(FlowCapableNodeUpdated.class, fnub.build()); NodeUpdated nodeUpdated = builder.build(); list.add(nodeUpdated); return list; } else { return Collections.emptyList(); } }
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(); }
@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(); }
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()); } }