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