Hi Håvard,
Which Zebra message should be used is depending on your purpose though...
For example, to retrieve the next hop address corresponding to the given
address,
you can use the ZEBRA_IPV4_NEXTHOP_LOOKUP/ZEBRA_IPV6_NEXTHOP_LOOKUP message.
$ cat my_zclient.py
from ryu.controller.handler import set_ev_cls
from ryu.lib import hub
from ryu.lib.packet import zebra
from ryu.services.protocols.zebra import event
from ryu.services.protocols.zebra.client.zclient import ZClient
from ryu.services.protocols.zebra.client import event as zclient_event
class MyZClient(ZClient):
def test_nexthop_lookup(self):
hub.sleep(3)
msg = zebra.ZebraMessage(
body=zebra.ZebraIPv4NexthopLookup(
addr='192.168.34.103'))
self.send_msg(msg)
self.logger.info('Sent message: %s', msg)
@set_ev_cls(event.EventZebraIPv4NexthopLookup)
def _ipv4_nexthop_lookup_handler(self, ev):
self.logger.info(
'ZEBRA_IPV4_NEXTHOP_LOOKUP received: %s', ev.__dict__)
@set_ev_cls(zclient_event.EventZServConnected)
def _zserv_connected_handler(self, ev):
self.logger.info(
'Zebra server connected to %s: %s',
ev.zserv.sock.getpeername(), ev.zserv.sock)
hub.spawn(self.test_nexthop_lookup)
$ ryu-manager my_zclient.py --zapi-server-version 3
lzma module is not available
Registered VCS backend: git
Registered VCS backend: hg
Registered VCS backend: svn
Registered VCS backend: bzr
loading app my_zclient.py
instantiating app my_zclient.py of MyZClient
Zebra server connected to /var/run/quagga/zserv.api:
<eventlet.greenio.base.GreenSocket object at 0x7f873d7b9790>
Sent message:
ZebraMessage(body=ZebraIPv4NexthopLookup(addr='192.168.34.103',metric=None,nexthops=[]),command=15,length=12,version=3,vrf_id=0)
ZEBRA_IPV4_NEXTHOP_LOOKUP received: {'body':
ZebraIPv4NexthopLookup(addr='192.168.34.103',metric=20,nexthops=[NextHopIPv4IFIndex(addr='192.168.24.104',ifindex=57,ifname=None,type=4),
NextHopIPv4IFIndex(addr='192.168.23.103',ifindex=65,ifname=None,type=4)]),
'zclient': <my_zclient.MyZClient object at 0x7f873d7b9c10>, 'length': 35,
'version': 3, 'command': 15, 'vrf_id': 0}
Thanks,
Iwase
On 2017年05月27日 00:39, Håvard Magne Fagervoll wrote:
> Hello!
>
> I have a hybrid setup with 1 OVSwitch connected to 2 hosts. One of the hosts
> are running OSPF externally and has IP 10.0.3.254 internally. The OSPF host
> is running Quagga routing software and the OSPF daemon.
>
> My goal is to access some of the routing data in the OSPF host with the
> controller. The next hop IPs for among other things.
>
> What would be the best way to do this?
>
> I have already implemented a python class, using telnet and vtysh, which is a
> cli running on the OSPF host. I'm not sure this is the best way to go about
> it.
>
> I hope the question made sense.
>
> Best regards
> Håvard Fagervoll
>
>
> ------------------------------------------------------------------------------
> 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
> [email protected]
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel