Package org.openflow.protocol.action

Examples of org.openflow.protocol.action.OFAction


        ChannelBuffer buf = ChannelBuffers.copiedBuffer(deadBeefMessage);

        List<OFAction> actions = factory.parseActions(buf,deadBeefMessage.length);
        assertEquals(1, actions.size());
        OFAction ofAction = actions.get(0);
        assertTrue("Action should be MockVendorAction, but is "+ofAction.getClass(), ofAction instanceof MockVendorAction);
        assertArrayEquals( new byte[]  { 1,2,3,4,5,6,7,8}, ((MockVendorAction)ofAction).getMockData());


    }
View Full Code Here


        ChannelBuffer buf = ChannelBuffers.copiedBuffer(nonDeadBeefMessage);

        List<OFAction> actions = factory.parseActions(buf,nonDeadBeefMessage.length);
        assertEquals(1, actions.size());
        OFAction ofAction = actions.get(0);
        assertTrue("Action should be OFActionVendorGeneric, but is "+ofAction.getClass(), ofAction instanceof OFActionVendorGeneric);
    }
View Full Code Here

    }

    @Override
    public List<OFAction> parseActions(ByteBuffer data, int length, int limit) {
        List<OFAction> results = new ArrayList<OFAction>();
        OFAction demux = new OFAction();
        OFAction ofa;
        int end = data.position() + length;

        while (limit == 0 || results.size() <= limit) {
            if (data.remaining() < OFAction.MINIMUM_LENGTH ||
                    (data.position() + OFAction.MINIMUM_LENGTH) > end)
                return results;

            data.mark();
            demux.readFrom(data);
            data.reset();

            if (demux.getLengthU() > data.remaining() ||
                    (data.position() + demux.getLengthU()) > end)
                return results;

            ofa = getAction(demux.getType());
            ofa.readFrom(data);
            if (OFAction.class.equals(ofa.getClass())) {
                // advance the position for un-implemented messages
                data.position(data.position()+(ofa.getLengthU() -
                        OFAction.MINIMUM_LENGTH));
            }
            results.add(ofa);
        }
View Full Code Here

TOP

Related Classes of org.openflow.protocol.action.OFAction

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.