diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 04:24:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 04:24:47 +0900 |
commit | d59f1b147eba8199458df22bba1d2462b65a2308 (patch) | |
tree | 59f5beae035f3424dddf1e993a0458cdcdf47b5f /openswitch/openswitch.go | |
parent | 1f9a5cb7e5e8aa90b94847cf787433053ba8324c (diff) |
remove REQ_GRPC_ADD_NEIGHBOR
replace REQ_GRPC_ADD_NEIGHBOR with REQ_ADD_NEIGHBOR
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'openswitch/openswitch.go')
-rw-r--r-- | openswitch/openswitch.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/openswitch/openswitch.go b/openswitch/openswitch.go index c6ff5e55..f1339123 100644 --- a/openswitch/openswitch.go +++ b/openswitch/openswitch.go @@ -24,6 +24,7 @@ import ( "github.com/osrg/gobgp/server" "github.com/satori/go.uuid" ovsdb "github.com/socketplane/libovsdb" + "golang.org/x/net/context" "net" "reflect" "strconv" @@ -351,14 +352,14 @@ func (m *OpsManager) handleNeighborUpdate(update ovsdb.TableUpdate) []*server.Gr }).Debug("remote-as is not configured yet") continue } - reqs = append(reqs, server.NewGrpcRequest(server.REQ_GRPC_ADD_NEIGHBOR, "", bgp.RouteFamily(0), &api.AddNeighborRequest{ + m.grpcServer.AddNeighbor(context.Background(), &api.AddNeighborRequest{ Peer: &api.Peer{ Conf: &api.PeerConf{ NeighborAddress: addrs[idx].String(), PeerAs: uint32(asn), }, }, - })) + }) } } } @@ -717,6 +718,7 @@ type OpsChs struct { } type OpsManager struct { + grpcServer *server.Server ops *ovsdb.OvsdbClient grpcCh chan *server.GrpcRequest opsCh chan *OpsOperation @@ -726,7 +728,7 @@ type OpsManager struct { cache map[string]map[string]ovsdb.Row } -func NewOpsManager(grpcCh chan *server.GrpcRequest) (*OpsManager, error) { +func NewOpsManager(grpcServer *server.Server, grpcCh chan *server.GrpcRequest) (*OpsManager, error) { ops, err := ovsdb.Connect("", 0) if err != nil { return nil, err @@ -737,6 +739,7 @@ func NewOpsManager(grpcCh chan *server.GrpcRequest) (*OpsManager, error) { ops.Register(n) return &OpsManager{ + grpcServer: grpcServer, ops: ops, grpcCh: grpcCh, opsCh: make(chan *OpsOperation, 1024), |