src/main/java/net/floodlightcontroller/topology/TopologyManager.java
/**
     * This function computes a new topology instance.
     * It ignores links connected to all broadcast domain ports
     * and tunnel ports. The method returns if a new instance of
     * topology was created or not.
     */
This function computes a new topology instance.
It ignores links connected to all broadcast domain ports
and tunnel ports. The method returns if a new instance of
topology was created or not.
This function computes a new topology instance . It ignores links connected to all broadcast domain ports and tunnel ports . The method returns if a new instance of topology was created or not .
protected boolean createNewInstance(String reason) {
        Set<NodePortTuple> blockedPorts = new HashSet<NodePortTuple>();
        if (!linksUpdated) return false;
        Map<NodePortTuple, Set<Link>> openflowLinks;
        openflowLinks =
                new HashMap<NodePortTuple, Set<Link>>();
        Set<NodePortTuple> nptList = switchPortLinks.keySet();
        if (nptList != null) {
            for(NodePortTuple npt: nptList) {
                Set<Link> linkSet = switchPortLinks.get(npt);
                if (linkSet == null) continue;
                openflowLinks.put(npt, new HashSet<Link>(linkSet));
            }
        }
        Set<NodePortTuple> broadcastDomainPorts =
                identifyBroadcastDomainPorts();
        for(NodePortTuple npt: broadcastDomainPorts) {
            if (switchPortLinks.get(npt) == null) continue;
            for(Link link: switchPortLinks.get(npt)) {
                removeLinkFromStructure(openflowLinks, link);
            }
        }
        for(NodePortTuple npt: tunnelPorts) {
            if (switchPortLinks.get(npt) == null) continue;
            for(Link link: switchPortLinks.get(npt)) {
                removeLinkFromStructure(openflowLinks, link);
            }
        }
        tiMap = new HashMap<Integer,TopologyInstance>();
        for(int i=0;i<3;i++){
            TopologyInstance nt = new TopologyInstance(switchPorts,
                    blockedPorts,
                    openflowLinks,
                    broadcastDomainPorts,
                    tunnelPorts);
            nt.setTrafficMap(traffic);
            nt.compute(i);
            tiMap.put(i, nt);
        }
        TopologyInstance nt = null;
        do{
            nt = tiMap.get(0);
        }while(nt == null);
        currentInstance = nt;
        currentInstanceWithoutTunnels = nt;
        TopologyEventInfo topologyInfo =
                new TopologyEventInfo(0, 
                                    nt.getClusters().size(),
                                      new HashMap<Long, List<NodePortTuple>>(),
                                      0);
        evTopology.updateEventWithFlush(new TopologyEvent(reason,
                                                          topologyInfo));
        return true;
    }
protected boolean createNewInstance ( String reason ) { Set < NodePortTuple > blockedPorts = new HashSet < NodePortTuple > ( ) ; if ( ! linksUpdated ) return false ; Map < NodePortTuple , Set < Link > > openflowLinks ; openflowLinks = new HashMap < NodePortTuple , Set < Link > > ( ) ; Set < NodePortTuple > nptList = switchPortLinks . keySet ( ) ; if ( nptList != null ) { for ( NodePortTuple npt : nptList ) { Set < Link > linkSet = switchPortLinks . get ( npt ) ; if ( linkSet == null ) continue ; openflowLinks . put ( npt , new HashSet < Link > ( linkSet ) ) ; } } Set < NodePortTuple > broadcastDomainPorts = identifyBroadcastDomainPorts ( ) ; for ( NodePortTuple npt : broadcastDomainPorts ) { if ( switchPortLinks . get ( npt ) == null ) continue ; for ( Link link : switchPortLinks . get ( npt ) ) { removeLinkFromStructure ( openflowLinks , link ) ; } } for ( NodePortTuple npt : tunnelPorts ) { if ( switchPortLinks . get ( npt ) == null ) continue ; for ( Link link : switchPortLinks . get ( npt ) ) { removeLinkFromStructure ( openflowLinks , link ) ; } } tiMap = new HashMap < Integer , TopologyInstance > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { TopologyInstance nt = new TopologyInstance ( switchPorts , blockedPorts , openflowLinks , broadcastDomainPorts , tunnelPorts ) ; nt . setTrafficMap ( traffic ) ; nt . compute ( i ) ; tiMap . put ( i , nt ) ; } TopologyInstance nt = null ; do { nt = tiMap . get ( 0 ) ; } while ( nt == null ) ; currentInstance = nt ; currentInstanceWithoutTunnels = nt ; TopologyEventInfo topologyInfo = new TopologyEventInfo ( 0 , nt . getClusters ( ) . size ( ) , new HashMap < Long , List < NodePortTuple > > ( ) , 0 ) ; evTopology . updateEventWithFlush ( new TopologyEvent ( reason , topologyInfo ) ) ; return true ; }
This function computes a new topology instance.
This function computes a new topology instance .
// TODO:DEBUG //log.info("Creating new topo..."); // Identify all broadcast domain ports. // Mark any port that has inconsistent set of links // as broadcast domain ports as well. // Remove all links incident on broadcast domain ports. // Remove all tunnel links. // for each priority we compute nt // We set the instances with and without tunnels to be identical. // If needed, we may compute them differently.