Example #1
0
 def _finalize_physical_nics(self, dpdk_interfaces, dpdk_vars):
     """
     Finalizes the physical interfaces
     :param dpdk_interfaces: Number of interfaces to be used (type: int)
     :param dpdk_vars: variables from config file related to DPDK pktgen
                       (type: dict)
     :return: None
     """
     if not dpdk_interfaces == 1 and not dpdk_interfaces == 2:
         raise ValueError('No interfaces have been indicated for packet '
                          'generation usage. Please specify one or two '
                          'NICs')
     # Initialize NIC 1
     common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                        'tools/dpdk_nic_bind.py --unbind ' +
                        dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
     common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                        'tools/dpdk_nic_bind.py --bind=ixgbe ' +
                        dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
     common.run_command('ifconfig ' +
                        common.get_interface_name_by_bus_address(
                            dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1]) +
                        ' up')
     if dpdk_interfaces == 2:
         # Initialize NIC 2
         common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                            'tools/dpdk_nic_bind.py --unbind ' +
                            dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
         common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                            'tools/dpdk_nic_bind.py --bind=ixgbe ' +
                            dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
         common.run_command('ifconfig ' +
                             common.get_interface_name_by_bus_address(
                             dpdk_vars[conf_file.
                             CFSP_DPDK_BUS_SLOT_NIC_2]) + ' up')
Example #2
0
    def run(self):
        # Setup packet generator
        traffic_time = '10'
        packet_size = '512'
        traffic_rate_percentage = self.params[THROUGHPUT]

        dpdk_pktgen_vars = common.get_dpdk_pktgen_vars()
        bus_address = dpdk_pktgen_vars[cfs.CFSP_DPDK_BUS_SLOT_NIC_2]
        self.interface_name = \
            common.get_interface_name_by_bus_address(bus_address)

        packetgen = dpdk.DpdkPacketGenerator()
        self._configure_lua_file(traffic_rate_percentage, traffic_time)
        packetgen.init_dpdk_pktgen(dpdk_interfaces=1,
                                   pcap_file_0='packet_' + packet_size +
                                   '.pcap',
                                   pcap_file_1='igmp.pcap',
                                   lua_script='constant_traffic.lua',
                                   vlan_0=self.params[VLAN_SENDER],
                                   vlan_1=self.params[VLAN_RECEIVER])

        self._init_packet_checker()
        # Send constant traffic at a specified rate
        common.LOG.debug('Start the packet generator')
        packetgen.send_traffic()
        common.LOG.debug('Stop the packet generator')
        time.sleep(5)
        self._finalize_packet_checker()
        self._reset_lua_file(traffic_rate_percentage, traffic_time)
        return self._get_results()
    def run(self):
        # Setup packet generator
        traffic_time = '10'
        packet_size = '512'
        traffic_rate_percentage = self.params[THROUGHPUT]

        dpdk_pktgen_vars = common.get_dpdk_pktgen_vars()
        bus_address = dpdk_pktgen_vars[cfs.CFSP_DPDK_BUS_SLOT_NIC_2]
        self.interface_name = \
            common.get_interface_name_by_bus_address(bus_address)

        packetgen = dpdk.DpdkPacketGenerator()
        self._configure_lua_file(traffic_rate_percentage, traffic_time)
        packetgen.init_dpdk_pktgen(dpdk_interfaces=1,
                                   pcap_file_0='packet_' + packet_size +
                                               '.pcap',
                                   pcap_file_1='igmp.pcap',
                                   lua_script='constant_traffic.lua',
                                   vlan_0=self.params[VLAN_SENDER],
                                   vlan_1=self.params[VLAN_RECEIVER])

        self._init_packet_checker()
        # Send constant traffic at a specified rate
        common.LOG.debug('Start the packet generator')
        packetgen.send_traffic()
        common.LOG.debug('Stop the packet generator')
        time.sleep(5)
        self._finalize_packet_checker()
        self._reset_lua_file(traffic_rate_percentage, traffic_time)
        return self._get_results()
Example #4
0
 def _init_physical_nics(self, dpdk_interfaces, dpdk_vars):
     """
     Initializes the physical interfaces
     :param dpdk_interfaces: Number of interfaces to be used (type: int)
     :param dpdk_vars: variables from config file related to DPDK pktgen
                       (type: dict)
     :return: None
     """
     if not dpdk_interfaces == 1 and not dpdk_interfaces == 2:
         raise ValueError('The number of NICs can be 1 or 2')
     # Initialize NIC 1
     bus_address_1 = dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1]
     interface_1 = common.get_interface_name_by_bus_address(bus_address_1)
     common.run_command('ifconfig ' + interface_1 + ' down')
     common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                        'tools/dpdk_nic_bind.py --unbind ' +
                        dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
     common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                        'tools/dpdk_nic_bind.py --bind=igb_uio ' +
                        dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
     if dpdk_interfaces == 2:
         # Initialize NIC 2
         bus_address_2 = dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2]
         interface_2 = common.\
             get_interface_name_by_bus_address(bus_address_2)
         common.run_command('ifconfig ' + interface_2 + ' down')
         common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                            'tools/dpdk_nic_bind.py --unbind ' +
                            dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
         common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
                            'tools/dpdk_nic_bind.py --bind=igb_uio ' +
                            dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])