Example #1
0
def topologie():
    call(["mn", "-c"])

    net = Mininet(controller=RemoteController, link=TCLink)
    c0 = net.addController('c0',
                           controller=RemoteController,
                           ip="127.0.0.1",
                           port=6633)

    h1 = net.addHost('h1', ip='10.0.0.1', mac="00:00:00:00:00:01")
    h2 = net.addHost('h2', ip='10.0.0.2', mac="00:00:00:00:00:02")
    h3 = net.addHost('h3', ip='10.0.0.3', mac="00:00:00:00:00:03")
    h4 = net.addHost('h4', ip='10.0.0.4', mac="00:00:00:00:00:04")
    h5 = net.addHost('h5', ip='10.0.0.5', mac="00:00:00:00:00:05")
    h6 = net.addHost('h6', ip='10.0.0.6', mac="00:00:00:00:00:06")

    s1 = net.addSwitch('s1')
    s2 = net.addSwitch('s2')
    s3 = net.addSwitch('s3')
    s4 = net.addSwitch('s4')
    s5 = net.addSwitch('s5')
    s6 = net.addSwitch('s6')
    s7 = net.addSwitch('s7')
    s8 = net.addSwitch('s8')
    s9 = net.addSwitch('s9')
    s10 = net.addSwitch('s10')
    s11 = net.addSwitch('s11')
    s12 = net.addSwitch('s12')

    net.addLink(h1, s1)
    net.addLink(h2, s2)
    net.addLink(h3, s3)
    net.addLink(h4, s10)
    net.addLink(h5, s11)
    net.addLink(h6, s12)

    net.addLink(s1, s4, bw=10)
    net.addLink(s2, s4, bw=10)
    net.addLink(s3, s4, bw=10)

    net.addLink(s4, s5, bw=3)
    net.addLink(s4, s6, bw=4)
    net.addLink(s4, s7)

    net.addLink(s5, s6, bw=3)

    net.addLink(s6, s9)
    net.addLink(s6, s10, bw=10)
    net.addLink(s6, s11, bw=10)
    net.addLink(s6, s12, bw=10)

    net.addLink(s7, s8, bw=2)
    net.addLink(s8, s9, bw=2)

    net.start()

    net.pingAllFull()

    CLI(net)
    net.stop()
Example #2
0
def Test(var, i):
    global res
    res1 = 0
    controller = Controller()
    controller.start()
    topo = linear(var)
    net = Mininet(topo=topo,
                  controller=RemoteController(controller.name, port=6653))
    #net = Mininet(topo=topo)
    net.start()
    print("Dumping host connections")
    dumpNodeConnections(net.hosts)
    print("Testing network connectivity")
    res1 = net.pingAllFull()
    res[i] += res1
    net.stop()
    controller.stop()
def testtopology():
    tkinter.messagebox.showinfo("Deploy topology to mininet ", "Press ok button and wait for a seconds to see result")

    with open('./stdout.txt', 'w') as outfile:
        with redirect_stdout(outfile), redirect_stderr(outfile):

            topo = CustomTopology()
            net = Mininet(topo=topo, cleanup=True)

            print('\n =================================================> Start the topology \n')
            net.start()

            print('\n =================================================> Test the topology by running a ping command \n')

            ping_all_full = net.pingAllFull()
            print('Result from ping Test: \n' + '\n' + str(ping_all_full) + '\n' + '\n % of packets dropped.\n')

            ping_pair = net.pingPairFull()
            print('Result from Regression Test : \n' + '\n' + str(ping_pair) + '\n' + '\n % of packets dropped.\n')

            print('\n ==============> Testing TCP bandwidth between: \n')

            iperf_origin = net.getNodeByName(node_1)
            iperf_destination = net.getNodeByName(node_2)

            iPerf = net.iperf([iperf_origin, iperf_destination])

            print('Result from iPerf between node ' + node_1 + ' and node ' + node_2 + '\n' + '\n' + str(iPerf) + '\n')

            stop = net.stop()
            print('Stop the network:' + str(stop) + '\n')

            clean = net.cleanup
            print('cleanup the mininet network: ' + str(clean) + '\n')

    with open('./stdout.txt') as infile:
        mnOutput.insert(END, infile.read())