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