Hi, Well... I didn't suppose the situation Ryu is connecting to multiple Zebra daemons. Because, by the default, Zebra (Quagga) uses the Unix domain socket to connect to other protocol daemons and the Unix domain socket provides its self like a "local file" (difficult to access it remotely), then I guess it requires the complex environment for multiple Zebra daemons topology.
If you build (when "./configure") Zebra (Quagga) with "--enable-tcp-zebra" option, Zebra will expose the Zebra API as the TCP port (the default number is 2600), and you can access it with "ryu-manager --zapi-server-host=<Zebra Host IP>". (APT packaged Quagga is configured without "--enable-tcp-zebra") But, Anyway, the current Ryu Zebra service cannot connect to the multiple Zebra daemons... To enable to connect multiply, we need to some modifications on Ryu. Thanks, Iwase On 2017年11月28日 06:09, Alessandro Gaballo wrote:
Hi, I'm using the following options for isolation: / privateLogDir=True// // privateRunDir=True// // inMountNamespace=True// // inPIDNamespace=True// // inUTSNamespace=True/ ryu-manager --zapi-server-host=/var/run/quagga/zserv.api ryu/services/protocols/zebra/client/sample_dumper.py The command above works if I run it on the host, but I was looking for a more centralized way, I wanted to get everything from the controller with a single ryu-app. On 25/11/2017 01:37, Iwase Yusuke wrote:Hi, Sorry, I haven't writing the docs for the Zebra service yet, because this feature is very experimental... For connecting to the specific Zebra daemon on a Mininet host, first, you need to find the path to the Zebra API socket (unix domain socket) or the TCP port for the Zebra API. This path or TCP port number is depending on the "configure" option when building the Zebra (Quagga) binaries, and mostly placed on "/var/run/quagga/zserv.api" or "127.0.0.1:2600". I don't know how you separate each namespaces for the Zebra daemons, please try to start the "sample_dumper.py" with "--zapi-server-host=/var/run/quagga/zserv.api" option on the Mininet host on which the Zebra daemon running. e.g.) $ ryu-manager --zapi-server-host=/var/run/quagga/zserv.api ryu/services/protocols/zebra/client/sample_dumper.py And for the naming of event classes which "sample_dumper.py" specifies, please refer the pydoc of the following module. The naming convention is the similar to the OpenFlow event classes. https://github.com/osrg/ryu/blob/ed2c6eca2227c9efb3c7e51cdd6db6bf578ec609/ryu/services/protocols/zebra/event.py#L35-L57 Thanks, Iwase On 2017年11月25日 02:17, Alessandro Gaballo wrote:Thanks for the reply, I'm running quagga on mininet and each router is in its own namespace, I think I need to connect to one specific zebra daemon. Do you know where I can find other examples or a clear docs for these APIs? On 23/11/2017 23:48, Iwase Yusuke wrote:Hi, How about using the Zebra client service library of Ryu? https://github.com/osrg/ryu/blob/master/ryu/services/protocols/zebra/client/sample_dumper.py This library provides the APIs to communicate with the Zebra daemon of Quagga (or FRRouting). For example, if you need "connected" routes in your Ryu application, the following dumps the "connected" routes which the Zebra daemon redistributed. $ git diff diff --git a/ryu/services/protocols/zebra/client/sample_dumper.py b/ryu/services/protocols/zebra/client/sample_dumper.py index 395620e..b4ab8ac 100644 --- a/ryu/services/protocols/zebra/client/sample_dumper.py +++ b/ryu/services/protocols/zebra/client/sample_dumper.py @@ -32,6 +32,17 @@ class ZClientDumper(ZClient): 'Zebra server connected to %s: %s', ev.zserv.sock.getpeername(), ev.zserv.sock) + # Send redistribute add message for the route type which you need + for route_type in [zebra.ZEBRA_ROUTE_CONNECT]: + self.send_msg( + zebra.ZebraMessage( + version=self.zserv_ver, + body=zebra.ZebraRedistributeAdd( + route_type=route_type, + ), + ), + ) + @set_ev_cls(event.EventZebraRouterIDUpdate) def _router_id_update_handler(self, ev): self.logger.info( @@ -47,6 +58,16 @@ class ZClientDumper(ZClient): self.logger.info( 'ZEBRA_INTERFACE_ADDRESS_ADD received: %s', ev.__dict__) + @set_ev_cls(event.EventZebraIPv4RouteAdd) + def _ipv4_route_add_handler(self, ev): + self.logger.info( + 'ZEBRA_IPV4_ROUTE_ADD received: %s', ev.__dict__) + + @set_ev_cls(event.EventZebraIPv4RouteDelete) + def _ipv4_route_delete_handler(self, ev): + self.logger.info( + 'ZEBRA_IPV4_ROUTE_DELETE received: %s', ev.__dict__) + @set_ev_cls(zclient_event.EventZServDisconnected) def _zserv_disconnected_handler(self, ev): self.logger.info( $ ryu-manager ryu/services/protocols/zebra/client/sample_dumper.py loading app ryu/services/protocols/zebra/client/sample_dumper.py instantiating app ryu/services/protocols/zebra/client/sample_dumper.py of ZClientDumper Zebra server connected to /var/run/quagga/zserv.api: <eventlet.greenio.base.GreenSocket object at 0x7fb945a14a90> ...(snip)... ZEBRA_IPV4_ROUTE_ADD received: {'zclient': <sample_dumper.ZClientDumper object at 0x7fb949b5a668>, 'version': 2, 'body': ZebraIPv4RouteAdd(distance=0,flags=16,from_zebra=True,ifindexes=[1],instance=None,message=15,metric=0,mtu=None,nexthops=['0.0.0.0'],prefix='2.2.2.2/32',route_type=2,safi=None,src_prefix=None,tag=None), 'command': 7, 'length': 29, 'vrf_id': 0} ZEBRA_IPV4_ROUTE_ADD received: {'zclient': <sample_dumper.ZClientDumper object at 0x7fb949b5a668>, 'version': 2, 'body': ZebraIPv4RouteAdd(distance=0,flags=16,from_zebra=True,ifindexes=[2],instance=None,message=15,metric=0,mtu=None,nexthops=['0.0.0.0'],prefix='192.168.23.0/24',route_type=2,safi=None,src_prefix=None,tag=None), 'command': 7, 'length': 28, 'vrf_id': 0} ZEBRA_IPV4_ROUTE_ADD received: {'zclient': <sample_dumper.ZClientDumper object at 0x7fb949b5a668>, 'version': 2, 'body': ZebraIPv4RouteAdd(distance=0,flags=16,from_zebra=True,ifindexes=[3],instance=None,message=15,metric=0,mtu=None,nexthops=['0.0.0.0'],prefix='192.168.24.0/24',route_type=2,safi=None,src_prefix=None,tag=None), 'command': 7, 'length': 28, 'vrf_id': 0} Thanks, Iwase On 2017年11月23日 00:27, Alessandro Gaballo wrote:Hi, I'm running Quagga on my mininet topology to capture routing information, I wanted to know if it's possible to retrieve the routing table on the quagga routers (which are basically mininet hosts) or at least the flow tables. If so, how do I do it? ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org!http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org!http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel