Ensure that ryu is killed
authorpeusterm <manuel.peuster@uni-paderborn.de>
Mon, 14 Mar 2016 16:40:43 +0000 (17:40 +0100)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Mon, 14 Mar 2016 16:40:43 +0000 (17:40 +0100)
src/emuvim/dcemulator/net.py

index bc54293..81d16ab 100755 (executable)
@@ -154,9 +154,8 @@ class DCNetwork(Dockernet):
 
     def stop(self):
         # stop Ryu controller
-        self.ryu_process.terminate()
-        #self.ryu_process.kill()
         Dockernet.stop(self)
+        self.stopRyu()
 
     def CLI(self):
         CLI(self)
@@ -217,4 +216,10 @@ class DCNetwork(Dockernet):
         ryu_cmd =  'ryu-manager'
         FNULL = open("/tmp/ryu.log", 'w')
         self.ryu_process = Popen([ryu_cmd, ryu_path, ryu_path2, ryu_option, ryu_of_port], stdout=FNULL, stderr=FNULL)
-        time.sleep(1)
\ No newline at end of file
+        time.sleep(1)
+
+    def stopRyu(self):
+        if self.ryu_process:
+            self.ryu_process.terminate()
+            self.ryu_process.kill()
+