aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nfvbench/chaining.py2
-rw-r--r--nfvbench/config.py2
-rw-r--r--nfvbench/credentials.py2
-rw-r--r--nfvbench/nfvbench.py4
-rw-r--r--nfvbench/traffic_gen/trex_gen.py4
-rw-r--r--nfvbench/traffic_server.py4
-rw-r--r--nfvbench/utils.py2
7 files changed, 10 insertions, 10 deletions
diff --git a/nfvbench/chaining.py b/nfvbench/chaining.py
index b983efb..5248d01 100644
--- a/nfvbench/chaining.py
+++ b/nfvbench/chaining.py
@@ -500,7 +500,7 @@ class ChainVnf(object):
vnf_gateway1_cidr = g1cidr
vnf_gateway2_cidr = g2cidr
- with open(BOOT_SCRIPT_PATHNAME, 'r') as boot_script:
+ with open(BOOT_SCRIPT_PATHNAME, 'r', encoding="utf-8") as boot_script:
content = boot_script.read()
vm_config = {
'forwarder': config.vm_forwarder,
diff --git a/nfvbench/config.py b/nfvbench/config.py
index c107958..8e77127 100644
--- a/nfvbench/config.py
+++ b/nfvbench/config.py
@@ -23,7 +23,7 @@ def config_load(file_name, from_cfg=None, whitelist_keys=None):
The config file content taking precedence in case of duplicate
"""
try:
- with open(file_name) as fileobj:
+ with open(file_name, encoding="utf-8") as fileobj:
cfg = AttrDict(yaml.safe_load(fileobj))
except IOError:
raise Exception("Configuration file at '{}' was not found. Please use correct path "
diff --git a/nfvbench/credentials.py b/nfvbench/credentials.py
index 7562896..7c48879 100644
--- a/nfvbench/credentials.py
+++ b/nfvbench/credentials.py
@@ -138,7 +138,7 @@ class Credentials(object):
if openrc_file:
if isinstance(openrc_file, str):
if os.path.exists(openrc_file):
- with open(openrc_file) as rc_file:
+ with open(openrc_file, encoding="utf-8") as rc_file:
self.__parse_openrc(rc_file)
else:
LOG.error('Error: rc file does not exist %s', openrc_file)
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py
index 740dca2..891b2bb 100644
--- a/nfvbench/nfvbench.py
+++ b/nfvbench/nfvbench.py
@@ -721,7 +721,7 @@ def main():
sys.exit(0)
if opts.summary:
- with open(opts.summary) as json_data:
+ with open(opts.summary, encoding="utf-8") as json_data:
result = json.load(json_data)
if opts.user_label:
result['config']['user_label'] = opts.user_label
@@ -736,7 +736,7 @@ def main():
# dump the contents of the trex log file
if opts.show_trex_log:
try:
- with open('/tmp/trex.log') as trex_log_file:
+ with open('/tmp/trex.log', encoding="utf-8") as trex_log_file:
print(trex_log_file.read(), end="")
except FileNotFoundError:
print("No TRex log file found!")
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py
index 41768b1..dff72ac 100644
--- a/nfvbench/traffic_gen/trex_gen.py
+++ b/nfvbench/traffic_gen/trex_gen.py
@@ -761,7 +761,7 @@ class TRex(AbstractTrafficGenerator):
after = None
last = None
try:
- with open('/tmp/trex.log', 'r') as trex_log:
+ with open('/tmp/trex.log', 'r', encoding="utf-8") as trex_log:
for _line in trex_log:
line = _line.strip()
if line.startswith('Usage:'):
@@ -912,7 +912,7 @@ class TRex(AbstractTrafficGenerator):
break
last_size = size
time.sleep(1)
- with open(logpath, 'r') as f:
+ with open(logpath, 'r', encoding="utf-8") as f:
message = f.read()
else:
message = e.message
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index 2c85286..5111b32 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -78,7 +78,7 @@ class TRexTrafficServer(TrafficServer):
def __load_config(self, filename):
result = {}
if os.path.exists(filename):
- with open(filename, 'r') as stream:
+ with open(filename, 'r', encoding="utf-8") as stream:
try:
result = yaml.safe_load(stream)
except yaml.YAMLError as exc:
@@ -90,7 +90,7 @@ class TRexTrafficServer(TrafficServer):
yaml.safe_load(result)
if os.path.exists(filename):
os.remove(filename)
- with open(filename, 'w') as f:
+ with open(filename, 'w', encoding="utf-8") as f:
f.write(result)
return filename
diff --git a/nfvbench/utils.py b/nfvbench/utils.py
index 512422d..07a38cb 100644
--- a/nfvbench/utils.py
+++ b/nfvbench/utils.py
@@ -66,7 +66,7 @@ def save_json_result(result, json_file, std_json_path, service_chain, service_ch
if filepaths:
for file_path in filepaths:
LOG.info('Saving results in json file: %s...', file_path)
- with open(file_path, 'w') as jfp:
+ with open(file_path, 'w', encoding="utf-8") as jfp:
json.dump(result,
jfp,
indent=4,