Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
70893cad
Commit
70893cad
authored
6 years ago
by
Daniel Czerwonk
Browse files
Options
Downloads
Patches
Plain Diff
added integration test for ipv6
parent
9594221b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
protocols/bgp/server/fsm_test.go
+117
-2
117 additions, 2 deletions
protocols/bgp/server/fsm_test.go
with
117 additions
and
2 deletions
protocols/bgp/server/fsm_test.go
+
117
−
2
View file @
70893cad
...
...
@@ -13,8 +13,8 @@ import (
bnet
"github.com/bio-routing/bio-rd/net"
)
// TestFSM
100
Updates emulates receiving
100
BGP updates and withdraws. Checks route counts.
func
TestFSM100Updates
(
t
*
testing
.
T
)
{
// TestFSM
255
Updates
IPv4
emulates receiving
255
BGP updates and withdraws. Checks route counts.
func
TestFSM100Updates
IPv4
(
t
*
testing
.
T
)
{
fsmA
:=
newFSM2
(
&
peer
{
addr
:
bnet
.
IPv4FromOctets
(
169
,
254
,
100
,
100
),
routerID
:
bnet
.
IPv4FromOctets
(
1
,
1
,
1
,
1
)
.
ToUint32
(),
...
...
@@ -127,6 +127,121 @@ func TestFSM100Updates(t *testing.T) {
wg
.
Wait
()
}
// TestFSM255UpdatesIPv6 emulates receiving 255 BGP updates and withdraws. Checks route counts.
func
TestFSM255UpdatesIPv6
(
t
*
testing
.
T
)
{
fsmA
:=
newFSM2
(
&
peer
{
addr
:
bnet
.
IPv6FromBlocks
(
0x2001
,
0x678
,
0x1e0
,
0xffff
,
0
,
0
,
0
,
1
),
routerID
:
bnet
.
IPv4FromOctets
(
1
,
1
,
1
,
1
)
.
ToUint32
(),
ipv6
:
&
familyParameters
{
rib
:
locRIB
.
New
(),
importFilter
:
filter
.
NewAcceptAllFilter
(),
exportFilter
:
filter
.
NewAcceptAllFilter
(),
},
})
fsmA
.
options
.
SupportsMultiProtocol
=
true
fsmA
.
holdTimer
=
time
.
NewTimer
(
time
.
Second
*
90
)
fsmA
.
keepaliveTimer
=
time
.
NewTimer
(
time
.
Second
*
30
)
fsmA
.
connectRetryTimer
=
time
.
NewTimer
(
time
.
Second
*
120
)
fsmA
.
state
=
newEstablishedState
(
fsmA
)
var
wg
sync
.
WaitGroup
wg
.
Add
(
1
)
go
func
()
{
fsmA
.
con
=
fakeConn
{}
for
{
nextState
,
reason
:=
fsmA
.
state
.
run
()
fsmA
.
state
=
nextState
stateName
:=
stateName
(
nextState
)
switch
stateName
{
case
"idle"
:
wg
.
Done
()
return
case
"cease"
:
t
.
Errorf
(
"Unexpected cease state: %s"
,
reason
)
wg
.
Done
()
return
case
"established"
:
continue
default
:
t
.
Errorf
(
"Unexpected new state: %s"
,
reason
)
wg
.
Done
()
return
}
}
}()
for
i
:=
uint8
(
0
);
i
<
255
;
i
++
{
update
:=
[]
byte
{
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0
,
76
,
2
,
0
,
0
,
0
,
53
,
64
,
// Attribute flags
1
,
// Attribute Type code (ORIGIN)
1
,
// Length
2
,
// INCOMPLETE
64
,
// Attribute flags
2
,
// Attribute Type code (AS Path)
12
,
// Length
2
,
// Type = AS_SEQUENCE
2
,
// Path Segement Length
59
,
65
,
// AS15169
12
,
248
,
// AS3320
1
,
// Type = AS_SET
2
,
// Path Segement Length
59
,
65
,
// AS15169
12
,
248
,
// AS3320
0x90
,
// Attribute flags
0x0e
,
// MP_REACH_NLRI
0x00
,
30
,
// Length
0x00
,
0x02
,
// AFI
0x01
,
// SAFI
0x10
,
0x20
,
0x01
,
0x06
,
0x78
,
0x01
,
0xe0
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
// Nexthop
0x00
,
64
,
0x20
,
0x01
,
0x06
,
0x78
,
0x01
,
0xe0
,
0x0
,
i
,
}
fsmA
.
msgRecvCh
<-
update
}
time
.
Sleep
(
time
.
Second
)
ribRouteCount
:=
fsmA
.
ipv6Unicast
.
rib
.
RouteCount
()
if
ribRouteCount
!=
255
{
t
.
Errorf
(
"Unexpected route count in LocRIB: %d"
,
ribRouteCount
)
}
for
i
:=
uint8
(
0
);
i
<
255
;
i
++
{
update
:=
[]
byte
{
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0x00
,
35
,
// Length
0x02
,
// UPDATE
0x00
,
0x00
,
// withdrawn routes
0x00
,
0x0c
,
0x90
,
0x0f
,
0x00
,
12
,
// Length
0x00
,
0x02
,
// AFI
0x01
,
// SAFI
64
,
0x20
,
0x01
,
0x06
,
0x78
,
0x01
,
0xe0
,
0x0
,
i
,
}
fsmA
.
msgRecvCh
<-
update
ribRouteCount
=
fsmA
.
ipv6Unicast
.
rib
.
RouteCount
()
}
time
.
Sleep
(
time
.
Second
*
1
)
ribRouteCount
=
fsmA
.
ipv6Unicast
.
rib
.
RouteCount
()
if
ribRouteCount
!=
0
{
t
.
Errorf
(
"Unexpected route count in LocRIB: %d"
,
ribRouteCount
)
}
fsmA
.
eventCh
<-
ManualStop
wg
.
Wait
()
}
func
TestOpenMessage
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment