OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / TableFeaturesResponseConvertor.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 java.math.BigInteger;
14 import java.util.ArrayList;
15 import java.util.Collection;
16 import java.util.Collections;
17 import java.util.List;
18 import java.util.Map;
19 import java.util.Set;
20 import java.util.stream.Collectors;
21 import org.opendaylight.openflowplugin.api.OFConstants;
22 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
23 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCaseBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCaseBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.clear.actions._case.ClearActionsBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.actions._case.WriteActionsBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlags;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeatureProperty;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeatureProperty;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCase;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCase;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCase;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCase;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCase;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCase;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCase;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCase;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCase;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCase;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCase;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCase;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCase;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCase;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.InstructionChoice;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCase;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCase;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpOp;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSha;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSpa;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpTha;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpTpa;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthDst;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthSrc;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthType;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv4Code;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv4Type;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv6Code;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv6Type;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPhyPort;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpDscp;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpEcn;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpProto;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Dst;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Src;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Dst;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Exthdr;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Flabel;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6NdSll;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6NdTarget;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6NdTll;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Src;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MplsBos;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MplsLabel;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MplsTc;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.PbbIsid;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.SctpDst;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.SctpSrc;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpDst;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpSrc;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TunnelId;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpDst;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpSrc;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WildcardsBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesMissBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfieldBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder;
163 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
165 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties;
166 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
167 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
168 import org.slf4j.Logger;
169 import org.slf4j.LoggerFactory;
170
171 /**
172  * Converts a OF library table features into the MD-SAL library table features.
173  *
174  * <p>
175  * Example usage:
176  * <pre>
177  * {@code
178  * VersionConvertorData data = new VersionConvertorData(version);
179  * Optional<List<TableFeatures>> salFeatures = convertorManager.convert(ofTableFeatures, data);
180  * }
181  * </pre>
182  */
183 public class TableFeaturesResponseConvertor
184         extends Convertor<MultipartReplyTableFeatures, List<TableFeatures>, VersionConvertorData> {
185     private static final Logger LOG = LoggerFactory.getLogger(TableFeaturesResponseConvertor.class);
186     private static final Map<TableFeaturesPropType, ActionExecutor> TABLE_FEATURE_PROPERTY_TYPE_TO_ACTION;
187     private static final Map<Class<?>,
188         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> OF_TO_SAL_ACTION;
189     private static final Map<Class<? extends MatchField>, Class<? extends org.opendaylight.yang.gen.v1.urn
190             .opendaylight.table.types.rev131026.MatchField>> OF_TO_SAL_TABLE_FEATURE_PROPERTIES;
191     private static final Set<Class<?>> TYPES = Collections.singleton(MultipartReplyTableFeatures.class);
192
193     static {
194         final Builder<TableFeaturesPropType, ActionExecutor> builder = ImmutableMap.builder();
195
196         builder.put(TableFeaturesPropType.OFPTFPTINSTRUCTIONS, (property, propBuilder) -> {
197             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
198                 .prop.type.InstructionsBuilder instructionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
199                     .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder();
200             instructionBuilder.setInstructions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026
201                     .table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder()
202                             .setInstruction(setInstructionTableFeatureProperty(property)).build());
203             propBuilder.setTableFeaturePropType(instructionBuilder.build());
204         });
205         builder.put(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS, (property, propBuilder) -> {
206             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
207                 .prop.type.InstructionsMissBuilder instructionMissBuilder = new org.opendaylight.yang.gen.v1.urn
208                     .opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type
209                         .InstructionsMissBuilder();
210             instructionMissBuilder.setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
211                 .rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder()
212                     .setInstruction(setInstructionTableFeatureProperty(property)).build());
213             propBuilder.setTableFeaturePropType(instructionMissBuilder.build());
214         });
215         builder.put(TableFeaturesPropType.OFPTFPTNEXTTABLES, (property, propBuilder) -> {
216             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
217                 .prop.type.NextTableBuilder nextTableBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table
218                     .types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder();
219             nextTableBuilder.setTables(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
220                 .feature.prop.type.table.feature.prop.type.next.table.TablesBuilder()
221                        .setTableIds(setNextTableFeatureProperty(property)).build());
222             propBuilder.setTableFeaturePropType(nextTableBuilder.build());
223         });
224         builder.put(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS, (property, propBuilder) -> {
225             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
226                 .prop.type.NextTableMissBuilder nextTableMissBuilder = new org.opendaylight.yang.gen.v1.urn
227                     .opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type
228                         .NextTableMissBuilder();
229             nextTableMissBuilder
230                     .setTablesMiss(new TablesMissBuilder()
231                             .setTableIds(setNextTableFeatureProperty(property)).build());
232             propBuilder.setTableFeaturePropType(nextTableMissBuilder.build());
233         });
234         builder.put(TableFeaturesPropType.OFPTFPTWRITEACTIONS, (property, propBuilder) -> {
235             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
236                 .prop.type.WriteActionsBuilder writeActionsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
237                     .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder();
238             writeActionsBuilder.setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
239                     .rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder()
240                             .setAction(setActionTableFeatureProperty(property)).build());
241             propBuilder.setTableFeaturePropType(writeActionsBuilder.build());
242         });
243         builder.put(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS, (property, propBuilder) -> {
244             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
245                 .prop.type.WriteActionsMissBuilder writeActionsMissBuilder = new org.opendaylight.yang.gen.v1.urn
246                     .opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type
247                         .WriteActionsMissBuilder();
248             writeActionsMissBuilder.setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
249                 .rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMissBuilder()
250                        .setAction(setActionTableFeatureProperty(property)).build());
251             propBuilder.setTableFeaturePropType(writeActionsMissBuilder.build());
252         });
253         builder.put(TableFeaturesPropType.OFPTFPTAPPLYACTIONS, (property, propBuilder) -> {
254             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
255                 .prop.type.ApplyActionsBuilder applyActionsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
256                     .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder();
257             applyActionsBuilder.setApplyActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026
258                     .table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder()
259                             .setAction(setActionTableFeatureProperty(property)).build());
260             propBuilder.setTableFeaturePropType(applyActionsBuilder.build());
261         });
262         builder.put(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS, (property, propBuilder) -> {
263             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
264                 .prop.type.ApplyActionsMissBuilder applyActionsMissBuilder = new org.opendaylight.yang.gen.v1.urn
265                     .opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type
266                         .ApplyActionsMissBuilder();
267             applyActionsMissBuilder.setApplyActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
268                 .rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder()
269                        .setAction(setActionTableFeatureProperty(property)).build());
270             propBuilder.setTableFeaturePropType(applyActionsMissBuilder.build());
271         });
272         builder.put(TableFeaturesPropType.OFPTFPTMATCH, (property, propBuilder) -> {
273             MatchSetfieldBuilder matchBuilder = new MatchSetfieldBuilder();
274
275             matchBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, true));
276             propBuilder.setTableFeaturePropType(new MatchBuilder().setMatchSetfield(matchBuilder.build()).build());
277         });
278         builder.put(TableFeaturesPropType.OFPTFPTWILDCARDS, (property, propBuilder) -> {
279             WildcardSetfieldBuilder wildcardsBuilder = new WildcardSetfieldBuilder();
280             wildcardsBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
281             propBuilder.setTableFeaturePropType(new WildcardsBuilder()
282                     .setWildcardSetfield(wildcardsBuilder.build()).build());
283         });
284         builder.put(TableFeaturesPropType.OFPTFPTWRITESETFIELD, (property, propBuilder) -> {
285             WriteSetfieldBuilder writeSetfieldBuilder = new WriteSetfieldBuilder();
286             writeSetfieldBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
287             propBuilder.setTableFeaturePropType(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
288                     .rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder()
289                         .setWriteSetfield(writeSetfieldBuilder.build()).build());
290         });
291         builder.put(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS, (property, propBuilder) -> {
292             WriteSetfieldMissBuilder writeSetfieldMissBuilder = new WriteSetfieldMissBuilder();
293             writeSetfieldMissBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
294             propBuilder.setTableFeaturePropType(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
295                 .rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder()
296                     .setWriteSetfieldMiss(writeSetfieldMissBuilder.build()).build());
297         });
298         builder.put(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD, (property, propBuilder) -> {
299             ApplySetfieldBuilder applySetfieldBuilder = new ApplySetfieldBuilder();
300             applySetfieldBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
301             propBuilder.setTableFeaturePropType(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
302                 .rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder()
303                    .setApplySetfield(applySetfieldBuilder.build()).build());
304         });
305         builder.put(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS, (property, propBuilder) -> {
306             ApplySetfieldMissBuilder applySetfieldMissBuilder = new ApplySetfieldMissBuilder();
307             applySetfieldMissBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
308             propBuilder.setTableFeaturePropType(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
309                 .rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder()
310                     .setApplySetfieldMiss(applySetfieldMissBuilder.build()).build());
311         });
312
313         builder.put(TableFeaturesPropType.OFPTFPTEXPERIMENTER, (property, propBuilder) ->
314             LOG.debug("Experimenter Table features is unhandled"));
315
316         builder.put(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS, (property, propBuilder) ->
317             LOG.debug("Experimenter miss Table features is unhandled"));
318
319         TABLE_FEATURE_PROPERTY_TYPE_TO_ACTION = builder.build();
320     }
321
322     static {
323         Builder<Class<?>, org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> builder =
324                 ImmutableMap.builder();
325
326         builder.put(OutputActionCase.class,
327                 new OutputActionCaseBuilder().setOutputAction(new OutputActionBuilder().build()).build());
328         builder.put(GroupCase.class,
329                 new GroupActionCaseBuilder().setGroupAction(new GroupActionBuilder().build()).build());
330         builder.put(CopyTtlOutCase.class,
331                 new CopyTtlOutCaseBuilder().setCopyTtlOut(new CopyTtlOutBuilder().build()).build());
332         builder.put(CopyTtlInCase.class,
333                 new CopyTtlInCaseBuilder().setCopyTtlIn(new CopyTtlInBuilder().build()).build());
334         builder.put(SetMplsTtlCase.class,
335                 new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(new SetMplsTtlActionBuilder().build()).build());
336         builder.put(DecMplsTtlCase.class,
337                 new DecMplsTtlCaseBuilder().setDecMplsTtl(new DecMplsTtlBuilder().build()).build());
338         builder.put(PushVlanCase.class,
339                 new PushVlanActionCaseBuilder().setPushVlanAction(new PushVlanActionBuilder().build()).build());
340         builder.put(PopVlanCase.class,
341                 new PopVlanActionCaseBuilder().setPopVlanAction(new PopVlanActionBuilder().build()).build());
342         builder.put(PushMplsCase.class,
343                 new PushMplsActionCaseBuilder().setPushMplsAction(new PushMplsActionBuilder().build()).build());
344         builder.put(PopMplsCase.class,
345                 new PopMplsActionCaseBuilder().setPopMplsAction(new PopMplsActionBuilder().build()).build());
346         builder.put(SetQueueCase.class,
347                 new SetQueueActionCaseBuilder().setSetQueueAction(new SetQueueActionBuilder().build()).build());
348         builder.put(SetNwTtlCase.class,
349                 new SetNwTtlActionCaseBuilder().setSetNwTtlAction(new SetNwTtlActionBuilder().build()).build());
350         builder.put(DecNwTtlCase.class, new DecNwTtlCaseBuilder().setDecNwTtl(new DecNwTtlBuilder().build()).build());
351         builder.put(SetFieldCase.class, new SetFieldCaseBuilder().setSetField(new SetFieldBuilder().build()).build());
352         builder.put(PushPbbCase.class,
353                 new PushPbbActionCaseBuilder().setPushPbbAction(new PushPbbActionBuilder().build()).build());
354         builder.put(PopPbbCase.class,
355                 new PopPbbActionCaseBuilder().setPopPbbAction(new PopPbbActionBuilder().build()).build());
356         builder.put(SetNwSrcCase.class,
357                 new SetNwSrcActionCaseBuilder().setSetNwSrcAction(new SetNwSrcActionBuilder().build()).build());
358         builder.put(SetNwDstCase.class,
359                 new SetNwDstActionCaseBuilder().setSetNwDstAction(new SetNwDstActionBuilder().build()).build());
360
361         OF_TO_SAL_ACTION = builder.build();
362     }
363
364     static {
365         final Builder<Class<? extends MatchField>, Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table
366                 .types.rev131026.MatchField>> builder = ImmutableMap.builder();
367
368         builder.put(ArpOp.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp.class);
369         builder.put(ArpSha.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha.class);
370         builder.put(ArpSpa.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSpa.class);
371         builder.put(ArpTha.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha.class);
372         builder.put(ArpTpa.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTpa.class);
373         builder.put(EthDst.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst.class);
374         builder.put(EthSrc.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc.class);
375         builder.put(EthType.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType.class);
376         builder.put(Icmpv4Code.class,
377                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code.class);
378         builder.put(Icmpv4Type.class,
379                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type.class);
380         builder.put(Icmpv6Code.class,
381                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Code.class);
382         builder.put(Icmpv6Type.class,
383                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type.class);
384         builder.put(InPhyPort.class,
385                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPhyPort.class);
386         builder.put(InPort.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort.class);
387         builder.put(IpDscp.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpDscp.class);
388         builder.put(IpEcn.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn.class);
389         builder.put(IpProto.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto.class);
390         builder.put(Ipv4Dst.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst.class);
391         builder.put(Ipv4Src.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Src.class);
392         builder.put(Ipv6Dst.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Dst.class);
393         builder.put(Ipv6Exthdr.class,
394                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr.class);
395         builder.put(Ipv6Flabel.class,
396                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Flabel.class);
397         builder.put(Ipv6NdSll.class,
398                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll.class);
399         builder.put(Ipv6NdTarget.class,
400                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget.class);
401         builder.put(Ipv6NdTll.class,
402                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTll.class);
403         builder.put(Ipv6Src.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Src.class);
404         builder.put(Metadata.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata.class);
405         builder.put(MplsBos.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos.class);
406         builder.put(MplsLabel.class,
407                 org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel.class);
408         builder.put(MplsTc.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsTc.class);
409         builder.put(PbbIsid.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.PbbIsid.class);
410         builder.put(SctpDst.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst.class);
411         builder.put(SctpSrc.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpSrc.class);
412         builder.put(TcpDst.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpDst.class);
413         builder.put(TcpSrc.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc.class);
414         builder.put(TunnelId.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelId.class);
415         builder.put(UdpDst.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst.class);
416         builder.put(UdpSrc.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc.class);
417         builder.put(VlanPcp.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp.class);
418         builder.put(VlanVid.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid.class);
419         builder.put(TcpFlags.class, org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags.class);
420
421         OF_TO_SAL_TABLE_FEATURE_PROPERTIES = builder.build();
422     }
423
424     private static TableProperties toTableProperties(final List<TableFeatureProperties> ofTablePropertiesList) {
425         if (ofTablePropertiesList == null) {
426             return new TablePropertiesBuilder()
427                     .setTableFeatureProperties(Collections.emptyList())
428                     .build();
429         }
430
431         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table
432             .properties.TableFeatureProperties> salTablePropertiesList = new ArrayList<>();
433         TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
434         int index = 0;
435
436         for (TableFeatureProperties property : ofTablePropertiesList) {
437             TableFeaturesPropType propType = property.getType();
438             ActionExecutor actionExecutor = TABLE_FEATURE_PROPERTY_TYPE_TO_ACTION.get(propType);
439
440             if (actionExecutor != null) {
441                 actionExecutor.execute(property, propBuilder);
442             } else {
443                 LOG.error("Unsupported table feature property : {}", propType);
444             }
445
446             propBuilder.setOrder(index);
447             salTablePropertiesList.add(propBuilder.build());
448             index += 1;
449         }
450
451         return new TablePropertiesBuilder().setTableFeatureProperties(salTablePropertiesList).build();
452     }
453
454     private static List<Instruction> setInstructionTableFeatureProperty(final TableFeatureProperties properties) {
455         List<Instruction> instructionList = new ArrayList<>();
456         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder
457             builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction
458                 .list.InstructionBuilder();
459         int index = 0;
460
461         for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731
462                 .instructions.grouping.Instruction currInstruction : properties
463                 .augmentation(InstructionRelatedTableFeatureProperty.class).getInstruction()) {
464             InstructionChoice currInstructionType = currInstruction.getInstructionChoice();
465
466             if (currInstructionType instanceof GotoTableCase) {
467                 builder.setInstruction(new GoToTableCaseBuilder()
468                         .setGoToTable(new GoToTableBuilder().build())
469                         .build());
470             } else if (currInstructionType instanceof WriteMetadataCase) {
471                 builder.setInstruction(new WriteMetadataCaseBuilder()
472                         .setWriteMetadata(new WriteMetadataBuilder().build())
473                         .build());
474             } else if (currInstructionType instanceof WriteActionsCase) {
475                 builder.setInstruction(new WriteActionsCaseBuilder()
476                         .setWriteActions(new WriteActionsBuilder().build())
477                         .build());
478             } else if (currInstructionType instanceof ApplyActionsCase) {
479                 builder.setInstruction(new ApplyActionsCaseBuilder()
480                         .setApplyActions(new ApplyActionsBuilder().build())
481                         .build());
482             } else if (currInstructionType instanceof ClearActionsCase) {
483                 builder.setInstruction(new ClearActionsCaseBuilder()
484                         .setClearActions(new ClearActionsBuilder().build())
485                         .build());
486             } else if (currInstructionType instanceof MeterCase) {
487                 builder.setInstruction(new MeterCaseBuilder()
488                         .setMeter(new MeterBuilder().build())
489                         .build());
490             }
491
492             // TODO: Experimenter instructions are unhandled
493             builder.setOrder(index);
494             index += 1;
495
496             instructionList.add(builder.build());
497         }
498
499         return instructionList;
500     }
501
502     private static List<Short> setNextTableFeatureProperty(final TableFeatureProperties properties) {
503         return properties.augmentation(NextTableRelatedTableFeatureProperty.class)
504                 .getNextTableIds().stream().map(NextTableIds::getTableId).collect(Collectors.toList());
505     }
506
507     private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>
508             setActionTableFeatureProperty(final TableFeatureProperties properties) {
509         List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList =
510                 new ArrayList<>();
511         int order = 0;
512
513         for (Action action : properties
514                 .augmentation(ActionRelatedTableFeatureProperty.class).getAction()) {
515             if (action != null && null != action.getActionChoice()) {
516                 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder
517                     actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
518                         .list.ActionBuilder();
519
520                 actionBuilder.setOrder(order++);
521                 ActionChoice actionType = action.getActionChoice();
522                 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action salAction =
523                         OF_TO_SAL_ACTION.get(actionType.getImplementedInterface());
524
525                 actionBuilder.setAction(salAction);
526                 actionList.add(actionBuilder.build());
527             }
528         }
529
530         return actionList;
531     }
532
533     private static List<SetFieldMatch> setSetFieldTableFeatureProperty(final TableFeatureProperties properties,
534                                                                        final boolean setHasMask) {
535         List<SetFieldMatch> setFieldMatchList = new ArrayList<>();
536         SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
537
538         // This handles only OpenflowBasicClass oxm class.
539         for (MatchEntry currMatch : properties.augmentation(OxmRelatedTableFeatureProperty.class)
540                 .getMatchEntry()) {
541             Class<? extends MatchField> ofMatchField = currMatch.getOxmMatchField();
542
543             if (setHasMask) {
544                 setFieldMatchBuilder.setHasMask(currMatch.isHasMask());
545             }
546
547             setFieldMatchBuilder.setMatchType(OF_TO_SAL_TABLE_FEATURE_PROPERTIES.get(ofMatchField));
548             setFieldMatchList.add(setFieldMatchBuilder.build());
549         }
550
551         return setFieldMatchList;
552     }
553
554     @Override
555     public Collection<Class<?>> getTypes() {
556         return TYPES;
557     }
558
559     @Override
560     public List<TableFeatures> convert(MultipartReplyTableFeatures source, VersionConvertorData data) {
561         if (source == null || source.getTableFeatures() == null) {
562             return Collections.emptyList();
563         }
564
565         List<TableFeatures> salTableFeaturesList = new ArrayList<>();
566         TableFeaturesBuilder salTableFeatures = new TableFeaturesBuilder();
567
568         for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply
569                 .body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures
570                     ofTableFeatures : source.getTableFeatures()) {
571             salTableFeatures.setTableId(ofTableFeatures.getTableId());
572             salTableFeatures.setName(ofTableFeatures.getName());
573
574             if (ofTableFeatures.getMetadataMatch() != null) {
575                 salTableFeatures.setMetadataMatch(new BigInteger(OFConstants.SIGNUM_UNSIGNED,
576                         ofTableFeatures.getMetadataMatch()));
577             }
578
579             if (ofTableFeatures.getMetadataWrite() != null) {
580                 salTableFeatures.setMetadataWrite(new BigInteger(OFConstants.SIGNUM_UNSIGNED,
581                         ofTableFeatures.getMetadataWrite()));
582             }
583
584             if (ofTableFeatures.getConfig() != null) {
585                 salTableFeatures.setConfig(new TableConfig(ofTableFeatures.getConfig().isOFPTCDEPRECATEDMASK()));
586             }
587
588             salTableFeatures.setMaxEntries(ofTableFeatures.getMaxEntries());
589             salTableFeatures.setTableProperties(toTableProperties(ofTableFeatures.getTableFeatureProperties()));
590             salTableFeaturesList.add(salTableFeatures.build());
591         }
592
593         return salTableFeaturesList;
594     }
595
596     private interface ActionExecutor {
597         void execute(TableFeatureProperties property, TableFeaturePropertiesBuilder propBuilder);
598     }
599 }