1 package org.openflow.protocol;
4 import java.nio.ByteBuffer;
5 import java.util.ArrayList;
8 import junit.framework.TestCase;
10 import org.openflow.util.OFTestCase;
13 public class OFFeaturesReplyTest extends OFTestCase {
14 public void testWriteRead() throws Exception {
15 OFFeaturesReply ofr = (OFFeaturesReply) messageFactory
16 .getMessage(OFType.FEATURES_REPLY);
17 List<OFPhysicalPort> ports = new ArrayList<OFPhysicalPort>();
18 OFPhysicalPort port = new OFPhysicalPort();
19 port.setHardwareAddress(new byte[6]);
23 ByteBuffer bb = ByteBuffer.allocate(1024);
28 TestCase.assertEquals(1, ofr.getPorts().size());
29 TestCase.assertEquals("eth0", ofr.getPorts().get(0).getName());
31 // test a 15 character name
32 ofr.getPorts().get(0).setName("012345678901234");
37 TestCase.assertEquals("012345678901234", ofr.getPorts().get(0).getName());
39 // test a 16 character name getting truncated
40 ofr.getPorts().get(0).setName("0123456789012345");
45 TestCase.assertEquals("012345678901234", ofr.getPorts().get(0).getName());