def createTopo(pod,
               density,
               ip="192.168.16.137",
               port=6653,
               bw_c2a=1000,
               bw_a2e=500,
               bw_e2h=250):
    """
        Create network topology and run the Mininet.
    """
    topo = Fattree(pod, density)
    topo.createNodes()
    topo.createLinks(bw_c2a=bw_c2a, bw_a2e=bw_a2e, bw_e2h=bw_e2h)
    # Start Mininet.
    CONTROLLER_IP = ip
    CONTROLLER_PORT = port
    net = Mininet(topo=topo, link=TCLink, controller=None, autoSetMacs=True)
    net.addController('controller',
                      controller=RemoteController,
                      ip=CONTROLLER_IP,
                      port=CONTROLLER_PORT)
    net.start()
    # Set OVS's protocol as OF13.
    topo.set_ovs_protocol_13()
    # Set hosts IP addresses.
    set_host_ip(net, topo)
    # Install proactive flow entries
    install_proactive(net, topo)
    pingPath = '/home/lee/ryu2/ryu/app/experiments/ping_test.txt'
    iperfPath = '/home/lee/ryu2/ryu/app/experiments/iperf_peers.txt'
    iperf_peers = readIpeers(iperfPath)
    ping_peers = readIpeers(pingPath)
    # 2. Start the controller.
    k_paths = args.k**2 / 4
    fanout = args.k
    # Controller_Ryu = Popen("ryu-manager --observe-links SRrouting.py --k_paths=%d --weight=hop --fanout=%d --miceIndex=%f" %(k_paths, fanout,0.8), shell=True, preexec_fn=os.setsid)
    Controller_Ryu = Popen(
        "ryu-manager --observe-links ./Hedera.py --k_paths=%d --weight=hop --fanout=%d "
        % (k_paths, fanout),
        shell=True,
        preexec_fn=os.setsid)
    # # Wait until the controller has discovered network topology.
    time.sleep(60)
    # 3. Generate traffics and test the performance of the network.
    monitor1 = Process(target=pingTest, args=(net, ping_peers))
    traffic_generation(net, iperf_peers, monitor1)
    time.sleep(60)
    monitor1.terminate()
    os.system('killall ping')
    os.system('killall iperf')
    # CLI(net)
    os.killpg(Controller_Ryu.pid, signal.SIGKILL)
    net.stop()
def run_experiment(pod,
                   density,
                   ip="192.168.16.137",
                   port=6653,
                   bw_c2a=100,
                   bw_a2e=100,
                   bw_e2h=100):
    """
        Firstly, start up Mininet;
        secondly, generate traffics and test the performance of the network.
    """
    # Create Topo.
    iperfPath = '/home/lee/ryu2/ryu/app/experiments/iperf_peers.txt'
    pingPath = '/home/lee/ryu2/ryu/app/experiments/ping_test.txt'
    # lossPath = '/home/lee/ryu2/ryu/app/experiments/link_loss.txt'
    iperf_peers = readIpeers(iperfPath)
    ping_peers = readIpeers(pingPath)
    # loss = readIpeers(lossPath)
    time.sleep(2)
    topo = Fattree(pod, density)
    topo.createNodes()
    topo.createLinks(bw_c2a=bw_c2a,
                     bw_a2e=bw_a2e,
                     bw_e2h=bw_e2h,
                     links_loss=loss)

    # 1. Start Mininet
    CONTROLLER_IP = ip
    CONTROLLER_PORT = port
    net = Mininet(topo=topo, link=TCLink, controller=None, autoSetMacs=True)
    net.addController('controller',
                      controller=RemoteController,
                      ip=CONTROLLER_IP,
                      port=CONTROLLER_PORT)
    net.start()
    # Set the OpenFlow version for switches as 1.3.0.
    topo.set_ovs_protocol_13()
    # Set the IP addresses for hosts.
    set_host_ip(net, topo)
    # Install proactive flow entries.
    install_proactive(net, topo)
    # monitor1 = Process(target=pingTest, args=(net, ping_peers))
    # monitor = Process(target=monitor_devs_ng, args=('%s/bwmng.txt' % args.output_dir, 1.0))
    # 3. Generate traffics and test the performance of the network.
    # traffic_generation(net, iperf_peers, monitor1,monitor)
    traffic_generation1(net, iperf_peers, ping_peers)

    os.system('killall ping')
    os.system('killall iperf')
    # CLI(net)
    # os.killpg(Controller_Ryu.pid, signal.SIGKILL)
    net.stop()
Beispiel #3
0
def createTopo(pod,
               density,
               ip="192.168.16.128",
               port=6653,
               bw_c2a=1000,
               bw_a2e=500,
               bw_e2h=250):
    """
		Create network topology and run the Mininet.
	"""
    topo = Fattree(pod, density)
    topo.createNodes()
    topo.createLinks(bw_c2a=bw_c2a, bw_a2e=bw_a2e, bw_e2h=bw_e2h)
    # Start Mininet.
    CONTROLLER_IP = ip
    CONTROLLER_PORT = port
    net = Mininet(topo=topo, link=TCLink, controller=None, autoSetMacs=True)
    net.addController('controller',
                      controller=RemoteController,
                      ip=CONTROLLER_IP,
                      port=CONTROLLER_PORT)
    net.start()
    # Set OVS's protocol as OF13.
    topo.set_ovs_protocol_13()
    # Set hosts IP addresses.
    set_host_ip(net, topo)
    # Install proactive flow entries
    install_proactive(net, topo)
    iperf_peers = readIpeers()
    # 2. Start the controller.
    k_paths = args.k**2 / 4
    fanout = args.k
    Controller_Ryu = Popen(
        "ryu-manager --observe-links Normalrouting.py --k_paths=%d --weight=hop --fanout=%d"
        % (k_paths, fanout),
        shell=True,
        preexec_fn=os.setsid)
    # Wait until the controller has discovered network topology.
    time.sleep(60)
    # 3. Generate traffics and test the performance of the network.
    traffic_generation(net, iperf_peers)

    time.sleep(60)

    # os.killpg(Controller_Ryu.pid, signal.SIGKILL)
    # Controller_Ryu = Popen("ryu-manager --observe-links SRrouting.py --k_paths=%d --weight=hop --fanout=%d" % (k_paths, fanout),shell=True, preexec_fn=os.setsid)
    # # Wait until the controller has discovered network topology.
    # time.sleep(60)
    # # 3. Generate traffics and test the performance of the network.
    # traffic_generation(net, readIpeers(),'SRrouting')
    # time.sleep(60)
    # CLI(net)
    # Stop the controller.
    os.killpg(Controller_Ryu.pid, signal.SIGKILL)
    net.stop()
