src/nepi/execution/resource.py
[nepi.git] / src / nepi / resources / linux / udptunnel.py
index 258fbbb..9a241d8 100644 (file)
@@ -29,9 +29,9 @@ import time
 
 @clsinit_copy
 class LinuxUdpTunnel(LinuxTunnel):
-    _rtype = "LinuxUdpTunnel"
+    _rtype = "linux::UdpTunnel"
     _help = "Constructs a tunnel between two Linux endpoints using a UDP connection "
-    _backend = "linux"
+    _platform = "linux"
 
     @classmethod
     def _register_attributes(cls):
@@ -104,13 +104,29 @@ class LinuxUdpTunnel(LinuxTunnel):
         return port
 
     def establish_connection(self, endpoint, remote_endpoint, port):
-        endpoint.establish_udp_connection(remote_endpoint, port)
+        connection_app_home = self.app_home(endpoint)
+        connection_run_home = self.run_home(endpoint)
+
+        endpoint.establish_udp_connection(remote_endpoint,
+                connection_app_home,
+                connection_run_home, 
+                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
@@ -137,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