示例#1
0
def testRemoteNet( remote='ubuntu2' ):
    "Test remote Node classes"
    print '*** Remote Node Test'
    net = Mininet( host=RemoteHost, switch=RemoteOVSSwitch,
                   link=RemoteLink )
    c0 = net.addController( 'c0' )
    # Make sure controller knows its non-loopback address
    Intf( 'eth0', node=c0 ).updateIP()
    print "*** Creating local h1"
    h1 = net.addHost( 'h1' )
    print "*** Creating remote h2"
    h2 = net.addHost( 'h2', server=remote )
    print "*** Creating local s1"
    s1 = net.addSwitch( 's1' )
    print "*** Creating remote s2"
    s2 = net.addSwitch( 's2', server=remote )
    print "*** Adding links"
    net.addLink( h1, s1 )
    net.addLink( s1, s2 )
    net.addLink( h2, s2 )
    net.start()
    print 'Mininet is running on', quietRun( 'hostname' ).strip()
    for node in c0, h1, h2, s1, s2:
        print 'Node', node, 'is running on', node.cmd( 'hostname' ).strip()
    net.pingAll()
    CLI( net )
    net.stop()
示例#2
0
def testRemoteNet(remote='ubuntu2', link=RemoteGRELink):
    "Test remote Node classes"
    info('*** Remote Node Test\n')
    net = Mininet(host=RemoteHost,
                  switch=RemoteOVSSwitch,
                  link=link,
                  waitConnected=True)
    c0 = net.addController('c0')
    # Make sure controller knows its non-loopback address
    Intf('eth0', node=c0).updateIP()
    info("*** Creating local h1\n")
    h1 = net.addHost('h1')
    info("*** Creating remote h2\n")
    h2 = net.addHost('h2', server=remote)
    info("*** Creating local s1\n")
    s1 = net.addSwitch('s1')
    info("*** Creating remote s2\n")
    s2 = net.addSwitch('s2', server=remote)
    info("*** Adding links\n")
    net.addLink(h1, s1)
    net.addLink(s1, s2)
    net.addLink(h2, s2)
    net.start()
    info('Mininet is running on', quietRun('hostname').strip(), '\n')
    for node in c0, h1, h2, s1, s2:
        info('Node', node, 'is running on', node.cmd('hostname').strip(), '\n')
    net.pingAll()
    CLI(net)
    net.stop()
示例#3
0
def clusterSanity():
    "Sanity check for cluster mode"
    topo = SingleSwitchTopo()
    net = MininetCluster( topo=topo )
    net.start()
    CLI( net )
    net.stop()
示例#4
0
def demo():
    "Simple Demo of Cluster Mode"
    servers = ['localhost', 'ubuntu2', 'ubuntu3']
    topo = TreeTopo(depth=3, fanout=3)
    net = MininetCluster(topo=topo, servers=servers, placement=SwitchBinPlacer)
    net.start()
    CLI(net)
    net.stop()