diff options
author | fmenguy <francoisregis.menguy@orange.com> | 2021-03-11 20:33:36 +0100 |
---|---|---|
committer | fmenguy <francoisregis.menguy@orange.com> | 2021-04-27 16:22:39 +0200 |
commit | fc792bba0bfaaaeca8a9a1b6ca47c9cd9303d41f (patch) | |
tree | 2042fd7846251f5f8dc56343400afbd315dc5377 /nfvbench | |
parent | 8755c892f6cfbfb8ca4f3405675dfe770c769605 (diff) |
NFVBENCH-205 - Add behave tests for characterization and non-regression
Change-Id: I708eee21a9fd11e7a276707fb0b43d8598381ce7
Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
Diffstat (limited to 'nfvbench')
-rw-r--r-- | nfvbench/nfvbench.py | 3 | ||||
-rw-r--r-- | nfvbench/utils.py | 18 |
2 files changed, 10 insertions, 11 deletions
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py index 7acb783..bd86810 100644 --- a/nfvbench/nfvbench.py +++ b/nfvbench/nfvbench.py @@ -246,8 +246,7 @@ class NFVBench(object): config.cache_size = config.flow_count # The size must be capped to 10000 (where does this limit come from?) - if config.cache_size > 10000: - config.cache_size = 10000 + config.cache_size = min(config.cache_size, 10000) config.duration_sec = float(config.duration_sec) config.interval_sec = float(config.interval_sec) diff --git a/nfvbench/utils.py b/nfvbench/utils.py index 80a0817..512422d 100644 --- a/nfvbench/utils.py +++ b/nfvbench/utils.py @@ -127,11 +127,11 @@ def get_intel_pci(nic_slot=None, nic_ports=None): trex_base_dir = '/opt/trex' contents = os.listdir(trex_base_dir) trex_dir = os.path.join(trex_base_dir, contents[0]) - process = subprocess.Popen(['python', 'dpdk_setup_ports.py', '-s'], - cwd=trex_dir, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - devices, _ = process.communicate() + with subprocess.Popen(['python', 'dpdk_setup_ports.py', '-s'], + cwd=trex_dir, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as process: + devices, _ = process.communicate() except Exception: devices = '' @@ -147,10 +147,10 @@ def get_intel_pci(nic_slot=None, nic_ports=None): intf_name = glob.glob("/sys/bus/pci/devices/%s/net/*" % port[0]) if intf_name: intf_name = intf_name[0][intf_name[0].rfind('/') + 1:] - process = subprocess.Popen(['ip', '-o', '-d', 'link', 'show', intf_name], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - intf_info, _ = process.communicate() + with subprocess.Popen(['ip', '-o', '-d', 'link', 'show', intf_name], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as process: + intf_info, _ = process.communicate() if re.search('team_slave|bond_slave', intf_info.decode("utf-8")): device_ports_list[port[0].split('.')[0]]['busy'] = True for port in matches: |