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