Package net.floodlightcontroller.topology

Examples of net.floodlightcontroller.topology.NodePortTuple


                                         remotePort,
                                         remoteSwitch.getPort(remotePort)});
            }
            return Command.STOP;
        }
        if (suppressLinkDiscovery.contains(new NodePortTuple(
                                                             remoteSwitch.getId(),
                                                             remotePort))) {
            if (log.isTraceEnabled()) {
                log.trace("Ignoring link with suppressed src port: switch {} port {} {}",
                          new Object[] { remoteSwitch.getStringId(),
                                         remotePort,
                                         remoteSwitch.getPort(remotePort)});
            }
            return Command.STOP;
        }
        if (!iofSwitch.portEnabled(inPort)) {
            if (log.isTraceEnabled()) {
                log.trace("Ignoring link with disabled dest port: switch {} port {} {}",
                          new Object[] { HexString.toHexString(sw),
                                         inPort,
                                         iofSwitch.getPort(inPort)});
            }
            return Command.STOP;
        }

        // Store the time of update to this link, and push it out to
        // routingEngine
        Link lt = new Link(remoteSwitch.getId(), remotePort,
                           iofSwitch.getId(), inPort);

        if (!isLinkAllowed(lt.getSrc(), lt.getSrcPort(),
                           lt.getDst(), lt.getDstPort()))
            return Command.STOP;

        // Continue only if link is allowed.
        Long lastLldpTime = null;
        Long lastBddpTime = null;

        Long firstSeenTime = System.currentTimeMillis();

        if (isStandard)
            lastLldpTime = System.currentTimeMillis();
        else
            lastBddpTime = System.currentTimeMillis();

        LinkInfo newLinkInfo = new LinkInfo(firstSeenTime, lastLldpTime,
                                            lastBddpTime);

        addOrUpdateLink(lt, newLinkInfo);

        // Check if reverse link exists.
        // If it doesn't exist and if the forward link was seen
        // first seen within a small interval, send probe on the
        // reverse link.
        newLinkInfo = links.get(lt);
        if (newLinkInfo != null && isStandard && isReverse == false) {
            Link reverseLink = new Link(lt.getDst(), lt.getDstPort(),
                                        lt.getSrc(), lt.getSrcPort());
            LinkInfo reverseInfo = links.get(reverseLink);
            if (reverseInfo == null) {
                // the reverse link does not exist.
                if (newLinkInfo.getFirstSeenTime() > System.currentTimeMillis()
                                                     - LINK_TIMEOUT) {
                    this.sendDiscoveryMessage(lt.getDst(), lt.getDstPort(),
                                              isStandard, true);
                }
            }
        }

        // If the received packet is a BDDP packet, then create a reverse BDDP
        // link as well.
        if (!isStandard) {
            Link reverseLink = new Link(lt.getDst(), lt.getDstPort(),
                                        lt.getSrc(), lt.getSrcPort());

            // srcPortState and dstPort state are reversed.
            LinkInfo reverseInfo = new LinkInfo(firstSeenTime, lastLldpTime,
                                                lastBddpTime);

            addOrUpdateLink(reverseLink, reverseInfo);
        }

        // Remove the node ports from the quarantine and maintenance queues.
        NodePortTuple nptSrc = new NodePortTuple(lt.getSrc(),
                                                 lt.getSrcPort());
        NodePortTuple nptDst = new NodePortTuple(lt.getDst(),
                                                 lt.getDstPort());
        removeFromQuarantineQueue(nptSrc);
        removeFromMaintenanceQueue(nptSrc);
        removeFromQuarantineQueue(nptDst);
        removeFromMaintenanceQueue(nptDst);
View Full Code Here


        if (autoPortFastFeature && iofSwitch.isFastPort(p)) {
            // Do nothing as the port is a fast port.
            return;
        }
        NodePortTuple npt = new NodePortTuple(sw, p);
        discover(sw, p);
        // if it is not a fast port, add it to quarantine.
        if (!iofSwitch.isFastPort(p)) {
            addToQuarantineQueue(npt);
        } else {
View Full Code Here

            }
        } while (updates.peek() != null);
    }

    protected boolean isLinkDiscoverySuppressed(long sw, short portNumber) {
        return this.suppressLinkDiscovery.contains(new NodePortTuple(sw,
                                                                     portNumber));
    }
