import com.google.common.collect.ImmutableMap.Builder;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
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.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.TableProperties;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* 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>> {
+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;
private static final Map<Class<? extends MatchField>, Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField>> OF_TO_SAL_TABLE_FEATURE_PROPERTIES;
+ private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(MultipartReplyTableFeatures.class);
static {
final Builder<TableFeaturesPropType, ActionExecutor> builder = ImmutableMap.builder();
}
@Override
- public Class<?> getType() {
- return MultipartReplyTableFeatures.class;
+ public Collection<Class<? extends DataContainer>> getTypes() {
+ return TYPES;
}
@Override
- public List<TableFeatures> convert(MultipartReplyTableFeatures source) {
+ public List<TableFeatures> convert(MultipartReplyTableFeatures source, VersionConvertorData data) {
if (source == null || source.getTableFeatures() == null) {
return Collections.emptyList();
}