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.ExperimenterAction;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
\r
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
\r
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
\r
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
\r
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
\r
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
\r
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
\r
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
\r
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
\r
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
\r
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
\r
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
\r
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
\r
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
\r
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
\r
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
\r
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
\r
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
\r
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
\r
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
\r
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
\r
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
\r
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
\r
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
\r
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
\r
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
\r
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
\r
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
\r
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
\r
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
\r
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
\r
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDrop;
\r
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemark;
\r
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenter;
\r
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregate;
\r
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDesc;
\r
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenter;
\r
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlow;
\r
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroup;
\r
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc;
\r
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeter;
\r
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig;
\r
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeatures;
\r
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDesc;
\r
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStats;
\r
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueue;
\r
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTable;
\r
67 * @author timotej.kubas
\r
68 * @author michal.polkorab
\r
70 public class MultipartReplyMessageFactoryTest {
\r
73 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
77 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 01 02 03 04");
\r
78 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
80 BufferHelper.checkHeaderV13(builtByFactory);
\r
82 Assert.assertEquals("Wrong type", 0x07, builtByFactory.getType().getIntValue());
\r
83 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
84 //Assert.assertArrayEquals("Wrong body", new byte[]{0x01, 0x02, 0x03, 0x04}, builtByFactory.getBody());
\r
88 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
91 public void testMultipartReplyDescBody(){
\r
92 final int DESC_STR_LEN = 256;
\r
93 final int SERIAL_NUM_LEN = 32;
\r
94 ByteBuf bb = BufferHelper.buildBuffer("00 00 00 01 00 00 00 00");
\r
96 String mfrDesc = "Manufacturer description";
\r
97 byte[] mfrDescBytes = new byte[256];
\r
98 mfrDescBytes = mfrDesc.getBytes();
\r
99 bb.writeBytes(mfrDescBytes);
\r
100 ByteBufUtils.padBuffer((DESC_STR_LEN - mfrDescBytes.length), bb);
\r
102 String hwDesc = "Hardware description";
\r
103 byte[] hwDescBytes = new byte[256];
\r
104 hwDescBytes = hwDesc.getBytes();
\r
105 bb.writeBytes(hwDescBytes);
\r
106 ByteBufUtils.padBuffer((DESC_STR_LEN - hwDescBytes.length), bb);
\r
108 String swDesc = "Software description";
\r
109 byte[] swDescBytes = new byte[256];
\r
110 swDescBytes = swDesc.getBytes();
\r
111 bb.writeBytes(swDescBytes);
\r
112 ByteBufUtils.padBuffer((DESC_STR_LEN - swDescBytes.length), bb);
\r
114 String serialNum = "SN0123456789";
\r
115 byte[] serialNumBytes = new byte[32];
\r
116 serialNumBytes = serialNum.getBytes();
\r
117 bb.writeBytes(serialNumBytes);
\r
118 ByteBufUtils.padBuffer((SERIAL_NUM_LEN - serialNumBytes.length), bb);
\r
120 String dpDesc = "switch3 in room 3120";
\r
121 byte[] dpDescBytes = new byte[256];
\r
122 dpDescBytes = dpDesc.getBytes();
\r
123 bb.writeBytes(dpDescBytes);
\r
124 ByteBufUtils.padBuffer((DESC_STR_LEN - dpDescBytes.length), bb);
\r
126 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
128 BufferHelper.checkHeaderV13(builtByFactory);
\r
129 Assert.assertEquals("Wrong type", 0x00, builtByFactory.getType().getIntValue());
\r
130 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
131 MultipartReplyDesc message = (MultipartReplyDesc) builtByFactory.getMultipartReplyBody();
\r
132 Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());
\r
133 Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());
\r
134 Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());
\r
135 Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());
\r
136 Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());
\r
140 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
143 public void testMultipartReplyFlowBody(){
\r
144 ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+
\r
148 "00 00 00 09 "+//durationSec
\r
149 "00 00 00 07 "+//durationNsec
\r
150 "00 0C "+//priority
\r
151 "00 0E "+//idleTimeout
\r
152 "00 0F "+//hardTimeout
\r
154 "00 00 00 00 "+//pad_02
\r
155 "00 01 01 01 01 01 01 01 "+//cookie
\r
156 "00 01 01 01 01 01 01 01 "+//packetCount
\r
157 "00 01 01 01 01 01 01 01"//byteCount
\r
160 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
162 BufferHelper.checkHeaderV13(builtByFactory);
\r
163 Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
\r
164 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
165 MultipartReplyFlow message = (MultipartReplyFlow) builtByFactory.getMultipartReplyBody();
\r
166 Assert.assertEquals("Wrong tableId", 8, message.getFlowStats().get(0).getTableId().intValue());
\r
167 Assert.assertEquals("Wrong durationSec", 9, message.getFlowStats().get(0).getDurationSec().intValue());
\r
168 Assert.assertEquals("Wrong durationNsec", 7, message.getFlowStats().get(0).getDurationNsec().intValue());
\r
169 Assert.assertEquals("Wrong priority", 12, message.getFlowStats().get(0).getPriority().intValue());
\r
170 Assert.assertEquals("Wrong idleTimeOut", 14, message.getFlowStats().get(0).getIdleTimeout().intValue());
\r
171 Assert.assertEquals("Wrong hardTimeOut", 15, message.getFlowStats().get(0).getHardTimeout().intValue());
\r
172 Assert.assertEquals("Wrong flags", new FlowModFlags(true, false, true, false, true),
\r
173 message.getFlowStats().get(0).getFlags());
\r
174 Assert.assertEquals("Wrong cookie",
\r
175 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
176 message.getFlowStats().get(0).getCookie());
\r
177 Assert.assertEquals("Wrong packetCount",
\r
178 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
179 message.getFlowStats().get(0).getPacketCount());
\r
180 Assert.assertEquals("Wrong byteCount",
\r
181 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
182 message.getFlowStats().get(0).getByteCount());
\r
186 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
189 public void testMultipartReplyAggregateBody(){
\r
190 ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 "+
\r
191 "00 01 01 01 01 01 01 01 "+//packetCount
\r
192 "00 01 01 01 01 01 01 01 "+//byteCount
\r
193 "00 00 00 08 "+//flowCount
\r
197 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
199 BufferHelper.checkHeaderV13(builtByFactory);
\r
200 Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
\r
201 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
202 MultipartReplyAggregate message = (MultipartReplyAggregate) builtByFactory.getMultipartReplyBody();
\r
203 Assert.assertEquals("Wrong packetCount",
\r
204 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
205 message.getPacketCount());
\r
206 Assert.assertEquals("Wrong byteCount",
\r
207 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
208 message.getByteCount());
\r
209 Assert.assertEquals("Wrong flowCount",
\r
211 message.getFlowCount().intValue());
\r
215 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
218 public void testMultipartReplyTableBody(){
\r
219 ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 00 00 00 00 "+
\r
222 "00 00 00 10 "+//activeCount
\r
223 "00 01 01 01 01 01 01 01 "+//lookupCount
\r
224 "00 01 01 01 01 01 01 01"//matchedCount
\r
227 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
229 BufferHelper.checkHeaderV13(builtByFactory);
\r
230 Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
\r
231 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
233 MultipartReplyTable message = (MultipartReplyTable) builtByFactory.getMultipartReplyBody();
\r
234 Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
\r
235 Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
\r
236 Assert.assertEquals("Wrong lookupCount",
\r
237 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
238 message.getTableStats().get(0).getLookupCount());
\r
239 Assert.assertEquals("Wrong matchedCount",
\r
240 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
241 message.getTableStats().get(0).getMatchedCount());
\r
245 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
248 public void testMultipartReplyPortStatsBody(){
\r
249 ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 00 00 00 00 "+
\r
250 "00 00 00 FF "+//portNo
\r
251 "00 00 00 00 "+//pad
\r
252 "00 01 01 01 01 01 01 01 "+//rxPackets
\r
253 "00 02 02 02 02 02 02 02 "+//txPackets
\r
254 "00 02 03 02 03 02 03 02 "+//rxBytes
\r
255 "00 02 03 02 03 02 03 02 "+//txBytes
\r
256 "00 02 03 02 03 02 03 02 "+//rxDropped
\r
257 "00 02 03 02 03 02 03 02 "+//txDropped
\r
258 "00 02 03 02 03 02 03 02 "+//rxErrors
\r
259 "00 02 03 02 03 02 03 02 "+//txErrors
\r
260 "00 02 03 02 03 02 03 02 "+//rxFrameErr
\r
261 "00 02 03 02 03 02 03 02 "+//rxOverErr
\r
262 "00 02 03 02 03 02 03 02 "+//rxCrcErr
\r
263 "00 02 03 02 03 02 03 02 "+//collisions
\r
264 "00 00 00 02 "+//durationSec
\r
265 "00 00 00 04"//durationNsec
\r
268 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
270 BufferHelper.checkHeaderV13(builtByFactory);
\r
271 Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());
\r
272 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
274 MultipartReplyPortStats message = (MultipartReplyPortStats) builtByFactory.getMultipartReplyBody();
\r
276 Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());
\r
277 Assert.assertEquals("Wrong rxPackets",
\r
278 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
279 message.getPortStats().get(0).getRxPackets());
\r
280 Assert.assertEquals("Wrong txPackets",
\r
281 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
282 message.getPortStats().get(0).getTxPackets());
\r
283 Assert.assertEquals("Wrong rxBytes",
\r
284 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
285 message.getPortStats().get(0).getRxBytes());
\r
286 Assert.assertEquals("Wrong txBytes",
\r
287 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
288 message.getPortStats().get(0).getTxBytes());
\r
289 Assert.assertEquals("Wrong rxDropped",
\r
290 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
291 message.getPortStats().get(0).getRxDropped());
\r
292 Assert.assertEquals("Wrong txDropped",
\r
293 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
294 message.getPortStats().get(0).getTxDropped());
\r
295 Assert.assertEquals("Wrong rxErrors",
\r
296 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
297 message.getPortStats().get(0).getRxErrors());
\r
298 Assert.assertEquals("Wrong txErrors",
\r
299 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
300 message.getPortStats().get(0).getTxErrors());
\r
301 Assert.assertEquals("Wrong rxFrameErr",
\r
302 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
303 message.getPortStats().get(0).getRxFrameErr());
\r
304 Assert.assertEquals("Wrong rxOverErr",
\r
305 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
306 message.getPortStats().get(0).getRxOverErr());
\r
307 Assert.assertEquals("Wrong rxCrcErr",
\r
308 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
309 message.getPortStats().get(0).getRxCrcErr());
\r
310 Assert.assertEquals("Wrong collisions",
\r
311 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
312 message.getPortStats().get(0).getCollisions());
\r
313 Assert.assertEquals("Wrong durationSec", 2, message.getPortStats().get(0).getDurationSec().intValue());
\r
314 Assert.assertEquals("Wrong durationNsec", 4, message.getPortStats().get(0).getDurationNsec().intValue());
\r
318 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
321 public void testMultipartReplyQueueBody(){
\r
322 ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 "+
\r
323 "00 00 00 FF "+//portNo
\r
324 "00 00 00 10 "+//queueId
\r
325 "00 02 03 02 03 02 03 02 "+//txBytes
\r
326 "00 02 02 02 02 02 02 02 "+//txPackets
\r
327 "00 02 03 02 03 02 03 02 "+//txErrors
\r
328 "00 00 00 02 "+//durationSec
\r
329 "00 00 00 04"//durationNsec
\r
332 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
334 BufferHelper.checkHeaderV13(builtByFactory);
\r
335 Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());
\r
336 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
338 MultipartReplyQueue message = (MultipartReplyQueue) builtByFactory.getMultipartReplyBody();
\r
340 Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
\r
341 Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
\r
342 Assert.assertEquals("Wrong txBytes",
\r
343 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
344 message.getQueueStats().get(0).getTxBytes());
\r
345 Assert.assertEquals("Wrong txPackets",
\r
346 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
347 message.getQueueStats().get(0).getTxPackets());
\r
348 Assert.assertEquals("Wrong txErrors",
\r
349 new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
\r
350 message.getQueueStats().get(0).getTxErrors());
\r
351 Assert.assertEquals("Wrong durationSec", 2, message.getQueueStats().get(0).getDurationSec().intValue());
\r
352 Assert.assertEquals("Wrong durationNsec", 4, message.getQueueStats().get(0).getDurationNsec().intValue());
\r
356 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
359 public void testMultipartReplyGroupBody(){
\r
360 ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 "+
\r
363 "00 00 00 10 "+//groupId
\r
364 "00 00 00 12 "+//refCount
\r
365 "00 00 00 00 "+//pad2
\r
366 "00 01 01 01 01 01 01 01 "+//packetCount
\r
367 "00 01 01 01 01 01 01 01 "+//byteCount
\r
368 "00 00 00 08 "+//durationSec
\r
369 "00 00 00 09 "+//durationNsec
\r
370 "00 01 01 01 01 01 01 01 "+//packetCountBucket
\r
371 "00 01 01 01 01 01 01 01 "+//byteCountBucket
\r
372 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2
\r
373 "00 02 02 02 02 02 02 02 "+//byteCountBucket_2
\r
374 "00 48 "+//length_2
\r
376 "00 00 00 10 "+//groupId_2
\r
377 "00 00 00 12 "+//refCount_2
\r
378 "00 00 00 00 "+//pad2.2
\r
379 "00 01 01 01 01 01 01 01 "+//packetCount_2
\r
380 "00 01 01 01 01 01 01 01 "+//byteCount_2
\r
381 "00 00 00 08 "+//durationSec_2
\r
382 "00 00 00 09 "+//durationNsec_2
\r
383 "00 01 01 01 01 01 01 01 "+//packetCountBucket_1.2
\r
384 "00 01 01 01 01 01 01 01 "+//byteCountBucket_1.2
\r
385 "00 02 02 02 02 02 02 02 "+//packetCountBucket_2.2
\r
386 "00 02 02 02 02 02 02 02"//byteCountBucket_2.2
\r
389 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
391 BufferHelper.checkHeaderV13(builtByFactory);
\r
392 Assert.assertEquals("Wrong type", 0x06, builtByFactory.getType().getIntValue());
\r
393 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
395 MultipartReplyGroup message = (MultipartReplyGroup) builtByFactory.getMultipartReplyBody();
\r
397 Assert.assertEquals("Wrong groupId", 16, message.getGroupStats().get(0).getGroupId().intValue());
\r
398 Assert.assertEquals("Wrong refCount", 18, message.getGroupStats().get(0).getRefCount().intValue());
\r
399 Assert.assertEquals("Wrong packetCount",
\r
400 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
401 message.getGroupStats().get(0).getPacketCount());
\r
402 Assert.assertEquals("Wrong byteCount",
\r
403 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
404 message.getGroupStats().get(0).getByteCount());
\r
405 Assert.assertEquals("Wrong durationSec", 8, message.getGroupStats().get(0).getDurationSec().intValue());
\r
406 Assert.assertEquals("Wrong durationNsec", 9, message.getGroupStats().get(0).getDurationNsec().intValue());
\r
407 Assert.assertEquals("Wrong packetCountBucket",
\r
408 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
409 message.getGroupStats().get(0).getBucketStats().get(0).getPacketCount());
\r
410 Assert.assertEquals("Wrong byteCountBucket",
\r
411 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
412 message.getGroupStats().get(0).getBucketStats().get(0).getByteCount());
\r
413 Assert.assertEquals("Wrong packetCountBucket_2",
\r
414 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
415 message.getGroupStats().get(0).getBucketStats().get(1).getPacketCount());
\r
416 Assert.assertEquals("Wrong byteCountBucket_2",
\r
417 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
418 message.getGroupStats().get(0).getBucketStats().get(1).getByteCount());
\r
420 Assert.assertEquals("Wrong groupId_2", 16, message.getGroupStats().get(1).getGroupId().intValue());
\r
421 Assert.assertEquals("Wrong refCount_2", 18, message.getGroupStats().get(1).getRefCount().intValue());
\r
422 Assert.assertEquals("Wrong packetCount_2",
\r
423 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
424 message.getGroupStats().get(1).getPacketCount());
\r
425 Assert.assertEquals("Wrong byteCount_2",
\r
426 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
427 message.getGroupStats().get(1).getByteCount());
\r
428 Assert.assertEquals("Wrong durationSec_2", 8, message.getGroupStats().get(1).getDurationSec().intValue());
\r
429 Assert.assertEquals("Wrong durationNsec_2", 9, message.getGroupStats().get(1).getDurationNsec().intValue());
\r
430 Assert.assertEquals("Wrong packetCountBucket_1.2",
\r
431 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
432 message.getGroupStats().get(1).getBucketStats().get(0).getPacketCount());
\r
433 Assert.assertEquals("Wrong byteCountBucket_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).getByteCount());
\r
436 Assert.assertEquals("Wrong packetCountBucket_2.2",
\r
437 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
438 message.getGroupStats().get(1).getBucketStats().get(1).getPacketCount());
\r
439 Assert.assertEquals("Wrong byteCountBucket_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).getByteCount());
\r
445 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
448 public void testMultipartReplyMeterFeaturesBody(){
\r
449 ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
\r
450 "00 00 00 09 "+//maxMeter
\r
451 "00 00 00 01 "+//bandTypes
\r
452 "00 00 00 03 "+//capabilities
\r
458 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
460 BufferHelper.checkHeaderV13(builtByFactory);
\r
461 Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
\r
462 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
464 MultipartReplyMeterFeatures message = (MultipartReplyMeterFeatures) builtByFactory.getMultipartReplyBody();
\r
466 Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());
\r
467 Assert.assertEquals("Wrong bandTypes", 1, message.getBandTypes().getIntValue());
\r
468 Assert.assertEquals("Wrong capabilities", new MeterFlags(false, true, true, false),
\r
469 message.getCapabilities());
\r
470 Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());
\r
471 Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());
\r
475 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
478 public void testMultipartReplyMeterBody(){
\r
479 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
\r
480 "00 00 00 09 "+//meterId
\r
482 "00 00 00 00 00 00 "+//pad
\r
483 "00 00 00 07 "+//flowCount
\r
484 "00 01 01 01 01 01 01 01 "+//packetInCount
\r
485 "00 01 01 01 01 01 01 01 "+//byteInCount
\r
486 "00 00 00 05 "+//durationSec
\r
487 "00 00 00 05 "+//durationNsec
\r
488 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
\r
489 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
\r
490 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
\r
491 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
\r
492 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
\r
493 "00 03 03 03 03 03 03 03"//byteBandCount_03
\r
496 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
498 BufferHelper.checkHeaderV13(builtByFactory);
\r
499 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
\r
500 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
502 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
\r
504 Assert.assertEquals("Wrong meterId", 9,
\r
505 message.getMeterStats().get(0).getMeterId().intValue());
\r
506 Assert.assertEquals("Wrong flowCount", 7,
\r
507 message.getMeterStats().get(0).getFlowCount().intValue());
\r
508 Assert.assertEquals("Wrong packetInCount",
\r
509 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
510 message.getMeterStats().get(0).getPacketInCount());
\r
511 Assert.assertEquals("Wrong byteInCount",
\r
512 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
513 message.getMeterStats().get(0).getByteInCount());
\r
514 Assert.assertEquals("Wrong durationSec", 5,
\r
515 message.getMeterStats().get(0).getDurationSec().intValue());
\r
516 Assert.assertEquals("Wrong durationNsec", 5,
\r
517 message.getMeterStats().get(0).getDurationNsec().intValue());
\r
518 Assert.assertEquals("Wrong packetBandCount_01",
\r
519 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
520 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
\r
521 Assert.assertEquals("Wrong byteBandCount_01",
\r
522 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
523 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
\r
524 Assert.assertEquals("Wrong packetBandCount_02",
\r
525 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
526 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
\r
527 Assert.assertEquals("Wrong byteBandCount_02",
\r
528 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
529 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
\r
530 Assert.assertEquals("Wrong packetBandCount_03",
\r
531 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
532 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
\r
533 Assert.assertEquals("Wrong byteBandCount_03",
\r
534 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
535 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
\r
539 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
542 public void testMultipartReplyMeterBodyMulti(){
\r
543 ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
\r
544 "00 00 00 09 "+//meterId_0
\r
546 "00 00 00 00 00 00 "+//pad_0
\r
547 "00 00 00 07 "+//flowCount_0
\r
548 "00 01 01 01 01 01 01 01 "+//packetInCount_0
\r
549 "00 01 01 01 01 01 01 01 "+//byteInCount_0
\r
550 "00 00 00 05 "+//durationSec_0
\r
551 "00 00 00 05 "+//durationNsec_0
\r
552 "00 01 01 01 01 01 01 01 "+//packetBandCount_01
\r
553 "00 01 01 01 01 01 01 01 "+//byteBandCount_01
\r
554 "00 02 02 02 02 02 02 02 "+//packetBandCount_02
\r
555 "00 02 02 02 02 02 02 02 "+//byteBandCount_02
\r
556 "00 03 03 03 03 03 03 03 "+//packetBandCount_03
\r
557 "00 03 03 03 03 03 03 03 "+//byteBandCount_03
\r
558 "00 00 00 08 "+//meterId_1
\r
560 "00 00 00 00 00 00 "+//pad_1
\r
561 "00 00 00 07 "+//flowCount_1
\r
562 "00 01 01 01 01 01 01 01 "+//packetInCount_1
\r
563 "00 01 01 01 01 01 01 01 "+//byteInCount_1
\r
564 "00 00 00 05 "+//durationSec_1
\r
565 "00 00 00 05 "+//durationNsec_1
\r
566 "00 01 01 01 01 01 01 01 "+//packetBandCount_11
\r
567 "00 01 01 01 01 01 01 01 "+//byteBandCount_11
\r
568 "00 02 02 02 02 02 02 02 "+//packetBandCount_12
\r
569 "00 02 02 02 02 02 02 02 "+//byteBandCount_12
\r
570 "00 03 03 03 03 03 03 03 "+//packetBandCount_13
\r
571 "00 03 03 03 03 03 03 03"//byteBandCount_13
\r
574 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
576 BufferHelper.checkHeaderV13(builtByFactory);
\r
577 Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
\r
578 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
580 MultipartReplyMeter message = (MultipartReplyMeter) builtByFactory.getMultipartReplyBody();
\r
582 Assert.assertEquals("Wrong meterId", 9,
\r
583 message.getMeterStats().get(0).getMeterId().intValue());
\r
584 Assert.assertEquals("Wrong flowCount", 7,
\r
585 message.getMeterStats().get(0).getFlowCount().intValue());
\r
586 Assert.assertEquals("Wrong packetInCount",
\r
587 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
588 message.getMeterStats().get(0).getPacketInCount());
\r
589 Assert.assertEquals("Wrong byteInCount",
\r
590 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
591 message.getMeterStats().get(0).getByteInCount());
\r
592 Assert.assertEquals("Wrong durationSec", 5,
\r
593 message.getMeterStats().get(0).getDurationSec().intValue());
\r
594 Assert.assertEquals("Wrong durationNsec", 5,
\r
595 message.getMeterStats().get(0).getDurationNsec().intValue());
\r
596 Assert.assertEquals("Wrong packetBandCount_01",
\r
597 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
598 message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
\r
599 Assert.assertEquals("Wrong byteBandCount_01",
\r
600 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
601 message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
\r
602 Assert.assertEquals("Wrong packetBandCount_02",
\r
603 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
604 message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
\r
605 Assert.assertEquals("Wrong byteBandCount_02",
\r
606 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
607 message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
\r
608 Assert.assertEquals("Wrong packetBandCount_03",
\r
609 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
610 message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
\r
611 Assert.assertEquals("Wrong byteBandCount_03",
\r
612 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
613 message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
\r
615 Assert.assertEquals("Wrong meterId", 8,
\r
616 message.getMeterStats().get(1).getMeterId().intValue());
\r
617 Assert.assertEquals("Wrong flowCount", 7,
\r
618 message.getMeterStats().get(1).getFlowCount().intValue());
\r
619 Assert.assertEquals("Wrong packetInCount",
\r
620 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
621 message.getMeterStats().get(1).getPacketInCount());
\r
622 Assert.assertEquals("Wrong byteInCount",
\r
623 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
624 message.getMeterStats().get(1).getByteInCount());
\r
625 Assert.assertEquals("Wrong durationSec", 5,
\r
626 message.getMeterStats().get(1).getDurationSec().intValue());
\r
627 Assert.assertEquals("Wrong durationNsec", 5,
\r
628 message.getMeterStats().get(1).getDurationNsec().intValue());
\r
629 Assert.assertEquals("Wrong packetBandCount_01",
\r
630 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
631 message.getMeterStats().get(1).getMeterBandStats().get(0).getPacketBandCount());
\r
632 Assert.assertEquals("Wrong byteBandCount_01",
\r
633 new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
\r
634 message.getMeterStats().get(1).getMeterBandStats().get(0).getByteBandCount());
\r
635 Assert.assertEquals("Wrong packetBandCount_02",
\r
636 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
637 message.getMeterStats().get(1).getMeterBandStats().get(1).getPacketBandCount());
\r
638 Assert.assertEquals("Wrong byteBandCount_02",
\r
639 new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
\r
640 message.getMeterStats().get(1).getMeterBandStats().get(1).getByteBandCount());
\r
641 Assert.assertEquals("Wrong packetBandCount_03",
\r
642 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
643 message.getMeterStats().get(1).getMeterBandStats().get(2).getPacketBandCount());
\r
644 Assert.assertEquals("Wrong byteBandCount_03",
\r
645 new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
\r
646 message.getMeterStats().get(1).getMeterBandStats().get(2).getByteBandCount());
\r
650 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
653 public void testMultipartReplyMeterConfigBody(){
\r
654 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
\r
657 "00 00 00 09 "+//meterId
\r
658 "00 01 "+//meterBandDrop.type
\r
659 "00 10 "+//meterBandDrop.len
\r
660 "00 00 00 11 "+//meterBandDrop.rate
\r
661 "00 00 00 20 "+//meterBandDrop.burstSize
\r
662 "00 00 00 00 "+//meterBandDrop.pad
\r
663 "00 02 "+//meterBandDscp.type
\r
664 "00 10 "+//meterBandDscp.len
\r
665 "00 00 00 11 "+//meterBandDscp.rate
\r
666 "00 00 00 20 "+//meterBandDscp.burstSize
\r
667 "04 "+//meterBandDscp.precLevel
\r
668 "00 00 00 "+//meterBandDscp.pad
\r
669 "FF FF "+//meterBandExperimenter.type
\r
670 "00 10 "+//meterBandExperimenter.len
\r
671 "00 00 00 11 "+//meterBandExperimenter.rate
\r
672 "00 00 00 20 "+//meterBandExperimenter.burstSize
\r
673 "00 00 00 04"//meterBandExperimenter.experimenter
\r
676 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
678 BufferHelper.checkHeaderV13(builtByFactory);
\r
679 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
\r
680 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
682 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
\r
684 Assert.assertEquals("Wrong flags", 1,
\r
685 message.getMeterConfig().get(0).getFlags().getIntValue());
\r
686 Assert.assertEquals("Wrong meterId", 9,
\r
687 message.getMeterConfig().get(0).getMeterId().intValue());
\r
689 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
\r
690 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
\r
691 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
\r
692 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
\r
694 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
\r
695 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
\r
696 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
\r
697 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
\r
698 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
\r
700 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
\r
701 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
\r
702 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
\r
703 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
\r
704 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
\r
708 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
711 public void testMultipartReplyMeterConfigBodyMulti(){
\r
712 ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
\r
715 "00 00 00 09 "+//meterId
\r
716 "00 01 "+//meterBandDrop.type
\r
717 "00 10 "+//meterBandDrop.len
\r
718 "00 00 00 11 "+//meterBandDrop.rate
\r
719 "00 00 00 20 "+//meterBandDrop.burstSize
\r
720 "00 00 00 00 "+//meterBandDrop.pad
\r
721 "00 02 "+//meterBandDscp.type
\r
722 "00 10 "+//meterBandDscp.len
\r
723 "00 00 00 11 "+//meterBandDscp.rate
\r
724 "00 00 00 20 "+//meterBandDscp.burstSize
\r
725 "04 "+//meterBandDscp.precLevel
\r
726 "00 00 00 "+//meterBandDscp.pad
\r
727 "FF FF "+//meterBandExperimenter.type
\r
728 "00 10 "+//meterBandExperimenter.len
\r
729 "00 00 00 11 "+//meterBandExperimenter.rate
\r
730 "00 00 00 20 "+//meterBandExperimenter.burstSize
\r
731 "00 00 00 04 "+//meterBandExperimenter.experimenter
\r
735 "00 00 00 07 "+//meterId01
\r
736 "00 02 "+//meterBandDscp01.type
\r
737 "00 10 "+//meterBandDscp01.len
\r
738 "00 00 00 11 "+//meterBandDscp01.rate
\r
739 "00 00 00 20 "+//meterBandDscp01.burstSize
\r
740 "04 "+//meterBandDscp01.precLevel
\r
741 "00 00 00"//meterBandDscp01.pad
\r
744 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
746 BufferHelper.checkHeaderV13(builtByFactory);
\r
747 Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
\r
748 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
750 MultipartReplyMeterConfig message = (MultipartReplyMeterConfig) builtByFactory.getMultipartReplyBody();
\r
752 Assert.assertEquals("Wrong flags", 1,
\r
753 message.getMeterConfig().get(0).getFlags().getIntValue());
\r
754 Assert.assertEquals("Wrong meterId", 9,
\r
755 message.getMeterConfig().get(0).getMeterId().intValue());
\r
757 MeterBandDrop meterBandDrop = (MeterBandDrop) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
\r
758 Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
\r
759 Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
\r
760 Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
\r
762 MeterBandDscpRemark meterBandDscp = (MeterBandDscpRemark) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
\r
763 Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
\r
764 Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
\r
765 Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
\r
766 Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
\r
768 MeterBandExperimenter meterBandExperimenter = (MeterBandExperimenter) message.getMeterConfig().get(0).getBands().get(2).getMeterBand();
\r
769 Assert.assertEquals("Wrong meterBandExperimenter.type", 0xFFFF, meterBandExperimenter.getType().getIntValue());
\r
770 Assert.assertEquals("Wrong meterBandExperimenter.rate", 17, meterBandExperimenter.getRate().intValue());
\r
771 Assert.assertEquals("Wrong meterBandExperimenter.burstSize", 32, meterBandExperimenter.getBurstSize().intValue());
\r
772 Assert.assertEquals("Wrong meterBandExperimenter.experimenter", 4, meterBandExperimenter.getExperimenter().intValue());
\r
774 Assert.assertEquals("Wrong flags01", 1,
\r
775 message.getMeterConfig().get(0).getFlags().getIntValue());
\r
776 Assert.assertEquals("Wrong meterId01", 7,
\r
777 message.getMeterConfig().get(1).getMeterId().intValue());
\r
779 MeterBandDscpRemark meterBandDscp01 = (MeterBandDscpRemark) message.getMeterConfig().get(1).getBands().get(0).getMeterBand();
\r
780 Assert.assertEquals("Wrong meterBandDscp01.type", 2, meterBandDscp01.getType().getIntValue());
\r
781 Assert.assertEquals("Wrong meterBandDscp01.rate", 17, meterBandDscp01.getRate().intValue());
\r
782 Assert.assertEquals("Wrong meterBandDscp01.burstSize", 32, meterBandDscp01.getBurstSize().intValue());
\r
783 Assert.assertEquals("Wrong meterBandDscp01.precLevel", 4, meterBandDscp01.getPrecLevel().intValue());
\r
788 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
791 public void testMultipartReplyExperimenterBody(){
\r
792 ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "+
\r
793 "00 00 00 0F "+//experimenterId
\r
794 "00 00 00 FF "+//expType
\r
795 "00 00 01 01 00 00 01 01"
\r
798 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
800 BufferHelper.checkHeaderV13(builtByFactory);
\r
801 Assert.assertEquals("Wrong type", 0xFFFF, builtByFactory.getType().getIntValue());
\r
802 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
804 MultipartReplyExperimenter message = (MultipartReplyExperimenter) builtByFactory.getMultipartReplyBody();
\r
806 Assert.assertEquals("Wrong experimenterId", 15, message.getExperimenter().intValue());
\r
807 Assert.assertEquals("Wrong expType", 255, message.getExpType().intValue());
\r
808 Assert.assertArrayEquals("Wrong data", new byte[]{0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01},
\r
809 message.getData());
\r
813 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
816 public void testMultipartReplyPortDescBody(){
\r
817 final byte MAX_PORT_NAME_LEN = 16;
\r
818 ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 01 00 00 00 00 "+
\r
819 "00 01 02 03 "+ //portNo
\r
820 "00 00 00 00 "+ //padding01
\r
821 "08 00 27 00 B0 EB " + //mac address
\r
822 "00 00 "); //padding02
\r
824 String portName = "SampleText";
\r
825 byte[] portNameBytes = new byte[MAX_PORT_NAME_LEN];
\r
826 portNameBytes = portName.getBytes();
\r
827 bb.writeBytes(portNameBytes);
\r
828 ByteBufUtils.padBuffer((MAX_PORT_NAME_LEN - portNameBytes.length), bb);
\r
830 ByteBuf bb2 = BufferHelper.buildBuffer("00 00 00 41 " + //port config
\r
831 "00 00 00 05 " + //port state
\r
832 "00 00 00 81 " + //current features
\r
833 "00 00 00 81 " + //advertised features
\r
834 "00 00 00 81 " + //supported features
\r
835 "00 00 00 81 " + //peer features
\r
836 "00 00 00 81 " + //curr speed
\r
837 "00 00 00 80" //max speed
\r
839 bb.writeBytes(bb2.copy(4, bb2.readableBytes()-4));//excluding version and xid
\r
841 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
843 BufferHelper.checkHeaderV13(builtByFactory);
\r
844 Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
\r
845 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
847 MultipartReplyPortDesc message = (MultipartReplyPortDesc) builtByFactory.getMultipartReplyBody();
\r
849 Assert.assertEquals("Wrong portNo", 66051L, message.getPorts().get(0).getPortNo().longValue());
\r
850 Assert.assertEquals("Wrong macAddress", new MacAddress("08002700B0EB"),
\r
851 message.getPorts().get(0).getHwAddr());
\r
852 Assert.assertEquals("Wrong portName", "SampleText",
\r
853 message.getPorts().get(0).getName());
\r
854 Assert.assertEquals("Wrong portConfig", new PortConfig(false, true, false, true),
\r
855 message.getPorts().get(0).getConfig());
\r
856 Assert.assertEquals("Wrong portState", new PortState(true, false, true),
\r
857 message.getPorts().get(0).getState());
\r
858 Assert.assertEquals("Wrong currentFeatures", new PortFeatures(true, false, false, false,
\r
859 false, false, false, true,
\r
860 false, false, false, false,
\r
861 false, false, false, false),
\r
862 message.getPorts().get(0).getCurrentFeatures());
\r
863 Assert.assertEquals("Wrong advertisedFeatures",
\r
864 new PortFeatures(true, false, false, false,
\r
865 false, false, false, true,
\r
866 false, false, false, false,
\r
867 false, false, false, false),
\r
868 message.getPorts().get(0).getAdvertisedFeatures());
\r
869 Assert.assertEquals("Wrong supportedFeatures",
\r
870 new PortFeatures(true, false, false, false,
\r
871 false, false, false, true,
\r
872 false, false, false, false,
\r
873 false, false, false, false),
\r
874 message.getPorts().get(0).getSupportedFeatures());
\r
875 Assert.assertEquals("Wrong peerFeatures",
\r
876 new PortFeatures(true, false, false, false,
\r
877 false, false, false, true,
\r
878 false, false, false, false,
\r
879 false, false, false, false),
\r
880 message.getPorts().get(0).getPeerFeatures());
\r
881 Assert.assertEquals("Wrong currSpeed", 129L, message.getPorts().get(0).getCurrSpeed().longValue());
\r
882 Assert.assertEquals("Wrong maxSpeed", 128L, message.getPorts().get(0).getMaxSpeed().longValue());
\r
886 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
887 * Test covers bodies of actions Output, Copy TTL Out, Copy TTL In
\r
890 public void testMultipartReplyGroupDescBody01(){
\r
891 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
895 "00 00 00 08 "+//groupId
\r
896 "00 30 "+//bucketLen
\r
897 "00 06 "+//bucketWeight
\r
898 "00 00 00 05 "+//bucketWatchPort
\r
899 "00 00 00 04 "+//bucketWatchGroup
\r
900 "00 00 00 00 "+//bucketPad
\r
901 "00 00 "+//outputType
\r
902 "00 10 "+//outputLen
\r
903 "00 00 10 FF "+//outputPort
\r
904 "FF FF "+//outputMaxLen
\r
905 "00 00 00 00 00 00 "+//outputPad
\r
906 "00 0B "+//copyTTLOutType
\r
907 "00 08 "+//copyTTLOutLen
\r
908 "00 00 00 00 "+//copyTTLOutPad
\r
909 "00 0C "+//copyTTLIntType
\r
910 "00 08 "+//copyTTLIntLen
\r
911 "00 00 00 00"//copyTTLInPad
\r
914 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
916 BufferHelper.checkHeaderV13(builtByFactory);
\r
917 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
918 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
920 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
922 Assert.assertEquals("Wrong type", 1,
\r
923 message.getGroupDesc().get(0).getType().getIntValue());
\r
924 Assert.assertEquals("Wrong groupId", 8,
\r
925 message.getGroupDesc().get(0).getGroupId().intValue());
\r
926 Assert.assertEquals("Wrong bucketWeight", 6,
\r
927 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
928 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
929 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
930 getValue().intValue());
\r
931 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
932 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
934 Assert.assertEquals("Wrong outputType", Output.class,
\r
935 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
936 getAction().getType());
\r
938 Assert.assertEquals("Wrong outputPort", 4351,
\r
939 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
940 getAction().getAugmentation(PortAction.class).
\r
941 getPort().getValue().intValue());
\r
943 Assert.assertEquals("Wrong outputMaxLen", 65535,
\r
944 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
945 getAction().getAugmentation(MaxLengthAction.class).
\r
946 getMaxLength().intValue());
\r
948 Assert.assertEquals("Wrong copyTtlOutType", CopyTtlOut.class,
\r
949 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
950 getAction().getType());
\r
952 Assert.assertEquals("Wrong copyTtlInType", CopyTtlIn.class,
\r
953 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
954 getAction().getType());
\r
958 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
959 * Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB
\r
962 public void testMultipartReplyGroupDescBody02(){
\r
963 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
967 "00 00 00 08 "+//groupId
\r
968 "00 38 "+//bucketLen
\r
969 "00 06 "+//bucketWeight
\r
970 "00 00 00 05 "+//bucketWatchPort
\r
971 "00 00 00 04 "+//bucketWatchGroup
\r
972 "00 00 00 00 "+//bucketPad
\r
973 "00 0F "+//setMplsTtlType
\r
974 "00 08 "+//setMplsTtlLen
\r
975 "09 "+//setMplsTtlMPLS_TTL
\r
976 "00 00 00 "+//setMplsTtlPad
\r
977 "00 10 "+//decMplsTtlType
\r
978 "00 08 "+//decMplsTtlLen
\r
979 "00 00 00 00 "+//decMplsTtlPad
\r
980 "00 11 "+//pushVlanType
\r
981 "00 08 "+//pushVlanLen
\r
982 "00 20 "+//pushVlanEthertype
\r
983 "00 00 "+//pushVlanPad
\r
984 "00 13 "+//pushMplsType
\r
985 "00 08 "+//pushMplsLen
\r
986 "00 FF "+//pushMplsEthertype
\r
987 "00 00 "+//pushMplsPad
\r
988 "00 1A "+//pushPbbType
\r
989 "00 08 "+//pushPbbLen
\r
990 "0F FF "+//pushPbbEthertype
\r
991 "00 00"//pushPbbPad
\r
994 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
996 BufferHelper.checkHeaderV13(builtByFactory);
\r
997 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
998 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1000 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1002 Assert.assertEquals("Wrong type", 1,
\r
1003 message.getGroupDesc().get(0).getType().getIntValue());
\r
1004 Assert.assertEquals("Wrong groupId", 8,
\r
1005 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1006 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1007 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1008 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1009 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1010 getValue().intValue());
\r
1011 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1012 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1015 Assert.assertEquals("Wrong setMplsTtlType", SetMplsTtl.class,
\r
1016 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1017 getAction().getType());
\r
1019 Assert.assertEquals("Wrong setMplsTtlMPLS_TTL", 9,
\r
1020 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1021 getAction().getAugmentation(MplsTtlAction.class).
\r
1022 getMplsTtl().intValue());
\r
1024 Assert.assertEquals("Wrong decMplsTtlType", DecMplsTtl.class,
\r
1025 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1026 getAction().getType());
\r
1028 Assert.assertEquals("Wrong pushVlanType", PushVlan.class,
\r
1029 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1030 getAction().getType());
\r
1032 Assert.assertEquals("Wrong pushVlanEthertype", 32,
\r
1033 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1034 getAction().getAugmentation(EthertypeAction.class).
\r
1035 getEthertype().getValue().intValue());
\r
1037 Assert.assertEquals("Wrong pushMplsType", PushMpls.class,
\r
1038 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1039 getAction().getType());
\r
1041 Assert.assertEquals("Wrong pushMplsEthertype", 255,
\r
1042 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1043 getAction().getAugmentation(EthertypeAction.class).
\r
1044 getEthertype().getValue().intValue());
\r
1046 Assert.assertEquals("Wrong pushPbbType", PushPbb.class,
\r
1047 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1048 getAction().getType());
\r
1050 Assert.assertEquals("Wrong pushPbbEthertype", 4095,
\r
1051 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1052 getAction().getAugmentation(EthertypeAction.class).
\r
1053 getEthertype().getValue().intValue());
\r
1058 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
1059 * Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL
\r
1062 public void testMultipartReplyGroupDescBody03(){
\r
1063 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
1067 "00 00 00 08 "+//groupId
\r
1068 "00 40 "+//bucketLen
\r
1069 "00 06 "+//bucketWeight
\r
1070 "00 00 00 05 "+//bucketWatchPort
\r
1071 "00 00 00 04 "+//bucketWatchGroup
\r
1072 "00 00 00 00 "+//bucketPad
\r
1073 "00 12 "+//popVlanType
\r
1074 "00 08 "+//popVlanLen
\r
1075 "00 00 00 00 "+//popVlanPad
\r
1076 "00 1B "+//popPbbType
\r
1077 "00 08 "+//popPbbLen
\r
1078 "00 00 00 00 "+//popPbbPad
\r
1079 "00 14 "+//popMplsType
\r
1080 "00 08 "+//popMplsLen
\r
1081 "00 CF "+//popMplsEthertype
\r
1082 "00 00 "+//popMplsPad
\r
1083 "00 15 "+//setQueueType
\r
1084 "00 08 "+//setQueueLen
\r
1085 "00 CF 00 00 "+//setQueueQueueId
\r
1086 "00 16 "+//groupType
\r
1087 "00 08 "+//groupLen
\r
1088 "00 CF 00 00 "+//groupGroupId
\r
1089 "00 18 "+//decNwTtlType
\r
1090 "00 08 "+//decNwTtlLen
\r
1091 "00 00 00 00"//decNwTtlPad
\r
1094 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
1096 BufferHelper.checkHeaderV13(builtByFactory);
\r
1097 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1098 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1100 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1102 Assert.assertEquals("Wrong type", 1,
\r
1103 message.getGroupDesc().get(0).getType().getIntValue());
\r
1104 Assert.assertEquals("Wrong groupId", 8,
\r
1105 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1106 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1107 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1108 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1109 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1110 getValue().intValue());
\r
1111 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1112 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1114 Assert.assertEquals("Wrong popVlanType", PopVlan.class,
\r
1115 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1116 getAction().getType());
\r
1118 Assert.assertEquals("Wrong popPbbType", PopPbb.class,
\r
1119 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1120 getAction().getType());
\r
1122 Assert.assertEquals("Wrong popMplsType", PopMpls.class,
\r
1123 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1124 getAction().getType());
\r
1126 Assert.assertEquals("Wrong popMplsEthertype", 207,
\r
1127 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1128 getAction().getAugmentation(EthertypeAction.class).
\r
1129 getEthertype().getValue().intValue());
\r
1131 Assert.assertEquals("Wrong setQueueType", SetQueue.class,
\r
1132 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1133 getAction().getType());
\r
1135 Assert.assertEquals("Wrong setQueueQueueId", 13565952,
\r
1136 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
\r
1137 getAction().getAugmentation(QueueIdAction.class).
\r
1138 getQueueId().intValue());
\r
1140 Assert.assertEquals("Wrong groupType", Group.class,
\r
1141 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1142 getAction().getType());
\r
1144 Assert.assertEquals("Wrong groupGroupId", 13565952,
\r
1145 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
\r
1146 getAction().getAugmentation(GroupIdAction.class).
\r
1147 getGroupId().intValue());
\r
1149 Assert.assertEquals("Wrong decNwTtlType", DecNwTtl.class,
\r
1150 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(5).
\r
1151 getAction().getType());
\r
1155 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
\r
1156 * Test covers bodies of actions NW TTL, Experimenter
\r
1159 public void testMultipartReplyGroupDescBody04(){
\r
1160 ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
\r
1164 "00 00 00 08 "+//groupId
\r
1165 "00 34 "+//bucketLen
\r
1166 "00 06 "+//bucketWeight
\r
1167 "00 00 00 05 "+//bucketWatchPort
\r
1168 "00 00 00 04 "+//bucketWatchGroup
\r
1169 "00 00 00 00 "+//bucketPad
\r
1170 "00 17 "+//nwTTlType
\r
1171 "00 08 "+//nwTTlLen
\r
1172 "0E "+//nwTTlnwTTL
\r
1173 "00 00 00 "+//nwTTlPad
\r
1174 "FF FF "+//experimenterType
\r
1175 "00 08 "+//experimenterLen
\r
1176 "00 01 02 03 "+//experimenterExperimenter
\r
1177 "00 19 "+//setFieldType
\r
1178 "00 14 "+//setFieldLen
\r
1179 "80 00 "+//setFieldOXMClass
\r
1180 "00 "+//setFieldOXMField
\r
1181 "04 "+//setFieldOXMLength
\r
1182 "00 00 00 FF "+//setFieldPort
\r
1184 "80 00 "+//setFieldOXMClass
\r
1185 "03 "+//setFieldOXMField
\r
1186 "04 "+//setFieldOXMLength
\r
1187 "00 00 0F FF"//setFieldPort
\r
1190 MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
\r
1192 BufferHelper.checkHeaderV13(builtByFactory);
\r
1193 Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
\r
1194 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
\r
1196 MultipartReplyGroupDesc message = (MultipartReplyGroupDesc) builtByFactory.getMultipartReplyBody();
\r
1198 Assert.assertEquals("Wrong type", 1,
\r
1199 message.getGroupDesc().get(0).getType().getIntValue());
\r
1200 Assert.assertEquals("Wrong groupId", 8,
\r
1201 message.getGroupDesc().get(0).getGroupId().intValue());
\r
1202 Assert.assertEquals("Wrong bucketWeight", 6,
\r
1203 message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
\r
1204 Assert.assertEquals("Wrong bucketWatchPort", 5,
\r
1205 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
\r
1206 getValue().intValue());
\r
1207 Assert.assertEquals("Wrong bucketWatchGroup", 4,
\r
1208 message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
\r
1210 Assert.assertEquals("Wrong nwTTlType", SetNwTtl.class,
\r
1211 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1212 getAction().getType());
\r
1214 Assert.assertEquals("Wrong nwTTlnwTTL", 14,
\r
1215 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
\r
1216 getAction().getAugmentation(NwTtlAction.class).getNwTtl().intValue());
\r
1218 Assert.assertEquals("Wrong experimenterType", Experimenter.class,
\r
1219 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1220 getAction().getType());
\r
1222 Assert.assertEquals("Wrong experimenterExperimenter", 66051,
\r
1223 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
\r
1224 getAction().getAugmentation(ExperimenterAction.class).getExperimenter().intValue());
\r
1226 Assert.assertEquals("Wrong setFieldType", SetField.class,
\r
1227 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1228 getAction().getType());
\r
1230 Assert.assertEquals("Wrong setFieldOXMClass", OpenflowBasicClass.class,
\r
1231 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1232 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmClass());
\r
1234 Assert.assertEquals("Wrong setFieldOXMField", InPort.class,
\r
1235 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1236 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmMatchField());
\r
1238 Assert.assertEquals("Wrong setFieldOXMField", 255,
\r
1239 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1240 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).
\r
1241 getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
\r
1244 Assert.assertEquals("Wrong setFieldOXMClass", OpenflowBasicClass.class,
\r
1245 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1246 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(1).getOxmClass());
\r
1248 Assert.assertEquals("Wrong setFieldOXMField", InPhyPort.class,
\r
1249 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1250 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(1).getOxmMatchField());
\r
1252 Assert.assertEquals("Wrong setFieldOXMField", 4095,
\r
1253 message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
\r
1254 getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(1).
\r
1255 getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
\r