Search in sources :

Example 6 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 BundleControlFactoryTest method testDeserializeWithoutProperties.

@Test
public void testDeserializeWithoutProperties() {
    ByteBuf buffer = ByteBufUtils.hexStringToByteBuf(// bundle ID
    "00 00 00 01 " + // type
    "00 01 " + // flags
    "00 03");
    BundleControlOnf builtByFactory = factory.deserialize(buffer);
    Assert.assertEquals(1, builtByFactory.getOnfControlGroupingData().getBundleId().getValue().intValue());
    BundleFlags flags = new BundleFlags(true, true);
    Assert.assertEquals("Wrong atomic flag", flags.isAtomic(), builtByFactory.getOnfControlGroupingData().getFlags().isAtomic());
    Assert.assertEquals("Wrong ordered flag", flags.isOrdered(), builtByFactory.getOnfControlGroupingData().getFlags().isOrdered());
    Assert.assertEquals("Wrong type", BundleControlType.ONFBCTOPENREPLY, builtByFactory.getOnfControlGroupingData().getType());
    Assert.assertTrue("Properties not empty", builtByFactory.getOnfControlGroupingData().getBundleProperty().isEmpty());
}
Also used : BundleControlOnf(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.BundleControlOnf) ByteBuf(io.netty.buffer.ByteBuf) BundleFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags) Test(org.junit.Test)

Example 7 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 FlowConvertorTest method test.

/**
 * Tests {@link FlowConvertor#convert(Flow, VersionDatapathIdConvertorData)} }.
 */
@Test
public void test() {
    RemoveFlowInputBuilder flowBuilder = new RemoveFlowInputBuilder();
    flowBuilder.setBarrier(false);
    flowBuilder.setCookie(new FlowCookie(new BigInteger("4")));
    flowBuilder.setCookieMask(new FlowCookie(new BigInteger("5")));
    flowBuilder.setTableId((short) 6);
    flowBuilder.setStrict(true);
    flowBuilder.setIdleTimeout(50);
    flowBuilder.setHardTimeout(500);
    flowBuilder.setPriority(40);
    flowBuilder.setBufferId(18L);
    flowBuilder.setOutPort(new BigInteger("65535"));
    flowBuilder.setOutGroup(5000L);
    flowBuilder.setFlags(null);
    flowBuilder.setMatch(null);
    RemoveFlowInput flow = flowBuilder.build();
    VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
    data.setDatapathId(new BigInteger("42"));
    List<FlowModInputBuilder> flowMod = convert(flow, data);
    Assert.assertEquals("Wrong version", 4, flowMod.get(0).getVersion().intValue());
    Assert.assertEquals("Wrong cookie", 4, flowMod.get(0).getCookie().intValue());
    Assert.assertEquals("Wrong cookie mask", 5, flowMod.get(0).getCookieMask().intValue());
    Assert.assertEquals("Wrong table id", 6, flowMod.get(0).getTableId().getValue().intValue());
    Assert.assertEquals("Wrong command", FlowModCommand.OFPFCDELETESTRICT, flowMod.get(0).getCommand());
    Assert.assertEquals("Wrong idle timeout", 50, flowMod.get(0).getIdleTimeout().intValue());
    Assert.assertEquals("Wrong hard timeout", 500, flowMod.get(0).getHardTimeout().intValue());
    Assert.assertEquals("Wrong priority", 40, flowMod.get(0).getPriority().intValue());
    Assert.assertEquals("Wrong buffer id", 18, flowMod.get(0).getBufferId().intValue());
    Assert.assertEquals("Wrong out port", 65535, flowMod.get(0).getOutPort().getValue().intValue());
    Assert.assertEquals("Wrong out group", 5000, flowMod.get(0).getOutGroup().intValue());
    Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowMod.get(0).getFlags());
    Assert.assertEquals("Wrong match", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmMatchType", flowMod.get(0).getMatch().getType().getName());
    Assert.assertEquals("Wrong match entries size", 0, flowMod.get(0).getMatch().getMatchEntry().size());
}
Also used : FlowCookie(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie) VersionDatapathIdConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData) FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags) RemoveFlowInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput) RemoveFlowInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder) BigInteger(java.math.BigInteger) FlowModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder) Test(org.junit.Test)

Example 8 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 FlowCreatorUtil method equalsFlowModFlags.

/**
 * Return {@code true} only if given two FLOW_MOD flags are identical.
 *
 * @param flags1 A value to be compared.
 * @param flags2 A value to be compared.
 * @return {@code true} only if {@code flags1} and {@code flags2} are identical.
 */
