diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-20 06:09:33 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-20 06:09:33 -0800 |
commit | 90b0bd64e0777f0023976f92d427920f9a6b5b21 (patch) | |
tree | a4104b7393317111787be1bd8af2019c6ba3a4d4 /table/path_test.go | |
parent | 73f09f0ac901cae866a1ecf5c0335ac9e9209145 (diff) |
table: use slice instead of homegrown orderedmap
- 4-bytes AS code needs add/delete a new path attribute at the exact
place.
- we would support actions to modify path attributes
Unliley operations on path attributes would perfomance bottle neck so
this commit changes the code to simply use slice to store path
attributes in a path structure.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/path_test.go')
-rw-r--r-- | table/path_test.go | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/table/path_test.go b/table/path_test.go index cc2ca1a7..3cd32d89 100644 --- a/table/path_test.go +++ b/table/path_test.go @@ -13,16 +13,14 @@ func TestPathNewIPv4(t *testing.T) { peerP := PathCreatePeer() msgP := PathCreateMSG(peerP) pathP := PathCreatePath(msgP) - ipv4p := NewIPv4Path(pathP[0].getSource(), pathP[0].GetNlri(), pathP[0].getSourceVerNum(), pathP[0].getNexthop(), - true, pathP[0].getPathAttributeMap(), pathP[0].getMedSetByTargetNeighbor()) + ipv4p := NewIPv4Path(pathP[0].getSource(), pathP[0].GetNlri(), pathP[0].getSourceVerNum(), true, pathP[0].GetPathAttrs(), pathP[0].getMedSetByTargetNeighbor()) assert.NotNil(t, ipv4p) } func TestPathNewIPv6(t *testing.T) { peerP := PathCreatePeer() msgP := PathCreateMSG(peerP) pathP := PathCreatePath(msgP) - ipv6p := NewIPv6Path(pathP[0].getSource(), pathP[0].GetNlri(), pathP[0].getSourceVerNum(), pathP[0].getNexthop(), - true, pathP[0].getPathAttributeMap(), pathP[0].getMedSetByTargetNeighbor()) + ipv6p := NewIPv6Path(pathP[0].getSource(), pathP[0].GetNlri(), pathP[0].getSourceVerNum(), true, pathP[0].GetPathAttrs(), pathP[0].getMedSetByTargetNeighbor()) assert.NotNil(t, ipv6p) } @@ -178,19 +176,11 @@ func TestPathGetAttribute(t *testing.T) { msgP := PathCreateMSG(peerP) pathP := PathCreatePath(msgP) nh := "192.168.50.1" - pa := pathP[0].getPathAttribute(bgp.BGP_ATTR_TYPE_NEXT_HOP) + _, pa := pathP[0].GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP) r_nh := pa.(*bgp.PathAttributeNextHop).Value.String() assert.Equal(t, r_nh, nh) } -func TestPathClone(t *testing.T) { - peerP := PathCreatePeer() - msgP := PathCreateMSG(peerP) - pathP := PathCreatePath(msgP) - clPath := pathP[0].clone(false) - assert.Equal(t, clPath, pathP[0]) -} - func PathCreatePeer() []*PeerInfo { peerP1 := &PeerInfo{VersionNum: 4, AS: 65000} peerP2 := &PeerInfo{VersionNum: 4, AS: 65001} |