diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-24 21:39:27 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-24 21:51:54 +0900 |
commit | bb881467bcbff28a56ff0f3eb6e16d261b31d4c3 (patch) | |
tree | b4ae401e0ad295a814c16bdc832bbc2f3c463779 /table/path_test.go | |
parent | 1aa345882e9feb46c0b7c2fa8c658794242e7418 (diff) |
policy: modify path.GetAsSeqList() to insert 0 for non-seq-as-elems
GetAsSeqList() is used for AsPathSet matching and AsPathPrepend action.
Just eliminating non-seq-as-elems from what GetAsSeqList() returns cause
wrong results for these two match/action.
e.g path A's as-path: {100, 200} 300
currently, action 'as-path-prepend left-most repeat 2' will alter
as-path to 300 300 {100, 200} 300, which is not expected behavior.
To fix this, insert 0 for non-seq-as-elems.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/path_test.go')
-rw-r--r-- | table/path_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/table/path_test.go b/table/path_test.go index 1f2311f5..98e59092 100644 --- a/table/path_test.go +++ b/table/path_test.go @@ -146,7 +146,7 @@ func TestPathPrependAsnToExistingSeqAttr(t *testing.T) { p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, false, time.Now(), false) p.PrependAsn(65000, 1) - assert.Equal([]uint32{65000, 65001, 65002, 65003, 65004, 65005}, p.GetAsSeqList()) + assert.Equal([]uint32{65000, 65001, 65002, 65003, 65004, 65005, 0, 0, 0}, p.GetAsSeqList()) fmt.Printf("asns: %v", p.GetAsSeqList()) } @@ -197,7 +197,7 @@ func TestPathPrependAsnToNewAsPathSeq(t *testing.T) { asn := uint32(65000) p.PrependAsn(asn, 1) - assert.Equal([]uint32{asn}, p.GetAsSeqList()) + assert.Equal([]uint32{asn, 0, 0, 0}, p.GetAsSeqList()) fmt.Printf("asns: %v", p.GetAsSeqList()) } @@ -227,7 +227,7 @@ func TestPathPrependAsnToEmptyAsPathAttr(t *testing.T) { asn := uint32(65000) p.PrependAsn(asn, 1) - assert.Equal([]uint32{asn}, p.GetAsSeqList()) + assert.Equal([]uint32{asn, 0, 0, 0}, p.GetAsSeqList()) fmt.Printf("asns: %v", p.GetAsSeqList()) } @@ -266,7 +266,7 @@ func TestPathPrependAsnToFullPathAttr(t *testing.T) { expected = append(expected, uint32(v)) } p.PrependAsn(65000, 2) - assert.Equal(expected, p.GetAsSeqList()) + assert.Equal(append(expected, []uint32{0, 0, 0}...), p.GetAsSeqList()) fmt.Printf("asns: %v", p.GetAsSeqList()) } |