use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class UdpSrcCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final UdpSrcCaseValueBuilder caseBuilder = new UdpSrcCaseValueBuilder();
final UdpSrcValuesBuilder valuesBuilder = new UdpSrcValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfUdpSrc.class);
matchEntryBuilder.setHasMask(true);
valuesBuilder.setPort(new PortNumber(1));
valuesBuilder.setMask(0xffff);
caseBuilder.setUdpSrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OF10FlowModInputMessageFactoryTest method createAction.
private static List<Action> createAction() {
final List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
SetNwDstCaseBuilder nwDstCaseBuilder = new SetNwDstCaseBuilder();
SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
nwDstBuilder.setIpAddress(new Ipv4Address("2.2.2.2"));
nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());
actionBuilder.setActionChoice(nwDstCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
SetTpSrcCaseBuilder tpSrcCaseBuilder = new SetTpSrcCaseBuilder();
SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
tpSrcBuilder.setPort(new PortNumber(42L));
tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
actionBuilder.setActionChoice(tpSrcCaseBuilder.build());
actions.add(actionBuilder.build());
return actions;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OF10FlowModInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 38 20 ff 00 3a 01 01 01 01 01 01 ff " + "ff ff ff ff ff 00 12 05 00 00 2a 04 07 00 00 08 08 08 08 10 10 10 10 " + "19 fd 19 e9 ff 01 04 01 06 00 07 01 00 00 00 0c 00 10 00 01 00 00 00 02 " + "11 46 00 03 00 07 00 08 02 02 02 02 00 09 00 08 00 2a 00 00 ");
FlowModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV10(deserializedMessage);
Assert.assertEquals("Wrong Match", createMatch(), deserializedMessage.getMatchV10());
byte[] cookie = new byte[] { (byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01 };
Assert.assertEquals("Wrong cookie", new BigInteger(1, cookie), deserializedMessage.getCookie());
Assert.assertEquals("Wrong command", FlowModCommand.forValue(0), deserializedMessage.getCommand());
Assert.assertEquals("Idle Timeout", 12, deserializedMessage.getIdleTimeout().intValue());
Assert.assertEquals("Wrong Hard Timeout", 16, deserializedMessage.getHardTimeout().intValue());
Assert.assertEquals("Wrong priority", 1, deserializedMessage.getPriority().intValue());
Assert.assertEquals("Wrong buffer id", 2L, deserializedMessage.getBufferId().longValue());
Assert.assertEquals("Wrong out port", new PortNumber(4422L), deserializedMessage.getOutPort());
Assert.assertEquals("Wrong flags", new FlowModFlagsV10(true, false, true), deserializedMessage.getFlagsV10());
Assert.assertEquals("Wrong actions", createAction(), deserializedMessage.getAction());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OF10GetQueueConfigInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("19 fd 00 00");
GetQueueConfigInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV10(deserializedMessage);
Assert.assertEquals("Wrong port", new PortNumber(6653L), deserializedMessage.getPort());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OF10PortModInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("19 e9 08 00 27 00 b0 eb " + "00 00 00 15 00 00 00 62 00 00 02 8c 00 00 00 00 ");
PortModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV10(deserializedMessage);
Assert.assertEquals("Wrong port", new PortNumber(6633L), deserializedMessage.getPortNo());
Assert.assertEquals("Wrong hwAddr", new MacAddress("08:00:27:00:b0:eb"), deserializedMessage.getHwAddress());
Assert.assertEquals("Wrong config", new PortConfigV10(true, false, false, true, false, false, true), deserializedMessage.getConfigV10());
Assert.assertEquals("Wrong mask", new PortConfigV10(false, true, true, false, false, true, false), deserializedMessage.getMaskV10());
Assert.assertEquals("Wrong advertise", new PortFeaturesV10(true, true, false, false, false, false, false, true, true, false, false, false), deserializedMessage.getAdvertiseV10());
}
Aggregations