docs: refresh & structure overhaul
[nfvbench.git] / nfvbench / traffic_server.py
index 53f4f39..5111b32 100644 (file)
@@ -72,13 +72,13 @@ class TRexTrafficServer(TrafficServer):
                                                                  hdrh_opt,
                                                                  mbuf_opt, cfg)]
         LOG.info(' '.join(cmd))
-        subprocess.Popen(cmd, cwd=self.trex_dir)
-        LOG.info('TRex server is running...')
+        with subprocess.Popen(cmd, cwd=self.trex_dir) as trex_process:
+            LOG.info('TRex server is running (PID: %s)...', trex_process.pid)
 
     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