blob: f71edaee014a6a801cbc1356dac147b470430f99 [file] [log] [blame]
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template unit_test.java
// Do not modify
package org.projectfloodlight.openflow.protocol.ver13;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.Before;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.hamcrest.CoreMatchers;
public class OFBsnGentableEntryDescStatsReplyVer13Test {
OFFactory factory;
final static byte[] BSN_GENTABLE_ENTRY_DESC_STATS_REPLY_SERIALIZED =
new byte[] { 0x4, 0x13, 0x0, 0x64, 0x12, 0x34, 0x56, 0x78, (byte) 0xff, (byte) 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5c, 0x16, (byte) 0xc7, 0x0, 0x0, 0x0, 0x2, 0x0, 0x26, 0x0, 0x8, (byte) 0xfe, (byte) 0xdc, (byte) 0xba, (byte) 0x98, 0x76, 0x54, 0x32, 0x10, (byte) 0xff, (byte) 0xee, (byte) 0xcc, (byte) 0xbb, (byte) 0xaa, (byte) 0x99, (byte) 0x88, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x5, 0x0, 0x1, 0x0, 0xa, (byte) 0xff, (byte) 0xee, (byte) 0xdd, (byte) 0xcc, (byte) 0xbb, 0x0, 0x0, 0x26, 0x0, 0x8, (byte) 0xfe, (byte) 0xdc, (byte) 0xba, (byte) 0x98, 0x76, 0x54, 0x32, 0x10, (byte) 0xff, (byte) 0xee, (byte) 0xcc, (byte) 0xbb, (byte) 0xaa, (byte) 0x99, (byte) 0x88, 0x1, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x6, 0x0, 0x1, 0x0, 0xa, (byte) 0xff, (byte) 0xee, (byte) 0xdd, (byte) 0xcc, (byte) 0xbb, 0x1 };
@Before
public void setup() {
factory = OFFactoryVer13.INSTANCE;
}
@Test
public void testWrite() {
OFBsnGentableEntryDescStatsReply.Builder builder = factory.buildBsnGentableEntryDescStatsReply();
builder.setXid(0x12345678)
.setEntries(
ImmutableList.<OFBsnGentableEntryDescStatsEntry>of(
factory.buildBsnGentableEntryDescStatsEntry()
.setChecksum(U128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998800L))
.setKey(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().port(OFPort.of(5))
))
.setValue(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().mac(MacAddress.of("ff:ee:dd:cc:bb:00"))
))
.build(),
factory.buildBsnGentableEntryDescStatsEntry()
.setChecksum(U128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998801L))
.setKey(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().port(OFPort.of(6))
))
.setValue(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().mac(MacAddress.of("ff:ee:dd:cc:bb:01"))
))
.build()
)
);
OFBsnGentableEntryDescStatsReply bsnGentableEntryDescStatsReply = builder.build();
ChannelBuffer bb = ChannelBuffers.dynamicBuffer();
bsnGentableEntryDescStatsReply.writeTo(bb);
byte[] written = new byte[bb.readableBytes()];
bb.readBytes(written);
assertThat(written, CoreMatchers.equalTo(BSN_GENTABLE_ENTRY_DESC_STATS_REPLY_SERIALIZED));
}
@Test
public void testRead() throws Exception {
OFBsnGentableEntryDescStatsReply.Builder builder = factory.buildBsnGentableEntryDescStatsReply();
builder.setXid(0x12345678)
.setEntries(
ImmutableList.<OFBsnGentableEntryDescStatsEntry>of(
factory.buildBsnGentableEntryDescStatsEntry()
.setChecksum(U128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998800L))
.setKey(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().port(OFPort.of(5))
))
.setValue(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().mac(MacAddress.of("ff:ee:dd:cc:bb:00"))
))
.build(),
factory.buildBsnGentableEntryDescStatsEntry()
.setChecksum(U128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998801L))
.setKey(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().port(OFPort.of(6))
))
.setValue(ImmutableList.<OFBsnTlv>of(
factory.bsnTlvs().mac(MacAddress.of("ff:ee:dd:cc:bb:01"))
))
.build()
)
);
OFBsnGentableEntryDescStatsReply bsnGentableEntryDescStatsReplyBuilt = builder.build();
ChannelBuffer input = ChannelBuffers.copiedBuffer(BSN_GENTABLE_ENTRY_DESC_STATS_REPLY_SERIALIZED);
// FIXME should invoke the overall reader once implemented
OFBsnGentableEntryDescStatsReply bsnGentableEntryDescStatsReplyRead = OFBsnGentableEntryDescStatsReplyVer13.READER.readFrom(input);
assertEquals(BSN_GENTABLE_ENTRY_DESC_STATS_REPLY_SERIALIZED.length, input.readerIndex());
assertEquals(bsnGentableEntryDescStatsReplyBuilt, bsnGentableEntryDescStatsReplyRead);
}
@Test
public void testReadWrite() throws Exception {
ChannelBuffer input = ChannelBuffers.copiedBuffer(BSN_GENTABLE_ENTRY_DESC_STATS_REPLY_SERIALIZED);
// FIXME should invoke the overall reader once implemented
OFBsnGentableEntryDescStatsReply bsnGentableEntryDescStatsReply = OFBsnGentableEntryDescStatsReplyVer13.READER.readFrom(input);
assertEquals(BSN_GENTABLE_ENTRY_DESC_STATS_REPLY_SERIALIZED.length, input.readerIndex());
// write message again
ChannelBuffer bb = ChannelBuffers.dynamicBuffer();
bsnGentableEntryDescStatsReply.writeTo(bb);
byte[] written = new byte[bb.readableBytes()];
bb.readBytes(written);
assertThat(written, CoreMatchers.equalTo(BSN_GENTABLE_ENTRY_DESC_STATS_REPLY_SERIALIZED));
}
}