Search in sources :

Example 41 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project openflowplugin by opendaylight.

the class SetConfigInputMessageFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("00 02 " + "00 0a");
    SetConfigInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    // Test Message
    Assert.assertEquals("Wrong flags ", SwitchConfigFlag.forValue(2), deserializedMessage.getFlags());
    Assert.assertEquals("Wrong Miss Send len ", 10, deserializedMessage.getMissSendLen().intValue());
}
Also used : SetConfigInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput) ByteBuf(io.netty.buffer.ByteBuf) DefaultDeserializerFactoryTest(org.opendaylight.openflowjava.protocol.impl.util.DefaultDeserializerFactoryTest) Test(org.junit.Test)

Example 42 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project openflowplugin by opendaylight.

the class OF10StatsRequestAggregateTest method test.

/**
 * Tests {@link OF10StatsRequestInputFactory} for correct serialization.
 */
@Test
public void test() throws Exception {
    MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    builder.setType(MultipartType.OFPMPAGGREGATE);
    builder.setFlags(new MultipartRequestFlags(false));
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    final MultipartRequestAggregateBuilder aggBuilder = new MultipartRequestAggregateBuilder();
    MatchV10Builder matchBuilder = new MatchV10Builder();
    matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true, true, true, true, true));
    matchBuilder.setNwSrcMask((short) 8);
    matchBuilder.setNwDstMask((short) 16);
    matchBuilder.setInPort(51);
    matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
    matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
    matchBuilder.setDlVlan(52);
    matchBuilder.setDlVlanPcp((short) 53);
    matchBuilder.setDlType(54);
    matchBuilder.setNwTos((short) 55);
    matchBuilder.setNwProto((short) 56);
    matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
    matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
    matchBuilder.setTpSrc(57);
    matchBuilder.setTpDst(58);
    aggBuilder.setMatchV10(matchBuilder.build());
    aggBuilder.setTableId((short) 5);
    aggBuilder.setOutPort(42L);
    caseBuilder.setMultipartRequestAggregate(aggBuilder.build());
    builder.setMultipartRequestBody(caseBuilder.build());
    MultipartRequestInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    statsFactory.serialize(message, out);
    BufferHelper.checkHeaderV10(out, (byte) 16, 56);
    Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());
    Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
    // skip match check
    out.skipBytes(40);
    Assert.assertEquals("Wrong table-id", 5, out.readUnsignedByte());
    out.skipBytes(1);
    Assert.assertEquals("Wrong out port", 42, out.readUnsignedShort());
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) FlowWildcardsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10) MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ByteBuf(io.netty.buffer.ByteBuf) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 43 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project openflowplugin by opendaylight.

the class SetConfigMessageFactoryTest method testSetConfigMessageV10.

/**
 * Testing of {@link SetConfigMessageFactory} for correct translation from POJO.
 */
@Test
public void testSetConfigMessageV10() throws Exception {
    SetConfigInputBuilder builder = new SetConfigInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    SwitchConfigFlag flag = SwitchConfigFlag.OFPCFRAGDROP;
    builder.setFlags(flag);
    builder.setMissSendLen(85);
    SetConfigInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    setConfigFactory.serialize(message, out);
    BufferHelper.checkHeaderV10(out, MESSAGE_TYPE, MESSAGE_LENGTH);
    Assert.assertEquals("Wrong flags", SwitchConfigFlag.OFPCFRAGDROP.getIntValue(), out.readUnsignedShort());
    Assert.assertEquals("Wrong missSendLen", 85, out.readUnsignedShort());
}
Also used : SetConfigInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput) SwitchConfigFlag(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag) SetConfigInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 44 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project openflowplugin by opendaylight.

the class OF10StatsRequestInputDescFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");
    MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV10(deserializedMessage);
    Assert.assertEquals("Wrong type", 0, deserializedMessage.getType().getIntValue());
    Assert.assertEquals("Wrong flags", new MultipartRequestFlags(false), deserializedMessage.getFlags());
    Assert.assertEquals("Wrong body", createMultipartRequestBody(), deserializedMessage.getMultipartRequestBody());
}
Also used : MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 45 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project openflowplugin by opendaylight.

the class OF10StatsRequestInputTableFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("00 03 00 00");
    MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV10(deserializedMessage);
    Assert.assertEquals("Wrong type", 3, deserializedMessage.getType().getIntValue());
    Assert.assertEquals("Wrong flags", new MultipartRequestFlags(false), deserializedMessage.getFlags());
    Assert.assertEquals("Wrong body", createMultipartRequestBody(), deserializedMessage.getMultipartRequestBody());
}
Also used : MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)120 Test (org.junit.Test)106 BitArray (org.opendaylight.protocol.util.BitArray)77 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)61 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)40 ArrayList (java.util.ArrayList)29 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)25 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)23 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)20 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)12 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)12 BigInteger (java.math.BigInteger)11 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)9 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)9 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)8 BundleFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags)8 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)8 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)7 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)7 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.UpdateBuilder)7