use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OxmTcpSrcSerializerTest method prepareMatchEntry.
private static MatchEntryBuilder prepareMatchEntry(int value) {
MatchEntryBuilder builder = prepareHeader(false);
TcpSrcCaseBuilder casebuilder = new TcpSrcCaseBuilder();
TcpSrcBuilder valueBuilder = new TcpSrcBuilder();
valueBuilder.setPort(new PortNumber(value));
casebuilder.setTcpSrc(valueBuilder.build());
builder.setMatchEntryValue(casebuilder.build());
return builder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OxmUdpDstSerializerTest method prepareMatchEntry.
private static MatchEntryBuilder prepareMatchEntry(int value) {
MatchEntryBuilder builder = prepareHeader(false);
UdpDstCaseBuilder casebuilder = new UdpDstCaseBuilder();
UdpDstBuilder valueBuilder = new UdpDstBuilder();
valueBuilder.setPort(new PortNumber(value));
casebuilder.setUdpDst(valueBuilder.build());
builder.setMatchEntryValue(casebuilder.build());
return builder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class PacketOutInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 01 00 00 00 01 00 00 28 00 00 00 00 00 00 00 11 00 08 00 19 00 00 00 12 00 08 00 00 00 00 00 12 " + "00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 10 " + "11 12 13 14");
PacketOutInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong buffer Id", 256L, deserializedMessage.getBufferId().longValue());
Assert.assertEquals("Wrong In Port", new PortNumber(256L), deserializedMessage.getInPort());
Assert.assertEquals("Wrong Numbers of actions", createAction(), deserializedMessage.getAction());
byte[] data = ByteBufUtils.hexStringToBytes("00 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14");
Assert.assertArrayEquals("Wrong data", data, deserializedMessage.getData());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class GetQueueConfigInputMessageFactoryTest method testGetQueueConfigInputMessage.
/**
* Testing of {@link GetQueueConfigInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testGetQueueConfigInputMessage() throws Exception {
GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setPort(new PortNumber(0x00010203L));
GetQueueConfigInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
getQueueFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, GET_QUEUE_CONFIG_INPUT_MESSAGE_CODE_TYPE, 16);
Assert.assertEquals("Wrong port", 0x00010203, out.readUnsignedInt());
out.skipBytes(PADDING_IN_QUEUE_CONFIG_INPUT_MESSAGE);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class PortConvertor method convert.
@Override
public PortModInput convert(Port source, VersionConvertorData data) {
PortConfig config = maskPortConfigFields(source.getConfiguration());
PortConfigV10 configV10 = maskPortConfigV10Fields(source.getConfiguration());
PortModInputBuilder portModInputBuilder = new PortModInputBuilder();
portModInputBuilder.setAdvertise(getPortFeatures(source.getAdvertisedFeatures()));
portModInputBuilder.setPortNo(new PortNumber(OpenflowPortsUtil.getProtocolPortNumber(OpenflowVersion.get(data.getVersion()), source.getPortNumber())));
portModInputBuilder.setConfig(config);
portModInputBuilder.setMask(MoreObjects.firstNonNull(maskPortConfigFields(source.getMask()), new PortConfig(true, true, true, true)));
portModInputBuilder.setHwAddress(new MacAddress(source.getHardwareAddress()));
portModInputBuilder.setVersion(data.getVersion());
portModInputBuilder.setConfigV10(configV10);
portModInputBuilder.setMaskV10(MoreObjects.firstNonNull(maskPortConfigV10Fields(source.getMask()), new PortConfigV10(true, true, true, true, true, true, true)));
portModInputBuilder.setAdvertiseV10(getPortFeaturesV10(source.getAdvertisedFeatures()));
return portModInputBuilder.build();
}
Aggregations