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
f88c87e5
Commit
f88c87e5
authored
6 years ago
by
Daniel Czerwonk
Browse files
Options
Downloads
Patches
Plain Diff
static uses our IP type now
parent
6c593157
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
route/route_test.go
+24
-24
24 additions, 24 deletions
route/route_test.go
route/static.go
+3
-1
3 additions, 1 deletion
route/static.go
routingtable/locRIB/loc_rib_test.go
+5
-4
5 additions, 4 deletions
routingtable/locRIB/loc_rib_test.go
with
32 additions
and
29 deletions
route/route_test.go
+
24
−
24
View file @
f88c87e5
...
...
@@ -5,25 +5,25 @@ import (
"github.com/stretchr/testify/assert"
"github.com/bio-routing/bio-rd/net"
bnet
"github.com/bio-routing/bio-rd/net"
)
func
TestNewRoute
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
pfx
net
.
Prefix
pfx
b
net
.
Prefix
path
*
Path
expected
*
Route
}{
{
name
:
"BGP Path"
,
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
path
:
&
Path
{
Type
:
BGPPathType
,
BGPPath
:
&
BGPPath
{},
},
expected
:
&
Route
{
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
paths
:
[]
*
Path
{
&
Path
{
Type
:
BGPPathType
,
...
...
@@ -34,9 +34,9 @@ func TestNewRoute(t *testing.T) {
},
{
name
:
"Empty Path"
,
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
expected
:
&
Route
{
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
paths
:
[]
*
Path
{},
},
},
...
...
@@ -52,14 +52,14 @@ func TestPrefix(t *testing.T) {
tests
:=
[]
struct
{
name
string
route
*
Route
expected
net
.
Prefix
expected
b
net
.
Prefix
}{
{
name
:
"Prefix"
,
route
:
&
Route
{
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
},
expected
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
expected
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
},
}
...
...
@@ -78,7 +78,7 @@ func TestAddr(t *testing.T) {
{
name
:
"Prefix"
,
route
:
&
Route
{
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
},
expected
:
0xa000000
,
},
...
...
@@ -99,7 +99,7 @@ func TestPfxlen(t *testing.T) {
{
name
:
"Prefix"
,
route
:
&
Route
{
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
},
expected
:
8
,
},
...
...
@@ -120,7 +120,7 @@ func TestAddPath(t *testing.T) {
}{
{
name
:
"Regular BGP path"
,
route
:
NewRoute
(
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
&
Path
{
route
:
NewRoute
(
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
&
Path
{
Type
:
BGPPathType
,
BGPPath
:
&
BGPPath
{},
}),
...
...
@@ -129,7 +129,7 @@ func TestAddPath(t *testing.T) {
BGPPath
:
&
BGPPath
{},
},
expected
:
&
Route
{
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
paths
:
[]
*
Path
{
{
Type
:
BGPPathType
,
...
...
@@ -144,13 +144,13 @@ func TestAddPath(t *testing.T) {
},
{
name
:
"Nil path"
,
route
:
NewRoute
(
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
&
Path
{
route
:
NewRoute
(
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
&
Path
{
Type
:
BGPPathType
,
BGPPath
:
&
BGPPath
{},
}),
newPath
:
nil
,
expected
:
&
Route
{
pfx
:
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
pfx
:
b
net
.
NewPfx
(
strAddr
(
"10.0.0.0"
),
8
),
paths
:
[]
*
Path
{
{
Type
:
BGPPathType
,
...
...
@@ -271,7 +271,7 @@ func TestCopy(t *testing.T) {
{
name
:
""
,
route
:
&
Route
{
pfx
:
net
.
NewPfx
(
1000
,
8
),
pfx
:
b
net
.
NewPfx
(
1000
,
8
),
ecmpPaths
:
2
,
paths
:
[]
*
Path
{
{
...
...
@@ -280,7 +280,7 @@ func TestCopy(t *testing.T) {
},
},
expected
:
&
Route
{
pfx
:
net
.
NewPfx
(
1000
,
8
),
pfx
:
b
net
.
NewPfx
(
1000
,
8
),
ecmpPaths
:
2
,
paths
:
[]
*
Path
{
{
...
...
@@ -328,7 +328,7 @@ func TestBestPath(t *testing.T) {
{
Type
:
StaticPathType
,
StaticPath
:
&
StaticPath
{
NextHop
:
32
,
NextHop
:
bnet
.
IPv4
(
32
)
,
},
},
},
...
...
@@ -336,7 +336,7 @@ func TestBestPath(t *testing.T) {
expected
:
&
Path
{
Type
:
StaticPathType
,
StaticPath
:
&
StaticPath
{
NextHop
:
32
,
NextHop
:
bnet
.
IPv4
(
32
)
,
},
},
},
...
...
@@ -366,13 +366,13 @@ func TestECMPPaths(t *testing.T) {
{
Type
:
StaticPathType
,
StaticPath
:
&
StaticPath
{
NextHop
:
32
,
NextHop
:
bnet
.
IPv4
(
32
)
,
},
},
{
Type
:
StaticPathType
,
StaticPath
:
&
StaticPath
{
NextHop
:
32
,
NextHop
:
bnet
.
IPv4
(
32
)
,
},
},
},
...
...
@@ -381,13 +381,13 @@ func TestECMPPaths(t *testing.T) {
{
Type
:
StaticPathType
,
StaticPath
:
&
StaticPath
{
NextHop
:
32
,
NextHop
:
bnet
.
IPv4
(
32
)
,
},
},
{
Type
:
StaticPathType
,
StaticPath
:
&
StaticPath
{
NextHop
:
32
,
NextHop
:
bnet
.
IPv4
(
32
)
,
},
},
},
...
...
@@ -399,6 +399,6 @@ func TestECMPPaths(t *testing.T) {
}
func
strAddr
(
s
string
)
uint32
{
ret
,
_
:=
net
.
StrToAddr
(
s
)
ret
,
_
:=
b
net
.
StrToAddr
(
s
)
return
ret
}
This diff is collapsed.
Click to expand it.
route/static.go
+
3
−
1
View file @
f88c87e5
package
route
import
bnet
"github.com/bio-routing/bio-rd/net"
// StaticPath represents a static path of a route
type
StaticPath
struct
{
NextHop
uint32
NextHop
bnet
.
IP
}
func
(
r
*
Route
)
staticPathSelection
()
{
...
...
This diff is collapsed.
Click to expand it.
routingtable/locRIB/loc_rib_test.go
+
5
−
4
View file @
f88c87e5
...
...
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/bio-routing/bio-rd/net"
bnet
"github.com/bio-routing/bio-rd/net"
"github.com/bio-routing/bio-rd/route"
"github.com/stretchr/testify/assert"
...
...
@@ -38,7 +39,7 @@ func TestContainsPfxPath(t *testing.T) {
path
:
&
route
.
Path
{
Type
:
route
.
StaticPathType
,
StaticPath
:
&
route
.
StaticPath
{
NextHop
:
2
,
NextHop
:
bnet
.
IPv4
(
2
)
,
},
},
},
...
...
@@ -57,7 +58,7 @@ func TestContainsPfxPath(t *testing.T) {
path
:
&
route
.
Path
{
Type
:
route
.
StaticPathType
,
StaticPath
:
&
route
.
StaticPath
{
NextHop
:
2
,
NextHop
:
bnet
.
IPv4
(
2
)
,
},
},
},
...
...
@@ -67,7 +68,7 @@ func TestContainsPfxPath(t *testing.T) {
path
:
&
route
.
Path
{
Type
:
route
.
StaticPathType
,
StaticPath
:
&
route
.
StaticPath
{
NextHop
:
2
,
NextHop
:
bnet
.
IPv4
(
2
)
,
},
},
},
...
...
@@ -91,7 +92,7 @@ func TestLocRIB_RemovePathUnknown(t *testing.T) {
&
route
.
Path
{
Type
:
route
.
StaticPathType
,
StaticPath
:
&
route
.
StaticPath
{
NextHop
:
2
,
NextHop
:
bnet
.
IPv4
(
2
)
,
},
}))
}
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