def runExperiment():
    # c = RemoteController('c0', ip='0.0.0.0', port=6633)

    net = Mininet(topo=StaticTopo())
    net.start()
    h1 = net.get('h1')
    h2 = net.get('h2')

    # there is probably a better way, but somehow we have to configure
    # the IP addresses
    for i in range(0, 2):
        h1.cmd('ifconfig h1-eth' + str(i) + ' 1' + str(i) + '.0.0.1')
        h2.cmd('ifconfig h2-eth' + str(i) + ' 1' + str(i) + '.0.0.2')

    # set path manager
    os.system('sysctl -w net.mptcp.mptcp_path_manager=fullmesh')
    # set scheduler
    os.system('sysctl -w net.mptcp.mptcp_scheduler=rbs')

    # you may want to start wireshark here and finish by typing exit
    cli = CLI(net)
    CLI.do_xterm(cli, 'h1 h2')
    CLI(net)
    h1.cmd(
        'ffplay -rtsp_flags listen rtsp://{}:6633/live.sdp?tcp 2>listener.txt &'
        .format('0.0.0.0'))
    sleep(3)
    h2.cmd(
        "ffmpeg -i ./videos/sample2.mp4 -f rtsp -rtsp_transport tcp rtsp://{}:6633/live.sdp 2>vid.txt"
        .format(h1.IP()))
    CLI(net)
    net.stop()
Beispiel #2
0
def runExperiment():
    # c = RemoteController('c0', ip='0.0.0.0', port=6633)

    net = Mininet(topo=StaticTopo())
    net.start()
    h1 = net.get('h1')
    h2 = net.get('h2')

    # there is probably a better way, but somehow we have to configure
    # the IP adresses
    for i in range(0, 2):
        h1.cmd('ifconfig h1-eth' + str(i) + ' 1' + str(i) + '.0.0.1')
        h2.cmd('ifconfig h2-eth' + str(i) + ' 1' + str(i) + '.0.0.2')

    # set path manager
    os.system('sysctl -w net.mptcp.mptcp_path_manager=fullmesh')
    # set scheduler
    os.system('sysctl -w net.mptcp.mptcp_scheduler=rbs')

    # you may want to start wireshark here and finish by typing exit
    cli = CLI(net)
    CLI.do_xterm(cli, 'h1 h2')
    CLI(net)
    # h1.cmd('python3 server.py 0.0.0.0 &')
    # h2.cmd("python3 client.py 10.0.0.1")
    # CLI(net)
    net.stop()
Beispiel #3
0
def run():
    cli_object = None

    myTopo = SimpleTopo()
    myController = partial(RemoteController, ip='192.168.74.5', port=6633)
    #myController = partial(RemoteController, ip='127.0.0.1', port=6633)
    net = Mininet(topo=myTopo, host=CPULimitedHost,
                  controller=myController)
    configureNet(net)
    net.start()

    network_situation = NetworkSituation(switch_state = {1:True, 2:True}, interface_state = {1:True, 2:True, 3:True, 4:True})

    network_state_manager = TestingNetworkStateManager(network_situation, net)

    def Stopping():
        print "ChangingState!!"
        network_state_manager.change_to_state(NetworkSituation(switch_state = {1:True, 2:False},
                                                               interface_state = {1:True, 2:True, 3:False, 4:True}),cli_object )

    def Starting():
        print "ChangingState22!!"
        network_state_manager.change_to_state(NetworkSituation(switch_state = {1:True, 2:True},
                                                               interface_state = {1:True, 2:True, 3:True, 4:True}),cli_object )

    #threading.Timer(10.0, Stopping).start()
    #threading.Timer(20.0, Starting).start()


    h1 = net.get('h1')
    h1.cmd('cd /home/mininet/server/h1')
    h1.cmd('python -m SimpleHTTPServer 80 &')

    h2 = net.get('h2')
    h2.cmd('cd /home/mininet/server/h2')
    h2.cmd('python -m SimpleHTTPServer 80 &')

    if False:  # nieważne, do testów
        cli = CLI(net, script='echo "lol"')
        CLI.do_xterm(cli, "h2 klient1")

        for line in sys.stdin:
            print line
    elif True:
        cli = CLI(net, script='echo "lol"')
        cli_object = cli

        threading.Timer(5.0, lambda : test1(cli_object, net)).start()

        CLI(net)
    else:
        CLI(net)


    # POLECENIA DO TESTOWANIA
    # klient1 ping 10.0.5.1 -c1
    # klient2 ping 10.0.5.1 -c1
    #
    # klient1 wget -O - -T 1 -t 1 10.0.5.1
    # klient2 wget -O - -T 1 -t 1 10.0.5.1
    net.stop()