Skip to content

Commit

Permalink
table: remove unused id in AdjRib strcture
Browse files Browse the repository at this point in the history
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
  • Loading branch information
fujita committed May 28, 2018
1 parent aef984c commit da488be
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 1 addition & 3 deletions table/adj.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
2 changes: 1 addition & 1 deletion table/table_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit da488be

Please sign in to comment.