Examples of ILinkDiscoveryService


Examples of net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService

public class LinksResource extends ServerResource {

    @Get("json")
    public Set<LinkWithType> retrieve() {
        ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
                get(ILinkDiscoveryService.class.getCanonicalName());
        Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
        Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();

        if (ld != null) {
            links.putAll(ld.getLinks());
            for (Link link: links.keySet()) {
                LinkInfo info = links.get(link);
                LinkType type = ld.getLinkType(link, info);
                if (type == LinkType.DIRECT_LINK || type == LinkType.TUNNEL) {
                    LinkWithType lwt;

                    long src = link.getSrc();
                    long dst = link.getDst();
                    short srcPort = link.getSrcPort();
                    short dstPort = link.getDstPort();
                    Link otherLink = new Link(dst, dstPort, src, srcPort);
                    LinkInfo otherInfo = links.get(otherLink);
                    LinkType otherType = null;
                    if (otherInfo != null)
                        otherType = ld.getLinkType(otherLink, otherInfo);
                    if (otherType == LinkType.DIRECT_LINK ||
                            otherType == LinkType.TUNNEL) {
                        // This is a bi-direcitonal link.
                        // It is sufficient to add only one side of it.
                        if ((src < dst) || (src == dst && srcPort < dstPort)) {
View Full Code Here

Examples of net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService

public class AutoPortFast extends ServerResource {
    protected static Logger log = LoggerFactory.getLogger(AutoPortFast.class);

    @Get("json")
    public String retrieve() {
        ILinkDiscoveryService linkDiscovery;
        linkDiscovery = (ILinkDiscoveryService)getContext().getAttributes().
                get(ILinkDiscoveryService.class.getCanonicalName());

        String param = ((String)getRequestAttributes().get("state")).toLowerCase();
        if (param.equals("enable") || param.equals("true")) {
            linkDiscovery.setAutoPortFastFeature(true);
        } else if (param.equals("disable") || param.equals("false")) {
            linkDiscovery.setAutoPortFastFeature(false);
        }
        setStatus(Status.SUCCESS_OK, "OK");
        if (linkDiscovery.isAutoPortFastFeature())
            return "enabled";
        else return "disabled";
    }
View Full Code Here

Examples of net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService

public class ExternalLinksResource extends ServerResource {

    @Get("json")
    public Set<LinkWithType> retrieve() {
        ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
                get(ILinkDiscoveryService.class.getCanonicalName());
        Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
        Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();

        if (ld != null) {
            links.putAll(ld.getLinks());
            for (Link link: links.keySet()) {
                LinkInfo info = links.get(link);
                LinkType type = ld.getLinkType(link, info);
                if (type == LinkType.MULTIHOP_LINK) {
                    LinkWithType lwt;

                    long src = link.getSrc();
                    long dst = link.getDst();
                    short srcPort = link.getSrcPort();
                    short dstPort = link.getDstPort();
                    Link otherLink = new Link(dst, dstPort, src, srcPort);
                    LinkInfo otherInfo = links.get(otherLink);
                    LinkType otherType = null;
                    if (otherInfo != null)
                        otherType = ld.getLinkType(otherLink, otherInfo);
                    if (otherType == LinkType.MULTIHOP_LINK) {
                        // This is a bi-direcitonal link.
                        // It is sufficient to add only one side of it.
                        if ((src < dst) || (src == dst && srcPort < dstPort)) {
                            lwt = new LinkWithType(link,
View Full Code Here

Examples of net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService

public class DirectedLinksResource extends ServerResource {

    @Get("json")
    public Set<LinkWithType> retrieve() {
        ILinkDiscoveryService ld = (ILinkDiscoveryService)getContext().getAttributes().
                get(ILinkDiscoveryService.class.getCanonicalName());
        Map<Link, LinkInfo> links = new HashMap<Link, LinkInfo>();
        Set<LinkWithType> returnLinkSet = new HashSet<LinkWithType>();

        if (ld != null) {
            links.putAll(ld.getLinks());
            for (Link link: links.keySet()) {
                LinkInfo info = links.get(link);
                LinkType type = ld.getLinkType(link, info);
                if (type == LinkType.DIRECT_LINK || type == LinkType.TUNNEL) {
                    LinkWithType lwt = new LinkWithType(link,
                            type,LinkDirection.UNIDIRECTIONAL);
                    returnLinkSet.add(lwt);
                }
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.