def test_checksum_checking(self): """ Packet forwarding checking test """ self.dut.kill_all() all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) core_mask = dts.create_mask( self.dut.get_core_list('1S/1C/1T', socket=self.ports_socket)) port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) for rxfreet_value in self.rxfreet_values: self.pmdout.start_testpmd( "all", "--coremask=%s --portmask=%s --nb-cores=2 --enable-rx-cksum --disable-hw-vlan --disable-rss --crc-strip --rxd=1024 --txd=1024 --rxfreet=%d" % (core_mask, port_mask, rxfreet_value)) self.dut.send_expect("set fwd csum", "testpmd> ") self.dut.send_expect("start", "testpmd> ") self.send_packet(self.frame_sizes[0], checksum_test=True) l4csum_error = self.stop_and_get_l4csum_errors() # Check the l4 checksum errors reported for Rx port self.verify( 1 == int(l4csum_error[1]), "Wrong l4 checksum error count using rxfreet=%d (expected 1, reported %s)" % (rxfreet_value, l4csum_error[1])) self.dut.send_expect("quit", "# ", 30) sleep(5)
def test_checksum_checking(self): """ Packet forwarding checking test """ self.dut.kill_all() all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) core_mask = dts.create_mask(self.dut.get_core_list('1S/1C/1T', socket=self.ports_socket)) port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) for rxfreet_value in self.rxfreet_values: self.pmdout.start_testpmd("all", "--coremask=%s --portmask=%s --nb-cores=2 --enable-rx-cksum --disable-hw-vlan --disable-rss --crc-strip --rxd=1024 --txd=1024 --rxfreet=%d" % (core_mask, port_mask, rxfreet_value)) self.dut.send_expect("set fwd csum", "testpmd> ") self.dut.send_expect("start", "testpmd> ") self.send_packet(self.frame_sizes[0], checksum_test=True) l4csum_error = self.stop_and_get_l4csum_errors() # Check the l4 checksum errors reported for Rx port self.verify(1 == int(l4csum_error[1]), "Wrong l4 checksum error count using rxfreet=%d (expected 1, reported %s)" % (rxfreet_value, l4csum_error[1])) self.dut.send_expect("quit", "# ", 30) sleep(5)
def functional_check_ipv4(self, cores, pkt_sizes, burst=1, flag=None, funtion=None): """ Perform functional fragmentation checks. """ coremask = dts.create_mask(cores) portmask = dts.create_mask([P0, P1]) numPortThread = len([P0, P1]) / len(cores) result = True errString = '' # run ipv4_frag self.dut.send_expect("examples/ip_fragmentation/build/ip_fragmentation -c %s -n %d -- -p %s -q %s" % ( coremask, self.dut.get_memory_channels(), portmask, numPortThread), "IP_FRAG:", 120) txItf = self.tester.get_interface(self.tester.get_local_port(P0)) rxItf = self.tester.get_interface(self.tester.get_local_port(P1)) dmac = self.dut.get_mac_address(P0) for size in pkt_sizes[::burst]: # simulate to set TG properties if flag == 'frag': # do fragment expPkts = (1517 + size) / 1518 val = 0 else: expPkts = 1 val = 2 # set wait packet self.tester.scapy_background() self.tester.scapy_append('import string') self.tester.scapy_append('p = sniff(iface="%s", count=%d, timeout=5)' % (rxItf, expPkts)) self.tester.scapy_append('nr_packets=len(p)') self.tester.scapy_append('reslist = [p[i].sprintf("%IP.len%;%IP.id%;%IP.flags%;%IP.frag%") for i in range(nr_packets)]') self.tester.scapy_append('RESULT = string.join(reslist, ",")') # send packet self.tester.scapy_foreground() for times in range(burst): self.tester.scapy_append('sendp([Ether(dst="%s")/IP(dst="100.10.0.1",src="1.2.3.4",flags=%d)/Raw(load="X"*%d)], iface="%s")' % (dmac, val, pkt_sizes[pkt_sizes.index(size) + times] - 38, txItf)) self.tester.scapy_execute() time.sleep(5) out = self.tester.scapy_get_result() nr_packets = len(out.split(',')) if funtion is not None: if not funtion(size, out.split(',')): result = False errString = "failed on fragment check size " + str(size) break elif nr_packets != expPkts: result = False errString = "Failed on forward packet size " + str(size) break self.dut.send_expect("^C", "#") # verify on the bottom so as to keep safety quit application self.verify(result, errString)
def benchmark(self, index, lcore, num_pthreads, size_list): """ Just Test IPv4 Throughput for selected parameters. """ Bps = dict() Pps = dict() Pct = dict() if int(lcore[0]) == 1: core_mask = dts.create_mask(self.dut.get_core_list(lcore, socket=self.ports_socket)) else: core_mask = dts.create_mask(self.dut.get_core_list(lcore)) portmask = dts.create_mask([P0, P1]) self.dut.send_expect("examples/ip_fragmentation/build/ip_fragmentation -c %s -n %d -- -p %s -q %s" % ( core_mask, self.dut.get_memory_channels(), portmask, num_pthreads), "IP_FRAG:", 120) result = [2, lcore, num_pthreads] for size in size_list: dmac = self.dut.get_mac_address(P0) flows = ['Ether(dst="%s")/IP(src="1.2.3.4", dst="100.10.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.20.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IPv6(dst="101:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58), 'Ether(dst="%s")/IPv6(dst="201:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58)] self.tester.scapy_append('wrpcap("test1.pcap", [%s])' % string.join(flows, ',')) # reserved for rx/tx bidirection test dmac = self.dut.get_mac_address(P1) flows = ['Ether(dst="%s")/IP(src="1.2.3.4", dst="100.30.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.40.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IPv6(dst="301:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58), 'Ether(dst="%s")/IPv6(dst="401:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58)] self.tester.scapy_append('wrpcap("test2.pcap", [%s])' % string.join(flows, ',')) self.tester.scapy_execute() tgenInput = [] tgenInput.append((self.tester.get_local_port(P0), self.tester.get_local_port(P1), "test1.pcap")) tgenInput.append((self.tester.get_local_port(P1), self.tester.get_local_port(P0), "test2.pcap")) factor = (size + 1517) / 1518 # wireSpd = 2 * 10000.0 / ((20 + size) * 8) Bps[str(size)], Pps[str(size)] = self.tester.traffic_generator_throughput(tgenInput) self.verify(Pps[str(size)] > 0, "No traffic detected") Pps[str(size)] *= 1.0 / factor / 1000000 Pct[str(size)] = (1.0 * Bps[str(size)] * 100) / (2 * 10000000000) result.append(Pps[str(size)]) result.append(Pct[str(size)]) dts.results_table_add_row(result) self.dut.send_expect("^C", "#")
def set_up_all(self): """ Run at the start of each test suite. Whitelist Prerequistites: Two Ports testpmd can normally started """ self.frames_to_send = 1 # Based on h/w type, choose how many ports to use self.dutPorts = self.dut.get_ports() # Verify that enough ports are available self.verify(len(self.dutPorts) >= 1, "Insufficient ports") portMask = dts.create_mask(self.dutPorts[:2]) self.pmdout = PmdOutput(self.dut) self.pmdout.start_testpmd("1S/2C/1T", "--portmask=%s" % portMask) self.dut.send_expect("set verbose 1", "testpmd> ") # get dest address from self.target port out = self.dut.send_expect("show port info %d" % self.dutPorts[0], "testpmd> ") self.dest = self.dut.get_mac_address(self.dutPorts[0]) mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})" ret = dts.regexp(out, mac_scanner) self.verify(ret is not None, "MAC address not found") self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong") self.max_mac_addr = dts.regexp(out, "Maximum number of MAC addresses: ([0-9]+)")
def set_up_all(self): """ Run at the start of each test suite. PMD prerequisites. """ # Check for port availability self.needed_ports = { "niantic": 2, "I217V": 1, "I217LM": 1, "I218V": 1, "I218LM": 1 } self.dut_ports = self.dut.get_ports() self.verify( len(self.dut_ports) >= self.needed_ports[self.nic], "Insufficient ports for speed testing") out = self.dut.build_dpdk_apps("./examples/ip_pipeline") self.verify("Error" not in out, "Compilation error") self.ports_mask = dts.create_mask( [self.dut_ports[0], self.dut_ports[1]]) self.coremask = "0x3e" # IP Pipeline app requires FIVE cores self.dut.setup_memory(4096)
def test_timer_callbacks_verify(self): """ Timer callbacks running on targeted cores """ # get the mask for the first core cores = self.dut.get_core_list('1S/1C/1T') coreMask = dts.create_mask(cores) # run timer on the background cmdline = "./examples/timer/build/app/timer -n 1 -c " + coreMask + " &" self.dut.send_expect(cmdline, "# ", 1) time.sleep(15) out = self.dut.send_expect("killall timer", "# ", 5) # verify timer0 dts.regexp(out, r'timer0_cb\(\) on lcore (\d+)') pat = re.compile(r'timer0_cb\(\) on lcore (\d+)') match = pat.findall(out) self.verify(match or match[0] == 0, "timer0 error") # verify timer1 pat = re.compile(r'timer1_cb\(\) on lcore (\d+)') matchlist = sorted(pat.findall(out)) self.verify(cmp(list(set(matchlist)), cores) == 0, "timer1 error")
def set_up_all(self): """ Run at the start of each test suite. Vlan Prerequistites """ # Based on h/w type, choose how many ports to use ports = self.dut.get_ports() # Verify that enough ports are available self.verify(len(ports) >= 2, "Insufficient ports") global valports valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] portMask = dts.create_mask(valports[:2]) self.pmdout = PmdOutput(self.dut) self.pmdout.start_testpmd("all", "--portmask=%s" % portMask) self.dut.send_expect("set verbose 1", "testpmd> ") out = self.dut.send_expect("set fwd mac", "testpmd> ") self.dut.send_expect("vlan set strip off %s" % valports[0], "testpmd> ") self.verify('Set mac packet forwarding mode' in out, "set fwd rxonly error")
def test_port_testing(self): """ Check port forwarding. """ # the cases use the first two ports port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.dut.send_expect("./examples/l2fwd/build/app/l2fwd -n 1 -c f -- -q 8 -p %s &" % port_mask, "L2FWD: entering main loop", 60) for i in [0, 1]: tx_port = self.tester.get_local_port(self.dut_ports[i]) rx_port = self.tester.get_local_port(self.dut_ports[1 - i]) tx_interface = self.tester.get_interface(tx_port) rx_interface = self.tester.get_interface(rx_port) self.tester.scapy_background() self.tester.scapy_append('p = sniff(iface="%s", count=1)' % rx_interface) self.tester.scapy_append('number_packets=len(p)') self.tester.scapy_append('RESULT = str(number_packets)') self.tester.scapy_foreground() self.tester.scapy_append('sendp([Ether()/IP()/UDP()/("X"*46)], iface="%s")' % tx_interface) self.tester.scapy_execute() number_packets = self.tester.scapy_get_result() self.verify(number_packets == "1", "Failed to switch L2 frame") self.quit_l2fwd()
def set_up_all(self): """ Run at the start of each test suite. Whitelist Prerequistites: Two Ports testpmd can normally started """ self.frames_to_send = 1 # Based on h/w type, choose how many ports to use self.dutPorts = self.dut.get_ports() # Verify that enough ports are available self.verify(len(self.dutPorts) >= 1, "Insufficient ports") portMask = dts.create_mask(self.dutPorts[:2]) self.pmdout = PmdOutput(self.dut) self.pmdout.start_testpmd("1S/2C/1T", "--portmask=%s" % portMask) self.dut.send_expect("set verbose 1", "testpmd> ") # get dest address from self.target port out = self.dut.send_expect("show port info %d" % self.dutPorts[0], "testpmd> ") self.dest = self.dut.get_mac_address(self.dutPorts[0]) mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})" ret = dts.regexp(out, mac_scanner) self.verify(ret is not None, "MAC address not found") self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong") self.max_mac_addr = dts.regexp( out, "Maximum number of MAC addresses: ([0-9]+)")
def set_up_all(self): """ Run at the start of each test suite. PMD prerequisites. """ # Check for port availability self.needed_ports = {"niantic": 2, "I217V": 1, "I217LM": 1, "I218V": 1, "I218LM": 1} self.dut_ports = self.dut.get_ports() self.verify(len(self.dut_ports) >= self.needed_ports[self.nic], "Insufficient ports for speed testing") out = self.dut.build_dpdk_apps("./examples/ip_pipeline") self.verify("Error" not in out, "Compilation error") self.ports_mask = dts.create_mask( [self.dut_ports[0], self.dut_ports[1]]) self.coremask = "0x3e" # IP Pipeline app requires FIVE cores self.dut.setup_memory(4096)
def test_perf_checksum_throughtput(self): """ Test checksum offload performance. """ self.dut_ports = self.dut.get_ports_performance() # Verify that enough ports are available self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") # sizes = [64, 128, 256, 512, 1024] sizes = [64, 128] pkts = { 'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/UDP()/("X"*(%d-46))', 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/TCP()/("X"*(%d-58))', 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/SCTP()/("X"*(%d-50+2))', 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/UDP()/("X"* (lambda x: x - 66 if x > 66 else 0)(%d))', 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/TCP()/("X"* (lambda x: x - 78 if x > 78 else 0)(%d))' } lcore = "1S/2C/1T" portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) for mode in ["sw", "hw"]: self.logger.info("%s performance" % mode) rst.write_text(mode + " Performance" + '\r\n') tblheader = ["Ports", "S/C/T", "Packet Type", "Mode"] for size in sizes: tblheader.append("%sB mpps" % str(size)) tblheader.append("%sB %% " % str(size)) dts.results_table_add_header(tblheader) self.pmdout.start_testpmd(lcore, "--portmask=%s" % self.portMask, socket=self.ports_socket) self.dut.send_expect("set verbose 1", "testpmd> ") self.dut.send_expect("set fwd csum", "testpmd> ") if mode == "hw": self.checksum_enablehw(self.dut_ports[0]) self.checksum_enablehw(self.dut_ports[1]) else: self.checksum_enablesw(self.dut_ports[0]) self.checksum_enablesw(self.dut_ports[1]) self.dut.send_expect("start", "testpmd> ", 3) for ptype in pkts.keys(): self.benchmark(lcore, ptype, mode, pkts[ptype], sizes, self.nic) self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "#", 10) dts.results_table_print()
def test_fdir_perfect_matching(self): """ FDir perfect matching mode. This test adds perfect-match filters to the hardware, and then checks whether sent packets match those filters. The test for each mode is following the steps below. - Start the ``testpmd`` application with perfect match; - Add filter with upd, tcp sctp, IP4; - Send the packet and validate the perfect filter function. """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd( "all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.dut.send_expect( "add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s tcp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x15" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s sctp src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x16" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x17" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def set_up_all(self): """ Prerequisite steps for each test suit. """ self.dut_ports = self.dut.get_ports() self.verify(len(self.dut_ports) >= 2, "Insufficient ports") self.rx_port = self.dut_ports[0] self.tx_port = self.dut_ports[1] cores = self.dut.get_core_list('1S/2C/2T') self.coremask = dts.create_mask(cores) self.port_mask = dts.create_mask([self.rx_port, self.tx_port]) self.tester.send_expect("ifconfig %s mtu %s" % (self.tester.get_interface(self.tester.get_local_port(self.rx_port)), ETHER_JUMBO_FRAME_MTU + 200), "# ") self.tester.send_expect("ifconfig %s mtu %s" % (self.tester.get_interface(self.tester.get_local_port(self.tx_port)), ETHER_JUMBO_FRAME_MTU + 200), "# ") self.pmdout = PmdOutput(self.dut)
def test_fdir_flexbytes_filtering(self): """ FDir flexbytes filtering The FDir feature supports setting up filters that can match on any two byte field within the first 64 bytes of a packet. Which byte offset to use is set by passing command line arguments to ``testpmd``. In this test a value of ``18`` corresponds to the bytes at offset 36 and 37, as the offset is in 2-byte units """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd( "all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=64K --pkt-filter-report-hash=match --pkt-filter-flexbytes-offset=18" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.dut.send_expect( "add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x1 vlan 0 queue 1 soft 0x1" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0x1)/IP()/UDP()], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0xff vlan 0 queue 1 soft 0xff" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0xff)/IP()/UDP()], iface="%s")' % (itf, itf)) self.dut.send_expect( "set_masks_filter %s only_ip_flow 0 src_mask 0xffffffff 0xffff dst_mask 0xffffffff 0xffff flexbytes 0 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect( "add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x0 vlan 0 queue 1 soft 0x42" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0x1)/IP()/UDP()], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0xFF)/IP()/UDP()], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_packet_checking(self): """ Packet forwarding checking test """ self.dut.kill_all() all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) core_mask = dts.create_mask(self.dut.get_core_list('1S/1C/1T', socket=self.ports_socket)) port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.pmdout.start_testpmd("all", "--coremask=%s --portmask=%s" % (core_mask, port_mask)) self.dut.send_expect("start", "testpmd> ") for size in self.frame_sizes: self.send_packet(size) self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "# ", 30) sleep(5)
def set_up_all(self): """ Run at the start of each test suite. Checksum offload prerequisites. """ # Based on h/w type, choose how many ports to use self.dut_ports = self.dut.get_ports() # Verify that enough ports are available self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") # Verify that enough threads are available cores = self.dut.get_core_list("1S/2C/2T") self.verify(cores is not None, "Insufficient cores for speed testing") self.pmdout = PmdOutput(self.dut) self.coreMask = dts.create_mask(cores) self.portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
def test_packet_checking(self): """ Packet forwarding checking test """ self.dut.kill_all() all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) core_mask = dts.create_mask( self.dut.get_core_list('1S/1C/1T', socket=self.ports_socket)) port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.pmdout.start_testpmd( "all", "--coremask=%s --portmask=%s" % (core_mask, port_mask)) self.dut.send_expect("start", "testpmd> ") for size in self.frame_sizes: self.send_packet(size) self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "# ", 30) sleep(5)
def test_hello_world_single_core(self): """ Run hello world on single lcores Only received hello message from core0 """ # get the mask for the first core cores = self.dut.get_core_list('1S/1C/1T') coreMask = dts.create_mask(cores) cmdline = "./examples/helloworld/build/app/helloworld -n 1 -c " + coreMask out = self.dut.send_expect(cmdline, "# ", 3) self.verify("hello from core %s" % cores[0] in out, "EAL not started on core%s" % cores[0])
def test_fdir_vlanfiltering(self): """ FDir VLAN field filtering """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd( "all", "--portmask=%s --nb-cores=2 --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") # "rx_vlan add all" has been removed from testpmd self.dut.send_expect("rx_vlan add 0xFFF %s" % dutPorts[0], "testpmd>") self.dut.send_expect("rx_vlan add 0x001 %s" % dutPorts[0], "testpmd>") self.dut.send_expect("rx_vlan add 0x017 %s" % dutPorts[0], "testpmd>") self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x0FFF)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x8100 vlan 0xfff queue 1 soft 0x47" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x0FFF)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "set_masks_filter %s only_ip_flow 0 src_mask 0xffffffff 0xffff dst_mask 0xffffffff 0xffff flexbytes 1 vlan_id 0 vlan_prio 0" % dutPorts[0], "testpmd>") self.dut.send_expect( "add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x8100 vlan 0 queue 1 soft 0x47" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x001)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x0017)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_hello_world_all_cores(self): """ Run hello world on all lcores Received hello message from all lcores """ # get the maximun logical core number cores = self.dut.get_core_list('all') coreMask = dts.create_mask(cores) cmdline = "./examples/helloworld/build/app/helloworld -n 1 -c " + coreMask out = self.dut.send_expect(cmdline, "# ", 5) for i in range(len(cores)): self.verify("hello from core %s" % cores[i] in out, "EAL not started on core%s" % cores[i])
def start_testpmd(self, cores, param='', eal_param='', socket=0): # in dpdk2.0 need used --txqflags param to open hardware features if "--txqflags" not in param: param += " --txqflags=0" if cores == "Default": core_list = self.dut.get_core_list(self.default_cores) else: core_list = self.dut.get_core_list(cores, socket) self.coremask = dts.create_mask(core_list) command = "./%s/app/testpmd -c %s -n %d %s -- -i %s" \ % (self.dut.target, self.coremask, self.dut.get_memory_channels(), eal_param, param) out = self.dut.send_expect(command, "testpmd> ", 120) self.command = command return out
def set_up_all(self): """ Run at the start of each test suite. Cmdline Prerequisites: cmdline build pass At least one core in DUT """ out = self.dut.build_dpdk_apps('examples/cmdline') self.verify('make: Leaving directory' in out, "Compilation failed") self.verify("Error" not in out, "compilation error 1") self.verify("No such file" not in out, "compilation error 2") # Run cmdline app cores = self.dut.get_core_list('1S/1C/1T') coreMask = dts.create_mask(cores) self.dut.send_expect("./examples/cmdline/build/app/cmdline -n 1 -c " + coreMask, "> ", 5)
def set_up_all(self): """ Run at the start of each test suite. Cmdline Prerequisites: cmdline build pass At least one core in DUT """ out = self.dut.build_dpdk_apps('examples/cmdline') self.verify('make: Leaving directory' in out, "Compilation failed") self.verify("Error" not in out, "compilation error 1") self.verify("No such file" not in out, "compilation error 2") # Run cmdline app cores = self.dut.get_core_list('1S/1C/1T') coreMask = dts.create_mask(cores) self.dut.send_expect( "./examples/cmdline/build/app/cmdline -n 1 -c " + coreMask, "> ", 5)
def set_up_all(self): """ Run at the start of each test suite. Link flow control Prerequisites """ self.dutPorts = self.dut.get_ports() self.verify(len(self.dutPorts) > 1, "Insuficient ports") self.rx_port = self.dutPorts[0] self.tester_tx_mac = self.tester.get_mac(self.tester.get_local_port(self.rx_port)) self.tx_port = self.dutPorts[1] self.portMask = dts.create_mask([self.rx_port, self.tx_port]) self.memChannels = self.dut.get_memory_channels() self.pmdout = PmdOutput(self.dut) self.pmdout.start_testpmd("all", "--portmask=%s" % self.portMask)
def test_fdir_signatures(self): """ FDir signature matching mode. There are three different reporting modes, that can be set in testpmd using the ``--pkt-filter-report-hash`` command line argument: --pkt-filter-report-hash=none --pkt-filter-report-hash=match --pkt-filter-report-hash=always The test for each mode is following the steps below. - Start the ``testpmd`` application by using paramter of each mode. - Send the ``p_udp`` packet with Scapy on the traffic generator and check that FDir information is printed """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd( "all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=none" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30) self.pmdout.start_testpmd( "all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "upd_perfect_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect( "rm_perfect_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30) self.pmdout.start_testpmd( "all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=always" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def packet_generator(self, portList, rate_percent): # bind ports self.tester.send_expect("insmod igb_uio.ko", "#") bind_cmd = "" ports = [] tx_ports = [] for (tx_port, rx_port, pcap_file) in portList: if tx_port not in ports: ports.append(tx_port) tx_ports.append(tx_port) if rx_port not in ports: ports.append(rx_port) for port in ports: bind_cmd += " %s" % self.tester.ports_info[port]['pci'] self.tester.send_expect( "./dpdk_nic_bind.py --bind=igb_uio %s" % bind_cmd, "#") # assgin core for ports map_cmd = "" port_index = range(len(ports)) port_map = dict(zip(ports, port_index)) self.tester.init_reserved_core() for port in ports: numa = self.tester.get_port_numa(port) cores = self.tester.get_reserved_core("2C", socket=numa) if len(cores) < 2: raise VerifyFailure("Not enough cores for performance!!!") map_cmd += "[%s:%s].%d, " % (cores[0], cores[1], port_map[port]) # create pcap for every port pcap_cmd = "" for (tx_port, rx_port, pcap_file) in portList: pcap_cmd += " -s %d:%s" % (port_map[tx_port], pcap_file) # Selected 2 for -n to optimize results on Burage cores_mask = dts.create_mask(self.tester.get_core_list("all")) self.tester.send_expect( "./pktgen -n 2 -c %s --proc-type auto --socket-mem 256,256 -- -P -m \"%s\" %s" % (cores_mask, map_cmd, pcap_cmd), "Pktgen >", 100) if rate_percent != 100: self.tester.send_expect("set all rate %s" % rate_percent, "Pktgen>") else: self.tester.send_expect("set all rate 100", "Pktgen>") self.tester.send_expect("start all", "Pktgen>") time.sleep(10) out = self.tester.send_expect("clr", "Pktgen>") match = r"Bits per second: (\d+)+/(\d+)" m = re.search(match, out) match = r"Packets per second: (\d+)+/(\d+)" n = re.search(match, out) rx_bps = int(m.group(1)) rx_pps = int(n.group(1)) tx_bps = int(m.group(2)) self.tester.send_expect("stop all", "Pktgen>") self.tester.send_expect("quit", "# ") self.tester.kill_all(killall=True) self.tester.restore_interfaces() return rx_bps, tx_bps, rx_pps
def benchmark(self, index, lcore, num_pthreads, size_list): """ Just Test IPv4 Throughput for selected parameters. """ Bps = dict() Pps = dict() Pct = dict() if int(lcore[0]) == 1: core_mask = dts.create_mask(self.dut.get_core_list(lcore, socket=self.ports_socket)) else: core_mask = dts.create_mask(self.dut.get_core_list(lcore)) portmask = dts.create_mask([P0, P1]) self.dut.send_expect( "examples/ip_fragmentation/build/ip_fragmentation -c %s -n %d -- -p %s -q %s" % (core_mask, self.dut.get_memory_channels(), portmask, num_pthreads), "IP_FRAG:", 120, ) result = [2, lcore, num_pthreads] for size in size_list: dmac = self.dut.get_mac_address(P0) flows = [ 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.10.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.20.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IPv6(dst="101:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58), 'Ether(dst="%s")/IPv6(dst="201:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58), ] self.tester.scapy_append('wrpcap("test1.pcap", [%s])' % string.join(flows, ",")) # reserved for rx/tx bidirection test dmac = self.dut.get_mac_address(P1) flows = [ 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.30.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.40.0.1", flags=0)/("X"*%d)' % (dmac, size - 38), 'Ether(dst="%s")/IPv6(dst="301:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58), 'Ether(dst="%s")/IPv6(dst="401:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58), ] self.tester.scapy_append('wrpcap("test2.pcap", [%s])' % string.join(flows, ",")) self.tester.scapy_execute() tgenInput = [] tgenInput.append((self.tester.get_local_port(P0), self.tester.get_local_port(P1), "test1.pcap")) tgenInput.append((self.tester.get_local_port(P1), self.tester.get_local_port(P0), "test2.pcap")) factor = (size + 1517) / 1518 # wireSpd = 2 * 10000.0 / ((20 + size) * 8) Bps[str(size)], Pps[str(size)] = self.tester.traffic_generator_throughput(tgenInput) self.verify(Pps[str(size)] > 0, "No traffic detected") Pps[str(size)] *= 1.0 / factor / 1000000 Pct[str(size)] = (1.0 * Bps[str(size)] * 100) / (2 * 10000000000) result.append(Pps[str(size)]) result.append(Pct[str(size)]) dts.results_table_add_row(result) self.dut.send_expect("^C", "#")
def functional_check_ipv6(self, cores, pkt_sizes, burst=1, flag=None, funtion=None): """ Perform functional fragmentation checks. """ coremask = dts.create_mask(cores) portmask = dts.create_mask([P0, P1]) numPortThread = len([P0, P1]) / len(cores) result = True errString = "" # run ipv4_frag self.dut.send_expect( "examples/ip_fragmentation/build/ip_fragmentation -c %s -n %d -- -p %s -q %s" % (coremask, self.dut.get_memory_channels(), portmask, numPortThread), "IP_FRAG:", 120, ) txItf = self.tester.get_interface(self.tester.get_local_port(P0)) rxItf = self.tester.get_interface(self.tester.get_local_port(P1)) dmac = self.dut.get_mac_address(P0) for size in pkt_sizes[::burst]: # simulate to set TG properties if flag == "frag": # do fragment expPkts = (1517 + size) / 1518 val = 0 else: expPkts = 1 val = 2 # set wait packet self.tester.scapy_background() self.tester.scapy_append("import string") self.tester.scapy_append('p = sniff(iface="%s", count=%d)' % (rxItf, expPkts)) self.tester.scapy_append("nr_packets=len(p)") self.tester.scapy_append( 'reslist = [p[i].sprintf("%IPv6.plen%;%IPv6.id%;%IPv6ExtHdrFragment.m%;%IPv6ExtHdrFragment.offset%") for i in range(nr_packets)]' ) self.tester.scapy_append('RESULT = string.join(reslist, ",")') # send packet self.tester.scapy_foreground() for times in range(burst): self.tester.scapy_append( 'sendp([Ether(dst="%s")/IPv6(dst="101:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)], iface="%s")' % (dmac, pkt_sizes[pkt_sizes.index(size) + times] - 58, txItf) ) self.tester.scapy_execute() out = self.tester.scapy_get_result() nr_packets = len(out.split(",")) if funtion is not None: if not funtion(size, out.split(",")): result = False errString = "failed on fragment check size " + str(size) break elif nr_packets != expPkts: result = False errString = "Failed on forward packet size " + str(size) break self.dut.send_expect("^C", "#") # verify on the bottom so as to keep safety quit application self.verify(result, errString)
def test_perf_multiprocess_client_serverperformance(self): """ Benchmark Multiprocess client-server performance. """ self.dut.kill_all() self.dut.send_expect("fg", "# ") dutPorts = self.dut.get_ports() txPort = self.tester.get_local_port(dutPorts[0]) rxPort = self.tester.get_local_port(dutPorts[1]) mac = self.tester.get_mac(txPort) self.tester.scapy_append('dmac="%s"' % self.dut.get_mac_address(dutPorts[0])) self.tester.scapy_append('smac="%s"' % mac) if not self.dut.want_perf_tests: self.tester.scapy_append( 'flows = [Ether(src=smac, dst=dmac)/IP(src="192.168.1.%s" % src, dst="192.168.1.%s" % dst)/("X"*26) for src in range(64) for dst in range(64)]' ) else: self.tester.scapy_append( 'flows = [Ether(src=smac, dst=dmac)/IP(src="192.168.1.1", dst="192.168.1.1")/("X"*26)]' ) self.tester.scapy_append('wrpcap("test.pcap", flows)') self.tester.scapy_execute() validExecutions = [] for execution in executions: if len(self.dut.get_core_list( execution['cores'])) == execution['nprocs']: validExecutions.append(execution) for execution in validExecutions: coreList = self.dut.get_core_list(execution['cores']) coreMask = dts.create_mask(self.dut.get_core_list('1S/1C/1T')) portMask = dts.create_mask([dutPorts[0], dutPorts[1]]) self.dut.send_expect( "./examples/multi_process/client_server_mp/mp_server/client_server_mp/mp_server/%s/mp_server -n %d -c %s -- -p %s -n %d" % (self.target, self.dut.get_memory_channels(), "0xA0", portMask, execution['nprocs']), "Finished Process Init", 20) self.dut.send_expect("^Z", "\r\n") self.dut.send_expect("bg", "# ") for n in range(execution['nprocs']): time.sleep(5) coreMask = dts.create_mask([coreList[n]]) self.dut.send_expect( "./examples/multi_process/client_server_mp/mp_client/client_server_mp/mp_client/%s/mp_client -n %d -c %s --proc-type=secondary -- -n %d" % (self.target, self.dut.get_memory_channels(), coreMask, n), "Finished Process Init") self.dut.send_expect("^Z", "\r\n") self.dut.send_expect("bg", "# ") tgenInput = [] tgenInput.append([txPort, rxPort, "test.pcap"]) _, pps = self.tester.traffic_generator_throughput(tgenInput) execution['pps'] = pps self.dut.kill_all() time.sleep(5) for n in range(len(executions)): self.verify(executions[n]['pps'] is not 0, "No traffic detected") dts.results_table_add_header([ 'Server threads', 'Server Cores/Threads', 'Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', 'Packet Rate(mpps)' ]) for execution in validExecutions: dts.results_table_add_row([ 1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), execution['pps'] / float(1000000) ]) dts.results_table_print()
def test_fdir_filter_masks(self): """ FDir filter masks. This tests the functionality of the setting FDir masks to to affect which fields, or parts of fields are used in the matching process. """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd( "all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=64K --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.dut.send_expect( "set_masks_filter %s only_ip_flow 0 src_mask 0xffffff00 0xffff dst_mask 0xffffff00 0xffff flexbytes 1 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect( "add_perfect_filter %s udp src 192.168.0.0 1024 dst 192.168.0.0 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x17" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.15", dst="192.168.0.15")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.1.1")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "set_masks_filter %s only_ip_flow 0 src_mask 0xffffffff 0xff00 dst_mask 0xffffffff 0xff00 flexbytes 1 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect( "add_perfect_filter %s udp src 10.11.12.1 0x4400 dst 10.11.12.2 0x4500 flexbytes 0x800 vlan 0 queue 1 soft 0x4" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4400,dport=0x4500)], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4411,dport=0x4517)], iface="%s")' % (itf, itf)) self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4500,dport=0x5500)], iface="%s")' % (itf, itf)) self.dut.send_expect( "set_masks_filter %s only_ip_flow 1 src_mask 0xffffffff 0x0 dst_mask 0xffffffff 0x0 flexbytes 1 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect( "add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x42" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_perf_l2fwd_performance(self): """ Benchmark performance for frame_sizes. """ ports = [] for port in xrange(self.number_of_ports): ports.append(self.dut_ports[port]) port_mask = dts.create_mask(ports) core_mask = dts.create_mask(self.dut.get_core_list(self.core_config, socket=self.ports_socket)) for frame_size in self.frame_sizes: payload_size = frame_size - self.headers_size tgen_input = [] for port in xrange(self.number_of_ports): rx_port = self.tester.get_local_port(self.dut_ports[port % self.number_of_ports]) tx_port = self.tester.get_local_port(self.dut_ports[(port + 1) % self.number_of_ports]) destination_mac = self.dut.get_mac_address(self.dut_ports[(port + 1) % self.number_of_ports]) self.tester.scapy_append('wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % ( port, destination_mac, payload_size)) tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) self.tester.scapy_execute() for queues in self.test_queues: command_line = "./examples/l2fwd/build/app/l2fwd -n %d -c %s -- -q %s -p %s &" % \ (self.dut.get_memory_channels(), core_mask, str(queues['queues']), port_mask) self.dut.send_expect(command_line, "memory mapped", 60) info = "Executing l2fwd using %s queues, frame size %d and %s setup.\n" % \ (queues['queues'], frame_size, self.core_config) self.logger.info(info) dts.report(info, annex=True) dts.report(command_line + "\n\n", frame=True, annex=True) _, pps = self.tester.traffic_generator_throughput(tgen_input) Mpps = pps / 1000000.0 queues['Mpps'][frame_size] = Mpps queues['pct'][frame_size] = Mpps * 100 / float(self.wirespeed( self.nic, frame_size, self.number_of_ports)) self.quit_l2fwd() # Look for transmission error in the results for frame_size in self.frame_sizes: for n in range(len(self.test_queues)): self.verify(self.test_queues[n]['Mpps'][frame_size] > 0, "No traffic detected") # Prepare the results for table and plot printing for frame_size in self.frame_sizes: results_row = [] results_row.append(frame_size) for queue in self.test_queues: results_row.append(queue['Mpps'][frame_size]) results_row.append(queue['pct'][frame_size]) dts.results_table_add_row(results_row) self.plot_results() dts.results_table_print()
def packet_generator(self, portList, rate_percent): # bind ports self.tester.send_expect("insmod igb_uio.ko", "#") bind_cmd = "" ports = [] tx_ports = [] for (tx_port, rx_port, pcap_file) in portList: if tx_port not in ports: ports.append(tx_port) tx_ports.append(tx_port) if rx_port not in ports: ports.append(rx_port) for port in ports: bind_cmd += " %s" % self.tester.ports_info[port]["pci"] self.tester.send_expect("./dpdk_nic_bind.py --bind=igb_uio %s" % bind_cmd, "#") # assgin core for ports map_cmd = "" port_index = range(len(ports)) port_map = dict(zip(ports, port_index)) self.tester.init_reserved_core() for port in ports: numa = self.tester.get_port_numa(port) cores = self.tester.get_reserved_core("2C", socket=numa) if len(cores) < 2: raise VerifyFailure("Not enough cores for performance!!!") map_cmd += "[%s:%s].%d, " % (cores[0], cores[1], port_map[port]) # create pcap for every port pcap_cmd = "" for (tx_port, rx_port, pcap_file) in portList: pcap_cmd += " -s %d:%s" % (port_map[tx_port], pcap_file) # Selected 2 for -n to optimize results on Burage cores_mask = dts.create_mask(self.tester.get_core_list("all")) self.tester.send_expect( './pktgen -n 2 -c %s --proc-type auto --socket-mem 256,256 -- -P -m "%s" %s' % (cores_mask, map_cmd, pcap_cmd), "Pktgen >", 100, ) if rate_percent != 100: self.tester.send_expect("set all rate %s" % rate_percent, "Pktgen>") else: self.tester.send_expect("set all rate 100", "Pktgen>") self.tester.send_expect("start all", "Pktgen>") time.sleep(10) out = self.tester.send_expect("clr", "Pktgen>") match = r"Bits per second: (\d+)+/(\d+)" m = re.search(match, out) match = r"Packets per second: (\d+)+/(\d+)" n = re.search(match, out) rx_bps = int(m.group(1)) rx_pps = int(n.group(1)) tx_bps = int(m.group(2)) self.tester.send_expect("stop all", "Pktgen>") self.tester.send_expect("quit", "# ") self.tester.kill_all(killall=True) self.tester.restore_interfaces() return rx_bps, tx_bps, rx_pps
def test_fdir_matching(self): """ FDir matching mode This test adds signature filters to the hardware, and then checks whether sent packets match those filters. The test for each mode is following the steps below. - Start the ``testpmd`` application - Add filter with upd, tcp sctp, IP4 or IP6 - Send the packet and validate the filter function. """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd("all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=signature --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_signature_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("upd_signature_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect("rm_signature_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0" % dutPorts[0], "testpmd>") self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_signature_filter %s tcp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_signature_filter %s sctp src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (itf, itf)) self.dut.send_expect("add_signature_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (itf, itf)) self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="2001:0db8:85a3:0000:0000:8a2e:0370:7000", dst="2001:0db8:85a3:0000:0000:8a2e:0370:7338")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_signature_filter %s udp src 2001:0db8:85a3:0000:0000:8a2e:0370:7000 1024 dst 2001:0db8:85a3:0000:0000:8a2e:0370:7338 1024 flexbytes 0x86dd vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="2001:0db8:85a3:0000:0000:8a2e:0370:7000", dst="2001:0db8:85a3:0000:0000:8a2e:0370:7338")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_fdir_flexbytes_filtering(self): """ FDir flexbytes filtering The FDir feature supports setting up filters that can match on any two byte field within the first 64 bytes of a packet. Which byte offset to use is set by passing command line arguments to ``testpmd``. In this test a value of ``18`` corresponds to the bytes at offset 36 and 37, as the offset is in 2-byte units """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd("all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=64K --pkt-filter-report-hash=match --pkt-filter-flexbytes-offset=18" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.dut.send_expect("add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x1 vlan 0 queue 1 soft 0x1" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0x1)/IP()/UDP()], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0xff vlan 0 queue 1 soft 0xff" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0xff)/IP()/UDP()], iface="%s")' % (itf, itf)) self.dut.send_expect("set_masks_filter %s only_ip_flow 0 src_mask 0xffffffff 0xffff dst_mask 0xffffffff 0xffff flexbytes 0 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect("add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x0 vlan 0 queue 1 soft 0x42" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0x1)/IP()/UDP()], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0xFF)/IP()/UDP()], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_perf_pmd_performance_2ports(self): """ PMD Performance Benchmarking with 2 ports. """ all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) # prepare traffic generator input tgen_input = [] tgen_input.append( (self.tester.get_local_port(self.dut_ports[0]), self.tester.get_local_port(self.dut_ports[1]), "test.pcap")) tgen_input.append( (self.tester.get_local_port(self.dut_ports[1]), self.tester.get_local_port(self.dut_ports[0]), "test.pcap")) # run testpmd for each core config for test_cycle in self.test_cycles: core_config = test_cycle['cores'] core_list = self.dut.get_core_list(core_config, socket=self.ports_socket) if len(core_list) > 2: queues = len(core_list) / 2 else: queues = 1 core_mask = dts.create_mask(core_list) port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.pmdout.start_testpmd( "all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" % (core_mask, queues, queues, port_mask)) command_line = self.pmdout.get_pmd_cmd() info = "Executing PMD using %s\n" % test_cycle['cores'] self.logger.info(info) dts.report(info, annex=True) dts.report(command_line + "\n\n", frame=True, annex=True) self.dut.send_expect("start", "testpmd> ") for frame_size in self.frame_sizes: wirespeed = self.wirespeed(self.nic, frame_size, 2) # create pcap file self.logger.info("Running with frame size %d " % frame_size) payload_size = frame_size - self.headers_size self.tester.scapy_append( 'wrpcap("test.pcap", [Ether(src="52:00:00:00:00:00")/IP()/UDP()/("X"*%d)])' % payload_size) self.tester.scapy_execute() # run traffic generator _, pps = self.tester.traffic_generator_throughput(tgen_input) pps /= 1000000.0 test_cycle['Mpps'][frame_size] = pps test_cycle['pct'][frame_size] = pps * 100 / wirespeed self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "# ", 30) sleep(5) for n in range(len(self.test_cycles)): for frame_size in self.frame_sizes: self.verify(self.test_cycles[n]['Mpps'][frame_size] > 0, "No traffic detected") # Print results dts.results_table_add_header(self.table_header) for frame_size in self.frame_sizes: table_row = [frame_size] for test_cycle in self.test_cycles: table_row.append(test_cycle['Mpps'][frame_size]) table_row.append(test_cycle['pct'][frame_size]) dts.results_table_add_row(table_row) self.plot_results(number_ports=2) dts.results_table_print()
def test_fdir_matching(self): """ FDir matching mode This test adds signature filters to the hardware, and then checks whether sent packets match those filters. The test for each mode is following the steps below. - Start the ``testpmd`` application - Add filter with upd, tcp sctp, IP4 or IP6 - Send the packet and validate the filter function. """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd( "all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=signature --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_signature_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "upd_signature_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect( "rm_signature_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0" % dutPorts[0], "testpmd>") self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_signature_filter %s tcp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_signature_filter %s sctp src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_signature_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (itf, itf)) self.send_and_verify( False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="2001:0db8:85a3:0000:0000:8a2e:0370:7000", dst="2001:0db8:85a3:0000:0000:8a2e:0370:7338")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect( "add_signature_filter %s udp src 2001:0db8:85a3:0000:0000:8a2e:0370:7000 1024 dst 2001:0db8:85a3:0000:0000:8a2e:0370:7338 1024 flexbytes 0x86dd vlan 0 queue 1" % dutPorts[0], "testpmd>") self.send_and_verify( True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="2001:0db8:85a3:0000:0000:8a2e:0370:7000", dst="2001:0db8:85a3:0000:0000:8a2e:0370:7338")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def get_throughput(self, frame_size, rx_queues_per_port, cores_config, command_line): """ Get the throughput for a test case from test_cases_4_ports. """ output_pattern = re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})") bps = dict() pps = dict() pct = dict() global corelist corelist = [] while output_pattern.search(command_line): command_line = output_pattern.sub(self.repl, command_line) self.logger.debug("%s\n" % str(corelist)) core_mask = dts.create_mask(set(corelist)) # First, measure by two different methods for method in TestL3fwd.methods: # start l3fwd method_command_line = command_line % (TestL3fwd.path + "l3fwd_" + method, core_mask, self.dut.get_memory_channels(), dts.create_mask(valports[:4])) dts.report(method_command_line + "\n", frame=True, annex=True) out = self.dut.send_expect(method_command_line, "L3FWD:", 120) # measure test tgen_input = [] for rxPort in range(4): if rxPort % 2 == 0: tx_interface = self.tester.get_local_port(valports[rxPort + 1]) else: tx_interface = self.tester.get_local_port(valports[rxPort - 1]) rx_interface = self.tester.get_local_port(valports[rxPort]) tgen_input.append((tx_interface, rx_interface, "dst%d.pcap" % valports[rxPort])) # FIX ME bps[method], pps[method] = self.tester.traffic_generator_throughput(tgen_input) self.verify(pps[method] > 0, "No traffic detected") pps[method] /= 1000000.0 pct[method] = pps[method] * 100 / float(self.wirespeed(self.nic, frame_size, 4)) # stop l3fwd self.dut.send_expect("^C", "#") data_row = [frame_size, rx_queues_per_port, cores_config] for method in TestL3fwd.methods: data_row.append(pps[method]) data_row.append(pct[method]) # generate report table dts.results_table_add_row(data_row) self.l3fwd_test_results['data'].append(data_row)
def test_fdir_filter_masks(self): """ FDir filter masks. This tests the functionality of the setting FDir masks to to affect which fields, or parts of fields are used in the matching process. """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd("all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=64K --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.dut.send_expect("set_masks_filter %s only_ip_flow 0 src_mask 0xffffff00 0xffff dst_mask 0xffffff00 0xffff flexbytes 1 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect("add_perfect_filter %s udp src 192.168.0.0 1024 dst 192.168.0.0 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x17" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.15", dst="192.168.0.15")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.1.1")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("set_masks_filter %s only_ip_flow 0 src_mask 0xffffffff 0xff00 dst_mask 0xffffffff 0xff00 flexbytes 1 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect("add_perfect_filter %s udp src 10.11.12.1 0x4400 dst 10.11.12.2 0x4500 flexbytes 0x800 vlan 0 queue 1 soft 0x4" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4400,dport=0x4500)], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4411,dport=0x4517)], iface="%s")' % (itf, itf)) self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4500,dport=0x5500)], iface="%s")' % (itf, itf)) self.dut.send_expect("set_masks_filter %s only_ip_flow 1 src_mask 0xffffffff 0x0 dst_mask 0xffffffff 0x0 flexbytes 1 vlan_id 1 vlan_prio 1" % dutPorts[0], "testpmd>") self.dut.send_expect("add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x42" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_perf_l3fwd_2ports(self): """ L3fwd main 2 ports. """ header_row = ["Frame", "Ports", "S/C/T", "Mpps", "% linerate", "mode"] self.l3fwd_test_results['header'] = header_row dts.results_table_add_header(header_row) self.l3fwd_test_results['data'] = [] for frame_size in TestL3fwd.frame_sizes: # Prepare traffic flow payload_size = frame_size - HEADER_SIZE['udp'] - \ HEADER_SIZE['ip'] - HEADER_SIZE['eth'] flows = ['Ether()/%s/("X"*%d)' % (flow, payload_size) for flow in self.flows()[:4]] dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size), annex=True) dts.report("%s" % string.join(flows, '\n'), frame=True, annex=True) self.tester.scapy_append('wrpcap("test2ports.pcap", [%s])' % string.join(flows, ',')) self.tester.scapy_execute() # Prepare the command line global corelist pat = re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})") coreMask = {} rtCmdLines = dict(TestL3fwd.test_cases_2_ports) for key in rtCmdLines.keys(): corelist = [] while pat.search(rtCmdLines[key]): rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key]) self.logger.info("%s\n" % str(corelist)) coreMask[key] = dts.create_mask(set(corelist)) # measure by two different mode for mode in TestL3fwd.methods: # start l3fwd index = 0 subtitle = [] for cores in rtCmdLines.keys(): info = "Executing l3fwd using %s mode, 2 ports, %s and %d frame size.\n" % ( mode, cores, frame_size) self.logger.info(info) dts.report(info, annex=True) subtitle.append(cores) cmdline = rtCmdLines[cores] % (TestL3fwd.path + "l3fwd_" + mode, coreMask[cores], self.dut.get_memory_channels(), dts.create_mask(valports[:2])) dts.report(cmdline + "\n", frame=True, annex=True) out = self.dut.send_expect(cmdline, "L3FWD:", 120) # Measure test tgenInput = [] for rxPort in range(2): # No use on rx/tx limitation if rxPort % 2 == 0: txIntf = self.tester.get_local_port(valports[rxPort + 1]) else: txIntf = self.tester.get_local_port(valports[rxPort - 1]) rxIntf = self.tester.get_local_port(valports[rxPort]) tgenInput.append((txIntf, rxIntf, "test2ports.pcap")) _, pps = self.tester.traffic_generator_throughput(tgenInput) self.verify(pps > 0, "No traffic detected") pps /= 1000000.0 linerate = self.wirespeed(self.nic, frame_size, 2) pct = pps * 100 / linerate index += 1 # Stop l3fwd self.dut.send_expect("^C", "#") data_row = [frame_size, 2, cores, str(pps), str(pct), mode] dts.results_table_add_row(data_row) self.l3fwd_test_results['data'].append(data_row) self.plot_2_ports() dts.results_table_print()
def test_fdir_perfect_matching(self): """ FDir perfect matching mode. This test adds perfect-match filters to the hardware, and then checks whether sent packets match those filters. The test for each mode is following the steps below. - Start the ``testpmd`` application with perfect match; - Add filter with upd, tcp sctp, IP4; - Send the packet and validate the perfect filter function. """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd("all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.dut.send_expect("add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s tcp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x15" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s sctp src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x16" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x17" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_fdir_vlanfiltering(self): """ FDir VLAN field filtering """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd("all", "--portmask=%s --nb-cores=2 --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") # "rx_vlan add all" has been removed from testpmd self.dut.send_expect("rx_vlan add 0xFFF %s" % dutPorts[0], "testpmd>") self.dut.send_expect("rx_vlan add 0x001 %s" % dutPorts[0], "testpmd>") self.dut.send_expect("rx_vlan add 0x017 %s" % dutPorts[0], "testpmd>") self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x0FFF)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x8100 vlan 0xfff queue 1 soft 0x47" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x0FFF)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("set_masks_filter %s only_ip_flow 0 src_mask 0xffffffff 0xffff dst_mask 0xffffffff 0xffff flexbytes 1 vlan_id 0 vlan_prio 0" % dutPorts[0], "testpmd>") self.dut.send_expect("add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x8100 vlan 0 queue 1 soft 0x47" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x001)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/Dot1Q(vlan=0x0017)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024, dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_fdir_signatures(self): """ FDir signature matching mode. There are three different reporting modes, that can be set in testpmd using the ``--pkt-filter-report-hash`` command line argument: --pkt-filter-report-hash=none --pkt-filter-report-hash=match --pkt-filter-report-hash=always The test for each mode is following the steps below. - Start the ``testpmd`` application by using paramter of each mode. - Send the ``p_udp`` packet with Scapy on the traffic generator and check that FDir information is printed """ dutPorts = self.dut.get_ports() localPort = self.tester.get_local_port(dutPorts[0]) itf = self.tester.get_interface(localPort) self.dut.kill_all() self.pmdout.start_testpmd("all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=none" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30) self.pmdout.start_testpmd("all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=match" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("upd_perfect_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect("rm_perfect_filter %s udp src 192.168.1.1 0 dst 192.168.1.2 0 flexbytes 0x800 vlan 0 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.1.1", dst="192.168.1.2")/UDP(sport=0,dport=0)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30) self.pmdout.start_testpmd("all", "--portmask=%s --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-report-hash=always" % dts.create_mask([dutPorts[0]])) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") self.dut.send_expect("set nbcore 3", "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("add_perfect_filter %s udp src 192.168.0.1 1024 dst 192.168.0.2 1024 flexbytes 0x800 vlan 0 queue 1 soft 0x14" % dutPorts[0], "testpmd>") self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (itf, itf)) self.dut.send_expect("quit", "# ", 30)
def test_perf_pmd_performance_2ports(self): """ PMD Performance Benchmarking with 2 ports. """ all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) # prepare traffic generator input tgen_input = [] tgen_input.append((self.tester.get_local_port(self.dut_ports[0]), self.tester.get_local_port(self.dut_ports[1]), "test.pcap")) tgen_input.append((self.tester.get_local_port(self.dut_ports[1]), self.tester.get_local_port(self.dut_ports[0]), "test.pcap")) # run testpmd for each core config for test_cycle in self.test_cycles: core_config = test_cycle['cores'] core_list = self.dut.get_core_list(core_config, socket=self.ports_socket) if len(core_list) > 2: queues = len(core_list) / 2 else: queues = 1 core_mask = dts.create_mask(core_list) port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.pmdout.start_testpmd("all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" % (core_mask, queues, queues, port_mask)) command_line = self.pmdout.get_pmd_cmd() info = "Executing PMD using %s\n" % test_cycle['cores'] self.logger.info(info) dts.report(info, annex=True) dts.report(command_line + "\n\n", frame=True, annex=True) self.dut.send_expect("start", "testpmd> ") for frame_size in self.frame_sizes: wirespeed = self.wirespeed(self.nic, frame_size, 2) # create pcap file self.logger.info("Running with frame size %d " % frame_size) payload_size = frame_size - self.headers_size self.tester.scapy_append( 'wrpcap("test.pcap", [Ether(src="52:00:00:00:00:00")/IP()/UDP()/("X"*%d)])' % payload_size) self.tester.scapy_execute() # run traffic generator _, pps = self.tester.traffic_generator_throughput(tgen_input) pps /= 1000000.0 test_cycle['Mpps'][frame_size] = pps test_cycle['pct'][frame_size] = pps * 100 / wirespeed self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "# ", 30) sleep(5) for n in range(len(self.test_cycles)): for frame_size in self.frame_sizes: self.verify(self.test_cycles[n]['Mpps'][ frame_size] > 0, "No traffic detected") # Print results dts.results_table_add_header(self.table_header) for frame_size in self.frame_sizes: table_row = [frame_size] for test_cycle in self.test_cycles: table_row.append(test_cycle['Mpps'][frame_size]) table_row.append(test_cycle['pct'][frame_size]) dts.results_table_add_row(table_row) self.plot_results(number_ports=2) dts.results_table_print()