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.MeterBandTypeBitmap;
\r
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
\r
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
\r
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
\r
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
\r
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
\r
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
\r
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
\r
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDrop;
\r
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemark;
\r
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenter;
\r
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregate;
\r
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDesc;
\r
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenter;
\r
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlow;
\r
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroup;
\r
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc;
\r
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeter;
\r
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig;
\r
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeatures;
\r
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDesc;
\r
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStats;
\r
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueue;
\r
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTable;
\r
63 import org.slf4j.Logger;
\r
64 import org.slf4j.LoggerFactory;
\r
67 * @author timotej.kubas
\r
68 * @author michal.polkorab
\r
70 public class MultipartReplyMessageFactoryTest {
\r
72 private static final Logger LOGGER = LoggerFactory
\r
73 .getLogger(MultipartReplyMessageFactoryTest.class);
\r
76 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
80 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 01 02 03 04");
\r
81 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
83 BufferHelper.checkHeaderV13(builtByFactory);
\r
85 Assert.assertEquals("Wrong type", 0x07, builtByFactory.getType().getIntValue());
\r
86 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
87 //Assert.assertArrayEquals("Wrong body", new byte[]{0x01, 0x02, 0x03, 0x04}, builtByFactory.getBody());
\r
91 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
94 public void testMultipartReplyDescBody(){
\r
95 final int DESC_STR_LEN = 256;
\r
96 final int SERIAL_NUM_LEN = 32;
\r
97 ByteBuf bb = BufferHelper.buildBuffer("00 00 00 01 00 00 00 00");
\r
99 String mfrDesc = "Manufacturer description";
\r
100 byte[] mfrDescBytes = new byte[256];
\r
101 mfrDescBytes = mfrDesc.getBytes();
\r
102 bb.writeBytes(mfrDescBytes);
\r
103 ByteBufUtils.padBuffer((DESC_STR_LEN - mfrDescBytes.length), bb);
\r
105 String hwDesc = "Hardware description";
\r
106 byte[] hwDescBytes = new byte[256];
\r
107 hwDescBytes = hwDesc.getBytes();
\r
108 bb.writeBytes(hwDescBytes);
\r
109 ByteBufUtils.padBuffer((DESC_STR_LEN - hwDescBytes.length), bb);
\r
111 String swDesc = "Software description";
\r
112 byte[] swDescBytes = new byte[256];
\r
113 swDescBytes = swDesc.getBytes();
\r
114 bb.writeBytes(swDescBytes);
\r
115 ByteBufUtils.padBuffer((DESC_STR_LEN - swDescBytes.length), bb);
\r
117 String serialNum = "SN0123456789";
\r
118 byte[] serialNumBytes = new byte[32];
\r
119 serialNumBytes = serialNum.getBytes();
\r
120 bb.writeBytes(serialNumBytes);
\r
121 ByteBufUtils.padBuffer((SERIAL_NUM_LEN - serialNumBytes.length), bb);
\r
123 String dpDesc = "switch3 in room 3120";
\r
124 byte[] dpDescBytes = new byte[256];
\r
125 dpDescBytes = dpDesc.getBytes();
\r
126 bb.writeBytes(dpDescBytes);
\r
127 ByteBufUtils.padBuffer((DESC_STR_LEN - dpDescBytes.length), bb);
\r
129 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
131 BufferHelper.checkHeaderV13(builtByFactory);
\r
132 Assert.assertEquals("Wrong type", 0x00, builtByFactory.getType().getIntValue());
\r
133 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
134 MultipartReplyDesc message = (MultipartReplyDesc) builtByFactory.getMultipartReplyBody();
\r
135 Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());
\r
136 Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());
\r
137 Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());
\r
138 Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());
\r
139 Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());
\r
143 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
146 public void testMultipartReplyFlowBody(){
\r
147 ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+
\r
151 "00 00 00 09 "+//durationSec
\r
152 "00 00 00 07 "+//durationNsec
\r
153 "00 0C "+//priority
\r
154 "00 0E "+//idleTimeout
\r
155 "00 0F "+//hardTimeout
\r
157 "00 00 00 00 "+//pad_02
\r
158 "00 01 01 01 01 01 01 01 "+//cookie
\r
159 "00 01 01 01 01 01 01 01 "+//packetCount
\r
160 "00 01 01 01 01 01 01 01"//byteCount
\r
163 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
165 BufferHelper.checkHeaderV13(builtByFactory);
\r
166 Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
\r
167 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
168 MultipartReplyFlow message = (MultipartReplyFlow) builtByFactory.getMultipartReplyBody();
\r
169 Assert.assertEquals("Wrong tableId", 8, message.getFlowStats().get(0).getTableId().intValue());
\r
170 Assert.assertEquals("Wrong durationSec", 9, message.getFlowStats().get(0).getDurationSec().intValue());
\r
171 Assert.assertEquals("Wrong durationNsec", 7, message.getFlowStats().get(0).getDurationNsec().intValue());
\r
172 Assert.assertEquals("Wrong priority", 12, message.getFlowStats().get(0).getPriority().intValue());
\r
173 Assert.assertEquals("Wrong idleTimeOut", 14, message.getFlowStats().get(0).getIdleTimeout().intValue());
\r
174 Assert.assertEquals("Wrong hardTimeOut", 15, message.getFlowStats().get(0).getHardTimeout().intValue());
\r
175 Assert.assertEquals("Wrong flags", new FlowModFlags(true, false, true, false, true),
\r
176 message.getFlowStats().get(0).getFlags());
\r
177 Assert.assertEquals("Wrong cookie",
\r
178 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
179 message.getFlowStats().get(0).getCookie());
\r
180 Assert.assertEquals("Wrong packetCount",
\r
181 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
182 message.getFlowStats().get(0).getPacketCount());
\r
183 Assert.assertEquals("Wrong byteCount",
\r
184 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
185 message.getFlowStats().get(0).getByteCount());
\r
189 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
192 public void testMultipartReplyAggregateBody(){
\r
193 ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 "+
\r
194 "00 01 01 01 01 01 01 01 "+//packetCount
\r
195 "00 01 01 01 01 01 01 01 "+//byteCount
\r
196 "00 00 00 08 "+//flowCount
\r
200 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
202 BufferHelper.checkHeaderV13(builtByFactory);
\r
203 Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
\r
204 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
205 MultipartReplyAggregate message = (MultipartReplyAggregate) builtByFactory.getMultipartReplyBody();
\r
206 Assert.assertEquals("Wrong packetCount",
\r
207 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
208 message.getPacketCount());
\r
209 Assert.assertEquals("Wrong byteCount",
\r
210 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
211 message.getByteCount());
\r
212 Assert.assertEquals("Wrong flowCount",
\r
214 message.getFlowCount().intValue());
\r
218 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
221 public void testMultipartReplyTableBody(){
\r
222 ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 00 00 00 00 "+
\r
225 "00 00 00 10 "+//activeCount
\r
226 "00 01 01 01 01 01 01 01 "+//lookupCount
\r
227 "00 01 01 01 01 01 01 01"//matchedCount
\r
230 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
232 BufferHelper.checkHeaderV13(builtByFactory);
\r
233 Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
\r
234 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
236 MultipartReplyTable message = (MultipartReplyTable) builtByFactory.getMultipartReplyBody();
\r
237 Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
\r
238 Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
\r
239 Assert.assertEquals("Wrong lookupCount",
\r
240 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
241 message.getTableStats().get(0).getLookupCount());
\r
242 Assert.assertEquals("Wrong matchedCount",
\r
243 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
244 message.getTableStats().get(0).getMatchedCount());
\r
248 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
251 public void testMultipartReplyPortStatsBody(){
\r
252 ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 00 00 00 00 "+
\r
253 "00 00 00 FF "+//portNo
\r
254 "00 00 00 00 "+//pad
\r
255 "00 01 01 01 01 01 01 01 "+//rxPackets
\r
256 "00 02 02 02 02 02 02 02 "+//txPackets
\r
257 "00 02 03 02 03 02 03 02 "+//rxBytes
\r
258 "00 02 03 02 03 02 03 02 "+//txBytes
\r
259 "00 02 03 02 03 02 03 02 "+//rxDropped
\r
260 "00 02 03 02 03 02 03 02 "+//txDropped
\r
261 "00 02 03 02 03 02 03 02 "+//rxErrors
\r
262 "00 02 03 02 03 02 03 02 "+//txErrors
\r
263 "00 02 03 02 03 02 03 02 "+//rxFrameErr
\r
264 "00 02 03 02 03 02 03 02 "+//rxOverErr
\r
265 "00 02 03 02 03 02 03 02 "+//rxCrcErr
\r
266 "00 02 03 02 03 02 03 02 "+//collisions
\r
267 "00 00 00 02 "+//durationSec
\r
268 "00 00 00 04"//durationNsec
\r
271 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
273 BufferHelper.checkHeaderV13(builtByFactory);
\r
274 Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());
\r
275 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
277 MultipartReplyPortStats message = (MultipartReplyPortStats) builtByFactory.getMultipartReplyBody();
\r
279 Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());
\r
280 Assert.assertEquals("Wrong rxPackets",
\r
281 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
282 message.getPortStats().get(0).getRxPackets());
\r
283 Assert.assertEquals("Wrong txPackets",
\r
284 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
285 message.getPortStats().get(0).getTxPackets());
\r
286 Assert.assertEquals("Wrong rxBytes",
\r
287 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
288 message.getPortStats().get(0).getRxBytes());
\r
289 Assert.assertEquals("Wrong txBytes",
\r
290 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
291 message.getPortStats().get(0).getTxBytes());
\r
292 Assert.assertEquals("Wrong rxDropped",
\r
293 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
294 message.getPortStats().get(0).getRxDropped());
\r
295 Assert.assertEquals("Wrong txDropped",
\r
296 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
297 message.getPortStats().get(0).getTxDropped());
\r
298 Assert.assertEquals("Wrong rxErrors",
\r
299 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
300 message.getPortStats().get(0).getRxErrors());
\r
301 Assert.assertEquals("Wrong txErrors",
\r
302 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
303 message.getPortStats().get(0).getTxErrors());
\r
304 Assert.assertEquals("Wrong rxFrameErr",
\r
305 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
306 message.getPortStats().get(0).getRxFrameErr());
\r
307 Assert.assertEquals("Wrong rxOverErr",
\r
308 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
309 message.getPortStats().get(0).getRxOverErr());
\r
310 Assert.assertEquals("Wrong rxCrcErr",
\r
311 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
312 message.getPortStats().get(0).getRxCrcErr());
\r
313 Assert.assertEquals("Wrong collisions",
\r
314 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
315 message.getPortStats().get(0).getCollisions());
\r
316 Assert.assertEquals("Wrong durationSec", 2, message.getPortStats().get(0).getDurationSec().intValue());
\r
317 Assert.assertEquals("Wrong durationNsec", 4, message.getPortStats().get(0).getDurationNsec().intValue());
\r
321 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
324 public void testMultipartReplyQueueBody(){
\r
325 ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 "+
\r
326 "00 00 00 FF "+//portNo
\r
327 "00 00 00 10 "+//queueId
\r
328 "00 02 03 02 03 02 03 02 "+//txBytes
\r
329 "00 02 02 02 02 02 02 02 "+//txPackets
\r
330 "00 02 03 02 03 02 03 02 "+//txErrors
\r
331 "00 00 00 02 "+//durationSec
\r
332 "00 00 00 04"//durationNsec
\r
335 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
337 BufferHelper.checkHeaderV13(builtByFactory);
\r
338 Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());
\r
339 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
341 MultipartReplyQueue message = (MultipartReplyQueue) builtByFactory.getMultipartReplyBody();
\r
343 Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
\r
344 Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
\r
345 Assert.assertEquals("Wrong txBytes",
\r
346 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
347 message.getQueueStats().get(0).getTxBytes());
\r
348 Assert.assertEquals("Wrong txPackets",
\r
349 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
350 message.getQueueStats().get(0).getTxPackets());
\r
351 Assert.assertEquals("Wrong txErrors",
\r
352 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
353 message.getQueueStats().get(0).getTxErrors());
\r
354 Assert.assertEquals("Wrong durationSec", 2, message.getQueueStats().get(0).getDurationSec().intValue());
\r
355 Assert.assertEquals("Wrong durationNsec", 4, message.getQueueStats().get(0).getDurationNsec().intValue());
\r
359 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
362 public void testMultipartReplyGroupBody(){
\r
363 ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 "+
\r
366 "00 00 00 10 "+//groupId
\r
367 "00 00 00 12 "+//refCount
\r
368 "00 00 00 00 "+//pad2
\r
369 "00 01 01 01 01 01 01 01 "+//packetCount
\r
370 "00 01 01 01 01 01 01 01 "+//byteCount
\r
371 "00 00 00 08 "+//durationSec
\r
372 "00 00 00 09 "+//durationNsec
\r
373 "00 01 01 01 01 01 01 01 "+//packetCountBucket
\r
374 "00 01 01 01 01 01 01 01 "+//byteCountBucket
\r
375 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2
\r
376 "00 02 02 02 02 02 02 02 "+//byteCountBucket_2
\r
377 "00 48 "+//length_2
\r
379 "00 00 00 10 "+//groupId_2
\r
380 "00 00 00 12 "+//refCount_2
\r
381 "00 00 00 00 "+//pad2.2
\r
382 "00 01 01 01 01 01 01 01 "+//packetCount_2
\r
383 "00 01 01 01 01 01 01 01 "+//byteCount_2
\r
384 "00 00 00 08 "+//durationSec_2
\r
385 "00 00 00 09 "+//durationNsec_2
\r
386 "00 01 01 01 01 01 01 01 "+//packetCountBucket_1.2
\r
387 "00 01 01 01 01 01 01 01 "+//byteCountBucket_1.2
\r
388 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2.2
\r
389 "00 02 02 02 02 02 02 02"//byteCountBucket_2.2
\r
392 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
394 BufferHelper.checkHeaderV13(builtByFactory);
\r
395 Assert.assertEquals("Wrong type", 0x06, builtByFactory.getType().getIntValue());
\r
396 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
398 MultipartReplyGroup message = (MultipartReplyGroup) builtByFactory.getMultipartReplyBody();
\r
400 Assert.assertEquals("Wrong groupId", 16, message.getGroupStats().get(0).getGroupId().intValue());
\r
401 Assert.assertEquals("Wrong refCount", 18, message.getGroupStats().get(0).getRefCount().intValue());
\r
402 Assert.assertEquals("Wrong packetCount",
\r
403 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
404 message.getGroupStats().get(0).getPacketCount());
\r
405 Assert.assertEquals("Wrong byteCount",
\r
406 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
407 message.getGroupStats().get(0).getByteCount());
\r
408 Assert.assertEquals("Wrong durationSec", 8, message.getGroupStats().get(0).getDurationSec().intValue());
\r
409 Assert.assertEquals("Wrong durationNsec", 9, message.getGroupStats().get(0).getDurationNsec().intValue());
\r
410 Assert.assertEquals("Wrong packetCountBucket",
\r
411 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
412 message.getGroupStats().get(0).getBucketStats().get(0).getPacketCount());
\r
413 Assert.assertEquals("Wrong byteCountBucket",
\r
414 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
415 message.getGroupStats().get(0).getBucketStats().get(0).getByteCount());
\r
416 Assert.assertEquals("Wrong packetCountBucket_2",
\r
417 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
418 message.getGroupStats().get(0).getBucketStats().get(1).getPacketCount());
\r
419 Assert.assertEquals("Wrong byteCountBucket_2",
\r
420 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
421 message.getGroupStats().get(0).getBucketStats().get(1).getByteCount());
\r
423 Assert.assertEquals("Wrong groupId_2", 16, message.getGroupStats().get(1).getGroupId().intValue());
\r
424 Assert.assertEquals("Wrong refCount_2", 18, message.getGroupStats().get(1).getRefCount().intValue());
\r
425 Assert.assertEquals("Wrong packetCount_2",
\r
426 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
427 message.getGroupStats().get(1).getPacketCount());
\r
428 Assert.assertEquals("Wrong byteCount_2",
\r
429 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
430 message.getGroupStats().get(1).getByteCount());
\r
431 Assert.assertEquals("Wrong durationSec_2", 8, message.getGroupStats().get(1).getDurationSec().intValue());
\r
432 Assert.assertEquals("Wrong durationNsec_2", 9, message.getGroupStats().get(1).getDurationNsec().intValue());
\r
433 Assert.assertEquals("Wrong packetCountBucket_1.2",
\r
434 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
435 message.getGroupStats().get(1).getBucketStats().get(0).getPacketCount());
\r
436 Assert.assertEquals("Wrong byteCountBucket_1.2",
\r
437 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
438 message.getGroupStats().get(1).getBucketStats().get(0).getByteCount());
\r
439 Assert.assertEquals("Wrong packetCountBucket_2.2",
\r
440 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
441 message.getGroupStats().get(1).getBucketStats().get(1).getPacketCount());
\r
442 Assert.assertEquals("Wrong byteCountBucket_2.2",
\r
443 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
444 message.getGroupStats().get(1).getBucketStats().get(1).getByteCount());
\r
448 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
451 public void testMultipartReplyMeterFeaturesBody(){
\r
452 ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
\r
453 "00 00 00 09 "+//maxMeter
\r
454 "00 00 00 01 "+//bandTypes
\r
455 "00 00 00 03 "+//capabilities
\r
461 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
463 BufferHelper.checkHeaderV13(builtByFactory);
\r
464 Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
\r
465 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
467 MultipartReplyMeterFeatures message = (MultipartReplyMeterFeatures) builtByFactory.getMultipartReplyBody();
\r
469 Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());
\r
470 Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(true, false), message.getBandTypes());
\r
471 Assert.assertEquals("Wrong capabilities", new MeterFlags(false, true, true, false),
\r
472 message.getCapabilities());
\r
473 Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());
\r
474 Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());
\r
478 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
481 public void testMultipartReplyMeterBody(){
\r
482 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
\r
483 "00 00 00 09 "+//meterId
\r
485 "00 00 00 00 00 00 "+//pad
\r
486 "00 00 00 07 "+//flowCount
\r
487 "00 01 01 01 01 01 01 01 "+//packetInCount
\r
488 "00 01 01 01 01 01 01 01 "+//byteInCount
\r
489 "00 00 00 05 "+//durationSec
\r
490 "00 00 00 05 "+//durationNsec
\r
491 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
\r
492 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
\r
493 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
\r
494 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
\r
495 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
\r
496 "00 03 03 03 03 03 03 03"//byteBandCount_03
\r
499 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
501 BufferHelper.checkHeaderV13(builtByFactory);
\r
502 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
\r
503 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
505 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
\r
507 Assert.assertEquals("Wrong meterId", 9,
\r
508 message.getMeterStats().get(0).getMeterId().intValue());
\r
509 Assert.assertEquals("Wrong flowCount", 7,
\r
510 message.getMeterStats().get(0).getFlowCount().intValue());
\r
511 Assert.assertEquals("Wrong packetInCount",
\r
512 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
513 message.getMeterStats().get(0).getPacketInCount());
\r
514 Assert.assertEquals("Wrong byteInCount",
\r
515 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
516 message.getMeterStats().get(0).getByteInCount());
\r
517 Assert.assertEquals("Wrong durationSec", 5,
\r
518 message.getMeterStats().get(0).getDurationSec().intValue());
\r
519 Assert.assertEquals("Wrong durationNsec", 5,
\r
520 message.getMeterStats().get(0).getDurationNsec().intValue());
\r
521 Assert.assertEquals("Wrong packetBandCount_01",
\r
522 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
523 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
\r
524 Assert.assertEquals("Wrong byteBandCount_01",
\r
525 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
526 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
\r
527 Assert.assertEquals("Wrong packetBandCount_02",
\r
528 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
529 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
\r
530 Assert.assertEquals("Wrong byteBandCount_02",
\r
531 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
532 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
\r
533 Assert.assertEquals("Wrong packetBandCount_03",
\r
534 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
535 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
\r
536 Assert.assertEquals("Wrong byteBandCount_03",
\r
537 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
538 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
\r
542 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
545 public void testMultipartReplyMeterBodyMulti(){
\r
546 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
\r
547 "00 00 00 09 "+//meterId_0
\r
549 "00 00 00 00 00 00 "+//pad_0
\r
550 "00 00 00 07 "+//flowCount_0
\r
551 "00 01 01 01 01 01 01 01 "+//packetInCount_0
\r
552 "00 01 01 01 01 01 01 01 "+//byteInCount_0
\r
553 "00 00 00 05 "+//durationSec_0
\r
554 "00 00 00 05 "+//durationNsec_0
\r
555 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
\r
556 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
\r
557 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
\r
558 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
\r
559 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
\r
560 "00 03 03 03 03 03 03 03 "+//byteBandCount_03
\r
561 "00 00 00 08 "+//meterId_1
\r
563 "00 00 00 00 00 00 "+//pad_1
\r
564 "00 00 00 07 "+//flowCount_1
\r
565 "00 01 01 01 01 01 01 01 "+//packetInCount_1
\r
566 "00 01 01 01 01 01 01 01 "+//byteInCount_1
\r
567 "00 00 00 05 "+//durationSec_1
\r
568 "00 00 00 05 "+//durationNsec_1
\r
569 "00 01 01 01 01 01 01 01 "+//packetBandCount_11
\r
570 "00 01 01 01 01 01 01 01 "+//byteBandCount_11
\r
571 "00 02 02 02 02 02 02 02 "+//packetBandCount_12
\r
572 "00 02 02 02 02 02 02 02 "+//byteBandCount_12
\r
573 "00 03 03 03 03 03 03 03 "+//packetBandCount_13
\r
574 "00 03 03 03 03 03 03 03"//byteBandCount_13
\r
577 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
579 BufferHelper.checkHeaderV13(builtByFactory);
\r
580 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
\r
581 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
583 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
\r
585 Assert.assertEquals("Wrong meterId", 9,
\r
586 message.getMeterStats().get(0).getMeterId().intValue());
\r
587 Assert.assertEquals("Wrong flowCount", 7,
\r
588 message.getMeterStats().get(0).getFlowCount().intValue());
\r
589 Assert.assertEquals("Wrong packetInCount",
\r
590 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
591 message.getMeterStats().get(0).getPacketInCount());
\r
592 Assert.assertEquals("Wrong byteInCount",
\r
593 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
594 message.getMeterStats().get(0).getByteInCount());
\r
595 Assert.assertEquals("Wrong durationSec", 5,
\r
596 message.getMeterStats().get(0).getDurationSec().intValue());
\r
597 Assert.assertEquals("Wrong durationNsec", 5,
\r
598 message.getMeterStats().get(0).getDurationNsec().intValue());
\r
599 Assert.assertEquals("Wrong packetBandCount_01",
\r
600 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
601 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
\r
602 Assert.assertEquals("Wrong byteBandCount_01",
\r
603 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
604 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
\r
605 Assert.assertEquals("Wrong packetBandCount_02",
\r
606 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
607 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
\r
608 Assert.assertEquals("Wrong byteBandCount_02",
\r
609 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
610 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
\r
611 Assert.assertEquals("Wrong packetBandCount_03",
\r
612 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
613 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
\r
614 Assert.assertEquals("Wrong byteBandCount_03",
\r
615 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
616 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
\r
618 Assert.assertEquals("Wrong meterId", 8,
\r
619 message.getMeterStats().get(1).getMeterId().intValue());
\r
620 Assert.assertEquals("Wrong flowCount", 7,
\r
621 message.getMeterStats().get(1).getFlowCount().intValue());
\r
622 Assert.assertEquals("Wrong packetInCount",
\r
623 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
624 message.getMeterStats().get(1).getPacketInCount());
\r
625 Assert.assertEquals("Wrong byteInCount",
\r
626 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
627 message.getMeterStats().get(1).getByteInCount());
\r
628 Assert.assertEquals("Wrong durationSec", 5,
\r
629 message.getMeterStats().get(1).getDurationSec().intValue());
\r
630 Assert.assertEquals("Wrong durationNsec", 5,
\r
631 message.getMeterStats().get(1).getDurationNsec().intValue());
\r
632 Assert.assertEquals("Wrong packetBandCount_01",
\r
633 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
634 message.getMeterStats().get(1).getMeterBandStats().get(0).getPacketBandCount());
\r
635 Assert.assertEquals("Wrong byteBandCount_01",
\r
636 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
637 message.getMeterStats().get(1).getMeterBandStats().get(0).getByteBandCount());
\r
638 Assert.assertEquals("Wrong packetBandCount_02",
\r
639 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
640 message.getMeterStats().get(1).getMeterBandStats().get(1).getPacketBandCount());
\r
641 Assert.assertEquals("Wrong byteBandCount_02",
\r
642 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
643 message.getMeterStats().get(1).getMeterBandStats().get(1).getByteBandCount());
\r
644 Assert.assertEquals("Wrong packetBandCount_03",
\r
645 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
646 message.getMeterStats().get(1).getMeterBandStats().get(2).getPacketBandCount());
\r
647 Assert.assertEquals("Wrong byteBandCount_03",
\r
648 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
649 message.getMeterStats().get(1).getMeterBandStats().get(2).getByteBandCount());
\r
653 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
656 public void testMultipartReplyMeterConfigBody(){
\r
657 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
\r
660 "00 00 00 09 "+//meterId
\r
661 "00 01 "+//meterBandDrop.type
\r
662 "00 10 "+//meterBandDrop.len
\r
663 "00 00 00 11 "+//meterBandDrop.rate
\r
664 "00 00 00 20 "+//meterBandDrop.burstSize
\r
665 "00 00 00 00 "+//meterBandDrop.pad
\r
666 "00 02 "+//meterBandDscp.type
\r
667 "00 10 "+//meterBandDscp.len
\r
668 "00 00 00 11 "+//meterBandDscp.rate
\r
669 "00 00 00 20 "+//meterBandDscp.burstSize
\r
670 "04 "+//meterBandDscp.precLevel
\r
671 "00 00 00 "+//meterBandDscp.pad
\r
672 "FF FF "+//meterBandExperimenter.type
\r
673 "00 10 "+//meterBandExperimenter.len
\r
674 "00 00 00 11 "+//meterBandExperimenter.rate
\r
675 "00 00 00 20 "+//meterBandExperimenter.burstSize
\r
676 "00 00 00 04"//meterBandExperimenter.experimenter
\r
679 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
681 BufferHelper.checkHeaderV13(builtByFactory);
\r
682 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
\r
683 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
685 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
\r
687 Assert.assertEquals("Wrong flags", new MeterFlags(false, false, true, true),
\r
688 message.getMeterConfig().get(0).getFlags());
\r
689 Assert.assertEquals("Wrong meterId", 9,
\r
690 message.getMeterConfig().get(0).getMeterId().intValue());
\r
692 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
\r
693 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
\r
694 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
\r
695 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
\r
697 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
\r
698 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
\r
699 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
\r
700 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
\r
701 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
\r
703 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
\r
704 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
\r
705 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
\r
706 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
\r
707 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
\r
711 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
714 public void testMultipartReplyMeterConfigBodyMulti(){
\r
715 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
\r
718 "00 00 00 09 "+//meterId
\r
719 "00 01 "+//meterBandDrop.type
\r
720 "00 10 "+//meterBandDrop.len
\r
721 "00 00 00 11 "+//meterBandDrop.rate
\r
722 "00 00 00 20 "+//meterBandDrop.burstSize
\r
723 "00 00 00 00 "+//meterBandDrop.pad
\r
724 "00 02 "+//meterBandDscp.type
\r
725 "00 10 "+//meterBandDscp.len
\r
726 "00 00 00 11 "+//meterBandDscp.rate
\r
727 "00 00 00 20 "+//meterBandDscp.burstSize
\r
728 "04 "+//meterBandDscp.precLevel
\r
729 "00 00 00 "+//meterBandDscp.pad
\r
730 "FF FF "+//meterBandExperimenter.type
\r
731 "00 10 "+//meterBandExperimenter.len
\r
732 "00 00 00 11 "+//meterBandExperimenter.rate
\r
733 "00 00 00 20 "+//meterBandExperimenter.burstSize
\r
734 "00 00 00 04 "+//meterBandExperimenter.experimenter
\r
738 "00 00 00 07 "+//meterId01
\r
739 "00 02 "+//meterBandDscp01.type
\r
740 "00 10 "+//meterBandDscp01.len
\r
741 "00 00 00 11 "+//meterBandDscp01.rate
\r
742 "00 00 00 20 "+//meterBandDscp01.burstSize
\r
743 "04 "+//meterBandDscp01.precLevel
\r
744 "00 00 00"//meterBandDscp01.pad
\r
747 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
749 BufferHelper.checkHeaderV13(builtByFactory);
\r
750 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
\r
751 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
753 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
\r
755 Assert.assertEquals("Wrong flags", new MeterFlags(true, false, true, false),
\r
756 message.getMeterConfig().get(0).getFlags());
\r
757 Assert.assertEquals("Wrong meterId", 9,
\r
758 message.getMeterConfig().get(0).getMeterId().intValue());
\r
760 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
\r
761 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
\r
762 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
\r
763 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
\r
765 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
\r
766 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
\r
767 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
\r
768 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
\r
769 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
\r
771 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
\r
772 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
\r
773 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
\r
774 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
\r
775 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
\r
777 LOGGER.info(message.getMeterConfig().get(0).getFlags().toString());
\r
778 Assert.assertEquals("Wrong flags01", new MeterFlags(false, true, true, false),
\r
779 message.getMeterConfig().get(1).getFlags());
\r
780 Assert.assertEquals("Wrong meterId01", 7,
\r
781 message.getMeterConfig().get(1).getMeterId().intValue());
\r
783 MeterBandDscpRemark meterBandDscp01 = (MeterBandDscpRemark) message.getMeterConfig().get(1).getBands().get(0).getMeterBand();
\r
784 Assert.assertEquals("Wrong meterBandDscp01.type", 2, meterBandDscp01.getType().getIntValue());
\r
785 Assert.assertEquals("Wrong meterBandDscp01.rate", 17, meterBandDscp01.getRate().intValue());
\r
786 Assert.assertEquals("Wrong meterBandDscp01.burstSize", 32, meterBandDscp01.getBurstSize().intValue());
\r
787 Assert.assertEquals("Wrong meterBandDscp01.precLevel", 4, meterBandDscp01.getPrecLevel().intValue());
\r
792 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
795 public void testMultipartReplyExperimenterBody(){
\r
796 ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "+
\r
797 "00 00 00 0F "+//experimenterId
\r
798 "00 00 00 FF "+//expType
\r
799 "00 00 01 01 00 00 01 01"
\r
802 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
804 BufferHelper.checkHeaderV13(builtByFactory);
\r
805 Assert.assertEquals("Wrong type", 0xFFFF, builtByFactory.getType().getIntValue());
\r
806 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
808 MultipartReplyExperimenter message = (MultipartReplyExperimenter) builtByFactory.getMultipartReplyBody();
\r
810 Assert.assertEquals("Wrong experimenterId", 15, message.getExperimenter().intValue());
\r
811 Assert.assertEquals("Wrong expType", 255, message.getExpType().intValue());
\r
812 Assert.assertArrayEquals("Wrong data", new byte[]{0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01},
\r
813 message.getData());
\r
817 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
820 public void testMultipartReplyPortDescBody(){
\r
821 final byte MAX_PORT_NAME_LEN = 16;
\r
822 ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 01 00 00 00 00 "+
\r
823 "00 01 02 03 "+ //portNo
\r
824 "00 00 00 00 "+ //padding01
\r
825 "08 00 27 00 B0 EB " + //mac address
\r
826 "00 00 "); //padding02
\r
828 String portName = "SampleText";
\r
829 byte[] portNameBytes = new byte[MAX_PORT_NAME_LEN];
\r
830 portNameBytes = portName.getBytes();
\r
831 bb.writeBytes(portNameBytes);
\r
832 ByteBufUtils.padBuffer((MAX_PORT_NAME_LEN - portNameBytes.length), bb);
\r
834 ByteBuf bb2 = BufferHelper.buildBuffer("00 00 00 41 " + //port config
\r
835 "00 00 00 05 " + //port state
\r
836 "00 00 00 81 " + //current features
\r
837 "00 00 00 81 " + //advertised features
\r
838 "00 00 00 81 " + //supported features
\r
839 "00 00 00 81 " + //peer features
\r
840 "00 00 00 81 " + //curr speed
\r
841 "00 00 00 80" //max speed
\r
843 bb.writeBytes(bb2.copy(4, bb2.readableBytes()-4));//excluding version and xid
\r
845 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
847 BufferHelper.checkHeaderV13(builtByFactory);
\r
848 Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
\r
849 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
851 MultipartReplyPortDesc message = (MultipartReplyPortDesc) builtByFactory.getMultipartReplyBody();
\r
853 Assert.assertEquals("Wrong portNo", 66051L, message.getPorts().get(0).getPortNo().longValue());
\r
854 Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"),
\r
855 message.getPorts().get(0).getHwAddr());
\r
856 Assert.assertEquals("Wrong portName", "SampleText",
\r
857 message.getPorts().get(0).getName());
\r
858 Assert.assertEquals("Wrong portConfig", new PortConfig(false, true, false, true),
\r
859 message.getPorts().get(0).getConfig());
\r
860 Assert.assertEquals("Wrong portState", new PortState(false, true, true),
\r
861 message.getPorts().get(0).getState());
\r
862 Assert.assertEquals("Wrong currentFeatures", new PortFeatures(true, false, false, false,
\r
863 false, false, false, true,
\r
864 false, false, false, false,
\r
865 false, false, false, false),
\r
866 message.getPorts().get(0).getCurrentFeatures());
\r
867 Assert.assertEquals("Wrong advertisedFeatures",
\r
868 new PortFeatures(true, false, false, false,
\r
869 false, false, false, true,
\r
870 false, false, false, false,
\r
871 false, false, false, false),
\r
872 message.getPorts().get(0).getAdvertisedFeatures());
\r
873 Assert.assertEquals("Wrong supportedFeatures",
\r
874 new PortFeatures(true, false, false, false,
\r
875 false, false, false, true,
\r
876 false, false, false, false,
\r
877 false, false, false, false),
\r
878 message.getPorts().get(0).getSupportedFeatures());
\r
879 Assert.assertEquals("Wrong peerFeatures",
\r
880 new PortFeatures(true, false, false, false,
\r
881 false, false, false, true,
\r
882 false, false, false, false,
\r
883 false, false, false, false),
\r
884 message.getPorts().get(0).getPeerFeatures());
\r
885 Assert.assertEquals("Wrong currSpeed", 129L, message.getPorts().get(0).getCurrSpeed().longValue());
\r
886 Assert.assertEquals("Wrong maxSpeed", 128L, message.getPorts().get(0).getMaxSpeed().longValue());
\r
890 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
891 * Test covers bodies of actions Output, Copy TTL Out, Copy TTL In
\r
894 public void testMultipartReplyGroupDescBody01(){
\r
895 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
899 "00 00 00 08 "+//groupId
\r
900 "00 30 "+//bucketLen
\r
901 "00 06 "+//bucketWeight
\r
902 "00 00 00 05 "+//bucketWatchPort
\r
903 "00 00 00 04 "+//bucketWatchGroup
\r
904 "00 00 00 00 "+//bucketPad
\r
905 "00 00 "+//outputType
\r
906 "00 10 "+//outputLen
\r
907 "00 00 10 FF "+//outputPort
\r
908 "FF FF "+//outputMaxLen
\r
909 "00 00 00 00 00 00 "+//outputPad
\r
910 "00 0B "+//copyTTLOutType
\r
911 "00 08 "+//copyTTLOutLen
\r
912 "00 00 00 00 "+//copyTTLOutPad
\r
913 "00 0C "+//copyTTLIntType
\r
914 "00 08 "+//copyTTLIntLen
\r
915 "00 00 00 00"//copyTTLInPad
\r
917 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
919 BufferHelper.checkHeaderV13(builtByFactory);
\r
920 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
921 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
923 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
925 Assert.assertEquals("Wrong type", 1,
\r
926 message.getGroupDesc().get(0).getType().getIntValue());
\r
927 Assert.assertEquals("Wrong groupId", 8,
\r
928 message.getGroupDesc().get(0).getGroupId().intValue());
\r
929 Assert.assertEquals("Wrong bucketWeight", 6,
\r
930 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
931 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
932 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
933 getValue().intValue());
\r
934 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
935 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
937 Assert.assertEquals("Wrong outputType", Output.class,
\r
938 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
939 getAction().getType());
\r
941 Assert.assertEquals("Wrong outputPort", 4351,
\r
942 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
943 getAction().getAugmentation(PortAction.class).
\r
944 getPort().getValue().intValue());
\r
946 Assert.assertEquals("Wrong outputMaxLen", 65535,
\r
947 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
948 getAction().getAugmentation(MaxLengthAction.class).
\r
949 getMaxLength().intValue());
\r
951 Assert.assertEquals("Wrong copyTtlOutType", CopyTtlOut.class,
\r
952 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
953 getAction().getType());
\r
955 Assert.assertEquals("Wrong copyTtlInType", CopyTtlIn.class,
\r
956 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
957 getAction().getType());
\r
961 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
962 * Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB
\r
965 public void testMultipartReplyGroupDescBody02(){
\r
966 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
970 "00 00 00 08 "+//groupId
\r
971 "00 38 "+//bucketLen
\r
972 "00 06 "+//bucketWeight
\r
973 "00 00 00 05 "+//bucketWatchPort
\r
974 "00 00 00 04 "+//bucketWatchGroup
\r
975 "00 00 00 00 "+//bucketPad
\r
976 "00 0F "+//setMplsTtlType
\r
977 "00 08 "+//setMplsTtlLen
\r
978 "09 "+//setMplsTtlMPLS_TTL
\r
979 "00 00 00 "+//setMplsTtlPad
\r
980 "00 10 "+//decMplsTtlType
\r
981 "00 08 "+//decMplsTtlLen
\r
982 "00 00 00 00 "+//decMplsTtlPad
\r
983 "00 11 "+//pushVlanType
\r
984 "00 08 "+//pushVlanLen
\r
985 "00 20 "+//pushVlanEthertype
\r
986 "00 00 "+//pushVlanPad
\r
987 "00 13 "+//pushMplsType
\r
988 "00 08 "+//pushMplsLen
\r
989 "00 FF "+//pushMplsEthertype
\r
990 "00 00 "+//pushMplsPad
\r
991 "00 1A "+//pushPbbType
\r
992 "00 08 "+//pushPbbLen
\r
993 "0F FF "+//pushPbbEthertype
\r
994 "00 00"//pushPbbPad
\r
997 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
999 BufferHelper.checkHeaderV13(builtByFactory);
\r
1000 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1001 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1003 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1005 Assert.assertEquals("Wrong type", 1,
\r
1006 message.getGroupDesc().get(0).getType().getIntValue());
\r
1007 Assert.assertEquals("Wrong groupId", 8,
\r
1008 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1009 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1010 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1011 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1012 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1013 getValue().intValue());
\r
1014 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1015 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1018 Assert.assertEquals("Wrong setMplsTtlType", SetMplsTtl.class,
\r
1019 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1020 getAction().getType());
\r
1022 Assert.assertEquals("Wrong setMplsTtlMPLS_TTL", 9,
\r
1023 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1024 getAction().getAugmentation(MplsTtlAction.class).
\r
1025 getMplsTtl().intValue());
\r
1027 Assert.assertEquals("Wrong decMplsTtlType", DecMplsTtl.class,
\r
1028 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1029 getAction().getType());
\r
1031 Assert.assertEquals("Wrong pushVlanType", PushVlan.class,
\r
1032 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1033 getAction().getType());
\r
1035 Assert.assertEquals("Wrong pushVlanEthertype", 32,
\r
1036 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1037 getAction().getAugmentation(EthertypeAction.class).
\r
1038 getEthertype().getValue().intValue());
\r
1040 Assert.assertEquals("Wrong pushMplsType", PushMpls.class,
\r
1041 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1042 getAction().getType());
\r
1044 Assert.assertEquals("Wrong pushMplsEthertype", 255,
\r
1045 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1046 getAction().getAugmentation(EthertypeAction.class).
\r
1047 getEthertype().getValue().intValue());
\r
1049 Assert.assertEquals("Wrong pushPbbType", PushPbb.class,
\r
1050 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1051 getAction().getType());
\r
1053 Assert.assertEquals("Wrong pushPbbEthertype", 4095,
\r
1054 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1055 getAction().getAugmentation(EthertypeAction.class).
\r
1056 getEthertype().getValue().intValue());
\r
1061 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
1062 * Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL
\r
1065 public void testMultipartReplyGroupDescBody03(){
\r
1066 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
1070 "00 00 00 08 "+//groupId
\r
1071 "00 40 "+//bucketLen
\r
1072 "00 06 "+//bucketWeight
\r
1073 "00 00 00 05 "+//bucketWatchPort
\r
1074 "00 00 00 04 "+//bucketWatchGroup
\r
1075 "00 00 00 00 "+//bucketPad
\r
1076 "00 12 "+//popVlanType
\r
1077 "00 08 "+//popVlanLen
\r
1078 "00 00 00 00 "+//popVlanPad
\r
1079 "00 1B "+//popPbbType
\r
1080 "00 08 "+//popPbbLen
\r
1081 "00 00 00 00 "+//popPbbPad
\r
1082 "00 14 "+//popMplsType
\r
1083 "00 08 "+//popMplsLen
\r
1084 "00 CF "+//popMplsEthertype
\r
1085 "00 00 "+//popMplsPad
\r
1086 "00 15 "+//setQueueType
\r
1087 "00 08 "+//setQueueLen
\r
1088 "00 CF 00 00 "+//setQueueQueueId
\r
1089 "00 16 "+//groupType
\r
1090 "00 08 "+//groupLen
\r
1091 "00 CF 00 00 "+//groupGroupId
\r
1092 "00 18 "+//decNwTtlType
\r
1093 "00 08 "+//decNwTtlLen
\r
1094 "00 00 00 00"//decNwTtlPad
\r
1097 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
1099 BufferHelper.checkHeaderV13(builtByFactory);
\r
1100 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1101 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1103 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1105 Assert.assertEquals("Wrong type", 1,
\r
1106 message.getGroupDesc().get(0).getType().getIntValue());
\r
1107 Assert.assertEquals("Wrong groupId", 8,
\r
1108 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1109 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1110 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1111 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1112 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1113 getValue().intValue());
\r
1114 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1115 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1117 Assert.assertEquals("Wrong popVlanType", PopVlan.class,
\r
1118 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1119 getAction().getType());
\r
1121 Assert.assertEquals("Wrong popPbbType", PopPbb.class,
\r
1122 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1123 getAction().getType());
\r
1125 Assert.assertEquals("Wrong popMplsType", PopMpls.class,
\r
1126 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1127 getAction().getType());
\r
1129 Assert.assertEquals("Wrong popMplsEthertype", 207,
\r
1130 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1131 getAction().getAugmentation(EthertypeAction.class).
\r
1132 getEthertype().getValue().intValue());
\r
1134 Assert.assertEquals("Wrong setQueueType", SetQueue.class,
\r
1135 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1136 getAction().getType());
\r
1138 Assert.assertEquals("Wrong setQueueQueueId", 13565952,
\r
1139 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1140 getAction().getAugmentation(QueueIdAction.class).
\r
1141 getQueueId().intValue());
\r
1143 Assert.assertEquals("Wrong groupType", Group.class,
\r
1144 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1145 getAction().getType());
\r
1147 Assert.assertEquals("Wrong groupGroupId", 13565952,
\r
1148 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1149 getAction().getAugmentation(GroupIdAction.class).
\r
1150 getGroupId().intValue());
\r
1152 Assert.assertEquals("Wrong decNwTtlType", DecNwTtl.class,
\r
1153 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(5).
\r
1154 getAction().getType());
\r
1158 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
1159 * Test covers bodies of actions NW TTL, Experimenter
\r
1162 public void testMultipartReplyGroupDescBody04(){
\r
1163 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
1167 "00 00 00 08 "+//groupId
\r
1168 "00 28 "+//bucketLen
\r
1169 "00 06 "+//bucketWeight
\r
1170 "00 00 00 05 "+//bucketWatchPort
\r
1171 "00 00 00 04 "+//bucketWatchGroup
\r
1172 "00 00 00 00 "+//bucketPad
\r
1173 "00 17 "+//nwTTlType
\r
1174 "00 08 "+//nwTTlLen
\r
1175 "0E "+//nwTTlnwTTL
\r
1176 "00 00 00 "+//nwTTlPad
\r
1177 "00 19 "+//setFieldType
\r
1178 "00 10 "+//setFieldLen
\r
1179 "80 00 "+//setFieldOXMClass
\r
1180 "00 "+//setFieldOXMField
\r
1181 "04 "+//setFieldOXMLength
\r
1182 "00 00 00 FF "+ //setFieldPort
\r
1186 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
1188 BufferHelper.checkHeaderV13(builtByFactory);
\r
1189 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1190 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1192 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1194 Assert.assertEquals("Wrong type", 1,
\r
1195 message.getGroupDesc().get(0).getType().getIntValue());
\r
1196 Assert.assertEquals("Wrong groupId", 8,
\r
1197 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1198 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1199 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1200 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1201 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1202 getValue().intValue());
\r
1203 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1204 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1206 Assert.assertEquals("Wrong nwTTlType", SetNwTtl.class,
\r
1207 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1208 getAction().getType());
\r
1210 Assert.assertEquals("Wrong nwTTlnwTTL", 14,
\r
1211 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1212 getAction().getAugmentation(NwTtlAction.class).getNwTtl().intValue());
\r
1214 Assert.assertEquals("Wrong setFieldType", SetField.class,
\r
1215 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1216 getAction().getType());
\r
1218 Assert.assertEquals("Wrong setFieldOXMClass", OpenflowBasicClass.class,
\r
1219 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1220 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmClass());
\r
1222 Assert.assertEquals("Wrong setFieldOXMField", InPort.class,
\r
1223 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1224 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmMatchField());
\r
1226 Assert.assertEquals("Wrong setFieldOXMValue", 255,
\r
1227 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1228 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).
\r
1229 getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
\r