Hi Hadem,

*How can i call my "neighbor_get()"function after the update messages are
received from the neighbor?. can we use any event to achieve this or any other
ways?.*

Originally, when do you need to call "neighbor_get()" function?
Every after the update message received? Periodically per N seconds?

To achieve the former one, unfortunately, now Ryu has no event for such, only
for notifying;
- best patch changed due to new UPDATE received
- peer up or down
https://github.com/osrg/ryu/blob/8287e3513a780c2dbfe3003f6b632d819a0e792c/ryu/services/protocols/bgp/application.py#L145-L147

For the latter one, how about spawn a new thread which calls "neighbor_get()"
periodically?


FYI, "application.py" can be integrated with your own application without
directly modifying "application.py".
http://ryu-iwase.readthedocs.io/en/doc-services_protocols_bgp_application/app/bgp_application.html#integration-with-other-applications

Please note the above link is temporary, because this document is under
reviewing on Ryu-devel and not yet merged to upstream. When merged, you can read
this document from the "official" Ryu Documentation page.


Thanks,
Iwase


On 2018年01月19日 01:55, Pynbiang Hadem wrote:
*Hi Iwase,*
*
*
*Yes you are right. The update messages from neighbor (10.0.0.2) was received much later as can be seen in the output log file(BGPTest-h1.py) attached herewith.*
*The update message received is as below:*
/Received msg from ('10.0.0.2', '55930') << BGPUpdate(len=106,nlri=[],path_attributes=[BGPPathAttributeMpReachNLRI(afi=2,flags=128,length=49,next_hop='::ffff:10.0.0.2',nlri=[LabelledVPNIP6AddrPrefix(addr=([101], BGPTwoOctetAsRD(admin=65002,assigned=150,type=0), '2001:db8:2::'),length=152)],safi=128,type=14), BGPPathAttributeOrigin(flags=64,length=1,type=1,value=2), BGPPathAttributeAsPath(flags=64,length=6,type=2,value=[[65002]]), BGPPathAttributeMultiExitDisc(flags=128,length=4,type=4,value=100), BGPPathAttributeExtendedCommunities(communities=[BGPTwoOctetAsSpecificExtendedCommunity(as_number=65002,local_administrator=150,subtype=2,type=0)],flags=192,length=8,type=16)],total_path_attribute_len=83,type=2,withdrawn_routes=[],withdrawn_routes_len=0)/ /Received route with RT ['65002:150'] that is of no interest to any VRFs or Peers set(['65001:200', '65001:350', '65001:150', '65001:300', '65001:100', '65001:250']). Ignoring paths from this UPDATE: BGPUpdate(len=106,nlri=[],path_attributes=[BGPPathAttributeMpReachNLRI(afi=2,flags=128,length=49,next_hop='::ffff:10.0.0.2',nlri=[LabelledVPNIP6AddrPrefix(addr=([101], BGPTwoOctetAsRD(admin=65002,assigned=150,type=0), '2001:db8:2::'),length=152)],safi=128,type=14), BGPPathAttributeOrigin(flags=64,length=1,type=1,value=2), BGPPathAttributeAsPath(flags=64,length=6,type=2,value=[[65002]]), BGPPathAttributeMultiExitDisc(flags=128,length=4,type=4,value=100), BGPPathAttributeExtendedCommunities(communities=[BGPTwoOctetAsSpecificExtendedCommunity(as_number=65002,local_administrator=150,subtype=2,type=0)],flags=192,length=8,type=16)],total_path_attribute_len=83,type=2,withdrawn_routes=[],withdrawn_routes_len=0)/ /Received msg from ('10.0.0.2', '55930') << BGPUpdate(len=76,nlri=[],path_attributes=[BGPPathAttributeMpReachNLRI(afi=2,flags=128,length=30,next_hop='::ffff:10.0.0.2',nlri=[IP6AddrPrefix(addr='2001:db8:1::',length=64)],safi=1,type=14), BGPPathAttributeOrigin(flags=64,length=1,type=1,value=0), BGPPathAttributeAsPath(flags=64,length=6,type=2,value=[[65002]]), BGPPathAttributeMultiExitDisc(flags=128,length=4,type=4,value=100)],total_path_attribute_len=53,type=2,withdrawn_routes=[],withdrawn_routes_len=0) /

*How can i call my "neighbor_get()"function after the update messages are received from the neighbor?. can we use any event to achieve this or any other ways?.*

Thanks
Hadem

On Wed, Jan 17, 2018 at 4:57 AM, Iwase Yusuke <iwase.yusu...@gmail.com <mailto:iwase.yusu...@gmail.com>> wrote:

    Hi Hadem,

    In that case, you need to call "neighbor_get()" after connections to 
neighbor(s)
    established and received some routes.
    It seems that Ryu just returns a empty list because Ryu does not yet 
