List of usage examples for io.netty.buffer ByteBuf readUnsignedInt
public abstract long readUnsignedInt();
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory.java
License:Open Source License
@Override public GetQueueConfigOutput bufferToMessage(ByteBuf rawMessage, short version) { GetQueueConfigOutputBuilder builder = new GetQueueConfigOutputBuilder(); builder.setVersion(version);/*from w ww.j a va2 s . c om*/ builder.setXid((rawMessage.readUnsignedInt())); builder.setPort(new PortNumber(rawMessage.readUnsignedInt())); rawMessage.skipBytes(PADDING_IN_QUEUE_GET_CONFIG_REPLY_HEADER); builder.setQueues(createQueuesList(rawMessage)); return builder.build(); }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory.java
License:Open Source License
private static List<Queues> createQueuesList(ByteBuf input) { List<Queues> queuesList = new ArrayList<>(); while (input.readableBytes() > 0) { QueuesBuilder queueBuilder = new QueuesBuilder(); queueBuilder.setQueueId(new QueueId(input.readUnsignedInt())); queueBuilder.setPort(new PortNumber(input.readUnsignedInt())); int length = input.readUnsignedShort(); input.skipBytes(PADDING_IN_PACKET_QUEUE_HEADER); queueBuilder.setQueueProperty(createPropertiesList(input, length - PACKET_QUEUE_LENGTH)); queuesList.add(queueBuilder.build()); }//w w w.j a va 2 s . c om return queuesList; }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory.java
License:Open Source License
private static List<QueueProperty> createPropertiesList(ByteBuf input, int length) { int propertiesLength = length; List<QueueProperty> propertiesList = new ArrayList<>(); while (propertiesLength > 0) { QueuePropertyBuilder propertiesBuilder = new QueuePropertyBuilder(); QueueProperties property = QueueProperties.forValue(input.readUnsignedShort()); propertiesBuilder.setProperty(property); int currentPropertyLength = input.readUnsignedShort(); propertiesLength -= currentPropertyLength; input.skipBytes(PADDING_IN_QUEUE_PROPERTY_HEADER); if (property.equals(QueueProperties.OFPQTMINRATE) || property.equals(QueueProperties.OFPQTMAXRATE)) { RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder(); rateBuilder.setRate(input.readUnsignedShort()); propertiesBuilder.addAugmentation(RateQueueProperty.class, rateBuilder.build()); input.skipBytes(PADDING_IN_RATE_QUEUE_PROPERTY); } else if (property.equals(QueueProperties.OFPQTEXPERIMENTER)) { ExperimenterQueuePropertyBuilder expBuilder = new ExperimenterQueuePropertyBuilder(); expBuilder.setExperimenter(input.readUnsignedInt()); input.skipBytes(PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY); expBuilder.setData(input.readBytes(currentPropertyLength - EncodeConstants.SIZE_OF_INT_IN_BYTES - PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY).array()); propertiesBuilder.addAugmentation(RateQueueProperty.class, expBuilder.build()); }/*from ww w.j a v a 2 s . co m*/ propertiesList.add(propertiesBuilder.build()); } return propertiesList; }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.factories.RoleReplyMessageFactory.java
License:Open Source License
@Override public RoleRequestOutput bufferToMessage(ByteBuf rawMessage, short version) { RoleRequestOutputBuilder builder = new RoleRequestOutputBuilder(); builder.setVersion(version);/*from w w w . j ava 2 s . c om*/ builder.setXid(rawMessage.readUnsignedInt()); builder.setRole(ControllerRole.forValue((int) rawMessage.readUnsignedInt())); rawMessage.skipBytes(PADDING_IN_ROLE_REPLY_HEADER); byte[] generationID = new byte[8]; rawMessage.readBytes(generationID); builder.setGenerationId(new BigInteger(1, generationID)); return builder.build(); }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.factories.SetConfigInputMessageFactory.java
License:Open Source License
@Override public SetConfigInput deserialize(ByteBuf rawMessage) { SetConfigInputBuilder builder = new SetConfigInputBuilder(); builder.setVersion(getVersion());/*from w w w.ja va2 s .c o m*/ builder.setXid(rawMessage.readUnsignedInt()); builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort())); builder.setMissSendLen(rawMessage.readUnsignedShort()); return builder.build(); }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.factories.VendorMessageFactory.java
License:Open Source License
@Override public ExperimenterMessage deserialize(ByteBuf message) { final long xid = message.readUnsignedInt(); final long expId = message.readUnsignedInt(); OFDeserializer<ExperimenterDataOfChoice> deserializer = deserializerRegistry .getDeserializer(ExperimenterDeserializerKeyFactory .createVendorMessageDeserializerKey(EncodeConstants.OF10_VERSION_ID, expId)); final ExperimenterDataOfChoice vendorData = deserializer.deserialize(message); final ExperimenterMessageBuilder messageBld = new ExperimenterMessageBuilder() .setVersion((short) EncodeConstants.OF10_VERSION_ID).setXid(xid) .setExperimenter(new ExperimenterId(expId)).setExperimenterDataOfChoice(vendorData); return messageBld.build(); }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.MeterInstructionDeserializer.java
License:Open Source License
@Override public Instruction deserialize(ByteBuf input) { InstructionBuilder builder = new InstructionBuilder(); input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES); MeterCaseBuilder caseBuilder = new MeterCaseBuilder(); MeterBuilder instructionBuilder = new MeterBuilder(); instructionBuilder.setMeterId(input.readUnsignedInt()); caseBuilder.setMeter(instructionBuilder.build()); builder.setInstructionChoice(caseBuilder.build()); return builder.build(); }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.AbstractOxmPortNumberDeserializer.java
License:Open Source License
@Override public MatchEntries deserialize(ByteBuf input) { MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input); PortNumberMatchEntryBuilder port = new PortNumberMatchEntryBuilder(); port.setPortNumber(new PortNumber(input.readUnsignedInt())); builder.addAugmentation(PortNumberMatchEntry.class, port.build()); return builder.build(); }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.ext.AbstractOxmExperimenterMatchEntryDeserializer.java
License:Open Source License
protected ExperimenterIdCaseBuilder createExperimenterIdCase(MatchEntryBuilder entryBuilder, ByteBuf input) { ExperimenterIdCaseBuilder expCaseBuilder = new ExperimenterIdCaseBuilder(); ExperimenterBuilder expBuilder = new ExperimenterBuilder(); expBuilder.setExperimenter(new ExperimenterId(input.readUnsignedInt())); expCaseBuilder.setExperimenter(expBuilder.build()); return expCaseBuilder; }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPhyPortDeserializer.java
License:Open Source License
private static void addInPhyPortValue(ByteBuf input, MatchEntryBuilder builder) { InPhyPortCaseBuilder caseBuilder = new InPhyPortCaseBuilder(); InPhyPortBuilder inPhyPortBuilder = new InPhyPortBuilder(); inPhyPortBuilder.setPortNumber(new PortNumber(input.readUnsignedInt())); caseBuilder.setInPhyPort(inPhyPortBuilder.build()); builder.setMatchEntryValue(caseBuilder.build()); }