X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fplanetlab%2Fopenvswitch%2Ftunnel.py;h=682d796e64a184392240f8b21f4b2ac0522b8500;hb=4c05030074b51677a854bfd9d71c9a83de44c90c;hp=23b084670cca42175979b1f32b593341a04c11a6;hpb=7a40d6db82dc5fd7de026b39fdc2bc35887c4e07;p=nepi.git diff --git a/src/nepi/resources/planetlab/openvswitch/tunnel.py b/src/nepi/resources/planetlab/openvswitch/tunnel.py index 23b08467..682d796e 100644 --- a/src/nepi/resources/planetlab/openvswitch/tunnel.py +++ b/src/nepi/resources/planetlab/openvswitch/tunnel.py @@ -15,8 +15,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Author: Alina Quereilhac -# Alexandros Kouvakas +# Authors: Alina Quereilhac +# Alexandros Kouvakas +# Julien Tribino 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))