received
    any routes from neighbors.

    Thanks,
    Iwase


    On 2018年01月15日 17:48, Pynbiang Hadem wrote:

        Hi Iwase,

        Precisely, i actually wanted to get *adj-RIB-in* information.

        Is there any problem with my code while trying to achieve this?.

        Thanks
        Hadem


        On Mon, Jan 15, 2018 at 5:38 AM, Iwase Yusuke <iwase.yusu...@gmail.com
        <mailto:iwase.yusu...@gmail.com> <mailto:iwase.yusu...@gmail.com
        <mailto:iwase.yusu...@gmail.com>>> wrote:

             Hi Hadem,

             It is depending on what you want to get though, you attempt to get
        neighbors
             information, right?
             In that case, you should use "neighbors_get()" (plural form) 
instead of
             "neighbor_get()".
        
http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.neighbors_get
        
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.neighbors_get>
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.neighbors_get
        
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.neighbors_get>>

             With "neighbor_get()" with "route_type='received-routes'", Ryu
        should return the
             adj-RIB-in information and I guess it is always an empty list when
        starting up
             (connections are not established with neighbors).


             Thanks,
             Iwase


             On 2018年01月13日 00:59, Pynbiang Hadem wrote:

                 Hi Iwase,

                 I've made the modifications accordingly. *Now i am able to see 
the
                 output for vrfs_get() and rib_get()*. *However there is still
        no output
                 for neighbor_get() . ---output is in **BGPTest-output.py*
                 *Pls advice how to get the output for neighbor_get().*
                 *Enclosed herewith: (1) modified bgpapplication1.py & (2)
        BGPTest-output.py*

                 Thanks
                 Hadem





                 On Fri, Jan 12, 2018 at 7:36 AM, Iwase Yusuke
        <iwase.yusu...@gmail.com <mailto:iwase.yusu...@gmail.com>
                 <mailto:iwase.yusu...@gmail.com
        <mailto:iwase.yusu...@gmail.com>> <mailto:iwase.yusu...@gmail.com
        <mailto:iwase.yusu...@gmail.com>

                 <mailto:iwase.yusu...@gmail.com
        <mailto:iwase.yusu...@gmail.com>>>> wrote:

                      Hi Hadem,

                      First, the return value for each BGPSpeaker's API (with
                 format="json") is str
                      type value.
                      Why you need to split them like;
                           vrf_result = self.speaker.vrfs_get('routes', None,
        'all', 'json')
                           nowtime = vrf_result[0]  # <--- ?
                           result = vrf_result[1]   # <--- ?

                      And, please confirm the meaning of each argument when
        calling         BGPSpeaker's
                      APIs.
                      For example, to getting all VRF configurations, you need
        to specify
                 "summary"
                      instead of "routes".
        
http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get
        
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get>
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get
        
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get>>
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get
        
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get>
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get
        
<http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker.vrfs_get>>>

                      Thanks,
                      Iwase


                      On 2018年01月11日 21:55, Pynbiang Hadem wrote:

                          *Hi,*
                          *
                          *
                          *I am getting blank output for BGPSpeaker show_vrf,
        show_rib,
                          show_neighbor. The partial output is as below:*
                                         ----------------------------------
                          /Sending MED Update Message.../
                          /Send BGP UPDATE Message for changing MED[100]/
                          /API method neighbor.update called with args:
        {'ip_address':
                 '10.0.0.2',
                          'changes': {'multi_exit_disc': 100}}/
                          /on_update_med fired/
                          /MED value for neigh: Neighbor: 10.0.0.2 updated to 
100/
                          /Calling get VRFs Information .../
                          /Shows BGP VRF information in a json format/
                          /API method operator.show called with args: {'params':
        ['vrf',
                 'routes',
                          'all'], 'format': 'json'}/
                          /+++++++++++++++++++++++++++++++/
                          /{ : Show VRFs /
                          /+++++++++++++++++++++++++++++++/
                          /"/
                          /
                          /
                          /Calling SHOW RIB .../
                          /Shows BGP routing information in a json format/
                          /API method operator.show called with args: {'params':
        ['rib',
                 'all'],
                          'format': 'json'}/
                          /+++++++++++++++++++++++++++++++/
                          /{ : Show rib /
                          /+++++++++++++++++++++++++++++++/
                          /"/
                          /
                          /
                          /Calling SHOW Neighbor.../
                          /Inside Show Neighbor BGP UPDATE Message/
                          /API method operator.show called with args: {'params':
        ['neighbor',
                          'received-routes', '10.0.0.2', 'all'], 'format': 
'json'}/
                          /[]/
                          /+++++++++++++++++++++++++++++++/
                          /[ : Show neighbor /
                          /+++++++++++++++++++++++++++++++/
                          /]/
                                          
------------------------------------------

                          *I am attaching herewith my BGP application
                 file(bgpapplication1.py). *
                          *Pls let me know what mistake i have done and how to
        display
                 the above
                          details.*
                          *
                          *
                          *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>>
                 <mailto: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>>
<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>
        <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