Serious refactoring of TUN/TAP and tunnel code. Linux udp/gre tunnels not yet functional
[nepi.git] / src / nepi / resources / linux / udptunnel.py
index c00459c..9a241d8 100644 (file)
@@ -113,10 +113,20 @@ class LinuxUdpTunnel(LinuxTunnel):
                 port)
 
     def verify_connection(self, endpoint, remote_endpoint):
-        endpoint.verify_connection()
+        connection_app_home = self.app_home(endpoint)
+        connection_run_home = self.run_home(endpoint)
+
+        endpoint.verify_connection(remote_endpoint,
+                connection_app_home, 
+                connection_run_home)
 
     def terminate_connection(self, endpoint, remote_endpoint):
-        endpoint.terminate_connection()
+        connection_app_home = self.app_home(endpoint)
+        connection_run_home = self.run_home(endpoint)
+
+        endpoint.terminate_connection(remote_endpoint,
+                connection_app_home, 
+                connection_run_home)
 
     def check_state_connection(self):
         # Make sure the process is still running in background
@@ -143,38 +153,4 @@ class LinuxUdpTunnel(LinuxTunnel):
             else:
                 self.set_stopped()
 
-    def wait_local_port(self, endpoint):
-        """ Waits until the local_port file for the endpoint is generated, 
-        and returns the port number 
-        
-        """
-        return self.wait_file(endpoint, "local_port")
-
-    def wait_result(self, endpoint):
-        """ Waits until the return code file for the endpoint is generated 
-        
-        """ 
-        return self.wait_file(endpoint, "ret_file")
-    def wait_file(self, endpoint, filename):
-        """ Waits until file on endpoint is generated """
-        result = None
-        delay = 1.0
-
-        for i in xrange(20):
-            (out, err), proc = endpoint.node.check_output(
-                    self.run_home(endpoint), filename)
-
-            if out:
-                result = out.strip()
-                break
-            else:
-                time.sleep(delay)
-                delay = delay * 1.5
-        else:
-            msg = "Couldn't retrieve %s" % filename
-            self.error(msg, out, err)
-            raise RuntimeError, msg
-
-        return result