1 package org.openflow.protocol;
3 import java.nio.ByteBuffer;
5 import junit.framework.TestCase;
7 import org.openflow.protocol.OFPortStatus.OFPortReason;
8 import org.openflow.util.OFTestCase;
10 public class OFPortStatusTest extends OFTestCase {
11 public void testWriteRead() throws Exception {
12 OFPortStatus msg = (OFPortStatus) messageFactory
13 .getMessage(OFType.PORT_STATUS);
14 msg.setDesc(new OFPhysicalPort());
15 msg.getDesc().setHardwareAddress(new byte[6]);
16 msg.getDesc().setName("eth0");
17 msg.setReason((byte) OFPortReason.OFPPR_ADD.ordinal());
18 ByteBuffer bb = ByteBuffer.allocate(1024);
23 TestCase.assertEquals(OFType.PORT_STATUS, msg.getType());
24 TestCase.assertEquals((byte) OFPortReason.OFPPR_ADD.ordinal(), msg
26 TestCase.assertNotNull(msg.getDesc());