Hi,

On Wed, 13 Aug 2014 13:28:55 +0200
Jaume Devesa <[email protected]> wrote:

> I'm connecting a Ryu bgp speaker to a remote Quagga service and I'm able to
> share prefixes with it.

Great! I'm glad to hear that you made rapid progress.

> When I execute the *get_rib() *method, I get the prefixes that I get from
> it and the prefixes that I send to it:
> 
> [{u'paths':
> [{u'origin': u'i', u'localpref': u'', u'nexthop': u'192.168.2.92',
> u'metric': 0, *u'aspath':   [1000]*, u'prefix': u'10.100.0.0/24', u'bpr':
> u'Only Path', u'best': True}], u'prefix':     u'10.100.0.0/24'}, {u'paths':
> [{u'origin': u'i', u'localpref': u'', u'nexthop': u'192.168.2.92',
> u'metric': 0, *u'aspath': [1000]*, u'prefix': u'10.101.0.0/24', u'bpr':
> u'Only Path', u'best': True}], u'prefix': u'10.101.0.0/24'}, {u'paths':
> [{u'origin': u'i', u'localpref': u'', u'nexthop': u'10.0.2.2', u'metric':
> u'', *u'aspath': []*, u'prefix': u'172.24.4.0/24', u'bpr': u'Only Path',
> u'best': True}], u'prefix': u'172.24.4.0/24'}]
> 
> I'm interested in filter only the learned ones. I noticed that the ones I
> want has the 'aspath' attribute informed, whereas the ones I have send are
> empty.
> 
> Is this attribute a reasonable filter? If not, how could I filter this list?

Yeah, I think that you can use the attribute like.

        paths = []
        for p in json.loads(speaker.rib_get()):
            for o in p["paths"]:
                if o["aspath"]:
                    paths.append(p)

I think that rib_get() should support other formats. We could define
prefix class (and some others) and return those instances. That makes
it easier to handle the output?

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to