summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--table/destination.go14
-rw-r--r--table/destination_test.go10
-rw-r--r--table/message.go12
-rw-r--r--table/path.go18
-rw-r--r--table/path_test.go8
-rw-r--r--table/table.go4
-rw-r--r--table/table_manager_test.go268
-rw-r--r--table/table_test.go24
8 files changed, 179 insertions, 179 deletions
diff --git a/table/destination.go b/table/destination.go
index 89bbab54..06bab95c 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -521,8 +521,8 @@ func compareByLocalPref(path1, path2 Path) Path {
//
// # Default local-pref values is 100
log.Debugf("enter compareByLocalPref")
- _, attribute1 := path1.GetPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
- _, attribute2 := path2.GetPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
+ _, attribute1 := path1.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
+ _, attribute2 := path2.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
if attribute1 == nil || attribute2 == nil {
return nil
@@ -572,8 +572,8 @@ func compareByASPath(path1, path2 Path) Path {
// Shortest as-path length is preferred. If both path have same lengths,
// we return None.
log.Debugf("enter compareByASPath")
- _, attribute1 := path1.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
- _, attribute2 := path2.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attribute1 := path1.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attribute2 := path2.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
asPath1 := attribute1.(*bgp.PathAttributeAsPath)
asPath2 := attribute2.(*bgp.PathAttributeAsPath)
@@ -609,8 +609,8 @@ func compareByOrigin(path1, path2 Path) Path {
// IGP is preferred over EGP; EGP is preferred over Incomplete.
// If both paths have same origin, we return None.
log.Debugf("enter compareByOrigin")
- _, attribute1 := path1.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
- _, attribute2 := path2.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attribute1 := path1.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attribute2 := path2.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
if attribute1 == nil || attribute2 == nil {
log.Error("it is not possible to compare origin are not present")
@@ -643,7 +643,7 @@ func compareByMED(path1, path2 Path) Path {
// like bgp always-compare-med
log.Debugf("enter compareByMED")
getMed := func(path Path) uint32 {
- _, attribute := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attribute := path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
if attribute == nil {
return 0
}
diff --git a/table/destination_test.go b/table/destination_test.go
index b3482839..e003ce67 100644
--- a/table/destination_test.go
+++ b/table/destination_test.go
@@ -27,14 +27,14 @@ func TestDestinationNewIPv4(t *testing.T) {
peerD := DestCreatePeer()
msgD := DestCreateMSG(peerD)
pathD := DestCreatePath(msgD)
- ipv4d := NewIPv4Destination(pathD[0].GetNlri())
+ ipv4d := NewIPv4Destination(pathD[0].getNlri())
assert.NotNil(t, ipv4d)
}
func TestDestinationNewIPv6(t *testing.T) {
peerD := DestCreatePeer()
msgD := DestCreateMSG(peerD)
pathD := DestCreatePath(msgD)
- ipv6d := NewIPv6Destination(pathD[0].GetNlri())
+ ipv6d := NewIPv6Destination(pathD[0].getNlri())
assert.NotNil(t, ipv6d)
}
@@ -82,7 +82,7 @@ func TestDestinationSetBestPath(t *testing.T) {
peerD := DestCreatePeer()
msgD := DestCreateMSG(peerD)
pathD := DestCreatePath(msgD)
- ipv4d := NewIPv4Destination(pathD[0].GetNlri())
+ ipv4d := NewIPv4Destination(pathD[0].getNlri())
ipv4d.setBestPath(pathD[0])
r_pathD := ipv4d.getBestPath()
assert.Equal(t, r_pathD, pathD[0])
@@ -91,7 +91,7 @@ func TestDestinationGetBestPath(t *testing.T) {
peerD := DestCreatePeer()
msgD := DestCreateMSG(peerD)
pathD := DestCreatePath(msgD)
- ipv4d := NewIPv4Destination(pathD[0].GetNlri())
+ ipv4d := NewIPv4Destination(pathD[0].getNlri())
ipv4d.setBestPath(pathD[0])
r_pathD := ipv4d.getBestPath()
assert.Equal(t, r_pathD, pathD[0])
@@ -100,7 +100,7 @@ func TestDestinationCalculate(t *testing.T) {
peerD := DestCreatePeer()
msgD := DestCreateMSG(peerD)
pathD := DestCreatePath(msgD)
- ipv4d := NewIPv4Destination(pathD[0].GetNlri())
+ ipv4d := NewIPv4Destination(pathD[0].getNlri())
//best path selection
ipv4d.addNewPath(pathD[0])
ipv4d.addNewPath(pathD[1])
diff --git a/table/message.go b/table/message.go
index a22c3b01..dac7c439 100644
--- a/table/message.go
+++ b/table/message.go
@@ -126,22 +126,22 @@ func CreateUpdateMsgFromPath(path Path, msg *bgp.BGPMessage) (*bgp.BGPMessage, e
if rf == bgp.RF_IPv4_UC {
if path.IsWithdraw() {
- draw := path.GetNlri().(*bgp.WithdrawnRoute)
+ draw := path.getNlri().(*bgp.WithdrawnRoute)
return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{*draw}, []bgp.PathAttributeInterface{}, []bgp.NLRInfo{}), nil
} else {
- nlri := path.GetNlri().(*bgp.NLRInfo)
- pathAttrs := path.GetPathAttrs()
+ nlri := path.getNlri().(*bgp.NLRInfo)
+ pathAttrs := path.getPathAttrs()
return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, pathAttrs, []bgp.NLRInfo{*nlri}), nil
}
} else if rf == bgp.RF_IPv6_UC {
if path.IsWithdraw() {
- clonedAttrs := clonePathAttributes(path.GetPathAttrs())
- idx, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ clonedAttrs := clonePathAttributes(path.getPathAttrs())
+ idx, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
reach := attr.(*bgp.PathAttributeMpReachNLRI)
clonedAttrs[idx] = bgp.NewPathAttributeMpUnreachNLRI(reach.Value)
return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, clonedAttrs, []bgp.NLRInfo{}), nil
} else {
- return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, path.GetPathAttrs(), []bgp.NLRInfo{}), nil
+ return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, path.getPathAttrs(), []bgp.NLRInfo{}), nil
}
}
return nil, nil
diff --git a/table/path.go b/table/path.go
index 96ffd250..bc92ed16 100644
--- a/table/path.go
+++ b/table/path.go
@@ -26,8 +26,8 @@ import (
type Path interface {
String() string
- GetPathAttrs() []bgp.PathAttributeInterface
- GetPathAttr(bgp.BGPAttrType) (int, bgp.PathAttributeInterface)
+ getPathAttrs() []bgp.PathAttributeInterface
+ getPathAttr(bgp.BGPAttrType) (int, bgp.PathAttributeInterface)
GetRouteFamily() bgp.RouteFamily
setSource(source *PeerInfo)
getSource() *PeerInfo
@@ -37,7 +37,7 @@ type Path interface {
getSourceVerNum() int
setWithdraw(withdraw bool)
IsWithdraw() bool
- GetNlri() bgp.AddrPrefixInterface
+ getNlri() bgp.AddrPrefixInterface
getPrefix() net.IP
setMedSetByTargetNeighbor(medSetByTargetNeighbor bool)
getMedSetByTargetNeighbor() bool
@@ -108,7 +108,7 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) {
Network: prefix.String() + "/" + fmt.Sprint(prefixLen),
//Nexthop: pd.nexthop.String(),
//Metric: fmt.Sprint(med),
- Attrs: pd.GetPathAttrs(),
+ Attrs: pd.getPathAttrs(),
Best: fmt.Sprint(pd.isBest),
})
}
@@ -161,7 +161,7 @@ func (pd *PathDefault) IsWithdraw() bool {
return pd.withdraw
}
-func (pd *PathDefault) GetNlri() bgp.AddrPrefixInterface {
+func (pd *PathDefault) getNlri() bgp.AddrPrefixInterface {
return pd.nlri
}
@@ -173,11 +173,11 @@ func (pd *PathDefault) getMedSetByTargetNeighbor() bool {
return pd.medSetByTargetNeighbor
}
-func (pd *PathDefault) GetPathAttrs() []bgp.PathAttributeInterface {
+func (pd *PathDefault) getPathAttrs() []bgp.PathAttributeInterface {
return pd.pathAttrs
}
-func (pd *PathDefault) GetPathAttr(pattrType bgp.BGPAttrType) (int, bgp.PathAttributeInterface) {
+func (pd *PathDefault) getPathAttr(pattrType bgp.BGPAttrType) (int, bgp.PathAttributeInterface) {
attrMap := [bgp.BGP_ATTR_TYPE_AS4_AGGREGATOR + 1]reflect.Type{}
attrMap[bgp.BGP_ATTR_TYPE_ORIGIN] = reflect.TypeOf(&bgp.PathAttributeOrigin{})
attrMap[bgp.BGP_ATTR_TYPE_AS_PATH] = reflect.TypeOf(&bgp.PathAttributeAsPath{})
@@ -259,7 +259,7 @@ func NewIPv4Path(source *PeerInfo, nlri bgp.AddrPrefixInterface, sourceVerNum in
ipv4Path := &IPv4Path{}
ipv4Path.PathDefault = NewPathDefault(bgp.RF_IPv4_UC, source, nlri, sourceVerNum, nil, isWithdraw, attrs, medSetByTargetNeighbor)
if !isWithdraw {
- _, nexthop_attr := ipv4Path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, nexthop_attr := ipv4Path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
ipv4Path.nexthop = nexthop_attr.(*bgp.PathAttributeNextHop).Value
}
return ipv4Path
@@ -280,7 +280,7 @@ func NewIPv6Path(source *PeerInfo, nlri bgp.AddrPrefixInterface, sourceVerNum in
ipv6Path := &IPv6Path{}
ipv6Path.PathDefault = NewPathDefault(bgp.RF_IPv6_UC, source, nlri, sourceVerNum, nil, isWithdraw, attrs, medSetByTargetNeighbor)
if !isWithdraw {
- _, mpattr := ipv6Path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, mpattr := ipv6Path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
ipv6Path.nexthop = mpattr.(*bgp.PathAttributeMpReachNLRI).Nexthop
}
return ipv6Path
diff --git a/table/path_test.go b/table/path_test.go
index 51fe6328..feed46ed 100644
--- a/table/path_test.go
+++ b/table/path_test.go
@@ -13,14 +13,14 @@ func TestPathNewIPv4(t *testing.T) {
peerP := PathCreatePeer()
msgP := PathCreateMSG(peerP)
pathP := PathCreatePath(msgP)
- ipv4p := NewIPv4Path(pathP[0].getSource(), pathP[0].GetNlri(), pathP[0].getSourceVerNum(), true, pathP[0].GetPathAttrs(), pathP[0].getMedSetByTargetNeighbor())
+ ipv4p := NewIPv4Path(pathP[0].getSource(), pathP[0].getNlri(), pathP[0].getSourceVerNum(), true, pathP[0].getPathAttrs(), pathP[0].getMedSetByTargetNeighbor())
assert.NotNil(t, ipv4p)
}
func TestPathNewIPv6(t *testing.T) {
peerP := PathCreatePeer()
msgP := PathCreateMSG(peerP)
pathP := PathCreatePath(msgP)
- ipv6p := NewIPv6Path(pathP[0].getSource(), pathP[0].GetNlri(), pathP[0].getSourceVerNum(), true, pathP[0].GetPathAttrs(), pathP[0].getMedSetByTargetNeighbor())
+ ipv6p := NewIPv6Path(pathP[0].getSource(), pathP[0].getNlri(), pathP[0].getSourceVerNum(), true, pathP[0].getPathAttrs(), pathP[0].getMedSetByTargetNeighbor())
assert.NotNil(t, ipv6p)
}
@@ -131,7 +131,7 @@ func TestPathGetNlri(t *testing.T) {
pd := &PathDefault{
nlri: nlri,
}
- r_nlri := pd.GetNlri()
+ r_nlri := pd.getNlri()
assert.Equal(t, r_nlri, nlri)
}
@@ -176,7 +176,7 @@ func TestPathGetAttribute(t *testing.T) {
msgP := PathCreateMSG(peerP)
pathP := PathCreatePath(msgP)
nh := "192.168.50.1"
- _, pa := pathP[0].GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, pa := pathP[0].getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
r_nh := pa.(*bgp.PathAttributeNextHop).Value.String()
assert.Equal(t, r_nh, nh)
}
diff --git a/table/table.go b/table/table.go
index 5981ca46..1f4058f0 100644
--- a/table/table.go
+++ b/table/table.go
@@ -79,8 +79,8 @@ func insert(table Table, path Path) Destination {
var dest Destination
table.validatePath(path)
- table.validateNlri(path.GetNlri())
- dest = getOrCreateDest(table, path.GetNlri())
+ table.validateNlri(path.getNlri())
+ dest = getOrCreateDest(table, path.getNlri())
if path.IsWithdraw() {
// withdraw insert
diff --git a/table/table_manager_test.go b/table/table_manager_test.go
index 761e6f54..60caa267 100644
--- a/table/table_manager_test.go
+++ b/table/table_manager_test.go
@@ -84,27 +84,27 @@ func TestProcessBGPUpdate_0_select_onlypath_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 4, len(path.GetPathAttrs()))
+ assert.Equal(t, 4, len(path.getPathAttrs()))
// check destination
expectedPrefix := "10.10.10.0"
@@ -136,27 +136,27 @@ func TestProcessBGPUpdate_0_select_onlypath_ipv6(t *testing.T) {
pathAttributes := bgpMessage.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 4, len(path.GetPathAttrs()))
+ assert.Equal(t, 4, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2001:123:123:1::"
@@ -221,27 +221,27 @@ func TestProcessBGPUpdate_1_select_high_localpref_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes2), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes2), len(path.getPathAttrs()))
// check destination
expectedPrefix := "10.10.10.0"
@@ -308,27 +308,27 @@ func TestProcessBGPUpdate_1_select_high_localpref_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 5, len(path.GetPathAttrs()))
+ assert.Equal(t, 5, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2001:123:123:1::"
@@ -393,27 +393,27 @@ func TestProcessBGPUpdate_2_select_local_origin_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes2), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes2), len(path.getPathAttrs()))
// check destination
expectedPrefix := "10.10.10.0"
@@ -480,27 +480,27 @@ func TestProcessBGPUpdate_2_select_local_origin_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 5, len(path.GetPathAttrs()))
+ assert.Equal(t, 5, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2001:123:123:1::"
@@ -538,27 +538,27 @@ func TestProcessBGPUpdate_3_select_aspath_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 4, len(path.GetPathAttrs()))
+ assert.Equal(t, 4, len(path.getPathAttrs()))
// check destination
expectedPrefix := "20.20.20.0"
@@ -596,27 +596,27 @@ func TestProcessBGPUpdate_3_select_aspath_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 4, len(path.GetPathAttrs()))
+ assert.Equal(t, 4, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2002:223:123:1::"
@@ -681,27 +681,27 @@ func TestProcessBGPUpdate_4_select_low_origin_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes2), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes2), len(path.getPathAttrs()))
// check destination
expectedPrefix := "10.10.10.0"
@@ -768,27 +768,27 @@ func TestProcessBGPUpdate_4_select_low_origin_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 5, len(path.GetPathAttrs()))
+ assert.Equal(t, 5, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2001:123:123:1::"
@@ -853,27 +853,27 @@ func TestProcessBGPUpdate_5_select_low_med_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes2), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes2), len(path.getPathAttrs()))
// check destination
expectedPrefix := "10.10.10.0"
@@ -940,27 +940,27 @@ func TestProcessBGPUpdate_5_select_low_med_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 5, len(path.GetPathAttrs()))
+ assert.Equal(t, 5, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2001:123:123:1::"
@@ -1027,27 +1027,27 @@ func TestProcessBGPUpdate_6_select_ebgp_path_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes2), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes2), len(path.getPathAttrs()))
// check destination
expectedPrefix := "10.10.10.0"
@@ -1115,27 +1115,27 @@ func TestProcessBGPUpdate_6_select_ebgp_path_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 5, len(path.GetPathAttrs()))
+ assert.Equal(t, 5, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2001:123:123:1::"
@@ -1204,27 +1204,27 @@ func TestProcessBGPUpdate_7_select_low_routerid_path_ipv4(t *testing.T) {
// check PathAttribute
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes2), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes2), len(path.getPathAttrs()))
// check destination
expectedPrefix := "10.10.10.0"
@@ -1292,27 +1292,27 @@ func TestProcessBGPUpdate_7_select_low_routerid_path_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, 5, len(path.GetPathAttrs()))
+ assert.Equal(t, 5, len(path.getPathAttrs()))
// check destination
expectedPrefix := "2001:123:123:1::"
@@ -1379,27 +1379,27 @@ func TestProcessBGPUpdate_8_withdraw_path_ipv4(t *testing.T) {
checkPattr := func(expected *bgp.BGPMessage, actual Path) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(path.getPathAttrs()))
}
checkPattr(bgpMessage2, path)
// check destination
@@ -1489,22 +1489,22 @@ func TestProcessBGPUpdate_8_mpunreach_path_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
@@ -1513,26 +1513,26 @@ func TestProcessBGPUpdate_8_mpunreach_path_ipv6(t *testing.T) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(path.getPathAttrs()))
}
checkPattr(bgpMessage2, path)
@@ -1613,27 +1613,27 @@ func TestProcessBGPUpdate_bestpath_lost_ipv4(t *testing.T) {
checkPattr := func(expected *bgp.BGPMessage, actual Path) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(path.getPathAttrs()))
}
checkPattr(bgpMessage1, path)
@@ -1688,26 +1688,26 @@ func TestProcessBGPUpdate_bestpath_lost_ipv6(t *testing.T) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := actual.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(path.getPathAttrs()))
}
checkPattr(bgpMessage1, path)
@@ -1772,27 +1772,27 @@ func TestProcessBGPUpdate_implicit_withdrwal_ipv4(t *testing.T) {
checkPattr := func(expected *bgp.BGPMessage, actual Path) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(path.getPathAttrs()))
}
checkPattr(bgpMessage2, path)
// check destination
@@ -1859,22 +1859,22 @@ func TestProcessBGPUpdate_implicit_withdrwal_ipv6(t *testing.T) {
pathAttributes := bgpMessage2.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := path.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = path.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
@@ -1883,26 +1883,26 @@ func TestProcessBGPUpdate_implicit_withdrwal_ipv6(t *testing.T) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
expectedNexthopAttr := pathAttributes[0]
- _, attr := actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := actual.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
pathNexthop := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(path.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(path.getPathAttrs()))
}
checkPattr(bgpMessage2, path)
@@ -1939,27 +1939,27 @@ func TestProcessBGPUpdate_multiple_nlri_ipv4(t *testing.T) {
checkPattr := func(expected *bgp.BGPMessage, actual Path) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
expectedOrigin := pathAttributes[0]
- _, attr := actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr := actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedNexthopAttr := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
pathNexthop := attr.(*bgp.PathAttributeNextHop)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedMed := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(actual.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(actual.getPathAttrs()))
}
checkBestPathResult := func(pType, prefix, nexthop string, p Path, m *bgp.BGPMessage) {
@@ -2068,32 +2068,32 @@ func TestProcessBGPUpdate_multiple_nlri_ipv6(t *testing.T) {
checkPattr := func(expected *bgp.BGPMessage, actual Path) {
pathAttributes := expected.Body.(*bgp.BGPUpdate).PathAttributes
pathNexthop := pathAttributes[4]
- _, attr := actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
+ _, attr := actual.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
expectedNexthopAttr := attr.(*bgp.PathAttributeMpReachNLRI)
assert.Equal(t, expectedNexthopAttr, pathNexthop)
expectedOrigin := pathAttributes[0]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
pathOrigin := attr.(*bgp.PathAttributeOrigin)
assert.Equal(t, expectedOrigin, pathOrigin)
expectedAsPath := pathAttributes[1]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH)
pathAspath := attr.(*bgp.PathAttributeAsPath)
assert.Equal(t, expectedAsPath, pathAspath)
expectedMed := pathAttributes[2]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
pathMed := attr.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, expectedMed, pathMed)
expectedLocalpref := pathAttributes[3]
- _, attr = actual.GetPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
+ _, attr = actual.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
localpref := attr.(*bgp.PathAttributeLocalPref)
assert.Equal(t, expectedLocalpref, localpref)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(actual.GetPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(actual.getPathAttrs()))
}
@@ -2200,22 +2200,22 @@ func TestModifyPathAttribute(t *testing.T) {
path0 := pList[0]
path1 := path0.clone(false)
ipv4p := path1.(*IPv4Path)
- ipv4p.PathDefault.pathAttrs = clonePathAttributes(path0.GetPathAttrs())
+ ipv4p.PathDefault.pathAttrs = clonePathAttributes(path0.getPathAttrs())
- _, attr1 := path1.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr1 := path1.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
mx1 := attr1.(*bgp.PathAttributeMultiExitDisc)
original := mx1.Value
mx1.Value++
table := tm.Tables[bgp.RF_IPv4_UC]
- dest := table.getDestination(table.tableKey(path0.GetNlri()).String()).(*IPv4Destination)
+ dest := table.getDestination(table.tableKey(path0.getNlri()).String()).(*IPv4Destination)
path2 := dest.getKnownPathList()
- _, attr2 := path2[0].GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr2 := path2[0].getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
mx2 := attr2.(*bgp.PathAttributeMultiExitDisc)
assert.Equal(t, original, mx2.Value)
path3 := path0
- _, attr3 := path3.GetPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
+ _, attr3 := path3.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
mx3 := attr3.(*bgp.PathAttributeMultiExitDisc)
mx3.Value++
assert.Equal(t, mx2.Value, mx3.Value)
diff --git a/table/table_test.go b/table/table_test.go
index 6e392e93..0827df74 100644
--- a/table/table_test.go
+++ b/table/table_test.go
@@ -41,13 +41,13 @@ func TestTableDeleteDestByNlri(t *testing.T) {
pathT := TableCreatePath(msgT)
ipv4t := NewIPv4Table(0)
for _, path := range pathT {
- tableKey := ipv4t.tableKey(path.GetNlri())
- dest := ipv4t.createDest(path.GetNlri())
+ tableKey := ipv4t.tableKey(path.getNlri())
+ dest := ipv4t.createDest(path.getNlri())
ipv4t.setDestination(tableKey.String(), dest)
}
- tableKey := ipv4t.tableKey(pathT[0].GetNlri())
+ tableKey := ipv4t.tableKey(pathT[0].getNlri())
gdest := ipv4t.getDestination(tableKey.String())
- rdest := deleteDestByNlri(ipv4t, pathT[0].GetNlri())
+ rdest := deleteDestByNlri(ipv4t, pathT[0].getNlri())
assert.Equal(t, rdest, gdest)
}
@@ -57,12 +57,12 @@ func TestTableDeleteDest(t *testing.T) {
pathT := TableCreatePath(msgT)
ipv4t := NewIPv4Table(0)
for _, path := range pathT {
- tableKey := ipv4t.tableKey(path.GetNlri())
- dest := ipv4t.createDest(path.GetNlri())
+ tableKey := ipv4t.tableKey(path.getNlri())
+ dest := ipv4t.createDest(path.getNlri())
ipv4t.setDestination(tableKey.String(), dest)
}
- tableKey := ipv4t.tableKey(pathT[0].GetNlri())
- dest := ipv4t.createDest(pathT[0].GetNlri())
+ tableKey := ipv4t.tableKey(pathT[0].getNlri())
+ dest := ipv4t.createDest(pathT[0].getNlri())
ipv4t.setDestination(tableKey.String(), dest)
deleteDest(ipv4t, dest)
gdest := ipv4t.getDestination(tableKey.String())
@@ -82,8 +82,8 @@ func TestTableSetDestinations(t *testing.T) {
ipv4t := NewIPv4Table(0)
destinations := make(map[string]Destination)
for _, path := range pathT {
- tableKey := ipv4t.tableKey(path.GetNlri())
- dest := ipv4t.createDest(path.GetNlri())
+ tableKey := ipv4t.tableKey(path.getNlri())
+ dest := ipv4t.createDest(path.getNlri())
destinations[tableKey.String()] = dest
}
ipv4t.setDestinations(destinations)
@@ -97,8 +97,8 @@ func TestTableGetDestinations(t *testing.T) {
ipv4t := NewIPv4Table(0)
destinations := make(map[string]Destination)
for _, path := range pathT {
- tableKey := ipv4t.tableKey(path.GetNlri())
- dest := ipv4t.createDest(path.GetNlri())
+ tableKey := ipv4t.tableKey(path.getNlri())
+ dest := ipv4t.createDest(path.getNlri())
destinations[tableKey.String()] = dest
}
ipv4t.setDestinations(destinations)