def start(self): dir = self.opts("dir") if not os.path.exists(dir): os.makedirs(dir) h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") hlist = HostList(h1, h2) self.hlist = hlist n = self.opts("n") hlist.rmmod() hlist.remove_qdiscs() if self.opts("enable"): hlist.insmod() else: # Rate limit second host to just the aggregate rate h2.insmod() h2.perfiso_set("ISO_MAX_TX_RATE", self.opts("rate")) h2.perfiso_set("ISO_RFAIR_INITIAL", self.opts("rate")) h1.perfiso_set("ISO_VQ_DRAIN_RATE_MBPS", self.opts('rate')) h1.perfiso_set("ISO_VQ_UPDATE_INTERVAL_US", self.opts("vqupdate")) if True: # Only for QCN tests perrate = int(self.opts("rate")) / n dt_qcn = min(1200, 100 * 1500 * 8 / perrate) hlist.perfiso_set("ISO_RFAIR_INCREASE_INTERVAL_US", dt_qcn) hlist.perfiso_set("ISO_RFAIR_DECREASE_INTERVAL_US", dt_qcn) # Create all IP routes etc. for i in xrange(n): hlist.create_ip_tenant(i+1) hlist.setup_tenant_routes(self.opts("n")) h1.start_monitors(self.opts("dir")) # Start iperf server iperf = Iperf({'-p': 5001}) self.procs.append(iperf.start_server(h1)) sleep(1) # Start all iperf clients for i in xrange(n): parallel = 4 iperf = Iperf({'-p': 5001, '-P': parallel, '-i': '1', '-c': h1.get_tenant_ip(i+1), '-B': h2.get_tenant_ip(i+1), 'dir': os.path.join(self.opts("dir"), "iperf"), '-t': self.opts('t')}) self.procs.append(iperf.start_client(h2)) if self.opts("profile"): self.h1 = h1 h1.start_profile(dir=self.opts("profile"))
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") hlist = HostList(h1, h2) self.hlist = hlist n = self.opts('n') hlist.rmmod() hlist.remove_qdiscs() hlist.insmod() hlist.prepare_iface() # VQ drain rate h1.perfiso_set("ISO_VQ_DRAIN_RATE_MBPS", self.opts('rate')) h1.perfiso_set("ISO_VQ_UPDATE_INTERVAL_US", "25") # Create vq class self.log("Creating vq classes") for i in xrange(n): hlist.create_ip_tenant(i+1) h1.start_monitors(self.opts('dir')) hlist.setup_tenant_routes(n) self.log("Starting %d iperfs" % n) # Start iperfs servers for i in xrange(n): parallel = 4 iperf = Iperf({'-p': 5001, '-P': parallel}) server = iperf.start_server(h1) self.procs.append(server) self.log("server %d" % i) sleep(1) for i in xrange(n): iperf = Iperf({'-p': 5001, '-P': parallel, '-c': h1.get_tenant_ip(i+1), '-t': self.opts('t')}) client = iperf.start_client(h2) self.procs.append(client) self.log("client %d" % i) if self.opts("profile"): h1.start_profile(dir=self.opts("profile")) self.h1 = h1
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") hlist = HostList(h1, h2) self.hlist = hlist n = self.opts('n') hlist.rmmod() hlist.remove_qdiscs() n = self.opts('n') hlist.prepare_iface() # Insert the module only in the second host h2.insmod() h2.perfiso_set("ISO_MAX_TX_RATE", self.opts("rate")) h2.perfiso_set("ISO_RFAIR_INITIAL", self.opts('rate')) # Create vq class # First host doesn't have module loaded ip = h2.get_10g_ip() h2.perfiso_create_txc(ip) h1.start_monitors(self.opts('dir')) if not self.opts("profile"): h1.start_perf_monitor(self.opts("dir"), self.opts('t')) self.log("Starting %d iperfs" % n) # Start same number of iperf servers for i in xrange(n): parallel = 4 iperf = Iperf({'-p': 5001, '-P': parallel}) server = iperf.start_server(h1) self.procs.append(server) sleep(1) for i in xrange(n): iperf = Iperf({'-p': 5001, '-P': parallel, '-c': h1.get_10g_ip(), '-t': self.opts('t')}) client = iperf.start_client(h2) self.procs.append(client)
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") hlist = HostList(h1, h2) self.hlist = hlist n = self.opts('n') hlist.cmd("rmmod newrl") hlist.remove_qdiscs() hlist.configure_rps() n = self.opts('n') if self.opts("rl") == "newrl": dev = h1.get_10g_dev() rate = self.opts("rate") h1.cmd("insmod ~/vimal/exports/newrl.ko rate=%s dev=%s" % (rate, dev)) else: # insert htb qdiscs in hierarchy dev = h1.get_10g_dev() ceil = '%sGbit' % (int(self.opts('rate')) / 1000) cmd = "tc qdisc add dev %s root handle 1: htb default 1" % dev h1.cmd(cmd) cmd = "tc class add dev %s classid 1:1 parent 1: htb" % dev cmd += " rate %s ceil %s mtu 64000" % (ceil, ceil) h1.cmd(cmd) h1.start_monitors(self.opts("dir")) # Start iperf server iperf = Iperf({'-p': 5001}) self.procs.append(iperf.start_server(h2)) sleep(1) # Start all iperf clients iperf = Iperf({'-p': 5001, '-P': self.opts("P"), '-i': '10', '-c': h2.get_10g_ip(), 'dir': os.path.join(self.opts("dir"), "iperf"), '-t': self.opts('t')}) self.procs.append(iperf.start_client(h1)) if self.opts("profile"): self.h1 = h1 h1.start_profile(dir=self.opts("profile")) return
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") h3 = Host("10.0.1.3") dev="eth2" self.hlist = HostList(h1, h2, h3) hlist = self.hlist h1.prepare_iface() h2.prepare_iface() h3.prepare_iface() hlist.rmmod() hlist.ipt_ebt_flush() if self.opts("enabled"): hlist.insmod() self.log("Creating a single UDP tenant") h1.create_udp_tenant(server_ports=[5001], tid=1) h1.create_udp_tenant(server_ports=[5002], tid=1) h2.create_udp_tenant(server_ports=[5001], tid=1) h3.create_udp_tenant(server_ports=[5002], tid=1) h1.perfiso_set("IsoAutoGenerateFeedback", "1") h1.perfiso_set("ISO_FEEDBACK_INTERVAL_US", 100) h1.perfiso_set("ISO_VQ_DRAIN_RATE_MBPS", 5000) #hlist.perfiso_set("ISO_VQ_MAX_BYTES", 50 * 1024) #hlist.perfiso_set("ISO_MAX_BURST_TIME_US", 500) #hlist.perfiso_set("ISO_VQ_MARK_THRESH_BYTES", 25 * 1024) hlist.start_monitors(self.opts("dir")) self.procs = [] # Start iperf servers for p in [5001, 5002]: opts = {'-p': p, '-u': True} iperf = Iperf(opts) server = iperf.start_server(h1) self.procs.append(server) # Start 32 UDP from h2 to h1 client = Iperf({'-p': 5001, '-c': h1.get_10g_ip(), '-t': self.opts("t"), '-b': '3G', '-P': 32}) client = client.start_client(h2) self.procs.append(client) # Start 32 UDP from h3 to h1 client = Iperf({'-p': 5002, '-c': h1.get_10g_ip(), '-t': self.opts("t"), '-b': '3G', '-P': 32}) client = client.start_client(h3) self.procs.append(client)
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") hlist = HostList(h1, h2) self.hlist = hlist n = self.opts('n') hlist.rmmod() hlist.remove_qdiscs() hlist.configure_rps() n = self.opts('n') if self.opts("enable"): h1.insmod() h1.perfiso_set("ISO_MAX_TX_RATE", self.opts("rate")) h1.perfiso_set("ISO_RFAIR_INITIAL", self.opts("rate")) else: # insert htb qdiscs in hierarchy dev = h1.get_10g_dev() ceil = '%sGbit' % (int(self.opts('rate')) / 1000) cmd = "tc qdisc add dev %s root handle 1: htb default 1000" % dev h1.cmd(cmd) for i in xrange(n): classid = 10+i tip = h1.get_tenant_ip(i+1) rate = "%.3f" % (float(self.opts("rate")) / n) cmd = "tc class add dev %s parent 1: classid 1:%s " % (dev, classid) cmd += "htb rate %sMbit ceil %s mtu 64000" % (rate, ceil) h1.cmd(cmd) cmd = 'tc filter add dev %s protocol ip parent 1: prio 1 ' % dev cmd += " u32 match ip src %s flowid 1:%s " % (tip, classid) h1.cmd(cmd) for i in xrange(n): #hlist.create_ip_tenant(i+1) ip = h1.get_tenant_ip(i+1) h1.perfiso_create_txc(ip) h1.tenants.append(i+1) h1.cmd("ifconfig %s:%d %s" % (h1.get_10g_dev(), i+1, ip)) h2.cmd("ifconfig %s:%d %s" % (h2.get_10g_dev(), i+1, h2.get_tenant_ip(i+1))) hlist.setup_tenant_routes(n) h1.start_monitors(self.opts("dir")) # Start iperf server iperf = Iperf({'-p': 5001}) self.procs.append(iperf.start_server(h2)) sleep(1) # Start all iperf clients for i in xrange(n): parallel = 4 iperf = Iperf({'-p': 5001, '-P': parallel, '-i': '1', '-c': h2.get_tenant_ip(i+1), 'dir': os.path.join(self.opts("dir"), "iperf"), '-t': self.opts('t')}) self.procs.append(iperf.start_client(h1)) if self.opts("profile"): self.h1 = h1 h1.start_profile(dir=self.opts("profile")) return
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") hlist = HostList(h1, h2) self.hlist = hlist hlist.rmmod() hlist.remove_qdiscs() hlist.configure_rps() n = self.opts('n') hlist.prepare_iface() direct=True if self.opts('rl') == "perfiso": hlist.insmod() hlist.perfiso_set("ISO_VQ_DRAIN_RATE_MBPS", "11000") hlist.perfiso_set("ISO_MAX_TX_RATE", self.opts("n") * self.opts('rate')) hlist.perfiso_set("ISO_RFAIR_INITIAL", self.opts("n") * self.opts('rate')) hlist.perfiso_set("ISO_TOKENBUCKET_TIMEOUT_NS", self.opts('timeout')) h1.delay = True h2.delay = True for i in xrange(n): #hlist.create_ip_tenant(i+1) ip = h1.get_tenant_ip(i+1) h1.perfiso_create_txc(ip) h1.tenants.append(i+1) if direct: h1.cmd("ifconfig %s:%d %s" % (h1.get_10g_dev(), i+1, ip)) else: h1.cmd("ifconfig br0:%d %s" % (i+1, ip)) #h2.create_ip_tenant(i+1) h2.delay = True h2.perfiso_create_txc(h2.get_tenant_ip(i+1)) h2.tenants.append(i+1) if direct: h2.cmd("ifconfig %s:%d %s" % (h2.get_10g_dev(), i+1, h2.get_tenant_ip(i+1))) else: h2.cmd("ifconfig br0:%d %s" % (i+1, h2.get_tenant_ip(i+1))) hlist.delayed_cmds_execute() else: self.configure_qdisc(h1) for i in xrange(n): hlist.create_ip_tenant(i+1) # Filter traffic to dest iperf port 5001+i to skb mark i+1 hlist.cmd("killall -9 iperf; iptables -F") self.log("Starting CPU/bandwidth monitors") self.hlist.start_monitors(self.opts("dir")) h1.setup_tenant_routes() self.log("Starting %d iperfs" % n) # Start iperfs servers parallel = self.opts("P") iperf = Iperf({'-p': 5001, '-P': parallel}) server = iperf.start_server(h2) self.procs.append(server) sleep(1) cpu = -1 m = self.opts("m") for i in xrange(n): ip = h2.get_tenant_ip(i+1) for j in xrange(m): cpu += 1 iperf = Iperf({'-p': 5001, '-P': parallel, '-c': ip, '-B': h1.get_tenant_ip(i+1), 'dir': self.opts("dir"), '-t': self.opts('t')}) client = iperf.start_client(h1, cpu=cpu) self.procs.append(client) if self.opts("profile"): h1.start_profile(dir=self.opts("profile")) self.h1 = h1
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") hlist = HostList(h1, h2) hlist_udp = HostList() for i in xrange(2, 2+self.opts("n")): try: ip = pick_host_ip(i) hi = Host(ip) hlist.append(hi) hlist_udp.append(hi) except: pass self.hlist = hlist hlist.prepare_iface() hlist.rmmod() hlist.insmod() self.log("Creating two tenants") h1.create_ip_tenant(tid=1) h1.create_ip_tenant(tid=2) # Set the weight for TCP tenant. UDP's weight is 1 h1.perfiso_set_vq_weight(vq=h1.get_tenant_ip(1), weight=self.opts("wtcp")) if self.opts("mtu"): hlist.set_mtu(self.opts("mtu")) else: hlist.set_mtu("1500") h2.create_ip_tenant(tid=1) hlist_udp.create_ip_tenant(2) sleep(1) hlist.setup_tenant_routes() if self.opts("enabled"): hlist.perfiso_set("IsoAutoGenerateFeedback", "1") hlist.perfiso_set("ISO_VQ_DRAIN_RATE_MBPS", self.opts("vqrate")) hlist.perfiso_set("ISO_VQ_UPDATE_INTERVAL_US", self.opts("vqupdate")) hlist.perfiso_set("ISO_RFAIR_INITIAL", 9000) # don't muck around with parameters #if self.opts("aimd_dt_us"): #hlist.perfiso_set("ISO_RFAIR_DECREASE_INTERVAL_US", self.opts("aimd_dt_us")) #hlist.perfiso_set("ISO_RFAIR_INCREASE_INTERVAL_US", self.opts("aimd_dt_us")) # At 500us, we increment by 1Mbps. So let's use this # to scale our increment accordingly #increment = max(1, self.opts("ai") * int(self.opts("aimd_dt_us")) / 500) #hlist.perfiso_set("ISO_RFAIR_INCREMENT", "%s" % increment) #hlist.perfiso_set("ISO_FALPHA", "%s" % self.opts("md")) else: hlist.perfiso_set("IsoAutoGenerateFeedback", 0) hlist.perfiso_set("ISO_VQ_DRAIN_RATE_MBPS", 100000) hlist.perfiso_set("ISO_VQ_UPDATE_INTERVAL_US", 1000000) hlist.perfiso_set("ISO_RFAIR_INITIAL", 100000) hlist.perfiso_set("ISO_MAX_TX_RATE", 100000) hlist.start_monitors(self.opts("dir"), 1e3) self.procs = [] if self.opts("tcptest") == "xput": # Start iperf servers iperf = Iperf({'-p': 5001}) server = iperf.start_server(h1) self.procs.append(server) sleep(1) # Start P TCP connection from h2 to h1 opts = {'-p': 5001, '-c': h1.get_10g_ip(), '-t': self.opts("t"), 'dir': self.opts("dir"), '-P': self.opts("P")} opts['-c'] = h1.get_tenant_ip(1) client = Iperf(opts) client = client.start_client(h2) self.procs.append(client) elif self.opts("tcptest") == "latency": # Start netperf server hlist.cmd("rmmod r2d2") h1.start_netperf_server() sleep(1) out = os.path.join(self.opts("dir"), "netperf_rr.txt") opts = "-v 2 -H %s -l %s " % (h1.get_tenant_ip(1), self.opts("t")) opts += " -t TCP_RR -D 1,s -- -r %s -D " % self.opts("rrsize") h2.start_netperf_client(opts=opts, out=out) if self.opts("traffic"): for hi in hlist.lst: LOADGEN = "taskset -c 7 /root/vimal/exports/loadgen" ip = hi.get_tenant_ip(2) out = os.path.join(self.opts("dir"), "loadgen.txt") cmd = "%s -i %s " % (LOADGEN, ip) cmd += "-l 12345 -p 500000 -f %s > %s" % (self.opts("traffic"), out) hi.cmd_async(cmd) # Start it sleep(5) execs = [] for hi in hlist.lst: ip = hi.get_tenant_ip(2) execs.append(subprocess.Popen("nc -nzv %s %s" % (ip, 12345), shell=True)) for e in execs: e.wait() else: for hi in hlist_udp.lst: # Start 32 UDP from h3 to h1 opts = {'-p': 5002, '-c': h1.get_10g_ip(), '-t': self.opts("t"), '-b': '3G', 'start_udp': self.opts("start_udp"), '-B': hi.get_tenant_ip(2), '-P': self.opts("P")} opts['-c'] = h1.get_tenant_ip(2) client = Iperf(opts) client = client.start_client(hi) self.procs.append(client)
def start(self): h1 = Host("10.0.1.1") h2 = Host("10.0.1.2") h3 = Host("10.0.1.4") self.hlist = HostList(h1, h2, h3) hlist = self.hlist for h in hlist.lst: h.prepare_iface() h.prepare_iface(direct=not args.oneg) hlist.configure_rps() hlist.rmmod() if self.opts("enabled"): for h in hlist.lst: h.insmod(direct=not args.oneg) self.log("Creating two tenants") #h1.create_tcp_tenant(server_ports=[5001], tid=1) #h1.create_tcp_tenant(server_ports=[5002], tid=2) #h2.create_tcp_tenant(server_ports=[5001], tid=1) #h3.create_tcp_tenant(server_ports=[5002], tid=2) h1.create_ip_tenant(tid=1, weight=self.opts("wtcp"), direct=not args.oneg) h1.create_ip_tenant(tid=2, direct=not args.oneg) h2.create_ip_tenant(tid=1, direct=not args.oneg) h3.create_ip_tenant(tid=1, direct=not args.oneg) if self.opts("enabled"): hlist.perfiso_set("ISO_VQ_DRAIN_RATE_MBPS", self.opts("vqrate")) hlist.perfiso_set("IsoAutoGenerateFeedback", 1) hlist.perfiso_set("ISO_VQ_UPDATE_INTERVAL_US", 25) if self.opts("oneg"): hlist.perfiso_set("ISO_VQ_MARK_THRESH_BYTES", 30000) hlist.perfiso_set("ISO_VQ_MAX_BYTES", 60000) hlist.perfiso_set("ISO_RFAIR_INCREASE_INTERVAL_US", 2000) hlist.perfiso_set("ISO_RFAIR_DECREASE_INTERVAL_US", 2000) hlist.start_monitors(self.opts("dir"), 1e3) self.procs = [] # Start iperf servers for p in [5001, 5002]: iperf = Iperf({'-p': p}) server = iperf.start_server(h1) self.procs.append(server) sleep(1) # Start 1 TCP connection from h2 to h1 client = Iperf({'-p': 5001, '-c': h1.get_10g_ip(), '-t': self.opts("t"), '-P': 2}) if self.opts("enabled"): client.opts["-c"] = h1.get_tenant_ip(1) client = client.start_client(h2) self.procs.append(client) # Start 32 TCP from h3 to h1 client = Iperf({'-p': 5002, '-c': h1.get_10g_ip(), '-t': self.opts("t"), '-P': self.opts("P")}) if self.opts("enabled"): client.opts["-c"] = h1.get_tenant_ip(2) if self.opts("udp"): client.opts["-b"] = '3G' client = client.start_client(h3) self.procs.append(client)