Merge "Removed duplicate declaration in pom.xml."
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / TableFeaturesConvertor.java
1 /*
2  * Copyright (c) 2013 Ericsson. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
10
11 import com.google.common.collect.ImmutableMap;
12 import com.google.common.collect.ImmutableMap.Builder;
13 import com.google.common.collect.Ordering;
14 import java.util.ArrayList;
15 import java.util.Arrays;
16 import java.util.Collection;
17 import java.util.Collections;
18 import java.util.List;
19 import java.util.Map;
20 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
21 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.OrderComparator;
22 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCase;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCase;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlags;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeatureProperty;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeatureProperty;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeaturePropertyBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCaseBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCaseBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCaseBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCaseBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCaseBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCaseBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCaseBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCaseBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpOp;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSha;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSpa;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpTha;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpTpa;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthDst;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthSrc;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthType;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ExperimenterClass;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv4Code;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv4Type;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv6Code;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv6Type;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPhyPort;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpDscp;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpEcn;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpProto;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Dst;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Src;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Dst;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Exthdr;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Flabel;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6NdSll;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6NdTarget;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6NdTll;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Src;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MplsBos;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MplsLabel;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MplsTc;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.PbbIsid;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.SctpDst;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.SctpSrc;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpDst;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpSrc;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TunnelId;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpDst;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpSrc;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
128 import 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;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTable;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMiss;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Wildcards;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActions;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfield;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesMiss;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfield;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTable;
151 import org.opendaylight.yangtools.yang.binding.DataContainer;
152 import org.slf4j.Logger;
153 import org.slf4j.LoggerFactory;
154
155 /**
156  * Converts a MD-SAL table features into the OF library table features.
157  *
158  * Example usage:
159  * <pre>
160  * {@code
161  * VersionConvertorData data = new VersionConvertorData(version);
162  * Optional<List<TableFeatures>> ofFeatures = convertorManager..convert(salTableFeatures, data);
163  * }
164  * </pre>
165  */
166 public class TableFeaturesConvertor extends Convertor<
167         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures,
168         List<TableFeatures>,
169         VersionConvertorData> {
170
171     private static final Logger LOG = LoggerFactory.getLogger(TableFeaturesConvertor.class);
172     private static final Ordering<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties> TABLE_FEATURE_PROPS_ORDERING =
173             Ordering.from(OrderComparator.<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties>build());
174     private static final Map<Class<?>, Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField>> SAL_TO_OF_TABLE_FEATURES;
175     private static final List<Class<? extends DataContainer>> TYPES = Arrays.asList(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures.class, UpdatedTable.class);
176
177     static {
178         Builder<Class<?>, Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField>> builder = ImmutableMap.builder();
179         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp.class, ArpOp.class);
180         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha.class, ArpSha.class);
181         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSpa.class, ArpSpa.class);
182         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha.class, ArpTha.class);
183         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTpa.class, ArpTpa.class);
184         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst.class, EthDst.class);
185         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc.class, EthSrc.class);
186         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType.class, EthType.class);
187         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code.class, Icmpv4Code.class);
188         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type.class, Icmpv4Type.class);
189         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Code.class, Icmpv6Code.class);
190         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type.class, Icmpv6Type.class);
191         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPhyPort.class, InPhyPort.class);
192         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort.class, InPort.class);
193         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpDscp.class, IpDscp.class);
194         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn.class, IpEcn.class);
195         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto.class, IpProto.class);
196         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst.class, Ipv4Dst.class);
197         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Src.class, Ipv4Src.class);
198         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Dst.class, Ipv6Dst.class);
199         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr.class, Ipv6Exthdr.class);
200         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Flabel.class, Ipv6Flabel.class);
201         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll.class, Ipv6NdSll.class);
202         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget.class, Ipv6NdTarget.class);
203         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTll.class, Ipv6NdTll.class);
204         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Src.class, Ipv6Src.class);
205         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata.class, Metadata.class);
206         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos.class, MplsBos.class);
207         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel.class, MplsLabel.class);
208         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsTc.class, MplsTc.class);
209         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.PbbIsid.class, PbbIsid.class);
210         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst.class, SctpDst.class);
211         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpSrc.class, SctpSrc.class);
212         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpDst.class, TcpDst.class);
213         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc.class, TcpSrc.class);
214         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelId.class, TunnelId.class);
215         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst.class, UdpDst.class);
216         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc.class, UdpSrc.class);
217         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp.class, VlanPcp.class);
218         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid.class, VlanVid.class);
219         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Dst.class, Ipv4Dst.class);
220         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Src.class, Ipv4Src.class);
221         builder.put(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags.class, TcpFlags.class);
222         SAL_TO_OF_TABLE_FEATURES = builder.build();
223     }
224
225     private static List<TableFeatureProperties> toTableProperties(
226             final org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties tableProperties) {
227         if (tableProperties == null) {
228             return Collections.emptyList();
229         }
230
231         List<TableFeatureProperties> ofTablePropertiesList = new ArrayList<>();
232
233         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties>
234                 sortedTableProperties = TABLE_FEATURE_PROPS_ORDERING.sortedCopy(tableProperties.getTableFeatureProperties());
235
236         for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties
237                 property : sortedTableProperties) {
238             TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
239
240             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType propType = property
241                     .getTableFeaturePropType();
242
243             setTableFeatureProperty(propType);
244
245             if (propType instanceof Instructions) {
246                 setTableFeatureProperty((Instructions) propType, propBuilder);
247             } else if (propType instanceof InstructionsMiss) {
248                 setTableFeatureProperty((InstructionsMiss) propType, propBuilder);
249             } else if (propType instanceof NextTable) {
250                 setTableFeatureProperty((NextTable) propType, propBuilder);
251             } else if (propType instanceof NextTableMiss) {
252                 setTableFeatureProperty((NextTableMiss) propType, propBuilder);
253             } else if (propType instanceof WriteActions) {
254                 setTableFeatureProperty((WriteActions) propType, propBuilder);
255             } else if (propType instanceof WriteActionsMiss) {
256                 setTableFeatureProperty((WriteActionsMiss) propType, propBuilder);
257             } else if (propType instanceof ApplyActions) {
258                 setTableFeatureProperty((ApplyActions) propType, propBuilder);
259             } else if (propType instanceof ApplyActionsMiss) {
260                 setTableFeatureProperty((ApplyActionsMiss) propType, propBuilder);
261             } else if (propType instanceof Match) {
262                 setTableFeatureProperty((Match) propType, propBuilder);
263             } else if (propType instanceof Wildcards) {
264                 setTableFeatureProperty((Wildcards) propType, propBuilder);
265             } else if (propType instanceof WriteSetfield) {
266                 setTableFeatureProperty((WriteSetfield) propType, propBuilder);
267             } else if (propType instanceof WriteSetfieldMiss) {
268                 setTableFeatureProperty((WriteSetfieldMiss) propType, propBuilder);
269             } else if (propType instanceof ApplySetfield) {
270                 setTableFeatureProperty((ApplySetfield) propType, propBuilder);
271             } else if (propType instanceof ApplySetfieldMiss) {
272                 setTableFeatureProperty((ApplySetfieldMiss) propType, propBuilder);
273             }
274
275             // Experimenter and Experimenter miss Table features are unhandled
276             ofTablePropertiesList.add(propBuilder.build());
277         }
278
279         return ofTablePropertiesList;
280     }
281
282     private static void setTableFeatureProperty(final TableFeaturePropType propType) {
283         LOG.debug("Unknown TableFeaturePropType [{}]", propType.getClass());
284     }
285
286     private static void setTableFeatureProperty(final ApplySetfieldMiss propType, final TableFeaturePropertiesBuilder propBuilder) {
287         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
288         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMiss applySetfieldMiss = propType.getApplySetfieldMiss();
289
290         if (null != applySetfieldMiss) {
291             setFieldMatch = applySetfieldMiss.getSetFieldMatch();
292         }
293
294         setSetFieldTableFeatureProperty(
295                 propBuilder,
296                 TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,
297                 ((setFieldMatch == null) ? new ArrayList<>()
298                         : setFieldMatch));
299     }
300
301     private static void setTableFeatureProperty(final ApplySetfield propType, final TableFeaturePropertiesBuilder propBuilder) {
302         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
303         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfield applySetfield = propType.getApplySetfield();
304
305         if (null != applySetfield) {
306             setFieldMatch = applySetfield.getSetFieldMatch();
307         }
308
309         setSetFieldTableFeatureProperty(
310                 propBuilder,
311                 TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,
312                 ((setFieldMatch == null) ? new ArrayList<>()
313                         : setFieldMatch));
314     }
315
316     private static void setTableFeatureProperty(final WriteSetfieldMiss propType, final TableFeaturePropertiesBuilder propBuilder) {
317         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
318         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMiss writeSetfieldMiss = propType.getWriteSetfieldMiss();
319
320         if (null != writeSetfieldMiss) {
321             setFieldMatch = writeSetfieldMiss.getSetFieldMatch();
322         }
323
324         setSetFieldTableFeatureProperty(
325                 propBuilder,
326                 TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,
327                 ((setFieldMatch == null) ? new ArrayList<>()
328                         : setFieldMatch));
329     }
330
331     private static void setTableFeatureProperty(final WriteSetfield propType, final TableFeaturePropertiesBuilder propBuilder) {
332         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
333         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfield writeSetField = propType.getWriteSetfield();
334
335         if (null != writeSetField) {
336             setFieldMatch = writeSetField.getSetFieldMatch();
337         }
338
339         setSetFieldTableFeatureProperty(
340                 propBuilder,
341                 TableFeaturesPropType.OFPTFPTWRITESETFIELD,
342                 ((setFieldMatch == null) ? new ArrayList<>()
343                         : setFieldMatch));
344     }
345
346     private static void setTableFeatureProperty(final Wildcards propType, final TableFeaturePropertiesBuilder propBuilder) {
347         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
348         WildcardSetfield wildcardSetField = propType.getWildcardSetfield();
349
350         if (null != wildcardSetField) {
351             setFieldMatch = wildcardSetField.getSetFieldMatch();
352         }
353
354         setSetFieldTableFeatureProperty(
355                 propBuilder,
356                 TableFeaturesPropType.OFPTFPTWILDCARDS,
357                 ((setFieldMatch == null) ? new ArrayList<>()
358                         : setFieldMatch));
359     }
360
361     private static void setTableFeatureProperty(final Match propType, final TableFeaturePropertiesBuilder propBuilder) {
362         MatchSetfield matchSetField = propType.getMatchSetfield();
363         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
364
365         if (null != matchSetField) {
366             setFieldMatch = matchSetField.getSetFieldMatch();
367         }
368
369         setSetFieldTableFeatureProperty(
370                 propBuilder,
371                 TableFeaturesPropType.OFPTFPTMATCH,
372                 ((setFieldMatch == null) ? new ArrayList<>()
373                         : setFieldMatch));
374     }
375
376     private static void setTableFeatureProperty(final ApplyActionsMiss propType, final TableFeaturePropertiesBuilder propBuilder) {
377         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMiss applyActionsMiss = propType
378                 .getApplyActionsMiss();
379         setActionTableFeatureProperty(
380                 propBuilder,
381                 TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
382                 ((applyActionsMiss == null) ? new ArrayList<>()
383                         : applyActionsMiss.getAction()));
384     }
385
386     private static void setTableFeatureProperty(final ApplyActions propType, final TableFeaturePropertiesBuilder propBuilder) {
387         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActions applyActions = propType.getApplyActions();
388         setActionTableFeatureProperty(
389                 propBuilder,
390                 TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
391                 ((applyActions == null) ? new ArrayList<>()
392                         : applyActions.getAction()));
393     }
394
395     private static void setTableFeatureProperty(final WriteActionsMiss propType, final TableFeaturePropertiesBuilder propBuilder) {
396         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMiss writeActionsMiss = propType.getWriteActionsMiss();
397         setActionTableFeatureProperty(
398                 propBuilder,
399                 TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
400                 ((writeActionsMiss == null) ? new ArrayList<>()
401                         : writeActionsMiss.getAction()));
402     }
403
404     private static void setTableFeatureProperty(final WriteActions propType, final TableFeaturePropertiesBuilder propBuilder) {
405         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActions writeActions = propType.getWriteActions();
406         setActionTableFeatureProperty(
407                 propBuilder,
408                 TableFeaturesPropType.OFPTFPTWRITEACTIONS,
409                 ((writeActions == null) ? new ArrayList<>()
410                         : writeActions.getAction()));
411     }
412
413     private static void setTableFeatureProperty(final NextTableMiss propType, final TableFeaturePropertiesBuilder propBuilder) {
414         TablesMiss tables = propType
415                 .getTablesMiss();
416         setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,
417                 (tables == null) ? new ArrayList<>() : tables.getTableIds());
418     }
419
420     private static void setTableFeatureProperty(final NextTable propType, final TableFeaturePropertiesBuilder propBuilder) {
421         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.Tables tables = propType
422                 .getTables();
423         setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLES,
424                 (tables == null) ? new ArrayList<>() : tables.getTableIds());
425     }
426
427     private static void setTableFeatureProperty(final InstructionsMiss propType, final TableFeaturePropertiesBuilder propBuilder) {
428         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMiss instructions = propType
429                 .getInstructionsMiss();
430         setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
431                 (instructions == null) ? new ArrayList<>() : instructions.getInstruction());
432     }
433
434     private static void setTableFeatureProperty(final Instructions propType, final TableFeaturePropertiesBuilder propBuilder) {
435         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions instructions = propType
436                 .getInstructions();
437         setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
438                 (instructions == null) ? new ArrayList<>() : instructions.getInstruction());
439     }
440
441     private static void setInstructionTableFeatureProperty(final TableFeaturePropertiesBuilder builder,
442                                                            final TableFeaturesPropType type, final List<Instruction> instructionList) {
443         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction> instructionTypeList = new ArrayList<>();
444
445         for (Instruction currInstruction : instructionList) {
446             InstructionBuilder instructionType = new InstructionBuilder();
447
448             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction instruction = currInstruction
449                     .getInstruction();
450
451             if (instruction instanceof GoToTableCase) {
452                 GotoTableCaseBuilder goToTableCaseBuilder = new GotoTableCaseBuilder();
453                 instructionType.setInstructionChoice(goToTableCaseBuilder.build());
454             } else if (instruction instanceof WriteMetadataCase) {
455                 WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
456                 instructionType.setInstructionChoice(writeMetadataCaseBuilder.build());
457             } else if (instruction instanceof WriteActionsCase) {
458                 WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
459                 instructionType.setInstructionChoice(writeActionsCaseBuilder.build());
460             } else if (instruction instanceof ApplyActionsCase) {
461                 ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
462                 instructionType.setInstructionChoice(applyActionsCaseBuilder.build());
463             } else if (instruction instanceof ClearActionsCase) {
464                 ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
465                 instructionType.setInstructionChoice(clearActionsCaseBuilder.build());
466             } else if (instruction instanceof MeterCase) {
467                 MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
468                 instructionType.setInstructionChoice(meterCaseBuilder.build());
469             }
470
471             // TODO: Experimenter instructions are unhandled
472             instructionTypeList.add(instructionType.build());
473         }
474
475         InstructionRelatedTableFeaturePropertyBuilder propBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
476         propBuilder.setInstruction(instructionTypeList);
477         builder.setType(type);
478         builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, propBuilder.build());
479     }
480
481     private static void setNextTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type,
482                                                     final List<Short> tableIds) {
483         List<NextTableIds> nextTableIdsList = new ArrayList<>();
484
485         for (Short tableId : tableIds) {
486             NextTableIdsBuilder nextTableId = new NextTableIdsBuilder();
487             nextTableId.setTableId(tableId);
488             nextTableIdsList.add(nextTableId.build());
489         }
490
491         NextTableRelatedTableFeaturePropertyBuilder propBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
492         propBuilder.setNextTableIds(nextTableIdsList);
493         builder.setType(type);
494         builder.addAugmentation(NextTableRelatedTableFeatureProperty.class, propBuilder.build());
495     }
496
497     private static void setActionTableFeatureProperty(final TableFeaturePropertiesBuilder builder,
498                                                       final TableFeaturesPropType type,
499                                                       final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> salActions) {
500
501         List<Action> actionList = new ArrayList<>();
502
503         for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action currAction : salActions) {
504             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionType = currAction
505                     .getAction();
506             ActionBuilder actionBuilder = new ActionBuilder();
507
508             if (actionType instanceof OutputActionCase) {
509                 OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
510                 actionBuilder.setActionChoice(outputActionCaseBuilder.build());
511             } else if (actionType instanceof GroupActionCase) {
512                 GroupCaseBuilder groupActionBuilder = new GroupCaseBuilder();
513                 actionBuilder.setActionChoice(groupActionBuilder.build());
514             } else if (actionType instanceof CopyTtlOutCase) {
515                 CopyTtlOutCaseBuilder copyTtlOutCaseBuilder = new CopyTtlOutCaseBuilder();
516                 actionBuilder.setActionChoice(copyTtlOutCaseBuilder.build());
517             } else if (actionType instanceof CopyTtlInCase) {
518                 CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
519                 actionBuilder.setActionChoice(copyTtlInCaseBuilder.build());
520             } else if (actionType instanceof SetMplsTtlActionCase) {
521                 SetMplsTtlCaseBuilder setMplsTtlActionBuilder = new SetMplsTtlCaseBuilder();
522                 actionBuilder.setActionChoice(setMplsTtlActionBuilder.build());
523             } else if (actionType instanceof DecMplsTtlCase) {
524                 DecMplsTtlCaseBuilder decMplsTtlCaseBuilder = new DecMplsTtlCaseBuilder();
525                 actionBuilder.setActionChoice(decMplsTtlCaseBuilder.build());
526             } else if (actionType instanceof PushVlanActionCase) {
527                 PushVlanCaseBuilder pushVlanActionBuilder = new PushVlanCaseBuilder();
528                 actionBuilder.setActionChoice(pushVlanActionBuilder.build());
529             } else if (actionType instanceof PopVlanActionCase) {
530                 PopVlanCaseBuilder popVlanCaseBuilder = new PopVlanCaseBuilder();
531                 actionBuilder.setActionChoice(popVlanCaseBuilder.build());
532             } else if (actionType instanceof PushMplsActionCase) {
533                 PushMplsCaseBuilder pushMplsActionBuilder = new PushMplsCaseBuilder();
534                 actionBuilder.setActionChoice(pushMplsActionBuilder.build());
535             } else if (actionType instanceof PopMplsActionCase) {
536                 PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
537                 actionBuilder.setActionChoice(popMplsCaseBuilder.build());
538             } else if (actionType instanceof SetQueueActionCase) {
539                 SetQueueCaseBuilder setQueueActionBuilder = new SetQueueCaseBuilder();
540                 actionBuilder.setActionChoice(setQueueActionBuilder.build());
541             } else if (actionType instanceof SetNwTtlActionCase) {
542                 SetNwTtlCaseBuilder setNwTtlActionBuilder = new SetNwTtlCaseBuilder();
543                 actionBuilder.setActionChoice(setNwTtlActionBuilder.build());
544             } else if (actionType instanceof DecNwTtlCase) {
545                 DecNwTtlCaseBuilder decNwTtlCaseBuilder = new DecNwTtlCaseBuilder();
546                 actionBuilder.setActionChoice(decNwTtlCaseBuilder.build());
547             } else if (actionType instanceof SetFieldCase) {
548                 SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
549                 actionBuilder.setActionChoice(setFieldCaseBuilder.build());
550             } else if (actionType instanceof PushPbbActionCase) {
551                 PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
552                 actionBuilder.setActionChoice(pushPbbCaseBuilder.build());
553             } else if (actionType instanceof PopPbbActionCase) {
554                 PopPbbCaseBuilder popPbbCaseBuilder = new PopPbbCaseBuilder();
555                 actionBuilder.setActionChoice(popPbbCaseBuilder.build());
556             }
557
558             // Experimenter action is unhandled
559             actionList.add(actionBuilder.build());
560         }
561
562         ActionRelatedTableFeaturePropertyBuilder propBuilder = new ActionRelatedTableFeaturePropertyBuilder();
563         propBuilder.setAction(actionList);
564         builder.setType(type);
565         builder.addAugmentation(ActionRelatedTableFeatureProperty.class, propBuilder.build());
566     }
567
568     private static void setSetFieldTableFeatureProperty(
569             final TableFeaturePropertiesBuilder builder,
570             final TableFeaturesPropType type,
571             final List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFields) {
572         List<MatchEntry> matchEntriesList = new ArrayList<>();
573
574         for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch currMatch : setFields) {
575             Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField> currMatchType = currMatch
576                     .getMatchType();
577             MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
578             Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField> ofTableFeatureClass
579                     = SAL_TO_OF_TABLE_FEATURES.get(currMatchType);
580             setMatchEntry(matchEntryBuilder, ofTableFeatureClass, currMatch.isHasMask());
581             matchEntriesList.add(matchEntryBuilder.build());
582         }
583
584         OxmRelatedTableFeaturePropertyBuilder propBuilder = new OxmRelatedTableFeaturePropertyBuilder();
585         propBuilder.setMatchEntry(matchEntriesList);
586         builder.setType(type);
587         builder.addAugmentation(OxmRelatedTableFeatureProperty.class, propBuilder.build());
588     }
589
590     private static void setMatchEntry(final MatchEntryBuilder builder,
591                                       final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField> field,
592                                       final Boolean hasMask) {
593         if(field == TcpFlags.class) {
594             builder.setOxmClass(ExperimenterClass.class);
595         } else {
596             builder.setOxmClass(OpenflowBasicClass.class);
597         }
598         builder.setOxmMatchField(field);
599         builder.setHasMask(hasMask);
600     }
601
602     @Override
603     public Collection<Class<? extends DataContainer>> getTypes() {
604         return  TYPES;
605     }
606
607     @Override
608     public List<TableFeatures> convert(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures source, VersionConvertorData data) {
609         List<TableFeatures> ofTableFeaturesList = new ArrayList<>();
610         TableFeaturesBuilder ofTableFeatures = new TableFeaturesBuilder();
611
612         for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures salTableFeatures : source
613                 .getTableFeatures()) {
614             ofTableFeatures.setTableId(salTableFeatures.getTableId());
615             ofTableFeatures.setName(salTableFeatures.getName());
616             ofTableFeatures.setMetadataMatch(salTableFeatures.getMetadataMatch());
617             ofTableFeatures.setMetadataWrite(salTableFeatures.getMetadataWrite());
618             ofTableFeatures.setMaxEntries(salTableFeatures.getMaxEntries());
619
620             if (salTableFeatures.getConfig() != null) {
621                 ofTableFeatures.setConfig(new TableConfig(salTableFeatures.getConfig().isDEPRECATEDMASK()));
622             }
623
624             ofTableFeatures.setTableFeatureProperties(toTableProperties(salTableFeatures.getTableProperties()));
625             ofTableFeaturesList.add(ofTableFeatures.build());
626         }
627
628         return ofTableFeaturesList;
629     }
630 }