1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
\r
4 import io.netty.buffer.ByteBuf;
\r
6 import java.math.BigInteger;
\r
8 import org.junit.Assert;
\r
9 import org.junit.Test;
\r
10 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
11 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
\r
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
\r
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
\r
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
\r
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
\r
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
\r
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
\r
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
\r
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
\r
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
\r
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
\r
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
\r
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
\r
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
\r
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
\r
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
\r
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
\r
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
\r
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
\r
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
\r
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
\r
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
\r
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
\r
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
\r
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
\r
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
\r
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
\r
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
\r
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
\r
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDrop;
\r
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemark;
\r
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenter;
\r
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregate;
\r
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDesc;
\r
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenter;
\r
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlow;
\r
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroup;
\r
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc;
\r
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeter;
\r
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig;
\r
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeatures;
\r
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDesc;
\r
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStats;
\r
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueue;
\r
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTable;
\r
62 import org.slf4j.Logger;
\r
63 import org.slf4j.LoggerFactory;
\r
66 * @author timotej.kubas
\r
67 * @author michal.polkorab
\r
69 public class MultipartReplyMessageFactoryTest {
\r
71 private static final Logger LOGGER = LoggerFactory
\r
72 .getLogger(MultipartReplyMessageFactoryTest.class);
\r
75 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
79 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 01 02 03 04");
\r
80 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
82 BufferHelper.checkHeaderV13(builtByFactory);
\r
84 Assert.assertEquals("Wrong type", 0x07, builtByFactory.getType().getIntValue());
\r
85 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
86 //Assert.assertArrayEquals("Wrong body", new byte[]{0x01, 0x02, 0x03, 0x04}, builtByFactory.getBody());
\r
90 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
93 public void testMultipartReplyDescBody(){
\r
94 final int DESC_STR_LEN = 256;
\r
95 final int SERIAL_NUM_LEN = 32;
\r
96 ByteBuf bb = BufferHelper.buildBuffer("00 00 00 01 00 00 00 00");
\r
98 String mfrDesc = "Manufacturer description";
\r
99 byte[] mfrDescBytes = new byte[256];
\r
100 mfrDescBytes = mfrDesc.getBytes();
\r
101 bb.writeBytes(mfrDescBytes);
\r
102 ByteBufUtils.padBuffer((DESC_STR_LEN - mfrDescBytes.length), bb);
\r
104 String hwDesc = "Hardware description";
\r
105 byte[] hwDescBytes = new byte[256];
\r
106 hwDescBytes = hwDesc.getBytes();
\r
107 bb.writeBytes(hwDescBytes);
\r
108 ByteBufUtils.padBuffer((DESC_STR_LEN - hwDescBytes.length), bb);
\r
110 String swDesc = "Software description";
\r
111 byte[] swDescBytes = new byte[256];
\r
112 swDescBytes = swDesc.getBytes();
\r
113 bb.writeBytes(swDescBytes);
\r
114 ByteBufUtils.padBuffer((DESC_STR_LEN - swDescBytes.length), bb);
\r
116 String serialNum = "SN0123456789";
\r
117 byte[] serialNumBytes = new byte[32];
\r
118 serialNumBytes = serialNum.getBytes();
\r
119 bb.writeBytes(serialNumBytes);
\r
120 ByteBufUtils.padBuffer((SERIAL_NUM_LEN - serialNumBytes.length), bb);
\r
122 String dpDesc = "switch3 in room 3120";
\r
123 byte[] dpDescBytes = new byte[256];
\r
124 dpDescBytes = dpDesc.getBytes();
\r
125 bb.writeBytes(dpDescBytes);
\r
126 ByteBufUtils.padBuffer((DESC_STR_LEN - dpDescBytes.length), bb);
\r
128 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
130 BufferHelper.checkHeaderV13(builtByFactory);
\r
131 Assert.assertEquals("Wrong type", 0x00, builtByFactory.getType().getIntValue());
\r
132 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
133 MultipartReplyDesc message = (MultipartReplyDesc) builtByFactory.getMultipartReplyBody();
\r
134 Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());
\r
135 Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());
\r
136 Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());
\r
137 Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());
\r
138 Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());
\r
142 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
145 public void testMultipartReplyFlowBody(){
\r
146 ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+
\r
150 "00 00 00 09 "+//durationSec
\r
151 "00 00 00 07 "+//durationNsec
\r
152 "00 0C "+//priority
\r
153 "00 0E "+//idleTimeout
\r
154 "00 0F "+//hardTimeout
\r
156 "00 00 00 00 "+//pad_02
\r
157 "00 01 01 01 01 01 01 01 "+//cookie
\r
158 "00 01 01 01 01 01 01 01 "+//packetCount
\r
159 "00 01 01 01 01 01 01 01"//byteCount
\r
162 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
164 BufferHelper.checkHeaderV13(builtByFactory);
\r
165 Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
\r
166 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
167 MultipartReplyFlow message = (MultipartReplyFlow) builtByFactory.getMultipartReplyBody();
\r
168 Assert.assertEquals("Wrong tableId", 8, message.getFlowStats().get(0).getTableId().intValue());
\r
169 Assert.assertEquals("Wrong durationSec", 9, message.getFlowStats().get(0).getDurationSec().intValue());
\r
170 Assert.assertEquals("Wrong durationNsec", 7, message.getFlowStats().get(0).getDurationNsec().intValue());
\r
171 Assert.assertEquals("Wrong priority", 12, message.getFlowStats().get(0).getPriority().intValue());
\r
172 Assert.assertEquals("Wrong idleTimeOut", 14, message.getFlowStats().get(0).getIdleTimeout().intValue());
\r
173 Assert.assertEquals("Wrong hardTimeOut", 15, message.getFlowStats().get(0).getHardTimeout().intValue());
\r
174 Assert.assertEquals("Wrong flags", new FlowModFlags(true, false, true, false, true),
\r
175 message.getFlowStats().get(0).getFlags());
\r
176 Assert.assertEquals("Wrong cookie",
\r
177 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
178 message.getFlowStats().get(0).getCookie());
\r
179 Assert.assertEquals("Wrong packetCount",
\r
180 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
181 message.getFlowStats().get(0).getPacketCount());
\r
182 Assert.assertEquals("Wrong byteCount",
\r
183 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
184 message.getFlowStats().get(0).getByteCount());
\r
188 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
191 public void testMultipartReplyAggregateBody(){
\r
192 ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 "+
\r
193 "00 01 01 01 01 01 01 01 "+//packetCount
\r
194 "00 01 01 01 01 01 01 01 "+//byteCount
\r
195 "00 00 00 08 "+//flowCount
\r
199 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
201 BufferHelper.checkHeaderV13(builtByFactory);
\r
202 Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
\r
203 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
204 MultipartReplyAggregate message = (MultipartReplyAggregate) builtByFactory.getMultipartReplyBody();
\r
205 Assert.assertEquals("Wrong packetCount",
\r
206 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
207 message.getPacketCount());
\r
208 Assert.assertEquals("Wrong byteCount",
\r
209 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
210 message.getByteCount());
\r
211 Assert.assertEquals("Wrong flowCount",
\r
213 message.getFlowCount().intValue());
\r
217 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
220 public void testMultipartReplyTableBody(){
\r
221 ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 00 00 00 00 "+
\r
224 "00 00 00 10 "+//activeCount
\r
225 "00 01 01 01 01 01 01 01 "+//lookupCount
\r
226 "00 01 01 01 01 01 01 01"//matchedCount
\r
229 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
231 BufferHelper.checkHeaderV13(builtByFactory);
\r
232 Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
\r
233 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
235 MultipartReplyTable message = (MultipartReplyTable) builtByFactory.getMultipartReplyBody();
\r
236 Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
\r
237 Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
\r
238 Assert.assertEquals("Wrong lookupCount",
\r
239 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
240 message.getTableStats().get(0).getLookupCount());
\r
241 Assert.assertEquals("Wrong matchedCount",
\r
242 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
243 message.getTableStats().get(0).getMatchedCount());
\r
247 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
250 public void testMultipartReplyPortStatsBody(){
\r
251 ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 00 00 00 00 "+
\r
252 "00 00 00 FF "+//portNo
\r
253 "00 00 00 00 "+//pad
\r
254 "00 01 01 01 01 01 01 01 "+//rxPackets
\r
255 "00 02 02 02 02 02 02 02 "+//txPackets
\r
256 "00 02 03 02 03 02 03 02 "+//rxBytes
\r
257 "00 02 03 02 03 02 03 02 "+//txBytes
\r
258 "00 02 03 02 03 02 03 02 "+//rxDropped
\r
259 "00 02 03 02 03 02 03 02 "+//txDropped
\r
260 "00 02 03 02 03 02 03 02 "+//rxErrors
\r
261 "00 02 03 02 03 02 03 02 "+//txErrors
\r
262 "00 02 03 02 03 02 03 02 "+//rxFrameErr
\r
263 "00 02 03 02 03 02 03 02 "+//rxOverErr
\r
264 "00 02 03 02 03 02 03 02 "+//rxCrcErr
\r
265 "00 02 03 02 03 02 03 02 "+//collisions
\r
266 "00 00 00 02 "+//durationSec
\r
267 "00 00 00 04"//durationNsec
\r
270 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
272 BufferHelper.checkHeaderV13(builtByFactory);
\r
273 Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());
\r
274 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
276 MultipartReplyPortStats message = (MultipartReplyPortStats) builtByFactory.getMultipartReplyBody();
\r
278 Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());
\r
279 Assert.assertEquals("Wrong rxPackets",
\r
280 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
281 message.getPortStats().get(0).getRxPackets());
\r
282 Assert.assertEquals("Wrong txPackets",
\r
283 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
284 message.getPortStats().get(0).getTxPackets());
\r
285 Assert.assertEquals("Wrong rxBytes",
\r
286 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
287 message.getPortStats().get(0).getRxBytes());
\r
288 Assert.assertEquals("Wrong txBytes",
\r
289 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
290 message.getPortStats().get(0).getTxBytes());
\r
291 Assert.assertEquals("Wrong rxDropped",
\r
292 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
293 message.getPortStats().get(0).getRxDropped());
\r
294 Assert.assertEquals("Wrong txDropped",
\r
295 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
296 message.getPortStats().get(0).getTxDropped());
\r
297 Assert.assertEquals("Wrong rxErrors",
\r
298 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
299 message.getPortStats().get(0).getRxErrors());
\r
300 Assert.assertEquals("Wrong txErrors",
\r
301 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
302 message.getPortStats().get(0).getTxErrors());
\r
303 Assert.assertEquals("Wrong rxFrameErr",
\r
304 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
305 message.getPortStats().get(0).getRxFrameErr());
\r
306 Assert.assertEquals("Wrong rxOverErr",
\r
307 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
308 message.getPortStats().get(0).getRxOverErr());
\r
309 Assert.assertEquals("Wrong rxCrcErr",
\r
310 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
311 message.getPortStats().get(0).getRxCrcErr());
\r
312 Assert.assertEquals("Wrong collisions",
\r
313 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
314 message.getPortStats().get(0).getCollisions());
\r
315 Assert.assertEquals("Wrong durationSec", 2, message.getPortStats().get(0).getDurationSec().intValue());
\r
316 Assert.assertEquals("Wrong durationNsec", 4, message.getPortStats().get(0).getDurationNsec().intValue());
\r
320 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
323 public void testMultipartReplyQueueBody(){
\r
324 ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 "+
\r
325 "00 00 00 FF "+//portNo
\r
326 "00 00 00 10 "+//queueId
\r
327 "00 02 03 02 03 02 03 02 "+//txBytes
\r
328 "00 02 02 02 02 02 02 02 "+//txPackets
\r
329 "00 02 03 02 03 02 03 02 "+//txErrors
\r
330 "00 00 00 02 "+//durationSec
\r
331 "00 00 00 04"//durationNsec
\r
334 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
336 BufferHelper.checkHeaderV13(builtByFactory);
\r
337 Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());
\r
338 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
340 MultipartReplyQueue message = (MultipartReplyQueue) builtByFactory.getMultipartReplyBody();
\r
342 Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
\r
343 Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
\r
344 Assert.assertEquals("Wrong txBytes",
\r
345 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
346 message.getQueueStats().get(0).getTxBytes());
\r
347 Assert.assertEquals("Wrong txPackets",
\r
348 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
349 message.getQueueStats().get(0).getTxPackets());
\r
350 Assert.assertEquals("Wrong txErrors",
\r
351 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
352 message.getQueueStats().get(0).getTxErrors());
\r
353 Assert.assertEquals("Wrong durationSec", 2, message.getQueueStats().get(0).getDurationSec().intValue());
\r
354 Assert.assertEquals("Wrong durationNsec", 4, message.getQueueStats().get(0).getDurationNsec().intValue());
\r
358 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
361 public void testMultipartReplyGroupBody(){
\r
362 ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 "+
\r
365 "00 00 00 10 "+//groupId
\r
366 "00 00 00 12 "+//refCount
\r
367 "00 00 00 00 "+//pad2
\r
368 "00 01 01 01 01 01 01 01 "+//packetCount
\r
369 "00 01 01 01 01 01 01 01 "+//byteCount
\r
370 "00 00 00 08 "+//durationSec
\r
371 "00 00 00 09 "+//durationNsec
\r
372 "00 01 01 01 01 01 01 01 "+//packetCountBucket
\r
373 "00 01 01 01 01 01 01 01 "+//byteCountBucket
\r
374 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2
\r
375 "00 02 02 02 02 02 02 02 "+//byteCountBucket_2
\r
376 "00 48 "+//length_2
\r
378 "00 00 00 10 "+//groupId_2
\r
379 "00 00 00 12 "+//refCount_2
\r
380 "00 00 00 00 "+//pad2.2
\r
381 "00 01 01 01 01 01 01 01 "+//packetCount_2
\r
382 "00 01 01 01 01 01 01 01 "+//byteCount_2
\r
383 "00 00 00 08 "+//durationSec_2
\r
384 "00 00 00 09 "+//durationNsec_2
\r
385 "00 01 01 01 01 01 01 01 "+//packetCountBucket_1.2
\r
386 "00 01 01 01 01 01 01 01 "+//byteCountBucket_1.2
\r
387 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2.2
\r
388 "00 02 02 02 02 02 02 02"//byteCountBucket_2.2
\r
391 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
393 BufferHelper.checkHeaderV13(builtByFactory);
\r
394 Assert.assertEquals("Wrong type", 0x06, builtByFactory.getType().getIntValue());
\r
395 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
397 MultipartReplyGroup message = (MultipartReplyGroup) builtByFactory.getMultipartReplyBody();
\r
399 Assert.assertEquals("Wrong groupId", 16, message.getGroupStats().get(0).getGroupId().intValue());
\r
400 Assert.assertEquals("Wrong refCount", 18, message.getGroupStats().get(0).getRefCount().intValue());
\r
401 Assert.assertEquals("Wrong packetCount",
\r
402 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
403 message.getGroupStats().get(0).getPacketCount());
\r
404 Assert.assertEquals("Wrong byteCount",
\r
405 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
406 message.getGroupStats().get(0).getByteCount());
\r
407 Assert.assertEquals("Wrong durationSec", 8, message.getGroupStats().get(0).getDurationSec().intValue());
\r
408 Assert.assertEquals("Wrong durationNsec", 9, message.getGroupStats().get(0).getDurationNsec().intValue());
\r
409 Assert.assertEquals("Wrong packetCountBucket",
\r
410 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
411 message.getGroupStats().get(0).getBucketStats().get(0).getPacketCount());
\r
412 Assert.assertEquals("Wrong byteCountBucket",
\r
413 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
414 message.getGroupStats().get(0).getBucketStats().get(0).getByteCount());
\r
415 Assert.assertEquals("Wrong packetCountBucket_2",
\r
416 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
417 message.getGroupStats().get(0).getBucketStats().get(1).getPacketCount());
\r
418 Assert.assertEquals("Wrong byteCountBucket_2",
\r
419 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
420 message.getGroupStats().get(0).getBucketStats().get(1).getByteCount());
\r
422 Assert.assertEquals("Wrong groupId_2", 16, message.getGroupStats().get(1).getGroupId().intValue());
\r
423 Assert.assertEquals("Wrong refCount_2", 18, message.getGroupStats().get(1).getRefCount().intValue());
\r
424 Assert.assertEquals("Wrong packetCount_2",
\r
425 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
426 message.getGroupStats().get(1).getPacketCount());
\r
427 Assert.assertEquals("Wrong byteCount_2",
\r
428 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
429 message.getGroupStats().get(1).getByteCount());
\r
430 Assert.assertEquals("Wrong durationSec_2", 8, message.getGroupStats().get(1).getDurationSec().intValue());
\r
431 Assert.assertEquals("Wrong durationNsec_2", 9, message.getGroupStats().get(1).getDurationNsec().intValue());
\r
432 Assert.assertEquals("Wrong packetCountBucket_1.2",
\r
433 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
434 message.getGroupStats().get(1).getBucketStats().get(0).getPacketCount());
\r
435 Assert.assertEquals("Wrong byteCountBucket_1.2",
\r
436 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
437 message.getGroupStats().get(1).getBucketStats().get(0).getByteCount());
\r
438 Assert.assertEquals("Wrong packetCountBucket_2.2",
\r
439 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
440 message.getGroupStats().get(1).getBucketStats().get(1).getPacketCount());
\r
441 Assert.assertEquals("Wrong byteCountBucket_2.2",
\r
442 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
443 message.getGroupStats().get(1).getBucketStats().get(1).getByteCount());
\r
447 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
450 public void testMultipartReplyMeterFeaturesBody(){
\r
451 ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
\r
452 "00 00 00 09 "+//maxMeter
\r
453 "00 00 00 01 "+//bandTypes
\r
454 "00 00 00 03 "+//capabilities
\r
460 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
462 BufferHelper.checkHeaderV13(builtByFactory);
\r
463 Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
\r
464 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
466 MultipartReplyMeterFeatures message = (MultipartReplyMeterFeatures) builtByFactory.getMultipartReplyBody();
\r
468 Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());
\r
469 Assert.assertEquals("Wrong bandTypes", 1, message.getBandTypes().getIntValue());
\r
470 Assert.assertEquals("Wrong capabilities", new MeterFlags(false, true, true, false),
\r
471 message.getCapabilities());
\r
472 Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());
\r
473 Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());
\r
477 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
480 public void testMultipartReplyMeterBody(){
\r
481 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
\r
482 "00 00 00 09 "+//meterId
\r
484 "00 00 00 00 00 00 "+//pad
\r
485 "00 00 00 07 "+//flowCount
\r
486 "00 01 01 01 01 01 01 01 "+//packetInCount
\r
487 "00 01 01 01 01 01 01 01 "+//byteInCount
\r
488 "00 00 00 05 "+//durationSec
\r
489 "00 00 00 05 "+//durationNsec
\r
490 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
\r
491 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
\r
492 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
\r
493 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
\r
494 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
\r
495 "00 03 03 03 03 03 03 03"//byteBandCount_03
\r
498 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
500 BufferHelper.checkHeaderV13(builtByFactory);
\r
501 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
\r
502 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
504 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
\r
506 Assert.assertEquals("Wrong meterId", 9,
\r
507 message.getMeterStats().get(0).getMeterId().intValue());
\r
508 Assert.assertEquals("Wrong flowCount", 7,
\r
509 message.getMeterStats().get(0).getFlowCount().intValue());
\r
510 Assert.assertEquals("Wrong packetInCount",
\r
511 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
512 message.getMeterStats().get(0).getPacketInCount());
\r
513 Assert.assertEquals("Wrong byteInCount",
\r
514 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
515 message.getMeterStats().get(0).getByteInCount());
\r
516 Assert.assertEquals("Wrong durationSec", 5,
\r
517 message.getMeterStats().get(0).getDurationSec().intValue());
\r
518 Assert.assertEquals("Wrong durationNsec", 5,
\r
519 message.getMeterStats().get(0).getDurationNsec().intValue());
\r
520 Assert.assertEquals("Wrong packetBandCount_01",
\r
521 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
522 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
\r
523 Assert.assertEquals("Wrong byteBandCount_01",
\r
524 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
525 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
\r
526 Assert.assertEquals("Wrong packetBandCount_02",
\r
527 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
528 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
\r
529 Assert.assertEquals("Wrong byteBandCount_02",
\r
530 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
531 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
\r
532 Assert.assertEquals("Wrong packetBandCount_03",
\r
533 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
534 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
\r
535 Assert.assertEquals("Wrong byteBandCount_03",
\r
536 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
537 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
\r
541 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
544 public void testMultipartReplyMeterBodyMulti(){
\r
545 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
\r
546 "00 00 00 09 "+//meterId_0
\r
548 "00 00 00 00 00 00 "+//pad_0
\r
549 "00 00 00 07 "+//flowCount_0
\r
550 "00 01 01 01 01 01 01 01 "+//packetInCount_0
\r
551 "00 01 01 01 01 01 01 01 "+//byteInCount_0
\r
552 "00 00 00 05 "+//durationSec_0
\r
553 "00 00 00 05 "+//durationNsec_0
\r
554 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
\r
555 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
\r
556 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
\r
557 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
\r
558 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
\r
559 "00 03 03 03 03 03 03 03 "+//byteBandCount_03
\r
560 "00 00 00 08 "+//meterId_1
\r
562 "00 00 00 00 00 00 "+//pad_1
\r
563 "00 00 00 07 "+//flowCount_1
\r
564 "00 01 01 01 01 01 01 01 "+//packetInCount_1
\r
565 "00 01 01 01 01 01 01 01 "+//byteInCount_1
\r
566 "00 00 00 05 "+//durationSec_1
\r
567 "00 00 00 05 "+//durationNsec_1
\r
568 "00 01 01 01 01 01 01 01 "+//packetBandCount_11
\r
569 "00 01 01 01 01 01 01 01 "+//byteBandCount_11
\r
570 "00 02 02 02 02 02 02 02 "+//packetBandCount_12
\r
571 "00 02 02 02 02 02 02 02 "+//byteBandCount_12
\r
572 "00 03 03 03 03 03 03 03 "+//packetBandCount_13
\r
573 "00 03 03 03 03 03 03 03"//byteBandCount_13
\r
576 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
578 BufferHelper.checkHeaderV13(builtByFactory);
\r
579 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
\r
580 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
582 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
\r
584 Assert.assertEquals("Wrong meterId", 9,
\r
585 message.getMeterStats().get(0).getMeterId().intValue());
\r
586 Assert.assertEquals("Wrong flowCount", 7,
\r
587 message.getMeterStats().get(0).getFlowCount().intValue());
\r
588 Assert.assertEquals("Wrong packetInCount",
\r
589 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
590 message.getMeterStats().get(0).getPacketInCount());
\r
591 Assert.assertEquals("Wrong byteInCount",
\r
592 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
593 message.getMeterStats().get(0).getByteInCount());
\r
594 Assert.assertEquals("Wrong durationSec", 5,
\r
595 message.getMeterStats().get(0).getDurationSec().intValue());
\r
596 Assert.assertEquals("Wrong durationNsec", 5,
\r
597 message.getMeterStats().get(0).getDurationNsec().intValue());
\r
598 Assert.assertEquals("Wrong packetBandCount_01",
\r
599 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
600 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
\r
601 Assert.assertEquals("Wrong byteBandCount_01",
\r
602 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
603 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
\r
604 Assert.assertEquals("Wrong packetBandCount_02",
\r
605 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
606 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
\r
607 Assert.assertEquals("Wrong byteBandCount_02",
\r
608 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
609 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
\r
610 Assert.assertEquals("Wrong packetBandCount_03",
\r
611 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
612 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
\r
613 Assert.assertEquals("Wrong byteBandCount_03",
\r
614 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
615 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
\r
617 Assert.assertEquals("Wrong meterId", 8,
\r
618 message.getMeterStats().get(1).getMeterId().intValue());
\r
619 Assert.assertEquals("Wrong flowCount", 7,
\r
620 message.getMeterStats().get(1).getFlowCount().intValue());
\r
621 Assert.assertEquals("Wrong packetInCount",
\r
622 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
623 message.getMeterStats().get(1).getPacketInCount());
\r
624 Assert.assertEquals("Wrong byteInCount",
\r
625 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
626 message.getMeterStats().get(1).getByteInCount());
\r
627 Assert.assertEquals("Wrong durationSec", 5,
\r
628 message.getMeterStats().get(1).getDurationSec().intValue());
\r
629 Assert.assertEquals("Wrong durationNsec", 5,
\r
630 message.getMeterStats().get(1).getDurationNsec().intValue());
\r
631 Assert.assertEquals("Wrong packetBandCount_01",
\r
632 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
633 message.getMeterStats().get(1).getMeterBandStats().get(0).getPacketBandCount());
\r
634 Assert.assertEquals("Wrong byteBandCount_01",
\r
635 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
636 message.getMeterStats().get(1).getMeterBandStats().get(0).getByteBandCount());
\r
637 Assert.assertEquals("Wrong packetBandCount_02",
\r
638 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
639 message.getMeterStats().get(1).getMeterBandStats().get(1).getPacketBandCount());
\r
640 Assert.assertEquals("Wrong byteBandCount_02",
\r
641 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
642 message.getMeterStats().get(1).getMeterBandStats().get(1).getByteBandCount());
\r
643 Assert.assertEquals("Wrong packetBandCount_03",
\r
644 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
645 message.getMeterStats().get(1).getMeterBandStats().get(2).getPacketBandCount());
\r
646 Assert.assertEquals("Wrong byteBandCount_03",
\r
647 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
648 message.getMeterStats().get(1).getMeterBandStats().get(2).getByteBandCount());
\r
652 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
655 public void testMultipartReplyMeterConfigBody(){
\r
656 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
\r
659 "00 00 00 09 "+//meterId
\r
660 "00 01 "+//meterBandDrop.type
\r
661 "00 10 "+//meterBandDrop.len
\r
662 "00 00 00 11 "+//meterBandDrop.rate
\r
663 "00 00 00 20 "+//meterBandDrop.burstSize
\r
664 "00 00 00 00 "+//meterBandDrop.pad
\r
665 "00 02 "+//meterBandDscp.type
\r
666 "00 10 "+//meterBandDscp.len
\r
667 "00 00 00 11 "+//meterBandDscp.rate
\r
668 "00 00 00 20 "+//meterBandDscp.burstSize
\r
669 "04 "+//meterBandDscp.precLevel
\r
670 "00 00 00 "+//meterBandDscp.pad
\r
671 "FF FF "+//meterBandExperimenter.type
\r
672 "00 10 "+//meterBandExperimenter.len
\r
673 "00 00 00 11 "+//meterBandExperimenter.rate
\r
674 "00 00 00 20 "+//meterBandExperimenter.burstSize
\r
675 "00 00 00 04"//meterBandExperimenter.experimenter
\r
678 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
680 BufferHelper.checkHeaderV13(builtByFactory);
\r
681 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
\r
682 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
684 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
\r
686 Assert.assertEquals("Wrong flags", new MeterFlags(false, false, true, true),
\r
687 message.getMeterConfig().get(0).getFlags());
\r
688 Assert.assertEquals("Wrong meterId", 9,
\r
689 message.getMeterConfig().get(0).getMeterId().intValue());
\r
691 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
\r
692 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
\r
693 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
\r
694 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
\r
696 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
\r
697 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
\r
698 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
\r
699 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
\r
700 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
\r
702 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
\r
703 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
\r
704 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
\r
705 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
\r
706 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
\r
710 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
713 public void testMultipartReplyMeterConfigBodyMulti(){
\r
714 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
\r
717 "00 00 00 09 "+//meterId
\r
718 "00 01 "+//meterBandDrop.type
\r
719 "00 10 "+//meterBandDrop.len
\r
720 "00 00 00 11 "+//meterBandDrop.rate
\r
721 "00 00 00 20 "+//meterBandDrop.burstSize
\r
722 "00 00 00 00 "+//meterBandDrop.pad
\r
723 "00 02 "+//meterBandDscp.type
\r
724 "00 10 "+//meterBandDscp.len
\r
725 "00 00 00 11 "+//meterBandDscp.rate
\r
726 "00 00 00 20 "+//meterBandDscp.burstSize
\r
727 "04 "+//meterBandDscp.precLevel
\r
728 "00 00 00 "+//meterBandDscp.pad
\r
729 "FF FF "+//meterBandExperimenter.type
\r
730 "00 10 "+//meterBandExperimenter.len
\r
731 "00 00 00 11 "+//meterBandExperimenter.rate
\r
732 "00 00 00 20 "+//meterBandExperimenter.burstSize
\r
733 "00 00 00 04 "+//meterBandExperimenter.experimenter
\r
737 "00 00 00 07 "+//meterId01
\r
738 "00 02 "+//meterBandDscp01.type
\r
739 "00 10 "+//meterBandDscp01.len
\r
740 "00 00 00 11 "+//meterBandDscp01.rate
\r
741 "00 00 00 20 "+//meterBandDscp01.burstSize
\r
742 "04 "+//meterBandDscp01.precLevel
\r
743 "00 00 00"//meterBandDscp01.pad
\r
746 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
748 BufferHelper.checkHeaderV13(builtByFactory);
\r
749 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
\r
750 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
752 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
\r
754 Assert.assertEquals("Wrong flags", new MeterFlags(true, false, true, false),
\r
755 message.getMeterConfig().get(0).getFlags());
\r
756 Assert.assertEquals("Wrong meterId", 9,
\r
757 message.getMeterConfig().get(0).getMeterId().intValue());
\r
759 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
\r
760 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
\r
761 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
\r
762 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
\r
764 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
\r
765 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
\r
766 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
\r
767 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
\r
768 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
\r
770 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
\r
771 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
\r
772 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
\r
773 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
\r
774 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
\r
776 LOGGER.info(message.getMeterConfig().get(0).getFlags().toString());
\r
777 Assert.assertEquals("Wrong flags01", new MeterFlags(false, true, true, false),
\r
778 message.getMeterConfig().get(1).getFlags());
\r
779 Assert.assertEquals("Wrong meterId01", 7,
\r
780 message.getMeterConfig().get(1).getMeterId().intValue());
\r
782 MeterBandDscpRemark meterBandDscp01 = (MeterBandDscpRemark) message.getMeterConfig().get(1).getBands().get(0).getMeterBand();
\r
783 Assert.assertEquals("Wrong meterBandDscp01.type", 2, meterBandDscp01.getType().getIntValue());
\r
784 Assert.assertEquals("Wrong meterBandDscp01.rate", 17, meterBandDscp01.getRate().intValue());
\r
785 Assert.assertEquals("Wrong meterBandDscp01.burstSize", 32, meterBandDscp01.getBurstSize().intValue());
\r
786 Assert.assertEquals("Wrong meterBandDscp01.precLevel", 4, meterBandDscp01.getPrecLevel().intValue());
\r
791 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
794 public void testMultipartReplyExperimenterBody(){
\r
795 ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "+
\r
796 "00 00 00 0F "+//experimenterId
\r
797 "00 00 00 FF "+//expType
\r
798 "00 00 01 01 00 00 01 01"
\r
801 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
803 BufferHelper.checkHeaderV13(builtByFactory);
\r
804 Assert.assertEquals("Wrong type", 0xFFFF, builtByFactory.getType().getIntValue());
\r
805 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
807 MultipartReplyExperimenter message = (MultipartReplyExperimenter) builtByFactory.getMultipartReplyBody();
\r
809 Assert.assertEquals("Wrong experimenterId", 15, message.getExperimenter().intValue());
\r
810 Assert.assertEquals("Wrong expType", 255, message.getExpType().intValue());
\r
811 Assert.assertArrayEquals("Wrong data", new byte[]{0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01},
\r
812 message.getData());
\r
816 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
819 public void testMultipartReplyPortDescBody(){
\r
820 final byte MAX_PORT_NAME_LEN = 16;
\r
821 ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 01 00 00 00 00 "+
\r
822 "00 01 02 03 "+ //portNo
\r
823 "00 00 00 00 "+ //padding01
\r
824 "08 00 27 00 B0 EB " + //mac address
\r
825 "00 00 "); //padding02
\r
827 String portName = "SampleText";
\r
828 byte[] portNameBytes = new byte[MAX_PORT_NAME_LEN];
\r
829 portNameBytes = portName.getBytes();
\r
830 bb.writeBytes(portNameBytes);
\r
831 ByteBufUtils.padBuffer((MAX_PORT_NAME_LEN - portNameBytes.length), bb);
\r
833 ByteBuf bb2 = BufferHelper.buildBuffer("00 00 00 41 " + //port config
\r
834 "00 00 00 05 " + //port state
\r
835 "00 00 00 81 " + //current features
\r
836 "00 00 00 81 " + //advertised features
\r
837 "00 00 00 81 " + //supported features
\r
838 "00 00 00 81 " + //peer features
\r
839 "00 00 00 81 " + //curr speed
\r
840 "00 00 00 80" //max speed
\r
842 bb.writeBytes(bb2.copy(4, bb2.readableBytes()-4));//excluding version and xid
\r
844 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
846 BufferHelper.checkHeaderV13(builtByFactory);
\r
847 Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
\r
848 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
850 MultipartReplyPortDesc message = (MultipartReplyPortDesc) builtByFactory.getMultipartReplyBody();
\r
852 Assert.assertEquals("Wrong portNo", 66051L, message.getPorts().get(0).getPortNo().longValue());
\r
853 Assert.assertEquals("Wrong macAddress", new MacAddress("08002700B0EB"),
\r
854 message.getPorts().get(0).getHwAddr());
\r
855 Assert.assertEquals("Wrong portName", "SampleText",
\r
856 message.getPorts().get(0).getName());
\r
857 Assert.assertEquals("Wrong portConfig", new PortConfig(false, true, false, true),
\r
858 message.getPorts().get(0).getConfig());
\r
859 Assert.assertEquals("Wrong portState", new PortState(false, true, true),
\r
860 message.getPorts().get(0).getState());
\r
861 Assert.assertEquals("Wrong currentFeatures", new PortFeatures(true, false, false, false,
\r
862 false, false, false, true,
\r
863 false, false, false, false,
\r
864 false, false, false, false),
\r
865 message.getPorts().get(0).getCurrentFeatures());
\r
866 Assert.assertEquals("Wrong advertisedFeatures",
\r
867 new PortFeatures(true, false, false, false,
\r
868 false, false, false, true,
\r
869 false, false, false, false,
\r
870 false, false, false, false),
\r
871 message.getPorts().get(0).getAdvertisedFeatures());
\r
872 Assert.assertEquals("Wrong supportedFeatures",
\r
873 new PortFeatures(true, false, false, false,
\r
874 false, false, false, true,
\r
875 false, false, false, false,
\r
876 false, false, false, false),
\r
877 message.getPorts().get(0).getSupportedFeatures());
\r
878 Assert.assertEquals("Wrong peerFeatures",
\r
879 new PortFeatures(true, false, false, false,
\r
880 false, false, false, true,
\r
881 false, false, false, false,
\r
882 false, false, false, false),
\r
883 message.getPorts().get(0).getPeerFeatures());
\r
884 Assert.assertEquals("Wrong currSpeed", 129L, message.getPorts().get(0).getCurrSpeed().longValue());
\r
885 Assert.assertEquals("Wrong maxSpeed", 128L, message.getPorts().get(0).getMaxSpeed().longValue());
\r
889 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
890 * Test covers bodies of actions Output, Copy TTL Out, Copy TTL In
\r
893 public void testMultipartReplyGroupDescBody01(){
\r
894 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
898 "00 00 00 08 "+//groupId
\r
899 "00 30 "+//bucketLen
\r
900 "00 06 "+//bucketWeight
\r
901 "00 00 00 05 "+//bucketWatchPort
\r
902 "00 00 00 04 "+//bucketWatchGroup
\r
903 "00 00 00 00 "+//bucketPad
\r
904 "00 00 "+//outputType
\r
905 "00 10 "+//outputLen
\r
906 "00 00 10 FF "+//outputPort
\r
907 "FF FF "+//outputMaxLen
\r
908 "00 00 00 00 00 00 "+//outputPad
\r
909 "00 0B "+//copyTTLOutType
\r
910 "00 08 "+//copyTTLOutLen
\r
911 "00 00 00 00 "+//copyTTLOutPad
\r
912 "00 0C "+//copyTTLIntType
\r
913 "00 08 "+//copyTTLIntLen
\r
914 "00 00 00 00"//copyTTLInPad
\r
916 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
918 BufferHelper.checkHeaderV13(builtByFactory);
\r
919 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
920 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
922 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
924 Assert.assertEquals("Wrong type", 1,
\r
925 message.getGroupDesc().get(0).getType().getIntValue());
\r
926 Assert.assertEquals("Wrong groupId", 8,
\r
927 message.getGroupDesc().get(0).getGroupId().intValue());
\r
928 Assert.assertEquals("Wrong bucketWeight", 6,
\r
929 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
930 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
931 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
932 getValue().intValue());
\r
933 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
934 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
936 Assert.assertEquals("Wrong outputType", Output.class,
\r
937 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
938 getAction().getType());
\r
940 Assert.assertEquals("Wrong outputPort", 4351,
\r
941 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
942 getAction().getAugmentation(PortAction.class).
\r
943 getPort().getValue().intValue());
\r
945 Assert.assertEquals("Wrong outputMaxLen", 65535,
\r
946 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
947 getAction().getAugmentation(MaxLengthAction.class).
\r
948 getMaxLength().intValue());
\r
950 Assert.assertEquals("Wrong copyTtlOutType", CopyTtlOut.class,
\r
951 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
952 getAction().getType());
\r
954 Assert.assertEquals("Wrong copyTtlInType", CopyTtlIn.class,
\r
955 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
956 getAction().getType());
\r
960 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
961 * Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB
\r
964 public void testMultipartReplyGroupDescBody02(){
\r
965 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
969 "00 00 00 08 "+//groupId
\r
970 "00 38 "+//bucketLen
\r
971 "00 06 "+//bucketWeight
\r
972 "00 00 00 05 "+//bucketWatchPort
\r
973 "00 00 00 04 "+//bucketWatchGroup
\r
974 "00 00 00 00 "+//bucketPad
\r
975 "00 0F "+//setMplsTtlType
\r
976 "00 08 "+//setMplsTtlLen
\r
977 "09 "+//setMplsTtlMPLS_TTL
\r
978 "00 00 00 "+//setMplsTtlPad
\r
979 "00 10 "+//decMplsTtlType
\r
980 "00 08 "+//decMplsTtlLen
\r
981 "00 00 00 00 "+//decMplsTtlPad
\r
982 "00 11 "+//pushVlanType
\r
983 "00 08 "+//pushVlanLen
\r
984 "00 20 "+//pushVlanEthertype
\r
985 "00 00 "+//pushVlanPad
\r
986 "00 13 "+//pushMplsType
\r
987 "00 08 "+//pushMplsLen
\r
988 "00 FF "+//pushMplsEthertype
\r
989 "00 00 "+//pushMplsPad
\r
990 "00 1A "+//pushPbbType
\r
991 "00 08 "+//pushPbbLen
\r
992 "0F FF "+//pushPbbEthertype
\r
993 "00 00"//pushPbbPad
\r
996 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
998 BufferHelper.checkHeaderV13(builtByFactory);
\r
999 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1000 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1002 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1004 Assert.assertEquals("Wrong type", 1,
\r
1005 message.getGroupDesc().get(0).getType().getIntValue());
\r
1006 Assert.assertEquals("Wrong groupId", 8,
\r
1007 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1008 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1009 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1010 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1011 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1012 getValue().intValue());
\r
1013 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1014 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1017 Assert.assertEquals("Wrong setMplsTtlType", SetMplsTtl.class,
\r
1018 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1019 getAction().getType());
\r
1021 Assert.assertEquals("Wrong setMplsTtlMPLS_TTL", 9,
\r
1022 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1023 getAction().getAugmentation(MplsTtlAction.class).
\r
1024 getMplsTtl().intValue());
\r
1026 Assert.assertEquals("Wrong decMplsTtlType", DecMplsTtl.class,
\r
1027 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1028 getAction().getType());
\r
1030 Assert.assertEquals("Wrong pushVlanType", PushVlan.class,
\r
1031 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1032 getAction().getType());
\r
1034 Assert.assertEquals("Wrong pushVlanEthertype", 32,
\r
1035 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1036 getAction().getAugmentation(EthertypeAction.class).
\r
1037 getEthertype().getValue().intValue());
\r
1039 Assert.assertEquals("Wrong pushMplsType", PushMpls.class,
\r
1040 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1041 getAction().getType());
\r
1043 Assert.assertEquals("Wrong pushMplsEthertype", 255,
\r
1044 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1045 getAction().getAugmentation(EthertypeAction.class).
\r
1046 getEthertype().getValue().intValue());
\r
1048 Assert.assertEquals("Wrong pushPbbType", PushPbb.class,
\r
1049 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1050 getAction().getType());
\r
1052 Assert.assertEquals("Wrong pushPbbEthertype", 4095,
\r
1053 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1054 getAction().getAugmentation(EthertypeAction.class).
\r
1055 getEthertype().getValue().intValue());
\r
1060 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
1061 * Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL
\r
1064 public void testMultipartReplyGroupDescBody03(){
\r
1065 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
1069 "00 00 00 08 "+//groupId
\r
1070 "00 40 "+//bucketLen
\r
1071 "00 06 "+//bucketWeight
\r
1072 "00 00 00 05 "+//bucketWatchPort
\r
1073 "00 00 00 04 "+//bucketWatchGroup
\r
1074 "00 00 00 00 "+//bucketPad
\r
1075 "00 12 "+//popVlanType
\r
1076 "00 08 "+//popVlanLen
\r
1077 "00 00 00 00 "+//popVlanPad
\r
1078 "00 1B "+//popPbbType
\r
1079 "00 08 "+//popPbbLen
\r
1080 "00 00 00 00 "+//popPbbPad
\r
1081 "00 14 "+//popMplsType
\r
1082 "00 08 "+//popMplsLen
\r
1083 "00 CF "+//popMplsEthertype
\r
1084 "00 00 "+//popMplsPad
\r
1085 "00 15 "+//setQueueType
\r
1086 "00 08 "+//setQueueLen
\r
1087 "00 CF 00 00 "+//setQueueQueueId
\r
1088 "00 16 "+//groupType
\r
1089 "00 08 "+//groupLen
\r
1090 "00 CF 00 00 "+//groupGroupId
\r
1091 "00 18 "+//decNwTtlType
\r
1092 "00 08 "+//decNwTtlLen
\r
1093 "00 00 00 00"//decNwTtlPad
\r
1096 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
1098 BufferHelper.checkHeaderV13(builtByFactory);
\r
1099 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1100 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1102 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1104 Assert.assertEquals("Wrong type", 1,
\r
1105 message.getGroupDesc().get(0).getType().getIntValue());
\r
1106 Assert.assertEquals("Wrong groupId", 8,
\r
1107 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1108 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1109 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1110 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1111 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1112 getValue().intValue());
\r
1113 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1114 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1116 Assert.assertEquals("Wrong popVlanType", PopVlan.class,
\r
1117 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1118 getAction().getType());
\r
1120 Assert.assertEquals("Wrong popPbbType", PopPbb.class,
\r
1121 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1122 getAction().getType());
\r
1124 Assert.assertEquals("Wrong popMplsType", PopMpls.class,
\r
1125 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1126 getAction().getType());
\r
1128 Assert.assertEquals("Wrong popMplsEthertype", 207,
\r
1129 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1130 getAction().getAugmentation(EthertypeAction.class).
\r
1131 getEthertype().getValue().intValue());
\r
1133 Assert.assertEquals("Wrong setQueueType", SetQueue.class,
\r
1134 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1135 getAction().getType());
\r
1137 Assert.assertEquals("Wrong setQueueQueueId", 13565952,
\r
1138 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1139 getAction().getAugmentation(QueueIdAction.class).
\r
1140 getQueueId().intValue());
\r
1142 Assert.assertEquals("Wrong groupType", Group.class,
\r
1143 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1144 getAction().getType());
\r
1146 Assert.assertEquals("Wrong groupGroupId", 13565952,
\r
1147 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1148 getAction().getAugmentation(GroupIdAction.class).
\r
1149 getGroupId().intValue());
\r
1151 Assert.assertEquals("Wrong decNwTtlType", DecNwTtl.class,
\r
1152 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(5).
\r
1153 getAction().getType());
\r
1157 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
1158 * Test covers bodies of actions NW TTL, Experimenter
\r
1161 public void testMultipartReplyGroupDescBody04(){
\r
1162 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
1166 "00 00 00 08 "+//groupId
\r
1167 "00 28 "+//bucketLen
\r
1168 "00 06 "+//bucketWeight
\r
1169 "00 00 00 05 "+//bucketWatchPort
\r
1170 "00 00 00 04 "+//bucketWatchGroup
\r
1171 "00 00 00 00 "+//bucketPad
\r
1172 "00 17 "+//nwTTlType
\r
1173 "00 08 "+//nwTTlLen
\r
1174 "0E "+//nwTTlnwTTL
\r
1175 "00 00 00 "+//nwTTlPad
\r
1176 "00 19 "+//setFieldType
\r
1177 "00 10 "+//setFieldLen
\r
1178 "80 00 "+//setFieldOXMClass
\r
1179 "00 "+//setFieldOXMField
\r
1180 "04 "+//setFieldOXMLength
\r
1181 "00 00 00 FF "+ //setFieldPort
\r
1185 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
1187 BufferHelper.checkHeaderV13(builtByFactory);
\r
1188 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1189 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1191 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1193 Assert.assertEquals("Wrong type", 1,
\r
1194 message.getGroupDesc().get(0).getType().getIntValue());
\r
1195 Assert.assertEquals("Wrong groupId", 8,
\r
1196 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1197 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1198 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1199 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1200 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1201 getValue().intValue());
\r
1202 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1203 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1205 Assert.assertEquals("Wrong nwTTlType", SetNwTtl.class,
\r
1206 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1207 getAction().getType());
\r
1209 Assert.assertEquals("Wrong nwTTlnwTTL", 14,
\r
1210 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1211 getAction().getAugmentation(NwTtlAction.class).getNwTtl().intValue());
\r
1213 Assert.assertEquals("Wrong setFieldType", SetField.class,
\r
1214 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1215 getAction().getType());
\r
1217 Assert.assertEquals("Wrong setFieldOXMClass", OpenflowBasicClass.class,
\r
1218 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1219 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmClass());
\r
1221 Assert.assertEquals("Wrong setFieldOXMField", InPort.class,
\r
1222 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1223 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmMatchField());
\r
1225 Assert.assertEquals("Wrong setFieldOXMValue", 255,
\r
1226 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1227 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).
\r
1228 getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
\r