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