2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.openflow.md.core.extension;
10 import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
11 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey;
12 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
13 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
14 import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
15 import org.opendaylight.openflowplugin.extension.api.TypeVersionKey;
16 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
17 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
26 public final class ActionExtensionHelper {
28 private static final Logger LOG = LoggerFactory
29 .getLogger(ActionExtensionHelper.class);
31 private ActionExtensionHelper() {
32 throw new IllegalAccessError("singleton enforcement");
39 * @return augmentation wrapper containing augmentation depending on matchPath
41 public static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
42 processAlienAction(Action action, OpenflowVersion ofVersion, ActionPath actionPath) {
43 ConvertorActionFromOFJava<Action, ActionPath> convertor = null;
44 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action alienAction = null;
45 if(action.getActionChoice() instanceof ExperimenterIdCase) {
46 ExperimenterIdCase actionCase = (ExperimenterIdCase) action.getActionChoice();
47 /** TODO: EXTENSION PROPOSAL (action, OFJava to MD-SAL) */
48 ExperimenterActionSerializerKey key = new ExperimenterActionSerializerKey(
49 ofVersion.getVersion(),
50 actionCase.getExperimenter().getExperimenter().getValue(),
51 actionCase.getExperimenter().getSubType());
52 convertor = OFSessionUtil.getExtensionConvertorProvider().getActionConverter(key);
53 } else if (action.getActionChoice() != null){
54 ActionSerializerKey<?> key = new ActionSerializerKey(EncodeConstants.OF13_VERSION_ID, action.getActionChoice().getImplementedInterface(), null);
55 convertor = OFSessionUtil.getExtensionConvertorProvider().getActionConverter(key);
57 if (convertor != null) {
58 alienAction = convertor.convert(