Search in sources :

Example 1 with ExperimenterIdCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase in project openflowplugin by opendaylight.

the class TypeKeyMakerFactory method createMatchEntriesKeyMaker.

/**
 * Creates a key maker for MatchEntry instances.
 *
 * @param version openflow wire version that shall be used in lookup key
 * @return lookup key
 */
public static TypeKeyMaker<MatchEntry> createMatchEntriesKeyMaker(short version) {
    return new AbstractTypeKeyMaker<MatchEntry>(version) {

        @Override
        public MatchEntrySerializerKey<?, ?> make(MatchEntry entry) {
            MatchEntrySerializerKey<?, ?> key;
            key = new MatchEntrySerializerKey<>(getVersion(), entry.getOxmClass(), entry.getOxmMatchField());
            if (entry.getOxmClass().equals(ExperimenterClass.class)) {
                ExperimenterIdCase entryValue = (ExperimenterIdCase) entry.getMatchEntryValue();
                key.setExperimenterId(entryValue.getExperimenter().getExperimenter().getValue());
                return key;
            }
            key.setExperimenterId(null);
            return key;
        }
    };
}
Also used : ExperimenterIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)

Example 2 with ExperimenterIdCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase in project openflowplugin by opendaylight.

the class AbstractOxmExperimenterMatchEntrySerializer method serializeExperimenterId.

protected ExperimenterIdCase serializeExperimenterId(MatchEntry matchEntry, ByteBuf out) {
    ExperimenterIdCase expCase = (ExperimenterIdCase) matchEntry.getMatchEntryValue();
    out.writeInt(expCase.getExperimenter().getExperimenter().getValue().intValue());
    return expCase;
}
Also used : ExperimenterIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase)

Example 3 with ExperimenterIdCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase in project openflowplugin by opendaylight.

the class OnfOxmTcpFlagsSerializer method serialize.

@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
    super.serialize(entry, outBuffer);
    ExperimenterIdCase expCase = serializeExperimenterId(entry, outBuffer);
    TcpFlags tcpFlags = expCase.getAugmentation(TcpFlagsContainer.class).getTcpFlags();
    outBuffer.writeShort(tcpFlags.getFlags());
    if (entry.isHasMask()) {
        outBuffer.writeBytes(tcpFlags.getMask());
    }
}
Also used : ExperimenterIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase) TcpFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags) TcpFlagsContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainer)

Example 4 with ExperimenterIdCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase in project openflowplugin by opendaylight.

the class ActionExtensionHelper method processAlienAction.

/**
 * Processes an alien action.
 *
 * @param action openflow action
 * @param ofVersion openflow version
 * @param actionPath openflow action path
 * @return augmentation wrapper containing augmentation depending on matchPath
 */
public static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action processAlienAction(final Action action, final OpenflowVersion ofVersion, final ActionPath actionPath) {
    ConvertorActionFromOFJava<Action, ActionPath> convertor = null;
    org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action alienAction = null;
    final ExtensionConverterProvider extensionConvertorProvider = OFSessionUtil.getExtensionConvertorProvider();
    if (Objects.isNull(extensionConvertorProvider)) {
        return null;
    }
    if (action.getActionChoice() instanceof ExperimenterIdCase) {
        ExperimenterIdCase actionCase = (ExperimenterIdCase) action.getActionChoice();
        // TODO: EXTENSION PROPOSAL (action, OFJava to MD-SAL)
        ExperimenterActionSerializerKey key = new ExperimenterActionSerializerKey(ofVersion.getVersion(), actionCase.getExperimenter().getExperimenter().getValue(), actionCase.getExperimenter().getSubType());
        convertor = extensionConvertorProvider.getActionConverter(key);
    } else if (action.getActionChoice() != null) {
        ActionSerializerKey<?> key = new ActionSerializerKey(EncodeConstants.OF13_VERSION_ID, action.getActionChoice().getImplementedInterface(), null);
        convertor = extensionConvertorProvider.getActionConverter(key);
    }
    if (convertor != null) {
        alienAction = convertor.convert(action, actionPath);
    }
    return alienAction;
}
Also used : ExperimenterIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) ExtensionConverterProvider(org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider) ActionPath(org.opendaylight.openflowplugin.extension.api.path.ActionPath) ExperimenterActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey) ActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey) ExperimenterActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey)

Example 5 with ExperimenterIdCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase in project openflowplugin by opendaylight.

the class OfToSalExperimenterIdCase method process.

@Override
public Optional<MatchBuilder> process(@Nonnull ExperimenterIdCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
    final MatchBuilder matchBuilder = data.getMatchBuilder();
    if (data.getOxmMatchField().equals(TcpFlags.class)) {
        final TcpFlagsMatchBuilder tcpFlagsMatchBuilder = data.getTcpFlagsMatchBuilder();
        final TcpFlagsContainer tcpFlagsContainer = source.getAugmentation(TcpFlagsContainer.class);
        if (tcpFlagsContainer != null) {
            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags tcpFlags = tcpFlagsContainer.getTcpFlags();
            tcpFlagsMatchBuilder.setTcpFlags(tcpFlags.getFlags());
            byte[] mask = tcpFlags.getMask();
            if (mask != null) {
                tcpFlagsMatchBuilder.setTcpFlagsMask(ByteUtil.bytesToUnsignedShort(mask));
            }
            matchBuilder.setTcpFlagsMatch(tcpFlagsMatchBuilder.build());
        }
    }
    return Optional.of(matchBuilder);
}
Also used : TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder) TcpFlagsContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainer) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder)

Aggregations

ExperimenterIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase)5 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)3 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)2 TcpFlagsContainer (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainer)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ActionSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey)1 ExperimenterActionSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey)1 ExtensionConverterProvider (org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider)1 ActionPath (org.opendaylight.openflowplugin.extension.api.path.ActionPath)1 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)1 TcpFlagsMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder)1 TcpFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags)1 ExperimenterIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase)1 SetFieldCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)1