-
- def set_port_info(self, ip):
- info = []
- info.append(self.node.get('hostname'))
- info.append(ip)
- info.append(self.get('port_name'))
- info.append(self.ovswitch.get('virtual_ip_pref'))
- info.append(self.port_number)
- return info
-
- def switch_connect_command(self, local_port_name,
- remote_ip, remote_port_num):
- """ Script for switch links
+
+ # Must set a routing rule in the ovs client nodes so they know
+ # that the LAN can be found through the switch
+ if remote_endpoint.is_rm_instance("planetlab::Tap"):
+ self._vroute = self.ec.register_resource("planetlab::Vroute")
+ self.ec.set(self._vroute, "action", "add")
+ self.ec.set(self._vroute, "prefix", remote_endpoint.get("prefix"))
+ self.ec.set(self._vroute, "nexthop", remote_endpoint.get("pointopoint"))
+ self.ec.set(self._vroute, "network", self.get("network"))
+
+ self.ec.register_connection(self._vroute, remote_endpoint.guid)
+ self.ec.deploy(guids=[self._vroute], group = self.deployment_group)
+
+ # For debugging
+ msg = "Route for the tap configured"
+ self.debug(msg)
+
+ return self.port_number
+
+ def establish_udp_connection(self, remote_endpoint,
+ connection_app_home,
+ connection_run_home,
+ port):
+ remote_ip = remote_endpoint.node.get("ip")
+ command = self._establish_connection_command(port, remote_ip)
+
+ shfile = os.path.join(connection_app_home, "connect_port.sh")
+ (out, err), proc = self.node.run_and_wait(command, connection_run_home,
+ shfile=shfile,
+ sudo=True,
+ overwrite = True,
+ pidfile="connect_port_pidfile",
+ ecodefile="connect_port_exitcode",
+ stdout="connect_port_stdout",
+ stderr="connect_port_stderr")
+
+ # For debugging
+ msg = "Connection on port configured"
+ self.debug(msg)
+
+ def _establish_connection_command(self, port, remote_ip):
+ """ Script to create the connection from a switch to a
+ remote endpoint