3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.openflow.protocol;
13 import java.nio.ByteBuffer;
14 import java.util.ArrayList;
15 import java.util.List;
17 import junit.framework.TestCase;
19 import org.openflow.util.OFTestCase;
22 public class OFFeaturesReplyTest extends OFTestCase {
23 public void testWriteRead() throws Exception {
24 OFFeaturesReply ofr = (OFFeaturesReply) messageFactory
25 .getMessage(OFType.FEATURES_REPLY);
26 List<OFPhysicalPort> ports = new ArrayList<OFPhysicalPort>();
27 OFPhysicalPort port = new OFPhysicalPort();
28 port.setHardwareAddress(new byte[6]);
32 ByteBuffer bb = ByteBuffer.allocate(1024);
37 TestCase.assertEquals(1, ofr.getPorts().size());
38 TestCase.assertEquals("eth0", ofr.getPorts().get(0).getName());
40 // test a 15 character name
41 ofr.getPorts().get(0).setName("012345678901234");
46 TestCase.assertEquals("012345678901234", ofr.getPorts().get(0).getName());
48 // test a 16 character name getting truncated
49 ofr.getPorts().get(0).setName("0123456789012345");
54 TestCase.assertEquals("012345678901234", ofr.getPorts().get(0).getName());