use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.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());
}
Aggregations