summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/sources/grpc-client.md6
-rw-r--r--gobgp/cmd/root.go14
-rw-r--r--gobgpd/main.go3
-rw-r--r--server/grpc_server.go2
-rw-r--r--tools/grpc/cpp/gobgp_api_client.cc2
-rw-r--r--tools/grpc/nodejs/get_neighbors.js2
-rw-r--r--tools/grpc/python/get_neighbor.py2
-rw-r--r--tools/grpc/ruby/get_neighbors.rb2
8 files changed, 16 insertions, 17 deletions
diff --git a/docs/sources/grpc-client.md b/docs/sources/grpc-client.md
index 33f7a98c..7740eede 100644
--- a/docs/sources/grpc-client.md
+++ b/docs/sources/grpc-client.md
@@ -90,7 +90,7 @@ _TIMEOUT_SECONDS = 10
def run(gobgpd_addr, neighbor_addr):
- channel = implementations.insecure_channel(gobgpd_addr, 8080)
+ channel = implementations.insecure_channel(gobgpd_addr, 50051)
with gobgp_pb2.beta_create_GobgpApi_stub(channel) as stub:
peer = stub.GetNeighbor(gobgp_pb2.Arguments(rf=4, name=neighbor_addr), _TIMEOUT_SECONDS)
print("BGP neighbor is %s, remote AS %d" % (peer.conf.neighbor_address, peer.conf.peer_as))
@@ -185,7 +185,7 @@ require 'gobgp_services'
host = 'localhost'
host = ARGV[0] if ARGV.length > 0
-stub = Gobgpapi::GobgpApi::Stub.new("#{host}:8080")
+stub = Gobgpapi::GobgpApi::Stub.new("#{host}:50051")
arg = Gobgpapi::Arguments.new()
stub.get_neighbors(arg).each do |n|
puts "BGP neighbor is #{n.conf.neighbor_address}, remote AS #{n.conf.peer_as}"
@@ -339,7 +339,7 @@ Here is an example to show neighbor information.
```javascript
var grpc = require('grpc');
var api = grpc.load('gobgp.proto').gobgpapi;
-var stub = new api.GobgpApi('localhost:8080', grpc.Credentials.createInsecure());
+var stub = new api.GobgpApi('localhost:50051', grpc.Credentials.createInsecure());
var call = stub.getNeighbors({});
call.on('data', function(neighbor) {
diff --git a/gobgp/cmd/root.go b/gobgp/cmd/root.go
index afd03bce..48a87149 100644
--- a/gobgp/cmd/root.go
+++ b/gobgp/cmd/root.go
@@ -21,12 +21,12 @@ import (
)
var globalOpts struct {
- Host string `short:"u" long:"url" description:"specifying an url" default:"127.0.0.1"`
- Port int `short:"p" long:"port" description:"specifying a port" default:"8080"`
- Debug bool `short:"d" long:"debug" description:"use debug"`
- Quiet bool `short:"q" long:"quiet" description:"use quiet"`
- Json bool `short:"j" long:"json" description:"use json format to output format"`
- GenCmpl bool `short:"c" long:"genbashcmpl" description:"use json format to output format"`
+ Host string
+ Port int
+ Debug bool
+ Quiet bool
+ Json bool
+ GenCmpl bool
BashCmplFile string
}
@@ -49,7 +49,7 @@ func NewRootCmd() *cobra.Command {
}
rootCmd.PersistentFlags().StringVarP(&globalOpts.Host, "host", "u", "127.0.0.1", "host")
- rootCmd.PersistentFlags().IntVarP(&globalOpts.Port, "port", "p", 8080, "port")
+ rootCmd.PersistentFlags().IntVarP(&globalOpts.Port, "port", "p", 50051, "port")
rootCmd.PersistentFlags().BoolVarP(&globalOpts.Json, "json", "j", false, "use json format to output format")
rootCmd.PersistentFlags().BoolVarP(&globalOpts.Debug, "debug", "d", false, "use debug")
rootCmd.PersistentFlags().BoolVarP(&globalOpts.Quiet, "quiet", "q", false, "use quiet")
diff --git a/gobgpd/main.go b/gobgpd/main.go
index f8632771..50c12a96 100644
--- a/gobgpd/main.go
+++ b/gobgpd/main.go
@@ -46,6 +46,7 @@ func main() {
DisableStdlog bool `long:"disable-stdlog" description:"disable standard logging"`
CPUs int `long:"cpus" description:"specify the number of CPUs to be used"`
Ops bool `long:"openswitch" description:"openswitch mode"`
+ GrpcPort int `long:"grpc-port" description:"grpc port" default:"50051"`
}
_, err := flags.Parse(&opts)
if err != nil {
@@ -166,7 +167,7 @@ func main() {
go bgpServer.Serve()
// start grpc Server
- grpcServer := server.NewGrpcServer(server.GRPC_PORT, bgpServer.GrpcReqCh)
+ grpcServer := server.NewGrpcServer(opts.GrpcPort, bgpServer.GrpcReqCh)
go grpcServer.Serve()
var bgpConfig *config.Bgp = nil
diff --git a/server/grpc_server.go b/server/grpc_server.go
index 85652c75..924566ca 100644
--- a/server/grpc_server.go
+++ b/server/grpc_server.go
@@ -66,8 +66,6 @@ const (
REQ_MOD_POLICY_ASSIGNMENT
)
-const GRPC_PORT = 8080
-
type Server struct {
grpcServer *grpc.Server
bgpServerCh chan *GrpcRequest
diff --git a/tools/grpc/cpp/gobgp_api_client.cc b/tools/grpc/cpp/gobgp_api_client.cc
index 2d0b0960..4780ded7 100644
--- a/tools/grpc/cpp/gobgp_api_client.cc
+++ b/tools/grpc/cpp/gobgp_api_client.cc
@@ -245,7 +245,7 @@ class GrpcClient {
};
int main(int argc, char** argv) {
- GrpcClient gobgp_client(grpc::CreateChannel("localhost:8080", grpc::InsecureChannelCredentials()));
+ GrpcClient gobgp_client(grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials()));
std::string reply = gobgp_client.GetNeighbor("213.133.111.200");
std::cout << "Neighbor information: " << reply << std::endl;
diff --git a/tools/grpc/nodejs/get_neighbors.js b/tools/grpc/nodejs/get_neighbors.js
index c1ec763b..ba2296fa 100644
--- a/tools/grpc/nodejs/get_neighbors.js
+++ b/tools/grpc/nodejs/get_neighbors.js
@@ -1,6 +1,6 @@
var grpc = require('grpc');
var api = grpc.load('gobgp.proto').gobgpapi;
-var stub = new api.GobgpApi('localhost:8080', grpc.Credentials.createInsecure());
+var stub = new api.GobgpApi('localhost:50051', grpc.Credentials.createInsecure());
var call = stub.getNeighbors({});
call.on('data', function(neighbor) {
diff --git a/tools/grpc/python/get_neighbor.py b/tools/grpc/python/get_neighbor.py
index 867f1124..f49a61bf 100644
--- a/tools/grpc/python/get_neighbor.py
+++ b/tools/grpc/python/get_neighbor.py
@@ -7,7 +7,7 @@ _TIMEOUT_SECONDS = 10
def run(gobgpd_addr, neighbor_addr):
- channel = implementations.insecure_channel(gobgpd_addr, 8080)
+ channel = implementations.insecure_channel(gobgpd_addr, 50051)
with gobgp_pb2.beta_create_GobgpApi_stub(channel) as stub:
peer = stub.GetNeighbor(gobgp_pb2.Arguments(rf=4, name=neighbor_addr), _TIMEOUT_SECONDS)
print("BGP neighbor is %s, remote AS %d" % (peer.conf.neighbor_address, peer.conf.peer_as))
diff --git a/tools/grpc/ruby/get_neighbors.rb b/tools/grpc/ruby/get_neighbors.rb
index 83ed9155..e47b7913 100644
--- a/tools/grpc/ruby/get_neighbors.rb
+++ b/tools/grpc/ruby/get_neighbors.rb
@@ -4,7 +4,7 @@ require 'gobgp_services'
host = 'localhost'
host = ARGV[0] if ARGV.length > 0
-stub = Gobgpapi::GobgpApi::Stub.new("#{host}:8080")
+stub = Gobgpapi::GobgpApi::Stub.new("#{host}:50051")
arg = Gobgpapi::Arguments.new()
stub.get_neighbors(arg).each do |n|
puts "BGP neighbor is #{n.conf.neighbor_address}, remote AS #{n.conf.peer_as}"