[Ryu-devel] bgp configuration
Brought to you by:
nz_gizmoguy
From: FUJITA T. <fuj...@la...> - 2014-05-28 19:39:44
|
Here's a simple instruction about bgp JSON API that I've added. = Quagga bgpd has AS 64513 and 192.168.177.32. Check some bgp info: bgpd> show ip bgp BGP table version is 0, local router ID is 192.168.177.32 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.1.0.0/24 0.0.0.0 0 32768 i Total number of prefixes 1 Now I start Ryu BGP: $ sudo PYTHONPATH=.:$PYTHONPATH ryu-manager ryu/services/protocols/bgp/api/jsonrpc.pyryu/services/protocols/bgp/application.py Next I'll configure via JSON RPC API: $ wsdump.py ws://127.0.0.1:8080/bgp/ws > {"jsonrpc": "2.0", "id": 1, "method": "core.start", "params" : {"as_number":64512, "router_id":"10.0.0.2"}} < {"jsonrpc": "2.0", "id": 1, "result": {}} > {"jsonrpc": "2.0", "id": 1, "method": "neighbor.create", "params" : {"ip_address":"192.168.177.32", "remote_as":64513}} < {"jsonrpc": "2.0", "id": 1, "result": {}} Note that wsdump.py is included in websocket-client python package. The connection between Ryu bgp and Quagga bgp is supposed to establish. Let's check: > {"jsonrpc": "2.0", "id": 1, "method": "neighbors.get", "params" : {}} < {"jsonrpc": "2.0", "id": 1, "result": [{"advertise_peer_as": false, "description": "Neighbor: 192.168.177.32", "rtc_as": 64512, "cap_refresh": true, "cap_mbgp_vpnv6": false, "cap_mbgp_vpnv4": false, "statistics_log_enabled": false, "ip_address": "192.168.177.32", "cap_mbgp_ipv4": true, "hold_time": 40, "id": "748932d3-dcb3-42cd-984b-de2ef5245d11", "remote_as": 64513, "name": "Neighbor: 192.168.177.32", "local_port": null, "statistics_interval": 60, "cap_rtc": false, "enabled": true, "max_prefixes": 0, "local_address": null, "cap_enhanced_refresh": false}]} You should see a route configured in Quagga bgp: > {"jsonrpc": "2.0", "id": 1, "method": "show.rib", "params" : {}} < {"jsonrpc": "2.0", "id": 1, "result": "[{\"paths\": [{\"origin\": \"i\", \"aspath\": [64513], \"prefix\": \"10.1.0.0/24\", \"bpr\": \"Only Path\", \"localpref\": \"\", \"metric\": 0, \"nexthop\": \"192.168.177.32\", \"best\": true}], \"prefix\": \"10.1.0.0/24\"}]"} Let's configure a route to Ryu bgp: > {"jsonrpc": "2.0", "id": 1, "method": "network.add", "params" : {"prefix":"10.20.0.0/24"}} < {"jsonrpc": "2.0", "id": 1, "result": {}} Let's check the status on Quagga side: bgpd> show ip bgp BGP table version is 0, local router ID is 192.168.177.32 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.1.0.0/24 0.0.0.0 0 32768 i *> 10.20.0.0/24 192.168.177.1 0 64512 i |