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
35424423
Commit
35424423
authored
6 years ago
by
Daniel Czerwonk
Browse files
Options
Downloads
Patches
Plain Diff
resolved merge conflicts
parent
617998b7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
route/bgp_path.go
+8
-6
8 additions, 6 deletions
route/bgp_path.go
route/bgp_test.go
+2
-2
2 additions, 2 deletions
route/bgp_test.go
with
10 additions
and
8 deletions
route/bgp_path.go
+
8
−
6
View file @
35424423
...
@@ -5,6 +5,8 @@ import (
...
@@ -5,6 +5,8 @@ import (
"fmt"
"fmt"
"strings"
"strings"
"github.com/taktv6/tflow2/convert"
bnet
"github.com/bio-routing/bio-rd/net"
bnet
"github.com/bio-routing/bio-rd/net"
"github.com/bio-routing/bio-rd/protocols/bgp/types"
"github.com/bio-routing/bio-rd/protocols/bgp/types"
)
)
...
@@ -252,7 +254,7 @@ func (b *BGPPath) Print() string {
...
@@ -252,7 +254,7 @@ func (b *BGPPath) Print() string {
ret
+=
fmt
.
Sprintf
(
"
\t\t
LargeCommunities: %v
\n
"
,
b
.
LargeCommunities
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
LargeCommunities: %v
\n
"
,
b
.
LargeCommunities
)
if
b
.
OriginatorID
!=
0
{
if
b
.
OriginatorID
!=
0
{
oid
:=
u
int32
To4
Byte
(
b
.
OriginatorID
)
oid
:=
convert
.
U
int32Byte
(
b
.
OriginatorID
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
OriginatorID: %d.%d.%d.%d
\n
"
,
oid
[
0
],
oid
[
1
],
oid
[
2
],
oid
[
3
])
ret
+=
fmt
.
Sprintf
(
"
\t\t
OriginatorID: %d.%d.%d.%d
\n
"
,
oid
[
0
],
oid
[
1
],
oid
[
2
],
oid
[
3
])
}
}
if
b
.
ClusterList
!=
nil
{
if
b
.
ClusterList
!=
nil
{
...
@@ -330,7 +332,7 @@ func (b *BGPPath) Copy() *BGPPath {
...
@@ -330,7 +332,7 @@ func (b *BGPPath) Copy() *BGPPath {
// ComputeHash computes an hash over all attributes of the path
// ComputeHash computes an hash over all attributes of the path
func
(
b
*
BGPPath
)
ComputeHash
()
string
{
func
(
b
*
BGPPath
)
ComputeHash
()
string
{
s
:=
fmt
.
Sprintf
(
"%s
\t
%d
\t
%v
\t
%d
\t
%d
\t
%v
\t
%d
\t
%s
\t
%v
\t
%v
\t
%d"
,
s
:=
fmt
.
Sprintf
(
"%s
\t
%d
\t
%v
\t
%d
\t
%d
\t
%v
\t
%d
\t
%s
\t
%v
\t
%v
\t
%d
\t
%d
\t
%v
"
,
b
.
NextHop
,
b
.
NextHop
,
b
.
LocalPref
,
b
.
LocalPref
,
b
.
ASPath
,
b
.
ASPath
,
...
@@ -340,10 +342,10 @@ func (b *BGPPath) ComputeHash() string {
...
@@ -340,10 +342,10 @@ func (b *BGPPath) ComputeHash() string {
b
.
BGPIdentifier
,
b
.
BGPIdentifier
,
b
.
Source
,
b
.
Source
,
b
.
Communities
,
b
.
Communities
,
b
.
OriginatorID
,
b
.
ClusterList
,
b
.
LargeCommunities
,
b
.
LargeCommunities
,
b
.
PathIdentifier
)
b
.
PathIdentifier
,
b
.
OriginatorID
,
b
.
ClusterList
)
return
fmt
.
Sprintf
(
"%x"
,
sha256
.
Sum256
([]
byte
(
s
)))
return
fmt
.
Sprintf
(
"%x"
,
sha256
.
Sum256
([]
byte
(
s
)))
}
}
...
@@ -362,7 +364,7 @@ func (b *BGPPath) CommunitiesString() string {
...
@@ -362,7 +364,7 @@ func (b *BGPPath) CommunitiesString() string {
func
(
b
*
BGPPath
)
ClusterListString
()
string
{
func
(
b
*
BGPPath
)
ClusterListString
()
string
{
str
:=
""
str
:=
""
for
_
,
cid
:=
range
b
.
ClusterList
{
for
_
,
cid
:=
range
b
.
ClusterList
{
octes
:=
u
int32
To4
Byte
(
cid
)
octes
:=
convert
.
U
int32Byte
(
cid
)
str
+=
fmt
.
Sprintf
(
"%d.%d.%d.%d "
,
octes
[
0
],
octes
[
1
],
octes
[
2
],
octes
[
3
])
str
+=
fmt
.
Sprintf
(
"%d.%d.%d.%d "
,
octes
[
0
],
octes
[
1
],
octes
[
2
],
octes
[
3
])
}
}
...
...
This diff is collapsed.
Click to expand it.
route/bgp_test.go
+
2
−
2
View file @
35424423
...
@@ -36,9 +36,9 @@ func TestComputeHash(t *testing.T) {
...
@@ -36,9 +36,9 @@ func TestComputeHash(t *testing.T) {
Source
:
bnet
.
IPv4
(
4
),
Source
:
bnet
.
IPv4
(
4
),
}
}
assert
.
Equal
(
t
,
"
1058916ff3e6a51c7d8a47945d13fc3fcd8ee578a6d376505f46d58979b30fae
"
,
p
.
ComputeHash
())
assert
.
Equal
(
t
,
"
5907ed8960ccc14eed8f1a34a8eb3e6c82a8dd947d6cbf67eb58ca292f4588d5
"
,
p
.
ComputeHash
())
p
.
LocalPref
=
150
p
.
LocalPref
=
150
assert
.
NotEqual
(
t
,
"
1058916ff3e6a51c7d8a47945d13fc3fcd8ee578a6d376505f46d58979b30fae
"
,
p
.
ComputeHash
())
assert
.
NotEqual
(
t
,
"
5907ed8960ccc14eed8f1a34a8eb3e6c82a8dd947d6cbf67eb58ca292f4588d5
"
,
p
.
ComputeHash
())
}
}
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