use of org.opendaylight.openflowplugin.extension.api.path.ActionPath in project openflowplugin by opendaylight.
the class InstructionDeserializerInjector method injectDeserializers.
/**
* Injects instruction deserializers into provided
* {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
*
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
// Inject new instruction deserializers here using injector created by createInjector method
final Function<Byte, Function<ActionPath, Consumer<OFDeserializer<Instruction>>>> injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(InstructionConstants.GOTO_TABLE_TYPE).apply(null).accept(new GoToTableInstructionDeserializer());
injector.apply(InstructionConstants.WRITE_METADATA_TYPE).apply(null).accept(new WriteMetadataInstructionDeserializer());
injector.apply(InstructionConstants.CLEAR_ACTIONS_TYPE).apply(null).accept(new ClearActionsInstructionDeserializer());
injector.apply(InstructionConstants.METER_TYPE).apply(null).accept(new MeterInstructionDeserializer());
for (ActionPath path : ActionPath.values()) {
injector.apply(InstructionConstants.WRITE_ACTIONS_TYPE).apply(path).accept(new WriteActionsInstructionDeserializer(path));
injector.apply(InstructionConstants.APPLY_ACTIONS_TYPE).apply(path).accept(new ApplyActionsInstructionDeserializer(path));
}
}
use of org.opendaylight.openflowplugin.extension.api.path.ActionPath 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;
}
Aggregations