diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/networkcard.py | 2 | ||||
-rw-r--r-- | tools/pkt_gen/moongen/moongen.py | 53 | ||||
-rw-r--r-- | tools/systeminfo.py | 41 |
3 files changed, 60 insertions, 36 deletions
diff --git a/tools/networkcard.py b/tools/networkcard.py index c31be691..8d704fd5 100644 --- a/tools/networkcard.py +++ b/tools/networkcard.py @@ -249,7 +249,7 @@ def reinit_vfs(pf_pci_handle): :param pf_pci_handle: PCI slot identifier of PF with domain part. """ - rte_pci_tool = os.path.join(settings.getValue('RTE_SDK'), 'tools', 'dpdk_nic_bind.py') + rte_pci_tool = glob.glob(os.path.join(settings.getValue('RTE_SDK'), 'tools', 'dpdk*bind.py'))[0] for vf_nic in get_sriov_vfs_list(pf_pci_handle): nic_driver = get_driver(vf_nic) diff --git a/tools/pkt_gen/moongen/moongen.py b/tools/pkt_gen/moongen/moongen.py index d6c09e5d..21dec9cc 100644 --- a/tools/pkt_gen/moongen/moongen.py +++ b/tools/pkt_gen/moongen/moongen.py @@ -58,12 +58,12 @@ class Moongen(ITrafficGenerator): will likely break traffic generator implementations or tests respectively. """ - self._logger.info("In moongen traffic_defaults method") + self._logger.info("In Moongen traffic_defaults method") return self._traffic_defaults def create_moongen_cfg_file(self, traffic, duration=60, acceptable_loss_pct=1, one_shot=0): - """Create the MoonGen configuration file from VSPERF's traffic profile + """Create the Moongen configuration file from VSPERF's traffic profile :param traffic: Detailed "traffic" spec, i.e. IP address, VLAN tags :param duration: The length of time to generate packet throughput :param acceptable_loss: Maximum packet loss acceptable @@ -138,8 +138,9 @@ class Moongen(ITrafficGenerator): out_file.write("dstIp = \"" + \ str(traffic['l3']['dstip']) + "\",\n") - out_file.write("vlanId = " + \ - str(traffic['vlan']['id']) + ",\n") + if traffic['vlan']['enabled']: + out_file.write("vlanId = " + \ + str(traffic['vlan']['id']) + ",\n") out_file.write("searchRunTime = " + \ str(duration) + ",\n") @@ -157,7 +158,7 @@ class Moongen(ITrafficGenerator): out_file.write("oneShot = true,\n") # Assume 10G line rates at the moment. Need to convert VSPERF - # frame_rate (percentage of line rate) to Mpps for MoonGen + # frame_rate (percentage of line rate) to Mpps for Moongen out_file.write("startRate = " + str((traffic['frame_rate'] / 100) * 14.88) + "\n") out_file.write("}" + "\n") @@ -181,17 +182,17 @@ class Moongen(ITrafficGenerator): raise RuntimeError('MOONGEN: Error copying configuration file') def connect(self): - """Connect to MoonGen traffic generator + """Connect to Moongen traffic generator - Verify that MoonGen is on the system indicated by + Verify that Moongen is on the system indicated by the configuration file """ - self._logger.info("MOONGEN: In MoonGen connect method...") + self._logger.info("MOONGEN: In Moongen connect method...") if self._moongen_host_ip_addr: cmd_ping = "ping -c1 " + self._moongen_host_ip_addr else: - raise RuntimeError('MOONGEN: MoonGen host not defined') + raise RuntimeError('MOONGEN: Moongen host not defined') ping = subprocess.Popen(cmd_ping, shell=True, stderr=subprocess.PIPE) output, error = ping.communicate() @@ -199,7 +200,7 @@ class Moongen(ITrafficGenerator): if ping.returncode: self._logger.error(error) self._logger.error(output) - raise RuntimeError('MOONGEN: Cannot ping MoonGen host at ' + \ + raise RuntimeError('MOONGEN: Cannot ping Moongen host at ' + \ self._moongen_host_ip_addr) connect_moongen = "ssh " + self._moongen_user + \ @@ -218,10 +219,10 @@ class Moongen(ITrafficGenerator): self._logger.error(error) self._logger.error(output) raise RuntimeError( - 'MOONGEN: Cannot locate MoonGen program at %s within %s' \ + 'MOONGEN: Cannot locate Moongen program at %s within %s' \ % (self._moongen_host_ip_addr, self._moongen_base_dir)) - self._logger.info("MOONGEN: MoonGen host successfully found...") + self._logger.info("MOONGEN: Moongen host successfully found...") def disconnect(self): """Disconnect from the traffic generator. @@ -252,7 +253,7 @@ class Moongen(ITrafficGenerator): - List of List of Rx Bytes, - Payload Errors and Sequence Errors. """ - self._logger.info("In moongen send_burst_traffic method") + self._logger.info("In Moongen send_burst_traffic method") return NotImplementedError('Moongen Burst traffic not implemented') def send_cont_traffic(self, traffic=None, duration=20): @@ -274,7 +275,7 @@ class Moongen(ITrafficGenerator): - Max Latency (ns), - Avg Latency (ns) """ - self._logger.info("In moongen send_cont_traffic method") + self._logger.info("In Moongen send_cont_traffic method") self._params.clear() self._params['traffic'] = self.traffic_defaults.copy() @@ -352,18 +353,18 @@ class Moongen(ITrafficGenerator): :param traffic: Detailed "traffic" spec, i.e. IP address, VLAN tags :param duration: Time to wait to receive packets (secs) """ - self._logger.info("In moongen start_cont_traffic method") - return NotImplementedError('Moongen continuous traffic not implemented') + self._logger.info("In Moongen start_cont_traffic method") + return NotImplementedError('moongen continuous traffic not implemented') def stop_cont_traffic(self): # Stop continuous transmission and return results. - self._logger.info("In moongen stop_cont_traffic method") + self._logger.info("In Moongen stop_cont_traffic method") def run_moongen_and_collect_results(self, test_run=1): - """Execute MoonGen and transform results into VSPERF format + """Execute Moongen and transform results into VSPERF format :param test_run: The number of tests to run """ - # Start MoonGen and create logfile of the run + # Start Moongen and create logfile of the run connect_moongen = "ssh " + self._moongen_user + "@" + \ self._moongen_host_ip_addr @@ -381,7 +382,7 @@ class Moongen(ITrafficGenerator): logging.debug(error) logging.debug(output) raise RuntimeError( - 'MOONGEN: Error starting MoonGen program at %s within %s' \ + 'MOONGEN: Error starting Moongen program at %s within %s' \ % (self._moongen_host_ip_addr, self._moongen_base_dir)) cmd_moongen = "mkdir -p /tmp/moongen/" + str(test_run) @@ -396,7 +397,7 @@ class Moongen(ITrafficGenerator): logging.debug(error) logging.debug(output) raise RuntimeError( - 'MOONGEN: Error obtaining MoonGen log from %s within %s' \ + 'MOONGEN: Error obtaining Moongen log from %s within %s' \ % (self._moongen_host_ip_addr, self._moongen_base_dir)) cmd_moongen = " scp " + self._moongen_user + "@" + \ @@ -414,7 +415,7 @@ class Moongen(ITrafficGenerator): logging.debug(error) logging.debug(output) raise RuntimeError( - 'MOONGEN: Error obtaining MoonGen log from %s within %s' \ + 'MOONGEN: Error obtaining Moongen log from %s within %s' \ % (self._moongen_host_ip_addr, self._moongen_base_dir)) log_file = "/tmp/moongen/" + str(test_run) + "/moongen-run.log" @@ -443,7 +444,7 @@ class Moongen(ITrafficGenerator): if not results_match: logging.error('There was a problem parsing ' +\ - 'MoonGen REPORT section of MoonGen log file') + 'Moongen REPORT section of Moongen log file') moongen_results = OrderedDict() moongen_results[ResultsConstants.THROUGHPUT_RX_FPS] = 0 @@ -468,8 +469,8 @@ class Moongen(ITrafficGenerator): if parameters_match: frame_size = int(parameters_match.group(1)) else: - logging.error('There was a problem parsing MoonGen ' +\ - 'PARAMETERS section of MoonGen log file') + logging.error('There was a problem parsing Moongen ' +\ + 'PARAMETERS section of Moongen log file') frame_size = 0 if results_match and parameters_match: @@ -737,7 +738,7 @@ class Moongen(ITrafficGenerator): # # Start transmission and immediately return. Do not wait for results. # - self._logger.info("In moongen start_rfc2544_back2back method") + self._logger.info("In Moongen start_rfc2544_back2back method") return NotImplementedError( 'Moongen start back2back traffic not implemented') diff --git a/tools/systeminfo.py b/tools/systeminfo.py index 9d8eb5cb..50dc17e0 100644 --- a/tools/systeminfo.py +++ b/tools/systeminfo.py @@ -223,22 +223,45 @@ def get_version(app_name): app_git_tag = get_git_tag(S.getValue('OVS_DIR')) elif app_name.lower() in ['dpdk', 'testpmd']: tmp_ver = ['', '', ''] - found = False + dpdk_16 = False with open(app_version_file['dpdk']) as file_: for line in file_: if not line.strip(): continue + # DPDK version < 16 if line.startswith('#define RTE_VER_MAJOR'): - found = True tmp_ver[0] = line.rstrip('\n').split(' ')[2] - if line.startswith('#define RTE_VER_MINOR'): - found = True - tmp_ver[1] = line.rstrip('\n').split(' ')[2] - if line.startswith('#define RTE_VER_PATCH_LEVEL'): - found = True + # DPDK version < 16 + elif line.startswith('#define RTE_VER_PATCH_LEVEL'): tmp_ver[2] = line.rstrip('\n').split(' ')[2] - - if found: + # DPDK version < 16 + elif line.startswith('#define RTE_VER_PATCH_RELEASE'): + release = line.rstrip('\n').split(' ')[2] + if not '16' in release: + tmp_ver[2] += line.rstrip('\n').split(' ')[2] + # DPDK all versions + elif line.startswith('#define RTE_VER_MINOR'): + if dpdk_16: + tmp_ver[2] = line.rstrip('\n').split(' ')[2] + else: + tmp_ver[1] = line.rstrip('\n').split(' ')[2] + # DPDK all versions + elif line.startswith('#define RTE_VER_SUFFIX'): + tmp_ver[2] += line.rstrip('\n').split('"')[1] + # DPDK version >= 16 + elif line.startswith('#define RTE_VER_YEAR'): + dpdk_16 = True + tmp_ver[0] = line.rstrip('\n').split(' ')[2] + # DPDK version >= 16 + elif line.startswith('#define RTE_VER_MONTH'): + tmp_ver[1] = '{:0>2}'.format(line.rstrip('\n').split(' ')[2]) + # DPDK version >= 16 + elif line.startswith('#define RTE_VER_RELEASE'): + release = line.rstrip('\n').split(' ')[2] + if not '16' in release: + tmp_ver[2] += line.rstrip('\n').split(' ')[2] + + if len(tmp_ver[0]): app_version = '.'.join(tmp_ver) app_git_tag = get_git_tag(S.getValue('RTE_SDK')) elif app_name.lower().startswith('qemu'): |