View Full Code Here

    protected void processBDDPLists() {
        int count = 0;
        Set<NodePortTuple> nptList = new HashSet<NodePortTuple>();

        while (count < BDDP_TASK_SIZE && quarantineQueue.peek() != null) {
            NodePortTuple npt;
            npt = quarantineQueue.remove();
            sendDiscoveryMessage(npt.getNodeId(), npt.getPortId(), false,
                                 false);
            nptList.add(npt);
            count++;
        }

        count = 0;
        while (count < BDDP_TASK_SIZE && maintenanceQueue.peek() != null) {
            NodePortTuple npt;
            npt = maintenanceQueue.remove();
            sendDiscoveryMessage(npt.getNodeId(), npt.getPortId(), false,
                                 false);
            count++;
        }

        for (NodePortTuple npt : nptList) {
            generateSwitchPortStatusUpdate(npt.getNodeId(), npt.getPortId());
        }
    }
View Full Code Here

                    sendDiscoveryMessage(sw, ofp.getPortNumber(), true,
                                         false);

                    // If the switch port is not already in the maintenance
                    // queue, add it.
                    NodePortTuple npt = new NodePortTuple(
                                                          sw,
                                                          ofp.getPortNumber());
                    addToMaintenanceQueue(npt);
                }
            }
View Full Code Here

                                    long dst, short dstPort) {
        return true;
    }

    private boolean addLink(Link lt, LinkInfo newInfo) {
        NodePortTuple srcNpt, dstNpt;

        srcNpt = new NodePortTuple(lt.getSrc(), lt.getSrcPort());
        dstNpt = new NodePortTuple(lt.getDst(), lt.getDstPort());

        // index it by switch source
        if (!switchLinks.containsKey(lt.getSrc()))
            switchLinks.put(lt.getSrc(),
                            new HashSet<Link>());
View Full Code Here

            explanation="A previously detected link between two openflow switches no longer exists, " +
                        "use show link to find current status")
    protected void deleteLinks(List<Link> links, String reason,
                               List<LDUpdate> updateList) {

        NodePortTuple srcNpt, dstNpt;
        List<LDUpdate> linkUpdateList = new ArrayList<LDUpdate>();
        lock.writeLock().lock();
        try {
            for (Link lt : links) {
                srcNpt = new NodePortTuple(lt.getSrc(), lt.getSrcPort());
                dstNpt = new NodePortTuple(lt.getDst(), lt.getDstPort());

                if (switchLinks.containsKey(lt.getSrc())) {
                    switchLinks.get(lt.getSrc()).remove(lt);
                    if (switchLinks.get(lt.getSrc()).isEmpty())
                        this.switchLinks.remove(lt.getSrc());
View Full Code Here

    //******************
    // IOFSwitchListener
    //******************
    private void handlePortDown(long switchId, short portNumber) {
            NodePortTuple npt = new NodePortTuple(switchId, portNumber);
            deleteLinksOnPort(npt, "Port Status Changed");
            LDUpdate update = new LDUpdate(switchId, portNumber,
                    UpdateOperation.PORT_DOWN);
            updates.add(update);
    }
View Full Code Here

        LinkInfo info = new LinkInfo(System.currentTimeMillis(),
                                     System.currentTimeMillis(), null);
        linkDiscovery.addOrUpdateLink(lt, info);


        NodePortTuple srcNpt = new NodePortTuple(1L, 2);
        NodePortTuple dstNpt = new NodePortTuple(2L, 1);

        // check invariants hold
        assertNotNull(linkDiscovery.switchLinks.get(lt.getSrc()));
        assertTrue(linkDiscovery.switchLinks.get(lt.getSrc()).contains(lt));
        assertNotNull(linkDiscovery.portLinks.get(srcNpt));
View Full Code Here

    @Test
    public void testAddOrUpdateLinkToSelf() throws Exception {
        LinkDiscoveryManager linkDiscovery = getLinkDiscoveryManager();

        Link lt = new Link(1L, 2, 2L, 3);
        NodePortTuple srcNpt = new NodePortTuple(1L, 2);
        NodePortTuple dstNpt = new NodePortTuple(2L, 3);

        LinkInfo info = new LinkInfo(System.currentTimeMillis(),
                                     System.currentTimeMillis(), null);
        linkDiscovery.addOrUpdateLink(lt, info);
View Full Code Here

TOP

Related Classes of net.floodlightcontroller.topology.NodePortTuple

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.