diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-02 16:01:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-12-02 16:02:21 +0900 |
commit | a36c84c510bd7cde344e6cbabd043153e4a0196c (patch) | |
tree | c9a529ea365def97af86cd5aba6d315aed6671ab /table/table_manager_test.go | |
parent | b83d3cc802cdaa69b8c77b6db54aa8fe4e472ba7 (diff) |
make adj-rib implementation more clear and efficient
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/table_manager_test.go')
-rw-r--r-- | table/table_manager_test.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/table/table_manager_test.go b/table/table_manager_test.go index 8a4f67f9..f0e465b2 100644 --- a/table/table_manager_test.go +++ b/table/table_manager_test.go @@ -26,6 +26,13 @@ import ( "time" ) +// process BGPUpdate message +// this function processes only BGPUpdate +func (manager *TableManager) ProcessUpdate(fromPeer *PeerInfo, message *bgp.BGPMessage) ([]*Path, error) { + paths := ProcessMessage(message, fromPeer, time.Now()) + return manager.ProcessPaths(paths) +} + func getLogger(lv log.Level) *log.Logger { var l *log.Logger = &log.Logger{ Out: os.Stderr, @@ -2147,15 +2154,15 @@ func TestProcessBGPUpdate_Timestamp(t *testing.T) { pList1 := ProcessMessage(m1, peer, time.Now()) path1 := pList1[0] t1 := path1.timestamp - adjRib.UpdateIn(pList1) + adjRib.Update(pList1) m2 := bgp.NewBGPUpdateMessage(nil, pathAttributes, nlri) pList2 := ProcessMessage(m2, peer, time.Now()) //path2 := pList2[0].(*IPv4Path) //t2 = path2.timestamp - adjRib.UpdateIn(pList2) + adjRib.Update(pList2) - inList := adjRib.GetInPathList([]bgp.RouteFamily{bgp.RF_IPv4_UC}) + inList := adjRib.PathList([]bgp.RouteFamily{bgp.RF_IPv4_UC}, false) assert.Equal(t, len(inList), 1) assert.Equal(t, inList[0].GetTimestamp(), t1) @@ -2170,9 +2177,9 @@ func TestProcessBGPUpdate_Timestamp(t *testing.T) { m3 := bgp.NewBGPUpdateMessage(nil, pathAttributes2, nlri) pList3 := ProcessMessage(m3, peer, time.Now()) t3 := pList3[0].GetTimestamp() - adjRib.UpdateIn(pList3) + adjRib.Update(pList3) - inList = adjRib.GetInPathList([]bgp.RouteFamily{bgp.RF_IPv4_UC}) + inList = adjRib.PathList([]bgp.RouteFamily{bgp.RF_IPv4_UC}, false) assert.Equal(t, len(inList), 1) assert.Equal(t, inList[0].GetTimestamp(), t3) } |