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