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