2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
11 import io.netty.buffer.ByteBuf;
13 import java.math.BigInteger;
15 import org.junit.Assert;
16 import org.junit.Test;
17 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
18 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandTypeBitmap;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDrop;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemark;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenter;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregate;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDesc;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenter;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlow;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroup;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeter;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeatures;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDesc;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStats;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueue;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTable;
70 import org.slf4j.Logger;
71 import org.slf4j.LoggerFactory;
74 * @author timotej.kubas
75 * @author michal.polkorab
77 public class MultipartReplyMessageFactoryTest {
79 private static final Logger LOGGER = LoggerFactory
80 .getLogger(MultipartReplyMessageFactoryTest.class);
83 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
87 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 01 02 03 04");
88 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
90 BufferHelper.checkHeaderV13(builtByFactory);
92 Assert.assertEquals("Wrong type", 0x07, builtByFactory.getType().getIntValue());
93 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
94 //Assert.assertArrayEquals("Wrong body", new byte[]{0x01, 0x02, 0x03, 0x04}, builtByFactory.getBody());
98 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
101 public void testMultipartReplyDescBody(){
102 final int DESC_STR_LEN = 256;
103 final int SERIAL_NUM_LEN = 32;
104 ByteBuf bb = BufferHelper.buildBuffer("00 00 00 01 00 00 00 00");
106 String mfrDesc = "Manufacturer description";
107 byte[] mfrDescBytes = new byte[256];
108 mfrDescBytes = mfrDesc.getBytes();
109 bb.writeBytes(mfrDescBytes);
110 ByteBufUtils.padBuffer((DESC_STR_LEN - mfrDescBytes.length), bb);
112 String hwDesc = "Hardware description";
113 byte[] hwDescBytes = new byte[256];
114 hwDescBytes = hwDesc.getBytes();
115 bb.writeBytes(hwDescBytes);
116 ByteBufUtils.padBuffer((DESC_STR_LEN - hwDescBytes.length), bb);
118 String swDesc = "Software description";
119 byte[] swDescBytes = new byte[256];
120 swDescBytes = swDesc.getBytes();
121 bb.writeBytes(swDescBytes);
122 ByteBufUtils.padBuffer((DESC_STR_LEN - swDescBytes.length), bb);
124 String serialNum = "SN0123456789";
125 byte[] serialNumBytes = new byte[32];
126 serialNumBytes = serialNum.getBytes();
127 bb.writeBytes(serialNumBytes);
128 ByteBufUtils.padBuffer((SERIAL_NUM_LEN - serialNumBytes.length), bb);
130 String dpDesc = "switch3 in room 3120";
131 byte[] dpDescBytes = new byte[256];
132 dpDescBytes = dpDesc.getBytes();
133 bb.writeBytes(dpDescBytes);
134 ByteBufUtils.padBuffer((DESC_STR_LEN - dpDescBytes.length), bb);
136 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
138 BufferHelper.checkHeaderV13(builtByFactory);
139 Assert.assertEquals("Wrong type", 0x00, builtByFactory.getType().getIntValue());
140 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
141 MultipartReplyDesc message = (MultipartReplyDesc) builtByFactory.getMultipartReplyBody();
142 Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());
143 Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());
144 Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());
145 Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());
146 Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());
150 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
153 public void testMultipartReplyFlowBody(){
154 ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+
158 "00 00 00 09 "+//durationSec
159 "00 00 00 07 "+//durationNsec
161 "00 0E "+//idleTimeout
162 "00 0F "+//hardTimeout
164 "00 00 00 00 "+//pad_02
165 "00 01 01 01 01 01 01 01 "+//cookie
166 "00 01 01 01 01 01 01 01 "+//packetCount
167 "00 01 01 01 01 01 01 01"//byteCount
170 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
172 BufferHelper.checkHeaderV13(builtByFactory);
173 Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
174 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
175 MultipartReplyFlow message = (MultipartReplyFlow) builtByFactory.getMultipartReplyBody();
176 Assert.assertEquals("Wrong tableId", 8, message.getFlowStats().get(0).getTableId().intValue());
177 Assert.assertEquals("Wrong durationSec", 9, message.getFlowStats().get(0).getDurationSec().intValue());
178 Assert.assertEquals("Wrong durationNsec", 7, message.getFlowStats().get(0).getDurationNsec().intValue());
179 Assert.assertEquals("Wrong priority", 12, message.getFlowStats().get(0).getPriority().intValue());
180 Assert.assertEquals("Wrong idleTimeOut", 14, message.getFlowStats().get(0).getIdleTimeout().intValue());
181 Assert.assertEquals("Wrong hardTimeOut", 15, message.getFlowStats().get(0).getHardTimeout().intValue());
182 Assert.assertEquals("Wrong flags", new FlowModFlags(true, false, true, false, true),
183 message.getFlowStats().get(0).getFlags());
184 Assert.assertEquals("Wrong cookie",
185 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
186 message.getFlowStats().get(0).getCookie());
187 Assert.assertEquals("Wrong packetCount",
188 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
189 message.getFlowStats().get(0).getPacketCount());
190 Assert.assertEquals("Wrong byteCount",
191 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
192 message.getFlowStats().get(0).getByteCount());
196 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
199 public void testMultipartReplyAggregateBody(){
200 ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 "+
201 "00 01 01 01 01 01 01 01 "+//packetCount
202 "00 01 01 01 01 01 01 01 "+//byteCount
203 "00 00 00 08 "+//flowCount
207 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
209 BufferHelper.checkHeaderV13(builtByFactory);
210 Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
211 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
212 MultipartReplyAggregate message = (MultipartReplyAggregate) builtByFactory.getMultipartReplyBody();
213 Assert.assertEquals("Wrong packetCount",
214 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
215 message.getPacketCount());
216 Assert.assertEquals("Wrong byteCount",
217 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
218 message.getByteCount());
219 Assert.assertEquals("Wrong flowCount",
221 message.getFlowCount().intValue());
225 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
228 public void testMultipartReplyTableBody(){
229 ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 00 00 00 00 "+
232 "00 00 00 10 "+//activeCount
233 "00 01 01 01 01 01 01 01 "+//lookupCount
234 "00 01 01 01 01 01 01 01"//matchedCount
237 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
239 BufferHelper.checkHeaderV13(builtByFactory);
240 Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
241 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
243 MultipartReplyTable message = (MultipartReplyTable) builtByFactory.getMultipartReplyBody();
244 Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
245 Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
246 Assert.assertEquals("Wrong lookupCount",
247 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
248 message.getTableStats().get(0).getLookupCount());
249 Assert.assertEquals("Wrong matchedCount",
250 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
251 message.getTableStats().get(0).getMatchedCount());
255 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
258 public void testMultipartReplyPortStatsBody(){
259 ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 00 00 00 00 "+
260 "00 00 00 FF "+//portNo
262 "00 01 01 01 01 01 01 01 "+//rxPackets
263 "00 02 02 02 02 02 02 02 "+//txPackets
264 "00 02 03 02 03 02 03 02 "+//rxBytes
265 "00 02 03 02 03 02 03 02 "+//txBytes
266 "00 02 03 02 03 02 03 02 "+//rxDropped
267 "00 02 03 02 03 02 03 02 "+//txDropped
268 "00 02 03 02 03 02 03 02 "+//rxErrors
269 "00 02 03 02 03 02 03 02 "+//txErrors
270 "00 02 03 02 03 02 03 02 "+//rxFrameErr
271 "00 02 03 02 03 02 03 02 "+//rxOverErr
272 "00 02 03 02 03 02 03 02 "+//rxCrcErr
273 "00 02 03 02 03 02 03 02 "+//collisions
274 "00 00 00 02 "+//durationSec
275 "00 00 00 04"//durationNsec
278 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
280 BufferHelper.checkHeaderV13(builtByFactory);
281 Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());
282 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
284 MultipartReplyPortStats message = (MultipartReplyPortStats) builtByFactory.getMultipartReplyBody();
286 Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());
287 Assert.assertEquals("Wrong rxPackets",
288 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
289 message.getPortStats().get(0).getRxPackets());
290 Assert.assertEquals("Wrong txPackets",
291 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
292 message.getPortStats().get(0).getTxPackets());
293 Assert.assertEquals("Wrong rxBytes",
294 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
295 message.getPortStats().get(0).getRxBytes());
296 Assert.assertEquals("Wrong txBytes",
297 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
298 message.getPortStats().get(0).getTxBytes());
299 Assert.assertEquals("Wrong rxDropped",
300 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
301 message.getPortStats().get(0).getRxDropped());
302 Assert.assertEquals("Wrong txDropped",
303 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
304 message.getPortStats().get(0).getTxDropped());
305 Assert.assertEquals("Wrong rxErrors",
306 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
307 message.getPortStats().get(0).getRxErrors());
308 Assert.assertEquals("Wrong txErrors",
309 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
310 message.getPortStats().get(0).getTxErrors());
311 Assert.assertEquals("Wrong rxFrameErr",
312 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
313 message.getPortStats().get(0).getRxFrameErr());
314 Assert.assertEquals("Wrong rxOverErr",
315 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
316 message.getPortStats().get(0).getRxOverErr());
317 Assert.assertEquals("Wrong rxCrcErr",
318 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
319 message.getPortStats().get(0).getRxCrcErr());
320 Assert.assertEquals("Wrong collisions",
321 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
322 message.getPortStats().get(0).getCollisions());
323 Assert.assertEquals("Wrong durationSec", 2, message.getPortStats().get(0).getDurationSec().intValue());
324 Assert.assertEquals("Wrong durationNsec", 4, message.getPortStats().get(0).getDurationNsec().intValue());
328 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
331 public void testMultipartReplyQueueBody(){
332 ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 "+
333 "00 00 00 FF "+//portNo
334 "00 00 00 10 "+//queueId
335 "00 02 03 02 03 02 03 02 "+//txBytes
336 "00 02 02 02 02 02 02 02 "+//txPackets
337 "00 02 03 02 03 02 03 02 "+//txErrors
338 "00 00 00 02 "+//durationSec
339 "00 00 00 04"//durationNsec
342 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
344 BufferHelper.checkHeaderV13(builtByFactory);
345 Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());
346 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
348 MultipartReplyQueue message = (MultipartReplyQueue) builtByFactory.getMultipartReplyBody();
350 Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
351 Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
352 Assert.assertEquals("Wrong txBytes",
353 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
354 message.getQueueStats().get(0).getTxBytes());
355 Assert.assertEquals("Wrong txPackets",
356 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
357 message.getQueueStats().get(0).getTxPackets());
358 Assert.assertEquals("Wrong txErrors",
359 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
360 message.getQueueStats().get(0).getTxErrors());
361 Assert.assertEquals("Wrong durationSec", 2, message.getQueueStats().get(0).getDurationSec().intValue());
362 Assert.assertEquals("Wrong durationNsec", 4, message.getQueueStats().get(0).getDurationNsec().intValue());
366 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
369 public void testMultipartReplyGroupBody(){
370 ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 "+
373 "00 00 00 10 "+//groupId
374 "00 00 00 12 "+//refCount
375 "00 00 00 00 "+//pad2
376 "00 01 01 01 01 01 01 01 "+//packetCount
377 "00 01 01 01 01 01 01 01 "+//byteCount
378 "00 00 00 08 "+//durationSec
379 "00 00 00 09 "+//durationNsec
380 "00 01 01 01 01 01 01 01 "+//packetCountBucket
381 "00 01 01 01 01 01 01 01 "+//byteCountBucket
382 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2
383 "00 02 02 02 02 02 02 02 "+//byteCountBucket_2
386 "00 00 00 10 "+//groupId_2
387 "00 00 00 12 "+//refCount_2
388 "00 00 00 00 "+//pad2.2
389 "00 01 01 01 01 01 01 01 "+//packetCount_2
390 "00 01 01 01 01 01 01 01 "+//byteCount_2
391 "00 00 00 08 "+//durationSec_2
392 "00 00 00 09 "+//durationNsec_2
393 "00 01 01 01 01 01 01 01 "+//packetCountBucket_1.2
394 "00 01 01 01 01 01 01 01 "+//byteCountBucket_1.2
395 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2.2
396 "00 02 02 02 02 02 02 02"//byteCountBucket_2.2
399 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
401 BufferHelper.checkHeaderV13(builtByFactory);
402 Assert.assertEquals("Wrong type", 0x06, builtByFactory.getType().getIntValue());
403 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
405 MultipartReplyGroup message = (MultipartReplyGroup) builtByFactory.getMultipartReplyBody();
407 Assert.assertEquals("Wrong groupId", 16, message.getGroupStats().get(0).getGroupId().getValue().intValue());
408 Assert.assertEquals("Wrong refCount", 18, message.getGroupStats().get(0).getRefCount().intValue());
409 Assert.assertEquals("Wrong packetCount",
410 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
411 message.getGroupStats().get(0).getPacketCount());
412 Assert.assertEquals("Wrong byteCount",
413 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
414 message.getGroupStats().get(0).getByteCount());
415 Assert.assertEquals("Wrong durationSec", 8, message.getGroupStats().get(0).getDurationSec().intValue());
416 Assert.assertEquals("Wrong durationNsec", 9, message.getGroupStats().get(0).getDurationNsec().intValue());
417 Assert.assertEquals("Wrong packetCountBucket",
418 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
419 message.getGroupStats().get(0).getBucketStats().get(0).getPacketCount());
420 Assert.assertEquals("Wrong byteCountBucket",
421 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
422 message.getGroupStats().get(0).getBucketStats().get(0).getByteCount());
423 Assert.assertEquals("Wrong packetCountBucket_2",
424 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
425 message.getGroupStats().get(0).getBucketStats().get(1).getPacketCount());
426 Assert.assertEquals("Wrong byteCountBucket_2",
427 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
428 message.getGroupStats().get(0).getBucketStats().get(1).getByteCount());
430 Assert.assertEquals("Wrong groupId_2", 16, message.getGroupStats().get(1).getGroupId().getValue().intValue());
431 Assert.assertEquals("Wrong refCount_2", 18, message.getGroupStats().get(1).getRefCount().intValue());
432 Assert.assertEquals("Wrong packetCount_2",
433 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
434 message.getGroupStats().get(1).getPacketCount());
435 Assert.assertEquals("Wrong byteCount_2",
436 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
437 message.getGroupStats().get(1).getByteCount());
438 Assert.assertEquals("Wrong durationSec_2", 8, message.getGroupStats().get(1).getDurationSec().intValue());
439 Assert.assertEquals("Wrong durationNsec_2", 9, message.getGroupStats().get(1).getDurationNsec().intValue());
440 Assert.assertEquals("Wrong packetCountBucket_1.2",
441 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
442 message.getGroupStats().get(1).getBucketStats().get(0).getPacketCount());
443 Assert.assertEquals("Wrong byteCountBucket_1.2",
444 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
445 message.getGroupStats().get(1).getBucketStats().get(0).getByteCount());
446 Assert.assertEquals("Wrong packetCountBucket_2.2",
447 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
448 message.getGroupStats().get(1).getBucketStats().get(1).getPacketCount());
449 Assert.assertEquals("Wrong byteCountBucket_2.2",
450 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
451 message.getGroupStats().get(1).getBucketStats().get(1).getByteCount());
455 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
458 public void testMultipartReplyMeterFeaturesBody(){
459 ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
460 "00 00 00 09 "+//maxMeter
461 "00 00 00 01 "+//bandTypes
462 "00 00 00 03 "+//capabilities
468 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
470 BufferHelper.checkHeaderV13(builtByFactory);
471 Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
472 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
474 MultipartReplyMeterFeatures message = (MultipartReplyMeterFeatures) builtByFactory.getMultipartReplyBody();
476 Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());
477 Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(true, false), message.getBandTypes());
478 Assert.assertEquals("Wrong capabilities", new MeterFlags(false, true, true, false),
479 message.getCapabilities());
480 Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());
481 Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());
485 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
488 public void testMultipartReplyMeterBody(){
489 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
490 "00 00 00 09 "+//meterId
492 "00 00 00 00 00 00 "+//pad
493 "00 00 00 07 "+//flowCount
494 "00 01 01 01 01 01 01 01 "+//packetInCount
495 "00 01 01 01 01 01 01 01 "+//byteInCount
496 "00 00 00 05 "+//durationSec
497 "00 00 00 05 "+//durationNsec
498 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
499 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
500 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
501 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
502 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
503 "00 03 03 03 03 03 03 03"//byteBandCount_03
506 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
508 BufferHelper.checkHeaderV13(builtByFactory);
509 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
510 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
512 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
514 Assert.assertEquals("Wrong meterId", 9,
515 message.getMeterStats().get(0).getMeterId().getValue().intValue());
516 Assert.assertEquals("Wrong flowCount", 7,
517 message.getMeterStats().get(0).getFlowCount().intValue());
518 Assert.assertEquals("Wrong packetInCount",
519 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
520 message.getMeterStats().get(0).getPacketInCount());
521 Assert.assertEquals("Wrong byteInCount",
522 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
523 message.getMeterStats().get(0).getByteInCount());
524 Assert.assertEquals("Wrong durationSec", 5,
525 message.getMeterStats().get(0).getDurationSec().intValue());
526 Assert.assertEquals("Wrong durationNsec", 5,
527 message.getMeterStats().get(0).getDurationNsec().intValue());
528 Assert.assertEquals("Wrong packetBandCount_01",
529 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
530 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
531 Assert.assertEquals("Wrong byteBandCount_01",
532 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
533 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
534 Assert.assertEquals("Wrong packetBandCount_02",
535 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
536 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
537 Assert.assertEquals("Wrong byteBandCount_02",
538 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
539 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
540 Assert.assertEquals("Wrong packetBandCount_03",
541 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
542 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
543 Assert.assertEquals("Wrong byteBandCount_03",
544 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
545 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
549 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
552 public void testMultipartReplyMeterBodyMulti(){
553 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
554 "00 00 00 09 "+//meterId_0
556 "00 00 00 00 00 00 "+//pad_0
557 "00 00 00 07 "+//flowCount_0
558 "00 01 01 01 01 01 01 01 "+//packetInCount_0
559 "00 01 01 01 01 01 01 01 "+//byteInCount_0
560 "00 00 00 05 "+//durationSec_0
561 "00 00 00 05 "+//durationNsec_0
562 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
563 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
564 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
565 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
566 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
567 "00 03 03 03 03 03 03 03 "+//byteBandCount_03
568 "00 00 00 08 "+//meterId_1
570 "00 00 00 00 00 00 "+//pad_1
571 "00 00 00 07 "+//flowCount_1
572 "00 01 01 01 01 01 01 01 "+//packetInCount_1
573 "00 01 01 01 01 01 01 01 "+//byteInCount_1
574 "00 00 00 05 "+//durationSec_1
575 "00 00 00 05 "+//durationNsec_1
576 "00 01 01 01 01 01 01 01 "+//packetBandCount_11
577 "00 01 01 01 01 01 01 01 "+//byteBandCount_11
578 "00 02 02 02 02 02 02 02 "+//packetBandCount_12
579 "00 02 02 02 02 02 02 02 "+//byteBandCount_12
580 "00 03 03 03 03 03 03 03 "+//packetBandCount_13
581 "00 03 03 03 03 03 03 03"//byteBandCount_13
584 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
586 BufferHelper.checkHeaderV13(builtByFactory);
587 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
588 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
590 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
592 Assert.assertEquals("Wrong meterId", 9,
593 message.getMeterStats().get(0).getMeterId().getValue().intValue());
594 Assert.assertEquals("Wrong flowCount", 7,
595 message.getMeterStats().get(0).getFlowCount().intValue());
596 Assert.assertEquals("Wrong packetInCount",
597 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
598 message.getMeterStats().get(0).getPacketInCount());
599 Assert.assertEquals("Wrong byteInCount",
600 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
601 message.getMeterStats().get(0).getByteInCount());
602 Assert.assertEquals("Wrong durationSec", 5,
603 message.getMeterStats().get(0).getDurationSec().intValue());
604 Assert.assertEquals("Wrong durationNsec", 5,
605 message.getMeterStats().get(0).getDurationNsec().intValue());
606 Assert.assertEquals("Wrong packetBandCount_01",
607 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
608 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
609 Assert.assertEquals("Wrong byteBandCount_01",
610 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
611 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
612 Assert.assertEquals("Wrong packetBandCount_02",
613 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
614 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
615 Assert.assertEquals("Wrong byteBandCount_02",
616 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
617 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
618 Assert.assertEquals("Wrong packetBandCount_03",
619 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
620 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
621 Assert.assertEquals("Wrong byteBandCount_03",
622 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
623 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
625 Assert.assertEquals("Wrong meterId", 8,
626 message.getMeterStats().get(1).getMeterId().getValue().intValue());
627 Assert.assertEquals("Wrong flowCount", 7,
628 message.getMeterStats().get(1).getFlowCount().intValue());
629 Assert.assertEquals("Wrong packetInCount",
630 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
631 message.getMeterStats().get(1).getPacketInCount());
632 Assert.assertEquals("Wrong byteInCount",
633 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
634 message.getMeterStats().get(1).getByteInCount());
635 Assert.assertEquals("Wrong durationSec", 5,
636 message.getMeterStats().get(1).getDurationSec().intValue());
637 Assert.assertEquals("Wrong durationNsec", 5,
638 message.getMeterStats().get(1).getDurationNsec().intValue());
639 Assert.assertEquals("Wrong packetBandCount_01",
640 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
641 message.getMeterStats().get(1).getMeterBandStats().get(0).getPacketBandCount());
642 Assert.assertEquals("Wrong byteBandCount_01",
643 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
644 message.getMeterStats().get(1).getMeterBandStats().get(0).getByteBandCount());
645 Assert.assertEquals("Wrong packetBandCount_02",
646 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
647 message.getMeterStats().get(1).getMeterBandStats().get(1).getPacketBandCount());
648 Assert.assertEquals("Wrong byteBandCount_02",
649 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
650 message.getMeterStats().get(1).getMeterBandStats().get(1).getByteBandCount());
651 Assert.assertEquals("Wrong packetBandCount_03",
652 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
653 message.getMeterStats().get(1).getMeterBandStats().get(2).getPacketBandCount());
654 Assert.assertEquals("Wrong byteBandCount_03",
655 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
656 message.getMeterStats().get(1).getMeterBandStats().get(2).getByteBandCount());
660 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
663 public void testMultipartReplyMeterConfigBody(){
664 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
667 "00 00 00 09 "+//meterId
668 "00 01 "+//meterBandDrop.type
669 "00 10 "+//meterBandDrop.len
670 "00 00 00 11 "+//meterBandDrop.rate
671 "00 00 00 20 "+//meterBandDrop.burstSize
672 "00 00 00 00 "+//meterBandDrop.pad
673 "00 02 "+//meterBandDscp.type
674 "00 10 "+//meterBandDscp.len
675 "00 00 00 11 "+//meterBandDscp.rate
676 "00 00 00 20 "+//meterBandDscp.burstSize
677 "04 "+//meterBandDscp.precLevel
678 "00 00 00 "+//meterBandDscp.pad
679 "FF FF "+//meterBandExperimenter.type
680 "00 10 "+//meterBandExperimenter.len
681 "00 00 00 11 "+//meterBandExperimenter.rate
682 "00 00 00 20 "+//meterBandExperimenter.burstSize
683 "00 00 00 04"//meterBandExperimenter.experimenter
686 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
688 BufferHelper.checkHeaderV13(builtByFactory);
689 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
690 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
692 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
694 Assert.assertEquals("Wrong flags", new MeterFlags(false, false, true, true),
695 message.getMeterConfig().get(0).getFlags());
696 Assert.assertEquals("Wrong meterId", 9,
697 message.getMeterConfig().get(0).getMeterId().getValue().intValue());
699 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
700 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
701 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
702 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
704 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
705 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
706 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
707 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
708 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
710 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
711 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
712 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
713 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
714 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
718 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
721 public void testMultipartReplyMeterConfigBodyMulti(){
722 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
725 "00 00 00 09 "+//meterId
726 "00 01 "+//meterBandDrop.type
727 "00 10 "+//meterBandDrop.len
728 "00 00 00 11 "+//meterBandDrop.rate
729 "00 00 00 20 "+//meterBandDrop.burstSize
730 "00 00 00 00 "+//meterBandDrop.pad
731 "00 02 "+//meterBandDscp.type
732 "00 10 "+//meterBandDscp.len
733 "00 00 00 11 "+//meterBandDscp.rate
734 "00 00 00 20 "+//meterBandDscp.burstSize
735 "04 "+//meterBandDscp.precLevel
736 "00 00 00 "+//meterBandDscp.pad
737 "FF FF "+//meterBandExperimenter.type
738 "00 10 "+//meterBandExperimenter.len
739 "00 00 00 11 "+//meterBandExperimenter.rate
740 "00 00 00 20 "+//meterBandExperimenter.burstSize
741 "00 00 00 04 "+//meterBandExperimenter.experimenter
745 "00 00 00 07 "+//meterId01
746 "00 02 "+//meterBandDscp01.type
747 "00 10 "+//meterBandDscp01.len
748 "00 00 00 11 "+//meterBandDscp01.rate
749 "00 00 00 20 "+//meterBandDscp01.burstSize
750 "04 "+//meterBandDscp01.precLevel
751 "00 00 00"//meterBandDscp01.pad
754 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
756 BufferHelper.checkHeaderV13(builtByFactory);
757 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
758 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
760 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
762 Assert.assertEquals("Wrong flags", new MeterFlags(true, false, true, false),
763 message.getMeterConfig().get(0).getFlags());
764 Assert.assertEquals("Wrong meterId", 9,
765 message.getMeterConfig().get(0).getMeterId().getValue().intValue());
767 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
768 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
769 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
770 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
772 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
773 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
774 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
775 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
776 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
778 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
779 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
780 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
781 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
782 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
784 LOGGER.info(message.getMeterConfig().get(0).getFlags().toString());
785 Assert.assertEquals("Wrong flags01", new MeterFlags(false, true, true, false),
786 message.getMeterConfig().get(1).getFlags());
787 Assert.assertEquals("Wrong meterId01", 7,
788 message.getMeterConfig().get(1).getMeterId().getValue().intValue());
790 MeterBandDscpRemark meterBandDscp01 = (MeterBandDscpRemark) message.getMeterConfig().get(1).getBands().get(0).getMeterBand();
791 Assert.assertEquals("Wrong meterBandDscp01.type", 2, meterBandDscp01.getType().getIntValue());
792 Assert.assertEquals("Wrong meterBandDscp01.rate", 17, meterBandDscp01.getRate().intValue());
793 Assert.assertEquals("Wrong meterBandDscp01.burstSize", 32, meterBandDscp01.getBurstSize().intValue());
794 Assert.assertEquals("Wrong meterBandDscp01.precLevel", 4, meterBandDscp01.getPrecLevel().intValue());
799 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
802 public void testMultipartReplyExperimenterBody(){
803 ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "+
804 "00 00 00 0F "+//experimenterId
805 "00 00 00 FF "+//expType
806 "00 00 01 01 00 00 01 01"
809 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
811 BufferHelper.checkHeaderV13(builtByFactory);
812 Assert.assertEquals("Wrong type", 0xFFFF, builtByFactory.getType().getIntValue());
813 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
815 MultipartReplyExperimenter message = (MultipartReplyExperimenter) builtByFactory.getMultipartReplyBody();
817 Assert.assertEquals("Wrong experimenterId", 15, message.getExperimenter().intValue());
818 Assert.assertEquals("Wrong expType", 255, message.getExpType().intValue());
819 Assert.assertArrayEquals("Wrong data", new byte[]{0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01},
824 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
827 public void testMultipartReplyPortDescBody(){
828 final byte MAX_PORT_NAME_LEN = 16;
829 ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 01 00 00 00 00 "+
830 "00 01 02 03 "+ //portNo
831 "00 00 00 00 "+ //padding01
832 "08 00 27 00 B0 EB " + //mac address
833 "00 00 "); //padding02
835 String portName = "SampleText";
836 byte[] portNameBytes = new byte[MAX_PORT_NAME_LEN];
837 portNameBytes = portName.getBytes();
838 bb.writeBytes(portNameBytes);
839 ByteBufUtils.padBuffer((MAX_PORT_NAME_LEN - portNameBytes.length), bb);
841 ByteBuf bb2 = BufferHelper.buildBuffer("00 00 00 41 " + //port config
842 "00 00 00 05 " + //port state
843 "00 00 00 81 " + //current features
844 "00 00 00 81 " + //advertised features
845 "00 00 00 81 " + //supported features
846 "00 00 00 81 " + //peer features
847 "00 00 00 81 " + //curr speed
848 "00 00 00 80" //max speed
850 bb.writeBytes(bb2.copy(4, bb2.readableBytes()-4));//excluding version and xid
852 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
854 BufferHelper.checkHeaderV13(builtByFactory);
855 Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
856 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
858 MultipartReplyPortDesc message = (MultipartReplyPortDesc) builtByFactory.getMultipartReplyBody();
860 Assert.assertEquals("Wrong portNo", 66051L, message.getPorts().get(0).getPortNo().longValue());
861 Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"),
862 message.getPorts().get(0).getHwAddr());
863 Assert.assertEquals("Wrong portName", "SampleText",
864 message.getPorts().get(0).getName());
865 Assert.assertEquals("Wrong portConfig", new PortConfig(false, true, false, true),
866 message.getPorts().get(0).getConfig());
867 Assert.assertEquals("Wrong portState", new PortState(false, true, true),
868 message.getPorts().get(0).getState());
869 Assert.assertEquals("Wrong currentFeatures", new PortFeatures(true, false, false, false,
870 false, false, false, true,
871 false, false, false, false,
872 false, false, false, false),
873 message.getPorts().get(0).getCurrentFeatures());
874 Assert.assertEquals("Wrong advertisedFeatures",
875 new PortFeatures(true, false, false, false,
876 false, false, false, true,
877 false, false, false, false,
878 false, false, false, false),
879 message.getPorts().get(0).getAdvertisedFeatures());
880 Assert.assertEquals("Wrong supportedFeatures",
881 new PortFeatures(true, false, false, false,
882 false, false, false, true,
883 false, false, false, false,
884 false, false, false, false),
885 message.getPorts().get(0).getSupportedFeatures());
886 Assert.assertEquals("Wrong peerFeatures",
887 new PortFeatures(true, false, false, false,
888 false, false, false, true,
889 false, false, false, false,
890 false, false, false, false),
891 message.getPorts().get(0).getPeerFeatures());
892 Assert.assertEquals("Wrong currSpeed", 129L, message.getPorts().get(0).getCurrSpeed().longValue());
893 Assert.assertEquals("Wrong maxSpeed", 128L, message.getPorts().get(0).getMaxSpeed().longValue());
897 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
898 * Test covers bodies of actions Output, Copy TTL Out, Copy TTL In
901 public void testMultipartReplyGroupDescBody01(){
902 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
906 "00 00 00 08 "+//groupId
908 "00 06 "+//bucketWeight
909 "00 00 00 05 "+//bucketWatchPort
910 "00 00 00 04 "+//bucketWatchGroup
911 "00 00 00 00 "+//bucketPad
912 "00 00 "+//outputType
914 "00 00 10 FF "+//outputPort
915 "FF FF "+//outputMaxLen
916 "00 00 00 00 00 00 "+//outputPad
917 "00 0B "+//copyTTLOutType
918 "00 08 "+//copyTTLOutLen
919 "00 00 00 00 "+//copyTTLOutPad
920 "00 0C "+//copyTTLIntType
921 "00 08 "+//copyTTLIntLen
922 "00 00 00 00"//copyTTLInPad
924 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
926 BufferHelper.checkHeaderV13(builtByFactory);
927 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
928 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
930 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
932 Assert.assertEquals("Wrong type", 1,
933 message.getGroupDesc().get(0).getType().getIntValue());
934 Assert.assertEquals("Wrong groupId", 8,
935 message.getGroupDesc().get(0).getGroupId().getValue().intValue());
936 Assert.assertEquals("Wrong bucketWeight", 6,
937 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
938 Assert.assertEquals("Wrong bucketWatchPort", 5,
939 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
940 getValue().intValue());
941 Assert.assertEquals("Wrong bucketWatchGroup", 4,
942 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
944 Assert.assertEquals("Wrong outputType", Output.class,
945 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
946 getAction().getType());
948 Assert.assertEquals("Wrong outputPort", 4351,
949 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
950 getAction().getAugmentation(PortAction.class).
951 getPort().getValue().intValue());
953 Assert.assertEquals("Wrong outputMaxLen", 65535,
954 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
955 getAction().getAugmentation(MaxLengthAction.class).
956 getMaxLength().intValue());
958 Assert.assertEquals("Wrong copyTtlOutType", CopyTtlOut.class,
959 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
960 getAction().getType());
962 Assert.assertEquals("Wrong copyTtlInType", CopyTtlIn.class,
963 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
964 getAction().getType());
968 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
969 * Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB
972 public void testMultipartReplyGroupDescBody02(){
973 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
977 "00 00 00 08 "+//groupId
979 "00 06 "+//bucketWeight
980 "00 00 00 05 "+//bucketWatchPort
981 "00 00 00 04 "+//bucketWatchGroup
982 "00 00 00 00 "+//bucketPad
983 "00 0F "+//setMplsTtlType
984 "00 08 "+//setMplsTtlLen
985 "09 "+//setMplsTtlMPLS_TTL
986 "00 00 00 "+//setMplsTtlPad
987 "00 10 "+//decMplsTtlType
988 "00 08 "+//decMplsTtlLen
989 "00 00 00 00 "+//decMplsTtlPad
990 "00 11 "+//pushVlanType
991 "00 08 "+//pushVlanLen
992 "00 20 "+//pushVlanEthertype
993 "00 00 "+//pushVlanPad
994 "00 13 "+//pushMplsType
995 "00 08 "+//pushMplsLen
996 "00 FF "+//pushMplsEthertype
997 "00 00 "+//pushMplsPad
998 "00 1A "+//pushPbbType
999 "00 08 "+//pushPbbLen
1000 "0F FF "+//pushPbbEthertype
1004 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
1006 BufferHelper.checkHeaderV13(builtByFactory);
1007 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
1008 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
1010 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
1012 Assert.assertEquals("Wrong type", 1,
1013 message.getGroupDesc().get(0).getType().getIntValue());
1014 Assert.assertEquals("Wrong groupId", 8,
1015 message.getGroupDesc().get(0).getGroupId().getValue().intValue());
1016 Assert.assertEquals("Wrong bucketWeight", 6,
1017 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
1018 Assert.assertEquals("Wrong bucketWatchPort", 5,
1019 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
1020 getValue().intValue());
1021 Assert.assertEquals("Wrong bucketWatchGroup", 4,
1022 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
1025 Assert.assertEquals("Wrong setMplsTtlType", SetMplsTtl.class,
1026 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
1027 getAction().getType());
1029 Assert.assertEquals("Wrong setMplsTtlMPLS_TTL", 9,
1030 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
1031 getAction().getAugmentation(MplsTtlAction.class).
1032 getMplsTtl().intValue());
1034 Assert.assertEquals("Wrong decMplsTtlType", DecMplsTtl.class,
1035 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
1036 getAction().getType());
1038 Assert.assertEquals("Wrong pushVlanType", PushVlan.class,
1039 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
1040 getAction().getType());
1042 Assert.assertEquals("Wrong pushVlanEthertype", 32,
1043 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
1044 getAction().getAugmentation(EthertypeAction.class).
1045 getEthertype().getValue().intValue());
1047 Assert.assertEquals("Wrong pushMplsType", PushMpls.class,
1048 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
1049 getAction().getType());
1051 Assert.assertEquals("Wrong pushMplsEthertype", 255,
1052 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
1053 getAction().getAugmentation(EthertypeAction.class).
1054 getEthertype().getValue().intValue());
1056 Assert.assertEquals("Wrong pushPbbType", PushPbb.class,
1057 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
1058 getAction().getType());
1060 Assert.assertEquals("Wrong pushPbbEthertype", 4095,
1061 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
1062 getAction().getAugmentation(EthertypeAction.class).
1063 getEthertype().getValue().intValue());
1068 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
1069 * Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL
1072 public void testMultipartReplyGroupDescBody03(){
1073 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
1077 "00 00 00 08 "+//groupId
1078 "00 40 "+//bucketLen
1079 "00 06 "+//bucketWeight
1080 "00 00 00 05 "+//bucketWatchPort
1081 "00 00 00 04 "+//bucketWatchGroup
1082 "00 00 00 00 "+//bucketPad
1083 "00 12 "+//popVlanType
1084 "00 08 "+//popVlanLen
1085 "00 00 00 00 "+//popVlanPad
1086 "00 1B "+//popPbbType
1087 "00 08 "+//popPbbLen
1088 "00 00 00 00 "+//popPbbPad
1089 "00 14 "+//popMplsType
1090 "00 08 "+//popMplsLen
1091 "00 CF "+//popMplsEthertype
1092 "00 00 "+//popMplsPad
1093 "00 15 "+//setQueueType
1094 "00 08 "+//setQueueLen
1095 "00 CF 00 00 "+//setQueueQueueId
1096 "00 16 "+//groupType
1098 "00 CF 00 00 "+//groupGroupId
1099 "00 18 "+//decNwTtlType
1100 "00 08 "+//decNwTtlLen
1101 "00 00 00 00"//decNwTtlPad
1104 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
1106 BufferHelper.checkHeaderV13(builtByFactory);
1107 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
1108 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
1110 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
1112 Assert.assertEquals("Wrong type", 1,
1113 message.getGroupDesc().get(0).getType().getIntValue());
1114 Assert.assertEquals("Wrong groupId", 8,
1115 message.getGroupDesc().get(0).getGroupId().getValue().intValue());
1116 Assert.assertEquals("Wrong bucketWeight", 6,
1117 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
1118 Assert.assertEquals("Wrong bucketWatchPort", 5,
1119 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
1120 getValue().intValue());
1121 Assert.assertEquals("Wrong bucketWatchGroup", 4,
1122 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
1124 Assert.assertEquals("Wrong popVlanType", PopVlan.class,
1125 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
1126 getAction().getType());
1128 Assert.assertEquals("Wrong popPbbType", PopPbb.class,
1129 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
1130 getAction().getType());
1132 Assert.assertEquals("Wrong popMplsType", PopMpls.class,
1133 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
1134 getAction().getType());
1136 Assert.assertEquals("Wrong popMplsEthertype", 207,
1137 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
1138 getAction().getAugmentation(EthertypeAction.class).
1139 getEthertype().getValue().intValue());
1141 Assert.assertEquals("Wrong setQueueType", SetQueue.class,
1142 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
1143 getAction().getType());
1145 Assert.assertEquals("Wrong setQueueQueueId", 13565952,
1146 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
1147 getAction().getAugmentation(QueueIdAction.class).
1148 getQueueId().intValue());
1150 Assert.assertEquals("Wrong groupType", Group.class,
1151 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
1152 getAction().getType());
1154 Assert.assertEquals("Wrong groupGroupId", 13565952,
1155 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
1156 getAction().getAugmentation(GroupIdAction.class).
1157 getGroupId().intValue());
1159 Assert.assertEquals("Wrong decNwTtlType", DecNwTtl.class,
1160 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(5).
1161 getAction().getType());
1165 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
1166 * Test covers bodies of actions NW TTL, Experimenter
1169 public void testMultipartReplyGroupDescBody04(){
1170 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
1174 "00 00 00 08 "+//groupId
1175 "00 28 "+//bucketLen
1176 "00 06 "+//bucketWeight
1177 "00 00 00 05 "+//bucketWatchPort
1178 "00 00 00 04 "+//bucketWatchGroup
1179 "00 00 00 00 "+//bucketPad
1180 "00 17 "+//nwTTlType
1183 "00 00 00 "+//nwTTlPad
1184 "00 19 "+//setFieldType
1185 "00 10 "+//setFieldLen
1186 "80 00 "+//setFieldOXMClass
1187 "00 "+//setFieldOXMField
1188 "04 "+//setFieldOXMLength
1189 "00 00 00 FF "+ //setFieldPort
1193 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
1195 BufferHelper.checkHeaderV13(builtByFactory);
1196 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
1197 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
1199 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
1201 Assert.assertEquals("Wrong type", 1,
1202 message.getGroupDesc().get(0).getType().getIntValue());
1203 Assert.assertEquals("Wrong groupId", 8,
1204 message.getGroupDesc().get(0).getGroupId().getValue().intValue());
1205 Assert.assertEquals("Wrong bucketWeight", 6,
1206 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
1207 Assert.assertEquals("Wrong bucketWatchPort", 5,
1208 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
1209 getValue().intValue());
1210 Assert.assertEquals("Wrong bucketWatchGroup", 4,
1211 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
1213 Assert.assertEquals("Wrong nwTTlType", SetNwTtl.class,
1214 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
1215 getAction().getType());
1217 Assert.assertEquals("Wrong nwTTlnwTTL", 14,
1218 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
1219 getAction().getAugmentation(NwTtlAction.class).getNwTtl().intValue());
1221 Assert.assertEquals("Wrong setFieldType", SetField.class,
1222 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
1223 getAction().getType());
1225 Assert.assertEquals("Wrong setFieldOXMClass", OpenflowBasicClass.class,
1226 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
1227 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmClass());
1229 Assert.assertEquals("Wrong setFieldOXMField", InPort.class,
1230 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
1231 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmMatchField());
1233 Assert.assertEquals("Wrong setFieldOXMValue", 255,
1234 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
1235 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).
1236 getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());