Hi, On 2016年07月15日 00:41, helcio wagner wrote: > Hi, people. > > I've found a code about BGP in Ryu at this URL: > > https://ryu.readthedocs.io/en/latest/library_bgp_speaker.html > > I suppose it is not an application that can be used on execution of > 'ryu-manager', so I think it should to be executed as an ordinary Python > module. Am I right?
To execute BGPSpeaker in your RyuApp in a simple way, please instantiate BGPSpeaker in your RyuApp initialization process. http://ryu.readthedocs.io/en/latest/library_bgp_speaker_ref.html#ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker Simultaneously, please note to register your handlers(best_path_change_handler, peer_down_handler, peer_up_handler) in order to get events from BGPSpeaker. e.g.) $ git diff diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py index 3e7c598..9a31296 100644 --- a/ryu/app/simple_switch_13.py +++ b/ryu/app/simple_switch_13.py @@ -21,6 +21,7 @@ from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet from ryu.lib.packet import ethernet from ryu.lib.packet import ether_types +from ryu.services.protocols.bgp.bgpspeaker import BGPSpeaker class SimpleSwitch13(app_manager.RyuApp): @@ -29,6 +30,15 @@ class SimpleSwitch13(app_manager.RyuApp): def __init__(self, *args, **kwargs): super(SimpleSwitch13, self).__init__(*args, **kwargs) self.mac_to_port = {} + self.bgpspeaker = BGPSpeaker( + as_number=65000, router_id='10.0.0.1', + best_path_change_handler=self._best_path_change_handler) + + @staticmethod + def _best_path_change_handler(ev): + print('Best path changed: remote_as=%s prefix=%s ' + 'next_hop=%s iis_withdraw=%s' % + (ev.remote_as, ev.prefix, ev.nexthop, ev.is_withdraw)) @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER) def switch_features_handler(self, ev): Thanks, Iwase > > On the other hand, there is such an application in > '/ryu/ryu/services/protocols/bgp' directory. Its name is 'application.py'. My > point is: Does the controller become a BGP node when running that application? > > Thanks in advance. > > Helcio. > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity planning > reports.http://sdm.link/zohodev2dev > > > > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel