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