Package org.openflow.protocol

Examples of org.openflow.protocol.OFMessage


        expectLastCall().once();
        sw.disconnectOutputStream(); // Make sure we disconnect
        expectLastCall().once();
        replay(sw);

        OFMessage m = BasicFactory.getInstance().getMessage(OFType.ECHO_REPLY);

        Thread.sleep(timeout+5);

        sendMessageToHandlerWithControllerReset(Collections.singletonList(m));
    }
View Full Code Here


        verify(controller);
        reset(controller);
        controller.switchActivated(sw);
        expectLastCall().once();
        OFMessage reply = getRoleReply(xid, Role.MASTER);
        // sendMessageToHandler will verify and rest controller mock
        sendMessageToHandlerNoControllerReset(Collections.singletonList(reply));

        assertEquals(OFChannelHandler.ChannelState.MASTER,
                     handler.getStateForTesting());
View Full Code Here

        verify(controller);
        reset(controller);
        controller.switchDeactivated(sw);
        expectLastCall().once();
        OFMessage reply = getRoleReply(xid, Role.SLAVE);
        // sendMessageToHandler will verify and rest controller mock
        sendMessageToHandlerNoControllerReset(Collections.singletonList(reply));

        assertEquals(OFChannelHandler.ChannelState.SLAVE,
                     handler.getStateForTesting());
View Full Code Here

                     handler.getStateForTesting());


        // FIXME: shouldn't use ordinal(), but OFError is broken

        OFMessage err = getErrorMessage(OFErrorType.OFPET_BAD_ACTION,
                                        0,
                                        xid);
        verify(sw);
        reset(sw);
        expect(sw.inputThrottled(anyObject(OFMessage.class)))
View Full Code Here

     * Test handleOutgoingMessage and also test listener ordering
     * @throws Exception
     */
    @Test
    public void testHandleOutgoingMessage() throws Exception {
        OFMessage m = BasicFactory.getInstance().getMessage(OFType.ECHO_REQUEST);
        FloodlightContext cntx = new FloodlightContext();
        IOFSwitch sw = createMock(IOFSwitch.class);
        expect(sw.getId()).andReturn(0L).anyTimes();
        expect(sw.getStringId()).andReturn("00:00:00:00:00:00:00").anyTimes();

View Full Code Here

    }

    @Override
    public List<OFMessage> parseMessages(ByteBuffer data, int limit) {
        List<OFMessage> results = new ArrayList<OFMessage>();
        OFMessage demux = new OFMessage();
        OFMessage ofm;

        while (limit == 0 || results.size() <= limit) {
            if (data.remaining() < OFMessage.MINIMUM_LENGTH)
                return results;

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

            if (demux.getLengthU() > data.remaining())
                return results;

            ofm = getMessage(demux.getType());
            if (ofm instanceof OFActionFactoryAware) {
                ((OFActionFactoryAware)ofm).setActionFactory(this);
            }
            if (ofm instanceof OFMessageFactoryAware) {
                ((OFMessageFactoryAware)ofm).setMessageFactory(this);
            }
            if (ofm instanceof OFQueuePropertyFactoryAware) {
                ((OFQueuePropertyFactoryAware)ofm).setQueuePropertyFactory(this);
            }
            if (ofm instanceof OFStatisticsFactoryAware) {
                ((OFStatisticsFactoryAware)ofm).setStatisticsFactory(this);
            }
            ofm.readFrom(data);
            if (OFMessage.class.equals(ofm.getClass())) {
                // advance the position for un-implemented messages
                data.position(data.position()+(ofm.getLengthU() -
                        OFMessage.MINIMUM_LENGTH));
            }
            results.add(ofm);
        }
View Full Code Here

TOP

Related Classes of org.openflow.protocol.OFMessage

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.