summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-05-17 15:38:43 +0900
committerIWASE Yusuke <iwase.yusuke0@gmail.com>2017-05-22 13:12:02 +0900
commit76ba8fcbda9480f9356d1733799974771f0280b0 (patch)
treeaf3b5917063491b238cb4b00cea6dc6e185c601a
parentc37b50a024f4b90edf390b3f60d3df0f6c1901e2 (diff)
server/peer: Number of filtered routes to advertise
This patch extend the "AdjTable" container to store the number of the "filtered" routes which should not be advertised to the given neighbor. This routes mean the filterd routes because of RTC, VRFs, policy and other constraints. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r--config/bgp_configs.go5
-rw-r--r--server/peer.go3
-rw-r--r--tools/pyang_plugins/gobgp.yang4
3 files changed, 11 insertions, 1 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index 9deb98dd..45515d00 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -2100,6 +2100,8 @@ func (lhs *Timers) Equal(rhs *Timers) bool {
type AdjTable struct {
// original -> gobgp:ADVERTISED
Advertised uint32 `mapstructure:"advertised" json:"advertised,omitempty"`
+ // original -> gobgp:FILTERED
+ Filtered uint32 `mapstructure:"filtered" json:"filtered,omitempty"`
// original -> gobgp:RECEIVED
Received uint32 `mapstructure:"received" json:"received,omitempty"`
// original -> gobgp:ACCEPTED
@@ -2113,6 +2115,9 @@ func (lhs *AdjTable) Equal(rhs *AdjTable) bool {
if lhs.Advertised != rhs.Advertised {
return false
}
+ if lhs.Filtered != rhs.Filtered {
+ return false
+ }
if lhs.Received != rhs.Received {
return false
}
diff --git a/server/peer.go b/server/peer.go
index 5e04ccf6..6ead5fbe 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -543,8 +543,9 @@ func (peer *Peer) ToConfig(getAdvertised bool) *config.Neighbor {
if peer.fsm.state == bgp.BGP_FSM_ESTABLISHED {
rfList := peer.configuredRFlist()
if getAdvertised {
- pathList, _ := peer.getBestFromLocal(rfList)
+ pathList, filtered := peer.getBestFromLocal(rfList)
conf.State.AdjTable.Advertised = uint32(len(pathList))
+ conf.State.AdjTable.Filtered = uint32(len(filtered))
} else {
conf.State.AdjTable.Advertised = 0
}
diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang
index b9bd5f6c..25299cc2 100644
--- a/tools/pyang_plugins/gobgp.yang
+++ b/tools/pyang_plugins/gobgp.yang
@@ -202,6 +202,10 @@ module gobgp {
type uint32;
}
+ leaf FILTERED {
+ type uint32;
+ }
+
leaf RECEIVED {
type uint32;
}