Thanks Iwase.
After weighing the pros and cons I think the solution pointed out by you
below seems to be the Most appropriate.
https://github.com/osrg/ryu/blob/7f6d8730ab321412e410f0eb65b
8fba6947cd380/ryu/services/protocols/bgp/speaker.py#L353

I will get back to you incase of any further doubt(s).
Thanks
Hadem

On 29-Nov-2017 6:24 AM, "Iwase Yusuke" <iwase.yusu...@gmail.com> wrote:

> Hi Hadem,
>
> > *I guess your suggestion about using the socket method may be the best
> option. *Have you ever tried
> > the socket approach?.
>
> I haven't tried it yet because with this approach, it is required to
> handle the manners of the BGP
> protocol (e.g., sending the OPEN message when established, sending
> KEEPALIVE messages periodically).
>
> Before you staring this approach, why you need to get all UPDATE message
> in your Ryu app?
> Why only the best path is not enough? Ryu provides the APIs to retrieve
> all routes which Ryu
> received from peers, is it not appropriate?
> http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.
> html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.rib_get
>
> I guess most of the UPDATE message field can be retrieved from the "Path"
> instance of the
> EventPrefix or the return values of "BGPSpeaker.rib_get()".
> http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.
> html#ryu.services.protocols.bgp.bgpspeaker.EventPrefix
>
> And If you just need to monitor the routes which Ryu received, how about
> using the BMP protocol?
> The supported features seem to be limited, Ryu sends the updates of peer
> states and of the
> adj-rib-in as the BMP messages.
> http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.
> html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.bmp_server_add
>
>
> FYI, Ryu BGP service receives the BGP message here, if you don't mind the
>> changing Ryu source,
>> you might be able to add some "hooks" for your application.
>> (I don't think it better way though...)
>>
>
> Sorry, I've missed the link to the source code in my previous mail.
> The link should point to the following;
>
> https://github.com/osrg/ryu/blob/7f6d8730ab321412e410f0eb65b
> 8fba6947cd380/ryu/services/protocols/bgp/speaker.py#L353
>
> As you can see in the above code, we need to handle other BGP messages
> with the socket approach...
>
>
> Thanks,
> Iwase
>
>
> On 2017年11月28日 22:49, Pynbiang Hadem wrote:
>
>> Hi Iwase,
>>
>> Regarding the *EventBestPathChanged *question i asked in the previous
>> mail, i think i may hove got the wrong idea.
>> I guess I'm a little confused about the *EventBestPathChanged.*
>> *
>> *
>> *I guess your suggestion about using the socket method may be the best
>> option. *Have you ever tried the socket approach?.
>> *
>> *
>> Thanks
>> Hadem
>>
>> On Tue, Nov 28, 2017 at 2:16 PM, Pynbiang Hadem <pynbiang.ha...@gmail.com
>> <mailto:pynbiang.ha...@gmail.com>> wrote:
>>
>>     Hi Iwase,
>>
>>     Thanks for the response. Changing the source code may not be the best
>> option as there are
>>     disadvantages involved.
>>     What about using the *"EventBestPathChanged(best_path_change_handler)*"
>> event handler?. Do you
>>     think we can catch the BGP Update messages using this event?.
>>
>>     Regards
>>     Hadem
>>
>>     On Tue, Nov 28, 2017 at 5:09 AM, Iwase Yusuke <
>> iwase.yusu...@gmail.com
>>     <mailto:iwase.yusu...@gmail.com>> wrote:
>>
>>         Hi Hadem,
>>
>>         Please let me know what "process" exactly means.
>>         You mean receiving all BGP UPDATE messages in your application,
>> right?
>>
>>         Currently, Ryu BGP service does not provide the APIs to pass the
>> received BGP Update messages to
>>         other applications, so you need to manually open socket, parse
>> the received buffer and
>>         handle the
>>         BGP states manually.
>>
>>         Example:
>>              import socket
>>              from ryu.lib.packet import bgp
>>              ...(snip)...
>>
>>              sock = socket.socket()
>>              ...(snip)...  # bind, connect, accept, ...
>>
>>              buf = self.socket.recv(required_len)
>>
>>              msg, _, rest = bgp.BGPMessage.parser(buf)
>>              # Do handling
>>
>>
>>         FYI, Ryu BGP service receives the BGP message here, if you don't
>> mind the changing Ryu source,
>>         you might be able to add some "hooks" for your application.
>>         (I don't think it better way though...)
>>
>>
>>         Thanks,
>>         Iwase
>>
>>
>>         On 2017年11月27日 18:15, Pynbiang Hadem wrote:
>>
>>             Hi Iwase,
>>
>>             Actually, i want to process the BGP Update messages in my
>> application.
>>             Pls suggest how this can be done.
>>
>>             Thanks
>>             Hadem
>>
>>             On Mon, Nov 27, 2017 at 12:54 PM, Iwase Yusuke <
>> iwase.yusu...@gmail.com
>>             <mailto:iwase.yusu...@gmail.com> <mailto:
>> iwase.yusu...@gmail.com
>>             <mailto:iwase.yusu...@gmail.com>>> wrote:
>>
>>                  Hi Hadem,
>>
>>                  You don't need to handle (receive, extract attributes
>> and so on) the BGP UPDATE
>>             messages directly.
>>                  Ryu BGP service does handle the BGP messages, then
>> notify the updates of the best
>>             path or connect/
>>                  disconnect of neighbors as the "events".
>>                  For example, Ryu will call the given
>> "best_path_change_handler" if you uses the
>>             APIs of BGPSpeaker,
>>
>>             http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.
>> html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker
>>             <http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref
>> .html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker>
>>                             <http://ryu.readthedocs.io/en/
>> latest/library_bgp_speaker_ref.html#ryu.services.protocols.
>> bgp.bgpspeaker.BGPSpeaker
>>             <http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref
>> .html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker>>
>>                  and application.py will generate the event instance if
>> your application observes them.
>>
>>             https://github.com/osrg/ryu/blob/ed2c6eca2227c9efb3c7e51cdd6
>> db6bf578ec609/ryu/services/protocols/bgp/application.py#L141-L171
>>             <https://github.com/osrg/ryu/blob/ed2c6eca2227c9efb3c7e51cdd
>> 6db6bf578ec609/ryu/services/protocols/bgp/application.py#L141-L171>
>>                             <https://github.com/osrg/ryu/b
>> lob/ed2c6eca2227c9efb3c7e51cdd6db6bf578ec609/ryu/services/pr
>> otocols/bgp/application.py#L141-L171
>>             <https://github.com/osrg/ryu/blob/ed2c6eca2227c9efb3c7e51cdd
>> 6db6bf578ec609/ryu/services/protocols/bgp/application.py#L141-L171>>
>>
>>                  Thanks,
>>                  Iwase
>>
>>
>>                  On 2017年11月24日 21:32, Pynbiang Hadem wrote:
>>
>>                      Hi,
>>
>>                      I have two Autonomous Systems AS1 and AS2. I am able
>> to send BGP update message
>>             from AS1 to
>>                      AS2 and vice versa. I want to process the BGP update
>> messages in my RYU
>>             application. I'm a
>>                      little confused how to achieve that.
>>
>>                      Pls help.
>>
>>                      Thanks
>>                      Hadem
>>
>>
>>                      ------------------------------
>> ------------------------------------------------
>>                      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 <mailto:
>> Ryu-devel@lists.sourceforge.net>
>>             <mailto:Ryu-devel@lists.sourceforge.net <mailto:
>> Ryu-devel@lists.sourceforge.net>>
>>             https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>             <https://lists.sourceforge.net/lists/listinfo/ryu-devel>
>>                      <https://lists.sourceforge.net
>> /lists/listinfo/ryu-devel
>>             <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 <mailto:
>> Ryu-devel@lists.sourceforge.net>
>>             https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>             <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

Reply via email to