예제 #1
0
    def test_incremental_ip(self):
        """
        Testing that frames with incremental IP addresses pass through the
        pipeline regardless the frames_number and the speed.
        """
        pcap_file = 'ip_pipeline.pcap'
        frame_size = 64

        self.start_ip_pipeline(ports=self.ports_mask)
        self.dut.send_expect(
            'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)

        # Create a PCAP file containing the maximum frames_number of frames needed
        # with fixed size and incremental IP
        self.create_pcap_file(pcap_file, frame_size,
                              max(TestIPPipeline.number_of_frames), True)
        self.tester.session.copy_file_to(pcap_file)

        for frames_number in TestIPPipeline.number_of_frames:
            for inter in TestIPPipeline.inter:
                print utils.BLUE(
                    "\tNumber of frames %d, interval %.1f" % (frames_number,
                                                              inter))
                stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
                                                      1, 0, inter)

                expected = {'tx': 0, 'rx': frames_number}
                self.check_results(stats, expected)

                stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
                                                      0, 1, inter)

                expected = {'tx': frames_number, 'rx': 0}
                self.check_results(stats, expected)
예제 #2
0
    def test_frame_sizes(self):
        """
        Testing that frames with different sizes pass through the pipeline.
        """
        pcap_file = 'ip_pipeline.pcap'
        frames_number = 100
        inter = 0.5

        self.start_ip_pipeline(ports=self.ports_mask)
        self.dut.send_expect(
            'run examples/ip_pipeline/ip_pipeline.sh', 'pipeline>', 10)

        for frame_size in TestIPPipeline.frame_sizes:

            # Create a PCAP file containing the fixed number of frames above
            # with variable size and incremental IP
            self.create_pcap_file(pcap_file, frame_size, 100, True)
            self.tester.session.copy_file_to(pcap_file)

            print utils.BLUE("\tFrame size %d, interval %.1f" % (frame_size,
                                                               inter))

            stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
                                                  1, 0, inter)

            expected = {'tx': 0, 'rx': frames_number}
            self.check_results(stats, expected)

            stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
                                                  0, 1, inter)

            expected = {'tx': frames_number, 'rx': 0}
            self.check_results(stats, expected)
예제 #3
0
    def test_perf_vmdq_performance(self):
        """
        Try  different configuration and different packe size
        """

        self.tester.get_interface(self.tester.get_local_port(
            self.dut_ports[0]))

        frame_sizes = [64, 128, 256, 512, 1024, 1280, 1518]
        for config in self.core_configs:

            print utils.BLUE(config["cores"])
            self.dut.kill_all()

            core_config = config['cores']
            core_list = self.dut.get_core_list(core_config,
                                               socket=self.ports_socket)
            core_mask = utils.create_mask(core_list)
            portmask = utils.create_mask(self.dut.get_ports())
            if self.nic in ("niantic", "springfountain"):
                self.queues = 64
                self.dut.send_expect(
                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 64&"
                    % (self.dut.get_memory_channels(), core_mask, portmask),
                    "reading queues", 30)
            elif self.nic in ("fortville_spirit", "fortville_spirit_single"):
                self.queues = 63
                self.dut.send_expect(
                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 63&"
                    % (self.dut.get_memory_channels(), core_mask, portmask),
                    "reading queues", 30)
            elif self.nic in ("fortville_eagle"):
                self.queues = 34
                self.dut.send_expect(
                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 34&"
                    % (self.dut.get_memory_channels(), core_mask, portmask),
                    "reading queues", 30)
            else:
                self.queues = 8
                self.dut.send_expect(
                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 8&"
                    % (self.dut.get_memory_channels(), core_mask, portmask),
                    "reading queues", 30)

            tx_port = self.tester.get_local_port(self.dut_ports[0])
            rx_port = self.tester.get_local_port(self.dut_ports[1])

            print utils.GREEN("Waiting for application to initialize")
            sleep(5)

            for frame_size in frame_sizes:

                TestVmdq.current_frame_size = frame_size

                print utils.BLUE(str(frame_size))

                self.tester.scapy_append('dstmac="%s"' % self.destmac_port0)
                tx_mac = self.tester.get_mac(tx_port)
                self.tester.scapy_append('srcmac="%s"' % tx_mac)
                self.tester.scapy_append(
                    'flows = [Ether(src=srcmac,dst=dstmac)/Dot1Q(vlan=0)/("X"*%d)]'
                    % (frame_size - TestVmdq.ip_dot1q_header_size))
                self.tester.scapy_append('wrpcap("test1.pcap", flows)')
                self.tester.scapy_execute()

                self.tester.scapy_append('dstmac="%s"' % self.destmac_port1)
                tx_mac = self.tester.get_mac(rx_port)
                self.tester.scapy_append('srcmac="%s"' % tx_mac)
                self.tester.scapy_append(
                    'flows = [Ether(src=srcmac,dst=dstmac)/Dot1Q(vlan=0)/("X"*%d)]'
                    % (frame_size - TestVmdq.ip_dot1q_header_size))
                self.tester.scapy_append('wrpcap("test2.pcap", flows)')
                self.tester.scapy_execute()

                self.vlan_repeat = self.queues
                self.da_repeat = self.queues

                tgen_input = []
                tgen_input.append((tx_port, rx_port, "test1.pcap"))
                tgen_input.append((rx_port, tx_port, "test2.pcap"))
                _, pps = self.tester.traffic_generator_throughput(tgen_input)
                config['mpps'][frame_size] = pps / 1000000.0

        for n in range(len(self.core_configs)):
            for size in frame_sizes:
                self.verify(self.core_configs[n]['mpps'][size] is not 0,
                            "No traffic detected")

        # Print results
        self.result_table_create(['Frame size'] +
                                 [n['cores'] for n in self.core_configs])

        for size in frame_sizes:
            self.result_table_add([size] +
                                  [n['mpps'][size] for n in self.core_configs])

        self.result_table_print()