Search in sources :

Example 41 with Message

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

the class WriteMetadataInstructionDeserializer method deserialize.

@Override
public Instruction deserialize(ByteBuf message) {
    processHeader(message);
    message.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
    final byte[] meta = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    message.readBytes(meta);
    final byte[] metaMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    message.readBytes(metaMask);
    return new WriteMetadataCaseBuilder().setWriteMetadata(new WriteMetadataBuilder().setMetadata(new BigInteger(1, meta)).setMetadataMask(new BigInteger(1, metaMask)).build()).build();
}
Also used : WriteMetadataCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder) BigInteger(java.math.BigInteger) WriteMetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder)

Example 42 with Message

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

the class AbstractMatchEntryDeserializer method readPrefix.

/**
 * Read Ipv4Prefix from message.
 * @param message buffered message
 * @param hasMask determines if prefix has mask or not
 * @return IPv4 prefix
 */
protected static Ipv4Prefix readPrefix(ByteBuf message, boolean hasMask) {
    final Ipv4Address address = ByteBufUtils.readIetfIpv4Address(message);
    int mask = 32;
    if (hasMask) {
        mask = IpConversionUtil.countBits(OxmDeserializerHelper.convertMask(message, EncodeConstants.GROUPS_IN_IPV4_ADDRESS));
    }
    return IpConversionUtil.createPrefix(address, mask);
}
Also used : Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 43 with Message

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

the class BundleAddMessageConverter method convert.

@Override
public BundleAddMessageOnf convert(BundleAddMessageSal experimenterMessageCase) throws ConversionException {
    final OnfAddMessageGroupingDataBuilder dataBuilder = new OnfAddMessageGroupingDataBuilder();
    dataBuilder.setBundleId(experimenterMessageCase.getSalAddMessageData().getBundleId());
    dataBuilder.setFlags(experimenterMessageCase.getSalAddMessageData().getFlags());
    dataBuilder.setBundleProperty(experimenterMessageCase.getSalAddMessageData().getBundleProperty());
    final BundleInnerMessage innerMessage = experimenterMessageCase.getSalAddMessageData().getBundleInnerMessage();
    final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
    data.setDatapathId(digDatapathId(node));
    if (innerMessage.getImplementedInterface().equals(BundleAddFlowCase.class) || innerMessage.getImplementedInterface().equals(BundleUpdateFlowCase.class) || innerMessage.getImplementedInterface().equals(BundleRemoveFlowCase.class)) {
        dataBuilder.setBundleInnerMessage(convertBundleFlowCase(innerMessage, data));
    } else if (innerMessage.getImplementedInterface().equals(BundleAddGroupCase.class) || innerMessage.getImplementedInterface().equals(BundleUpdateGroupCase.class) || innerMessage.getImplementedInterface().equals(BundleRemoveGroupCase.class)) {
        dataBuilder.setBundleInnerMessage(convertBundleGroupCase(innerMessage, data));
    } else if (innerMessage.getImplementedInterface().equals(BundleUpdatePortCase.class)) {
        dataBuilder.setBundleInnerMessage(convertBundlePortCase(innerMessage, data));
    } else {
        throw new ConversionException("Unsupported inner message");
    }
    return new BundleAddMessageOnfBuilder().setOnfAddMessageGroupingData(dataBuilder.build()).build();
}
Also used : ConversionException(org.opendaylight.openflowplugin.extension.api.exception.ConversionException) OnfAddMessageGroupingDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.bundle.add.message.onf.OnfAddMessageGroupingDataBuilder) VersionDatapathIdConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData) BundleInnerMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.BundleInnerMessage) BundleAddGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.BundleAddGroupCase) BundleUpdateGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.BundleUpdateGroupCase) BundleRemoveFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.BundleRemoveFlowCase) BundleAddMessageOnfBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.BundleAddMessageOnfBuilder)

Example 44 with Message

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

the class BundleControlFactory method deserialize.

@Override
public BundleControlOnf deserialize(ByteBuf message) {
    BundleId bundleId = new BundleId(message.readUnsignedInt());
    BundleControlType type = BundleControlType.forValue(message.readUnsignedShort());
    BundleFlags flags = createBundleFlags(message.readUnsignedShort());
    OnfControlGroupingDataBuilder builder = new OnfControlGroupingDataBuilder();
    List<BundleProperty> properties = createBundleProperties(message);
    builder.setBundleId(bundleId).setType(type).setFlags(flags).setBundleProperty(properties);
    return new BundleControlOnfBuilder().setOnfControlGroupingData(builder.build()).build();
}
Also used : BundleId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleId) OnfControlGroupingDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.bundle.control.onf.OnfControlGroupingDataBuilder) BundleProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty) BundleControlOnfBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.experimenter.input.experimenter.data.of.choice.BundleControlOnfBuilder) BundleFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags) BundleControlType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleControlType)

Example 45 with Message

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

the class BundleControlFactory method createExperimenterBundleProperty.

// FB doesn't recognize Objects.requireNonNull
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
private BundleProperty createExperimenterBundleProperty(final int length, final ByteBuf message) {
    Objects.requireNonNull(deserializerRegistry);
    BundlePropertyExperimenterBuilder experimenterProperty = new BundlePropertyExperimenterBuilder();
    long experimenterId = message.readUnsignedInt();
    long expType = message.readUnsignedInt();
    experimenterProperty.setExperimenter(new ExperimenterId(experimenterId));
    experimenterProperty.setExpType(expType);
    OFDeserializer<BundlePropertyExperimenterData> deserializer = deserializerRegistry.getDeserializer(new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF13_VERSION_ID, experimenterId, expType, BundlePropertyExperimenterData.class));
    experimenterProperty.setBundlePropertyExperimenterData(deserializer.deserialize(message.readBytes(length - 12)));
    return new BundlePropertyBuilder().setType(BundlePropertyType.ONFETBPTEXPERIMENTER).setBundlePropertyEntry(experimenterProperty.build()).build();
}
Also used : BundlePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundlePropertyBuilder) BundlePropertyExperimenterData(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.property.grouping.bundle.property.entry.bundle.property.experimenter.BundlePropertyExperimenterData) BundlePropertyExperimenterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.property.grouping.bundle.property.entry.BundlePropertyExperimenterBuilder) ExperimenterIdTypeDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeDeserializerKey) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

Test (org.junit.Test)202 ByteBuf (io.netty.buffer.ByteBuf)184 ArrayList (java.util.ArrayList)109 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)53 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)45 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)44 BigInteger (java.math.BigInteger)37 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)26 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)25 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)25 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)22 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)21 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)21 List (java.util.List)18 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)18 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)17 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)17 Message (org.eclipse.bpmn2.Message)16 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)15 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message)15