Search in sources :

Example 51 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.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());
}
Also used : FlowModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput) BigInteger(java.math.BigInteger) FlowModFlagsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlagsV10) ByteBuf(io.netty.buffer.ByteBuf) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Test(org.junit.Test)

Example 52 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.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());
}
Also used : GetQueueConfigInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput) ByteBuf(io.netty.buffer.ByteBuf) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Test(org.junit.Test)

Example 53 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.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());
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PortModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput) ByteBuf(io.netty.buffer.ByteBuf) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Test(org.junit.Test)

Example 54 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.

the class GroupModInputMessageFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("00 02 03 00 00 00 01 00 00 10 00 0a 00 " + "00 00 41 00 00 00 16 00 00 00 00");
    GroupModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV13(deserializedMessage);
    // Test Message
    Assert.assertEquals("Wrong command", GroupModCommand.forValue(2), deserializedMessage.getCommand());
    Assert.assertEquals("Wrong type", GroupType.forValue(3), deserializedMessage.getType());
    Assert.assertEquals("Wrong group id", new GroupId(256L), deserializedMessage.getGroupId());
    BucketsList bucket = deserializedMessage.getBucketsList().get(0);
    Assert.assertEquals("Wrong weight", 10, bucket.getWeight().intValue());
    Assert.assertEquals("Wrong watch port", new PortNumber(65L), bucket.getWatchPort());
    Assert.assertEquals("Wrong watch group", 22L, bucket.getWatchGroup().longValue());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) BucketsList(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) GroupModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId) Test(org.junit.Test)

Example 55 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.

the class FlowModInputMessageFactoryTest method test.

@Test
public void test() throws Exception {
    ByteBuf bb = BufferHelper.buildBuffer("ff 01 04 01 06 00 07 01 ff 05 00 00 09 30 00 30 41 02 00 0c 00 00 00 7e 00 " + "00 00 02 00 00 11 46 00 00 00 62 00 0b 00 00 00 01 00 11 80 00 02 04 00 00 00 2a 80 00 12 01 04 00 " + "00 00 00 00 00 00 00 01 00 08 2b 00 00 00 00 02 00 18 00 00 00 00 ff 01 04 01 06 00 07 01 ff 05 00 00 " + "09 30 00 30 00 04 00 18 00 00 00 00 00 00 00 10 00 00 00 2a 00 34 00 00 00 00 00 00");
    FlowModInput deserializedMessage = BufferHelper.deserialize(flowFactory, bb);
    BufferHelper.checkHeaderV13(deserializedMessage);
    byte[] cookie = new byte[] { (byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01 };
    Assert.assertEquals("Wrong cookie", new BigInteger(1, cookie), deserializedMessage.getCookie());
    byte[] cookieMask = new byte[] { (byte) 0xFF, 0x05, 0x00, 0x00, 0x09, 0x30, 0x00, 0x30 };
    Assert.assertEquals("Wrong cookie mask", new BigInteger(1, cookieMask), deserializedMessage.getCookieMask());
    Assert.assertEquals("Wrong table id", new TableId(65L), deserializedMessage.getTableId());
    Assert.assertEquals("Wrong command", FlowModCommand.forValue(2), deserializedMessage.getCommand());
    Assert.assertEquals("Wrong idle timeout", 12, deserializedMessage.getIdleTimeout().intValue());
    Assert.assertEquals("Wrong hard timeout", 0, deserializedMessage.getHardTimeout().intValue());
    Assert.assertEquals("Wrong priority", 126, 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 out group", 98L, deserializedMessage.getOutGroup().longValue());
    Assert.assertEquals("Wrong flags", new FlowModFlags(true, false, true, false, true), deserializedMessage.getFlags());
    Assert.assertEquals("Wrong match", createMatch(), deserializedMessage.getMatch());
    Assert.assertEquals("Wrong instructions", createInstructions(), deserializedMessage.getInstruction());
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId) FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags) FlowModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput) BigInteger(java.math.BigInteger) ByteBuf(io.netty.buffer.ByteBuf) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Test(org.junit.Test)

Aggregations

PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)98 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)81 Test (org.junit.Test)72 ArrayList (java.util.ArrayList)50 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)33 ByteBuf (io.netty.buffer.ByteBuf)29 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)29 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)26 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)23 BigInteger (java.math.BigInteger)21 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder)19 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)18 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)17 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)17 OutputActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder)17 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)16 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)16 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)14 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)13 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)12