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