Examples of IOFSwitch


Examples of net.floodlightcontroller.core.IOFSwitch

            if (this.role == Role.SLAVE)
                return this.syncedSwitches.get(dpid);
            // MASTER: if the switch is found in the active map return
            // otherwise look up the switch in the bigSync map. The bigSync map
            // wil be cleared after the transition is complete.
            IOFSwitch sw = this.activeSwitches.get(dpid);
            if (sw != null)
                return sw;
            return this.syncedSwitches.get(dpid);
        }
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

        // Find the appropriate driver
        for (String descPrefix: switchDescSorted) {
            if (description.getManufacturerDescription()
                    .startsWith(descPrefix)) {
                IOFSwitchDriver driver = switchBindingMap.get(descPrefix);
                IOFSwitch sw = driver.getOFSwitchImpl(description);
                if (sw != null) {
                    sw.setSwitchProperties(description);
                    return sw;
                }
            }
        }
        // no switch found
        IOFSwitch sw = new OFSwitchImpl();
        sw.setSwitchProperties(description);
        return sw;
    }
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

                                                     OFStatisticsType statType) {
        IFloodlightProviderService floodlightProvider =
                (IFloodlightProviderService)getContext().getAttributes().
                    get(IFloodlightProviderService.class.getCanonicalName());

        IOFSwitch sw = floodlightProvider.getSwitch(switchId);
        Future<List<OFStatistics>> future;
        List<OFStatistics> values = null;
        if (sw != null) {
            OFStatisticsRequest req = new OFStatisticsRequest();
            req.setStatisticType(statType);
            int requestLength = req.getLengthU();
            if (statType == OFStatisticsType.FLOW) {
                OFFlowStatisticsRequest specificReq = new OFFlowStatisticsRequest();
                OFMatch match = new OFMatch();
                match.setWildcards(0xffffffff);
                specificReq.setMatch(match);
                specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
                specificReq.setTableId((byte) 0xff);
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.AGGREGATE) {
                OFAggregateStatisticsRequest specificReq = new OFAggregateStatisticsRequest();
                OFMatch match = new OFMatch();
                match.setWildcards(0xffffffff);
                specificReq.setMatch(match);
                specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
                specificReq.setTableId((byte) 0xff);
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.PORT) {
                OFPortStatisticsRequest specificReq = new OFPortStatisticsRequest();
                specificReq.setPortNumber(OFPort.OFPP_NONE.getValue());
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.QUEUE) {
                OFQueueStatisticsRequest specificReq = new OFQueueStatisticsRequest();
                specificReq.setPortNumber(OFPort.OFPP_ALL.getValue());
                // LOOK! openflowj does not define OFPQ_ALL! pulled this from openflow.h
                // note that I haven't seen this work yet though...
                specificReq.setQueueId(0xffffffff);
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.DESC ||
                       statType == OFStatisticsType.TABLE) {
                // pass - nothing todo besides set the type above
            }
            req.setLengthU(requestLength);
            try {
                future = sw.queryStatistics(req);
                values = future.get(10, TimeUnit.SECONDS);
            } catch (Exception e) {
                log.error("Failure retrieving statistics from switch " + sw, e);
            }
        }
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

    protected OFFeaturesReply getSwitchFeaturesReply(long switchId) {
        IFloodlightProviderService floodlightProvider =
                (IFloodlightProviderService)getContext().getAttributes().
                get(IFloodlightProviderService.class.getCanonicalName());

        IOFSwitch sw = floodlightProvider.getSwitch(switchId);
        Future<OFFeaturesReply> future;
        OFFeaturesReply featuresReply = null;
        if (sw != null) {
            try {
                future = sw.querySwitchFeaturesReply();
                featuresReply = future.get(10, TimeUnit.SECONDS);
            } catch (Exception e) {
                log.error("Failure getting features reply from switch" + sw, e);
            }
        }
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

                setStatus(Status.CLIENT_ERROR_BAD_REQUEST, DPID_ERROR);
                return null;
            }
        }
        if (switchDPID != null) {
            IOFSwitch sw =
                    floodlightProvider.getSwitch(switchDPID);
            if (sw != null) {
                SwitchJsonSerializerWrapper wrappedSw =
                        new SwitchJsonSerializerWrapper(sw);
                return Collections.singleton(wrappedSw).iterator();
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

            }
            return model;
        }

        Long dpid = HexString.toLong(switchId);
        IOFSwitch sw = floodlightProvider.getSwitch(dpid);
        if (sw == null)
            return null;
        roleInfo = new RoleInfo(sw.getHARole(), null);
        return roleInfo;
    }
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

            .setPacketData(this.testPacketSerialized);
        po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLengthU()
                + this.testPacketSerialized.length);

        // Mock up our expected behavior
        IOFSwitch mockSwitch = createMock(IOFSwitch.class);
       
        Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
        Capture<FloodlightContext> bc1 = new Capture<FloodlightContext>(CaptureType.ALL);
       
        mockSwitch.write(capture(wc1), capture(bc1));

        // Start recording the replay on the mocks
        replay(mockSwitch);
        // Get the listener and trigger the packet in
        IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

            .setBufferId(10)
            .setInPort((short) 1);
        po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLengthU());

        // Mock up our expected behavior
        IOFSwitch mockSwitch = createMock(IOFSwitch.class);
        Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
        Capture<FloodlightContext> bc1 = new Capture<FloodlightContext>(CaptureType.ALL);
       
        mockSwitch.write(capture(wc1), capture(bc1));

        // Start recording the replay on the mocks
        replay(mockSwitch);
        // Get the listener and trigger the packet in
        IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

    DeviceManagerImpl deviceManager;
    MemoryStorageSource storageSource;
    FlowReconcileManager flowReconcileMgr;

    private IOFSwitch makeSwitchMock(long id) {
        IOFSwitch mockSwitch = createMock(IOFSwitch.class);
        ImmutablePort port = ImmutablePort.create("p1", (short)1);
        expect(mockSwitch.getId()).andReturn(id).anyTimes();
        expect(mockSwitch.getStringId())
                .andReturn(HexString.toHexString(id, 6)).anyTimes();
        expect(mockSwitch.getPort(anyShort()))
                .andReturn(port).anyTimes();
        return mockSwitch;
    }
View Full Code Here

Examples of net.floodlightcontroller.core.IOFSwitch

        reset(topology);
        topology.addListener(deviceManager);
        expectLastCall().anyTimes();
        replay(topology);

        IOFSwitch mockSwitch1 = makeSwitchMock(1L);
        IOFSwitch mockSwitch10 = makeSwitchMock(10L);
        IOFSwitch mockSwitch5 = makeSwitchMock(5L);
        IOFSwitch mockSwitch50 = makeSwitchMock(50L);
        Map<Long, IOFSwitch> switches = new HashMap<Long,IOFSwitch>();
        switches.put(1L, mockSwitch1);
        switches.put(10L, mockSwitch10);
        switches.put(5L, mockSwitch5);
        switches.put(50L, mockSwitch50);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.