예제 #1
0
def main():
    in_rates = [10e6, 100e6, 1000e6]
    ctrl_rates = []
    out_dir = "control_test"
    sleep_per_test = 10  # seconds
    setLogLevel("info")
    topo = TestTopo(2)
    net = Mininet(topo=topo, controller=None)
    net.start()
    net.ping()
    hosts = net.hosts
    src_host = hosts[0]
    dst_host = hosts[1]
    ctrl_iface = connect_controller(net, src_host)
    server_proc = launch_goben_server(dst_host)
    time.sleep(2)
    for in_rate in in_rates:
        ctrl_proc = launch_ctrl_client(src_host, in_rate)
        tx_rate, bw_proc = init_rate_control(ctrl_iface, in_rate)
        time.sleep(0.5)
        ctrl_rates = generate_ctrl_rates(in_rate)
        client_proc = launch_goben_client(src_host, dst_host, in_rate)
        for ctrl_rate in ctrl_rates:
            log.info("#############################")
            tx_rate[0] = ctrl_rate
            dc_utils.start_process("tc qdisc show dev h0-eth0", src_host)
            record_rate(in_rate, ctrl_rate, sleep_per_test, out_dir)
            log.info("#############################")
        dc_utils.kill_processes([ctrl_proc, client_proc, bw_proc])
    dc_utils.kill_processes([server_proc])
    summarize(out_dir)
    net.stop()
예제 #2
0
 def _start_generators(self, hosts, input_file, traffic_gen, out_dir):
     log.info("Loading file: %s" % input_file)
     if not os.path.basename(input_file) == "all":
         traffic_pattern = parse_traffic_file(input_file)
         if traffic_pattern is None:
             log.error("No traffic pattern provided!")
             dc_utils.kill_processes(self.service_procs, use_sigkill=True)
             exit(1)
     log.info("Starting load-generators")
     if os.path.basename(input_file) == "all":
         # generate an all-to-all pattern
         for src_host in hosts:
             dst_hosts = []
             for dst_host in hosts:
                 if src_host != dst_host:
                     dst_hosts.append(dst_host.intfList()[0].IP())
             self._start_client(traffic_gen, src_host, out_dir, dst_hosts)
     else:
         for src_host in hosts:
             host_ip = src_host.intfList()[0].IP()
             dst_hosts = []
             # generate a pattern according to the traffic matrix
             for config_row in traffic_pattern:
                 if host_ip == config_row["src"]:
                     dst_hosts.append(config_row["dst"])
             self._start_client(traffic_gen, src_host, out_dir, dst_hosts)
예제 #3
0
 def _start_controllers(self, hosts, out_dir):
     # The binary of the host rate limiter
     traffic_ctrl = FILE_DIR + "/control/go_ctrl"
     if not os.path.isfile(traffic_ctrl):
         log.info("The traffic controller does not exist.\n"
                  "Run the install.sh script to compile it.")
         dc_utils.kill_processes(self.service_procs)
         exit(1)
     log.info("Starting controllers")
     for host in hosts:
         iface_net = host.intfList()[0]
         ifaces_ctrl = host.intfList()[1]
         out_file = "%s/%s_ctrl" % (out_dir, host.name)
         ctrl_cmd = "%s " % traffic_ctrl
         ctrl_cmd += "-n %s " % iface_net
         ctrl_cmd += "-c %s " % ifaces_ctrl
         ctrl_cmd += "-r %d " % self.net_man.topo.conf["max_capacity"]
         c_proc = dc_utils.start_process(ctrl_cmd, host, out_file)
         self.service_procs.append(c_proc)
예제 #4
0
 def _stop_traffic(self):
     log.info("")
     log.info("Stopping traffic processes")
     dc_utils.kill_processes(self.traffic_procs)
     del self.traffic_procs[:]
     sys.stdout.flush()
예제 #5
0
 def _stop_services(self):
     log.info("")
     log.info("Stopping services")
     dc_utils.kill_processes(self.service_procs, use_sigkill=True)
     del self.service_procs[:]
     sys.stdout.flush()