Examples of IFloodlightProviderService


Examples of net.floodlightcontroller.core.IFloodlightProviderService

* Returns a JSON map of <ClusterId, List<SwitchDpids>>
*/
public class SwitchClustersResource extends ServerResource {
    @Get("json")
    public Map<String, List<String>> retrieve() {
        IFloodlightProviderService floodlightProvider =
                (IFloodlightProviderService)getContext().getAttributes().
                    get(IFloodlightProviderService.class.getCanonicalName());
        ITopologyService topology =
                (ITopologyService)getContext().getAttributes().
                    get(ITopologyService.class.getCanonicalName());

        Form form = getQuery();
        String queryType = form.getFirstValue("type", true);
        boolean openflowDomain = true;
        if (queryType != null && "l2".equals(queryType)) {
            openflowDomain = false;
        }

        Map<String, List<String>> switchClusterMap = new HashMap<String, List<String>>();
        for (Long dpid: floodlightProvider.getAllSwitchDpids()) {
            Long clusterDpid =
                    (openflowDomain
                     ? topology.getOpenflowDomainId(dpid)
                     :topology.getL2DomainId(dpid));
            List<String> switchesInCluster = switchClusterMap.get(HexString.toHexString(clusterDpid));
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

public class EnabledPortsResource extends ServerResource {
    @Get("json")
    public List<NodePortTuple> retrieve() {
        List<NodePortTuple> result = new ArrayList<NodePortTuple>();

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

        ITopologyService topology=
                (ITopologyService)getContext().getAttributes().
                get(ITopologyService.class.getCanonicalName());

        if (floodlightProvider == null || topology == null)
            return result;

        Set<Long> switches = floodlightProvider.getAllSwitchDpids();
        if (switches == null) return result;

        for(long sw: switches) {
            Set<Short> ports = topology.getPorts(sw);
            if (ports == null) continue;
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

* @author shudongz
*/
public class ControllerSummaryResource extends ServerResource {
    @Get("json")
    public Map<String, Object> retrieve() {
        IFloodlightProviderService floodlightProvider =
            (IFloodlightProviderService)getContext().getAttributes().
                get(IFloodlightProviderService.class.getCanonicalName());
        return floodlightProvider.getControllerInfo("summary");
    }
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

                       "from the switch",
                   recommendation=LogMessageDoc.CHECK_SWITCH + " " +
                       LogMessageDoc.GENERIC_ACTION)
    protected List<OFStatistics> getSwitchStatistics(long switchId,
                                                     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);
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

    protected List<OFStatistics> getSwitchStatistics(String switchId, OFStatisticsType statType) {
        return getSwitchStatistics(HexString.toLong(switchId), statType);
    }

    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();
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

* @author readams
*/
public class SwitchCounterResource extends CounterResourceBase {
    @Get("json")
    public Map<String, Object> retrieve() {
        IFloodlightProviderService floodlightProvider =
                (IFloodlightProviderService)getContext().getAttributes().
                    get(IFloodlightProviderService.class.getCanonicalName());
        HashMap<String,Object> model = new HashMap<String,Object>();

        String switchID = (String) getRequestAttributes().get("switchId");
        String counterName = (String) getRequestAttributes().get("counterName");

        if (switchID.equalsIgnoreCase("all")) {
            getOneSwitchCounterJson(model, ICounterStoreService.CONTROLLER_NAME, counterName);
            for (Long dpid : floodlightProvider.getAllSwitchDpids()) {
                switchID = HexString.toHexString(dpid);

                getOneSwitchCounterJson(model, switchID, counterName);
            }
        } else {
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

            "Invalid Switch DPID: must be a 64-bit quantity, expressed in " +
            "hex as AA:BB:CC:DD:EE:FF:00:11";

    @Get("json")
    public Iterator<SwitchJsonSerializerWrapper> retrieve() {
        IFloodlightProviderService floodlightProvider =
                (IFloodlightProviderService)getContext().getAttributes().
                    get(IFloodlightProviderService.class.getCanonicalName());

        Long switchDPID = null;

        Form form = getQuery();
        String dpid = form.getFirstValue("dpid", true);
        if (dpid != null) {
            try {
                switchDPID = HexString.toLong(dpid);
            } catch (Exception e) {
                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();
            }
            return Collections.<SwitchJsonSerializerWrapper>emptySet().iterator();
        }
        final String dpidStartsWith =
                form.getFirstValue("dpid__startswith", true);

        Iterator<IOFSwitch> iofSwitchIter =
                floodlightProvider.getAllSwitchMap().values().iterator();
        Iterator<SwitchJsonSerializerWrapper> switer =
                new SwitchJsonSerializerWrapperIterator(iofSwitchIter);
        if (dpidStartsWith != null) {
            return new FilterIterator<SwitchJsonSerializerWrapper>(switer) {
                @Override
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

            rType = REQUESTTYPE.OFFEATURES;
        } else {
            return model;
        }

        IFloodlightProviderService floodlightProvider =
                (IFloodlightProviderService)getContext().getAttributes().
                    get(IFloodlightProviderService.class.getCanonicalName());
        Set<Long> switchDpids = floodlightProvider.getAllSwitchDpids();
        List<GetConcurrentStatsThread> activeThreads = new ArrayList<GetConcurrentStatsThread>(switchDpids.size());
        List<GetConcurrentStatsThread> pendingRemovalThreads = new ArrayList<GetConcurrentStatsThread>();
        GetConcurrentStatsThread t;
        for (Long l : switchDpids) {
            t = new GetConcurrentStatsThread(l, rType, type);
View Full Code Here

Examples of net.floodlightcontroller.core.IFloodlightProviderService

    protected static Logger log = LoggerFactory.getLogger(SwitchRoleResource.class);

    @Get("json")
    public Object getRole() {
        IFloodlightProviderService floodlightProvider =
                (IFloodlightProviderService)getContext().getAttributes().
                    get(IFloodlightProviderService.class.getCanonicalName());

        String switchId = (String) getRequestAttributes().get("switchId");

        RoleInfo roleInfo;

        if (switchId.equalsIgnoreCase("all")) {
            HashMap<String,RoleInfo> model = new HashMap<String,RoleInfo>();
            for (IOFSwitch sw: floodlightProvider.getAllSwitchMap().values()) {
                switchId = sw.getStringId();
                roleInfo = new RoleInfo(sw.getHARole(), null);
                model.put(switchId, roleInfo);
            }
            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.IFloodlightProviderService

        }
    }

    @Get("json")
    public UptimeRest retrieve() {
        IFloodlightProviderService floodlightProvider =
            (IFloodlightProviderService)getContext().getAttributes().
            get(IFloodlightProviderService.class.getCanonicalName());

        UptimeRest uptime = new UptimeRest();
        uptime.systemUptimeMsec = floodlightProvider.getUptime();

        return (uptime);
    }
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.