diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-04-29 17:49:51 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-05-10 04:26:48 +0000 |
commit | 23d1d4322199bbaae52c52aa0db8db9b000944fe (patch) | |
tree | 64ad12096d8bfcdd2bce990f02e1f42f542f11bc /server/peer.go | |
parent | 7cbb6bbd32ad37ceae89c23bc79ff9cf5fe6a01d (diff) |
api/gobgp: show multiprotocol capabilities in detail
/home/vagrant% gobgp -u 192.168.10.4 neighbor 192.168.10.2
BGP neighbor is 192.168.10.2, remote AS 65001
BGP version 4, remote router ID 192.168.10.2
BGP state = BGP_FSM_ESTABLISHED, up for 00:12:57
BGP OutQ = 0, Flops = 0
Neighbor capabilities:
MULTIPROTOCOL(IP,UNICAST): advertised
MULTIPROTOCOL(L2VPN,EVPN): advertised
MULTIPROTOCOL(IP,ENCAP): advertised
MULTIPROTOCOL(IP,ROUTE_TARGET_CONSTRTAINS): received
ROUTE_REFRESH: advertised
FOUR_OCTET_AS_NUMBER: advertised and received
Message statistics:
Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 0 0
Keepalives: 26 26
Route Refesh: 0 0
Discarded: 0 0
Total: 27 27
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/server/peer.go b/server/peer.go index 604be36b..ccb2538b 100644 --- a/server/peer.go +++ b/server/peer.go @@ -944,17 +944,23 @@ func (peer *Peer) ToApiStruct() *api.Peer { f := peer.fsm c := f.peerConfig - capList := make([]int32, 0, len(peer.capMap)) - for k, _ := range peer.capMap { - capList = append(capList, int32(k)) + remoteCap := make([]*api.Capability, 0, len(peer.capMap)) + for _, c := range peer.capMap { + remoteCap = append(remoteCap, c.ToApiStruct()) + } + + caps := capabilitiesFromConfig(&peer.globalConfig, &peer.peerConfig) + localCap := make([]*api.Capability, 0, len(caps)) + for _, c := range caps { + localCap = append(localCap, c.ToApiStruct()) } conf := &api.PeerConf{ RemoteIp: c.NeighborAddress.String(), Id: peer.peerInfo.ID.To4().String(), RemoteAs: c.PeerAs, - RemoteCap: capList, - LocalCap: []int32{int32(bgp.BGP_CAP_MULTIPROTOCOL), int32(bgp.BGP_CAP_ROUTE_REFRESH), int32(bgp.BGP_CAP_FOUR_OCTET_AS_NUMBER)}, + RemoteCap: remoteCap, + LocalCap: localCap, KeepaliveInterval: uint32(peer.fsm.peerConfig.Timers.KeepaliveInterval), Holdtime: uint32(peer.fsm.peerConfig.Timers.HoldTime), } |