summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-07-22 13:24:31 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-22 14:49:46 +0900
commita4501ccc3f680de0a9f9cc8621256d71d3679478 (patch)
tree1ab8e04fb4c6c39f512be1e9f76c26c78a127ac7 /table
parent3409f6a5443cf0d6cf0d318feba845f237cd14ba (diff)
mrt: support mrt dump
$ gobgp mrt dump 10 -o ./dump Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r--table/destination.go32
-rw-r--r--table/destination_test.go4
-rw-r--r--table/message.go8
-rw-r--r--table/path.go8
-rw-r--r--table/path_test.go4
-rw-r--r--table/table.go6
-rw-r--r--table/table_manager.go20
-rw-r--r--table/table_manager_test.go54
8 files changed, 68 insertions, 68 deletions
diff --git a/table/destination.go b/table/destination.go
index aa30fc2f..65697570 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -87,7 +87,7 @@ func (dd *Destination) MarshalJSON() ([]byte, error) {
}
func (dd *Destination) ToApiStruct() *api.Destination {
- prefix := dd.getNlri().String()
+ prefix := dd.GetNlri().String()
idx := func() int {
for i, p := range dd.knownPathList {
@@ -125,7 +125,7 @@ func (dd *Destination) setRouteFamily(routeFamily bgp.RouteFamily) {
dd.routeFamily = routeFamily
}
-func (dd *Destination) getNlri() bgp.AddrPrefixInterface {
+func (dd *Destination) GetNlri() bgp.AddrPrefixInterface {
return dd.nlri
}
@@ -149,7 +149,7 @@ func (dd *Destination) setBestPath(path *Path) {
dd.bestPath = path
}
-func (dd *Destination) getKnownPathList() []*Path {
+func (dd *Destination) GetKnownPathList() []*Path {
return dd.knownPathList
}
@@ -172,7 +172,7 @@ func (dd *Destination) validatePath(path *Path) {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dd.getNlri().String(),
+ "Key": dd.GetNlri().String(),
"Path": path,
"ExpectedRF": dd.routeFamily,
}).Error("path is nil or invalid route family")
@@ -201,7 +201,7 @@ func (dest *Destination) Calculate(localAsn uint32) (*Path, string, error) {
dest.newPathList, _ = deleteAt(dest.newPathList, 0)
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Path": dest.knownPathList[0],
"Reason": BPR_ONLY_PATH,
}).Debug("best path")
@@ -246,7 +246,7 @@ func (dest *Destination) removeWithdrawals() {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Length": len(dest.withdrawList),
}).Debug("Removing withdrawals")
// If we have no withdrawals, we have nothing to do.
@@ -259,7 +259,7 @@ func (dest *Destination) removeWithdrawals() {
if len(dest.knownPathList) == 0 {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Length": len(dest.withdrawList),
}).Debug("Found withdrawals for path(s) that did not get installed")
@@ -289,7 +289,7 @@ func (dest *Destination) removeWithdrawals() {
if !isFound {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Path": withdraw,
}).Debug("No matching path for withdraw found, may be path was not installed into table")
}
@@ -299,7 +299,7 @@ func (dest *Destination) removeWithdrawals() {
if len(matches) != len(dest.withdrawList) {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"MatchLength": len(matches),
"WithdrawLength": len(dest.withdrawList),
}).Debug("Did not find match for some withdrawals.")
@@ -312,7 +312,7 @@ func (dest *Destination) removeWithdrawals() {
if !result {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Path": path,
}).Debug("could not remove path from knownPathList")
}
@@ -323,7 +323,7 @@ func (dest *Destination) removeWithdrawals() {
if !result {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Path": path,
}).Debug("could not remove path from withdrawList")
}
@@ -386,14 +386,14 @@ func (dest *Destination) removeOldPaths() {
if !match {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Path": oldPath,
}).Debug("not matched")
}
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": dest.getNlri().String(),
+ "Key": dest.GetNlri().String(),
"Path": oldPath,
}).Debug("Implicit withdrawal of old path, since we have learned new path from the same peer")
}
@@ -577,11 +577,11 @@ func compareByLocalOrigin(path1, path2 *Path) *Path {
// Here we consider prefix from NC as locally originating static route.
// Hence it is preferred.
- if path1.isLocal() {
+ if path1.IsLocal() {
return path1
}
- if path2.isLocal() {
+ if path2.IsLocal() {
return path2
}
return nil
@@ -729,7 +729,7 @@ func compareByRouterID(localAsn uint32, path1, path2 *Path) (*Path, error) {
source2 := path2.GetSource()
// If both paths are from NC we have same router Id, hence cannot compare.
- if path1.isLocal() && path2.isLocal() {
+ if path1.IsLocal() && path2.IsLocal() {
return nil, nil
}
diff --git a/table/destination_test.go b/table/destination_test.go
index dbdf19a2..0b1b8e3b 100644
--- a/table/destination_test.go
+++ b/table/destination_test.go
@@ -53,14 +53,14 @@ func TestDestinationSetNlri(t *testing.T) {
dd := &Destination{}
nlri := bgp.NewNLRInfo(24, "13.2.3.1")
dd.setNlri(nlri)
- r_nlri := dd.getNlri()
+ r_nlri := dd.GetNlri()
assert.Equal(t, r_nlri, nlri)
}
func TestDestinationGetNlri(t *testing.T) {
dd := &Destination{}
nlri := bgp.NewNLRInfo(24, "10.110.123.1")
dd.setNlri(nlri)
- r_nlri := dd.getNlri()
+ r_nlri := dd.GetNlri()
assert.Equal(t, r_nlri, nlri)
}
func TestDestinationSetBestPathReason(t *testing.T) {
diff --git a/table/message.go b/table/message.go
index d8bb3cff..ffcbfa08 100644
--- a/table/message.go
+++ b/table/message.go
@@ -146,7 +146,7 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage {
u := msg.Body.(*bgp.BGPUpdate)
u.NLRI = append(u.NLRI, *nlri)
} else {
- pathAttrs := path.getPathAttrs()
+ pathAttrs := path.GetPathAttrs()
return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, pathAttrs, []bgp.NLRInfo{*nlri})
}
}
@@ -158,7 +158,7 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage {
unreach := u.PathAttributes[idx].(*bgp.PathAttributeMpUnreachNLRI)
unreach.Value = append(unreach.Value, path.GetNlri())
} else {
- clonedAttrs := cloneAttrSlice(path.getPathAttrs())
+ clonedAttrs := cloneAttrSlice(path.GetPathAttrs())
idx, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
reach := attr.(*bgp.PathAttributeMpReachNLRI)
clonedAttrs[idx] = bgp.NewPathAttributeMpUnreachNLRI(reach.Value)
@@ -175,7 +175,7 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage {
// we don't need to clone here but we
// might merge path to this message in
// the future so let's clone anyway.
- clonedAttrs := cloneAttrSlice(path.getPathAttrs())
+ clonedAttrs := cloneAttrSlice(path.GetPathAttrs())
return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, clonedAttrs, []bgp.NLRInfo{})
}
}
@@ -210,7 +210,7 @@ func isMergeable(p1, p2 *Path) bool {
if p1.GetRouteFamily() != bgp.RF_IPv4_UC {
return false
}
- if p1.GetSource().Equal(p2.GetSource()) && isSamePathAttrs(p1.getPathAttrs(), p2.getPathAttrs()) {
+ if p1.GetSource().Equal(p2.GetSource()) && isSamePathAttrs(p1.GetPathAttrs(), p2.GetPathAttrs()) {
return true
}
return false
diff --git a/table/path.go b/table/path.go
index 8734c513..12f7d498 100644
--- a/table/path.go
+++ b/table/path.go
@@ -122,7 +122,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor)
}
}
-func (path *Path) getTimestamp() time.Time {
+func (path *Path) GetTimestamp() time.Time {
return path.timestamp
}
@@ -130,7 +130,7 @@ func (path *Path) setTimestamp(t time.Time) {
path.timestamp = t
}
-func (path *Path) isLocal() bool {
+func (path *Path) IsLocal() bool {
var ret bool
if path.source.Address == nil {
ret = true
@@ -145,7 +145,7 @@ func (path *Path) ToApiStruct() *api.Path {
ret = append(ret, a.ToApiStruct())
}
return ret
- }(path.getPathAttrs())
+ }(path.GetPathAttrs())
return &api.Path{
Nlri: path.GetNlri().ToApiStruct(),
Nexthop: path.GetNexthop().String(),
@@ -239,7 +239,7 @@ func (path *Path) getMedSetByTargetNeighbor() bool {
return path.medSetByTargetNeighbor
}
-func (path *Path) getPathAttrs() []bgp.PathAttributeInterface {
+func (path *Path) GetPathAttrs() []bgp.PathAttributeInterface {
return path.pathAttrs
}
diff --git a/table/path_test.go b/table/path_test.go
index 976a5620..d973294a 100644
--- a/table/path_test.go
+++ b/table/path_test.go
@@ -14,13 +14,13 @@ import (
func TestPathNewIPv4(t *testing.T) {
peerP := PathCreatePeer()
pathP := PathCreatePath(peerP)
- ipv4p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].getPathAttrs(), pathP[0].getMedSetByTargetNeighbor(), time.Now())
+ ipv4p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].GetPathAttrs(), pathP[0].getMedSetByTargetNeighbor(), time.Now())
assert.NotNil(t, ipv4p)
}
func TestPathNewIPv6(t *testing.T) {
peerP := PathCreatePeer()
pathP := PathCreatePath(peerP)
- ipv6p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].getPathAttrs(), pathP[0].getMedSetByTargetNeighbor(), time.Now())
+ ipv6p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].GetPathAttrs(), pathP[0].getMedSetByTargetNeighbor(), time.Now())
assert.NotNil(t, ipv6p)
}
diff --git a/table/table.go b/table/table.go
index b3d21840..0c7bb653 100644
--- a/table/table.go
+++ b/table/table.go
@@ -58,12 +58,12 @@ func (t *Table) DeleteDestByPeer(peerInfo *PeerInfo) []*Destination {
changedDests := make([]*Destination, 0)
for _, dest := range t.destinations {
newKnownPathList := make([]*Path, 0)
- for _, p := range dest.getKnownPathList() {
+ for _, p := range dest.GetKnownPathList() {
if !p.GetSource().Equal(peerInfo) {
newKnownPathList = append(newKnownPathList, p)
}
}
- if len(newKnownPathList) != len(dest.getKnownPathList()) {
+ if len(newKnownPathList) != len(dest.GetKnownPathList()) {
changedDests = append(changedDests, dest)
dest.setKnownPathList(newKnownPathList)
}
@@ -83,7 +83,7 @@ func (t *Table) deleteDestByNlri(nlri bgp.AddrPrefixInterface) *Destination {
func (t *Table) deleteDest(dest *Destination) {
destinations := t.GetDestinations()
- delete(destinations, t.tableKey(dest.getNlri()))
+ delete(destinations, t.tableKey(dest.GetNlri()))
}
func (t *Table) validatePath(path *Path) {
diff --git a/table/table_manager.go b/table/table_manager.go
index 4a692d23..65ead593 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -138,7 +138,7 @@ func (manager *TableManager) calculate(destinationList []*Destination) ([]*Path,
log.WithFields(log.Fields{
"Topic": "table",
"Owner": manager.owner,
- "Key": destination.getNlri().String(),
+ "Key": destination.GetNlri().String(),
}).Debug("Processing destination")
newBestPath, reason, err := destination.Calculate(manager.localAsn)
@@ -156,7 +156,7 @@ func (manager *TableManager) calculate(destinationList []*Destination) ([]*Path,
log.WithFields(log.Fields{
"Topic": "table",
"Owner": manager.owner,
- "Key": destination.getNlri().String(),
+ "Key": destination.GetNlri().String(),
"peer": newBestPath.GetSource().Address,
"next_hop": newBestPath.GetNexthop().String(),
"reason": reason,
@@ -168,16 +168,16 @@ func (manager *TableManager) calculate(destinationList []*Destination) ([]*Path,
log.WithFields(log.Fields{
"Topic": "table",
"Owner": manager.owner,
- "Key": destination.getNlri().String(),
+ "Key": destination.GetNlri().String(),
}).Debug("best path is nil")
- if len(destination.getKnownPathList()) == 0 {
+ if len(destination.GetKnownPathList()) == 0 {
// create withdraw path
if currentBestPath != nil {
log.WithFields(log.Fields{
"Topic": "table",
"Owner": manager.owner,
- "Key": destination.getNlri().String(),
+ "Key": destination.GetNlri().String(),
"peer": currentBestPath.GetSource().Address,
"next_hop": currentBestPath.GetNexthop().String(),
}).Debug("best path is lost")
@@ -190,7 +190,7 @@ func (manager *TableManager) calculate(destinationList []*Destination) ([]*Path,
log.WithFields(log.Fields{
"Topic": "table",
"Owner": manager.owner,
- "Key": destination.getNlri().String(),
+ "Key": destination.GetNlri().String(),
}).Error("known path list is not empty")
}
} else {
@@ -207,14 +207,14 @@ func (manager *TableManager) calculate(destinationList []*Destination) ([]*Path,
destination.setBestPath(newBestPath)
}
- if len(destination.getKnownPathList()) == 0 && destination.GetBestPath() == nil {
+ if len(destination.GetKnownPathList()) == 0 && destination.GetBestPath() == nil {
rf := destination.getRouteFamily()
t := manager.Tables[rf]
t.deleteDest(destination)
log.WithFields(log.Fields{
"Topic": "table",
"Owner": manager.owner,
- "Key": destination.getNlri().String(),
+ "Key": destination.GetNlri().String(),
"route_family": rf,
}).Debug("destination removed")
}
@@ -297,8 +297,8 @@ func (adj *AdjRib) update(rib map[bgp.RouteFamily]map[string]*ReceivedRoute, pat
delete(rib[rf], key)
}
} else {
- if found && reflect.DeepEqual(old.path.getPathAttrs(), path.getPathAttrs()) {
- path.setTimestamp(old.path.getTimestamp())
+ if found && reflect.DeepEqual(old.path.GetPathAttrs(), path.GetPathAttrs()) {
+ path.setTimestamp(old.path.GetTimestamp())
}
rib[rf][key] = NewReceivedRoute(path, false)
}
diff --git a/table/table_manager_test.go b/table/table_manager_test.go
index 206b322e..5a875c9b 100644
--- a/table/table_manager_test.go
+++ b/table/table_manager_test.go
@@ -102,7 +102,7 @@ func TestProcessBGPUpdate_0_select_onlypath_ipv4(t *testing.T) {
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/24"
@@ -153,7 +153,7 @@ func TestProcessBGPUpdate_0_select_onlypath_ipv6(t *testing.T) {
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::/64"
@@ -237,7 +237,7 @@ func TestProcessBGPUpdate_1_select_high_localpref_ipv4(t *testing.T) {
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/24"
@@ -323,7 +323,7 @@ func TestProcessBGPUpdate_1_select_high_localpref_ipv6(t *testing.T) {
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::/64"
@@ -409,7 +409,7 @@ func TestProcessBGPUpdate_2_select_local_origin_ipv4(t *testing.T) {
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/24"
@@ -498,7 +498,7 @@ func TestProcessBGPUpdate_2_select_local_origin_ipv6(t *testing.T) {
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::/64"
@@ -555,7 +555,7 @@ func TestProcessBGPUpdate_3_select_aspath_ipv4(t *testing.T) {
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/24"
@@ -612,7 +612,7 @@ func TestProcessBGPUpdate_3_select_aspath_ipv6(t *testing.T) {
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::/64"
@@ -696,7 +696,7 @@ func TestProcessBGPUpdate_4_select_low_origin_ipv4(t *testing.T) {
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/24"
@@ -782,7 +782,7 @@ func TestProcessBGPUpdate_4_select_low_origin_ipv6(t *testing.T) {
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::/64"
@@ -866,7 +866,7 @@ func TestProcessBGPUpdate_5_select_low_med_ipv4(t *testing.T) {
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/24"
@@ -952,7 +952,7 @@ func TestProcessBGPUpdate_5_select_low_med_ipv6(t *testing.T) {
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::/64"
@@ -1038,7 +1038,7 @@ func TestProcessBGPUpdate_6_select_ebgp_path_ipv4(t *testing.T) {
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/24"
@@ -1125,7 +1125,7 @@ func TestProcessBGPUpdate_6_select_ebgp_path_ipv6(t *testing.T) {
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::/64"
@@ -1213,7 +1213,7 @@ func TestProcessBGPUpdate_7_select_low_routerid_path_ipv4(t *testing.T) {
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/24"
@@ -1300,7 +1300,7 @@ func TestProcessBGPUpdate_7_select_low_routerid_path_ipv6(t *testing.T) {
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::/64"
@@ -1386,7 +1386,7 @@ func TestProcessBGPUpdate_8_withdraw_path_ipv4(t *testing.T) {
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
@@ -1517,7 +1517,7 @@ func TestProcessBGPUpdate_8_mpunreach_path_ipv6(t *testing.T) {
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)
@@ -1616,7 +1616,7 @@ func TestProcessBGPUpdate_bestpath_lost_ipv4(t *testing.T) {
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)
@@ -1689,7 +1689,7 @@ func TestProcessBGPUpdate_bestpath_lost_ipv6(t *testing.T) {
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)
@@ -1773,7 +1773,7 @@ func TestProcessBGPUpdate_implicit_withdrwal_ipv4(t *testing.T) {
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
@@ -1882,7 +1882,7 @@ func TestProcessBGPUpdate_implicit_withdrwal_ipv6(t *testing.T) {
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,7 +1939,7 @@ func TestProcessBGPUpdate_multiple_nlri_ipv4(t *testing.T) {
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(rf bgp.RouteFamily, prefix, nexthop string, p *Path, m *bgp.BGPMessage) {
@@ -2078,7 +2078,7 @@ func TestProcessBGPUpdate_multiple_nlri_ipv6(t *testing.T) {
assert.Equal(t, expectedLocalpref, localpref)
// check PathAttribute length
- assert.Equal(t, len(pathAttributes), len(actual.getPathAttrs()))
+ assert.Equal(t, len(pathAttributes), len(actual.GetPathAttrs()))
}
@@ -2210,7 +2210,7 @@ func TestProcessBGPUpdate_Timestamp(t *testing.T) {
inList := adjRib.GetInPathList(bgp.RF_IPv4_UC)
assert.Equal(t, len(inList), 1)
- assert.Equal(t, inList[0].getTimestamp(), t1)
+ assert.Equal(t, inList[0].GetTimestamp(), t1)
med2 := bgp.NewPathAttributeMultiExitDisc(1)
pathAttributes2 := []bgp.PathAttributeInterface{
@@ -2222,12 +2222,12 @@ func TestProcessBGPUpdate_Timestamp(t *testing.T) {
m3 := bgp.NewBGPUpdateMessage(withdrawnRoutes, pathAttributes2, nlri)
pList3 := ProcessMessage(m3, peer)
- t3 := pList3[0].getTimestamp()
+ t3 := pList3[0].GetTimestamp()
adjRib.UpdateIn(pList3)
inList = adjRib.GetInPathList(bgp.RF_IPv4_UC)
assert.Equal(t, len(inList), 1)
- assert.Equal(t, inList[0].getTimestamp(), t3)
+ assert.Equal(t, inList[0].GetTimestamp(), t3)
}
func update_fromR1() *bgp.BGPMessage {