277bcee92c4a4792ecb84a2940e0875e4e409e40
[openflowjava.git] / third-party / openflow-codec / src / test / java / org / openflow / codec / protocol / OFPPortConfigTest.java
1 package org.openflow.codec.protocol;
2
3 import junit.framework.TestCase;
4
5 import org.openflow.codec.io.DataBuffers;
6 import org.openflow.codec.io.IDataBuffer;
7 import org.openflow.codec.protocol.OFPPortMod;
8 import org.openflow.codec.protocol.OFPType;
9 import org.openflow.codec.util.OFTestCase;
10
11 public class OFPPortConfigTest extends OFTestCase {
12     public void testWriteRead() throws Exception {
13         OFPPortMod msg = (OFPPortMod) messageFactory.getMessage(OFPType.PORT_MOD);
14         msg.setHardwareAddress(new byte[6]);
15         msg.portNumber = 1;
16         IDataBuffer bb = DataBuffers.allocate(1024);
17         bb.clear();
18         msg.writeTo(bb);
19         bb.flip();
20         msg.readFrom(bb);
21         TestCase.assertEquals(OFPType.PORT_MOD, msg.getType());
22         TestCase.assertEquals(1, msg.getPortNumber());
23     }
24 }