import org.opendaylight.openflowplugin.extension.api.ExtensionConverterProviderKeeper;
import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
import org.opendaylight.openflowplugin.impl.util.MdSalRegistrationUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
import org.slf4j.Logger;
private StatisticsManager statisticsManager;
private RpcManager rpcManager;
private final MessageIntelligenceAgency messageIntelligenceAgency;
+ private final ConvertorExecutor convertorExecutor;
private ConcurrentHashMap<DeviceInfo, ServiceChangeListener> serviceChangeListeners = new ConcurrentHashMap<>();
private NotificationPublishService notificationPublishService;
- LifecycleConductorImpl(final MessageIntelligenceAgency messageIntelligenceAgency) {
+ LifecycleConductorImpl(final MessageIntelligenceAgency messageIntelligenceAgency, ConvertorExecutor convertorExecutor) {
this.messageIntelligenceAgency = Preconditions.checkNotNull(messageIntelligenceAgency);
+ this.convertorExecutor = convertorExecutor;
}
@Override
if (OfpRole.BECOMEMASTER.equals(newRole)) {
logText = "Start";
fillDeviceFlowRegistry(deviceInfo, deviceContext.getDeviceFlowRegistry());
- MdSalRegistrationUtils.registerServices(rpcContext, deviceContext, this.extensionConverterProvider);
+ MdSalRegistrationUtils.registerServices(rpcContext, deviceContext, this.extensionConverterProvider, convertorExecutor);
if (rpcContext.isStatisticsRpcEnabled()) {
MdSalRegistrationUtils.registerStatCompatibilityServices(
rpcContext,
deviceContext,
- notificationPublishService);
+ notificationPublishService, convertorExecutor);
}
} else {
logText = "Stopp";
import org.opendaylight.openflowplugin.impl.util.TranslatorLibraryUtil;
import org.opendaylight.openflowplugin.openflow.md.core.ThreadPoolLoggingExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final int rpcRequestsQuota;
private final long globalNotificationQuota;
+ private final ConvertorManager convertorManager;
private long barrierInterval;
private int barrierCountLimit;
private long echoReplyTimeout;
Preconditions.checkNotNull(threadPoolTimeout), TimeUnit.SECONDS,
new SynchronousQueue<>(), "ofppool");
- conductor = new LifecycleConductorImpl(messageIntelligenceAgency);
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
+ conductor = new LifecycleConductorImpl(messageIntelligenceAgency, convertorManager);
}
@Override
barrierInterval,
barrierCountLimit,
conductor,
- isNotificationFlowRemovedOff);
+ isNotificationFlowRemovedOff,
+ convertorManager);
((ExtensionConverterProviderKeeper) conductor).setExtensionConverterProvider(extensionConverterManager);
((ExtensionConverterProviderKeeper) deviceManager).setExtensionConverterProvider(extensionConverterManager);
conductor.setNotificationPublishService(notificationPublishService);
roleManager = new RoleManagerImpl(entityOwnershipService, dataBroker, conductor);
- statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, isStatisticsPollingOff, conductor);
+ statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, isStatisticsPollingOff, conductor, convertorManager);
conductor.setSafelyManager(statisticsManager);
rpcManager = new RpcManagerImpl(rpcProviderRegistry, rpcRequestsQuota, conductor);
rpcManager.setStatisticsRpcEnabled(isStatisticsRpcEnabled);
- TranslatorLibraryUtil.setBasicTranslatorLibrary(deviceManager);
+ TranslatorLibraryUtil.injectBasicTranslatorLibrary(deviceManager, convertorManager);
deviceManager.initialize();
startSwitchConnections();
import java.util.Optional;
import javax.annotation.CheckForNull;
import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
* table can have List of TableFeatures so add it directly to
* {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder}
*
- * @param reply
- * @return
+ * @param reply reply
+ * @param version Openflow version
+ * @param convertorExecutor convertor executor
+ * @return list of table features
*/
- public static List<TableFeatures> nodeTableFeatureTranslator(@CheckForNull final MultipartReplyTableFeatures reply) {
+ public static List<TableFeatures> nodeTableFeatureTranslator(@CheckForNull final MultipartReplyTableFeatures reply, final short version, @CheckForNull final ConvertorExecutor convertorExecutor) {
Preconditions.checkArgument(reply != null);
- final Optional<List<TableFeatures>> tableFeaturesList = ConvertorManager.getInstance().convert(reply);
+ Preconditions.checkArgument(convertorExecutor != null);
+ final Optional<List<TableFeatures>> tableFeaturesList = convertorExecutor.convert(reply, new VersionConvertorData(version));
return tableFeaturesList.orElse(Collections.emptyList());
}
import org.opendaylight.openflowplugin.impl.connection.OutboundQueueProviderImpl;
import org.opendaylight.openflowplugin.impl.device.listener.OpenflowProtocolListenerFullImpl;
import org.opendaylight.openflowplugin.impl.util.DeviceInitializationUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
private static final int SPY_RATE = 10;
private final DataBroker dataBroker;
+ private final ConvertorExecutor convertorExecutor;
private TranslatorLibrary translatorLibrary;
private DeviceInitializationPhaseHandler deviceInitPhaseHandler;
private DeviceTerminationPhaseHandler deviceTerminPhaseHandler;
public DeviceManagerImpl(@Nonnull final DataBroker dataBroker,
final long globalNotificationQuota, final boolean switchFeaturesMandatory,
final long barrierInterval, final int barrierCountLimit,
- final LifecycleConductor lifecycleConductor, boolean isNotificationFlowRemovedOff) {
+ final LifecycleConductor lifecycleConductor, boolean isNotificationFlowRemovedOff,
+ final ConvertorExecutor convertorExecutor) {
this.switchFeaturesMandatory = switchFeaturesMandatory;
this.globalNotificationQuota = globalNotificationQuota;
this.isNotificationFlowRemovedOff = isNotificationFlowRemovedOff;
this.dataBroker = Preconditions.checkNotNull(dataBroker);
+ this.convertorExecutor = convertorExecutor;
/* merge empty nodes to oper DS to predict any problems with missing parent for Node */
final WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
((DeviceContextImpl)deviceContext).getTransactionChainManager().activateTransactionManager();
/* Init Collecting NodeInfo */
final ListenableFuture<Void> initCollectingDeviceInfo = DeviceInitializationUtils.initializeNodeInformation(
- deviceContext, switchFeaturesMandatory);
+ deviceContext, switchFeaturesMandatory, convertorExecutor);
/* Init Collecting StatInfo */
final ListenableFuture<Boolean> statPollFuture = Futures.transform(initCollectingDeviceInfo,
new AsyncFunction<Void, Boolean>() {
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
public abstract class AbstractMultipartOnTheFlyService<I> extends AbstractService<I, List<MultipartReply>> {
- protected AbstractMultipartOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ private final ConvertorExecutor convertorExecutor;
+
+ protected AbstractMultipartOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext);
+ this.convertorExecutor = convertorExecutor;
}
@Override
protected final FutureCallback<OfHeader> createCallback(final RequestContext<List<MultipartReply>> context, final Class<?> requestType) {
return new MultipartRequestOnTheFlyCallback(context, requestType,
getMessageSpy(), getEventIdentifier(), getDeviceInfo(),
- getDeviceContext().getDeviceFlowRegistry(), getTxFacade());
+ getDeviceContext().getDeviceFlowRegistry(), getTxFacade(),
+ convertorExecutor);
}
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
final class FlowService<O extends DataObject> extends AbstractSimpleService<FlowModInputBuilder, O> {
- protected FlowService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionDatapathIdConvertorData data;
+
+ protected FlowService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, clazz);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getDatapathId());
}
@Override
}
List<FlowModInputBuilder> toFlowModInputs(final Flow input) {
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getDatapathId());
-
- final Optional<List<FlowModInputBuilder>> flowModInputBuilders = ConvertorManager.getInstance().convert(input, data);
+ final Optional<List<FlowModInputBuilder>> flowModInputBuilders = convertorExecutor.convert(input, data);
return flowModInputBuilders.orElse(Collections.emptyList());
}
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group;
import org.opendaylight.yangtools.yang.binding.DataObject;
final class GroupService<I extends Group, O extends DataObject> extends AbstractSimpleService<I, O> {
- GroupService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionDatapathIdConvertorData data;
+
+ GroupService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, clazz);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getDatapathId());
}
@Override
protected OfHeader buildRequest(final Xid xid, final I input) {
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getDatapathId());
- final Optional<GroupModInputBuilder> ofGroupModInput = ConvertorManager
- .getInstance()
- .convert(input, data);
+ final Optional<GroupModInputBuilder> ofGroupModInput = convertorExecutor.convert(input, data);
final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
.orElse(GroupConvertor.defaultResult(getVersion()))
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter;
final class MeterService<I extends Meter, O extends DataObject> extends AbstractSimpleService<I, O> {
- MeterService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
+ MeterService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, clazz);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
protected OfHeader buildRequest(final Xid xid, final I input) {
- final VersionConvertorData data = new VersionConvertorData(getVersion());
- final Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager.getInstance().convert(input, data);
+ final Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(input, data);
final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
.orElse(MeterConvertor.defaultResult(getVersion()));
import org.opendaylight.openflowplugin.impl.statistics.SinglePurposeMultipartReplyTranslator;
import org.opendaylight.openflowplugin.impl.statistics.StatisticsGatheringUtils;
import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback<List<MultipartReply>> {
private static final Logger LOG = LoggerFactory.getLogger(MultipartRequestOnTheFlyCallback.class);
- private static final SinglePurposeMultipartReplyTranslator MULTIPART_REPLY_TRANSLATOR = new SinglePurposeMultipartReplyTranslator();
+ private final SinglePurposeMultipartReplyTranslator multipartReplyTranslator;
private final DeviceInfo deviceInfo;
private final DeviceFlowRegistry registry;
private boolean virgin = true;
final EventIdentifier eventIdentifier,
final DeviceInfo deviceInfo,
final DeviceFlowRegistry registry,
- final TxFacade txFacade) {
+ final TxFacade txFacade,
+ final ConvertorExecutor convertorExecutor) {
super(context, requestType, messageSpy, eventIdentifier);
this.deviceInfo = deviceInfo;
this.registry = registry;
this.txFacade = txFacade;
+ multipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorExecutor);
+
//TODO: this is focused on flow stats only - need more general approach if used for more than flow stats
doneEventIdentifier = new EventIdentifier(MultipartType.OFPMPFLOW.name(), deviceInfo.getNodeId().toString());
}
final MultipartReply multipartReply = (MultipartReply) result;
final MultipartReply singleReply = multipartReply;
- final List<? extends DataObject> multipartDataList = MULTIPART_REPLY_TRANSLATOR.translate(
+ final List<? extends DataObject> multipartDataList = multipartReplyTranslator.translate(
deviceInfo.getDatapathId(), deviceInfo.getVersion(), singleReply);
final Iterable<? extends DataObject> allMultipartData = multipartDataList;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
public final class PacketProcessingServiceImpl extends AbstractVoidService<TransmitPacketInput> implements PacketProcessingService {
- public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ private final ConvertorExecutor convertorExecutor;
+
+ public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext);
+ this.convertorExecutor = convertorExecutor;
}
@Override
data.setDatapathId(getDatapathId());
data.setXid(xid.getValue());
- final Optional<PacketOutInput> result = ConvertorManager.getInstance().convert(input, data);
+ final Optional<PacketOutInput> result = convertorExecutor.convert(input, data);
return result.orElse(PacketOutConvertor.defaultResult(getVersion()));
}
}
import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
import org.opendaylight.openflowplugin.impl.registry.flow.FlowDescriptorFactory;
import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
private final DeviceContext deviceContext;
private ItemLifecycleListener itemLifecycleListener;
- public SalFlowServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ public SalFlowServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
this.deviceContext = deviceContext;
- flowRemove = new FlowService(requestContextStack, deviceContext, RemoveFlowOutput.class);
- flowAdd = new FlowService<>(requestContextStack, deviceContext, AddFlowOutput.class);
- flowUpdate = new FlowService<>(requestContextStack, deviceContext, UpdateFlowOutput.class);
+ flowRemove = new FlowService<>(requestContextStack, deviceContext, RemoveFlowOutput.class, convertorExecutor);
+ flowAdd = new FlowService<>(requestContextStack, deviceContext, AddFlowOutput.class, convertorExecutor);
+ flowUpdate = new FlowService<>(requestContextStack, deviceContext, UpdateFlowOutput.class, convertorExecutor);
}
@Override
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
private final DeviceContext deviceContext;
private ItemLifecycleListener itemLifecycleListener;
- public SalGroupServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ public SalGroupServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
this.deviceContext = deviceContext;
- addGroup = new GroupService<>(requestContextStack, deviceContext, AddGroupOutput.class);
- updateGroup = new GroupService<>(requestContextStack, deviceContext, UpdateGroupOutput.class);
- removeGroup = new GroupService<>(requestContextStack, deviceContext, RemoveGroupOutput.class);
+ addGroup = new GroupService<>(requestContextStack, deviceContext, AddGroupOutput.class, convertorExecutor);
+ updateGroup = new GroupService<>(requestContextStack, deviceContext, UpdateGroupOutput.class, convertorExecutor);
+ removeGroup = new GroupService<>(requestContextStack, deviceContext, RemoveGroupOutput.class, convertorExecutor);
}
@Override
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
private ItemLifecycleListener itemLifecycleListener;
private final DeviceContext deviceContext;
- public SalMeterServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ public SalMeterServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
this.deviceContext = deviceContext;
- addMeter = new MeterService<>(requestContextStack, deviceContext, AddMeterOutput.class);
- updateMeter = new MeterService<>(requestContextStack, deviceContext, UpdateMeterOutput.class);
- removeMeter = new MeterService<>(requestContextStack, deviceContext, RemoveMeterOutput.class);
+ addMeter = new MeterService<>(requestContextStack, deviceContext, AddMeterOutput.class, convertorExecutor);
+ updateMeter = new MeterService<>(requestContextStack, deviceContext, UpdateMeterOutput.class, convertorExecutor);
+ removeMeter = new MeterService<>(requestContextStack, deviceContext, RemoveMeterOutput.class, convertorExecutor);
}
@Override
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
import org.opendaylight.yangtools.yang.common.RpcResult;
public final class SalPortServiceImpl extends AbstractSimpleService<UpdatePortInput, UpdatePortOutput> implements SalPortService {
- public SalPortServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
+ public SalPortServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, UpdatePortOutput.class);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
@Override
protected OfHeader buildRequest(final Xid xid, final UpdatePortInput input) {
final Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
- final Optional<PortModInput> ofPortModInput = ConvertorManager
- .getInstance()
- .convert(inputPort, new VersionConvertorData(getVersion()));
+ final Optional<PortModInput> ofPortModInput = convertorExecutor.convert(inputPort, data);
final PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput
.orElse(PortConvertor.defaultResult(getVersion())))
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.TxFacade;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
public final class SalTableServiceImpl extends AbstractMultipartService<UpdateTableInput> implements SalTableService {
private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(SalTableServiceImpl.class);
private final TxFacade txFacade;
- private final NodeId nodeId;
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
- public SalTableServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
- final NodeId nodeId) {
+ public SalTableServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext);
this.txFacade = deviceContext;
- this.nodeId = nodeId;
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
txFacade.submitTransaction();
}
- protected static List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> convertToSalTableFeatures(
+ protected List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> convertToSalTableFeatures(
final List<MultipartReply> multipartReplies) {
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> salTableFeaturesAll = new ArrayList<>();
for (final MultipartReply multipartReply : multipartReplies) {
.getMultipartReplyTableFeatures();
final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures>> salTableFeaturesPartial =
- ConvertorManager.getInstance().convert(salTableFeatures);
+ convertorExecutor.convert(salTableFeatures, data);
if (salTableFeaturesPartial.isPresent()) {
salTableFeaturesAll.addAll(salTableFeaturesPartial.get());
final MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
final MultipartRequestTableFeaturesBuilder requestBuilder = new MultipartRequestTableFeaturesBuilder();
- final Optional<List<TableFeatures>> ofTableFeatureList = ConvertorManager.getInstance().convert(input.getUpdatedTable());
+ final Optional<List<TableFeatures>> ofTableFeatureList = convertorExecutor.convert(input.getUpdatedTable(), data);
requestBuilder.setTableFeatures(ofTableFeatureList.orElse(Collections.emptyList()));
caseBuilder.setMultipartRequestTableFeatures(requestBuilder.build());
import java.util.List;
import java.util.Optional;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
protected static final Logger logger = LoggerFactory
.getLogger(SinglePurposeMultipartReplyTranslator.class);
+ private final ConvertorExecutor convertorExecutor;
+
+ public SinglePurposeMultipartReplyTranslator(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
public List<DataObject> translate(final BigInteger datapathId, final short version, final OfHeader msg) {
MultipartReplyMessage mpReply = (MultipartReplyMessage) msg;
OpenflowVersion ofVersion = OpenflowVersion.get(version);
NodeId node = nodeIdFromDatapathId(datapathId);
- VersionDatapathIdConvertorData versionDatapathIdConvertorData = new VersionDatapathIdConvertorData(version);
- versionDatapathIdConvertorData.setDatapathId(datapathId);
- VersionConvertorData simpleConvertorData = new VersionConvertorData(version);
+ VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
+ data.setDatapathId(datapathId);
- translateFlow(listDataObject, mpReply, node, versionDatapathIdConvertorData);
+ translateFlow(listDataObject, mpReply, node, data);
translateAggregate(listDataObject, mpReply, node);
translatePortStats(listDataObject, mpReply, node, ofVersion, datapathId);
- translateGroup(listDataObject, mpReply, node);
- translateGroupDesc(listDataObject, mpReply, node, simpleConvertorData);
+ translateGroup(listDataObject, mpReply, node, data);
+ translateGroupDesc(listDataObject, mpReply, node, data);
translateGroupFeatures(listDataObject, mpReply, node);
- translateMeter(listDataObject, mpReply, node);
- translateMeterConfig(listDataObject, mpReply, node);
+ translateMeter(listDataObject, mpReply, node, data);
+ translateMeterConfig(listDataObject, mpReply, node, data);
translateMeterFeatures(listDataObject, mpReply, node);
translateTable(listDataObject, mpReply, node);
translateQueue(listDataObject, mpReply, node, ofVersion, datapathId);
return listDataObject;
}
- private static void translateFlow(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node, VersionDatapathIdConvertorData versionDatapathIdConvertorData) {
+ private void translateFlow(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node, VersionDatapathIdConvertorData data) {
if (!MultipartType.OFPMPFLOW.equals(mpReply.getType())) {
return;
}
MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpReply.getMultipartReplyBody();
MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
final Optional<List<FlowAndStatisticsMapList>> flowAndStatisticsMapLists =
- ConvertorManager.getInstance().convert(replyBody.getFlowStats(), versionDatapathIdConvertorData);
+ convertorExecutor.convert(replyBody.getFlowStats(), data);
message.setFlowAndStatisticsMapList(flowAndStatisticsMapLists.orElse(Collections.emptyList()));
listDataObject.add(message.build());
}
- private static void translateAggregate(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node) {
+ private void translateAggregate(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node) {
if (!MultipartType.OFPMPAGGREGATE.equals(mpReply.getType())) {
return;
}
listDataObject.add(message.build());
}
- private static void translatePortStats(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node,
- final OpenflowVersion ofVersion,
- final BigInteger datapathId) {
+ private void translatePortStats(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node,
+ final OpenflowVersion ofVersion,
+ final BigInteger datapathId) {
if (!MultipartType.OFPMPPORTSTATS.equals(mpReply.getType())) {
return;
}
listDataObject.add(message.build());
}
- private static void translateGroup(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node) {
+ private void translateGroup(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node,
+ final VersionDatapathIdConvertorData data) {
if (!MultipartType.OFPMPGROUP.equals(mpReply.getType())) {
return;
}
message.setTransactionId(generateTransactionId(mpReply.getXid()));
MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
- final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(
- replyBody.getGroupStats());
+ final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(
+ replyBody.getGroupStats(), data);
message.setGroupStats(groupStatsList.orElse(Collections.emptyList()));
listDataObject.add(message.build());
}
- private static void translateGroupDesc(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node,
- VersionConvertorData simpleConvertorData) {
+ private void translateGroupDesc(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node,
+ final VersionDatapathIdConvertorData data) {
if (!MultipartType.OFPMPGROUPDESC.equals(mpReply.getType())) {
return;
}
MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase) mpReply.getMultipartReplyBody();
MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
- final Optional<List<GroupDescStats>> groupDescStatsList = ConvertorManager.getInstance().convert(
- replyBody.getGroupDesc(), simpleConvertorData);
+ final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(
+ replyBody.getGroupDesc(), data);
message.setGroupDescStats(groupDescStatsList.orElse(Collections.emptyList()));
listDataObject.add(message.build());
}
- private static void translateGroupFeatures(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node) {
+ private void translateGroupFeatures(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node) {
if (!MultipartType.OFPMPGROUPFEATURES.equals(mpReply.getType())) {
return;
}
listDataObject.add(message.build());
}
- private static void translateMeter(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node) {
+ private void translateMeter(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node,
+ final VersionDatapathIdConvertorData data) {
if (!MultipartType.OFPMPMETER.equals(mpReply.getType())) {
return;
}
MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>> meterStatsList =
- ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+ convertorExecutor.convert(replyBody.getMeterStats(), data);
message.setMeterStats(meterStatsList.orElse(Collections.emptyList()));
listDataObject.add(message.build());
}
- private static void translateMeterConfig(final List<DataObject> listDataObject,
- final MultipartReplyMessage mpReply,
- final NodeId node) {
+ private void translateMeterConfig(final List<DataObject> listDataObject,
+ final MultipartReplyMessage mpReply,
+ final NodeId node,
+ final VersionDatapathIdConvertorData data) {
if (!MultipartType.OFPMPMETERCONFIG.equals(mpReply.getType())) {
return;
}
MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase) mpReply.getMultipartReplyBody();
MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
- final Optional<List<MeterConfigStats>> meterConfigStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterConfig());
+ final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
message.setMeterConfigStats(meterConfigStatsList.orElse(Collections.emptyList()));
listDataObject.add(message.build());
}
- private static void translateMeterFeatures(final List<DataObject> listDataObject,
+ private void translateMeterFeatures(final List<DataObject> listDataObject,
final MultipartReplyMessage mpReply,
final NodeId node) {
if (!MultipartType.OFPMPMETERFEATURES.equals(mpReply.getType())) {
listDataObject.add(message.build());
}
- private static void translateTable(final List<DataObject> listDataObject,
+ private void translateTable(final List<DataObject> listDataObject,
final MultipartReplyMessage mpReply,
final NodeId node) {
if (!MultipartType.OFPMPTABLE.equals(mpReply.getType())) {
listDataObject.add(message.build());
}
- private static void translateQueue(final List<DataObject> listDataObject,
+ private void translateQueue(final List<DataObject> listDataObject,
final MultipartReplyMessage mpReply,
final NodeId node,
final OpenflowVersion ofVersion,
import org.opendaylight.openflowplugin.impl.services.RequestContextUtil;
import org.opendaylight.openflowplugin.impl.statistics.services.dedicated.StatisticsGatheringOnTheFlyService;
import org.opendaylight.openflowplugin.impl.statistics.services.dedicated.StatisticsGatheringService;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final ListenableFuture<Boolean> emptyFuture;
private final boolean shuttingDownStatisticsPolling;
private final Object COLLECTION_STAT_TYPE_LOCK = new Object();
+ private final SinglePurposeMultipartReplyTranslator multipartReplyTranslator;
@GuardedBy("COLLECTION_STAT_TYPE_LOCK")
private List<MultipartType> collectingStatType;
private volatile boolean schedulingEnabled;
private volatile CONTEXT_STATE contextState;
- StatisticsContextImpl(@CheckForNull final DeviceInfo deviceInfo, final boolean shuttingDownStatisticsPolling, final LifecycleConductor lifecycleConductor) {
+ StatisticsContextImpl(@CheckForNull final DeviceInfo deviceInfo, final boolean shuttingDownStatisticsPolling, final LifecycleConductor lifecycleConductor, final ConvertorExecutor convertorExecutor) {
this.deviceContext = Preconditions.checkNotNull(lifecycleConductor.getDeviceContext(deviceInfo));
this.devState = Preconditions.checkNotNull(deviceContext.getDeviceState());
this.shuttingDownStatisticsPolling = shuttingDownStatisticsPolling;
+ multipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorExecutor);
emptyFuture = Futures.immediateFuture(false);
statisticsGatheringService = new StatisticsGatheringService(this, deviceContext);
- statisticsGatheringOnTheFlyService = new StatisticsGatheringOnTheFlyService(this, deviceContext);
+ statisticsGatheringOnTheFlyService = new StatisticsGatheringOnTheFlyService(this, deviceContext, convertorExecutor);
itemLifeCycleListener = new ItemLifecycleListenerImpl(deviceContext);
statListForCollectingInitialization();
contextState = CONTEXT_STATE.WORKING;
/*MultipartType.OFPMPFLOW*/ multipartType,
deviceContext,
deviceContext,
- initial) : emptyFuture;
+ initial, multipartReplyTranslator) : emptyFuture;
}
private ListenableFuture<Boolean> collectTableStatistics(final MultipartType multipartType) {
/*MultipartType.OFPMPTABLE*/ multipartType,
deviceContext,
deviceContext,
- false) : emptyFuture;
+ false, multipartReplyTranslator) : emptyFuture;
}
private ListenableFuture<Boolean> collectPortStatistics(final MultipartType multipartType) {
/*MultipartType.OFPMPPORTSTATS*/ multipartType,
deviceContext,
deviceContext,
- false) : emptyFuture;
+ false, multipartReplyTranslator) : emptyFuture;
}
private ListenableFuture<Boolean> collectQueueStatistics(final MultipartType multipartType) {
/*MultipartType.OFPMPQUEUE*/ multipartType,
deviceContext,
deviceContext,
- false);
+ false, multipartReplyTranslator);
}
private ListenableFuture<Boolean> collectGroupDescStatistics(final MultipartType multipartType) {
/*MultipartType.OFPMPGROUPDESC*/ multipartType,
deviceContext,
deviceContext,
- false) : emptyFuture;
+ false, multipartReplyTranslator) : emptyFuture;
}
private ListenableFuture<Boolean> collectGroupStatistics(final MultipartType multipartType) {
/*MultipartType.OFPMPGROUP*/ multipartType,
deviceContext,
deviceContext,
- false) : emptyFuture;
+ false, multipartReplyTranslator) : emptyFuture;
}
private ListenableFuture<Boolean> collectMeterConfigStatistics(final MultipartType multipartType) {
/*MultipartType.OFPMPMETERCONFIG*/ multipartType,
deviceContext,
deviceContext,
- false) : emptyFuture;
+ false, multipartReplyTranslator) : emptyFuture;
}
private ListenableFuture<Boolean> collectMeterStatistics(final MultipartType multipartType) {
/*MultipartType.OFPMPMETER*/ multipartType,
deviceContext,
deviceContext,
- false) : emptyFuture;
+ false, multipartReplyTranslator) : emptyFuture;
}
@VisibleForTesting
private static String DATE_AND_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
private static final Logger LOG = LoggerFactory.getLogger(StatisticsGatheringUtils.class);
- private static final SinglePurposeMultipartReplyTranslator MULTIPART_REPLY_TRANSLATOR = new SinglePurposeMultipartReplyTranslator();
private static final String QUEUE2_REQCTX = "QUEUE2REQCTX-";
private StatisticsGatheringUtils() {
final MultipartType type,
final TxFacade txFacade,
final DeviceRegistry registry,
- final Boolean initial) {
+ final Boolean initial,
+ final SinglePurposeMultipartReplyTranslator multipartReplyTranslator) {
EventIdentifier wholeProcessEventIdentifier = null;
if (MultipartType.OFPMPFLOW.equals(type)) {
wholeProcessEventIdentifier = new EventIdentifier(type.toString(), deviceInfo.getNodeId().getValue());
final ListenableFuture<RpcResult<List<MultipartReply>>> statisticsDataInFuture =
JdkFutureAdapters.listenInPoolThread(statisticsGatheringService.getStatisticsOfType(
ofpQueuToRequestContextEventIdentifier, type));
- return transformAndStoreStatisticsData(statisticsDataInFuture, deviceInfo, wholeProcessEventIdentifier, type, txFacade, registry, initial);
+ return transformAndStoreStatisticsData(statisticsDataInFuture, deviceInfo, wholeProcessEventIdentifier, type, txFacade, registry, initial, multipartReplyTranslator);
}
private static ListenableFuture<Boolean> transformAndStoreStatisticsData(final ListenableFuture<RpcResult<List<MultipartReply>>> statisticsDataInFuture,
final MultipartType type,
final TxFacade txFacade,
final DeviceRegistry registry,
- final boolean initial) {
+ final boolean initial,
+ final SinglePurposeMultipartReplyTranslator multipartReplyTranslator) {
return Futures.transform(statisticsDataInFuture, new AsyncFunction<RpcResult<List<MultipartReply>>, Boolean>() {
@Nullable
@Override
try {
for (final MultipartReply singleReply : rpcResult.getResult()) {
- final List<? extends DataObject> multipartDataList = MULTIPART_REPLY_TRANSLATOR.translate(
+ final List<? extends DataObject> multipartDataList = multipartReplyTranslator.translate(
deviceInfo.getDatapathId(),
deviceInfo.getVersion(), singleReply);
multipartData = multipartDataList.get(0);
import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.ChangeStatisticsWorkModeInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutputBuilder;
private static final Logger LOG = LoggerFactory.getLogger(StatisticsManagerImpl.class);
private static final long DEFAULT_STATS_TIMEOUT_SEC = 50L;
+ private final ConvertorExecutor convertorExecutor;
private DeviceInitializationPhaseHandler deviceInitPhaseHandler;
private DeviceTerminationPhaseHandler deviceTerminPhaseHandler;
public StatisticsManagerImpl(@CheckForNull final RpcProviderRegistry rpcProviderRegistry,
final boolean shuttingDownStatisticsPolling,
- final LifecycleConductor lifecycleConductor) {
+ final LifecycleConductor lifecycleConductor,
+ final ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
Preconditions.checkArgument(rpcProviderRegistry != null);
this.controlServiceRegistration = Preconditions.checkNotNull(rpcProviderRegistry.addRpcImplementation(
StatisticsManagerControlService.class, this));
final DeviceContext deviceContext = Preconditions.checkNotNull(conductor.getDeviceContext(deviceInfo));
- final StatisticsContext statisticsContext = new StatisticsContextImpl(deviceInfo, shuttingDownStatisticsPolling, conductor);
+ final StatisticsContext statisticsContext = new StatisticsContextImpl(deviceInfo, shuttingDownStatisticsPolling, conductor, convertorExecutor);
Verify.verify(contexts.putIfAbsent(deviceInfo, statisticsContext) == null, "StatisticsCtx still not closed for Node {}", deviceInfo.getNodeId());
deviceInitPhaseHandler.onDeviceContextLevelUp(deviceInfo);
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
public final class AllFlowsInAllTablesService extends AbstractCompatibleStatService<GetAllFlowsStatisticsFromAllFlowTablesInput,
GetAllFlowsStatisticsFromAllFlowTablesOutput, FlowsStatisticsUpdate> {
private final MultipartRequestFlowCase flowCase;
+ private final ConvertorExecutor convertorExecutor;
public AllFlowsInAllTablesService(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
- final AtomicLong compatibilityXidSeed) {
+ final AtomicLong compatibilityXidSeed, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
@Override
public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
}
}
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
public class AllFlowsInTableService extends AbstractCompatibleStatService<GetAllFlowStatisticsFromFlowTableInput,
GetAllFlowStatisticsFromFlowTableOutput, FlowsStatisticsUpdate> {
+ private final ConvertorExecutor convertorExecutor;
private Function<? super RpcResult<List<MultipartReply>>, FlowsStatisticsUpdate> transformer;
- public AllFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ public AllFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
}
@Override
@Override
public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> mpResult, TransactionId emulatedTxId) {
- return FlowStatisticsToNotificationTransformer.transformToNotification(mpResult, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return FlowStatisticsToNotificationTransformer.transformToNotification(mpResult, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
}
}
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.GroupStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
GROUP_CASE = caseBuilder.build();
}
+ private final ConvertorExecutor convertorExecutor;
- public AllGroupsStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+
+ public AllGroupsStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
}
@Override
public GroupStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId);
+ return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId, convertorExecutor);
}
}
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
METER_CONFIG_CASE = caseBuilder.build();
}
- public AllMeterConfigStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
+ public AllMeterConfigStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase) mpReply.getMultipartReplyBody();
MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
- final Optional<List<MeterConfigStats>> meterConfigStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterConfig());
+ final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
if (meterConfigStatsList.isPresent()) {
message.getMeterConfigStats().addAll(meterConfigStatsList.get());
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.MeterStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
METER_CASE = caseBuilder.build();
}
- public AllMeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ private final ConvertorExecutor convertorExecutor;
+
+ public AllMeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
}
@Override
@Override
public MeterStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
}
}
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
public final class FlowsInTableService extends AbstractCompatibleStatService<GetFlowStatisticsFromFlowTableInput,
GetFlowStatisticsFromFlowTableOutput, FlowsStatisticsUpdate> {
- public FlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ private final ConvertorExecutor convertorExecutor;
+
+ public FlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
}
@Override
// convert and inject match
final short version = getVersion();
- MatchReactor.getInstance().convert(input.getMatch(), version, mprFlowRequestBuilder);
+ MatchReactor.getInstance().convert(input.getMatch(), version, mprFlowRequestBuilder, convertorExecutor);
// Set request body to main multipart request
multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
@Override
public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
}
}
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
final class GroupDescriptionService
extends AbstractCompatibleStatService<GetGroupDescriptionInput, GetGroupDescriptionOutput, GroupDescStatsUpdated> {
private static final MultipartRequestGroupDescCase GROUP_DESC_CASE = new MultipartRequestGroupDescCaseBuilder().build();
+ private final ConvertorExecutor convertorExecutor;
- public GroupDescriptionService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ public GroupDescriptionService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
}
@Override
for (MultipartReply mpReply : result) {
MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase) mpReply.getMultipartReplyBody();
MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
- final Optional<List<GroupDescStats>> groupDescStatsList = ConvertorManager.getInstance().convert(
+ final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(
replyBody.getGroupDesc(), data);
if (groupDescStatsList.isPresent()) {
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.GroupStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
final class GroupStatsService
extends AbstractCompatibleStatService<GetGroupStatisticsInput, GetGroupStatisticsOutput, GroupStatisticsUpdated> {
- public GroupStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ private final ConvertorExecutor convertorExecutor;
+
+ public GroupStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
}
@Override
@Override
public GroupStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId);
+ return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId, convertorExecutor);
}
}
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.services.AbstractMultipartService;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
final class MatchingFlowsInTableService extends AbstractMultipartService<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput> {
- public MatchingFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ private final ConvertorExecutor convertorExecutor;
+
+ public MatchingFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext);
+ this.convertorExecutor = convertorExecutor;
}
@Override
mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
}
- MatchReactor.getInstance().convert(input.getMatch(), version, mprAggregateRequestBuilder);
+ MatchReactor.getInstance().convert(input.getMatch(), version, mprAggregateRequestBuilder, convertorExecutor);
FlowCreatorUtil.setWildcardedFlowMatch(version, mprAggregateRequestBuilder);
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.MeterStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
final class MeterStatsService
extends AbstractCompatibleStatService<GetMeterStatisticsInput, GetMeterStatisticsOutput, MeterStatisticsUpdated> {
- public MeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ private final ConvertorExecutor convertorExecutor;
+
+ public MeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
+ this.convertorExecutor = convertorExecutor;
}
@Override
@Override
public MeterStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
}
}
import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.api.openflow.statistics.compatibility.Delegator;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
private OpendaylightFlowStatisticsService delegate;
public static OpendaylightFlowStatisticsServiceImpl createWithOook(final RequestContextStack requestContextStack,
- final DeviceContext deviceContext) {
- return new OpendaylightFlowStatisticsServiceImpl(requestContextStack, deviceContext, deviceContext.oook());
+ final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
+ return new OpendaylightFlowStatisticsServiceImpl(requestContextStack, deviceContext, deviceContext.oook(), convertorExecutor);
}
public OpendaylightFlowStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
- final TranslatorLibrary translatorLibrary) {
- matchingFlowsInTable = new MatchingFlowsInTableService(requestContextStack, deviceContext);
+ final TranslatorLibrary translatorLibrary, final ConvertorExecutor convertorExecutor) {
+ matchingFlowsInTable = new MatchingFlowsInTableService(requestContextStack, deviceContext, convertorExecutor);
this.translatorLibrary = translatorLibrary;
}
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
public OpendaylightGroupStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
final AtomicLong compatibilityXidSeed,
- final NotificationPublishService notificationPublishService) {
+ final NotificationPublishService notificationPublishService,
+ final ConvertorExecutor convertorExecutor) {
this.notificationPublishService = notificationPublishService;
- allGroups = new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
- groupDesc = new GroupDescriptionService(requestContextStack, deviceContext, compatibilityXidSeed);
+ allGroups = new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ groupDesc = new GroupDescriptionService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
groupFeat = new GroupFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
- groupStats = new GroupStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+ groupStats = new GroupStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
}
@Override
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
public OpendaylightMeterStatisticsServiceImpl(final RequestContextStack requestContextStack,
final DeviceContext deviceContext,
final AtomicLong compatibilityXidSeed,
- final NotificationPublishService notificationPublishService) {
+ final NotificationPublishService notificationPublishService,
+ final ConvertorExecutor convertorExecutor) {
this.notificationPublishService = notificationPublishService;
- allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
- allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+ allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
meterFeatures = new MeterFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
- meterStats = new MeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+ meterStats = new MeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
}
@Override
import java.util.Optional;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdateBuilder;
* @param deviceInfo device state
* @param ofVersion device version
* @param emulatedTxId
+ * @param convertorExecutor
* @return notification containing flow stats
*/
public static FlowsStatisticsUpdate transformToNotification(final List<MultipartReply> mpResult,
final DeviceInfo deviceInfo,
final OpenflowVersion ofVersion,
- final TransactionId emulatedTxId) {
+ final TransactionId emulatedTxId,
+ final ConvertorExecutor convertorExecutor) {
final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(ofVersion.getVersion());
data.setDatapathId(deviceInfo.getDatapathId());
final FlowsStatisticsUpdateBuilder notification = new FlowsStatisticsUpdateBuilder();
MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpRawReply.getMultipartReplyBody();
MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
final Optional<List<FlowAndStatisticsMapList>> outStatsItem =
- ConvertorManager.getInstance().convert(replyBody.getFlowStats(), data);
+ convertorExecutor.convert(replyBody.getFlowStats(), data);
if (outStatsItem.isPresent()) {
import java.util.List;
import java.util.Optional;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder;
* @param mpReplyList raw multipart response from device
* @param deviceInfo device state
* @param emulatedTxId
+ * @param convertorExecutor
* @return notification containing flow stats
*/
public static GroupStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList,
final DeviceInfo deviceInfo,
- final TransactionId emulatedTxId) {
+ final TransactionId emulatedTxId,
+ final ConvertorExecutor convertorExecutor) {
+ VersionConvertorData data = new VersionConvertorData(deviceInfo.getVersion());
GroupStatisticsUpdatedBuilder notification = new GroupStatisticsUpdatedBuilder();
notification.setId(deviceInfo.getNodeId());
notification.setMoreReplies(Boolean.FALSE);
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
- final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(
- replyBody.getGroupStats());
+ final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(
+ replyBody.getGroupStats(), data);
if (groupStatsList.isPresent()) {
notification.getGroupStats().addAll(groupStatsList.get());
import java.util.Optional;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdatedBuilder;
* @param deviceInfo device state
* @param ofVersion device version
* @param emulatedTxId
+ * @param convertorExecutor
* @return notification containing flow stats
*/
public static MeterStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList,
final DeviceInfo deviceInfo,
final OpenflowVersion ofVersion,
- final TransactionId emulatedTxId) {
+ final TransactionId emulatedTxId,
+ final ConvertorExecutor convertorExecutor) {
+ VersionConvertorData data = new VersionConvertorData(deviceInfo.getVersion());
MeterStatisticsUpdatedBuilder notification = new MeterStatisticsUpdatedBuilder();
notification.setId(deviceInfo.getNodeId());
notification.setMoreReplies(Boolean.FALSE);
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
- final Optional<List<MeterStats>> meterStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+ final Optional<List<MeterStats>> meterStatsList = convertorExecutor.convert(replyBody.getMeterStats(), data);
if (meterStatsList.isPresent()) {
notification.getMeterStats().addAll(meterStatsList.get());
import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInAllTablesService;
import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInTableService;
import org.opendaylight.openflowplugin.impl.statistics.services.FlowsInTableService;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
public OpendaylightFlowStatisticsServiceDelegateImpl(final RequestContextStack requestContextStack,
final DeviceContext deviceContext,
final NotificationPublishService notificationService,
- final AtomicLong compatibilityXidSeed) {
+ final AtomicLong compatibilityXidSeed,
+ final ConvertorExecutor convertorExecutor) {
this.notificationService = notificationService;
aggregateFlowsInTable = AggregateFlowsInTableService.createWithOook(requestContextStack, deviceContext, compatibilityXidSeed);
- allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack, deviceContext, compatibilityXidSeed);
- allFlowsInTable = new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed);
- flowsInTable = new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed);
+ allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ allFlowsInTable = new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ flowsInTable = new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
}
/**
import org.opendaylight.openflowplugin.impl.common.MultipartRequestInputFactory;
import org.opendaylight.openflowplugin.impl.services.AbstractMultipartOnTheFlyService;
import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
private static final Logger LOG = LoggerFactory.getLogger(StatisticsGatheringOnTheFlyService.class);
- public StatisticsGatheringOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
- super(requestContextStack, deviceContext);
+ public StatisticsGatheringOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
+ super(requestContextStack, deviceContext, convertorExecutor);
}
@Override
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.impl.services.AbstractMultipartService;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.StoreStatsGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
};
private final MultipartType multipartType;
+ private final ConvertorExecutor convertorExecutor;
private final OpenflowVersion ofVersion = OpenflowVersion.get(getVersion());
-
/**
* Instantiates a new Abstract direct statistics service.
*
* @param multipartType the multipart type
* @param requestContextStack the request context stack
* @param deviceContext the device context
+ * @param convertorExecutor
*/
- protected AbstractDirectStatisticsService(MultipartType multipartType, RequestContextStack requestContextStack, DeviceContext deviceContext) {
+ protected AbstractDirectStatisticsService(MultipartType multipartType, RequestContextStack requestContextStack,
+ DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext);
this.multipartType = multipartType;
+ this.convertorExecutor = convertorExecutor;
+ }
+
+ protected ConvertorExecutor getConvertorExecutor() {
+ return convertorExecutor;
}
/**
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey;
import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput;
* The Flow direct statistics service.
*/
public class FlowDirectStatisticsService extends AbstractDirectStatisticsService<GetFlowStatisticsInput, GetFlowStatisticsOutput> {
+ private final VersionDatapathIdConvertorData data;
+
/**
* Instantiates a new Flow direct statistics service.
- *
- * @param requestContextStack the request context stack
+ * @param requestContextStack the request context stack
* @param deviceContext the device context
+ * @param convertorExecutor
*/
- public FlowDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
- super(MultipartType.OFPMPFLOW, requestContextStack, deviceContext);
+ public FlowDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+ super(MultipartType.OFPMPFLOW, requestContextStack, deviceContext, convertorExecutor);
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getDatapathId());
}
@Override
mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
}
- MatchReactor.getInstance().convert(input.getMatch(), getVersion(), mprFlowRequestBuilder);
+ MatchReactor.getInstance().convert(input.getMatch(), getVersion(), mprFlowRequestBuilder, getConvertorExecutor());
return new MultipartRequestFlowCaseBuilder()
.setMultipartRequestFlow(mprFlowRequestBuilder.build())
@Override
protected GetFlowStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
final List<FlowAndStatisticsMapList> statsList = new ArrayList<>();
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getDatapathId());
if (success) {
for (final MultipartReply mpReply : input) {
final MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpReply.getMultipartReplyBody();
final MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
- final Optional<List<FlowAndStatisticsMapList>> statsListPart = ConvertorManager.getInstance().convert(
+ final Optional<List<FlowAndStatisticsMapList>> statsListPart = getConvertorExecutor().convert(
replyBody.getFlowStats(), data);
if (statsListPart.isPresent()) {
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsOutputBuilder;
* The Group direct statistics service.
*/
public class GroupDirectStatisticsService extends AbstractDirectStatisticsService<GetGroupStatisticsInput, GetGroupStatisticsOutput> {
+ private final VersionConvertorData data;
+
/**
* Instantiates a new Group direct statistics service.
- *
- * @param requestContextStack the request context stack
+ * @param requestContextStack the request context stack
* @param deviceContext the device context
+ * @param convertorExecutor
*/
- public GroupDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
- super(MultipartType.OFPMPGROUP, requestContextStack, deviceContext);
+ public GroupDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+ super(MultipartType.OFPMPGROUP, requestContextStack, deviceContext, convertorExecutor);
+ data = new VersionConvertorData(getVersion());
}
@Override
for (final MultipartReply mpReply : input) {
final MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
final MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
- final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(
- replyBody.getGroupStats());
+ final Optional<List<GroupStats>> groupStatsList = getConvertorExecutor().convert(
+ replyBody.getGroupStats(), data);
if (groupStatsList.isPresent()) {
groupStats.addAll(groupStatsList.get());
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsOutputBuilder;
* The Meter direct statistics service.
*/
public class MeterDirectStatisticsService extends AbstractDirectStatisticsService<GetMeterStatisticsInput, GetMeterStatisticsOutput> {
+ private final VersionConvertorData data;
+
/**
* Instantiates a new Meter direct statistics service.
- *
- * @param requestContextStack the request context stack
+ * @param requestContextStack the request context stack
* @param deviceContext the device context
+ * @param convertorExecutor
*/
- public MeterDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
- super(MultipartType.OFPMPMETER, requestContextStack, deviceContext);
+ public MeterDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+ super(MultipartType.OFPMPMETER, requestContextStack, deviceContext, convertorExecutor);
+ data = new VersionConvertorData(getVersion());
}
@Override
for (final MultipartReply mpReply : input) {
final MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
final MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
- final Optional<List<MeterStats>> meterStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+ final Optional<List<MeterStats>> meterStatsList = getConvertorExecutor().convert(replyBody.getMeterStats(), data);
if (meterStatsList.isPresent()) {
meterStats.addAll(meterStatsList.get());
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInput;
public class NodeConnectorDirectStatisticsService extends AbstractDirectStatisticsService<GetNodeConnectorStatisticsInput, GetNodeConnectorStatisticsOutput> {
/**
* Instantiates a new Node connector direct statistics service.
- *
- * @param requestContextStack the request context stack
+ * @param requestContextStack the request context stack
* @param deviceContext the device context
+ * @param convertorExecutor
*/
- public NodeConnectorDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
- super(MultipartType.OFPMPPORTSTATS, requestContextStack, deviceContext);
+ public NodeConnectorDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+ super(MultipartType.OFPMPPORTSTATS, requestContextStack, deviceContext, convertorExecutor);
}
@Override
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
public class QueueDirectStatisticsService extends AbstractDirectStatisticsService<GetQueueStatisticsInput, GetQueueStatisticsOutput> {
/**
* Instantiates a new Queue direct statistics service.
- *
- * @param requestContextStack the request context stack
+ * @param requestContextStack the request context stack
* @param deviceContext the device context
+ * @param convertorExecutor
*/
- public QueueDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
- super(MultipartType.OFPMPQUEUE, requestContextStack, deviceContext);
+ public QueueDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+ super(MultipartType.OFPMPQUEUE, requestContextStack, deviceContext, convertorExecutor);
}
@Override
import java.util.Optional;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
* translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions)
*/
public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved> {
+ private final ConvertorExecutor convertorExecutor;
+
+ public FlowRemovedTranslator(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
+
+ protected ConvertorExecutor getConvertorExecutor() {
+ return convertorExecutor;
+ }
@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved translate(FlowRemoved input, DeviceInfo deviceInfo, Object connectionDistinguisher) {
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
- final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(
+ final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
flowRemoved.getMatch(),
datapathIdConvertorData);
import java.util.Optional;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
*/
public class FlowRemovedV10Translator extends FlowRemovedTranslator {
+ public FlowRemovedV10Translator(ConvertorExecutor convertorExecutor) {
+ super(convertorExecutor);
+ }
+
@Override
protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
- final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(
+ final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
flowRemoved.getMatchV10(),
datapathIdConvertorData);
import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
import org.opendaylight.openflowplugin.impl.util.NodeConnectorRefToPortTranslator;
import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.PacketInUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
* Created by tkubas on 4/1/15.
*/
public class PacketReceivedTranslator implements MessageTranslator<PacketInMessage, PacketReceived> {
+ private final ConvertorExecutor convertorExecutor;
+
+ public PacketReceivedTranslator(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
+
@Override
public PacketReceived translate(final PacketInMessage input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
}
@VisibleForTesting
- static org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(input.getVersion());
datapathIdConvertorData.setDatapathId(datapathId);
- final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder> matchOptional = ConvertorManager.getInstance().convert(input.getMatch(), datapathIdConvertorData);
+ final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder> matchOptional = convertorExecutor.convert(input.getMatch(), datapathIdConvertorData);
final MatchBuilder matchBuilder = matchOptional.isPresent() ?
new MatchBuilder(matchOptional.get().build()) :
new MatchBuilder();
import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
*
* @param deviceContext
* @param switchFeaturesMandatory
+ * @param convertorExecutor
* @return future - recommended to have blocking call for this future
*/
- public static ListenableFuture<Void> initializeNodeInformation(final DeviceContext deviceContext, final boolean switchFeaturesMandatory) {
+ public static ListenableFuture<Void> initializeNodeInformation(final DeviceContext deviceContext, final boolean switchFeaturesMandatory, final ConvertorExecutor convertorExecutor) {
Preconditions.checkArgument(deviceContext != null);
final DeviceState deviceState = Preconditions.checkNotNull(deviceContext.getDeviceState());
final DeviceInfo deviceInfo = deviceContext.getDeviceInfo();
final Capabilities capabilities = connectionContext.getFeatures().getCapabilities();
LOG.debug("Setting capabilities for device {}", deviceInfo.getNodeId());
DeviceStateUtil.setDeviceStateBasedOnV13Capabilities(deviceState, capabilities);
- deviceFeaturesFuture = createDeviceFeaturesForOF13(deviceContext, deviceState, switchFeaturesMandatory);
+ deviceFeaturesFuture = createDeviceFeaturesForOF13(deviceContext, switchFeaturesMandatory, convertorExecutor);
} else {
deviceFeaturesFuture = Futures.immediateFailedFuture(new ConnectionException("Unsupported version "
+ version));
}
private static ListenableFuture<List<RpcResult<List<MultipartReply>>>> createDeviceFeaturesForOF13(
- final DeviceContext deviceContext, final DeviceState deviceState, final boolean switchFeaturesMandatory) {
+ final DeviceContext deviceContext, final boolean switchFeaturesMandatory, final ConvertorExecutor convertorExecutor) {
final ListenableFuture<RpcResult<List<MultipartReply>>> replyDesc = getNodeStaticInfo(MultipartType.OFPMPDESC,
deviceContext, deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
final RpcResult<List<MultipartReply>> rpcResult) throws Exception {
translateAndWriteReply(MultipartType.OFPMPDESC, deviceContext,
- deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), rpcResult.getResult());
+ deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), rpcResult.getResult(), convertorExecutor);
final ListenableFuture<RpcResult<List<MultipartReply>>> replyMeterFeature = getNodeStaticInfo(
MultipartType.OFPMPMETERFEATURES, deviceContext,
deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
createSuccessProcessingCallback(MultipartType.OFPMPMETERFEATURES, deviceContext,
- deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyMeterFeature);
+ deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyMeterFeature, convertorExecutor);
final ListenableFuture<RpcResult<List<MultipartReply>>> replyGroupFeatures = getNodeStaticInfo(
MultipartType.OFPMPGROUPFEATURES, deviceContext,
deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
createSuccessProcessingCallback(MultipartType.OFPMPGROUPFEATURES, deviceContext,
- deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyGroupFeatures);
+ deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyGroupFeatures, convertorExecutor);
final ListenableFuture<RpcResult<List<MultipartReply>>> replyTableFeatures = getNodeStaticInfo(
MultipartType.OFPMPTABLEFEATURES, deviceContext,
deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
createSuccessProcessingCallback(MultipartType.OFPMPTABLEFEATURES, deviceContext,
- deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyTableFeatures);
+ deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyTableFeatures, convertorExecutor);
final ListenableFuture<RpcResult<List<MultipartReply>>> replyPortDescription = getNodeStaticInfo(
MultipartType.OFPMPPORTDESC, deviceContext, deviceContext.getDeviceInfo().getNodeInstanceIdentifier(),
deviceContext.getDeviceInfo().getVersion());
createSuccessProcessingCallback(MultipartType.OFPMPPORTDESC, deviceContext,
- deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyPortDescription);
+ deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyPortDescription, convertorExecutor);
if (switchFeaturesMandatory) {
return Futures.allAsList(Arrays.asList(replyMeterFeature, replyGroupFeatures,
replyTableFeatures, replyPortDescription));
}
static void translateAndWriteReply(final MultipartType type, final DeviceContext dContext,
- final InstanceIdentifier<Node> nodeII, final Collection<MultipartReply> result) {
+ final InstanceIdentifier<Node> nodeII, final Collection<MultipartReply> result,
+ final ConvertorExecutor convertorExecutor) {
try {
for (final MultipartReply reply : result) {
final MultipartReplyBody body = reply.getMultipartReplyBody();
final MultipartReplyTableFeatures tableFeaturesMP = ((MultipartReplyTableFeaturesCase) body)
.getMultipartReplyTableFeatures();
final List<TableFeatures> tableFeatures = NodeStaticReplyTranslatorUtil
- .nodeTableFeatureTranslator(tableFeaturesMP);
+ .nodeTableFeatureTranslator(tableFeaturesMP, dContext.getDeviceInfo().getVersion(), convertorExecutor);
for (final TableFeatures tableFeature : tableFeatures) {
final Short tableId = tableFeature.getTableId();
final KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> tableFeaturesII =
static void createSuccessProcessingCallback(final MultipartType type, final DeviceContext deviceContext,
final InstanceIdentifier<Node> nodeII,
- final ListenableFuture<RpcResult<List<MultipartReply>>> requestContextFuture) {
+ final ListenableFuture<RpcResult<List<MultipartReply>>> requestContextFuture,
+ final ConvertorExecutor convertorExecutor) {
Futures.addCallback(requestContextFuture, new FutureCallback<RpcResult<List<MultipartReply>>>() {
@Override
public void onSuccess(final RpcResult<List<MultipartReply>> rpcResult) {
final List<MultipartReply> result = rpcResult.getResult();
if (result != null) {
LOG.info("Static node {} info: {} collected", deviceContext.getDeviceInfo().getNodeId(), type);
- translateAndWriteReply(type, deviceContext, nodeII, result);
+ translateAndWriteReply(type, deviceContext, nodeII, result, convertorExecutor);
} else {
final Iterator<RpcError> rpcErrorIterator = rpcResult.getErrors().iterator();
while (rpcErrorIterator.hasNext()) {
package org.opendaylight.openflowplugin.impl.util;
import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
import com.google.common.reflect.TypeToken;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.CheckForNull;
import org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceImpl;
import org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider;
import org.opendaylight.openflowplugin.impl.statistics.services.direct.QueueDirectStatisticsService;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.OpendaylightDirectStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SalEchoService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SalExperimenterMessageService;
/**
* Method registers all OF services for role {@link OfpRole#BECOMEMASTER}
- *
- * @param rpcContext - registration processing is implemented in {@link RpcContext}
- * @param deviceContext - every service needs {@link DeviceContext} as input parameter
+ * @param rpcContext - registration processing is implemented in {@link org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext}
+ * @param deviceContext - every service needs {@link org.opendaylight.openflowplugin.api.openflow.device.DeviceContext} as input parameter
+ * @param convertorExecutor
*/
public static void registerServices(@CheckForNull final RpcContext rpcContext,
@CheckForNull final DeviceContext deviceContext,
- final ExtensionConverterProvider extensionConverterProvider) {
+ final ExtensionConverterProvider extensionConverterProvider,
+ final ConvertorExecutor convertorExecutor) {
Preconditions.checkArgument(rpcContext != null);
Preconditions.checkArgument(deviceContext != null);
// create service instances
- final SalFlowServiceImpl salFlowService = new SalFlowServiceImpl(rpcContext, deviceContext);
+ final SalFlowServiceImpl salFlowService = new SalFlowServiceImpl(rpcContext, deviceContext, convertorExecutor);
final FlowCapableTransactionServiceImpl flowCapableTransactionService = new FlowCapableTransactionServiceImpl(rpcContext, deviceContext);
- final SalGroupServiceImpl salGroupService = new SalGroupServiceImpl(rpcContext, deviceContext);
- final SalMeterServiceImpl salMeterService = new SalMeterServiceImpl(rpcContext, deviceContext);
+ final SalGroupServiceImpl salGroupService = new SalGroupServiceImpl(rpcContext, deviceContext, convertorExecutor);
+ final SalMeterServiceImpl salMeterService = new SalMeterServiceImpl(rpcContext, deviceContext, convertorExecutor);
// register routed service instances
rpcContext.registerRpcServiceImplementation(SalEchoService.class, new SalEchoServiceImpl(rpcContext, deviceContext));
rpcContext.registerRpcServiceImplementation(FlowCapableTransactionService.class, flowCapableTransactionService);
rpcContext.registerRpcServiceImplementation(SalMeterService.class, salMeterService);
rpcContext.registerRpcServiceImplementation(SalGroupService.class, salGroupService);
- rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl(rpcContext, deviceContext, deviceContext.getPrimaryConnectionContext().getNodeId()));
- rpcContext.registerRpcServiceImplementation(SalPortService.class, new SalPortServiceImpl(rpcContext, deviceContext));
- rpcContext.registerRpcServiceImplementation(PacketProcessingService.class, new PacketProcessingServiceImpl(rpcContext, deviceContext));
+ rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl(rpcContext, deviceContext, convertorExecutor));
+ rpcContext.registerRpcServiceImplementation(SalPortService.class, new SalPortServiceImpl(rpcContext, deviceContext, convertorExecutor));
+ rpcContext.registerRpcServiceImplementation(PacketProcessingService.class, new PacketProcessingServiceImpl(rpcContext, deviceContext, convertorExecutor));
rpcContext.registerRpcServiceImplementation(NodeConfigService.class, new NodeConfigServiceImpl(rpcContext, deviceContext));
- rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class, OpendaylightFlowStatisticsServiceImpl.createWithOook(rpcContext, deviceContext));
+ rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class, OpendaylightFlowStatisticsServiceImpl.createWithOook(rpcContext, deviceContext, convertorExecutor));
// Direct statistics gathering
final OpendaylightDirectStatisticsServiceProvider statisticsProvider = new OpendaylightDirectStatisticsServiceProvider();
- statisticsProvider.register(FlowDirectStatisticsService.class, new FlowDirectStatisticsService(rpcContext, deviceContext));
- statisticsProvider.register(GroupDirectStatisticsService.class, new GroupDirectStatisticsService(rpcContext, deviceContext));
- statisticsProvider.register(MeterDirectStatisticsService.class, new MeterDirectStatisticsService(rpcContext, deviceContext));
- statisticsProvider.register(NodeConnectorDirectStatisticsService.class, new NodeConnectorDirectStatisticsService(rpcContext, deviceContext));
- statisticsProvider.register(QueueDirectStatisticsService.class, new QueueDirectStatisticsService(rpcContext, deviceContext));
+ statisticsProvider.register(FlowDirectStatisticsService.class, new FlowDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+ statisticsProvider.register(GroupDirectStatisticsService.class, new GroupDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+ statisticsProvider.register(MeterDirectStatisticsService.class, new MeterDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+ statisticsProvider.register(NodeConnectorDirectStatisticsService.class, new NodeConnectorDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+ statisticsProvider.register(QueueDirectStatisticsService.class, new QueueDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
rpcContext.registerRpcServiceImplementation(OpendaylightDirectStatisticsService.class, new OpendaylightDirectStatisticsServiceImpl(statisticsProvider));
final SalFlatBatchServiceImpl salFlatBatchService = new SalFlatBatchServiceImpl(
/**
* Support deprecated statistic related services for backward compatibility. The only exception from deprecation is
* the aggregated flow statistic with match criteria input.
- *
- * @param rpcContext
+ * @param rpcContext
* @param deviceContext
* @param notificationPublishService
+ * @param convertorExecutor
*/
public static void registerStatCompatibilityServices(final RpcContext rpcContext, final DeviceContext deviceContext,
- final NotificationPublishService notificationPublishService) {
+ final NotificationPublishService notificationPublishService,
+ final ConvertorExecutor convertorExecutor) {
AtomicLong compatibilityXidSeed = new AtomicLong();
// pickup low statistics service
Preconditions.checkArgument(COMPOSITE_SERVICE_TYPE_TOKEN.isAssignableFrom(flowStatisticsService.getClass()));
// attach delegate to flow statistics service (to cover all but aggregated stats with match filter input)
final OpendaylightFlowStatisticsServiceDelegateImpl flowStatisticsDelegate =
- new OpendaylightFlowStatisticsServiceDelegateImpl(rpcContext, deviceContext, notificationPublishService, new AtomicLong());
+ new OpendaylightFlowStatisticsServiceDelegateImpl(rpcContext, deviceContext, notificationPublishService, new AtomicLong(), convertorExecutor);
((Delegator<OpendaylightFlowStatisticsService>) flowStatisticsService).setDelegate(flowStatisticsDelegate);
// register all statistics (deprecated) services
rpcContext.registerRpcServiceImplementation(OpendaylightFlowTableStatisticsService.class,
new OpendaylightFlowTableStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
rpcContext.registerRpcServiceImplementation(OpendaylightGroupStatisticsService.class,
- new OpendaylightGroupStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
+ new OpendaylightGroupStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
rpcContext.registerRpcServiceImplementation(OpendaylightMeterStatisticsService.class,
- new OpendaylightMeterStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
+ new OpendaylightMeterStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
rpcContext.registerRpcServiceImplementation(OpendaylightQueueStatisticsService.class,
new OpendaylightQueueStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
rpcContext.registerRpcServiceImplementation(OpendaylightPortStatisticsService.class,
import org.opendaylight.openflowplugin.impl.translator.PortUpdateTranslator;
import org.opendaylight.openflowplugin.impl.translator.TranslatorKeyFactory;
import org.opendaylight.openflowplugin.impl.translator.TranslatorLibraryBuilder;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
private static final TranslatorKeyFactory of13TranslatorKeyFactory = new TranslatorKeyFactory(OFConstants.OFP_VERSION_1_3);
private static final TranslatorKeyFactory of10TranslatorKeyFactory = new TranslatorKeyFactory(OFConstants.OFP_VERSION_1_0);
- private static final TranslatorLibrary basicTranslatorLibrary;
- static {
- basicTranslatorLibrary = new TranslatorLibraryBuilder().
- addTranslator(of13TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator()).
+ public static void injectBasicTranslatorLibrary(final TranslatorLibrarian librarian, final ConvertorExecutor convertorExecutor) {
+ final TranslatorLibrary basicTranslatorLibrary = new TranslatorLibraryBuilder().
+ addTranslator(of13TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator(convertorExecutor)).
addTranslator(of13TranslatorKeyFactory.createTranslatorKey(PortGrouping.class), new PortUpdateTranslator()).
addTranslator(of13TranslatorKeyFactory.createTranslatorKey(MultipartReplyAggregateCase.class), new AggregatedFlowStatisticsTranslator()).
- addTranslator(of13TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedTranslator()).
- addTranslator(of10TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator()).
+ addTranslator(of13TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedTranslator(convertorExecutor)).
+ addTranslator(of10TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator(convertorExecutor)).
addTranslator(of10TranslatorKeyFactory.createTranslatorKey(PortGrouping.class), new PortUpdateTranslator()).
addTranslator(of10TranslatorKeyFactory.createTranslatorKey(MultipartReplyAggregateCase.class), new AggregatedFlowStatisticsTranslator()).
- addTranslator(of10TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedV10Translator()).
+ addTranslator(of10TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedV10Translator(convertorExecutor)).
build();
- }
- public static void setBasicTranslatorLibrary(final TranslatorLibrarian librarian) {
librarian.setTranslatorLibrary(basicTranslatorLibrary);
}
}
import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
import org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
@Before
public void setUp() {
nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId));
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
- lifecycleConductor = new LifecycleConductorImpl(messageIntelligenceAgency);
+ lifecycleConductor = new LifecycleConductorImpl(messageIntelligenceAgency, convertorManager);
lifecycleConductor.setSafelyManager(deviceManager);
lifecycleConductor.setSafelyManager(statisticsManager);
lifecycleConductor.setSafelyManager(rpcManager);
import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
when(mockedWriteTransaction.submit()).thenReturn(mockedFuture);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
final DeviceManagerImpl deviceManager = new DeviceManagerImpl(mockedDataBroker,
- TEST_VALUE_GLOBAL_NOTIFICATION_QUOTA, false, barrierIntervalNanos, barrierCountLimit, lifecycleConductor, true);
+ TEST_VALUE_GLOBAL_NOTIFICATION_QUOTA, false, barrierIntervalNanos, barrierCountLimit, lifecycleConductor, true, convertorManager);
deviceManager.setDeviceInitializationPhaseHandler(deviceInitPhaseHandler);
deviceManager.setDeviceTerminationPhaseHandler(deviceTerminationPhaseHandler);
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
when(mockedDeviceState.deviceSynchronized()).thenReturn(true);
when(mockedDeviceInfo.getNodeId()).thenReturn(mockedNodeId);
when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN);
+ when(mockedDeviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
//NOOP
}
};
+
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
multipartRequestOnTheFlyCallback = new MultipartRequestOnTheFlyCallback(dummyRequestContext, String.class,
mockedDeviceContext.getMessageSpy(),dummyEventIdentifier, mockedDeviceInfo,
- mockedDeviceContext.getDeviceFlowRegistry(), mockedDeviceContext);
+ mockedDeviceContext.getDeviceFlowRegistry(), mockedDeviceContext, convertorManager);
}
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
@Override
protected void setup() {
- packetProcessingService = new PacketProcessingServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ packetProcessingService = new PacketProcessingServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
pathToNodeconnector = KeyedInstanceIdentifier.create(Nodes.class)
.child(Node.class, new NodeKey(new NodeId("ofp-ut:123")))
.child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("ofp-ut:123:1")));
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey;
import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
- salFlowService = new SalFlowServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ salFlowService = new SalFlowServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
}
@Test
import org.mockito.Mock;
import org.opendaylight.openflowplugin.api.openflow.registry.group.DeviceGroupRegistry;
import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
public void initialization() {
super.initialization();
when(mockedDeviceContext.getDeviceGroupRegistry()).thenReturn(mockedDeviceGroupRegistry);
- salGroupService = new SalGroupServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ salGroupService = new SalGroupServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
}
@Test
import org.mockito.Mock;
import org.opendaylight.openflowplugin.api.openflow.registry.meter.DeviceMeterRegistry;
import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
public void initialization() {
super.initialization();
when(mockedDeviceContext.getDeviceMeterRegistry()).thenReturn(mockedDeviceMeterRegistry);
- salMeterService = new SalMeterServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ salMeterService = new SalMeterServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
}
@Test
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
@Override
public void initialization() {
super.initialization();
- salPortService = new SalPortServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ salPortService = new SalPortServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
}
@Test
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;
.when(mockedOutboundQueue).commitEntry(
Matchers.anyLong(), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
salTableService = new SalTableServiceImpl(mockedRequestContextStack, mockedDeviceContext,
- mockedDeviceContext.getPrimaryConnectionContext().getNodeId());
+ convertorManager);
}
@Test
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
private static final BigInteger DUMMY_DATAPATH_ID = new BigInteger("21");
private static final Long DUMMY_XID = 1L;
- private static final SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator();
+ private SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator;
private static final BigInteger DUMMY_BYTE_COUNT = new BigInteger("31");
private static final BigInteger DUMMY_PACKET_COUNT = new BigInteger("41");
private static final Long DUMMY_FLOW_COUNT = 51L;
private static final GroupType DUMMY_GROUP_TYPE = GroupType.OFPGTALL;
private static final Long GROUP_ACTION_BITMAP = 0b00000000000000000000000000000000000001111111111111001100000000001L;
+ @Before
+ public void setUp() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorManager);
+ }
+
@Test
public void testTranslateFlow() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
mockConductor.setSafelyManager(mockedDeviceManager);
when(mockConductor.getDeviceContext(mockedDeviceInfo)).thenReturn(mockedDeviceContext);
-
}
}
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yangtools.yang.common.RpcResult;
@Test
public void gatherDynamicDataTest() {
-
- final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor, convertorManager);
final ListenableFuture<RpcResult<List<MultipartReply>>> rpcResult = immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build());
when(mockedStatisticsGatheringService.getStatisticsOfType(any(EventIdentifier.class), any(MultipartType
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yangtools.yang.common.RpcResult;
private static final Long TEST_XID = 55L;
private StatisticsContextImpl statisticsContext;
+ private ConvertorManager convertorManager;
@Before
public void setUp() throws Exception {
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
when(mockedDeviceContext.reserveXidForDeviceMessage()).thenReturn(TEST_XID);
when(mockConductor.getDeviceContext(mockedDeviceInfo)).thenReturn(mockedDeviceContext);
initStatisticsContext();
}
private void initStatisticsContext() {
- statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor);
+ statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor, convertorManager);
statisticsContext.setStatisticsGatheringService(mockedStatisticsGatheringService);
statisticsContext.setStatisticsGatheringOnTheFlyService(mockedStatisticsOnFlyGatheringService);
}
*/
@Test
public void testClose() throws Exception {
- final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor);
+ final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor, convertorManager);
final RequestContext<Object> requestContext = statisticsContext.createRequestContext();
statisticsContext.close();
try {
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.StatisticsGatherer;
import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
@Mock
private TxFacade txFacade;
+ private SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator;
+
public StatisticsGatheringUtilsTest() {
OpenflowPortsUtil.init();
}
@Before
public void setUp() throws Exception {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorManager);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry);
when(deviceInfo.getNodeId()).thenReturn(DUMMY_NODE_ID);
}
- @After
- public void tearDown() throws Exception {
-
- }
-
@Test
public void testWriteFlowStatistics() throws Exception {
final ArgumentCaptor<LogicalDatastoreType> dataStoreType = ArgumentCaptor.forClass(LogicalDatastoreType.class);
type,
txFacade,
deviceContext,
- false);
+ false,
+ singlePurposeMultipartReplyTranslator);
Assert.assertTrue(gatherStatisticsResult.get(1, TimeUnit.SECONDS).booleanValue());
verify(txFacade).submitTransaction();
}
import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
import org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
Matchers.eq(StatisticsManagerControlService.class),
Matchers.<StatisticsManagerControlService>any())).thenReturn(serviceControlRegistration);
- statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, false, conductor);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, false, conductor, convertorManager);
statisticsManager.setDeviceInitializationPhaseHandler(deviceInitializationPhaseHandler);
when(conductor.getDeviceContext(deviceInfo)).thenReturn(mockedDeviceContext);
}
Mockito.when(getFeaturesOutput.getDatapathId()).thenReturn(BigInteger.valueOf(123L));
Mockito.when(getFeaturesOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
-
setUp();
}
import org.mockito.Captor;
import org.mockito.Mockito;
import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
public void setUp() {
- flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
rqContext = new AbstractRequestContext<Object>(42L) {
@Override
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatistics;
public void setUp() {
- flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
rqContextMp = new AbstractRequestContext<List<MultipartReply>>(42L) {
@Override
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
public void setUp() {
- flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
flowStatisticsService.setDelegate(flowStatisticsDelegate);
}
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInputBuilder;
private OpendaylightGroupStatisticsServiceImpl groupStatisticsService;
public void setUp() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
groupStatisticsService = new OpendaylightGroupStatisticsServiceImpl(rqContextStack, deviceContext,
- new AtomicLong(), notificationPublishService);
+ new AtomicLong(), notificationPublishService, convertorManager);
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
.commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInputBuilder;
private OpendaylightMeterStatisticsServiceImpl meterStatisticsService;
public void setUp() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
meterStatisticsService = new OpendaylightMeterStatisticsServiceImpl(rqContextStack, deviceContext,
- new AtomicLong(), notificationPublishService);
+ new AtomicLong(), notificationPublishService, convertorManager);
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
.commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.impl.statistics.services.AbstractSingleStatsServiceTest;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
@Override
public void setUp() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
flowStatisticsServiceDelegate = new OpendaylightFlowStatisticsServiceDelegateImpl(
- rqContextStack, deviceContext, notificationPublishService, new AtomicLong(21));
+ rqContextStack, deviceContext, notificationPublishService, new AtomicLong(21), convertorManager);
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
.commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.impl.services.ServiceMocking;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
@Override
protected void setup() {
- statisticsGatheringService = new StatisticsGatheringOnTheFlyService(mockedRequestContextStack, mockedDeviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ statisticsGatheringService = new StatisticsGatheringOnTheFlyService(mockedRequestContextStack, mockedDeviceContext, convertorManager);
Mockito.doReturn(NODE_ID).when(mockedPrimConnectionContext).getNodeId();
Mockito.when(mockedDeviceInfo.getNodeId()).thenReturn(NODE_ID);
Mockito.when(mockedDeviceContext.getDeviceInfo().getNodeId()).thenReturn(NODE_ID);
import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
protected NodeConnectorId nodeConnectorId;
protected KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier;
+ protected ConvertorManager convertorManager;
protected static NodeRef createNodeRef(String nodeIdValue) {
InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class)
.create(Nodes.class)
.child(Node.class, new NodeKey(new NodeId(NODE_ID)));
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
+
when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector);
@Override
public void setUp() throws Exception {
- service = new FlowDirectStatisticsService(requestContextStack, deviceContext);
+ service = new FlowDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
final DeviceFlowRegistry registry = mock(DeviceFlowRegistry.class);
when(registry.storeIfNecessary(any())).thenReturn(new FlowId("1"));
when(deviceContext.getDeviceFlowRegistry()).thenReturn(registry);
@Override
public void setUp() throws Exception {
- service = new GroupDirectStatisticsService(requestContextStack, deviceContext);
+ service = new GroupDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
}
@Override
@Override
public void setUp() throws Exception {
- service = new MeterDirectStatisticsService(requestContextStack, deviceContext);
+ service = new MeterDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
}
@Override
@Override
public void setUp() throws Exception {
- service = new NodeConnectorDirectStatisticsService(requestContextStack, deviceContext);
+ service = new NodeConnectorDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
}
@Override
@Override
public void setUp() throws Exception {
- service = new QueueDirectStatisticsService(requestContextStack, deviceContext);
+ service = new QueueDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
}
@Override
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
nodeId = InstanceIdentifier.create(Nodes.class)
.child(Node.class, new NodeKey(new NodeId("dummyNodeId")));
- translator = new FlowRemovedTranslator();
- translatorV10 = new FlowRemovedV10Translator();
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ translator = new FlowRemovedTranslator(convertorManager);
+ translatorV10 = new FlowRemovedV10Translator(convertorManager);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeId);
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@Mock
PhyPort phyPort;
+ ConvertorManager convertorManager;
+
static final Long PORT_NO = 5l;
static final Long PORT_NO_DS = 6l;
static final String DATA = "Test_Data";
@Before
public void setUp() throws Exception {
final List<PhyPort> phyPorts = Arrays.asList(phyPort);
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
Mockito.when(connectionContext.getFeatures()).thenReturn(featuresReply);
final KeyedInstanceIdentifier<Node, NodeKey> nodePath = KeyedInstanceIdentifier
.create(Nodes.class)
.child(Node.class, new NodeKey(new NodeId("openflow:10")));
- final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator();
+ final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator(convertorManager);
final PacketInMessage packetInMessage = createPacketInMessage(DATA.getBytes(), PORT_NO);
Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
.setVersion(OFConstants.OFP_VERSION_1_3);
BigInteger dpid = BigInteger.TEN;
- final Match packetInMatch = PacketReceivedTranslator.getPacketInMatch(inputBld.build(), dpid);
+ final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator(convertorManager);
+ final Match packetInMatch = packetReceivedTranslator.getPacketInMatch(inputBld.build(), dpid);
Assert.assertNotNull(packetInMatch.getInPort());
Assert.assertEquals("openflow:10:" + PORT_NUM_VALUE, packetInMatch.getInPort().getValue());
import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.impl.device.DeviceContextImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@Mock
private DeviceInfo deviceInfo;
+ private ConvertorManager convertorManager;
+
@Before
public void setUp() throws Exception {
OpenflowPortsUtil.init();
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
when(mockConnectionContext.getNodeId()).thenReturn(new NodeId(DUMMY_NODE_ID));
when(mockConnectionContext.getFeatures()).thenReturn(mockFeatures);
final ConnectionContext connectionContext = buildMockConnectionContext(OFConstants.OFP_VERSION_1_0);
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
- DeviceInitializationUtils.initializeNodeInformation(mockedDeviceContext, true);
+ DeviceInitializationUtils.initializeNodeInformation(mockedDeviceContext, true, convertorManager);
verify(mockFeatures, atLeastOnce()).getPhyPort();
verify(tLibrary, atLeastOnce()).lookupTranslator(any(TranslatorKey.class));
final Collection<MultipartReply> multipartReplyMessages = prepareDataforTypeDesc(mockedDeviceContext);
- DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+ DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
verify(mockedDeviceContext)
.writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
}
@Test
public void translateAndWriteReplyTypeTableFeatures() throws Exception {
+ when(mockedDeviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
TableFeaturesBuilder tableFeature = new TableFeaturesBuilder();
tableFeature.setTableId(DUMMY_TABLE_ID);
final List<TableFeatures> tableFeatures = new ArrayList<>();
final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyTableFeaturesCaseBuilder.build()).build();
final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
- DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPTABLEFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+ DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPTABLEFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
verify(mockedDeviceContext)
.writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL),
eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(DUMMY_TABLE_ID))), any(Table.class));
final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyMeterFeaturesCaseBuilder.build()).build();
final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
- DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPMETERFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+ DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPMETERFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
verify(mockedDeviceContext)
.writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(NodeMeterFeatures.class)), any(NodeMeterFeatures.class));
verify(mockedDeviceState).setMeterAvailable(eq(true));
final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyGroupFeaturesCaseBuilder.build()).build();
final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
- DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPGROUPFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+ DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPGROUPFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
verify(mockedDeviceContext)
.writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(NodeGroupFeatures.class)), any(NodeGroupFeatures.class));
}
final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
OpenflowPortsUtil.init();
- DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPPORTDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+ DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPPORTDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL),
Matchers.<InstanceIdentifier<NodeConnector>> any(), any(NodeConnector.class));
}
final RpcResult<List<MultipartReply>> result = RpcResultBuilder.<List<MultipartReply>>success(multipartReplies).build();
ListenableFuture<RpcResult<List<MultipartReply>>> mockedRequestContextFuture = Futures.immediateFuture(result);
- DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture);
+ DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture, convertorManager);
verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
final RpcResult<List<MultipartReply>> rpcResult = RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.PROTOCOL, "dummy error").build();
mockedRequestContextFuture = Futures.immediateFuture(rpcResult);
- DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture);
+ DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture, convertorManager);
verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
}
import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
import org.opendaylight.yangtools.yang.binding.RpcService;
public class MdSalRegistrationUtilsTest {
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext);
final ExtensionConverterProvider extensionConverterProvider = mock(ExtensionConverterProvider.class);
- MdSalRegistrationUtils.registerServices(mockedRpcContext, mockedDeviceContext, extensionConverterProvider);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ MdSalRegistrationUtils.registerServices(mockedRpcContext, mockedDeviceContext, extensionConverterProvider, convertorManager);
verify(mockedRpcContext, times(NUMBER_OF_RPC_SERVICE_REGISTRATION)).registerRpcServiceImplementation(
Matchers.<Class<RpcService>> any(), any(RpcService.class));
}
import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
import org.opendaylight.openflowplugin.api.openflow.translator.TranslatorLibrarian;
import org.opendaylight.openflowplugin.impl.translator.TranslatorKeyFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
@Test
public void setBasicTranslatorLibraryTest() {
- TranslatorLibraryUtil.setBasicTranslatorLibrary(translatorLibrarian);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ TranslatorLibraryUtil.injectBasicTranslatorLibrary(translatorLibrarian, convertorManager);
TranslatorLibrary translatorLibrary = translatorLibrarian.oook();
TranslatorKeyFactory of13TranslatorKeyFactory = new TranslatorKeyFactory(OFP_VERSION_1_3);
import org.opendaylight.openflowplugin.api.openflow.md.queue.PopListener;
import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy;
import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.translator.ErrorTranslator;
import org.opendaylight.openflowplugin.openflow.md.core.translator.ErrorV10Translator;
public class MDController implements IMDController, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(MDController.class);
+ private final ConvertorExecutor convertorExecutor;
private Collection<SwitchConnectionProvider> switchConnectionProviders;
private ExtensionConverterProvider extensionConverterProvider;
+ public MDController(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
+
/**
* @return translator mapping
*/
//TODO: move registration to factory
addMessageTranslator(ErrorMessage.class, OF10, new ErrorV10Translator());
addMessageTranslator(ErrorMessage.class, OF13, new ErrorTranslator());
- addMessageTranslator(FlowRemovedMessage.class, OF10, new FlowRemovedTranslator());
- addMessageTranslator(FlowRemovedMessage.class, OF13, new FlowRemovedTranslator());
+ addMessageTranslator(FlowRemovedMessage.class, OF10, new FlowRemovedTranslator(convertorExecutor));
+ addMessageTranslator(FlowRemovedMessage.class, OF13, new FlowRemovedTranslator(convertorExecutor));
addMessageTranslator(PacketInMessage.class,OF10, new PacketInV10Translator());
- addMessageTranslator(PacketInMessage.class,OF13, new PacketInTranslator());
+ addMessageTranslator(PacketInMessage.class,OF13, new PacketInTranslator(convertorExecutor));
addMessageTranslator(PortStatusMessage.class,OF10, new PortStatusMessageToNodeConnectorUpdatedTranslator());
addMessageTranslator(PortStatusMessage.class,OF13, new PortStatusMessageToNodeConnectorUpdatedTranslator());
addMessageTranslator(MultipartReplyMessage.class,OF13,new MultiPartReplyPortToNodeConnectorUpdatedTranslator());
addMessageTranslator(MultipartReplyMessage.class,OF10, new MultiPartMessageDescToNodeUpdatedTranslator());
addMessageTranslator(MultipartReplyMessage.class,OF13, new MultiPartMessageDescToNodeUpdatedTranslator());
addMessageTranslator(ExperimenterMessage.class, OF10, new ExperimenterTranslator());
- addMessageTranslator(MultipartReplyMessage.class,OF10, new MultipartReplyTranslator());
- addMessageTranslator(MultipartReplyMessage.class,OF13, new MultipartReplyTranslator());
- addMessageTranslator(MultipartReplyMessage.class,OF13,new MultipartReplyTableFeaturesToTableUpdatedTranslator());
+ addMessageTranslator(MultipartReplyMessage.class,OF10, new MultipartReplyTranslator(convertorExecutor));
+ addMessageTranslator(MultipartReplyMessage.class,OF13, new MultipartReplyTranslator(convertorExecutor));
+ addMessageTranslator(MultipartReplyMessage.class,OF13,new MultipartReplyTableFeaturesToTableUpdatedTranslator(convertorExecutor));
addMessageTranslator(GetFeaturesOutput.class,OF10, new FeaturesV10ToNodeConnectorUpdatedTranslator());
addMessageTranslator(NotificationQueueWrapper.class, OF10, new NotificationPlainTranslator());
addMessageTranslator(NotificationQueueWrapper.class, OF13, new NotificationPlainTranslator());
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
private final NodeId nodeId;
private final IMessageDispatchService messageService;
private short version = 0;
+ private final ConvertorExecutor convertorExecutor;
private OFRpcTaskContext rpcTaskContext;
// TODO:read timeout from configSubsystem
protected TimeUnit maxTimeoutUnit = TimeUnit.MILLISECONDS;
protected ModelDrivenSwitchImpl(final NodeId nodeId, final InstanceIdentifier<Node> identifier,
- final SessionContext sessionContext) {
+ final SessionContext sessionContext, final ConvertorExecutor convertorExecutor) {
super(identifier, sessionContext);
this.nodeId = nodeId;
messageService = sessionContext.getMessageDispatchService();
version = sessionContext.getPrimaryConductor().getVersion();
+ this.convertorExecutor = convertorExecutor;
final NotificationProviderService rpcNotificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
rpcTaskContext = new OFRpcTaskContext();
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> task =
- OFRpcTaskFactory.createAddFlowTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createAddFlowTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddFlowOutput());
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> task =
- OFRpcTaskFactory.createAddGroupTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createAddGroupTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddGroupOutput());
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> task =
- OFRpcTaskFactory.createAddMeterTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createAddMeterTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddMeterOutput());
// use primary connection
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> task =
- OFRpcTaskFactory.createRemoveFlowTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createRemoveFlowTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveFlowOutput());
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> task =
- OFRpcTaskFactory.createRemoveGroupTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createRemoveGroupTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveGroupOutput());
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> task =
- OFRpcTaskFactory.createRemoveMeterTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createRemoveMeterTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveMeterOutput());
data.setDatapathId(sessionContext.getFeatures().getDatapathId());
data.setXid(sessionContext.getNextXid());
- final java.util.Optional<PacketOutInput> message = ConvertorManager.getInstance().convert(input, data);
+ final java.util.Optional<PacketOutInput> message = convertorExecutor.convert(input, data);
SwitchConnectionDistinguisher cookie = null;
ConnectionCookie connectionCookie = input.getConnectionCookie();
SwitchConnectionDistinguisher cookie = null;
final ReadWriteTransaction rwTx = OFSessionUtil.getSessionManager().getDataBroker().newReadWriteTransaction();
OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task =
- OFRpcTaskFactory.createUpdateFlowTask(rpcTaskContext, input, cookie, rwTx);
+ OFRpcTaskFactory.createUpdateFlowTask(rpcTaskContext, input, cookie, rwTx, convertorExecutor);
ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
return result;
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> task =
- OFRpcTaskFactory.createUpdateGroupTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createUpdateGroupTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
return result;
SwitchConnectionDistinguisher cookie = null;
OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> task =
- OFRpcTaskFactory.createUpdateMeterTask(rpcTaskContext, input, cookie);
+ OFRpcTaskFactory.createUpdateMeterTask(rpcTaskContext, input, cookie, convertorExecutor);
ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
return result;
LOG.debug("Calling the updatePort RPC method on MessageDispatchService");
OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task =
- OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, null);
+ OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, null, convertorExecutor);
return task.submit();
}
LOG.debug("Calling the updateTable RPC method on MessageDispatchService");
OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> task =
- OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, null);
+ OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, null, convertorExecutor);
return task.submit();
}
LOG.debug("Calling the getFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> task =
- OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, null);
+ OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, null, convertorExecutor);
return task.submit();
}
LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForGivenMatch RPC method on MessageDispatchService");
OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> task =
- OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, null);
+ OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, null, convertorExecutor);
return task.submit();
}
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.api.openflow.md.core.sal.NotificationComposer;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
* @param taskContext task context
* @param input flow object input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return UpdateFlow task
*/
public static OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> createAddFlowTask(
OFRpcTaskContext taskContext, AddFlowInput input,
- SwitchConnectionDistinguisher cookie) {
+ SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> {
- public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddFlowInput input) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionDatapathIdConvertorData data;
+
+ public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddFlowInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getSession().getFeatures().getDatapathId());
}
@Override
public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getSession().getFeatures().getDatapathId());
// Convert the AddFlowInput to FlowModInput
final java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs =
- ConvertorManager.getInstance().convert(getInput(), data);
+ convertorExecutor.convert(getInput(), data);
final List<FlowModInputBuilder> flowModInputs = ofFlowModInputs.orElse(Collections.emptyList());
LOG.debug("Number of flows to push to switch: {}", flowModInputs.size());
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
- * Recursive helper method for {@link OFRpcTaskFactory#createAddFlowTask(OFRpcTaskContext, AddFlowInput, SwitchConnectionDistinguisher)}
- * and {@link OFRpcTaskFactory#createUpdateFlowTask(OFRpcTaskContext, UpdateFlowInput, SwitchConnectionDistinguisher, ReadWriteTransaction)} to chain results
+ * Recursive helper method for {@link OFRpcTaskFactory#createAddFlowTask(OFRpcTaskContext, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput, org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)}
+ * and {@link OFRpcTaskFactory#createUpdateFlowTask(OFRpcTaskContext, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput, org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher, org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)} to chain results
* of multiple flowmods.
* The next flowmod gets executed if the earlier one is successful.
* All the flowmods should have the same xid, in-order to cross-reference
* @param input update flow input
* @param cookie switch connection distinguisher cookie value
* @param rwTx read write transaction
+ * @param convertorExecutor
* @return UpdateFlow task
*/
public static OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> createUpdateFlowTask(
final OFRpcTaskContext taskContext, UpdateFlowInput input,
- SwitchConnectionDistinguisher cookie, final ReadWriteTransaction rwTx) {
+ SwitchConnectionDistinguisher cookie, final ReadWriteTransaction rwTx, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> {
final ReadWriteTransaction rwTx;
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionDatapathIdConvertorData data;
InstanceIdentifier<Table> iiToTable = null;
String flowId = null;
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- final UpdateFlowInput in, final ReadWriteTransaction rwTx) {
+ final UpdateFlowInput in, final ReadWriteTransaction rwTx, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, in);
+ this.convertorExecutor = convertorExecutor;
final FlowRef flowRef = in.getFlowRef();
if (flowRef != null) {
InstanceIdentifier<Flow> iiToFlow = (InstanceIdentifier<Flow>)(flowRef.getValue());
}
}
this.rwTx = rwTx;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getSession().getFeatures().getDatapathId());
}
@Override
UpdateFlowInput in = getInput();
UpdatedFlow updated = in.getUpdatedFlow();
OriginalFlow original = in.getOriginalFlow();
- Short version = getVersion();
List<FlowModInputBuilder> allFlowMods = new ArrayList<>();
java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs;
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
- data.setDatapathId(getSession().getFeatures().getDatapathId());
- if (!FlowCreatorUtil.canModifyFlow(original, updated, version)) {
+ if (!FlowCreatorUtil.canModifyFlow(original, updated, getVersion())) {
// We would need to remove original and add updated.
//remove flow
RemoveFlowInputBuilder removeflow = new RemoveFlowInputBuilder(original);
java.util.Optional<List<FlowModInputBuilder>> ofFlowRemoveInput =
- ConvertorManager.getInstance().convert(removeflow.build(), data);
+ convertorExecutor.convert(removeflow.build(), data);
if (ofFlowRemoveInput.isPresent()) {
// remove flow should be the first
}
AddFlowInputBuilder addFlowInputBuilder = new AddFlowInputBuilder(updated);
- ofFlowModInputs = ConvertorManager.getInstance().convert(addFlowInputBuilder.build(), data);
+ ofFlowModInputs = convertorExecutor.convert(addFlowInputBuilder.build(), data);
} else {
- ofFlowModInputs = ConvertorManager.getInstance().convert(updated, data);
+ ofFlowModInputs = convertorExecutor.convert(updated, data);
}
//deleting flow hash value from operational DS
return getInput().getUpdatedFlow().isBarrier();
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input, rwTx);
+ return new OFRpcTaskImpl(taskContext, cookie, input, rwTx, convertorExecutor);
}
* @param taskContext taks context
* @param input group update input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return update group task
*/
public static OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> createAddGroupTask(
final OFRpcTaskContext taskContext, AddGroupInput input,
- final SwitchConnectionDistinguisher cookie) {
+ final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> {
- public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddGroupInput input) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionDatapathIdConvertorData data;
+
+ public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddGroupInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getSession().getFeatures().getDatapathId());
}
@Override
public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getSession().getFeatures().getDatapathId());
// Convert the AddGroupInput to GroupModInput
- final java.util.Optional<GroupModInputBuilder> ofGroupModInput = ConvertorManager.getInstance().convert(getInput(), data);
+ final java.util.Optional<GroupModInputBuilder> ofGroupModInput = convertorExecutor.convert(getInput(), data);
final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
.orElse(GroupConvertor.defaultResult(getVersion()))
.setXid(getSession().getNextXid());
}
};
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
* @param taskContext task context
* @param input meter add input
* @param cookie switch connection distinguisher
+ * @param convertorExecutor
* @return update meter task
*/
public static OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> createAddMeterTask(
OFRpcTaskContext taskContext, AddMeterInput input,
- SwitchConnectionDistinguisher cookie) {
+ SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> {
- public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddMeterInput input) {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
+ public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddMeterInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
ListenableFuture<RpcResult<UpdateMeterOutput>> result = SettableFuture.create();
// Convert the AddMeterInput to UpdateMeterOutput
- final java.util.Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager
- .getInstance()
- .convert(getInput(), new VersionConvertorData(getVersion()));
+ final java.util.Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(getInput(), data);
final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
.orElse(MeterConvertor.defaultResult(getVersion()))
}
};
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input update group output
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return UpdateFlow task
*/
public static OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> createUpdateGroupTask(
OFRpcTaskContext taskContext, UpdateGroupInput input,
- SwitchConnectionDistinguisher cookie) {
+ SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionDatapathIdConvertorData data;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- UpdateGroupInput input) {
+ UpdateGroupInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getSession().getFeatures().getDatapathId());
}
@Override
public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
ListenableFuture<RpcResult<UpdateGroupOutput>> result = null;
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getSession().getFeatures().getDatapathId());
// Convert the UpdateGroupInput to GroupModInput
final java.util.Optional<GroupModInputBuilder> ofGroupModInput =
- ConvertorManager.getInstance().convert(getInput().getUpdatedGroup(), data);
+ convertorExecutor.convert(getInput().getUpdatedGroup(), data);
final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
.orElse(GroupConvertor.defaultResult(getVersion()))
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input update meter input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return update meter task
*/
public static OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> createUpdateMeterTask(
OFRpcTaskContext taskContext, UpdateMeterInput input,
- SwitchConnectionDistinguisher cookie) {
+ SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- UpdateMeterInput input) {
+ UpdateMeterInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
ListenableFuture<RpcResult<UpdateMeterOutput>> result = null;
// Convert the UpdateMeterInput to MeterModInput
- final java.util.Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager
- .getInstance()
- .convert(getInput().getUpdatedMeter(), new VersionConvertorData(getVersion()));
+ final java.util.Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(getInput().getUpdatedMeter(), data);
final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
.orElse(MeterConvertor.defaultResult(getVersion()))
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input update flow input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return task remove flow task
*/
public static OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> createRemoveFlowTask(
OFRpcTaskContext taskContext, RemoveFlowInput input,
- SwitchConnectionDistinguisher cookie) {
+ SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> {
+ private final VersionDatapathIdConvertorData data;
+ private final ConvertorExecutor convertorExecutor;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- RemoveFlowInput input) {
+ RemoveFlowInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getSession().getFeatures().getDatapathId());
}
@Override
public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getSession().getFeatures().getDatapathId());
// Convert the AddFlowInput to FlowModInput
- final java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs =
- ConvertorManager.getInstance().convert(getInput(), data);
+ final java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs = convertorExecutor.convert(getInput(), data);
result = chainFlowMods(ofFlowModInputs.orElse(Collections.emptyList()), 0, getTaskContext(), getCookie());
result = OFRpcTaskUtil.chainFutureBarrier(this, result);
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input remove group input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return task remove group task
*/
public static OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> createRemoveGroupTask(
final OFRpcTaskContext taskContext, RemoveGroupInput input,
- final SwitchConnectionDistinguisher cookie) {
+ final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionDatapathIdConvertorData data;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- RemoveGroupInput input) {
+ RemoveGroupInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionDatapathIdConvertorData(getVersion());
+ data.setDatapathId(getSession().getFeatures().getDatapathId());
}
@Override
public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
- data.setDatapathId(getSession().getFeatures().getDatapathId());
// Convert the AddGroupInput to GroupModInput
- final java.util.Optional<GroupModInputBuilder> ofGroupModInput =
- ConvertorManager.getInstance().convert(getInput(), data);
+ final java.util.Optional<GroupModInputBuilder> ofGroupModInput = convertorExecutor.convert(getInput(), data);
final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
.orElse(GroupConvertor.defaultResult(getVersion()))
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input meter removed input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return task meter remove task
*/
public static OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> createRemoveMeterTask(
OFRpcTaskContext taskContext, RemoveMeterInput input,
- SwitchConnectionDistinguisher cookie) {
+ SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- RemoveMeterInput input) {
+ RemoveMeterInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
ListenableFuture<RpcResult<UpdateMeterOutput>> result = SettableFuture.create();
// Convert the RemoveMeterInput to UpdateMeterOutput
- final java.util.Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager
- .getInstance()
- .convert(getInput(), new VersionConvertorData(getVersion()));
+ final java.util.Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(getInput(), data);
final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
.orElse(MeterConvertor.defaultResult(getVersion()))
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
* @param taskContext task context
* @param input get flow statistics from flow table
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return task get flow statistics from flow table task
*/
public static OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>>
createGetFlowStatisticsFromFlowTableTask(
final OFRpcTaskContext taskContext,
- final GetFlowStatisticsFromFlowTableInput input, SwitchConnectionDistinguisher cookie) {
+ final GetFlowStatisticsFromFlowTableInput input, SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- GetFlowStatisticsFromFlowTableInput input) {
+ GetFlowStatisticsFromFlowTableInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
}
@Override
// convert and inject match
MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
- .getPrimaryConductor().getVersion(), mprFlowRequestBuilder);
+ .getPrimaryConductor().getVersion(), mprFlowRequestBuilder, convertorExecutor);
// Set request body to main multipart request
multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input aggregate flow statistics input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return task task to fetch the statistics
*/
public static OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(
final OFRpcTaskContext taskContext,
- final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input, SwitchConnectionDistinguisher cookie) {
+ final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input, SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
+ GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
}
@Override
}
MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
- .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
+ .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder, convertorExecutor);
FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
.getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input update port input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return task task to update port
*/
public static OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> createUpdatePortTask(
final OFRpcTaskContext taskContext, final UpdatePortInput input,
- final SwitchConnectionDistinguisher cookie) {
+ final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- UpdatePortInput input) {
+ UpdatePortInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
public ListenableFuture<RpcResult<UpdatePortOutput>> call() {
ListenableFuture<RpcResult<UpdatePortOutput>> result = SettableFuture.create();
- final short version = taskContext.getSession().getPrimaryConductor().getVersion();
final Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
- final java.util.Optional<PortModInput> ofPortModInput = ConvertorManager
- .getInstance()
- .convert(inputPort, new VersionConvertorData(version));
+ final java.util.Optional<PortModInput> ofPortModInput = convertorExecutor.convert(inputPort, data);
PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput
- .orElse(PortConvertor.defaultResult(version)))
+ .orElse(PortConvertor.defaultResult(getVersion())))
.setXid(taskContext.getSession().getNextXid());
Future<RpcResult<UpdatePortOutput>> resultFromOFLib = getMessageService()
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
/**
* @param taskContext task context
* @param input update table input
* @param cookie switch connection distinguisher cookie value
+ * @param convertorExecutor
* @return task task to udpate table input
*/
public static OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> createUpdateTableTask(
final OFRpcTaskContext taskContext, final UpdateTableInput input,
- final SwitchConnectionDistinguisher cookie) {
+ final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
class OFRpcTaskImpl extends OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> {
+ private final ConvertorExecutor convertorExecutor;
+ private final VersionConvertorData data;
+
public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
- UpdateTableInput input) {
+ UpdateTableInput input, ConvertorExecutor convertorExecutor) {
super(taskContext, cookie, input);
+ this.convertorExecutor = convertorExecutor;
+ data = new VersionConvertorData(getVersion());
}
@Override
MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
MultipartRequestTableFeaturesBuilder requestBuilder = new MultipartRequestTableFeaturesBuilder();
- final java.util.Optional<List<TableFeatures>> ofTableFeatureList = ConvertorManager.getInstance().convert(input.getUpdatedTable());
+ final java.util.Optional<List<TableFeatures>> ofTableFeatureList = convertorExecutor.convert(input.getUpdatedTable(), data);
requestBuilder.setTableFeatures(ofTableFeatureList.orElse(Collections.emptyList()));
caseBuilder.setMultipartRequestTableFeatures(requestBuilder.build());
}
}
- return new OFRpcTaskImpl(taskContext, cookie, input);
+ return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
}
public static OFRpcTask<SetConfigInput, RpcResult<SetConfigOutput>> createSetNodeConfigTask(final OFRpcTaskContext taskContext,
import org.opendaylight.openflowplugin.openflow.md.core.MDController;
import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFRoleManager;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.opendaylight.openflowplugin.statistics.MessageSpyCounterImpl;
* Initialization of services and msgSpy counter
*/
public void initialization() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+
messageCountProvider = new MessageSpyCounterImpl();
extensionConverterManager = new ExtensionConverterManagerImpl();
roleManager = new OFRoleManager(OFSessionUtil.getSessionManager());
entManager.init();
LOG.debug("dependencies gathered..");
- registrationManager = new SalRegistrationManager();
+ registrationManager = new SalRegistrationManager(convertorManager);
registrationManager.setDataService(dataBroker);
registrationManager.setPublishService(notificationService);
registrationManager.setRpcProviderRegistry(rpcRegistry);
registrationManager.setOfEntityManager(entManager);
registrationManager.init();
- mdController = new MDController();
+ mdController = new MDController(convertorManager);
mdController.setSwitchConnectionProviders(switchConnectionProviders);
mdController.setMessageSpyCounter(messageCountProvider);
mdController.setExtensionConverterProvider(extensionConverterManager);
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionManager;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
public class SalRegistrationManager implements SessionListener, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(SalRegistrationManager.class);
+ private final ConvertorExecutor convertorExecutor;
private NotificationProviderService publishService;
private OfEntityManager entManager;
- public SalRegistrationManager() {
+ public SalRegistrationManager(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
swFeaturesUtil = SwitchFeaturesUtil.getInstance();
}
InstanceIdentifier<Node> identifier = identifierFromDatapathId(datapathId);
NodeRef nodeRef = new NodeRef(identifier);
NodeId nodeId = nodeIdFromDatapathId(datapathId);
- ModelDrivenSwitch ofSwitch = new ModelDrivenSwitchImpl(nodeId, identifier,context);
+ ModelDrivenSwitch ofSwitch = new ModelDrivenSwitchImpl(nodeId, identifier, context, convertorExecutor);
NotificationQueueWrapper wrappedNotification = new NotificationQueueWrapper(
nodeAdded(ofSwitch, features, nodeRef),
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
-import java.util.ArrayList;
+import com.google.common.annotations.VisibleForTesting;
+import java.util.Arrays;
import java.util.Collection;
-import java.util.List;
+import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nullable;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor;
+import java.util.stream.Stream;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowInstructionResponseConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowStatsResponseConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchResponseConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor;
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
public class ConvertorManager implements ConvertorExecutor, ConvertorRegistrator {
private static final Logger LOG = LoggerFactory.getLogger(ConvertorManager.class);
- private static ConvertorManager INSTANCE;
-
- static {
- INSTANCE = new ConvertorManager();
- // All convertors are registered here
- INSTANCE.registerConvertor(new TableFeaturesConvertor());
- INSTANCE.registerConvertor(new TableFeaturesResponseConvertor());
- INSTANCE.registerConvertor(new MeterConvertor());
- INSTANCE.registerConvertor(new MeterStatsResponseConvertor());
- INSTANCE.registerConvertor(new MeterConfigStatsResponseConvertor());
- INSTANCE.registerConvertor(new PortConvertor());
- // TODO: Add MatchConvertor
- INSTANCE.registerConvertor(new MatchResponseConvertor());
- INSTANCE.registerConvertor(new MatchV10ResponseConvertor());
- INSTANCE.registerConvertor(new ActionConvertor());
- INSTANCE.registerConvertor(new ActionResponseConvertor());
- INSTANCE.registerConvertor(new GroupConvertor());
- INSTANCE.registerConvertor(new GroupDescStatsResponseConvertor());
- INSTANCE.registerConvertor(new GroupStatsResponseConvertor());
- INSTANCE.registerConvertor(new PacketOutConvertor());
- INSTANCE.registerConvertor(new FlowConvertor());
- INSTANCE.registerConvertor(new FlowInstructionResponseConvertor());
- INSTANCE.registerConvertor(new FlowStatsResponseConvertor());
- }
-
- // Actual convertor keys
- private List<Class<? extends DataContainer>> convertorKeys = new ArrayList<>();
// Cache, that holds all registered convertors, but they can have multiple keys,
// based on instanceof checks in the convert method
- private Map<Class<? extends DataContainer>, Convertor> convertors = new ConcurrentHashMap<>();
-
- private ConvertorManager() {
- // Hiding implicit constructor
- }
+ private Map<Short, Map<Class<? extends DataContainer>, Convertor<?, ?, ? extends ConvertorData>>> convertors;
/**
- * Gets instance of Convertor Manager.
- *
- * @return the instance
+ * Create new instance of Convertor Manager
+ * @param supportedVersions supported versions
*/
- public static ConvertorManager getInstance() {
- return INSTANCE;
+ public ConvertorManager(final Short... supportedVersions) {
+ final Stream<Short> stream = Arrays.stream(supportedVersions);
+
+ if (supportedVersions.length == 1) {
+ final Optional<Short> versionOptional = stream.findFirst();
+ versionOptional.ifPresent(version -> convertors = Collections.singletonMap(version, new ConcurrentHashMap<>()));
+ } else {
+ convertors = new ConcurrentHashMap<>();
+ stream.forEach(version -> convertors.putIfAbsent(version, new ConcurrentHashMap<>()));
+ }
}
@Override
- @SuppressWarnings("unchecked")
- public void registerConvertor(final Convertor convertor) {
- for (final Object typeRaw : convertor.getTypes()) {
- final Class<? extends DataContainer> type = (Class<? extends DataContainer>)typeRaw;
- final Convertor result = convertors.get(type);
-
- if (Objects.isNull(result)) {
- convertorKeys.add(type);
- convertors.put(type, convertor);
- LOG.debug("{} is now converted by {}", type, convertor);
- } else {
- LOG.warn("Convertor for type {} is already registered", type);
+ public ConvertorManager registerConvertor(final short version, final Convertor<?, ?, ? extends ConvertorData> convertor) {
+ final Map<Class<? extends DataContainer>, Convertor<?, ?, ? extends ConvertorData>> convertorsForVersion =
+ convertors.get(version);
+
+ if (Objects.nonNull(convertorsForVersion)) {
+ for (final Class<? extends DataContainer> type : convertor.getTypes()) {
+ final Convertor<?, ?, ? extends ConvertorData> result = convertorsForVersion.get(type);
+
+ if (Objects.isNull(result)) {
+ convertor.setConvertorExecutor(this);
+ convertorsForVersion.put(type, convertor);
+ LOG.debug("{} for version {} is now converted by {}", type, version, convertor);
+ } else {
+ LOG.warn("{} for version {} have already registered convertor", type, version);
+ }
}
+ } else {
+ LOG.warn("{} do not supports version {}", this, version);
}
- }
- public <FROM extends DataContainer, TO> Optional<TO> convert(final FROM source) {
- return convert(source, null);
+ return this;
}
@Override
@SuppressWarnings("unchecked")
- public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final FROM source, @Nullable final DATA data) {
+ public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final FROM source, final DATA data) {
Optional<TO> result = Optional.empty();
if (Objects.isNull(source)) {
final Class<? extends DataContainer> type = source.getImplementedInterface();
if (Objects.isNull(type)) {
- LOG.warn("Cannot extract type from source, because getImplementedInterface() returns null");
+ LOG.warn("Cannot extract type from {}, because getImplementedInterface() returns null", source);
return result;
}
- final Optional<Convertor> convertor = findConvertor(type);
-
- if (convertor.isPresent()) {
- result = Optional.of((TO) convertor.get().convert(source, data));
- }
-
- return result;
- }
-
- public <FROM extends DataContainer, TO> Optional<TO> convert(final Collection<FROM> source) {
- return convert(source, null);
+ return findConvertor(data.getVersion(), type)
+ .map(convertor -> (TO)convertor.convert(source, data));
}
@Override
@SuppressWarnings("unchecked")
- public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final Collection<FROM> source, @Nullable final DATA data) {
+ public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final Collection<FROM> source, final DATA data) {
Optional<TO> result = Optional.empty();
if (Objects.isNull(source)) {
final Class<? extends DataContainer> type = first.get().getImplementedInterface();
if (Objects.isNull(type)) {
- LOG.warn("Cannot extract type from source, because getImplementedInterface() returns null");
+ LOG.warn("Cannot extract type from {}, because getImplementedInterface() returns null", source);
return result;
}
- final Optional<Convertor> convertor = findConvertor(type);
-
- if (convertor.isPresent()) {
- result = Optional.of((TO) convertor.get().convert(source, data));
- }
-
- return result;
+ return findConvertor(data.getVersion(), type)
+ .map(convertor -> (TO)convertor.convert(source, data));
}
/**
* @param type input type
* @return found convertor
*/
- private Optional<Convertor> findConvertor(final Class<? extends DataContainer> type) {
- Optional<Convertor> convertor = Optional.ofNullable(convertors.get(type));
-
- if (!convertor.isPresent()) {
- for (final Class<? extends DataContainer> key : convertorKeys) {
- if (key.isAssignableFrom(type)) {
- final Convertor foundConvertor = convertors.get(key);
- convertor = Optional.ofNullable(foundConvertor);
- convertors.put(type, foundConvertor);
- LOG.warn("{} is now converted by {} using last resort method", type, foundConvertor);
- break;
- }
- }
+ @VisibleForTesting
+ Optional<Convertor> findConvertor(final short version, final Class<? extends DataContainer> type) {
+ final Map<Class<? extends DataContainer>, Convertor<?, ?, ? extends ConvertorData>> convertorsForVersion =
+ convertors.get(version);
+
+ Optional<Convertor> convertor = Optional.empty();
+
+ if (Objects.nonNull(convertorsForVersion)) {
+ convertor = Optional.ofNullable(convertorsForVersion.get(type));
if (!convertor.isPresent()) {
- LOG.warn("Convertor for {} not found", type);
+ for (final Class<? extends DataContainer> convertorType : convertorsForVersion.keySet()) {
+ if (type.isAssignableFrom(convertorType)) {
+ final Convertor<?, ?, ? extends ConvertorData> foundConvertor = convertorsForVersion.get(convertorType);
+ convertor = Optional.ofNullable(foundConvertor);
+
+ if (convertor.isPresent()) {
+ convertorsForVersion.put(type, foundConvertor);
+ LOG.warn("{} for version {} is now converted by {} using last resort method", type, version, foundConvertor);
+ break;
+ }
+ }
+ }
+
+ if (!convertor.isPresent()) {
+ LOG.warn("Convertor for {} for version {} not found", type, version);
+ }
}
+ } else {
+ LOG.warn("{} do not supports version {}", this, version);
}
return convertor;
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
+
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowInstructionResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowStatsResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor;
+
+/**
+ * Convertor manager factory.
+ */
+public class ConvertorManagerFactory {
+ /**
+ * Create default convertor manager.
+ *
+ * @return the convertor manager
+ */
+ public static ConvertorManager createDefaultManager() {
+ final TableFeaturesConvertor tableFeaturesConvertor = new TableFeaturesConvertor();
+ final TableFeaturesResponseConvertor tableFeaturesResponseConvertor = new TableFeaturesResponseConvertor();
+ final MeterConvertor meterConvertor = new MeterConvertor();
+ final MeterStatsResponseConvertor meterStatsResponseConvertor = new MeterStatsResponseConvertor();
+ final MeterConfigStatsResponseConvertor meterConfigStatsResponseConvertor = new MeterConfigStatsResponseConvertor();
+ final PortConvertor portConvertor = new PortConvertor();
+ final MatchResponseConvertor matchResponseConvertor = new MatchResponseConvertor();
+ final MatchV10ResponseConvertor matchV10ResponseConvertor = new MatchV10ResponseConvertor();
+ final ActionConvertor actionConvertor = new ActionConvertor();
+ final ActionResponseConvertor actionResponseConvertor = new ActionResponseConvertor();
+ final GroupConvertor groupConvertor = new GroupConvertor();
+ final GroupDescStatsResponseConvertor groupDescStatsResponseConvertor = new GroupDescStatsResponseConvertor();
+ final GroupStatsResponseConvertor groupStatsResponseConvertor = new GroupStatsResponseConvertor();
+ final PacketOutConvertor packetOutConvertor = new PacketOutConvertor();
+ final FlowConvertor flowConvertor = new FlowConvertor();
+ final FlowInstructionResponseConvertor flowInstructionResponseConvertor = new FlowInstructionResponseConvertor();
+ final FlowStatsResponseConvertor flowStatsResponseConvertor = new FlowStatsResponseConvertor();
+
+ return new ConvertorManager(OFConstants.OFP_VERSION_1_0, OFConstants.OFP_VERSION_1_3)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, tableFeaturesConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, tableFeaturesConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, tableFeaturesResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, tableFeaturesResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, meterConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, meterConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, meterStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, meterStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, meterConfigStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, meterConfigStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, portConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, portConvertor)
+ // TODO: Add MatchConvertorImpl and MatchConvertorV10Impl
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, matchResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, matchV10ResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, actionConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, actionConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, actionResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, actionResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, groupConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, groupConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, groupDescStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, groupDescStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, groupStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, groupStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, packetOutConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, packetOutConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, flowConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, flowConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, flowInstructionResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, flowInstructionResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_0, flowStatsResponseConvertor)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, flowStatsResponseConvertor);
+ }
+}
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
public interface ConvertorRegistrator {
/**
*
* @param convertor the convertor
*/
- void registerConvertor(final Convertor convertor);
+ ConvertorManager registerConvertor(final short version, final Convertor<?, ?, ? extends ConvertorData> convertor);
}
\ No newline at end of file
* {@code
* VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
* data.setDatapathId(datapathId);
- * Optional<GroupModInputBuilder> ofGroup = ConvertorManager.getInstance().convert(salGroup, data);
+ * Optional<GroupModInputBuilder> ofGroup = convertorManager.convert(salGroup, data);
* }
* </pre>
*/
-public class GroupConvertor implements Convertor<Group, GroupModInputBuilder, VersionDatapathIdConvertorData> {
+public class GroupConvertor extends Convertor<Group, GroupModInputBuilder, VersionDatapathIdConvertorData> {
private static final List<Class<? extends DataContainer>> TYPES = Arrays.asList(Group.class, AddGroupInput.class, RemoveGroupInput.class, UpdatedGroup.class);
-
/**
* Create default empty group mod input builder
* Use this method, if result from convertor is empty.
return bucket1.getBucketId().getValue().compareTo(bucket2.getBucketId().getValue());
};
- private static List<BucketsList> salToOFBucketList(Buckets buckets, short version, int groupType, BigInteger datapathid) {
+ private List<BucketsList> salToOFBucketList(Buckets buckets, short version, int groupType, BigInteger datapathid) {
final List<BucketsList> bucketLists = new ArrayList<>();
final ActionConvertorData data = new ActionConvertorData(version);
data.setDatapathId(datapathid);
salToOFBucketListWatchGroup(groupBucket, bucketBuilder, groupType);
salToOFBucketListWatchPort(groupBucket, bucketBuilder, groupType);
- Optional<List<Action>> bucketActionList = ConvertorManager.getInstance().convert(
+ Optional<List<Action>> bucketActionList = getConvertorExecutor().convert(
groupBucket.getAction(), data);
bucketBuilder.setAction(bucketActionList.orElse(Collections.emptyList()));
* <pre>
* {@code
* VersionConvertorData data = new VersionConvertorData(version);
- * Optional<List<GroupDescStats>> salGroupStats = ConvertorManager.getInstance().convert(ofGroupStats, data);
+ * Optional<List<GroupDescStats>> salGroupStats = convertorManager.convert(ofGroupStats, data);
* }
* </pre>
*/
-public class GroupDescStatsResponseConvertor implements Convertor<List<GroupDesc>, List<GroupDescStats>, VersionConvertorData> {
+public class GroupDescStatsResponseConvertor extends Convertor<List<GroupDesc>, List<GroupDescStats>, VersionConvertorData> {
private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(GroupDesc.class);
for (BucketsList bucketDetails : bucketDescStats) {
BucketBuilder bucketDesc = new BucketBuilder();
final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> convertedSalActions =
- ConvertorManager.getInstance().convert(
+ getConvertorExecutor().convert(
bucketDetails.getAction(), data);
* Example usage:
* <pre>
* {@code
- * Optional<List<GroupStats>> salGroupStats = ConvertorManager.getInstance().convert(ofGroupStats);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<GroupStats>> salGroupStats = convertorManager.convert(ofGroupStats, data);
* }
* </pre>
*/
-public class GroupStatsResponseConvertor implements Convertor<
+public class GroupStatsResponseConvertor extends Convertor<
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats>,
List<GroupStats>,
VersionConvertorData> {
* Example usage:
* <pre>
* {@code
- * Optional<List<MeterConfigStats>> salMeterConfigStats = ConvertorManager.getInstance().convert(
- * ofMeterConfigStats);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<MeterConfigStats>> salMeterConfigStats = convertorManager.convert(ofMeterConfigStats, data);
* }
* </pre>
*/
-public class MeterConfigStatsResponseConvertor implements Convertor<List<MeterConfig>, List<MeterConfigStats>, VersionConvertorData> {
+public class MeterConfigStatsResponseConvertor extends Convertor<List<MeterConfig>, List<MeterConfigStats>, VersionConvertorData> {
private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(MeterConfig.class);
* <pre>
* {@code
* VersionConvertorData data = new VersionConvertorData(version);
- * Optional<MeterModInputBuilder> ofMeter = ConvertorManager.getInstance().convert(salMeter, data);
+ * Optional<MeterModInputBuilder> ofMeter = convertorManager.convert(salMeter, data);
* }
* </pre>
*/
-public class MeterConvertor implements Convertor<Meter, MeterModInputBuilder, VersionConvertorData> {
+public class MeterConvertor extends Convertor<Meter, MeterModInputBuilder, VersionConvertorData> {
private static final Logger LOG = LoggerFactory.getLogger(MeterConvertor.class);
private static final List<Class<? extends DataContainer>> TYPES = Arrays.asList(Meter.class, AddMeterInput.class, RemoveMeterInput.class, UpdatedMeter.class);
* Example usage:
* <pre>
* {@code
- * Optional<List<MeterStats>> salMeterStats = ConvertorManager.getInstance().convert(
- * ofMeterStats);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<MeterStats>> salMeterStats = convertorManager.convert(ofMeterStats, data);
* }
* </pre>
*/
-public class MeterStatsResponseConvertor implements Convertor<
+public class MeterStatsResponseConvertor extends Convertor<
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply
.multipart.reply.body.multipart.reply.meter._case.multipart.reply.meter.MeterStats>,
List<MeterStats>,
* PacketOutConvertorData data = new PacketOutConvertorData(version);
* data.setDatapathId(datapathId);
* data.setXid(xid);
- * Optional<PacketOutInput> ofPacketInput = ConvertorManager.getInstance().convert(salPacket, data);
+ * Optional<PacketOutInput> ofPacketInput = convertorManager.convert(salPacket, data);
* }
* </pre>
*/
-public class PacketOutConvertor implements Convertor<TransmitPacketInput, PacketOutInput, PacketOutConvertorData> {
+public class PacketOutConvertor extends Convertor<TransmitPacketInput, PacketOutInput, PacketOutConvertorData> {
private static final Logger LOG = LoggerFactory.getLogger(PacketOutConvertor.class);
private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(TransmitPacketInput.class);
final ActionConvertorData actionConvertorData = new ActionConvertorData(data.getVersion());
actionConvertorData.setDatapathId(data.getDatapathId());
- final Optional<List<Action>> convertedActions = ConvertorManager.getInstance().convert(
+ final Optional<List<Action>> convertedActions = getConvertorExecutor().convert(
inputActions, actionConvertorData);
actions = convertedActions.orElse(Collections.emptyList());
* <pre>
* {@code
* VersionConvertorData data = new VersionConvertorData(version);
- * Optional<PortModInput> ofPort = ConvertorManager.getInstance().convert(salPort, data);
+ * Optional<PortModInput> ofPort = convertorManager.convert(salPort, data);
* }
* </pre>
*/
-public class PortConvertor implements Convertor<Port, PortModInput, VersionConvertorData> {
+public class PortConvertor extends Convertor<Port, PortModInput, VersionConvertorData> {
private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(Port.class);
* Example usage:
* <pre>
* {@code
- * Optional<List<TableFeatures>> ofFeatures = ConvertorManager.getInstance().convert(salTableFeatures);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<TableFeatures>> ofFeatures = convertorManager..convert(salTableFeatures, data);
* }
* </pre>
*/
-public class TableFeaturesConvertor implements Convertor<
+public class TableFeaturesConvertor extends Convertor<
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures,
List<TableFeatures>,
VersionConvertorData> {
* Example usage:
* <pre>
* {@code
- * Optional<List<TableFeatures>> salFeatures = ConvertorManager.getInstance().convert(ofTableFeatures);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<TableFeatures>> salFeatures = convertorManager.convert(ofTableFeatures, data);
* }
* </pre>
*/
-public class TableFeaturesResponseConvertor implements Convertor<MultipartReplyTableFeatures, List<TableFeatures>, VersionConvertorData> {
+public class TableFeaturesResponseConvertor extends Convertor<MultipartReplyTableFeatures, List<TableFeatures>, VersionConvertorData> {
private static final Logger LOG = LoggerFactory.getLogger(TableFeaturesResponseConvertor.class);
private static final Map<TableFeaturesPropType, ActionExecutor> TABLE_FEATURE_PROPERTY_TYPE_TO_ACTION;
private static final Map<Class<?>, org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> OF_TO_SAL_ACTION;
* ActionConvertorData data = new ActionConvertorData(version);
* data.setDatapathId(datapathId);
* data.setIpProtocol(ipProtocol);
- * Optional<List<Action>> ofActions = ConvertorManager.getInstance().convert(salActions, data);
+ * Optional<List<Action>> ofActions = convertorManager.convert(salActions, data);
* }
* </pre>
*/
-public final class ActionConvertor implements Convertor<
+public final class ActionConvertor extends Convertor<
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>,
List<Action>,
ActionConvertorData> {
// Iterate over SAL actions, run them through tokenizer and then add them to list of converted actions
if (source != null) {
for (final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : source) {
- final Optional<Action> convertedAction = PROCESSOR.process(action.getAction(), data);
+ final Optional<Action> convertedAction = PROCESSOR.process(action.getAction(), data, getConvertorExecutor());
if (convertedAction.isPresent()) {
result.add(convertedAction.get());
* {@code
* ActionResponseConvertorData data = new ActionResponseConvertorData(version);
* data.setActionPath(actionPath);
- * Optional<List<Action>> salActions = ConvertorManager.getInstance().convert(ofActions, data);
+ * Optional<List<Action>> salActions = convertorManager.convert(ofActions, data);
* }
* </pre>
*/
-public final class ActionResponseConvertor implements Convertor<
+public final class ActionResponseConvertor extends Convertor<
List<Action>,
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>,
ActionResponseConvertorData> {
// Iterate over Openflow actions, run them through tokenizer and then add them to list of converted actions
if (source != null) {
for (final Action action : source) {
- final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> convertedAction = PROCESSOR.process(action.getActionChoice(), data);
+ final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> convertedAction = PROCESSOR.process(action.getActionChoice(), data, getConvertorExecutor());
if (convertedAction.isPresent()) {
result.add(convertedAction.get());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
CopyTtlInBuilder copyTtlInaction = new CopyTtlInBuilder();
return Optional.of(new CopyTtlInCaseBuilder().setCopyTtlIn(copyTtlInaction.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
CopyTtlOutBuilder copyTtlOutaction = new CopyTtlOutBuilder();
return Optional.of(new CopyTtlOutCaseBuilder().setCopyTtlOut(copyTtlOutaction.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
DecMplsTtlBuilder decMplsTtl = new DecMplsTtlBuilder();
return Optional.of(new DecMplsTtlCaseBuilder().setDecMplsTtl(decMplsTtl.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
DecNwTtlBuilder decNwTtl = new DecNwTtlBuilder();
return Optional.of(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final GroupCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final GroupCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
GroupAction groupActionFromOF = source.getGroupAction();
GroupActionBuilder groupAction = new GroupActionBuilder();
groupAction.setGroupId(groupActionFromOF.getGroupId());
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
}
@Override
- public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
OutputActionBuilder outputAction = new OutputActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final PopMplsCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final PopMplsCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
PopMplsAction popMplsActionFromOF = source.getPopMplsAction();
PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
popMplsAction.setEthernetType(popMplsActionFromOF.getEthertype().getValue());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final PopPbbCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final PopPbbCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
PopPbbActionBuilder popPbb = new PopPbbActionBuilder();
return Optional.of(new PopPbbActionCaseBuilder().setPopPbbAction(popPbb.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final PopVlanCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final PopVlanCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
PopVlanActionBuilder popVlan = new PopVlanActionBuilder();
return Optional.of(new PopVlanActionCaseBuilder().setPopVlanAction(popVlan.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final PushMplsCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final PushMplsCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
PushMplsAction pushMplsActionFromOF = source.getPushMplsAction();
PushMplsActionBuilder pushMplsAction = new PushMplsActionBuilder();
pushMplsAction.setEthernetType(pushMplsActionFromOF.getEthertype().getValue());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final PushPbbCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final PushPbbCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
PushPbbAction pushPbbActionFromOf = source.getPushPbbAction();
PushPbbActionBuilder pushPbbAction = new PushPbbActionBuilder();
pushPbbAction.setEthernetType(pushPbbActionFromOf.getEthertype().getValue());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final PushVlanCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final PushVlanCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
PushVlanAction pushVlanActionFromOF = source.getPushVlanAction();
PushVlanActionBuilder pushVlanAction = new PushVlanActionBuilder();
pushVlanAction.setEthernetType(pushVlanActionFromOF.getEthertype().getValue());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
}
@Override
- public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(data.getVersion());
final SetFieldAction setFieldAction = source.getSetFieldAction();
final SetFieldBuilder setField = new SetFieldBuilder();
- final Optional<MatchBuilder> matchOptional = ConvertorManager.getInstance().convert(setFieldAction, datapathIdConvertorData);
+ final Optional<MatchBuilder> matchOptional = convertorExecutor.convert(setFieldAction, datapathIdConvertorData);
setField.fieldsFrom(matchOptional.orElse(new MatchBuilder()).build());
return Optional.of(new SetFieldCaseBuilder().setSetField(setField.build()).build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final SetMplsTtlCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetMplsTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
SetMplsTtlAction setMplsTtlActionFromOF = source.getSetMplsTtlAction();
SetMplsTtlActionBuilder mplsTtlAction = new SetMplsTtlActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final SetNwDstCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwDstCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
return Optional.of(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final SetNwTtlCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
SetNwTtlAction setNwTtlActionFromOf = source.getSetNwTtlAction();
SetNwTtlActionBuilder setNwTtl = new SetNwTtlActionBuilder();
setNwTtl.setNwTtl(setNwTtlActionFromOf.getNwTtl());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final SetQueueCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetQueueCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
SetQueueAction queueActionFromOF = source.getSetQueueAction();
SetQueueActionBuilder setQueueAction = new SetQueueActionBuilder();
setQueueAction.setQueueId(queueActionFromOF.getQueueId());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
}
@Override
- public Optional<Action> process(@Nonnull final StripVlanCase source, final ActionResponseConvertorData data) {
+ public Optional<Action> process(@Nonnull final StripVlanCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
PopVlanActionBuilder popVlan = new PopVlanActionBuilder();
return Optional.of(new PopVlanActionCaseBuilder().setPopVlanAction(popVlan.build()).build());
}
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new CopyTtlInCaseBuilder().build())
.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new CopyTtlOutCaseBuilder().build())
.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new DecMplsTtlCaseBuilder().build())
.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new DecNwTtlCaseBuilder().build())
.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final DropActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final DropActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.empty();
}
}
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey;
import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final GeneralExtensionGrouping source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final GeneralExtensionGrouping source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final short version = data.getVersion();
/**
* TODO: EXTENSION PROPOSAL (action, MD-SAL to OFJava)
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final GroupActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final GroupActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
GroupAction groupAction = source.getGroupAction();
GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final OutputAction outputAction = source.getOutputAction();
final OutputActionBuilder outputBuilder = new OutputActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final PopMplsActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final PopMplsActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
PopMplsActionBuilder popMplsBuilder = new PopMplsActionBuilder();
popMplsBuilder.setEthertype(new EtherType(new EtherType(source.getPopMplsAction().getEthernetType())));
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final PopPbbActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final PopPbbActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new PopPbbCaseBuilder().build())
.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new PopVlanCaseBuilder().build())
.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new StripVlanCaseBuilder().build())
.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final PushMplsActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final PushMplsActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
PushMplsCaseBuilder pushMplsCaseBuilder = new PushMplsCaseBuilder();
PushMplsActionBuilder pushMplsBuilder = new PushMplsActionBuilder();
pushMplsBuilder.setEthertype(new EtherType(source.getPushMplsAction().getEthernetType()));
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final PushPbbActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final PushPbbActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
PushPbbActionBuilder pushPbbBuilder = new PushPbbActionBuilder();
pushPbbBuilder.setEthertype(new EtherType(source.getPushPbbAction().getEthernetType()));
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final PushVlanActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final PushVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
PushVlanAction pushVlanAction = source.getPushVlanAction();
PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetDlDstAction setdldstaction = source.getSetDlDstAction();
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetDlDstAction setdldstaction = source.getSetDlDstAction();
SetDlDstCaseBuilder setDlDstCaseBuilder = new SetDlDstCaseBuilder();
SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetDlSrcAction setdlsrcaction = source.getSetDlSrcAction();
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetDlSrcAction setdlsrcaction = source.getSetDlSrcAction();
SetDlSrcCaseBuilder setDlSrcCaseBuilder = new SetDlSrcCaseBuilder();
SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final short version = data.getVersion();
final SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
- MatchReactor.getInstance().convert(source.getSetField(), version, setFieldBuilder);
+ MatchReactor.getInstance().convert(source.getSetField(), version, setFieldBuilder, convertorExecutor);
return Optional.of(new ActionBuilder()
.setActionChoice(new SetFieldCaseBuilder()
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetVlanVidCaseBuilder setVlanVidCaseBuilder = new SetVlanVidCaseBuilder();
if (source.getSetField().getVlanMatch() != null) {
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetMplsTtlActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetMplsTtlActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetMplsTtlActionBuilder setMplsTtlBuilder = new SetMplsTtlActionBuilder()
.setMplsTtl(source.getSetMplsTtlAction().getMplsTtl());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final ActionBuilder builder = new ActionBuilder();
final Address address = source.getSetNwDstAction().getAddress();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final ActionBuilder builder = new ActionBuilder();
final Address address = source.getSetNwDstAction().getAddress();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final ActionBuilder builder = new ActionBuilder();
final Address address = source.getSetNwSrcAction().getAddress();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final ActionBuilder builder = new ActionBuilder();
final Address address = source.getSetNwSrcAction().getAddress();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetNwTosAction setnwtosaction = source.getSetNwTosAction();
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetNwTosAction setnwtosaction = source.getSetNwTosAction();
SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
SetNwTosCaseBuilder setNwTosCaseBuilder = new SetNwTosCaseBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetNwTtlActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetNwTtlActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetNwTtlCaseBuilder nwTtlCaseBuilder = new SetNwTtlCaseBuilder();
SetNwTtlActionBuilder nwTtlBuilder = new SetNwTtlActionBuilder();
nwTtlBuilder.setNwTtl(source.getSetNwTtlAction().getNwTtl());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetQueueActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetQueueActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetQueueAction setQueueAction = source.getSetQueueAction();
SetQueueCaseBuilder setQueueCaseBuilder = new SetQueueCaseBuilder();
SetQueueActionBuilder setQueueBuilder = new SetQueueActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IPProtocols;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
IPProtocols protocol = null;
if (data.getIpProtocol() != null) {
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetTpDstAction settpdstaction = source.getSetTpDstAction();
SetTpDstCaseBuilder setTpDstCaseBuilder = new SetTpDstCaseBuilder();
SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IPProtocols;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
IPProtocols protocol = null;
if (data.getIpProtocol() != null) {
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetTpSrcAction settpsrcaction = source.getSetTpSrcAction();
SetTpSrcCaseBuilder setTpSrcCaseBuilder = new SetTpSrcCaseBuilder();
SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetVlanIdAction setvlanidaction = source.getSetVlanIdAction();
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetVlanIdAction setvlanidaction = source.getSetVlanIdAction();
SetVlanVidActionBuilder vlanidActionBuilder = new SetVlanVidActionBuilder();
SetVlanVidCaseBuilder setVlanVidCaseBuilder = new SetVlanVidCaseBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetVlanPcpAction setvlanpcpaction = source.getSetVlanPcpAction();
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetVlanPcpAction setvlanpcpaction = source.getSetVlanPcpAction();
SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder();
SetVlanPcpCaseBuilder setVlanPcpCaseBuilder = new SetVlanPcpCaseBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
List<MatchEntry> entries = new ArrayList<>();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCase;
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
return Optional.of(new ActionBuilder()
.setActionChoice(new StripVlanCaseBuilder().build())
.build());
import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
import org.opendaylight.openflowplugin.extension.api.TypeVersionKey;
import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
@SuppressWarnings("unchecked")
@Nonnull
@Override
- public Optional<Action> process(@Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action source, final ActionConvertorData data) {
+ public Optional<Action> process(@Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final short version = data.getVersion();
final TypeVersionKey<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> key =
new TypeVersionKey<>(
import com.google.common.collect.ImmutableMap;
import java.util.HashMap;
import java.util.Map;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
/**
* @param <FROM> source type for conversion
*
*/
public abstract class ConvertReactor<FROM> {
- private final Map<InjectionKey, ResultInjector<?, ?>> injectionMapping;
- private final Map<Short, Convertor<FROM, ?, ?>> conversionMapping;
+ private final Map<ConvertorKey, ResultInjector<?, ?>> injectionMapping;
+ private final Map<Short, ConvertReactorConvertor<FROM, ?>> conversionMapping;
protected ConvertReactor() {
- final Map<Short, Convertor<FROM, ?, ?>> conversions = new HashMap<>();
- final Map<InjectionKey, ResultInjector<?, ?>> injections = new HashMap<>();
+ final Map<Short, ConvertReactorConvertor<FROM, ?>> conversions = new HashMap<>();
+ final Map<ConvertorKey, ResultInjector<?, ?>> injections = new HashMap<>();
initMappings(conversions, injections);
// Create optimized view of mappings
* @param conversions convert from
* @param injections injection
*/
- protected abstract void initMappings(Map<Short, Convertor<FROM, ?, ?>> conversions,
- Map<InjectionKey, ResultInjector<?, ?>> injections);
+ protected abstract void initMappings(Map<Short, ConvertReactorConvertor<FROM, ?>> conversions,
+ Map<ConvertorKey, ResultInjector<?, ?>> injections);
/**
+ * @param <RESULT> result
+ * @param <TARGET> target
* @param source convert from
* @param version openflow version
* @param target convert to
- * @param <RESULT> result
- * @param <TARGET> target
+ * @param convertorExecutor
*/
@SuppressWarnings("unchecked")
- public <RESULT, TARGET> void convert(final FROM source, final short version, final TARGET target) {
+ public <RESULT, TARGET> void convert(final FROM source, final short version, final TARGET target, final ConvertorExecutor convertorExecutor) {
//lookup converter
- Convertor<FROM, RESULT, ?> convertor = (Convertor<FROM, RESULT, ?>) conversionMapping.get(version);
+ ConvertReactorConvertor<FROM, RESULT> convertor = (ConvertReactorConvertor<FROM, RESULT>) conversionMapping.get(version);
if (convertor == null) {
throw new IllegalArgumentException("convertor for given version ["+version+"] not found");
}
- RESULT convertedItem = convertor.convert(source, null);
+ RESULT convertedItem = convertor.convert(source, convertorExecutor);
//lookup injection
- InjectionKey key = buildInjectionKey(version, convertedItem, target);
+ ConvertorKey key = buildInjectionKey(version, convertedItem, target);
ResultInjector<RESULT, TARGET> injection = (ResultInjector<RESULT, TARGET>) injectionMapping.get(key);
if (injection == null) {
throw new IllegalArgumentException("injector for given version and target ["+key+"] not found");
* @param target object
* @return injection key
*/
- protected InjectionKey buildInjectionKey(final short version, final Object convertedItem, final Object target) {
- return new InjectionKey(version, target.getClass());
+ protected ConvertorKey buildInjectionKey(final short version, final Object convertedItem, final Object target) {
+ return new ConvertorKey(version, target.getClass());
}
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
+
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+
+/**
+ * Converts OpenflowJava to MDSal model and vice versa
+ *
+ * @param <FROM> type of source
+ * @param <TO> type of result
+ */
+public interface ConvertReactorConvertor<FROM, TO> {
+ /**
+ * Converts source to result
+ *
+ * @param source source
+ * @param convertorExecutor
+ * @return converted source
+ */
+ TO convert(FROM source, ConvertorExecutor convertorExecutor);
+}
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
import java.util.Collection;
-import javax.annotation.Nullable;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
*
* @param <FROM> type of source
* @param <TO> type of result
+ * @param <DATA> the type parameter
*/
-public interface Convertor<FROM, TO, DATA extends ConvertorData> {
+public abstract class Convertor<FROM, TO, DATA extends ConvertorData> {
+ private ConvertorExecutor convertorExecutor;
+
+ /**
+ * Gets convertor manager.
+ *
+ * @return the convertor manager
+ */
+ protected ConvertorExecutor getConvertorExecutor() {
+ return convertorExecutor;
+ }
+
+ /**
+ * Sets convertor manager.
+ *
+ * @param convertorExecutor the convertor manager
+ */
+ public void setConvertorExecutor(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
/**
* Gets type of convertor, used in
*
* @return the type of convertor
*/
- Collection<Class<? extends DataContainer>> getTypes();
+ public abstract Collection<Class<? extends DataContainer>> getTypes();
/**
* Converts source to result
* @param data convertor data
* @return converted source
*/
- TO convert(FROM source, @Nullable DATA data);
+ public abstract TO convert(FROM source, DATA data);
}
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
/**
* The Convertor case used in {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor}.
/**
* Process source and return result, what can be empty
*
+ *
* @param source the source
* @param data the data
+ * @param convertorExecutor convertor executor
* @return the optional
*/
- public abstract Optional<TO> process(@Nonnull final FROM source, final DATA data);
+ public abstract Optional<TO> process(@Nonnull final FROM source, final DATA data, final ConvertorExecutor convertorExecutor);
/**
* Should {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor}
/**
* Cast untyped source to type of this case and sends it to actual process method.
*
+ *
* @param source the source
* @param data the data
+ * @param convertorExecutor convertor executor
* @return the optional
*/
- Optional<TO> processRaw(@Nonnull final Object source, final DATA data) {
- return process(getType().cast(source), data);
+ Optional<TO> processRaw(@Nonnull final Object source, final DATA data, final ConvertorExecutor convertorExecutor) {
+ return process(getType().cast(source), data, convertorExecutor);
}
/**
/**
* injection lookup key based on version and target object
*/
-public class InjectionKey {
+public class ConvertorKey {
private final int version;
private final Class<?> targetClazz;
* @param version openflow version
* @param targetClazz target class
*/
- public InjectionKey(final int version, final Class<?> targetClazz) {
+ public ConvertorKey(final int version, final Class<?> targetClazz) {
this.version = version;
this.targetClazz = Preconditions.checkNotNull(targetClazz);
}
if (getClass() != obj.getClass()) {
return false;
}
- final InjectionKey other = (InjectionKey) obj;
- if (version != other.version) {
- return false;
- }
- return targetClazz.equals(other.targetClazz);
+ final ConvertorKey other = (ConvertorKey) obj;
+ return version == other.version && targetClazz.equals(other.targetClazz);
}
@Override
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final short OFP_VERSION_ALL = 0x00;
private static final Logger LOG = LoggerFactory.getLogger(ConvertorProcessor.class);
- private final Map<InjectionKey, ConvertorCase<?, TO, DATA>> conversions = new ConcurrentHashMap<>();
+ private final Map<Short, Map<Class<?>, ConvertorCase<?, TO, DATA>>> conversions = new ConcurrentHashMap<>();
private ConvertorCase<?, TO, DATA> defaultCase;
/**
*/
public ConvertorProcessor<FROM, TO, DATA> addCase(final ConvertorCase<?, TO, DATA> processorCase) {
if (processorCase.getSupportedVersions().isEmpty()) {
- final InjectionKey key = new InjectionKey(OFP_VERSION_ALL, processorCase.getType());
- conversions.putIfAbsent(key, processorCase);
+ getCasesForVersion(OFP_VERSION_ALL).putIfAbsent(processorCase.getType(), processorCase);
} else {
for (short supportedVersion : processorCase.getSupportedVersions()) {
- final InjectionKey key = new InjectionKey(supportedVersion, processorCase.getType());
- conversions.putIfAbsent(key, processorCase);
+ getCasesForVersion(supportedVersion).putIfAbsent(processorCase.getType(), processorCase);
}
}
* Process source and return result based on convertor cases, or empty if no match is found.
*
* @param source the source
+ * @param convertorExecutor convertor executor
* @return the optional
*/
- public Optional<TO> process(final FROM source) {
- return process(source, null);
+ public Optional<TO> process(final FROM source, final ConvertorExecutor convertorExecutor) {
+ return process(source, null, convertorExecutor);
}
/**
*
* @param source the source
* @param data the data
+ * @param convertorExecutor convertor executor
* @return the optional
*/
- public Optional<TO> process(final FROM source, final DATA data) {
+ public Optional<TO> process(final FROM source, final DATA data, final ConvertorExecutor convertorExecutor) {
Optional<TO> result = Optional.empty();
final short version = data != null ? data.getVersion() : OFP_VERSION_ALL;
}
final Class<?> clazz = source.getImplementedInterface();
- final InjectionKey key = new InjectionKey(version, clazz);
- final Optional<ConvertorCase<?, TO, DATA>> caseOptional = Optional.ofNullable(conversions.get(key));
+ final Optional<ConvertorCase<?, TO, DATA>> caseOptional = Optional
+ .ofNullable(getCasesForVersion(version).get(clazz));
+
final ConvertorCase<?, TO, DATA> processorCase = caseOptional.orElse(defaultCase);
if (Objects.nonNull(processorCase)) {
- result = processorCase.processRaw(source, data);
+ result = processorCase.processRaw(source, data, convertorExecutor);
if (processorCase.isErrorOnEmpty() && !result.isPresent()) {
LOG.warn("Failed to process {} for version {}", clazz, version);
this.defaultCase = defaultCase;
return this;
}
+
+ private Map<Class<?>, ConvertorCase<?, TO, DATA>> getCasesForVersion(final short version) {
+ final Map<Class<?>, ConvertorCase<?, TO, DATA>> casesForVersion =
+ conversions.getOrDefault(version, new ConcurrentHashMap<>());
+
+ conversions.putIfAbsent(version, casesForVersion);
+
+ return casesForVersion;
+ }
}
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data;
import java.math.BigInteger;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
/**
* Convertor data implementation containing Openflow version and datapath ID
*/
-public class VersionDatapathIdConvertorData extends ConvertorData {
+public class VersionDatapathIdConvertorData extends VersionConvertorData {
private BigInteger datapathId;
/**
import java.util.List;
import java.util.Optional;
import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor;
* {@code
* VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
* data.setDatapathId(datapathId);
- * Optional<List<FlowModInputBuilder>> ofFlow = ConvertorManager.getInstance().convert(salFlow, data);
+ * Optional<List<FlowModInputBuilder>> ofFlow = convertorManager.convert(salFlow, data);
* }
* </pre>
*/
-public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>, VersionDatapathIdConvertorData> {
+public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, VersionDatapathIdConvertorData> {
/**
* Default idle timeout
*/
.addCase(new MeterCase())
.addCase(new WriteActionsCase())
.addCase(new WriteMetadataCase());
+ private static final List<Class<? extends DataContainer>> TYPES = Arrays.asList(Flow.class, AddFlowInput.class, RemoveFlowInput.class, UpdatedFlow.class);
static {
final VlanId zeroVlan = new VlanId(0);
VLAN_MATCH_TRUE = vlanMatchBuilder2.build();
}
- private static FlowModInputBuilder toFlowModInput(Flow flow, short version, BigInteger datapathid) {
+ private FlowModInputBuilder toFlowModInput(Flow flow, short version, BigInteger datapathid) {
FlowModInputBuilder flowMod = new FlowModInputBuilder();
salToOFFlowCookie(flow, flowMod);
salToOFFlowOutGroup(flow, flowMod);
// convert and inject flowFlags
- FlowFlagReactor.getInstance().convert(flow.getFlags(), version, flowMod);
+ FlowFlagReactor.getInstance().convert(flow.getFlags(), version, flowMod, getConvertorExecutor());
// convert and inject match
- MatchReactor.getInstance().convert(flow.getMatch(), version, flowMod);
+ MatchReactor.getInstance().convert(flow.getMatch(), version, flowMod, getConvertorExecutor());
if (flow.getInstructions() != null) {
flowMod.setInstruction(toInstructions(flow, version, datapathid));
}
}
- private static List<Instruction> toInstructions(Flow flow, short version, BigInteger datapathid) {
+ private List<Instruction> toInstructions(Flow flow, short version, BigInteger datapathid) {
final List<Instruction> instructionsList = new ArrayList<>();
final ActionConvertorData data = new ActionConvertorData(version);
data.setDatapathId(datapathid);
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction
.getInstruction();
- Optional<Instruction> result = PROCESSOR.process(curInstruction, data);
+ Optional<Instruction> result = PROCESSOR.process(curInstruction, data, getConvertorExecutor());
if (result.isPresent()) {
instructionsList.add(result.get());
return instructionsList;
}
- private static List<Action> getActions(short version, BigInteger datapathid, Flow flow) {
+ private List<Action> getActions(short version, BigInteger datapathid, Flow flow) {
Instructions instructions = flow.getInstructions();
List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction> sortedInstructions =
INSTRUCTION_ORDERING.sortedCopy(instructions.getInstruction());
final ActionConvertorData data = new ActionConvertorData(version);
data.setDatapathId(datapathid);
data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));
- Optional<List<Action>> result = ConvertorManager.getInstance().convert(applyActions.getAction(), data);
+ Optional<List<Action>> result = getConvertorExecutor().convert(applyActions.getAction(), data);
return result.orElse(Collections.emptyList());
}
}
* Â Â 1) Match on (OFPVID_NONEÂ ) without mask + action [push vlan tag + set_field]
* Â Â 2) Match on (OFPVID_PRESENT) with mask (OFPVID_PRESENT ) + action [ set_field]
*/
- private static List<FlowModInputBuilder> handleSetVlanIdForOF13(Flow srcFlow, short version, BigInteger datapathId) {
+ private List<FlowModInputBuilder> handleSetVlanIdForOF13(Flow srcFlow, short version, BigInteger datapathId) {
List<FlowModInputBuilder> list = new ArrayList<>(2);
final Match srcMatch = Preconditions.checkNotNull(srcFlow.getMatch());
@Override
public Collection<Class<? extends DataContainer>> getTypes() {
- return Arrays.asList(Flow.class, AddFlowInput.class, RemoveFlowInput.class, UpdatedFlow.class);
+ return TYPES;
}
@Override
import java.util.Set;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
* <pre>
* {@code
* VersionConvertorData data = new VersionConvertorData(version);
- * Optional<Instructions> salFlowInstruction = ConvertorManager.getInstance().convert(ofFlowInstructions, data);
+ * Optional<Instructions> salFlowInstruction = convertorManager.convert(ofFlowInstructions, data);
* }
* </pre>
*/
-public final class FlowInstructionResponseConvertor implements Convertor<
+public final class FlowInstructionResponseConvertor extends Convertor<
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction>,
Instructions,
VersionConvertorData> {
final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
- final Optional<List<Action>> actions = ConvertorManager.getInstance().convert(
+ final Optional<List<Action>> actions = getConvertorExecutor().convert(
actionsInstruction.getApplyActions().getAction(), actionResponseConvertorData);
applyActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
- final Optional<List<Action>> actions = ConvertorManager.getInstance().convert(
+ final Optional<List<Action>> actions = getConvertorExecutor().convert(
writeActionsCase.getWriteActions().getAction(), actionResponseConvertorData);
writeActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow;
-import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
* {@code
* VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
* data.setDatapathId(datapathId);
- * Optional<List<FlowAndStatisticsMapList>> salFlowStats = ConvertorManager.getInstance().convert(ofFlowStats, data);
+ * Optional<List<FlowAndStatisticsMapList>> salFlowStats = convertorManager.convert(ofFlowStats, data);
* }
* </pre>
*/
-public class FlowStatsResponseConvertor implements Convertor<List<FlowStats>, List<FlowAndStatisticsMapList>, VersionDatapathIdConvertorData> {
+public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<FlowAndStatisticsMapList>, VersionDatapathIdConvertorData> {
private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(FlowStats.class);
* @param actionsList list of action
* @return OF10 actions as an instructions
*/
- @VisibleForTesting
- static Instructions wrapOF10ActionsToInstruction(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actionsList, final short version) {
+ private Instructions wrapOF10ActionsToInstruction(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actionsList, final short version) {
ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(version);
actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
- final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> actions = ConvertorManager.getInstance().convert(
+ final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> actions = getConvertorExecutor().convert(
actionsList, actionResponseConvertorData);
applyActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
salFlowStatsBuilder.setTableId(flowStats.getTableId());
if (flowStats.getMatchV10() != null) {
- final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(flowStats.getMatchV10(), data);
+ final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(flowStats.getMatchV10(), data);
if (matchBuilderOptional.isPresent()) {
salFlowStatsBuilder.setMatch(matchBuilderOptional.get().build());
}
if (flowStats.getMatch() != null) {
- final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(flowStats.getMatch(), data);
+ final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(flowStats.getMatch(), data);
if (matchBuilderOptional.isPresent()) {
final MatchBuilder matchBuilder = matchBuilderOptional.get();
if (flowStats.getInstruction() != null) {
final VersionConvertorData simpleConvertorData = new VersionConvertorData(data.getVersion());
- final Optional<Instructions> instructions = ConvertorManager.getInstance().convert(
+ final Optional<Instructions> instructions = getConvertorExecutor().convert(
flowStats.getInstruction(), simpleConvertorData);
salFlowStatsBuilder.setInstructions(instructions.orElse(new InstructionsBuilder()
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActions;
}
@Override
- public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase source, final ActionConvertorData data) {
+ public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
ApplyActions applyActions = source.getApplyActions();
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
- final Optional<List<Action>> actionList = ConvertorManager.getInstance().convert(
- applyActions.getAction(), data);
+ final Optional<List<Action>> actionList = convertorExecutor.convert(applyActions.getAction(), data);
applyActionsBuilder.setAction(actionList.orElse(Collections.emptyList()));
applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder;
}
@Override
- public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase source, final ActionConvertorData data) {
+ public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
InstructionBuilder instructionBuilder = new InstructionBuilder();
instructionBuilder.setInstructionChoice(clearActionsCaseBuilder.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTable;
}
@Override
- public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase source, final ActionConvertorData data) {
+ public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
GoToTable goToTable = source.getGoToTable();
GotoTableCaseBuilder gotoTableCaseBuilder = new GotoTableCaseBuilder();
GotoTableBuilder gotoTableBuilder = new GotoTableBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.Meter;
}
@Override
- public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase source, final ActionConvertorData data) {
+ public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
Meter meter = source.getMeter();
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
MeterBuilder meterBuilder = new MeterBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.actions._case.WriteActions;
}
@Override
- public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase source, final ActionConvertorData data) {
+ public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
WriteActions writeActions = source.getWriteActions();
WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
- final Optional<List<Action>> actions = ConvertorManager.getInstance().convert(
- writeActions.getAction(), data);
+ final Optional<List<Action>> actions = convertorExecutor.convert(writeActions.getAction(), data);
writeActionsBuilder.setAction(actions.orElse(Collections.emptyList()));
writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
}
@Override
- public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase source, final ActionConvertorData data) {
+ public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
WriteMetadata writeMetadata = source.getWriteMetadata();
WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder();
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flowflag;
-import java.util.Collection;
-import java.util.Collections;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* converting from MD-SAL match model into appropriate OF-API match model
*
* @param <E> type of converted match
*/
-public interface FlowFlagConvertor<E> extends Convertor<FlowModFlags, E, VersionConvertorData> {
-
- @Override
- default Collection<Class<? extends DataContainer>> getTypes() {
- return Collections.singleton(DataContainer.class);
- }
-
- @Override
- default E convert(FlowModFlags source, VersionConvertorData data) {
- return convert(source);
- }
-
+public interface FlowFlagConvertor<E> extends ConvertReactorConvertor<FlowModFlags, E> {
/**
* @param source flow mode flags
+ * @param convertorExecutor
* @return converted match (into OF-API model)
*/
- E convert(FlowModFlags source);
+ E convert(FlowModFlags source, ConvertorExecutor convertorExecutor);
}
import java.util.Map;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
}
@Override
- protected void initMappings(final Map<Short, Convertor<FlowModFlags, ?, ?>> conversions,
- final Map<InjectionKey, ResultInjector<?, ?>> injections) {
+ protected void initMappings(final Map<Short, ConvertReactorConvertor<FlowModFlags, ?>> conversions,
+ final Map<ConvertorKey, ResultInjector<?, ?>> injections) {
FlowFlagReactorMappingFactory.addFlowFlagsConvertors(conversions);
FlowFlagReactorMappingFactory.addFlowFlagsIjectors(injections);
}
import java.util.Map;
import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlagsV10;
/**
* @param conversionMapping conversion mapping
*/
- public static void addFlowFlagsConvertors(final Map<Short, Convertor<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags, ?, ?>> conversionMapping) {
+ public static void addFlowFlagsConvertors(final Map<Short, ConvertReactorConvertor<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags, ?>> conversionMapping) {
conversionMapping.put(OFConstants.OFP_VERSION_1_3, new FlowFlagsConvertorImpl());
conversionMapping.put(OFConstants.OFP_VERSION_1_0, new FlowFlagsConvertorV10Impl());
}
/**
* @param injectionMapping injection mapping
*/
- public static void addFlowFlagsIjectors(final Map<InjectionKey, ResultInjector<?, ?>> injectionMapping) {
+ public static void addFlowFlagsIjectors(final Map<ConvertorKey, ResultInjector<?, ?>> injectionMapping) {
// OF-1.3|FlowModFlags --> FlowModInputBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
new ResultInjector<FlowModFlags, FlowModInputBuilder>() {
@Override
public void inject(final FlowModFlags value,
});
// OF-1.3|FlowModFlagsV10 --> FlowModInputBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
new ResultInjector<FlowModFlagsV10, FlowModInputBuilder>() {
@Override
public void inject(final FlowModFlagsV10 value,
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flowflag;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
@Override
public FlowModFlags convert(
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags source) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags source, ConvertorExecutor convertorExecutor) {
FlowModFlags ofFlowModFlags;
if (source != null) {
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flowflag;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlagsV10;
@Override
public FlowModFlagsV10 convert(
- FlowModFlags source) {
+ FlowModFlags source, ConvertorExecutor convertorExecutor) {
FlowModFlagsV10 ofFlowModFlags;
if (source != null) {
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
-import java.util.Collection;
-import java.util.Collections;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* converting from MD-SAL match model into appropriate OF-API match model
*
* @param <E> type of converted match
*/
-public interface MatchConvertor<E> extends Convertor<Match, E, VersionConvertorData> {
-
- @Override
- default Collection<Class<? extends DataContainer>> getTypes() {
- return Collections.singleton(DataContainer.class);
- }
-
- @Override
- default E convert(Match source, VersionConvertorData data) {
- return convert(source);
- }
-
+public interface MatchConvertor<E> extends ConvertReactorConvertor<Match, E> {
/**
* @param source match input
+ * @param convertorExecutor
* @return converted match (into OF-API model)
*/
- E convert(Match source);
+ E convert(Match source, ConvertorExecutor convertorExecutor);
}
import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionResolvers;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.OFApprovedExperimenterIds;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cases.SalToOfArpMatchCase;
private static final byte[] VLAN_VID_MASK = new byte[]{16, 0};
- private static void layer3Match(final List<MatchEntry> matchEntryList, final Layer3Match layer3Match) {
- java.util.Optional<List<MatchEntry>> result = LAYER3_PROCESSOR.process(layer3Match);
+ private static void layer3Match(final List<MatchEntry> matchEntryList, final Layer3Match layer3Match, ConvertorExecutor convertorExecutor) {
+ java.util.Optional<List<MatchEntry>> result = LAYER3_PROCESSOR.process(layer3Match, convertorExecutor);
if (result.isPresent()) {
matchEntryList.addAll(result.get());
}
}
- private static void layer4Match(final List<MatchEntry> matchEntryList, final Layer4Match layer4Match) {
- java.util.Optional<List<MatchEntry>> result = LAYER4_PROCESSOR.process(layer4Match);
+ private static void layer4Match(final List<MatchEntry> matchEntryList, final Layer4Match layer4Match, ConvertorExecutor convertorExecutor) {
+ java.util.Optional<List<MatchEntry>> result = LAYER4_PROCESSOR.process(layer4Match, convertorExecutor);
if (result.isPresent()) {
matchEntryList.addAll(result.get());
}
@Override
- public List<MatchEntry> convert(final Match match) {
+ public List<MatchEntry> convert(final Match match, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (match == null) {
ethernetMatch(result, match.getEthernetMatch());
vlanMatch(result, match.getVlanMatch());
ipMatch(result, match.getIpMatch());
- layer4Match(result, match.getLayer4Match());
+ layer4Match(result, match.getLayer4Match(), convertorExecutor);
icmpv4Match(result, match.getIcmpv4Match());
icmpv6Match(result, match.getIcmpv6Match());
- layer3Match(result, match.getLayer3Match());
+ layer3Match(result, match.getLayer3Match(), convertorExecutor);
protocolMatchFields(result, match.getProtocolMatchFields());
tunnelMatch(result, match.getTunnel());
tcpFlagsMatch(result, match.getTcpFlagsMatch());
import java.util.Iterator;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.util.ActionUtil;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
* Method builds openflow 1.0 specific match (MatchV10) from MD-SAL match.
*
* @param match MD-SAL match
+ * @param convertorExecutor
* @return OF-API match
*/
@Override
- public MatchV10 convert(final Match match) {
+ public MatchV10 convert(final Match match, ConvertorExecutor convertorExecutor) {
MatchV10Builder matchBuilder = new MatchV10Builder();
boolean _dLDST = true;
boolean _dLSRC = true;
import java.util.Map;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
}
@Override
- protected void initMappings(final Map<Short, Convertor<Match, ?, ?>> conversions,
- final Map<InjectionKey, ResultInjector<?, ?>> injections) {
+ protected void initMappings(final Map<Short, ConvertReactorConvertor<Match, ?>> conversions,
+ final Map<ConvertorKey, ResultInjector<?, ?>> injections) {
MatchReactorMappingFactory.addMatchConvertors(conversions);
MatchReactorMappingFactory.addMatchIjectors(injections);
}
import java.util.List;
import java.util.Map;
import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
/**
* @param conversionMapping conversion mapping
*/
- public static void addMatchConvertors(final Map<Short, Convertor<Match, ?, ?>> conversionMapping) {
+ public static void addMatchConvertors(final Map<Short, ConvertReactorConvertor<Match, ?>> conversionMapping) {
conversionMapping.put(OFConstants.OFP_VERSION_1_3, new MatchConvertorImpl());
conversionMapping.put(OFConstants.OFP_VERSION_1_0, new MatchConvertorV10Impl());
}
/**
* @param injectionMapping injection mapping
*/
- public static void addMatchIjectors(final Map<InjectionKey, ResultInjector<?, ?>> injectionMapping) {
+ public static void addMatchIjectors(final Map<ConvertorKey, ResultInjector<?, ?>> injectionMapping) {
// OF-1.3|List<MatchEntries> --> FlowModInputBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
new ResultInjector<List<MatchEntry>, FlowModInputBuilder>() {
@Override
public void inject(final List<MatchEntry> value,
});
// OF-1.3|List<MatchEntries> --> OxmFieldsActionBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, SetFieldActionBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, SetFieldActionBuilder.class),
new ResultInjector<List<MatchEntry>, SetFieldActionBuilder>() {
@Override
public void inject(final List<MatchEntry> value,
});
// OF-1.0|MatchV10Builder --> FlowModInputBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
new ResultInjector<MatchV10, FlowModInputBuilder>() {
@Override
public void inject(final MatchV10 value,
});
// OF-1.3|List<MatchEntries> --> MultipartRequestFlowBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, MultipartRequestFlowBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, MultipartRequestFlowBuilder.class),
new ResultInjector<List<MatchEntry>, MultipartRequestFlowBuilder>() {
@Override
public void inject(final List<MatchEntry> value,
});
// OF-1.0|List<MatchEntries> --> MultipartRequestFlowBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, MultipartRequestFlowBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, MultipartRequestFlowBuilder.class),
new ResultInjector<MatchV10, MultipartRequestFlowBuilder>() {
@Override
public void inject(final MatchV10 value,
});
// OF-1.3|List<MatchEntries> --> MultipartRequestAggregateBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, MultipartRequestAggregateBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, MultipartRequestAggregateBuilder.class),
new ResultInjector<List<MatchEntry>, MultipartRequestAggregateBuilder>() {
@Override
public void inject(final List<MatchEntry> value,
});
// OF-1.0|List<MatchEntries> --> MultipartRequestAggregateBuilder
- injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, MultipartRequestAggregateBuilder.class),
+ injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, MultipartRequestAggregateBuilder.class),
new ResultInjector<MatchV10, MultipartRequestAggregateBuilder>() {
@Override
public void inject(final MatchV10 value,
* {@code
* VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
* data.setDatapathId(datapathId);
- * Optional<MatchBuilder> salMatch = ConvertorManager.getInstance().convert(ofMatch, data);
+ * Optional<MatchBuilder> salMatch = convertorManager.convert(ofMatch, data);
* }
* </pre>
*/
-public class MatchResponseConvertor implements Convertor<MatchEntriesGrouping, MatchBuilder, VersionDatapathIdConvertorData> {
+public class MatchResponseConvertor extends Convertor<MatchEntriesGrouping, MatchBuilder, VersionDatapathIdConvertorData> {
private static final ConvertorProcessor<MatchEntryValue, MatchBuilder, MatchResponseConvertorData> OF_TO_SAL_PROCESSOR = new ConvertorProcessor<MatchEntryValue, MatchBuilder, MatchResponseConvertorData>()
.addCase(new OfToSalInPortCase())
.addCase(new OfToSalInPhyPortCase())
* org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value
* and proper use of it can fix this bug.
*/
- OF_TO_SAL_TUNNEL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data);
+ OF_TO_SAL_TUNNEL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data, getConvertorExecutor());
} else {
data.setOxmMatchField(ofMatch.getOxmMatchField());
- OF_TO_SAL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data);
+ OF_TO_SAL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data, getConvertorExecutor());
}
}
* {@code
* VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
* data.setDatapathId(datapathId);
- * Optional<MatchBuilder> salMatch = ConvertorManager.getInstance().convert(ofMatchV10, data);
+ * Optional<MatchBuilder> salMatch = convertorManager.convert(ofMatchV10, data);
* }
* </pre>
*/
-public class MatchV10ResponseConvertor implements Convertor<MatchV10, MatchBuilder, VersionDatapathIdConvertorData> {
+public class MatchV10ResponseConvertor extends Convertor<MatchV10, MatchBuilder, VersionDatapathIdConvertorData> {
private static final short PROTO_TCP = 6;
private static final short PROTO_UDP = 17;
private static final short PROTO_ICMPV4 = 1;
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull ArpOpCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull ArpOpCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
import javax.annotation.Nonnull;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull ArpShaCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull ArpShaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull ArpSpaCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull ArpSpaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
import javax.annotation.Nonnull;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull ArpThaCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull ArpThaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull ArpTpaCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull ArpTpaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull EthDstCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull EthDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull EthSrcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull EthSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull EthTypeCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull EthTypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull ExperimenterIdCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull ExperimenterIdCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
if (data.getOxmMatchField().equals(TcpFlags.class)) {
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Icmpv4CodeCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Icmpv4CodeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Icmpv4MatchBuilder icmpv4MatchBuilder = data.getIcmpv4MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Icmpv4TypeCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Icmpv4TypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Icmpv4MatchBuilder icmpv4MatchBuilder = data.getIcmpv4MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Icmpv6CodeCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Icmpv6CodeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Icmpv6MatchBuilder icmpv6MatchBuilder = data.getIcmpv6MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Icmpv6TypeCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Icmpv6TypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Icmpv6MatchBuilder icmpv6MatchBuilder = data.getIcmpv6MatchBuilder();
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull InPhyPortCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull InPhyPortCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
final BigInteger datapathId = data.getDatapathId();
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull InPortCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull InPortCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
final BigInteger datapathId = data.getDatapathId();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull IpDscpCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull IpDscpCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final IpMatchBuilder ipMatchBuilder = data.getIpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull IpEcnCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull IpEcnCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final IpMatchBuilder ipMatchBuilder = data.getIpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull IpProtoCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull IpProtoCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final IpMatchBuilder ipMatchBuilder = data.getIpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
final Ipv4MatchArbitraryBitMaskBuilder ipv4MatchArbitraryBitMaskBuilder = data.getIpv4MatchArbitraryBitMaskBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
final Ipv4MatchArbitraryBitMaskBuilder ipv4MatchArbitraryBitMaskBuilder = data.getIpv4MatchArbitraryBitMaskBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv6DstCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv6DstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
final Ipv6MatchArbitraryBitMaskBuilder ipv6MatchArbitraryBitMaskBuilder = data.getIpv6MatchArbitraryBitMaskBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv6ExthdrCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv6ExthdrCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv6FlabelCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv6FlabelCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv6NdSllCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv6NdSllCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv6NdTargetCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv6NdTargetCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv6NdTllCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv6NdTllCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv6SrcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv6SrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
final Ipv6MatchArbitraryBitMaskBuilder ipv6MatchArbitraryBitMaskBuilder = data.getIpv6MatchArbitraryBitMaskBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull MetadataCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull MetadataCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final MetadataBuilder metadataBuilder = new MetadataBuilder();
final Metadata metadata = source.getMetadata();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull MplsBosCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull MplsBosCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull MplsLabelCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull MplsLabelCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull MplsTcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull MplsTcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull PbbIsidCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull PbbIsidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull SctpDstCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull SctpDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final SctpMatchBuilder sctpMatchBuilder = data.getSctpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull SctpSrcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull SctpSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final SctpMatchBuilder sctpMatchBuilder = data.getSctpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull TcpDstCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull TcpDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final TcpMatchBuilder tcpMatchBuilder = data.getTcpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull TcpSrcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull TcpSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final TcpMatchBuilder tcpMatchBuilder = data.getTcpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull TunnelIdCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull TunnelIdCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
TunnelId tunnelId = source.getTunnelId();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
final TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = data.getTunnelIpv4MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
final TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = data.getTunnelIpv4MatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull UdpDstCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull UdpDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final UdpMatchBuilder udpMatchBuilder = data.getUdpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull UdpSrcCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull UdpSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final UdpMatchBuilder udpMatchBuilder = data.getUdpMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull VlanPcpCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull VlanPcpCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final VlanMatchBuilder vlanMatchBuilder = data.getVlanMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
}
@Override
- public Optional<MatchBuilder> process(@Nonnull VlanVidCase source, MatchResponseConvertorData data) {
+ public Optional<MatchBuilder> process(@Nonnull VlanVidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final VlanMatchBuilder vlanMatchBuilder = data.getVlanMatchBuilder();
import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull ArpMatch source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull ArpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getArpOp() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull Ipv4MatchArbitraryBitMask source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull Ipv4MatchArbitraryBitMask source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getIpv4SourceAddressNoMask() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull Ipv4Match source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull Ipv4Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getIpv4Source() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull Ipv6MatchArbitraryBitMask source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull Ipv6MatchArbitraryBitMask source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getIpv6SourceAddressNoMask() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull Ipv6Match source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull Ipv6Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getIpv6Source() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull SctpMatch source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull SctpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getSctpSourcePort() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull TcpMatch source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull TcpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getTcpSourcePort() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull TunnelIpv4Match source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull TunnelIpv4Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getTunnelIpv4Source() != null) {
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch;
}
@Override
- public Optional<List<MatchEntry>> process(@Nonnull UdpMatch source, VersionConvertorData data) {
+ public Optional<List<MatchEntry>> process(@Nonnull UdpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getUdpSourcePort() != null) {
import org.opendaylight.openflowplugin.extension.api.AugmentTuple;
import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
private static final Logger LOG = LoggerFactory.getLogger(FlowRemovedTranslator.class);
private static final String PREFIX_SEPARATOR = "/";
+ private final ConvertorExecutor convertorExecutor;
+
+ public FlowRemovedTranslator(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
@Override
public List<DataObject> translate(final SwitchConnectionDistinguisher cookie, final SessionContext sc, final OfHeader msg) {
final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(sc.getPrimaryConductor().getVersion());
data.setDatapathId(sc.getFeatures().getDatapathId());
- final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(ofFlow.getMatchV10(), data);
+ final Optional<MatchBuilder> matchBuilderOptional = convertorExecutor.convert(ofFlow.getMatchV10(), data);
salFlowRemoved.setMatch(matchBuilderOptional.orElse(new MatchBuilder()).build());
}
salFlowRemoved.setNode(new NodeRef(InventoryDataServiceUtil.identifierFromDatapathId(sc.getFeatures()
import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
private static final Logger LOG = LoggerFactory
.getLogger(MultipartReplyTableFeaturesToTableUpdatedTranslator.class);
+ private final ConvertorExecutor convertorExecutor;
+
+ public MultipartReplyTableFeaturesToTableUpdatedTranslator(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
@Override
public List<DataObject> translate(SwitchConnectionDistinguisher cookie, SessionContext sc, OfHeader msg) {
List<DataObject> listDataObject = new CopyOnWriteArrayList<>();
- TableUpdatedBuilder message = new TableUpdatedBuilder() ;
+ TableUpdatedBuilder message = new TableUpdatedBuilder();
message.setNode((new NodeRef(InventoryDataServiceUtil.identifierFromDatapathId(sc.getFeatures()
.getDatapathId()))));
message.setMoreReplies(mpReply.getFlags().isOFPMPFREQMORE());
MultipartReplyTableFeaturesCase caseBody = (MultipartReplyTableFeaturesCase) mpReply.getMultipartReplyBody();
MultipartReplyTableFeatures body = caseBody.getMultipartReplyTableFeatures();
- final Optional<List<TableFeatures>> tableFeaturesList = ConvertorManager.getInstance().convert(body);
+ final VersionConvertorData data = new VersionConvertorData(sc.getPrimaryConductor().getVersion());
+ final Optional<List<TableFeatures>> tableFeaturesList = convertorExecutor.convert(body, data);
message.setTableFeatures(tableFeaturesList.orElse(Collections.emptyList()));
listDataObject.add( message.build()) ;
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
protected static final Logger logger = LoggerFactory
.getLogger(MultipartReplyTranslator.class);
+ private final ConvertorExecutor convertorExecutor;
+
+ public MultipartReplyTranslator(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
@Override
List<DataObject> listDataObject = new CopyOnWriteArrayList<DataObject>();
OpenflowVersion ofVersion = OpenflowVersion.get(sc.getPrimaryConductor().getVersion());
+ final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(sc.getPrimaryConductor().getVersion());
+ data.setDatapathId(sc.getFeatures().getDatapathId());
if(msg instanceof MultipartReplyMessage){
MultipartReplyMessage mpReply = (MultipartReplyMessage)msg;
message.setTransactionId(generateTransactionId(mpReply.getXid()));
MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase)mpReply.getMultipartReplyBody();
MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
- final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(sc.getPrimaryConductor().getVersion());
- data.setDatapathId(sc.getFeatures().getDatapathId());
- final Optional<List<FlowAndStatisticsMapList>> flowAndStatisticsMapLists = ConvertorManager.getInstance().convert(replyBody.getFlowStats(), data);
+ final Optional<List<FlowAndStatisticsMapList>> flowAndStatisticsMapLists = convertorExecutor.convert(replyBody.getFlowStats(), data);
message.setFlowAndStatisticsMapList(flowAndStatisticsMapLists.orElse(Collections.emptyList()));
logger.debug("Converted flow statistics : {}",message.build().toString());
message.setTransactionId(generateTransactionId(mpReply.getXid()));
MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase)mpReply.getMultipartReplyBody();
MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
- final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(replyBody.getGroupStats());
+ final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(replyBody.getGroupStats(), data);
message.setGroupStats(groupStatsList.orElse(Collections.emptyList()));
logger.debug("Converted group statistics : {}",message.toString());
listDataObject.add(message.build());
MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase)mpReply.getMultipartReplyBody();
MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
- final VersionConvertorData data = new VersionConvertorData(sc.getPrimaryConductor().getVersion());
- final Optional<List<GroupDescStats>> groupDescStatsList = ConvertorManager.getInstance().convert(replyBody.getGroupDesc(), data);
+ final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(replyBody.getGroupDesc(), data);
message.setGroupDescStats(groupDescStatsList.orElse(Collections.emptyList()));
logger.debug("Converted group statistics : {}",message.toString());
listDataObject.add(message.build());
MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>> meterStatsList =
- ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+ convertorExecutor.convert(replyBody.getMeterStats(), data);
message.setMeterStats(meterStatsList.orElse(Collections.emptyList()));
listDataObject.add(message.build());
MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase)mpReply.getMultipartReplyBody();
MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
- final Optional<List<MeterConfigStats>> meterConfigStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterConfig());
+ final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
message.setMeterConfigStats(meterConfigStatsList.orElse(Collections.emptyList()));
listDataObject.add(message.build());
import org.opendaylight.openflowplugin.extension.api.AugmentTuple;
import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.openflowplugin.openflow.md.util.PacketInUtil;
private static final Logger LOG = LoggerFactory
.getLogger(PacketInTranslator.class);
+ private final ConvertorExecutor convertorExecutor;
+
+ public PacketInTranslator(ConvertorExecutor convertorExecutor) {
+ this.convertorExecutor = convertorExecutor;
+ }
@Override
public List<DataObject> translate(final SwitchConnectionDistinguisher cookie,
datapathIdConvertorData.setDatapathId(dpid);
final OpenflowVersion ofVersion = OpenflowVersion.get(sc.getPrimaryConductor().getVersion());
- final Optional<MatchBuilder> matchOptional = ConvertorManager.getInstance().convert(message.getMatch(), datapathIdConvertorData);
+ final Optional<MatchBuilder> matchOptional = convertorExecutor.convert(message.getMatch(), datapathIdConvertorData);
final MatchBuilder matchBuilder = new MatchBuilder(matchOptional.orElse(new MatchBuilder()).build());
AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match> matchExtensionWrap =
import org.opendaylight.openflowplugin.openflow.md.core.plan.ConnectionAdapterStackImpl;
import org.opendaylight.openflowplugin.openflow.md.core.plan.EventFactory;
import org.opendaylight.openflowplugin.openflow.md.core.plan.SwitchTestEvent;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.queue.QueueProcessorLightImpl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
popListener = new PopListenerCountingImpl<>();
- controller = new MDController();
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ controller = new MDController(convertorManager);
controller.init();
controller.getMessageTranslators().putAll(assembleTranslatorMapping());
package org.opendaylight.openflowplugin.openflow.md.core;
import java.util.List;
-
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
*/
@Before
public void setUp() throws Exception {
- controller = new MDController();
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ controller = new MDController(convertorManager);
controller.init();
}
controller = null;
}
-
- /**
- * Test method for
- * {@link org.opendaylight.openflowplugin.openflow.md.core.MDController#addMessageListeners}
- * .
- */
@Test
public void testAddMessageListeners() {
//clean translators
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
import org.opendaylight.openflowplugin.openflow.md.core.ThreadPoolLoggingExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
/** registration related action must end within this amount of seconds */
private static final int REGISTRATION_ACTION_TIMEOUT = 5;
- protected static final SalRegistrationManager registrationManager = new SalRegistrationManager();
+ protected SalRegistrationManager registrationManager;
protected static final Logger LOG = LoggerFactory.getLogger(ConcurrentSalRegistrationManagerTest.class);
protected static final SwitchSessionKeyOF SWITCH_SESSION_KEY_OF = new SwitchSessionKeyOF();
*/
@Before
public void setUp() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ registrationManager = new SalRegistrationManager(convertorManager);
SWITCH_SESSION_KEY_OF.setDatapathId(BigInteger.ONE);
Mockito.when(context.getNotificationEnqueuer()).thenReturn(notificationEnqueuer);
import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
OpenflowPortsUtil.init();
- mdSwitchOF10 = new ModelDrivenSwitchImpl(null, null, context);
- mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ mdSwitchOF10 = new ModelDrivenSwitchImpl(null, null, context, convertorManager);
+ mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context, convertorManager);
}
/**
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.when;
+
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import java.util.Collection;
import org.opendaylight.openflowplugin.api.openflow.md.core.sal.NotificationComposer;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
@Mock
private ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlowRpcResultListenableFuture;
@Mock
- private OFRpcTaskContext ofRpcTaskContext;
- @Mock
private NotificationProviderService notificationProviderService;
@Mock
private NotificationComposer<?> notificationComposer;
@Mock
ListeningExecutorService executorService;
+ private ConvertorManager convertorManager;
@Before
- public void setup() {
+ public void setUp() {
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
when(taskContext.getSession()).thenReturn(sessionContext);
when(taskContext.getMessageService()).thenReturn(messageDispatchService);
when(sessionContext.getNextXid()).thenReturn(new Long(10));
when(sessionContext.getFeatures()).thenReturn(featuresOutput);
when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(messageDispatchService.barrier(Mockito.any(BarrierInput.class), Mockito.any(SwitchConnectionDistinguisher.class))).thenReturn(resultListenableFuture);
- when(ofRpcTaskContext.getRpcPool()).thenReturn(executorService);
+ when(taskContext.getRpcPool()).thenReturn(executorService);
when(executorService.submit(Mockito.<Callable<RpcResult<UpdateFlowOutput>>> any())).thenReturn(updateFlowRpcResultListenableFuture);
}
@Test
public void testHookFutureNotification() throws Exception {
final AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
- final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
+ final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(taskContext, flowInputBuilder.build(), connectionDistinguisher, convertorManager);
OFRpcTaskUtil.hookFutureNotification(addFlowInputRpcResultOFRpcTask, updateFlowRpcResultListenableFuture, notificationProviderService, notificationComposer);
}
public void testChainFutureBarrier() throws Exception {
final AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
flowInputBuilder.setBarrier(true);
- final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
+ final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(taskContext, flowInputBuilder.build(), connectionDistinguisher, convertorManager);
OFRpcTaskUtil.chainFutureBarrier(addFlowInputRpcResultOFRpcTask, updateFlowRpcResultListenableFuture);
}
}
\ No newline at end of file
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListeningExecutorService;
import java.math.BigInteger;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContextOFImpl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
Mockito.when(features.getVersion()).thenReturn((short) 1);
context.setFeatures(features);
context.setNotificationEnqueuer(notificationEnqueuer);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
- OfEntityManager entManager = new OfEntityManager(entityOwnershipService,getConfig());
- mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context);
+ OfEntityManager entManager = new OfEntityManager(entityOwnershipService,getConfig());
+ mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context, convertorManager);
registration = new AbstractModelDrivenSwitchRegistration(mdSwitchOF13) {
@Override
protected void removeRegistration() {
messageDispatchService.flowMod(Matchers.any(FlowModInput.class),
Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
- salRegistrationManager = new SalRegistrationManager();
+ salRegistrationManager = new SalRegistrationManager(convertorManager);
salRegistrationManager.setPublishService(notificationProviderService);
salRegistrationManager.setDataService(dataBroker);
salRegistrationManager.setRpcProviderRegistry(rpcProviderRegistry);
--- /dev/null
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+
+/**
+ * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager}
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ConvertorManagerTest {
+ /**
+ * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager#registerConvertor(short, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor)}
+ * @throws Exception
+ */
+ @Test
+ public void testRegisterConvertor() throws Exception {
+ final ConvertorManager convertorManager = new ConvertorManager(OFConstants.OFP_VERSION_1_3)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, new Convertor<Action, String, VersionConvertorData>() {
+ @Override
+ public Collection<Class<? extends DataContainer>> getTypes() {
+ return Collections.singleton(Action.class);
+ }
+
+ @Override
+ public String convert(Action source, VersionConvertorData data) {
+ return null;
+ }
+ });
+
+ final Optional<Convertor> convertor = convertorManager.findConvertor(OFConstants.OFP_VERSION_1_3, Action.class);
+ assertTrue("Failed to find convertor for action", convertor.isPresent());
+ }
+
+ /**
+ * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager#convert(org.opendaylight.yangtools.yang.binding.DataContainer, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData)}
+ * @throws Exception
+ */
+ @Test
+ public void testConvert() throws Exception {
+ final ConvertorManager convertorManager = new ConvertorManager(OFConstants.OFP_VERSION_1_3)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, new Convertor<Action, String, VersionConvertorData>() {
+ @Override
+ public Collection<Class<? extends DataContainer>> getTypes() {
+ return Collections.singleton(Action.class);
+ }
+
+ @Override
+ public String convert(Action source, VersionConvertorData data) {
+ return String.valueOf(source) + String.valueOf(data);
+ }
+ });
+
+ final Action source = new ActionBuilder().build();
+ final VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
+ final String expectedResult = String.valueOf(source) + String.valueOf(data);
+ final Optional<String> result = convertorManager.convert(source, data);
+
+ assertTrue("Failed to convert action to string", result.isPresent());
+ assertEquals("Result and expected result do not match", result.get(), expectedResult);
+ }
+
+ /**
+ * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager#convert(java.util.Collection, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData)}
+ * @throws Exception
+ */
+ @Test
+ public void testConvert1() throws Exception {
+ final ConvertorManager convertorManager = new ConvertorManager(OFConstants.OFP_VERSION_1_3)
+ .registerConvertor(OFConstants.OFP_VERSION_1_3, new Convertor<List<Action>, String, VersionConvertorData>() {
+ @Override
+ public Collection<Class<? extends DataContainer>> getTypes() {
+ return Collections.singleton(Action.class);
+ }
+
+ @Override
+ public String convert(List<Action> source, VersionConvertorData data) {
+ return String.valueOf(source) + String.valueOf(data);
+ }
+ });
+
+ final List<Action> source = Collections.singletonList(new ActionBuilder().build());
+ final VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
+ final String expectedResult = String.valueOf(source) + String.valueOf(data);
+ final Optional<String> result = convertorManager.convert(source, data);
+
+ assertTrue("Failed to convert action to string", result.isPresent());
+ assertEquals("Result and expected result do not match", result.get(), expectedResult);
+ }
+}
\ No newline at end of file
import java.util.List;
import java.util.Optional;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
public class GroupConvertorTest {
+ private ConvertorManager convertorManager;
+
+ @Before
+ public void setUp() {
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
+ }
/**
* test of {@link GroupConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)} }
}
private GroupModInputBuilder convert(Group group, VersionDatapathIdConvertorData data) {
- final Optional<GroupModInputBuilder> outAddGroupInputOptional = ConvertorManager.getInstance().convert(group, data);
+ final Optional<GroupModInputBuilder> outAddGroupInputOptional = convertorManager.convert(group, data);
Assert.assertTrue("Group convertor not found", outAddGroupInputOptional.isPresent());
return outAddGroupInputOptional.get();
}
import java.util.List;\r
import java.util.Optional;\r
import org.junit.Assert;\r
+import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.openflowplugin.api.OFConstants;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;\r
*\r
*/\r
public class GroupDescStatsResponseConvertorTest {\r
+ private ConvertorManager convertorManager;\r
+\r
+ @Before\r
+ public void setUp() {\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ }\r
\r
/**\r
* Test empty GroupDescStats conversion\r
}\r
\r
private List<GroupDescStats> convert(List<GroupDesc> groupDescStats,VersionConvertorData data) {\r
- Optional<List<GroupDescStats>> statsListOptional = ConvertorManager.getInstance().convert(groupDescStats, data);\r
+ Optional<List<GroupDescStats>> statsListOptional = convertorManager.convert(groupDescStats, data);\r
return statsListOptional.orElse(Collections.emptyList());\r
}\r
}\r
\r
import java.util.Optional;\r
import org.junit.Assert;\r
+import org.junit.Before;\r
import org.junit.Test;\r
+import org.opendaylight.openflowplugin.api.OFConstants;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.buckets.BucketCounter;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats;\r
*\r
*/\r
public class GroupStatsResponseConvertorTest {\r
+ private ConvertorManager convertorManager;\r
+\r
+ @Before\r
+ public void setUp() {\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ }\r
\r
/**\r
* Test empty GroupStats conversion\r
List<GroupStats> groupStats = new ArrayList<>();\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
- .GroupStats>> salGroupStats = ConvertorManager.getInstance().convert(groupStats);\r
+ .GroupStats>> salGroupStats = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
\r
Assert.assertFalse("Group stats response should be not present", salGroupStats.isPresent());\r
}\r
groupStats.add(statsBuilder.build());\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
- .GroupStats>> salGroupStatsOptional = ConvertorManager.getInstance().convert(groupStats);\r
+ .GroupStats>> salGroupStatsOptional = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
Assert.assertTrue("Group stats response convertor not found", salGroupStatsOptional.isPresent());\r
List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
.GroupStats> salGroupStats = salGroupStatsOptional.get();\r
groupStats.add(statsBuilder.build());\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
- .GroupStats>> salGroupStatsOptional = ConvertorManager.getInstance().convert(groupStats);\r
+ .GroupStats>> salGroupStatsOptional = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
Assert.assertTrue("Group stats response convertor not found", salGroupStatsOptional.isPresent());\r
List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
.GroupStats> salGroupStats = salGroupStatsOptional.get();\r
groupStats.add(statsBuilder.build());\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
- .GroupStats>> salGroupStatsOptional = ConvertorManager.getInstance().convert(groupStats);\r
+ .GroupStats>> salGroupStatsOptional = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
Assert.assertTrue("Group stats response convertor not found", salGroupStatsOptional.isPresent());\r
List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
.GroupStats> salGroupStats = salGroupStatsOptional.get();\r
import java.util.List;
import java.util.Optional;
import org.junit.Test;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
* Test of basic mapping functionality of {@link MeterConfigStatsResponseConvertor#convert(java.util.List)} }
*/
public void testToSALMeterConfigList() {
- Optional<List<MeterConfigStats>> meterConfigsOptional = ConvertorManager.getInstance().convert(createMeterConfigList());
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ Optional<List<MeterConfigStats>> meterConfigsOptional = convertorManager.convert(createMeterConfigList(), new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MeterConfigStats> meterConfigs = meterConfigsOptional.orElse(Collections.emptyList());
assertEquals(PRESET_COUNT, meterConfigs.size());
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.Bands;
public class MeterConvertorTest {
+ private ConvertorManager convertorManager;
+
+ @Before
+ public void setUp() {
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
+ }
+
@Test
public void testMeterModCommandConvertorwithAllParameters() {
long BURST_SIZE = 10L;
}
private MeterModInputBuilder convert(Meter source, VersionConvertorData data) {
- Optional<MeterModInputBuilder> outMeterModInputOptional = ConvertorManager.getInstance().convert(source, data);
+ Optional<MeterModInputBuilder> outMeterModInputOptional = convertorManager.convert(source, data);
return outMeterModInputOptional.orElse(MeterConvertor.defaultResult(data.getVersion()));
}
}
\ No newline at end of file
import java.util.List;
import java.util.Optional;
import org.junit.Test;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.meter.band.stats.BandStat;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsKey;
* Test of basic mapping functionality of {@link MeterStatsResponseConvertor#convert(java.util.List)}
*/
public void testToSALMeterStatsList() {
-
- Optional<List<MeterStats>> meterStatsListOptional = ConvertorManager.getInstance().convert(createMeterStatsLit());
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ Optional<List<MeterStats>> meterStatsListOptional = convertorManager.convert(createMeterStatsLit(), new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MeterStats> meterStatsList = meterStatsListOptional.orElse(Collections.emptyList());
assertEquals(PRESET_COUNT, meterStatsList.size());
\r
public class PacketOutConvertorTest {\r
\r
+ private ConvertorManager convertorManager;\r
+\r
@Before\r
- public void init() {\r
+ public void setUp() {\r
OpenflowPortsUtil.init();\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
}\r
\r
/**\r
ActionConvertorData actionConvertorData = new ActionConvertorData(version);\r
actionConvertorData.setDatapathId(datapathId);\r
\r
- Optional<List<Action>> actionsOptional = ConvertorManager.getInstance().convert(\r
+ Optional<List<Action>> actionsOptional = convertorManager.convert(\r
actionList, actionConvertorData);\r
\r
List<Action> actions = actionsOptional.orElse(Collections.emptyList());\r
}\r
\r
private PacketOutInput convert(TransmitPacketInput transmitPacketInput, PacketOutConvertorData data) {\r
- Optional<PacketOutInput> messageOptional = ConvertorManager.getInstance().convert(transmitPacketInput, data);\r
+ Optional<PacketOutInput> messageOptional = convertorManager.convert(transmitPacketInput, data);\r
return messageOptional.orElse(PacketOutConvertor.defaultResult(data.getVersion()));\r
}\r
}\r
portBld.setHardwareAddress(new MacAddress(DEFAULT_MAC_ADDRESS));
VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
- Optional<PortModInput> portOutOptional = ConvertorManager.getInstance().convert(portBld.build(), data);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ Optional<PortModInput> portOutOptional = convertorManager.convert(portBld.build(), data);
PortModInput portOut = portOutOptional.orElse(PortConvertor.defaultResult(OFConstants.OFP_VERSION_1_3));
PortConfigV10 portConfV10 = new PortConfigV10(false, false, false, false, true, true, false);
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
-@RunWith(MockitoJUnitRunner.class)
-public class TableFeaturesConvertorTest extends TestCase {
+public class TableFeaturesConvertorTest {
private static final TablePropertiesBuilder tablePropertiesBuilder = new TablePropertiesBuilder();
private static final Map<Class<? extends TableFeaturePropType>, TableFeaturePropType> augmentationsMap = new HashMap<>();
private static final List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction> instructionsList = new ArrayList<>();
.setTableFeatures(tableFeaturesList)
.build();
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures>> tableFeaturesesOptional =
- ConvertorManager.getInstance().convert(tableFeatures);
+ convertorManager.convert(tableFeatures, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures> tableFeatureses =
tableFeaturesesOptional.orElse(Collections.emptyList());
import java.util.List;\r
import java.util.Optional;\r
import org.junit.Assert;\r
+import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
+import org.opendaylight.openflowplugin.api.OFConstants;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeatureProperty;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeatureProperty;\r
* @author michal.polkorab\r
*/\r
public class TableFeaturesResponseConvertorTest {\r
+ private ConvertorManager convertorManager;\r
+\r
+ @Before\r
+ public void setUp() {\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ }\r
\r
/**\r
* Incorrect / empty input test\r
\r
\r
private List<TableFeatures> convert(MultipartReplyTableFeatures features) {\r
- Optional<List<TableFeatures>> listOptional = ConvertorManager.getInstance().convert(features);\r
+ Optional<List<TableFeatures>> listOptional = convertorManager.convert(features, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
return listOptional.orElse(Collections.emptyList());\r
}\r
}
\ No newline at end of file
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
ActionConvertorData data = new ActionConvertorData((short) 0X4);
data.setDatapathId(BigInteger.ONE);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>> OFActionsList =
- ConvertorManager.getInstance().convert(actions, data);
+ convertorManager.convert(actions, data);
outputActions(OFActionsList.orElse(Collections.emptyList()));
}
if (action.getActionChoice() instanceof CopyTtlInCase) {
- CopyTtlInCase copyTtlInCase = (CopyTtlInCase) action.getActionChoice();
Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), CopyTtlInCase.class.getName());
}
import java.util.List;\r
import java.util.Optional;\r
import org.junit.Assert;\r
+import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.openflowplugin.api.OFConstants;\r
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;\r
*\r
*/\r
public class ActionConvertorV10Test {\r
+ private ConvertorManager convertorManager;\r
+\r
+ @Before\r
+ public void setUp() {\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ }\r
\r
/**\r
* Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)}}\r
data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>> actionsOptional =\r
- ConvertorManager.getInstance().convert(salActions, data);\r
+ convertorManager.convert(salActions, data);\r
\r
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actions = actionsOptional.orElse(Collections.emptyList());\r
\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
.Action>> mdSalActionsOptional =\r
- ConvertorManager.getInstance().convert(\r
+ convertorManager.convert(\r
actions, data);\r
\r
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
import java.util.List;\r
import java.util.Optional;\r
import org.junit.Assert;\r
+import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.openflowplugin.api.OFConstants;\r
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;\r
* @author michal.polkorab\r
*/\r
public class ActionConvertorV13Test {\r
+ private ConvertorManager convertorManager;\r
+\r
+ @Before\r
+ public void setUp() {\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ }\r
+\r
/**\r
* Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData)}}\r
*/\r
data.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
- .Action>> mdSalActions = ConvertorManager.getInstance().convert(actions, data);\r
+ .Action>> mdSalActions = convertorManager.convert(actions, data);\r
\r
Assert.assertEquals("Wrong number of output actions", 0, mdSalActions.orElse(Collections.emptyList()).size());\r
}\r
data.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);\r
\r
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
- .Action>> mdSalActionsOptional = ConvertorManager.getInstance().convert(actions, data);\r
+ .Action>> mdSalActionsOptional = convertorManager.convert(actions, data);\r
\r
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
.Action> mdSalActions = mdSalActionsOptional.orElse(Collections.emptyList());\r
data.setDatapathId(new BigInteger("42"));\r
data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));\r
\r
- Optional<List<Action>> actionsOptional = ConvertorManager.getInstance().convert(salActions, data);\r
+ Optional<List<Action>> actionsOptional = convertorManager.convert(salActions, data);\r
List<Action> actions = actionsOptional.orElse(Collections.emptyList());\r
\r
Assert.assertEquals("Wrong number of actions", 12, actions.size());\r
import java.util.List;\r
import java.util.Optional;\r
import org.junit.Assert;\r
+import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.openflowplugin.api.OFConstants;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;\r
*\r
*/\r
public class FlowConvertorTest {\r
+ private ConvertorManager convertorManager;\r
+\r
+ @Before\r
+ public void setUp() {\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ }\r
\r
/**\r
* Tests {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)} }\r
}\r
\r
private List<FlowModInputBuilder> convert(Flow flow, VersionDatapathIdConvertorData data) {\r
- Optional<List<FlowModInputBuilder>> flowModOptional = ConvertorManager.getInstance().convert(flow, data);\r
+ Optional<List<FlowModInputBuilder>> flowModOptional = convertorManager.convert(flow, data);\r
Assert.assertTrue("Flow convertor not found", flowModOptional.isPresent());\r
return flowModOptional.get();\r
}\r
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
* Created by Martin Bobak mbobak@cisco.com on 9/18/14.
*/
public class FlowStatsResponseConvertorTest {
+ private ConvertorManager convertorManager;
- private static final int PRESET_COUNT = 7;
-
- /**
- * Test method for {@link FlowStatsResponseConvertor#wrapOF10ActionsToInstruction(java.util.List, short)} }
- */
- @Test
- public void testWrapOF10ActionsToInstruction() {
- ActionBuilder actionBuilder = new ActionBuilder();
- List<Action> actions = new ArrayList<>();
- for (int j = 0; j < PRESET_COUNT; j++) {
- actions.add(actionBuilder.build());
- }
- Instructions instructions = FlowStatsResponseConvertor.wrapOF10ActionsToInstruction(actions, OFConstants.OFP_VERSION_1_3);
- assertNotNull(instructions);
+ @Before
+ public void setUp() {
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
}
+ private static final int PRESET_COUNT = 7;
+
/**
* Test method for {@link FlowInstructionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)} }
*/
}
private Instructions convert(List<Instruction> instructionsList, VersionConvertorData data) {
- Optional<Instructions> instructionsOptional = ConvertorManager.getInstance().convert(instructionsList, data);
+ Optional<Instructions> instructionsOptional = convertorManager.convert(instructionsList, data);
assertTrue("Flow instruction response convertor not found", instructionsOptional.isPresent());
return instructionsOptional.get();
}
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
public class FlowFlagReactorTest {
private FlowModFlags[] flowFlags;
+ private ConvertorManager convertorManager;
/**
* prepare input match
new FlowModFlags(false, false, false, false, false),
new FlowModFlags(true, false, true, false, true)
};
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
}
/**
for (FlowModFlags fFlag : flowFlags) {
target.setFlags(null);
FlowFlagReactor.getInstance().convert(fFlag,
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getFlags());
}
}
for (FlowModFlags fFlag : flowFlags) {
target.setFlagsV10(null);
FlowFlagReactor.getInstance().convert(fFlag,
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getFlagsV10());
}
}
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
public class MatchConvertorImpl2Test {\r
\r
private static final MatchConvertorImpl convertor = new MatchConvertorImpl();\r
+ private ConvertorManager convertorManager;\r
\r
/**\r
* Initializes OpenflowPortsUtil\r
@Before\r
public void startUp() {\r
OpenflowPortsUtil.init();\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testEmptyAndNullInput() {\r
MatchBuilder builder = new MatchBuilder();\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(null);\r
+ List<MatchEntry> entries = convertor.convert(null, convertorManager);\r
Assert.assertEquals("Wrong entries size", 0, entries.size());\r
\r
- entries = convertor.convert(match);\r
+ entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 0, entries.size());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testConversion() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv4MatchBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 24, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, InPort.class, false);\r
Assert.assertEquals("Wrong hasMask", hasMask, entry.isHasMask());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testIpv4MatchArbitraryBitMaskwithNoMask(){\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv4MatchArbitraryBitMaskBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 2, entries.size());\r
\r
MatchEntry entry = entries.get(0);\r
Assert.assertEquals("wrong Ipv4Address destination", "10.1.1.1",((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst().getIpv4Address().getValue());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testIpv4MatchArbitraryBitMaskwithMask(){\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv4MatchArbitraryBitMaskBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 2, entries.size());\r
\r
MatchEntry entry = entries.get(0);\r
Assert.assertEquals("wrong Ipv4Adress destination", "10.1.1.1",((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst().getIpv4Address().getValue());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testUdpMatchConversion() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer4Match(udpMatchBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 2, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, UdpSrc.class, false);\r
.getUdpDst().getPort().getValue().intValue());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testTunnelIpv4MatchConversion() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(tunnelIpv4MatchBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 2, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, Ipv4Src.class, false);\r
.getIpv4Address().getValue());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testSctpMatchConversion() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer4Match(sctpMatchBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 2, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, SctpSrc.class, false);\r
.getSctpDst().getPort().getValue().intValue());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testArpMatchConversion() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(arpBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 5, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, ArpOp.class, false);\r
.getArpTha().getMacAddress().getValue());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testArpMatchConversionWithMasks() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(arpBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 4, entries.size());\r
MatchEntry entry = entries.get(0);\r
entry = entries.get(0);\r
((ArpThaCase) entry.getMatchEntryValue()).getArpTha().getMask());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testIpv6MatchConversion() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv6Builder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 7, entries.size());\r
MatchEntry entry = entries.get(0);\r
/* Due to conversion ambiguities, we always get "has mask" because \r
true, false, true, false), ((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getPseudoField());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testIpv6MatchConversionWithMasks() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv6Builder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 2, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, Ipv6Src.class, true);\r
((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getMask());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testIpv6ExtHeaderConversion() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv6Builder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 1, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, Ipv6Exthdr.class, true);\r
((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getMask());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testConversionWithMasks() {\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv4MatchBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 8, entries.size());\r
MatchEntry entry = entries.get(0);\r
checkEntryHeader(entry, Metadata.class, true);\r
((TunnelIdCase) entry.getMatchEntryValue()).getTunnelId().getMask());\r
}\r
\r
- /**\r
- * Test {@link Convertor#convert(Object)}\r
- */\r
@Test\r
public void testIpv6MatchArbitraryBitMask(){\r
MatchBuilder builder = new MatchBuilder();\r
builder.setLayer3Match(ipv6MatchArbitraryBitMaskBuilder.build());\r
Match match = builder.build();\r
\r
- List<MatchEntry> entries = convertor.convert(match);\r
+ List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
Assert.assertEquals("Wrong entries size", 2, entries.size());\r
\r
MatchEntry entry = entries.get(0);\r
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
import static org.junit.Assert.assertEquals;
+
import java.math.BigInteger;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpVersion;
private static final VlanId DEFAULT_VLAN_ID = new VlanId(42);
private static final Ipv4Address DEFAULT_IPV4_ADDRESS = new Ipv4Address("10.0.0.1");
private static final short DEFAULT_MASK = 24;
+ private ConvertorManager convertorManager;
@Before
public void setup() {
OpenflowPortsUtil.init();
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
}
@Test
* Test method for {@link MatchConvertorV10Impl#convert(Match,BigInteger)}
*/
public void testConvert() {
- MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build());
+ MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build(), null);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
- matchV10 = matchConvertorV10.convert(createL4TcpMatch().build());
+ matchV10 = matchConvertorV10.convert(createL4TcpMatch().build(), null);
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
- matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build());
+ matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build(), null);
assertEquals(DEFAULT_VLAN_ID.getValue().intValue(), matchV10.getDlVlan().intValue());
}
/**
* ICMPv4 match test for
- * {@link MatchConvertorV10Impl#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)}.
+ * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor#convert(Object, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)}.
*/
@Test
public void testConvertIcmpv4() {
MatchBuilder matchBuilder = createMatchBuilderWithDefaults();
Match match = matchBuilder.build();
- MatchV10 matchV10 = matchConvertorV10.convert(match);
+ MatchV10 matchV10 = matchConvertorV10.convert(match, convertorManager);
Integer zero = 0;
boolean wcTpSrc = true;
boolean wcTpDst = true;
wcTpDst, wcTpSrc);
match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
build();
- matchV10 = matchConvertorV10.convert(match);
+ matchV10 = matchConvertorV10.convert(match, convertorManager);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(0, matchV10.getDlType().intValue());
wcTpDst, wcTpSrc);
match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
build();
- matchV10 = matchConvertorV10.convert(match);
+ matchV10 = matchConvertorV10.convert(match, convertorManager);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(0, matchV10.getDlType().intValue());
wcTpDst, wcTpSrc);
match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
build();
- matchV10 = matchConvertorV10.convert(match);
+ matchV10 = matchConvertorV10.convert(match, convertorManager);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(0, matchV10.getDlType().intValue());
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
* match conversion and injection test
*/
public class MatchReactorTest {
-
private MatchBuilder matchBuilder;
+ private ConvertorManager convertorManager;
/**
* prepare input match
ethernetTypeBuilder.setType(new EtherType(42L));
ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
}
/**
public void testMatchConvertorV13_flow() {
FlowModInputBuilder target = new FlowModInputBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
}
public void testMatchConvertorV10_flow() {
FlowModInputBuilder target = new FlowModInputBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}
public void testMatchConvertorV13_mpRequestFlow() {
MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
}
public void testMatchConvertorV10_mpRequestFlow() {
MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}
public void testMatchConvertorV10_null() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(null,
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}
public void testMatchConvertorV13_mpRequestAggregate() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
}
public void testMatchConvertorV13_null() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(null,
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
Assert.assertEquals(0, target.getMatch().getMatchEntry().size());
}
public void testMatchConvertorV10_mpRequestAggregate() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}
import org.junit.Test;\r
import org.opendaylight.openflowplugin.api.OFConstants;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;\r
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;\r
*/\r
public class MatchResponseConvertor2Test {\r
\r
+ private ConvertorManager convertorManager;\r
+\r
/**\r
* Initializes OpenflowPortsUtil\r
*/\r
@Before\r
public void startUp() {\r
OpenflowPortsUtil.init();\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
}\r
\r
/**\r
*/\r
@Test(expected = NullPointerException.class)\r
public void testEmptyMatch() {\r
- final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+ final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
convert(new MatchBuilder().build(), datapathIdConvertorData);\r
}\r
builder.setMatchEntry(entries);\r
final Match match = builder.build();\r
\r
- final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+ final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
\r
final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
\r
final Match match = builder.build();\r
\r
- final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+ final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
\r
final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
builder.setMatchEntry(entries);\r
final Match match = builder.build();\r
\r
- final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+ final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
\r
final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
private org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
.MatchBuilder convert(Match match, VersionDatapathIdConvertorData data) {\r
final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
- .MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);\r
+ .MatchBuilder> salMatchOptional = convertorManager.convert(match, data);\r
\r
return salMatchOptional\r
.orElse(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder());\r
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
Ipv4Address.getDefaultInstance("10.1.2.3");
private static final int DL_VLAN_NONE = 0xffff;
+ private ConvertorManager convertorManager;
- @BeforeClass
- public static void setUp() {
+ @Before
+ public void setUp() {
OpenflowPortsUtil.init();
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
}
/**
}
private MatchBuilder convert(MatchV10 match, VersionDatapathIdConvertorData data) {
- final Optional<MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);
+ final Optional<MatchBuilder> salMatchOptional = convertorManager.convert(match, data);
return salMatchOptional.orElse(new MatchBuilder());
}
private MatchBuilder convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match match, VersionDatapathIdConvertorData data) {
- final Optional<MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);
+ final Optional<MatchBuilder> salMatchOptional = convertorManager.convert(match, data);
return salMatchOptional.orElse(new MatchBuilder());
}
import org.junit.Test;\r
import org.opendaylight.openflowplugin.api.OFConstants;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;\r
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
*/\r
public class MatchV10ResponseConvertorTest {\r
\r
+ private ConvertorManager convertorManager;\r
+\r
/**\r
* Initializes OpenflowPortsUtil\r
*/\r
@Before\r
public void startUp() {\r
OpenflowPortsUtil.init();\r
+ convertorManager = ConvertorManagerFactory.createDefaultManager();\r
}\r
\r
/**\r
}\r
\r
private MatchBuilder convert(MatchV10 match, VersionDatapathIdConvertorData data) {\r
- final Optional<MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);\r
+ final Optional<MatchBuilder> salMatchOptional = convertorManager.convert(match, data);\r
\r
return salMatchOptional.orElse(new MatchBuilder());\r
}\r
package org.opendaylight.openflowplugin.openflow.md.core.session;
import static org.mockito.Matchers.any;
+
import com.google.common.util.concurrent.ListeningExecutorService;
import java.math.BigInteger;
import java.net.InetSocketAddress;
import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
import org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl;
import org.opendaylight.openflowplugin.openflow.md.core.sal.SalRegistrationManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
import org.opendaylight.yangtools.yang.binding.RpcService;
});
// session listener - prepare registration and notification mockery
- final SalRegistrationManager sessionListener = new SalRegistrationManager();
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ final SalRegistrationManager sessionListener = new SalRegistrationManager(convertorManager);
sessionListener.setPublishService(notificationProviderService);
sessionListener.setRpcProviderRegistry(rpcProviderRegistry);
sessionListener.setDataService(dataService);
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.when;
+
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.core.session.SessionManagerOFImpl;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
import org.opendaylight.yangtools.yang.binding.DataObject;
-
@RunWith(MockitoJUnitRunner.class)
-public class FlowRemovedTranslatorTest extends FlowRemovedTranslator {
+public class FlowRemovedTranslatorTest {
- private static final FlowRemovedTranslator flowRemovedTranslator = new FlowRemovedTranslator();
+ private FlowRemovedTranslator flowRemovedTranslator;
private static final BigInteger DATA_PATH_ID = BigInteger.valueOf(42);
public static final Ipv6Address IPV_6_ADDRESS = new Ipv6Address("2001:0DB8:AC10:FE01:0000:0000:0000:0000");
private static final byte[] IPV_6_ADDRESS_MASK = ByteUtil.unsignedIntToBytes(new Long(64));
@Before
public void setup() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ flowRemovedTranslator = new FlowRemovedTranslator(convertorManager);
when(sessionContext.getPrimaryConductor()).thenReturn(connectionConductor);
when(connectionConductor.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(sessionContext.getFeatures()).thenReturn(featuresOutput);
import java.math.BigInteger;\r
import java.util.ArrayList;\r
import java.util.List;\r
-\r
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowplugin.api.OFConstants;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds;\r
* @author michal.polkorab\r
*\r
*/\r
+@RunWith(MockitoJUnitRunner.class)\r
public class MultipartReplyTableFeaturesToTableUpdatedTranslatorTest {\r
\r
@Mock SwitchConnectionDistinguisher cookie;\r
@Mock SessionContext sc;\r
@Mock GetFeaturesOutput features;\r
+ @Mock ConnectionConductor conductor;\r
\r
- MultipartReplyTableFeaturesToTableUpdatedTranslator translator = new MultipartReplyTableFeaturesToTableUpdatedTranslator();\r
+ MultipartReplyTableFeaturesToTableUpdatedTranslator translator;\r
\r
/**\r
* Initializes mocks\r
*/\r
@Before\r
public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ translator = new MultipartReplyTableFeaturesToTableUpdatedTranslator(convertorManager);\r
+ when(sc.getPrimaryConductor()).thenReturn(conductor);\r
when(sc.getFeatures()).thenReturn(features);\r
+ when(conductor.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);\r
when(features.getDatapathId()).thenReturn(new BigInteger("42"));\r
}\r
\r
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
import org.mockito.Mock;\r
import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterConfigStatsUpdated;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdated;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;\r
/**\r
* @author michal.polkorab\r
*/\r
+@RunWith(MockitoJUnitRunner.class)\r
public class MultipartReplyTranslatorFifthTest {\r
\r
@Mock\r
@Mock\r
GetFeaturesOutput features;\r
\r
- MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+ MultipartReplyTranslator translator;\r
\r
/**\r
* Initializes mocks\r
*/\r
@Before\r
public void startUp() {\r
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ translator = new MultipartReplyTranslator(convertorManager);\r
MockitoAnnotations.initMocks(this);\r
when(sc.getPrimaryConductor()).thenReturn(conductor);\r
when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
import java.math.BigInteger;\r
import java.util.ArrayList;\r
import java.util.List;\r
-\r
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;\r
* @author michal.polkorab\r
*\r
*/\r
+@RunWith(MockitoJUnitRunner.class)\r
public class MultipartReplyTranslatorFirstTest {\r
\r
@Mock SwitchConnectionDistinguisher cookie;\r
@Mock ConnectionConductor conductor;\r
@Mock GetFeaturesOutput features;\r
\r
- MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+ MultipartReplyTranslator translator;\r
\r
/**\r
* Initializes mocks\r
*/\r
@Before\r
public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ translator = new MultipartReplyTranslator(convertorManager);\r
when(sc.getPrimaryConductor()).thenReturn(conductor);\r
when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
when(sc.getFeatures()).thenReturn(features);\r
package org.opendaylight.openflowplugin.openflow.md.core.translator;\r
\r
import static org.mockito.Mockito.when;\r
+\r
import java.math.BigInteger;\r
import java.util.ArrayList;\r
import java.util.List;\r
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;\r
* @author michal.polkorab\r
*\r
*/\r
+@RunWith(MockitoJUnitRunner.class)\r
public class MultipartReplyTranslatorFourthTest {\r
\r
@Mock SwitchConnectionDistinguisher cookie;\r
@Mock ConnectionConductor conductor;\r
@Mock GetFeaturesOutput features;\r
\r
- MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+ MultipartReplyTranslator translator;\r
\r
/**\r
* Initializes mocks\r
*/\r
@Before\r
public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ translator = new MultipartReplyTranslator(convertorManager);\r
when(sc.getPrimaryConductor()).thenReturn(conductor);\r
when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
when(sc.getFeatures()).thenReturn(features);\r
import java.math.BigInteger;\r
import java.util.ArrayList;\r
import java.util.List;\r
-\r
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdated;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterFeaturesUpdated;\r
* @author michal.polkorab\r
*\r
*/\r
+@RunWith(MockitoJUnitRunner.class)\r
public class MultipartReplyTranslatorSecondTest {\r
\r
@Mock SwitchConnectionDistinguisher cookie;\r
@Mock ConnectionConductor conductor;\r
@Mock GetFeaturesOutput features;\r
\r
- MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+ MultipartReplyTranslator translator;\r
\r
/**\r
* Initializes mocks\r
*/\r
@Before\r
public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ translator = new MultipartReplyTranslator(convertorManager);\r
when(sc.getPrimaryConductor()).thenReturn(conductor);\r
when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
when(sc.getFeatures()).thenReturn(features);\r
import java.math.BigInteger;\r
import java.util.ArrayList;\r
import java.util.List;\r
-\r
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
import org.opendaylight.openflowjava.protocol.api.util.BinContent;\r
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;\r
* @author michal.polkorab\r
*\r
*/\r
+@RunWith(MockitoJUnitRunner.class)\r
public class MultipartReplyTranslatorThirdTest {\r
\r
@Mock SwitchConnectionDistinguisher cookie;\r
@Mock ConnectionConductor conductor;\r
@Mock GetFeaturesOutput features;\r
\r
- MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+ MultipartReplyTranslator translator;\r
\r
/**\r
* Initializes mocks\r
*/\r
@Before\r
public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+ translator = new MultipartReplyTranslator(convertorManager);\r
when(sc.getPrimaryConductor()).thenReturn(conductor);\r
when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
when(sc.getFeatures()).thenReturn(features);\r