diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2018-12-24 23:20:35 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2018-12-24 23:20:35 +0900 |
commit | 48fa25d06c96262779253b0b051e8d1a34604764 (patch) | |
tree | fabaad0ea3022bc15c526e6757793ce62d2b67b3 /tools | |
parent | bb1bbdd197a971917ae24946a4c4d2da539e5d55 (diff) |
docs: delete outdated java/nodejs/ruby gRPC API examples
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/grpc/java/src/gobgp/example/GobgpSampleClient.java | 44 | ||||
-rw-r--r-- | tools/grpc/nodejs/get_neighbors.js | 24 | ||||
-rw-r--r-- | tools/grpc/ruby/get_neighbors.rb | 15 |
3 files changed, 0 insertions, 83 deletions
diff --git a/tools/grpc/java/src/gobgp/example/GobgpSampleClient.java b/tools/grpc/java/src/gobgp/example/GobgpSampleClient.java deleted file mode 100644 index 287b46b6..00000000 --- a/tools/grpc/java/src/gobgp/example/GobgpSampleClient.java +++ /dev/null @@ -1,44 +0,0 @@ -package gobgp.example; - -import gobgpapi.Gobgp; -import gobgpapi.GobgpApiGrpc; -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; - -import java.util.List; - -public class GobgpSampleClient { - - private final GobgpApiGrpc.GobgpApiBlockingStub blockingStub; - - public GobgpSampleClient(String host, int port) { - ManagedChannel channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext(true).build(); - this.blockingStub = GobgpApiGrpc.newBlockingStub(channel); - } - - public void getNeighbors(){ - - Gobgp.GetNeighborRequest request = Gobgp.GetNeighborRequest.newBuilder().build(); - - for(Gobgp.Peer peer: this.blockingStub.getNeighbor(request).getPeersList()) { - Gobgp.PeerConf conf = peer.getConf(); - Gobgp.PeerState state = peer.getInfo(); - Gobgp.Timers timer = peer.getTimers(); - - System.out.printf("BGP neighbor is %s, remote AS %d\n", conf.getNeighborAddress(), conf.getPeerAs()); - System.out.printf("\tBGP version 4, remote router ID %s\n", conf.getId()); - System.out.printf("\tBGP state = %s, up for %d\n", state.getBgpState(), timer.getState().getUptime()); - System.out.printf("\tBGP OutQ = %d, Flops = %d\n", state.getOutQ(), state.getFlops()); - System.out.printf("\tHold time is %d, keepalive interval is %d seconds\n", - timer.getState().getHoldTime(), timer.getState().getKeepaliveInterval()); - System.out.printf("\tConfigured hold time is %d\n", timer.getConfig().getHoldTime()); - - } - } - - public static void main(String args[]){ - new GobgpSampleClient(args[0], 50051).getNeighbors(); - } - -} - diff --git a/tools/grpc/nodejs/get_neighbors.js b/tools/grpc/nodejs/get_neighbors.js deleted file mode 100644 index 6cc6b082..00000000 --- a/tools/grpc/nodejs/get_neighbors.js +++ /dev/null @@ -1,24 +0,0 @@ -var grpc = require('grpc'); -var api = grpc.load('gobgp.proto').gobgpapi; -var stub = new api.GobgpApi('localhost:50051', grpc.credentials.createInsecure()); - -stub.getNeighbor({}, function(err, neighbor) { - neighbor.peers.forEach(function(peer) { - if(peer.info.bgp_state == 'BGP_FSM_ESTABLISHED') { - var date = new Date(Number(peer.timers.state.uptime)*1000); - var holdtime = peer.timers.state.negotiated_hold_time; - var keepalive = peer.timers.state.keepalive_interval; - } - - console.log('BGP neighbor:', peer.conf.neighbor_address, - ', remote AS:', peer.conf.peer_as); - console.log("\tBGP version 4, remote router ID:", peer.conf.id); - console.log("\tBGP state:", peer.info.bgp_state, - ', uptime:', date); - console.log("\tBGP OutQ:", peer.info.out_q, - ', Flops:', peer.info.flops); - console.log("\tHold time:", holdtime, - ', keepalive interval:', keepalive, 'seconds'); - console.log("\tConfigured hold time:", peer.timers.config.hold_time); - }); -}); diff --git a/tools/grpc/ruby/get_neighbors.rb b/tools/grpc/ruby/get_neighbors.rb deleted file mode 100644 index a451f67f..00000000 --- a/tools/grpc/ruby/get_neighbors.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'gobgp_pb' -require 'gobgp_services_pb' - -host = ARGV[0] - -stub = Gobgpapi::GobgpApi::Stub.new("#{host}:50051", :this_channel_is_insecure) -arg = Gobgpapi::GetNeighborRequest.new() -stub.get_neighbor(arg).peers.each do |n| - puts "BGP neighbor is #{n.conf.neighbor_address}, remote AS #{n.conf.peer_as}" - puts "\tBGP version 4, remote route ID #{n.conf.id}" - puts "\tBGP state = #{n.info.bgp_state}, up for #{n.timers.state.uptime}" - puts "\tBGP OutQ = #{n.info.out_q}, Flops = #{n.info.flops}" - puts "\tHold time is #{n.timers.state.hold_time}, keepalive interval is #{n.timers.state.keepalive_interval} seconds" - puts "\tConfigured hold time is #{n.timers.config.hold_time}" -end |