Search in sources :

Example 1 with ActionSerializerKey

use of org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey 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 2 with ActionSerializerKey

use of org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey in project openflowplugin by opendaylight.

the class NiciraExtensionCodecRegistratorImplTest method registerActionSerializerTest.

@Test
public void registerActionSerializerTest() {
    niciraExtensionCodecRegistrator.registerActionSerializer(actionSerializerKey, actionSerializer);
    ActionSerializerKey key1 = NiciraUtil.createOfJavaKeyFrom(actionSerializerKey);
    Mockito.verify(provider).registerActionSerializer(Matchers.eq(key1), Matchers.any(OFGeneralSerializer.class));
}
Also used : NiciraActionSerializerKey(org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey) ActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey) OFGeneralSerializer(org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer) Test(org.junit.Test)

Example 3 with ActionSerializerKey

use of org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey in project openflowplugin by opendaylight.

the class NiciraExtensionCodecRegistratorImplTest method unregisterActionSerializerTest.

@Test
public void unregisterActionSerializerTest() {
    niciraExtensionCodecRegistrator.registerActionSerializer(actionSerializerKey, actionSerializer);
    ActionSerializerKey key1 = NiciraUtil.createOfJavaKeyFrom(actionSerializerKey);
    niciraExtensionCodecRegistrator.unregisterActionSerializer(actionSerializerKey);
    Mockito.verify(provider).unregisterSerializer(Matchers.eq(key1));
}
Also used : NiciraActionSerializerKey(org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey) ActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey) Test(org.junit.Test)

Aggregations

ActionSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey)3 Test (org.junit.Test)2 NiciraActionSerializerKey (org.opendaylight.openflowjava.nx.api.NiciraActionSerializerKey)2 OFGeneralSerializer (org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer)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 ExperimenterIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)1