diff options
-rwxr-xr-x | cli/gobgpcli | 16 | ||||
-rw-r--r-- | server/peer.go | 14 |
2 files changed, 19 insertions, 11 deletions
diff --git a/cli/gobgpcli b/cli/gobgpcli index 325c268d..f1209bb3 100755 --- a/cli/gobgpcli +++ b/cli/gobgpcli @@ -70,12 +70,20 @@ class Show(object): print(" BGP version 4, remote router ID {:s}".format(n["conf"]["id"])) print(" BGP state = {:s}, up for {:s}".format(n["info"]["bgp_state"], str(timedelta(seconds=n["info"]["uptime"])))) print(" Neighbor capabilities:") - for i in n["conf"]["CapList"]: + allcap = set(n["conf"]["RemoteCap"]) | set(n["conf"]["LocalCap"]) + for i in sorted(allcap): if i in capdict: - i = capdict[i] + k = capdict[i] else: - i = "UNKNOWN (" + str(i) + ")" - print(" {:s}".format(i)) + k = "UNKNOWN (" + str(i) + ")" + r = "" + if i in n["conf"]["LocalCap"]: + r += "advertised" + if i in n["conf"]["RemoteCap"]: + if len(r) != 0: + r += " and " + r += "received" + print(" {:s}: {:s}".format(k, r)) print(" Message statistics:") print(" Sent Rcvd") print(" Opens: {:>10d} {:>10d}".format(n["info"]["open_message_out"], n["info"]["open_message_in"])) diff --git a/server/peer.go b/server/peer.go index 96f6dfb3..0bc993e9 100644 --- a/server/peer.go +++ b/server/peer.go @@ -304,14 +304,14 @@ func (peer *Peer) MarshalJSON() ([]byte, error) { RemoteAS uint32 `json:"remote_as"` CapRefresh bool `json:"cap_refresh"` CapEnhancedRefresh bool `json:"cap_enhanced_refresh"` - CapList []int + RemoteCap []int + LocalCap []int }{ - RemoteIP: c.NeighborAddress.String(), - Id: peer.peerInfo.ID.To4().String(), - RemoteAS: c.PeerAs, - CapList: capList, - CapRefresh: false, - CapEnhancedRefresh: false, + RemoteIP: c.NeighborAddress.String(), + Id: peer.peerInfo.ID.To4().String(), + RemoteAS: c.PeerAs, + RemoteCap: capList, + LocalCap: []int{int(bgp.BGP_CAP_MULTIPROTOCOL), int(bgp.BGP_CAP_ROUTE_REFRESH), int(bgp.BGP_CAP_FOUR_OCTET_AS_NUMBER)}, } s := c.BgpNeighborCommonState |