blob: 39331d0fdc32a8fb9219d82017b4bfb7be955f12 [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2// Copyright (c) 2011, 2012 Open Networking Foundation
3// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4// This library was generated by the LoxiGen Compiler.
5// See the file LICENSE.txt which should have been included in the source distribution
6
7// Automatically generated by LOXI from template unit_test.java
8// Do not modify
9
10package org.projectfloodlight.openflow.protocol.ver13;
11
12import org.projectfloodlight.openflow.protocol.*;
13import org.projectfloodlight.openflow.protocol.action.*;
14import org.projectfloodlight.openflow.protocol.actionid.*;
15import org.projectfloodlight.openflow.protocol.bsntlv.*;
16import org.projectfloodlight.openflow.protocol.errormsg.*;
17import org.projectfloodlight.openflow.protocol.meterband.*;
18import org.projectfloodlight.openflow.protocol.instruction.*;
19import org.projectfloodlight.openflow.protocol.instructionid.*;
20import org.projectfloodlight.openflow.protocol.match.*;
21import org.projectfloodlight.openflow.protocol.oxm.*;
22import org.projectfloodlight.openflow.protocol.queueprop.*;
23import org.projectfloodlight.openflow.types.*;
24import org.projectfloodlight.openflow.util.*;
25import org.projectfloodlight.openflow.exceptions.*;
26import static org.junit.Assert.*;
27import java.util.Set;
28import org.junit.Test;
29import org.junit.Before;
30import org.jboss.netty.buffer.ChannelBuffer;
31import org.jboss.netty.buffer.ChannelBuffers;
32import org.hamcrest.CoreMatchers;
33
34
35
36public class OFBsnSetAuxCxnsReplyVer13Test {
37 OFFactory factory;
38
39 final static byte[] BSN_SET_AUX_CXNS_REPLY_SERIALIZED =
40 new byte[] { 0x4, 0x4, 0x0, 0x18, 0x12, 0x34, 0x56, 0x78, 0x0, 0x5c, 0x16, (byte) 0xc7, 0x0, 0x0, 0x0, 0x3b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0 };
41
42 @Before
43 public void setup() {
44 factory = OFFactoryVer13.INSTANCE;
45 }
46
47 @Test
48 public void testWrite() {
49 OFBsnSetAuxCxnsReply.Builder builder = factory.buildBsnSetAuxCxnsReply();
50 builder.setXid(0x12345678)
51 .setNumAux(1)
52 .setStatus(0);
53 OFBsnSetAuxCxnsReply bsnSetAuxCxnsReply = builder.build();
54 ChannelBuffer bb = ChannelBuffers.dynamicBuffer();
55 bsnSetAuxCxnsReply.writeTo(bb);
56 byte[] written = new byte[bb.readableBytes()];
57 bb.readBytes(written);
58
59 assertThat(written, CoreMatchers.equalTo(BSN_SET_AUX_CXNS_REPLY_SERIALIZED));
60 }
61
62 @Test
63 public void testRead() throws Exception {
64 OFBsnSetAuxCxnsReply.Builder builder = factory.buildBsnSetAuxCxnsReply();
65 builder.setXid(0x12345678)
66 .setNumAux(1)
67 .setStatus(0);
68 OFBsnSetAuxCxnsReply bsnSetAuxCxnsReplyBuilt = builder.build();
69
70 ChannelBuffer input = ChannelBuffers.copiedBuffer(BSN_SET_AUX_CXNS_REPLY_SERIALIZED);
71
72 // FIXME should invoke the overall reader once implemented
73 OFBsnSetAuxCxnsReply bsnSetAuxCxnsReplyRead = OFBsnSetAuxCxnsReplyVer13.READER.readFrom(input);
74 assertEquals(BSN_SET_AUX_CXNS_REPLY_SERIALIZED.length, input.readerIndex());
75
76 assertEquals(bsnSetAuxCxnsReplyBuilt, bsnSetAuxCxnsReplyRead);
77 }
78
79 @Test
80 public void testReadWrite() throws Exception {
81 ChannelBuffer input = ChannelBuffers.copiedBuffer(BSN_SET_AUX_CXNS_REPLY_SERIALIZED);
82
83 // FIXME should invoke the overall reader once implemented
84 OFBsnSetAuxCxnsReply bsnSetAuxCxnsReply = OFBsnSetAuxCxnsReplyVer13.READER.readFrom(input);
85 assertEquals(BSN_SET_AUX_CXNS_REPLY_SERIALIZED.length, input.readerIndex());
86
87 // write message again
88 ChannelBuffer bb = ChannelBuffers.dynamicBuffer();
89 bsnSetAuxCxnsReply.writeTo(bb);
90 byte[] written = new byte[bb.readableBytes()];
91 bb.readBytes(written);
92
93 assertThat(written, CoreMatchers.equalTo(BSN_SET_AUX_CXNS_REPLY_SERIALIZED));
94 }
95
96}