table: remove unused id in AdjRib strcture

Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
FUJITA Tomonori
2018-05-28 22:28:12 +09:00
parent aef984c85c
commit da488beb00
4 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ func NewPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, p
peer.tableId = table.GLOBAL_RIB_NAME
}
rfs, _ := config.AfiSafis(conf.AfiSafis).ToRfList()
peer.adjRibIn = table.NewAdjRib(peer.ID(), rfs)
peer.adjRibIn = table.NewAdjRib(rfs)
return peer
}
+2 -2
View File
@@ -1938,7 +1938,7 @@ func (s *BgpServer) GetAdjRib(addr string, family bgp.RouteFamily, in bool, pref
if in {
adjRib = peer.adjRibIn
} else {
adjRib = table.NewAdjRib(id, peer.configuredRFlist())
adjRib = table.NewAdjRib(peer.configuredRFlist())
accepted, _ := s.getBestFromLocal(peer, peer.configuredRFlist())
adjRib.Update(accepted)
}
@@ -1983,7 +1983,7 @@ func (s *BgpServer) GetAdjRibInfo(addr string, family bgp.RouteFamily, in bool)
if in {
adjRib = peer.adjRibIn
} else {
adjRib = table.NewAdjRib(peer.ID(), peer.configuredRFlist())
adjRib = table.NewAdjRib(peer.configuredRFlist())
accepted, _ := s.getBestFromLocal(peer, peer.configuredRFlist())
adjRib.Update(accepted)
}
+1 -3
View File
@@ -22,18 +22,16 @@ import (
)
type AdjRib struct {
id string
accepted map[bgp.RouteFamily]int
table map[bgp.RouteFamily]map[string]*Path
}
func NewAdjRib(id string, rfList []bgp.RouteFamily) *AdjRib {
func NewAdjRib(rfList []bgp.RouteFamily) *AdjRib {
table := make(map[bgp.RouteFamily]map[string]*Path)
for _, rf := range rfList {
table[rf] = make(map[string]*Path)
}
return &AdjRib{
id: id,
table: table,
accepted: make(map[bgp.RouteFamily]int),
}
+1 -1
View File
@@ -2129,7 +2129,7 @@ func TestProcessBGPUpdate_Timestamp(t *testing.T) {
nlri := []*bgp.IPAddrPrefix{bgp.NewIPAddrPrefix(24, "10.10.10.0")}
adjRib := NewAdjRib("test", []bgp.RouteFamily{bgp.RF_IPv4_UC, bgp.RF_IPv6_UC})
adjRib := NewAdjRib([]bgp.RouteFamily{bgp.RF_IPv4_UC, bgp.RF_IPv6_UC})
m1 := bgp.NewBGPUpdateMessage(nil, pathAttributes, nlri)
peer := peerR1()
pList1 := ProcessMessage(m1, peer, time.Now())