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