Hi, On Mon, 17 Aug 2015 12:35:15 +0000 Vikram Choudhary <[email protected]> wrote:
> We have used Ryu's BGP speaker functionality for one of the neutron > projects (https://review.openstack.org/#/c/207635/) and want to know > BGP Speaker and Peer states for display purpose/s. Great, thanks for using Ryu! > With reference to this we have following question's. > > > รจ Does Ryu's BGP Speaker functionality expose any API to query BGP Speaker > and BGP Peer state? > > BGP_FSM_IDLE = 'Idle' > > BGP_FSM_CONNECT = 'Connect' > > BGP_FSM_ACTIVE = 'Active' > > BGP_FSM_OPEN_SENT = 'OpenSent' > > BGP_FSM_OPEN_CONFIRM = 'OpenConfirm' > > BGP_FSM_ESTABLISHED = 'Established' Oops, looks like I left out exporting the important API (I'll export this soon). But, you can easily do such. Add the following line to your code: from ryu.services.protocols.bgp.api.base import call Then add the following function: def neighbor_state_get(format='json'): show = {} show['params'] = ['neighbor', 'summary'] show['format'] = 'json' return call('operator.show', **show) when you call the function, you get something like: {"10.0.255.1": {"info": {"total_message_in": 2, "uptime": 358.009761095047, "fsm_established_transitions": 1, "bgp_state": "Established", "update_message_in": 2, "last_error": null, "total_message_out": 0, "update_message_out": 0}, "conf": {"connect_mode": "both", "cap_refresh": true, "cap_mbgp_vpnv6": false, "cap_mbgp_vpnv4": false, "out_filter": [], "ip_address": "10.0.255.1", "cap_enhanced_refresh": false, "statistics_interval": 60, "id": "e65e2e6a-46ca-42f0-8ea6-65a3aafda6cd", "in_filter": [], "remote_as": 65001, "local_port": null, "check_first_as": false, "local_address": null, "advertise_peer_as": false, "description": "Neighbor: 10.0.255.1", "rtc_as": 64512, "cap_rtc": false, "cap_mbgp_ipv6": false, "cap_mbgp_ipv4": true, "is_route_server_client": false, "statistics_log_enabled": false, "password": null, "hold_time": 40, "name": "Neighbor: 10.0.255.1", "max_prefixes": 0, "enabled": true, "is_next_hop_self": false, "peer_next_hop": null}}} "bgp_state" field is what you are looking for. Please let us know if anything else you need. ------------------------------------------------------------------------------ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
