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
0e00270b
Commit
0e00270b
authored
6 years ago
by
cedi
Browse files
Options
Downloads
Patches
Plain Diff
Add GetRIBNames
parent
d50f66fa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
routingtable/vrf/vrf.go
+13
-0
13 additions, 0 deletions
routingtable/vrf/vrf.go
routingtable/vrf/vrf_test.go
+12
-0
12 additions, 0 deletions
routingtable/vrf/vrf_test.go
with
25 additions
and
0 deletions
routingtable/vrf/vrf.go
+
13
−
0
View file @
0e00270b
...
@@ -121,3 +121,16 @@ func (v *VRF) RIBByName(name string) (rib *locRIB.LocRIB, found bool) {
...
@@ -121,3 +121,16 @@ func (v *VRF) RIBByName(name string) (rib *locRIB.LocRIB, found bool) {
rib
,
found
=
v
.
ribNames
[
name
]
rib
,
found
=
v
.
ribNames
[
name
]
return
rib
,
found
return
rib
,
found
}
}
// GetRIBNames returns an []string containing all rib-names
func
(
v
*
VRF
)
GetRIBNames
()
[]
string
{
v
.
mu
.
Lock
()
defer
v
.
mu
.
Unlock
()
ribNames
:=
make
([]
string
,
0
)
for
ribName
:=
range
v
.
ribNames
{
ribNames
=
append
(
ribNames
,
ribName
)
}
return
ribNames
}
This diff is collapsed.
Click to expand it.
routingtable/vrf/vrf_test.go
+
12
−
0
View file @
0e00270b
...
@@ -81,3 +81,15 @@ func TestUnregister(t *testing.T) {
...
@@ -81,3 +81,15 @@ func TestUnregister(t *testing.T) {
_
,
found
=
globalRegistry
.
vrfsID
[
vrfID
]
_
,
found
=
globalRegistry
.
vrfsID
[
vrfID
]
assert
.
False
(
t
,
found
,
"vrf must not be in global registry"
)
assert
.
False
(
t
,
found
,
"vrf must not be in global registry"
)
}
}
func
TestGetRIBNames
(
t
*
testing
.
T
)
{
vrfName
:=
"namedRIBs"
vrfID
:=
uint32
(
8
)
v
,
err
:=
New
(
vrfName
,
vrfID
)
assert
.
Nil
(
t
,
err
,
"error must be nil on first invokation"
)
ribNames
:=
v
.
GetRIBNames
()
expectedRibNames
:=
[]
string
{
"inet.8"
,
"inet6.8"
}
assert
.
EqualValues
(
t
,
expectedRibNames
,
ribNames
,
"rib names must match"
)
}
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