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