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