Skip to content
Snippets Groups Projects
Commit 35424423 authored by Daniel Czerwonk's avatar Daniel Czerwonk
Browse files

resolved merge conflicts

parent 617998b7
No related branches found
No related tags found
No related merge requests found
...@@ -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\tLargeCommunities: %v\n", b.LargeCommunities) ret += fmt.Sprintf("\t\tLargeCommunities: %v\n", b.LargeCommunities)
if b.OriginatorID != 0 { if b.OriginatorID != 0 {
oid := uint32To4Byte(b.OriginatorID) oid := convert.Uint32Byte(b.OriginatorID)
ret += fmt.Sprintf("\t\tOriginatorID: %d.%d.%d.%d\n", oid[0], oid[1], oid[2], oid[3]) ret += fmt.Sprintf("\t\tOriginatorID: %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 := uint32To4Byte(cid) octes := convert.Uint32Byte(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])
} }
......
...@@ -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())
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment