summaryrefslogtreecommitdiffhomepage
path: root/server/fsm_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/fsm_test.go')
-rw-r--r--server/fsm_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/fsm_test.go b/server/fsm_test.go
index 0fb67f98..aea6700b 100644
--- a/server/fsm_test.go
+++ b/server/fsm_test.go
@@ -287,6 +287,15 @@ func TestFSMHandlerEstablished_HoldtimeZero(t *testing.T) {
assert.Equal(0, len(m.sendBuf))
}
+func TestCheckOwnASLoop(t *testing.T) {
+ assert := assert.New(t)
+ aspathParam := []bgp.AsPathParamInterface{bgp.NewAs4PathParam(2, []uint32{65100})}
+ aspath := bgp.NewPathAttributeAsPath(aspathParam)
+ assert.False(hasOwnASLoop(65100, 10, aspath))
+ assert.True(hasOwnASLoop(65100, 0, aspath))
+ assert.False(hasOwnASLoop(65200, 0, aspath))
+}
+
func makePeerAndHandler() (*Peer, *FSMHandler) {
p := &Peer{
fsm: NewFSM(&config.Global{}, &config.Neighbor{}, table.NewRoutingPolicy()),