Hope you don't mind that I added the mailing list on the cc since I forgot how to mail earlier and dropped it ;)
On Thu, Mar 26, 2015 at 9:35 PM, Llorente Santos Jesus <[email protected]> wrote: > Thanks a lot for the info, it's certainly useful! I think I would give a try > to your solution, using the hub and greenthreads. > What you said got me Googling about the greenthreads, and they seem indeed > quite cheap to create with negligible overhead. > > Hei, about your work on ovsdb. Funny thing, I was looking today at exactly > the same, adding a remote ptcp to the OpenvSwitch service to support remote > modifications of the switch configuration. I'm interested in creating on > demand GRE tunnels directly from the Ryu app, would you happen to have any > other hints for this? I don't suppose this is straight forward, but I think > ovsdb is the way to go to get this done :) Yep right now we're developing a system that will create STT and VxLAN ports on the fly. Our code that uses that ovsdb service to create a port is (relevant snippit from a larger class): ```python def create_port(self, system_id, bridge_name, port_info, iface_info=None): try: if iface_info is None: iface_info = {'name': port_info['name'], 'type': 'internal'} new_port_uuid = port_info.get('uuid', uuid.uuid4()) new_iface_uuid = iface_info.get('uuid', uuid.uuid4()) self.logger.info("Creating new port: uuid: %s, data: %s, " "interface: uuid: %s, data: %s" % (new_port_uuid, port_info, new_iface_uuid, iface_info)) def _create_port(tables, insert): bridge = ovsdb_api.row_by_name(self._manager, system_id, bridge_name) if not bridge: return iface = insert(tables['Interface'], new_iface_uuid) for key, val in iface_info.iteritems(): setattr(iface, key, val) port = insert(tables['Port'], new_port_uuid) for key, val in port_info.iteritems(): setattr(port, key, val) port.interfaces = [iface] bridge.ports = bridge.ports + [port] return (new_port_uuid, new_iface_uuid) request_to_add_port = ovsdb_event.EventModifyRequest(system_id, _create_port) reply_to_add_port = self._manager.send_request(request_to_add_port) status = reply_to_add_port.status if status != 'success': self.logger.error("There was an error creating the " "port/interface %s. Status: %s" % (new_port_uuid, status)) return None self.logger.info("Port %s created successfully." % new_port_uuid) return new_port_uuid except Exception: self.logger.exception('Error creating port and interface.') def add_tunnel_port(self, system_id, bridge_name, port_name, tunnel_type=const.TYPE_STT): try: self.logger.info("Creating tunnel port %s on bridge %s" % (port_name, bridge_name)) if not (ovsdb_api.bridge_exists(self._manager, system_id, bridge_name)): self.logger.error("Bridge %s does not exists" % bridge_name) return # TODO(Name) Change this to log and raise an exception if port_name: if ovsdb_api.port_exists(self._manager, system_id, port_name): self.logger.info("Port %s already exists" % port_name) return # TODO(Name) Change this to log and raise an # exception else: self.logger.error("No port name provided.") return # TODO(Name) Change this to log and raise an exception port_info = {'name': port_name, 'other_config': {'tunnel_type': tunnel_type}} iface_info = {'name': port_name, 'type': tunnel_type, 'other_config': {'tunnel_type': tunnel_type}, 'options': {'remote_ip': 'flow', 'key': 'flow'}} return self.create_port(system_id, bridge_name, port_info, iface_info) except Exception: self.logger.exception('Error adding tunnel port.') ``` My goal is to clean up the ovsdb api and get ssl support added in, then propose it for addition to Ryu. Happy Hacking! 7-11 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
