diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-27 18:44:21 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-27 18:47:01 +0900 |
commit | 8ef1f381b07d04a38597f1fd5587cc1d377433cf (patch) | |
tree | 7a44788f43ddb0d552ed8a4bdb5d8b7c511bffc5 /tools/grpc | |
parent | 7b1db76d135aadff9b8710dc52f953c30f2857b6 (diff) |
doc/tools: add doc explains how to interact with gobgp using ruby
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'tools/grpc')
-rw-r--r-- | tools/grpc/ruby/get_neighbors.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/grpc/ruby/get_neighbors.rb b/tools/grpc/ruby/get_neighbors.rb new file mode 100644 index 00000000..d833802c --- /dev/null +++ b/tools/grpc/ruby/get_neighbors.rb @@ -0,0 +1,16 @@ +require 'gobgp' +require 'gobgp_services' + +host = 'localhost' +host = ARGV[0] if ARGV.length > 0 + +stub = Api::Grpc::Stub.new("#{host}:8080") +arg = Api::Arguments.new() +stub.get_neighbors(arg).each do |n| + puts "BGP neighbor is #{n.conf.remote_ip}, remote AS #{n.conf.remote_as}" + puts "\tBGP version 4, remote route ID #{n.conf.id}" + puts "\tBGP state = #{n.info.bgp_state}, up for #{n.info.uptime}" + puts "\tBGP OutQ = #{n.info.out_q}, Flops = #{n.info.flops}" + puts "\tHold time is #{n.info.negotiated_holdtime}, keepalive interval is #{n.info.keepalive_interval} seconds" + puts "\tConfigured hold time is #{n.conf.holdtime}" +end |