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