summaryrefslogtreecommitdiffhomepage
path: root/tools/grpc
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2017-06-29 16:20:04 +0900
committerSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2017-06-30 13:36:24 +0900
commit1af73d413afd1956b1922fd8b637bb6341a1e467 (patch)
tree86e4fcc5646971a63be0cfa2fcaaf9f7c268a934 /tools/grpc
parent609e3171dfc85b85dbaa7ca641600f3803a53692 (diff)
grpc: Update Java sample client for GoBGP v1.20 gRPC API
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'tools/grpc')
-rw-r--r--tools/grpc/java/src/gobgp/example/GobgpSampleClient.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/grpc/java/src/gobgp/example/GobgpSampleClient.java b/tools/grpc/java/src/gobgp/example/GobgpSampleClient.java
index eb991f88..287b46b6 100644
--- a/tools/grpc/java/src/gobgp/example/GobgpSampleClient.java
+++ b/tools/grpc/java/src/gobgp/example/GobgpSampleClient.java
@@ -5,7 +5,7 @@ import gobgpapi.GobgpApiGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
-import java.util.Iterator;
+import java.util.List;
public class GobgpSampleClient {
@@ -18,13 +18,12 @@ public class GobgpSampleClient {
public void getNeighbors(){
- Gobgp.Arguments request = Gobgp.Arguments.newBuilder().build();
+ Gobgp.GetNeighborRequest request = Gobgp.GetNeighborRequest.newBuilder().build();
- for(Iterator<Gobgp.Peer> iterator = this.blockingStub.getNeighbors(request); iterator.hasNext(); ) {
- Gobgp.Peer p = iterator.next();
- Gobgp.PeerConf conf = p.getConf();
- Gobgp.PeerState state = p.getInfo();
- Gobgp.Timers timer = p.getTimers();
+ 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());
@@ -38,7 +37,7 @@ public class GobgpSampleClient {
}
public static void main(String args[]){
- new GobgpSampleClient(args[0], 8080).getNeighbors();
+ new GobgpSampleClient(args[0], 50051).getNeighbors();
}
}