Clean up use of deprecated methods
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / TableFeaturesResponseConvertorTest.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. 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 java.util.ArrayList;
12 import java.util.Collection;
13 import java.util.Collections;
14 import java.util.Iterator;
15 import java.util.List;
16 import java.util.Optional;
17 import org.junit.Assert;
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.opendaylight.openflowplugin.api.OFConstants;
21 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
22 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeaturePropertyBuilder;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCase;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCase;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCaseBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCase;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCaseBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCase;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCaseBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCase;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCase;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCase;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCaseBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.group._case.GroupActionBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.pbb._case.PushPbbActionBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.vlan._case.PushVlanActionBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.mpls.ttl._case.SetMplsTtlActionBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.src._case.SetNwSrcActionBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCaseBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice._goto.table._case.GotoTableBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.apply.actions._case.ApplyActionsBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.actions._case.WriteActionsBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.metadata._case.WriteMetadataBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
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.EthDst;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthSrc;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPhyPort;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpEcn;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpProto;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Exthdr;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TcpSrc;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpDst;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpSrc;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeaturesBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTable;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMiss;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Wildcards;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
105 import org.opendaylight.yangtools.yang.common.Uint64;
106 import org.opendaylight.yangtools.yang.common.Uint8;
107
108 /**
109  * Unit tests for table features response conversions.
110  *
111  * @author michal.polkorab
112  */
113 public class TableFeaturesResponseConvertorTest {
114     private ConvertorManager convertorManager;
115
116     @Before
117     public void setUp() {
118         convertorManager = ConvertorManagerFactory.createDefaultManager();
119     }
120
121     /**
122      * Incorrect / empty input test.
123      */
124     @Test
125     public void test() {
126         List<TableFeatures> list = convert(null);
127         Assert.assertEquals("Returned list is not empty", 0, list.size());
128     }
129
130     /**
131      * Incorrect / empty input test.
132      */
133     @Test
134     public void test2() {
135         MultipartReplyTableFeaturesBuilder builder = new MultipartReplyTableFeaturesBuilder();
136         List<TableFeatures> list = convert(builder.build());
137         Assert.assertEquals("Returned list is not empty", 0, list.size());
138     }
139
140     /**
141      * Test correct input - without table properties.
142      */
143     @Test
144     public void testWithMPTableFeature() {
145         TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
146         featuresBuilder.setTableId((short) 5);
147         featuresBuilder.setName("Aloha");
148         byte[] metaMatch = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};
149         featuresBuilder.setMetadataMatch(metaMatch);
150         byte[] metaWrite = new byte[]{8, 9, 10, 11, 12, 13, 14, 15};
151         featuresBuilder.setMetadataWrite(metaWrite);
152         featuresBuilder.setConfig(new TableConfig(false));
153         featuresBuilder.setMaxEntries(42L);
154
155         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart
156             .reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features
157                 .TableFeatures> features = new ArrayList<>();
158         features.add(featuresBuilder.build());
159
160         MultipartReplyTableFeaturesBuilder builder = new MultipartReplyTableFeaturesBuilder();
161         builder.setTableFeatures(features);
162         List<TableFeatures> list = convert(builder.build());
163         Assert.assertEquals("Returned empty list", 1, list.size());
164         TableFeatures feature = list.get(0);
165         Assert.assertEquals("Wrong table-id", 5, feature.getTableId().intValue());
166         Assert.assertEquals("Wrong name", "Aloha", feature.getName());
167         Assert.assertEquals("Wrong metadata match", Uint64.valueOf("0001020304050607", 16), feature.getMetadataMatch());
168         Assert.assertEquals("Wrong metadata write", Uint64.valueOf("08090A0B0C0D0E0F", 16), feature.getMetadataWrite());
169         Assert.assertEquals("Wrong config", false, feature.getConfig().isDEPRECATEDMASK());
170         Assert.assertEquals("Wrong max-entries", 42, feature.getMaxEntries().intValue());
171         Assert.assertEquals("Wrong properties", 0, feature.getTableProperties().nonnullTableFeatureProperties().size());
172     }
173
174     /**
175      * Test correct input.
176      */
177     @Test
178     public void testWithMPTableFeatureWithProperties() {
179         TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
180         featuresBuilder.setTableId((short) 5);
181         featuresBuilder.setName("Aloha");
182         featuresBuilder.setMetadataMatch(new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
183         featuresBuilder.setMetadataWrite(new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
184         featuresBuilder.setConfig(new TableConfig(false));
185         featuresBuilder.setMaxEntries(42L);
186
187         TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
188
189         propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);
190         List<NextTableIds> nextIds = new ArrayList<>();
191         nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());
192         nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());
193         propBuilder.addAugmentation(new NextTableRelatedTableFeaturePropertyBuilder().setNextTableIds(nextIds).build());
194
195         List<TableFeatureProperties> properties = new ArrayList<>();
196         properties.add(propBuilder.build());
197         propBuilder = new TableFeaturePropertiesBuilder();
198
199         propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);
200         nextIds = new ArrayList<>();
201         nextIds.add(new NextTableIdsBuilder().setTableId((short) 3).build());
202         propBuilder.addAugmentation(new NextTableRelatedTableFeaturePropertyBuilder().setNextTableIds(nextIds).build());
203         properties.add(propBuilder.build());
204         propBuilder = new TableFeaturePropertiesBuilder();
205
206         propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);
207
208          /* -------------------------------------------------- */
209
210         List<Action> actions = new ArrayList<>();
211         WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
212         ActionBuilder actionBuilder = new ActionBuilder();
213         actionBuilder.setActionChoice(createSetNwSrcAction());
214         actions.add(actionBuilder.build());
215         writeActionsBuilder.setAction(actions);
216
217         WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
218         writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
219
220         InstructionBuilder insBuilder = new InstructionBuilder();
221         insBuilder.setInstructionChoice(writeActionsCaseBuilder.build());
222
223         List<Instruction> insIds = new ArrayList<>();
224         insIds.add(insBuilder.build());
225
226          /* -------------------------------------------------- */
227
228         insBuilder = new InstructionBuilder();
229         GotoTableCaseBuilder gotoCaseBuilder = new GotoTableCaseBuilder();
230         GotoTableBuilder gotoTableBuilder = new GotoTableBuilder();
231         gotoCaseBuilder.setGotoTable(gotoTableBuilder.build());
232         insBuilder.setInstructionChoice(gotoCaseBuilder.build());
233         insIds.add(insBuilder.build());
234
235         propBuilder.addAugmentation(new InstructionRelatedTableFeaturePropertyBuilder().setInstruction(insIds).build());
236         properties.add(propBuilder.build());
237
238          /* -------------------------------------------------- */
239
240         propBuilder = new TableFeaturePropertiesBuilder();
241         propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS);
242         insIds = new ArrayList<>();
243         insBuilder = new InstructionBuilder();
244         WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
245         WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder();
246         writeMetadataCaseBuilder.setWriteMetadata(writeMetadataBuilder.build());
247         insBuilder.setInstructionChoice(writeMetadataCaseBuilder.build());
248         insIds.add(insBuilder.build());
249
250         insBuilder = new InstructionBuilder();
251         ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
252         ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
253         applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
254         insBuilder.setInstructionChoice(applyActionsCaseBuilder.build());
255         insIds.add(insBuilder.build());
256
257         insBuilder = new InstructionBuilder();
258         MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
259         MeterBuilder meterBuilder = new MeterBuilder();
260         meterCaseBuilder.setMeter(meterBuilder.build());
261         insBuilder.setInstructionChoice(meterCaseBuilder.build());
262         insIds.add(insBuilder.build());
263
264
265         insBuilder = new InstructionBuilder();
266         ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
267         insBuilder.setInstructionChoice(clearActionsCaseBuilder.build());
268         insIds.add(insBuilder.build());
269
270
271         insBuilder = new InstructionBuilder();
272         GotoTableCaseBuilder gotoCaseBuilder2 = new GotoTableCaseBuilder();
273         GotoTableBuilder gotoTableBuilder2 = new GotoTableBuilder();
274         gotoCaseBuilder2.setGotoTable(gotoTableBuilder2.build());
275         insBuilder.setInstructionChoice(gotoCaseBuilder2.build());
276         insIds.add(insBuilder.build());
277
278         propBuilder.addAugmentation(new InstructionRelatedTableFeaturePropertyBuilder().setInstruction(insIds).build());
279         properties.add(propBuilder.build());
280         featuresBuilder.setTableFeatureProperties(properties);
281
282         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart
283             .reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features
284                 .TableFeatures> features = new ArrayList<>();
285         features.add(featuresBuilder.build());
286         featuresBuilder = new TableFeaturesBuilder();
287         featuresBuilder.setTableId((short) 6);
288         featuresBuilder.setName("Mahalo");
289         featuresBuilder.setMetadataMatch(new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
290         featuresBuilder.setMetadataWrite(new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
291         featuresBuilder.setConfig(new TableConfig(false));
292         featuresBuilder.setMaxEntries(24L);
293
294         /* -------------------------------------------------- */
295
296         properties = new ArrayList<>();
297         propBuilder = new TableFeaturePropertiesBuilder();
298         propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);
299         MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
300         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
301         entriesBuilder.setOxmMatchField(InPhyPort.class);
302         entriesBuilder.setHasMask(false);
303
304         List<MatchEntry> entries = new ArrayList<>();
305         entries.add(entriesBuilder.build());
306         entriesBuilder = new MatchEntryBuilder();
307         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
308         entriesBuilder.setOxmMatchField(InPort.class);
309         entriesBuilder.setHasMask(false);
310         entries.add(entriesBuilder.build());
311
312         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().setMatchEntry(entries).build());
313         properties.add(propBuilder.build()); //[0]
314
315         /* -------------------------------------------------- */
316
317         propBuilder = new TableFeaturePropertiesBuilder();
318         propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD);
319         entries = new ArrayList<>();
320         entriesBuilder = new MatchEntryBuilder();
321         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
322         entriesBuilder.setOxmMatchField(IpProto.class);
323         entriesBuilder.setHasMask(false);
324         entries.add(entriesBuilder.build());
325         entriesBuilder = new MatchEntryBuilder();
326         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
327         entriesBuilder.setOxmMatchField(IpEcn.class);
328         entriesBuilder.setHasMask(false);
329         entries.add(entriesBuilder.build());
330         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().setMatchEntry(entries).build());
331         properties.add(propBuilder.build());//[1]
332
333         /* -------------------------------------------------- */
334
335         propBuilder = new TableFeaturePropertiesBuilder();
336         propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELD);
337         entries = new ArrayList<>();
338         entriesBuilder = new MatchEntryBuilder();
339         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
340         entriesBuilder.setOxmMatchField(Ipv6Exthdr.class);
341         entriesBuilder.setHasMask(false);
342         entries.add(entriesBuilder.build());
343         entriesBuilder = new MatchEntryBuilder();
344         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
345         entriesBuilder.setOxmMatchField(VlanVid.class);
346         entriesBuilder.setHasMask(false);
347         entries.add(entriesBuilder.build());
348         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().setMatchEntry(entries).build());
349         properties.add(propBuilder.build());//[2]
350
351         /* -------------------------------------------------- */
352
353         propBuilder = new TableFeaturePropertiesBuilder();
354         propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS);
355         entries = new ArrayList<>();
356         entriesBuilder = new MatchEntryBuilder();
357         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
358         entriesBuilder.setOxmMatchField(VlanPcp.class);
359         entriesBuilder.setHasMask(false);
360         entries.add(entriesBuilder.build());
361         entriesBuilder = new MatchEntryBuilder();
362         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
363         entriesBuilder.setOxmMatchField(TcpSrc.class);
364         entriesBuilder.setHasMask(false);
365         entries.add(entriesBuilder.build());
366         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().setMatchEntry(entries).build());
367         properties.add(propBuilder.build());//[3]
368
369         /* -------------------------------------------------- */
370
371         propBuilder = new TableFeaturePropertiesBuilder();
372         propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS);
373         entries = new ArrayList<>();
374         entriesBuilder = new MatchEntryBuilder();
375         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
376         entriesBuilder.setOxmMatchField(UdpSrc.class);
377         entriesBuilder.setHasMask(false);
378         entries.add(entriesBuilder.build());
379
380         entriesBuilder = new MatchEntryBuilder();
381         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
382         entriesBuilder.setOxmMatchField(UdpDst.class);
383         entriesBuilder.setHasMask(false);
384         entries.add(entriesBuilder.build());
385
386         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().setMatchEntry(entries).build());
387         properties.add(propBuilder.build());//[4]
388
389         /* -------------------------------------------------- */
390
391         propBuilder = new TableFeaturePropertiesBuilder();
392         propBuilder.setType(TableFeaturesPropType.OFPTFPTWILDCARDS);
393         entries = new ArrayList<>();
394
395         entriesBuilder = new MatchEntryBuilder();
396         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
397         entriesBuilder.setOxmMatchField(EthSrc.class);
398         entriesBuilder.setHasMask(false);
399         entries.add(entriesBuilder.build());
400
401         entriesBuilder = new MatchEntryBuilder();
402         entriesBuilder.setOxmClass(OpenflowBasicClass.class);
403         entriesBuilder.setOxmMatchField(EthDst.class);
404         entriesBuilder.setHasMask(false);
405         entries.add(entriesBuilder.build());
406
407         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().setMatchEntry(entries).build());
408         properties.add(propBuilder.build());//[5]
409
410         /* -------------------------------------------------- */
411
412         propBuilder = new TableFeaturePropertiesBuilder();
413         propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONS);
414         actions = new ArrayList<>();
415
416         actionBuilder = new ActionBuilder();
417         actionBuilder.setActionChoice(createSetNwSrcAction());
418         actions.add(actionBuilder.build());
419
420         actionBuilder = new ActionBuilder();
421         actionBuilder.setActionChoice(createSetNwSrcAction());
422         actions.add(actionBuilder.build());
423
424         actionBuilder = new ActionBuilder();
425         actionBuilder.setActionChoice(createSetNwSrcAction());
426         actions.add(actionBuilder.build());
427
428         propBuilder.addAugmentation(new ActionRelatedTableFeaturePropertyBuilder().setAction(actions).build());
429         properties.add(propBuilder.build());//[6]
430
431         /* -------------------------------------------------- */
432
433         propBuilder = new TableFeaturePropertiesBuilder();
434         propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS);
435
436         actions = new ArrayList<>();
437         actionBuilder = new ActionBuilder();
438         actionBuilder.setActionChoice(createGroupAction());
439         actions.add(actionBuilder.build());
440
441         actionBuilder = new ActionBuilder();
442         actionBuilder.setActionChoice(createCopyTtlInCase());
443         actions.add(actionBuilder.build());
444
445         actionBuilder = new ActionBuilder();
446         actionBuilder.setActionChoice(createCopyTtlOutCase());
447         actions.add(actionBuilder.build());
448         propBuilder.addAugmentation(new ActionRelatedTableFeaturePropertyBuilder().setAction(actions).build());
449         properties.add(propBuilder.build());//[7]
450
451         /* -------------------------------------------------- */
452         propBuilder = new TableFeaturePropertiesBuilder();
453         propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONS);
454
455         actions = new ArrayList<>();
456         actionBuilder = new ActionBuilder();
457         actionBuilder.setActionChoice(createSetMplsTtlCase());
458         actions.add(actionBuilder.build());
459
460         actionBuilder = new ActionBuilder();
461         actionBuilder.setActionChoice(createDecMplsTtlCase());
462         actions.add(actionBuilder.build());
463
464         actionBuilder = new ActionBuilder();
465         actionBuilder.setActionChoice(pushVlanCase());
466         actions.add(actionBuilder.build());
467
468         propBuilder.addAugmentation(new ActionRelatedTableFeaturePropertyBuilder().setAction(actions).build());
469         properties.add(propBuilder.build());
470
471         /* -------------------------------------------------- */
472
473         propBuilder = new TableFeaturePropertiesBuilder();
474         propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS);
475
476         actions = new ArrayList<>();
477         actionBuilder = new ActionBuilder();
478         actionBuilder.setActionChoice(createPopVlanCase());
479         actions.add(actionBuilder.build());
480
481         actionBuilder = new ActionBuilder();
482         actionBuilder.setActionChoice(createPushPbbCase());
483         actions.add(actionBuilder.build());
484
485         actionBuilder = new ActionBuilder();
486         actionBuilder.setActionChoice(createEmptySetFieldCase());
487         actions.add(actionBuilder.build());
488
489         propBuilder.addAugmentation(new ActionRelatedTableFeaturePropertyBuilder().setAction(actions).build());
490         properties.add(propBuilder.build());
491
492         /* -------------------------------------------------- */
493
494         propBuilder = new TableFeaturePropertiesBuilder();
495         propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);
496         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().build());
497         properties.add(propBuilder.build());
498
499         /* -------------------------------------------------- */
500
501         propBuilder = new TableFeaturePropertiesBuilder();
502         propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);
503         propBuilder.addAugmentation(new OxmRelatedTableFeaturePropertyBuilder().build());
504         properties.add(propBuilder.build());
505
506         /* -------------------------------------------------- */
507
508         featuresBuilder.setTableFeatureProperties(properties);
509         features.add(featuresBuilder.build());
510
511         MultipartReplyTableFeaturesBuilder builder = new MultipartReplyTableFeaturesBuilder();
512         builder.setTableFeatures(features);
513
514         List<TableFeatures> list = convert(builder.build());
515
516         Assert.assertEquals("Returned empty list", 2, list.size());
517         TableFeatures feature = list.get(0);
518         Assert.assertEquals("Wrong table-id", 5, feature.getTableId().intValue());
519         Assert.assertEquals("Wrong name", "Aloha", feature.getName());
520         Assert.assertEquals("Wrong metadata match", Uint64.valueOf("0001020304050607", 16), feature.getMetadataMatch());
521         Assert.assertEquals("Wrong metadata write",Uint64.valueOf("08090A0B0C0D0E0F", 16), feature.getMetadataWrite());
522         Assert.assertEquals("Wrong config", false, feature.getConfig().isDEPRECATEDMASK());
523         Assert.assertEquals("Wrong max-entries", 42, feature.getMaxEntries().intValue());
524         Assert.assertEquals("Wrong properties", 4, feature.getTableProperties().nonnullTableFeatureProperties().size());
525
526         var featProps = feature.getTableProperties().getTableFeatureProperties().values().iterator();
527         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table
528             .properties.TableFeatureProperties property = featProps.next();
529         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
530             + "rev131026.table.feature.prop.type.table.feature.prop.type.NextTable",
531                 property.getTableFeaturePropType().implementedInterface().getName());
532         NextTable propType = (NextTable) property.getTableFeaturePropType();
533         List<Uint8> ids = propType.getTables().getTableIds();
534         Assert.assertEquals("Wrong next table-id size", 2, ids.size());
535         Assert.assertEquals("Wrong next-registry-id", 1, ids.get(0).intValue());
536         Assert.assertEquals("Wrong next-registry-id", 2, ids.get(1).intValue());
537         property = featProps.next();
538         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
539             + "rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMiss",
540                 property.getTableFeaturePropType().implementedInterface().getName());
541         NextTableMiss propType2 = (NextTableMiss) property.getTableFeaturePropType();
542         ids = propType2.getTablesMiss().getTableIds();
543         Assert.assertEquals("Wrong next table-id size", 1, ids.size());
544         Assert.assertEquals("Wrong next-registry-id", 3, ids.get(0).intValue());
545
546         property = featProps.next();
547         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
548             + "rev131026.table.feature.prop.type.table.feature.prop.type.Instructions",
549                 property.getTableFeaturePropType().implementedInterface().getName());
550         Instructions propType3 = (Instructions) property.getTableFeaturePropType();
551         var instructionIds = propType3.getInstructions().nonnullInstruction().values();
552         Assert.assertEquals("Wrong instruction-ids size", 2, instructionIds.size());
553         var instructionIt = instructionIds.iterator();
554         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
555             + "rev131026.instruction.instruction.WriteActionsCase",
556             instructionIt.next().getInstruction().implementedInterface().getName());
557         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
558             + "rev131026.instruction.instruction.GoToTableCase",
559             instructionIt.next().getInstruction().implementedInterface().getName());
560         property = featProps.next();
561         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
562             + "rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss",
563                 property.getTableFeaturePropType().implementedInterface().getName());
564         InstructionsMiss propType4 = (InstructionsMiss) property.getTableFeaturePropType();
565         instructionIds = propType4.getInstructionsMiss().nonnullInstruction().values();
566         Assert.assertEquals("Wrong instruction-ids size", 5, instructionIds.size());
567         instructionIt = instructionIds.iterator();
568         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
569             + "rev131026.instruction.instruction.WriteMetadataCase",
570                 instructionIt.next().getInstruction().implementedInterface().getName());
571         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
572             + "rev131026.instruction.instruction.ApplyActionsCase",
573                 instructionIt.next().getInstruction().implementedInterface().getName());
574         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
575             + "rev131026.instruction.instruction.MeterCase",
576                 instructionIt.next().getInstruction().implementedInterface().getName());
577         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
578             + "rev131026.instruction.instruction.ClearActionsCase",
579                 instructionIt.next().getInstruction().implementedInterface().getName());
580         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
581             + "rev131026.instruction.instruction.GoToTableCase",
582                 instructionIt.next().getInstruction().implementedInterface().getName());
583
584         feature = list.get(1);
585         Assert.assertEquals("Wrong table-id", 6, feature.getTableId().intValue());
586         Assert.assertEquals("Wrong name", "Mahalo", feature.getName());
587         Assert.assertEquals("Wrong metadata match", Uint64.valueOf("08090A0B0C0D0E0F", 16), feature.getMetadataMatch());
588         Assert.assertEquals("Wrong metadata write", Uint64.valueOf("0001020304050607", 16), feature.getMetadataWrite());
589         Assert.assertEquals("Wrong config", false, feature.getConfig().isDEPRECATEDMASK());
590         Assert.assertEquals("Wrong max-entries", 24, feature.getMaxEntries().intValue());
591         Assert.assertEquals("Wrong properties", 12, feature.getTableProperties().getTableFeatureProperties().size());
592         featProps = feature.getTableProperties().nonnullTableFeatureProperties().values().iterator();
593         property = featProps.next();
594         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
595             + "rev131026.table.feature.prop.type.table.feature.prop.type.Match",
596                 property.getTableFeaturePropType().implementedInterface().getName());
597         Match propType5 = (Match) property.getTableFeaturePropType();
598         Collection<SetFieldMatch> fieldMatch = propType5.getMatchSetfield().nonnullSetFieldMatch().values();
599         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
600         Iterator<SetFieldMatch> fieldIt = fieldMatch.iterator();
601         Assert.assertEquals("Wrong match-entry-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
602             + "rev131026.InPhyPort", fieldIt.next().getMatchType().getName());
603         Assert.assertEquals("Wrong match-entry-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
604             + "rev131026.InPort", fieldIt.next().getMatchType().getName());
605         property = featProps.next();
606         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
607             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield",
608                 property.getTableFeaturePropType().implementedInterface().getName());
609         ApplySetfield propType6 = (ApplySetfield) property.getTableFeaturePropType();
610         fieldMatch = propType6.getApplySetfield().nonnullSetFieldMatch().values();
611         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
612         fieldIt = fieldMatch.iterator();
613         Assert.assertEquals("Wrong match-entry-id",
614                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto",
615                 fieldIt.next().getMatchType().getName());
616         Assert.assertEquals("Wrong match-entry-id",
617                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn",
618                 fieldIt.next().getMatchType().getName());
619         property = featProps.next();
620         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
621             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield",
622                 property.getTableFeaturePropType().implementedInterface().getName());
623         WriteSetfield propType7 = (WriteSetfield) property.getTableFeaturePropType();
624         fieldMatch = propType7.getWriteSetfield().nonnullSetFieldMatch().values();
625         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
626         fieldIt = fieldMatch.iterator();
627         Assert.assertEquals("Wrong match-entry-id",
628                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr",
629                 fieldIt.next().getMatchType().getName());
630         Assert.assertEquals("Wrong match-entry-id",
631                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid",
632                 fieldIt.next().getMatchType().getName());
633         property = featProps.next();
634         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
635             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss",
636                 property.getTableFeaturePropType().implementedInterface().getName());
637         WriteSetfieldMiss propType8 = (WriteSetfieldMiss) property.getTableFeaturePropType();
638         fieldMatch = propType8.getWriteSetfieldMiss().nonnullSetFieldMatch().values();
639         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
640         fieldIt = fieldMatch.iterator();
641         Assert.assertEquals("Wrong match-entry-id",
642                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp",
643                 fieldIt.next().getMatchType().getName());
644         Assert.assertEquals("Wrong match-entry-id",
645                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc",
646                 fieldIt.next().getMatchType().getName());
647         property = featProps.next();
648         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
649             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss",
650                 property.getTableFeaturePropType().implementedInterface().getName());
651         ApplySetfieldMiss propType9 = (ApplySetfieldMiss) property.getTableFeaturePropType();
652         fieldMatch = propType9.getApplySetfieldMiss().nonnullSetFieldMatch().values();
653         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
654         fieldIt = fieldMatch.iterator();
655         Assert.assertEquals("Wrong match-entry-id",
656                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc",
657                 fieldIt.next().getMatchType().getName());
658         Assert.assertEquals("Wrong match-entry-id",
659                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst",
660                 fieldIt.next().getMatchType().getName());
661         property = featProps.next();
662         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
663             + "rev131026.table.feature.prop.type.table.feature.prop.type.Wildcards",
664                 property.getTableFeaturePropType().implementedInterface().getName());
665         Wildcards propType10 = (Wildcards) property.getTableFeaturePropType();
666         fieldMatch = propType10.getWildcardSetfield().nonnullSetFieldMatch().values();
667         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
668         fieldIt = fieldMatch.iterator();
669         Assert.assertEquals("Wrong match-entry-id",
670                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc",
671                 fieldIt.next().getMatchType().getName());
672         Assert.assertEquals("Wrong match-entry-id",
673                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst",
674                 fieldIt.next().getMatchType().getName());
675
676         property = featProps.next();
677         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
678             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions",
679                 property.getTableFeaturePropType().implementedInterface().getName());
680         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
681             .type.ApplyActions propType11 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
682                     .feature.prop.type.table.feature.prop.type.ApplyActions) property.getTableFeaturePropType();
683         var actionsList = propType11.getApplyActions().nonnullAction().values();
684         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
685         var actionsIt = actionsList.iterator();
686         Assert.assertEquals("Wrong actions-id",
687                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase",
688                 actionsIt.next().getAction().implementedInterface().getName());
689         Assert.assertEquals("Wrong actions-id",
690                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase",
691                 actionsIt.next().getAction().implementedInterface().getName());
692         Assert.assertEquals("Wrong actions-id",
693                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase",
694                 actionsIt.next().getAction().implementedInterface().getName());
695
696         property = featProps.next();
697         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
698             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss",
699                 property.getTableFeaturePropType().implementedInterface().getName());
700         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
701             .type.ApplyActionsMiss propType12 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026
702                 .table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss) property.getTableFeaturePropType();
703         actionsList = propType12.getApplyActionsMiss().nonnullAction().values();
704         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
705         actionsIt = actionsList.iterator();
706         Assert.assertEquals("Wrong actions-id",
707                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase",
708                 actionsIt.next().getAction().implementedInterface().getName());
709         Assert.assertEquals("Wrong actions-id",
710                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase",
711                 actionsIt.next().getAction().implementedInterface().getName());
712         Assert.assertEquals("Wrong actions-id",
713                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase",
714                 actionsIt.next().getAction().implementedInterface().getName());
715         property = featProps.next();
716         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
717             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteActions",
718                 property.getTableFeaturePropType().implementedInterface().getName());
719
720         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
721             .type.WriteActions propType13 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
722                 .feature.prop.type.table.feature.prop.type.WriteActions) property.getTableFeaturePropType();
723         actionsList = propType13.getWriteActions().nonnullAction().values();
724         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
725         actionsIt = actionsList.iterator();
726         Assert.assertEquals("Wrong actions-id",
727             "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase",
728                 actionsIt.next().getAction().implementedInterface().getName());
729         Assert.assertEquals("Wrong actions-id",
730                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase",
731                 actionsIt.next().getAction().implementedInterface().getName());
732         Assert.assertEquals("Wrong actions-id",
733                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase",
734                 actionsIt.next().getAction().implementedInterface().getName());
735         property = featProps.next();
736         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
737             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss",
738                 property.getTableFeaturePropType().implementedInterface().getName());
739
740         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
741             .type.WriteActionsMiss propType14 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026
742                 .table.feature.prop.type.table.feature.prop.type.WriteActionsMiss) property.getTableFeaturePropType();
743         actionsList = propType14.getWriteActionsMiss().nonnullAction().values();
744         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
745         actionsIt = actionsList.iterator();
746         Assert.assertEquals("Wrong actions-id",
747                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase",
748                 actionsIt.next().getAction().implementedInterface().getName());
749         Assert.assertEquals("Wrong actions-id",
750                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase",
751                 actionsIt.next().getAction().implementedInterface().getName());
752         Assert.assertEquals("Wrong actions-id",
753                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase",
754                 actionsIt.next().getAction().implementedInterface().getName());
755     }
756
757     private static SetNwSrcCase createSetNwSrcAction() {
758         final SetNwSrcCaseBuilder setNwSrcCaseBuilder;
759         final SetNwSrcActionBuilder setNwSrcActionBuilder;
760         setNwSrcCaseBuilder = new SetNwSrcCaseBuilder();
761         setNwSrcActionBuilder = new SetNwSrcActionBuilder();
762         setNwSrcActionBuilder.setIpAddress(new Ipv4Address("1.2.3.4"));
763         setNwSrcCaseBuilder.setSetNwSrcAction(setNwSrcActionBuilder.build());
764         return setNwSrcCaseBuilder.build();
765     }
766
767     private static GroupCase createGroupAction() {
768         final GroupCaseBuilder groupCaseBuilder = new GroupCaseBuilder();
769         final GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
770         groupActionBuilder.setGroupId(42L);
771         groupCaseBuilder.setGroupAction(groupActionBuilder.build());
772         return groupCaseBuilder.build();
773     }
774
775     private static CopyTtlInCase createCopyTtlInCase() {
776         CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
777         return copyTtlInCaseBuilder.build();
778     }
779
780     private static CopyTtlOutCase createCopyTtlOutCase() {
781         CopyTtlOutCaseBuilder copyTtlInCaseBuilder = new CopyTtlOutCaseBuilder();
782         return copyTtlInCaseBuilder.build();
783     }
784
785     private static SetMplsTtlCase createSetMplsTtlCase() {
786         SetMplsTtlCaseBuilder setMplsTtlCaseBuilder = new SetMplsTtlCaseBuilder();
787         SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
788         setMplsTtlActionBuilder.setMplsTtl((short) 42);
789         setMplsTtlCaseBuilder.setSetMplsTtlAction(setMplsTtlActionBuilder.build());
790         return setMplsTtlCaseBuilder.build();
791     }
792
793     private static DecMplsTtlCase createDecMplsTtlCase() {
794         DecMplsTtlCaseBuilder decMplsTtlCaseBuilder = new DecMplsTtlCaseBuilder();
795         return decMplsTtlCaseBuilder.build();
796     }
797
798     private static PushVlanCase pushVlanCase() {
799         PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
800         PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder();
801         pushVlanActionBuilder.setEthertype(new EtherType(1));
802         pushVlanCaseBuilder.setPushVlanAction(pushVlanActionBuilder.build());
803         return pushVlanCaseBuilder.build();
804     }
805
806     private static PopVlanCase createPopVlanCase() {
807         PopVlanCaseBuilder popVlanCaseBuilder = new PopVlanCaseBuilder();
808         return popVlanCaseBuilder.build();
809     }
810
811     private static PushPbbCase createPushPbbCase() {
812         PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
813         PushPbbActionBuilder pushPbbActionBuilder = new PushPbbActionBuilder();
814         pushPbbActionBuilder.setEthertype(new EtherType(1));
815         pushPbbCaseBuilder.setPushPbbAction(pushPbbActionBuilder.build());
816         return pushPbbCaseBuilder.build();
817     }
818
819     private static SetFieldCase createEmptySetFieldCase() {
820         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
821         SetFieldActionBuilder setFieldActionBuilder = new SetFieldActionBuilder();
822         List<MatchEntry> matchEntries = new ArrayList<>();
823         MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
824
825         matchEntries.add(matchEntryBuilder.build());
826         setFieldActionBuilder.setMatchEntry(matchEntries);
827         setFieldCaseBuilder.setSetFieldAction(setFieldActionBuilder.build());
828         return setFieldCaseBuilder.build();
829     }
830
831
832     private List<TableFeatures> convert(final MultipartReplyTableFeatures features) {
833         Optional<List<TableFeatures>> listOptional =
834                 convertorManager.convert(features, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
835         return listOptional.orElse(Collections.emptyList());
836     }
837 }