'Build mininet from a topology object
At the end of this function, everything should be connected
and up.'

def buildFromTopo(self, topo=None):

    if self.cleanup:
        pass
    info('***    Creating    network\n')
    if ((not self.controllers) and self.controller):
        info('***    Adding    controller\n')
        classes = self.controller
        if (not isinstance(classes, list)):
            classes = [classes]
        for (i, cls) in enumerate(classes):
            if isinstance(cls, Controller):
                self.addController(cls)
            else:
                self.addController(('c%d' % i), cls)
    info('***    Adding    hosts:\n')
    for hostName in topo.hosts():
        self.addHost(hostName, **topo.nodeInfo(hostName))
        info((hostName + '    '))
    info('\n***    Adding    switches:\n')
    for switchName in topo.switches():
        params = topo.nodeInfo(switchName)
        cls = params.get('cls', self.switch)
        if hasattr(cls, 'batchStartup'):
            params.setdefault('batch', True)
        self.addSwitch(switchName, **params)
        info((switchName + '    '))
    info('\n***    Adding    links:\n')
    for (srcName, dstName, params) in topo.links(sort=True, withInfo=True):
        self.addLink(**params)
        info(('(%s,    %s)    ' % (srcName, dstName)))
    info('\n')
