Remove the ovs example under planetlab. Let only the ones under openvswicth folder
[nepi.git] / src / nepi / resources / planetlab / openvswitch / tunnel.py
index 23b0846..682d796 100644 (file)
@@ -15,8 +15,9 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
-#            Alexandros Kouvakas <alexandros.kouvakas@gmail.com>
+# Authors: Alina Quereilhac <alina.quereilhac@inria.fr>
+#         Alexandros Kouvakas <alexandros.kouvakas@inria.fr>
+#         Julien Tribino <julien.tribino@inria.fr>
 
 
 from nepi.execution.attribute import Attribute, Flags, Types
@@ -58,7 +59,7 @@ class OVSTunnel(LinuxApplication):
 
         """
         network = Attribute("network", "IPv4 Network Address",
-               flags = Flags.ExecReadOnly)
+               flags = Flags.Design)
 
         cipher = Attribute("cipher",
                "Cipher to encript communication. "
@@ -66,25 +67,25 @@ class OVSTunnel(LinuxApplication):
                 default = None,
                 allowed = ["PLAIN", "AES", "Blowfish", "DES", "DES3"],
                 type = Types.Enumerate, 
-                flags = Flags.ExecReadOnly)
+                flags = Flags.Design)
 
         cipher_key = Attribute("cipherKey",
                 "Specify a symmetric encryption key with which to protect "
                 "packets across the tunnel. python-crypto must be installed "
                 "on the system." ,
-                flags = Flags.ExecReadOnly)
+                flags = Flags.Design)
 
         txqueuelen = Attribute("txQueueLen",
                 "Specifies the interface's transmission queue length. "
                 "Defaults to 1000. ", 
                 type = Types.Integer, 
-                flags = Flags.ExecReadOnly)
+                flags = Flags.Design)
 
         bwlimit = Attribute("bwLimit",
                 "Specifies the interface's emulated bandwidth in bytes "
                 "per second.",
                 type = Types.Integer, 
-                flags = Flags.ExecReadOnly)
+                flags = Flags.Design)
 
         cls._register_attribute(network)
         cls._register_attribute(cipher)
@@ -158,7 +159,7 @@ class OVSTunnel(LinuxApplication):
             if hasattr(rm, "create_port"):
                 connected[position] = rm
                 position += 1
-            elif hasattr(rm, "udp_connect_command"):
+            elif hasattr(rm, "udp_connect"):
                 connected[1] = rm
         return connected
 
@@ -246,29 +247,34 @@ class OVSTunnel(LinuxApplication):
             remote_ip = socket.gethostbyname(rm_node.get("hostname"))
 
         # Collect info from endpoint
-            local_port_file = os.path.join(self.run_home(local_node), "local_port")
-            rem_port_file = os.path.join(self.run_home(local_node), "remote_port")
-            ret_file = os.path.join(self.run_home(local_node), "ret_file")
+            connection_run_home = self.run_home(local_node)
+            connection_app_home = self.app_home(local_node)
             cipher = self.get("cipher")
             cipher_key = self.get("cipherKey")
             bwlimit = self.get("bwLimit")
             txqueuelen = self.get("txQueueLen")
 
-            rem_port = str(self.get_port_info(rm_endpoint,local_endpoint))
-   
+           
         # Upload the remote port in a file
+            rem_port = str(self.get_port_info(rm_endpoint,local_endpoint))
+            rem_port_file = os.path.join(self.run_home(local_node), "remote_port")
             local_node.upload(rem_port, rem_port_file,
                  text = True,
                  overwrite = False)
        
-            connect_command = local_endpoint.udp_connect_command(
-                 remote_ip, local_port_file, rem_port_file,
-                 ret_file, cipher, cipher_key, bwlimit, txqueuelen) 
+            self._pid, self._ppid = local_endpoint.udp_connect(
+                 rm_node, connection_run_home, connection_app_home,
+                 cipher, cipher_key, bwlimit, txqueuelen) 
+
+
+#            connect_command = local_endpoint.udp_connect_command(
+#                 remote_ip, local_port_file, rem_port_file,
+#                 ret_file, cipher, cipher_key, bwlimit, txqueuelen) 
 
-            self.connection_command(connect_command, local_node, rm_node)
+#            self.connection_command(connect_command, local_node, rm_node)
 
-        # Wait for pid file to be generated
-            self._pid, self._ppid = local_node.wait_pid(self.run_home(local_node))
+#        # Wait for pid file to be generated
+#            self._pid, self._ppid = local_node.wait_pid(self.run_home(local_node))
 
             if not self._pid or not self._ppid:
                 (out, err), proc = local_node.check_errors(self.run_home(local_node))