public static boolean equalsFlowModFlags(FlowModFlags flags1, FlowModFlags flags2) {
    FlowModFlags f1;
    FlowModFlags f2;
    if (flags1 == null) {
        if (flags2 == null) {
            return true;
        }
        f1 = DEFAULT_FLOW_MOD_FLAGS;
        f2 = flags2;
    } else {
        f1 = flags1;
        f2 = (flags2 == null) ? DEFAULT_FLOW_MOD_FLAGS : flags2;
    }
    return equalsWithDefault(f1.isCHECKOVERLAP(), f2.isCHECKOVERLAP(), Boolean.FALSE) && equalsWithDefault(f1.isNOBYTCOUNTS(), f2.isNOBYTCOUNTS(), Boolean.FALSE) && equalsWithDefault(f1.isNOPKTCOUNTS(), f2.isNOPKTCOUNTS(), Boolean.FALSE) && equalsWithDefault(f1.isRESETCOUNTS(), f2.isRESETCOUNTS(), Boolean.FALSE) && equalsWithDefault(f1.isSENDFLOWREM(), f2.isSENDFLOWREM(), Boolean.FALSE);
}
Also used : FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags)

Example 9 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 MultipartReplyMessageFactoryTest method testMultipartReplyMeterConfigBodyMulti.

/**
 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
 */
@Test
public void testMultipartReplyMeterConfigBodyMulti() {
    ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 " + // len
    "00 28 " + // flags
    "00 06 " + // meterId
    "00 00 00 09 " + // meterBandDrop.type
    "00 01 " + // meterBandDrop.len
    "00 10 " + // meterBandDrop.rate
    "00 00 00 11 " + // meterBandDrop.burstSize
    "00 00 00 20 " + // meterBandDrop.pad
    "00 00 00 00 " + // meterBandDscp.type
    "00 02 " + // meterBandDscp.len
    "00 10 " + // meterBandDscp.rate
    "00 00 00 11 " + // meterBandDscp.burstSize
    "00 00 00 20 " + // meterBandDscp.precLevel
    "04 " + // meterBandDscp.pad
    "00 00 00 " + // len01
    "00 18 " + // flags01
    "00 03 " + // meterId01
    "00 00 00 07 " + // meterBandDscp01.type
    "00 02 " + // meterBandDscp01.len
    "00 10 " + // meterBandDscp01.rate
    "00 00 00 11 " + // meterBandDscp01.burstSize
    "00 00 00 20 " + // meterBandDscp01.precLevel
    "04 " + // meterBandDscp01.pad
    "00 00 00");
    MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
    Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
    MultipartReplyMeterConfigCase messageCase = (MultipartReplyMeterConfigCase) builtByFactory.getMultipartReplyBody();
    MultipartReplyMeterConfig message = messageCase.getMultipartReplyMeterConfig();
    Assert.assertEquals("Wrong flags", new MeterFlags(true, false, true, false), message.getMeterConfig().get(0).getFlags());
    Assert.assertEquals("Wrong meterId", 9, message.getMeterConfig().get(0).getMeterId().getValue().intValue());
    MeterBandDropCase dropCase = (MeterBandDropCase) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
    MeterBandDrop meterBandDrop = dropCase.getMeterBandDrop();
    Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
    Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
    Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
    MeterBandDscpRemarkCase dscpCase = (MeterBandDscpRemarkCase) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
    MeterBandDscpRemark meterBandDscp = dscpCase.getMeterBandDscpRemark();
    Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
    Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
    Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
    Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
    LOG.info(message.getMeterConfig().get(0).getFlags().toString());
    Assert.assertEquals("Wrong flags01", new MeterFlags(false, true, true, false), message.getMeterConfig().get(1).getFlags());
    Assert.assertEquals("Wrong meterId01", 7, message.getMeterConfig().get(1).getMeterId().getValue().intValue());
    MeterBandDscpRemarkCase dscpCase01 = (MeterBandDscpRemarkCase) message.getMeterConfig().get(1).getBands().get(0).getMeterBand();
    MeterBandDscpRemark meterBandDscp01 = dscpCase01.getMeterBandDscpRemark();
    Assert.assertEquals("Wrong meterBandDscp01.type", 2, meterBandDscp01.getType().getIntValue());
    Assert.assertEquals("Wrong meterBandDscp01.rate", 17, meterBandDscp01.getRate().intValue());
    Assert.assertEquals("Wrong meterBandDscp01.burstSize", 32, meterBandDscp01.getBurstSize().intValue());
    Assert.assertEquals("Wrong meterBandDscp01.precLevel", 4, meterBandDscp01.getPrecLevel().intValue());
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) MeterFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags) MeterBandDrop(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.drop._case.MeterBandDrop) MultipartReplyMeterConfigCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfigCase) ByteBuf(io.netty.buffer.ByteBuf) MeterBandDscpRemarkCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCase) MeterBandDscpRemark(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemark) MultipartReplyMeterConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.MultipartReplyMeterConfig) MeterBandDropCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCase) Test(org.junit.Test)

Example 10 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 MultipartRequestMeterInputMessageFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 00 00 04 61 00 00 00 00");
    MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV13(deserializedMessage);
    Assert.assertEquals("Wrong type", MultipartType.forValue(9), deserializedMessage.getType());
    Assert.assertEquals("Wrong flags", new MultipartRequestFlags(true), deserializedMessage.getFlags());
    Assert.assertEquals("Wrong aggregate", createRequestMeter(), 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