def createTopo(pod, density, ip="192.168.16.138", port=6653, bw_c2a=100, bw_a2e=100, bw_e2h=100):
    """
        Create network topology and run the Mininet.
    """
    iperfPath = '/home/lee/ryu2/ryu/app/experiments/iperf_peers.txt'
    pingPath = '/home/lee/ryu2/ryu/app/experiments/ping_test.txt'
    # lossPath='/home/lee/ryu2/ryu/app/experiments/link_loss.txt'
    iperf_peers = readIpeers(iperfPath)
    ping_peers = readIpeers(pingPath)
    # loss = readIpeers(lossPath)
    time.sleep(2)
    topo = Fattree(pod, density)
    topo.createNodes()
    topo.createLinks(bw_c2a=bw_c2a, bw_a2e=bw_a2e, bw_e2h=bw_e2h)
    # Start Mininet.
    CONTROLLER_IP = ip
    CONTROLLER_PORT = port
    net = Mininet(topo=topo, link=TCLink, controller=None, autoSetMacs=True)
    net.addController(
        'controller', controller=RemoteController,
        ip=CONTROLLER_IP, port=CONTROLLER_PORT)
    net.start()
    # Set OVS's protocol as OF13.
    topo.set_ovs_protocol_13()
    # Set hosts IP addresses.
    set_host_ip(net, topo)
    # Install proactive flow entries
    install_proactive(net, topo)
    # 2. Start the controller.
    k_paths = args.k ** 2 / 4
    fanout = args.k
    Controller_Ryu = Popen("ryu-manager --observe-links ./PureSDNPkt/Normalrouting.py --k_paths=%d --weight=hop --fanout=%d --dir=%s --miceIndex=%f" %(k_paths, fanout,args.output_dir[2:],args.miceIndex), shell=True, preexec_fn=os.setsid)
    time.sleep(60)
    t.traffic_generation(net, iperf_peers, ping_peers)
    os.system('killall ping')
    os.system('killall iperf')
    # CLI(net)
    os.killpg(Controller_Ryu.pid, signal.SIGKILL)
    net.stop()
def createTopo(pod,
               density,
               ip="192.168.16.137",
               port=6653,
               bw_c2a=100,
               bw_a2e=100,
               bw_e2h=100):
    """
        Create network topology and run the Mininet.
    """
    iperfPath = '/home/lee/ryu2/ryu/app/experiments/iperf_peers.txt'
    pingPath = '/home/lee/ryu2/ryu/app/experiments/ping_test.txt'
    # lossPath = '/home/lee/ryu2/ryu/app/experiments/link_loss.txt'
    iperf_peers = readIpeers(iperfPath)
    ping_peers = readIpeers(pingPath)
    # loss = readIpeers(lossPath)
    time.sleep(2)
    topo = Fattree(pod, density)
    topo.createNodes()
    topo.createLinks(bw_c2a=bw_c2a, bw_a2e=bw_a2e, bw_e2h=bw_e2h)
    # Start Mininet.
    CONTROLLER_IP = ip
    CONTROLLER_PORT = port
    net = Mininet(topo=topo, link=TCLink, controller=None, autoSetMacs=True)
    net.addController('controller',
                      controller=RemoteController,
                      ip=CONTROLLER_IP,
                      port=CONTROLLER_PORT)
    net.start()

    # Set OVS's protocol as OF13.
    topo.set_ovs_protocol_13()
    # Set hosts IP addresses.
    set_host_ip(net, topo)
    # Install proactive flow entries
    install_proactive(net, topo)
    # dumpNodeConnections(net.hosts)
    # pingTest(net)
    # iperfTest(net, topo)
    k_paths = args.k**2 / 4
    fanout = args.k
    Controller_Ryu = Popen(
        "ryu-manager --observe-links ./Hedera/Hedera.py --k_paths=%d --weight=bw --fanout=%d"
        % (k_paths, fanout),
        shell=True,
        preexec_fn=os.setsid)

    # Wait until the controller has discovered network topology.
    time.sleep(60)
    # monitor1 = Process(target=pingTest, args=(net, ping_peers))
    # monitor = Process(target=monitor_devs_ng, args=('%s/bwmng.txt' % args.output_dir, 1.0))
    # 3. Generate traffics and test the performance of the network.
    # traffic_generation(net,iperf_peers,monitor1,monitor)
    traffic_generation1(net, iperf_peers, ping_peers)
    os.system('killall ping')
    os.system('killall iperf')

    # Stop the controller
    # CLI(net)
    os.killpg(Controller_Ryu.pid, signal.SIGKILL)

    net.stop()