ec.register_connection(port, ovs)
return port
-def add_tap(ec, ip4, prefix4, pointopoint, node):
+def add_tap(ec, endpoint_ip, endpoint_prefix, pointopoint, node):
tap = ec.register_resource("PlanetlabTap")
- ec.set(tap, "ip4", ip4)
- ec.set(tap, "prefix4", prefix4)
+ ec.set(tap, "endpoint_ip", endpoint_ip)
+ ec.set(tap, "endpoint_prefix", endpoint_prefix)
ec.set(tap, "pointopoint", pointopoint)
ec.set(tap, "up", True)
ec.register_connection(tap, node)
ec.register_connection(port, ovs)
return port
-def add_tap(ec, ip4, prefix4, pointopoint, node):
+def add_tap(ec, endpoint_ip, endpoint_prefix, pointopoint, node):
tap = ec.register_resource("PlanetlabTap")
- ec.set(tap, "ip4", ip4)
- ec.set(tap, "prefix4", prefix4)
+ ec.set(tap, "endpoint_ip", endpoint_ip)
+ ec.set(tap, "endpoint_prefix", endpoint_prefix)
ec.set(tap, "pointopoint", pointopoint)
ec.set(tap, "up", True)
ec.register_connection(tap, node)
ec.register_connection(port, ovs)
return port
-def add_tap(ec, ip4, prefix4, pointopoint, node):
+def add_tap(ec, endpoint_ip, endpoint_prefix, pointopoint, node):
tap = ec.register_resource("PlanetlabTap")
- ec.set(tap, "ip4", ip4)
- ec.set(tap, "prefix4", prefix4)
+ ec.set(tap, "endpoint_ip", endpoint_ip)
+ ec.set(tap, "endpoint_prefix", endpoint_prefix)
ec.set(tap, "pointopoint", pointopoint)
ec.set(tap, "up", True)
ec.register_connection(tap, node)
ec.set(node, "cleanProcesses", True)
return node
-def add_tap(ec, ip4, prefix4, pointopoint, node):
+def add_tap(ec, endpoint_ip, endpoint_prefix, pointopoint, node):
tap = ec.register_resource("PlanetlabTap")
- ec.set(tap, "ip4", ip4)
- ec.set(tap, "prefix4", prefix4)
+ ec.set(tap, "endpoint_ip", endpoint_ip)
+ ec.set(tap, "endpoint_prefix", endpoint_prefix)
ec.set(tap, "pointopoint", pointopoint)
ec.set(tap, "up", True)
ec.register_connection(tap, node)
@classmethod
def _register_attributes(cls):
- ip4 = Attribute("ip4", "IPv4 Address",
+ endpoint_ip = Attribute("endpoint_ip", "IPv4 Address",
flags = Flags.Design)
mac = Attribute("mac", "MAC Address",
flags = Flags.Design)
- prefix4 = Attribute("prefix4", "IPv4 network prefix",
+ endpoint_prefix = Attribute("endpoint_prefix", "IPv4 network prefix",
type = Types.Integer,
flags = Flags.Design)
"Bash script to be executed before releasing the resource",
flags = Flags.Design)
- cls._register_attribute(ip4)
+ cls._register_attribute(endpoint_ip)
cls._register_attribute(mac)
- cls._register_attribute(prefix4)
+ cls._register_attribute(endpoint_prefix)
cls._register_attribute(mtu)
cls._register_attribute(devname)
cls._register_attribute(up)
cipher, cipher_key, bwlimit, txqueuelen):
# Set the remote endpoint
- self.set("pointopoint", remote_endpoint.get("ip4"))
+ self.set("pointopoint", remote_endpoint.get("endpoint_ip"))
# Planetlab TAPs always use PI headers
from nepi.resources.planetlab.tap import PlanetlabTap
def _gre_connect_command(self, remote_endpoint, connection_run_home):
# Set the remote endpoint
- self.set("pointopoint", remote_endpoint.get("ip4"))
+ self.set("pointopoint", remote_endpoint.get("endpoint_ip"))
self.set("greRemote", remote_endpoint.node.get("ip"))
# Generate GRE connect command
"pi" if self.get("pi") else ""))
start_command.append("sudo -S ip link set %s up" % self.get("deviceName"))
start_command.append("sudo -S ip addr add %s/%d dev %s" % (
- self.get("ip4"),
- self.get("prefix4"),
+ self.get("endpoint_ip"),
+ self.get("endpoint_prefix"),
self.get("deviceName"),
))
self.get("greKey")
))
command.append("sudo -S ip addr add %s/%d peer %s/%d dev %s" % (
- self.get("ip4"),
- self.get("prefix4"),
+ self.get("endpoint_ip"),
+ self.get("endpoint_prefix"),
self.get("pointopoint"),
- self.get("prefix4"),
+ self.get("endpoint_prefix"),
self.get("deviceName"),
))
command.append("sudo -S ip link set %s up " % self.get("deviceName"))
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
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))
@classmethod
def _register_attributes(cls):
- ip4 = Attribute("ip4", "IPv4 Address",
+ endpoint_ip = Attribute("endpoint_ip", "IP of the endpoint. This is the attribute "
+ "you should use to establish a tunnel or a remote "
+ "connection between endpoint",
flags = Flags.Design)
mac = Attribute("mac", "MAC Address",
flags = Flags.Design)
- prefix4 = Attribute("prefix4", "IPv4 network prefix",
+ endpoint_prefix = Attribute("endpoint_prefix", "IPv4 network prefix of the endpoint",
type = Types.Integer,
flags = Flags.Design)
"Bash script to be executed before releasing the resource",
flags = Flags.Design)
- cls._register_attribute(ip4)
+ cls._register_attribute(endpoint_ip)
cls._register_attribute(mac)
- cls._register_attribute(prefix4)
+ cls._register_attribute(endpoint_prefix)
cls._register_attribute(mtu)
cls._register_attribute(devname)
cls._register_attribute(up)
cipher, cipher_key, bwlimit, txqueuelen):
# Set the remote endpoint
- self.set("pointopoint", remote_endpoint.get("ip4"))
+ self.set("pointopoint", remote_endpoint.get("endpoint_ip"))
remote_ip = remote_endpoint.node.get("ip")
def _gre_connect_command(self, remote_endpoint, connection_run_home):
# Set the remote endpoint
- self.set("pointopoint", remote_endpoint.get("ip4"))
+ self.set("pointopoint", remote_endpoint.get("endpoint_ip"))
self.set("greRemote", remote_endpoint.node.get("ip"))
# Generate GRE connect command
command = ["sudo -S python ${SRC}/pl-vif-create.py"]
command.append("-t %s" % self.vif_type)
- command.append("-a %s" % self.get("ip4"))
- command.append("-n %d" % self.get("prefix4"))
+ command.append("-a %s" % self.get("endpoint_ip"))
+ command.append("-n %d" % self.get("endpoint_prefix"))
command.append("-f %s " % self.vif_name_file)
command.append("-S %s " % self.sock_name)
command.append("-u %s" % self.node.get("username"))
command.append("-N %s" % device_name)
command.append("-t %s" % self.vif_type)
- command.append("-a %s" % self.get("ip4"))
- command.append("-n %d" % self.get("prefix4"))
+ command.append("-a %s" % self.get("endpoint_ip"))
+ command.append("-n %d" % self.get("endpoint_prefix"))
if self.get("snat") == True:
command.append("-s")
command = ["sudo -S python ${SRC}/pl-vroute.py"]
command.append("-a %s" % self.get("action"))
command.append("-n %s" % self.get("network"))
- command.append("-p %d" % self.tap.get("prefix4"))
+ command.append("-p %d" % self.tap.get("endpoint_prefix"))
command.append("-g %s" % self.tap.get("pointopoint"))
command.append("-f %s" % self.tap.get("deviceName"))
return " ".join(command)
command = ["sudo -S python ${SRC}/pl-vroute.py"]
command.append("-a %s" % "del")
command.append("-n %s" % self.get("network"))
- command.append("-p %d" % self.tap.get("prefix4"))
+ command.append("-p %d" % self.tap.get("endpoint_prefix"))
command.append("-g %s" % self.tap.get("pointopoint"))
command.append("-f %s" % self.tap.get("deviceName"))
return " ".join(command)
ec.set(node1, "cleanProcesses", True)
tap1 = ec.register_resource("LinuxTap")
- ec.set(tap1, "ip4", "%s.1" % self.netblock)
- ec.set(tap1, "prefix4", 32)
+ ec.set(tap1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tap1, "endpoint_prefix", 32)
ec.register_connection(tap1, node1)
node2 = ec.register_resource("LinuxNode")
ec.set(node2, "cleanProcesses", True)
tap2 = ec.register_resource("LinuxTap")
- ec.set(tap2, "ip4", "%s.2" % self.netblock)
- ec.set(tap2, "prefix4", 32)
+ ec.set(tap2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tap2, "endpoint_prefix", 32)
ec.register_connection(tap2, node2)
gretun = ec.register_resource("LinuxGRETunnel")
ec.set(node1, "cleanProcesses", True)
tun1 = ec.register_resource("LinuxTun")
- ec.set(tun1, "ip4", "%s.1" % self.netblock)
- ec.set(tun1, "prefix4", 32)
+ ec.set(tun1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tun1, "endpoint_prefix", 32)
ec.register_connection(tun1, node1)
node2 = ec.register_resource("LinuxNode")
ec.set(node2, "cleanProcesses", True)
tun2 = ec.register_resource("LinuxTun")
- ec.set(tun2, "ip4", "%s.2" % self.netblock)
- ec.set(tun2, "prefix4", 32)
+ ec.set(tun2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tun2, "endpoint_prefix", 32)
ec.register_connection(tun2, node2)
udptun = ec.register_resource("LinuxGRETunnel")
ec.set(node, "cleanProcesses", True)
tap = ec.register_resource("LinuxTap")
- ec.set(tap, "ip4", "%s.1" % self.netblock)
- ec.set(tap, "prefix4", 24)
+ ec.set(tap, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tap, "endpoint_prefix", 24)
ec.register_connection(tap, node)
app = ec.register_resource("LinuxApplication")
ec.set(node, "cleanProcesses", True)
tun = ec.register_resource("LinuxTun")
- ec.set(tun, "ip4", "%s.1" % self.netblock)
- ec.set(tun, "prefix4", 24)
+ ec.set(tun, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tun, "endpoint_prefix", 24)
ec.register_connection(tun, node)
app = ec.register_resource("LinuxApplication")
ec.set(node1, "cleanProcesses", True)
tap1 = ec.register_resource("LinuxTap")
- ec.set(tap1, "ip4", "%s.1" % self.netblock)
- ec.set(tap1, "prefix4", 32)
+ ec.set(tap1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tap1, "endpoint_prefix", 32)
ec.register_connection(tap1, node1)
node2 = ec.register_resource("LinuxNode")
ec.set(node2, "cleanProcesses", True)
tap2 = ec.register_resource("LinuxTap")
- ec.set(tap2, "ip4", "%s.2" % self.netblock)
- ec.set(tap2, "prefix4", 32)
+ ec.set(tap2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tap2, "endpoint_prefix", 32)
ec.register_connection(tap2, node2)
udptun = ec.register_resource("LinuxUdpTunnel")
ec.set(node1, "cleanProcesses", True)
tun1 = ec.register_resource("LinuxTun")
- ec.set(tun1, "ip4", "%s.1" % self.netblock)
- ec.set(tun1, "prefix4", 32)
+ ec.set(tun1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tun1, "endpoint_prefix", 32)
ec.register_connection(tun1, node1)
node2 = ec.register_resource("LinuxNode")
ec.set(node2, "cleanProcesses", True)
tun2 = ec.register_resource("LinuxTun")
- ec.set(tun2, "ip4", "%s.2" % self.netblock)
- ec.set(tun2, "prefix4", 32)
+ ec.set(tun2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tun2, "endpoint_prefix", 32)
ec.register_connection(tun2, node2)
udptun = ec.register_resource("LinuxUdpTunnel")
ec.set(node1, "cleanProcesses", True)
tap1 = ec.register_resource("PlanetlabTap")
- ec.set(tap1, "ip4", "%s.1" % self.netblock)
- ec.set(tap1, "prefix4", 24)
+ ec.set(tap1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tap1, "endpoint_prefix", 24)
ec.register_connection(tap1, node1)
node2 = ec.register_resource("PlanetlabNode")
ec.set(node2, "cleanProcesses", True)
tap2 = ec.register_resource("PlanetlabTap")
- ec.set(tap2, "ip4", "%s.2" % self.netblock)
- ec.set(tap2, "prefix4", 24)
+ ec.set(tap2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tap2, "endpoint_prefix", 24)
ec.register_connection(tap2, node2)
gretun = ec.register_resource("LinuxGRETunnel")
ec.set(node1, "cleanProcesses", True)
tun1 = ec.register_resource("PlanetlabTun")
- ec.set(tun1, "ip4", "%s.1" % self.netblock)
- ec.set(tun1, "prefix4", 24)
+ ec.set(tun1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tun1, "endpoint_prefix", 24)
ec.register_connection(tun1, node1)
node2 = ec.register_resource("PlanetlabNode")
ec.set(node2, "cleanProcesses", True)
tun2 = ec.register_resource("PlanetlabTun")
- ec.set(tun2, "ip4", "%s.2" % self.netblock)
- ec.set(tun2, "prefix4", 24)
+ ec.set(tun2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tun2, "endpoint_prefix", 24)
ec.register_connection(tun2, node2)
udptun = ec.register_resource("LinuxGRETunnel")
ec.set(node1, "cleanProcesses", True)
tun1 = ec.register_resource("PlanetlabTun")
- ec.set(tun1, "ip4", "%s.1" % self.netblock)
- ec.set(tun1, "prefix4", 24)
+ ec.set(tun1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tun1, "endpoint_prefix", 24)
ec.register_connection(tun1, node1)
node2 = ec.register_resource("LinuxNode")
ec.set(node2, "cleanProcesses", True)
tun2 = ec.register_resource("LinuxTun")
- ec.set(tun2, "ip4", "%s.2" % self.netblock)
- ec.set(tun2, "prefix4", 24)
+ ec.set(tun2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tun2, "endpoint_prefix", 24)
ec.register_connection(tun2, node2)
gretun = ec.register_resource("LinuxGRETunnel")
ec.set(node, "cleanProcesses", True)
tap = ec.register_resource("PlanetlabTap")
- ec.set(tap, "ip4", "%s.1" % self.netblock)
- ec.set(tap, "prefix4", 24)
+ ec.set(tap, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tap, "endpoint_prefix", 24)
ec.register_connection(tap, node)
app = ec.register_resource("LinuxApplication")
ec.set(node, "cleanProcesses", True)
tun = ec.register_resource("PlanetlabTun")
- ec.set(tun, "ip4", "%s.1" % self.netblock)
- ec.set(tun, "prefix4", 24)
+ ec.set(tun, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tun, "endpoint_prefix", 24)
ec.register_connection(tun, node)
app = ec.register_resource("LinuxApplication")
ec.set(node1, "cleanProcesses", True)
tap1 = ec.register_resource("PlanetlabTap")
- ec.set(tap1, "ip4", "%s.1" % self.netblock)
- ec.set(tap1, "prefix4", 24)
+ ec.set(tap1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tap1, "endpoint_prefix", 24)
ec.register_connection(tap1, node1)
node2 = ec.register_resource("PlanetlabNode")
ec.set(node2, "cleanProcesses", True)
tap2 = ec.register_resource("PlanetlabTap")
- ec.set(tap2, "ip4", "%s.2" % self.netblock)
- ec.set(tap2, "prefix4", 24)
+ ec.set(tap2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tap2, "endpoint_prefix", 24)
ec.register_connection(tap2, node2)
udptun = ec.register_resource("LinuxUdpTunnel")
ec.set(node1, "cleanProcesses", True)
tun1 = ec.register_resource("PlanetlabTun")
- ec.set(tun1, "ip4", "%s.1" % self.netblock)
- ec.set(tun1, "prefix4", 24)
+ ec.set(tun1, "endpoint_ip", "%s.1" % self.netblock)
+ ec.set(tun1, "endpoint_prefix", 24)
ec.register_connection(tun1, node1)
node2 = ec.register_resource("PlanetlabNode")
ec.set(node2, "cleanProcesses", True)
tun2 = ec.register_resource("PlanetlabTun")
- ec.set(tun2, "ip4", "%s.2" % self.netblock)
- ec.set(tun2, "prefix4", 24)
+ ec.set(tun2, "endpoint_ip", "%s.2" % self.netblock)
+ ec.set(tun2, "endpoint_prefix", 24)
ec.register_connection(tun2, node2)
udptun = ec.register_resource("LinuxUdpTunnel")