smartbgp / yabgp

:bowtie:Yet Another BGP Python Implementation
http://yabgp.readthedocs.org
Apache License 2.0
238 stars 70 forks source link

how to get the rib of yabgp #78

Closed wuwenhao2000 closed 6 years ago

wuwenhao2000 commented 6 years ago

hello, in the yabgp.ini, it has the option that following, my question is how to get the rib of yabgp using GET?

Whether maintain bgp rib table rib = True

xiaopeng163 commented 6 years ago

Hi @wuwenhao2000

I am sorry, yabgp does not support that now, if you want to maintain rib like adj-in, please write your own handler to do that.

You can reference this doc http://yabgp.readthedocs.io/en/latest/extension.html about how to write your own yabgp.

more detail, because through the method update_received you can get all the update and withdraw messages received from the peer, so it's easy to create a rib table here.

wuwenhao2000 commented 6 years ago

I see, thanks very much. Currently, I am using MySQL to store the update message received. The following is what I have done, a little ugly but which is working well 😆, I appreciate your job https://github.com/wuwenhao2000/BGP-Agent-test

xiaopeng163 commented 6 years ago

ok, good to know that.

If you have huge amount of BGP prefixes in your network, I suggest:

  1. write bgp update message to file on local disk (by default we do that)
  2. write another program to read the file and then insert/update them into MySQL

The reason is, if you insert/update prefix in update_received each time, it will slow down the yabgp main process. So asynchronous mode like file write/read will be better.

wuwenhao2000 commented 6 years ago

I see thanks a lot