diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2017-05-05 12:30:32 -0400 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2017-05-10 08:15:00 +0000 |
commit | 9b9a65d410bbf35730f4970932c7688203e096b1 (patch) | |
tree | 5a539d40d6190c20341ae7e5c4827e2c0bd532e2 /table/path_test.go | |
parent | 1f053c25c423c79471fbe1d5fb6c618bb67409df (diff) |
*: support replace-peer-as (aka as-override)
we use the term replace-peer-as instead of as-override
since openconfig is using it.
cli
```
$ gobgp n add <neighbor-addr> as <asn> replace-peer-as
```
config
```
neighbor:
config:
peer-as: <asn>
neighbor-address: <neighbor-addr>
as-path-options:
config:
replace-peer-as: true
```
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/path_test.go')
-rw-r--r-- | table/path_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/table/path_test.go b/table/path_test.go index 29a296ac..ea4e23d5 100644 --- a/table/path_test.go +++ b/table/path_test.go @@ -353,3 +353,17 @@ func TestRemovePrivateAS(t *testing.T) { assert.Equal(t, list[2], uint32(1)) assert.Equal(t, list[3], uint32(2)) } + +func TestReplaceAS(t *testing.T) { + aspathParam := []bgp.AsPathParamInterface{bgp.NewAs4PathParam(2, []uint32{64512, 64513, 1, 2})} + aspath := bgp.NewPathAttributeAsPath(aspathParam) + nlri := bgp.NewIPAddrPrefix(24, "30.30.30.0") + path := NewPath(nil, nlri, false, []bgp.PathAttributeInterface{aspath}, time.Now(), false) + path = path.ReplaceAS(10, 1) + list := path.GetAsList() + assert.Equal(t, len(list), 4) + assert.Equal(t, list[0], uint32(64512)) + assert.Equal(t, list[1], uint32(64513)) + assert.Equal(t, list[2], uint32(10)) + assert.Equal(t, list[3], uint32(2)) +} |