Package org.openflow.protocol.factory

Examples of org.openflow.protocol.factory.BasicFactory


                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                (byte) 0xff, 0x00, (byte) 0xff, (byte) 0xff };

        OFMessageFactory factory = new BasicFactory();
        ByteBuffer packetBuf = ByteBuffer.wrap(packet);
        List<OFMessage> msgs = factory.parseMessages(packetBuf, packet.length);
        TestCase.assertEquals(1, msgs.size());
        TestCase.assertTrue(msgs.get(0) instanceof OFStatisticsRequest);
        OFStatisticsRequest sr = (OFStatisticsRequest) msgs.get(0);
        TestCase.assertEquals(OFStatisticsType.FLOW, sr.getStatisticType());
        TestCase.assertTrue(sr.getStatistics() instanceof OFFlowStatisticsRequest);
View Full Code Here


                (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x50, 0x04,
                0x00, 0x00, 0x00, 0x00, (byte) 0xff, 0x00, 0x00, 0x00,
                (byte) 0xff, (byte) 0xff, 0x4e, 0x20 };

        OFMessageFactory factory = new BasicFactory();
        ByteBuffer packetBuf = ByteBuffer.wrap(packet);
        List<OFMessage> msgs = factory.parseMessages(packetBuf, packet.length);
        TestCase.assertEquals(1, msgs.size());
        TestCase.assertTrue(msgs.get(0) instanceof OFStatisticsRequest);
        OFStatisticsRequest sr = (OFStatisticsRequest) msgs.get(0);
        TestCase.assertEquals(OFStatisticsType.VENDOR, sr.getStatisticType());
        TestCase.assertTrue(sr.getStatistics() instanceof OFVendorStatistics);
View Full Code Here



public class BasicFactoryTest extends TestCase {
    public void testCreateAndParse() {
        BasicFactory factory = new BasicFactory();
        OFMessage m = factory.getMessage(OFType.HELLO);
        m.setVersion((byte) 1);
        m.setType(OFType.ECHO_REQUEST);
        m.setLength(U16.t(8));
        m.setXid(0xdeadbeef);
        ByteBuffer bb = ByteBuffer.allocate(1024);
        m.writeTo(bb);
        bb.flip();
        bb.limit(bb.limit()-1);
        TestCase.assertEquals(0, factory.parseMessages(bb).size());
        bb.limit(bb.limit()+1);
        List<OFMessage> messages = factory.parseMessages(bb);
        TestCase.assertEquals(1, messages.size());
        TestCase.assertTrue(messages.get(0).getType() == OFType.ECHO_REQUEST);
    }
View Full Code Here

                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xc4, 0x00, 0x00, 0x00,
                0x08, 0x00, 0x02, 0x00, 0x00 };

        OFMessageFactory factory = new BasicFactory();
        ByteBuffer packetBuf = ByteBuffer.wrap(packet);
        List<OFMessage> msgs = factory.parseMessages(packetBuf, packet.length);
        TestCase.assertEquals(1, msgs.size());
        TestCase.assertTrue(msgs.get(0) instanceof OFStatisticsReply);
        OFStatisticsReply sr = (OFStatisticsReply) msgs.get(0);
        TestCase.assertEquals(OFStatisticsType.FLOW, sr.getStatisticType());
        TestCase.assertEquals(3, sr.getStatistics().size());
View Full Code Here

TOP

Related Classes of org.openflow.protocol.factory.BasicFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.