@@ -31,26 +31,26 @@ import (
3131func TestDestinationNewIPv4 (t * testing.T ) {
3232 peerD := DestCreatePeer ()
3333 pathD := DestCreatePath (peerD )
34- ipv4d := NewDestination (pathD [0 ].GetNlri (), 0 )
34+ ipv4d := newDestination (pathD [0 ].GetNlri (), 0 )
3535 assert .NotNil (t , ipv4d )
3636}
3737
3838func TestDestinationNewIPv6 (t * testing.T ) {
3939 peerD := DestCreatePeer ()
4040 pathD := DestCreatePath (peerD )
41- ipv6d := NewDestination (pathD [0 ].GetNlri (), 0 )
41+ ipv6d := newDestination (pathD [0 ].GetNlri (), 0 )
4242 assert .NotNil (t , ipv6d )
4343}
4444
4545func TestDestinationGetNlri (t * testing.T ) {
46- dd := & Destination {}
46+ dd := & destination {}
4747 nlri , _ := bgp .NewIPAddrPrefix (netip .MustParsePrefix ("10.110.123.1/24" ))
4848 dd .nlri = nlri
4949 r_nlri := dd .GetNlri ()
5050 assert .Equal (t , r_nlri , nlri )
5151
5252 nlri2 , _ := bgp .NewIPAddrPrefix (netip .MustParsePrefix ("10.110.123.2/24" ))
53- dd2 := NewDestination (nlri2 , 0 )
53+ dd2 := newDestination (nlri2 , 0 )
5454 r_nlri2 := dd2 .GetNlri ()
5555 assert .Equal (t , r_nlri2 , nlri2 )
5656}
@@ -69,7 +69,7 @@ func TestCalculate2(t *testing.T) {
6969 peer1 := & PeerInfo {AS : 1 , Address : netip .MustParseAddr ("1.1.1.1" )}
7070 path1 := ProcessMessage (update1 , peer1 , time .Now (), false )[0 ]
7171
72- d := NewDestination (nlri , 0 )
72+ d := newDestination (nlri , 0 )
7373 d .Calculate (logger , path1 )
7474
7575 // suppose peer2 sends grammaatically correct but semantically flawed update message
@@ -198,7 +198,7 @@ func TestTimeTieBreaker(t *testing.T) {
198198 peer2 := & PeerInfo {AS : 2 , LocalAS : 1 , Address : netip .MustParseAddr ("2.2.2.2" ), ID : netip .MustParseAddr ("2.2.2.2" )} // weaker router-id
199199 path2 := ProcessMessage (updateMsg , peer2 , time .Now ().Add (- 1 * time .Hour ), false )[0 ] // older than path1
200200
201- d := NewDestination (nlri , 0 )
201+ d := newDestination (nlri , 0 )
202202 d .Calculate (logger , path1 )
203203 d .Calculate (logger , path2 )
204204
@@ -207,7 +207,7 @@ func TestTimeTieBreaker(t *testing.T) {
207207
208208 // this option disables tie breaking by age
209209 SelectionOptions .ExternalCompareRouterId = true
210- d = NewDestination (nlri , 0 )
210+ d = newDestination (nlri , 0 )
211211 d .Calculate (logger , path1 )
212212 d .Calculate (logger , path2 )
213213
@@ -331,7 +331,7 @@ func TestMultipath(t *testing.T) {
331331 updateMsg = bgp .NewBGPUpdateMessage (nil , pathAttributes , []bgp.PathNLRI {{NLRI : nlri }})
332332 path2 := ProcessMessage (updateMsg , peer2 , time .Now (), false )[0 ]
333333
334- d := NewDestination (nlri , 0 )
334+ d := newDestination (nlri , 0 )
335335 d .Calculate (logger , path2 )
336336
337337 best , old , multi := d .Calculate (logger , path1 ).GetChanges (GLOBAL_RIB_NAME , 0 , false )
@@ -384,7 +384,7 @@ func TestMultipath(t *testing.T) {
384384
385385func TestIdMap (t * testing.T ) {
386386 nlri , _ := bgp .NewIPAddrPrefix (netip .MustParsePrefix ("10.10.0.101/24" ))
387- d := NewDestination (nlri , 64 )
387+ d := newDestination (nlri , 64 )
388388 for i := 0 ; ; i ++ {
389389 if id , err := d .localIdMap .FindandSetZeroBit (); err == nil {
390390 assert .Equal (t , uint (i + 1 ), id )
@@ -437,7 +437,7 @@ func TestDestination_Calculate_ExplicitWithdraw(t *testing.T) {
437437 p1 := NewPath (bgp .RF_IPv4_UC , peer1 , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
438438 p2 := NewPath (bgp .RF_IPv4_UC , peer2 , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
439439
440- d := NewDestination (nlri , 1 , p1 , p2 )
440+ d := newDestination (nlri , 1 , p1 , p2 )
441441
442442 // Test explicit withdraw
443443 withdrawPath := NewPath (bgp .RF_IPv4_UC , peer1 , bgp.PathNLRI {NLRI : nlri }, true , attrs , time .Now (), false )
@@ -457,7 +457,7 @@ func TestDestination_Calculate_ImplicitWithdraw(t *testing.T) {
457457
458458 // Create initial path
459459 p1 := NewPath (bgp .RF_IPv4_UC , peer1 , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
460- d := NewDestination (nlri , 0 , p1 )
460+ d := newDestination (nlri , 0 , p1 )
461461
462462 // Send new path from same peer (should trigger implicit withdraw)
463463 newAttrs := []bgp.PathAttributeInterface {
@@ -481,7 +481,7 @@ func TestDestination_GetBestPath_InvalidNexthop(t *testing.T) {
481481
482482 p1 := NewPath (bgp .RF_IPv4_UC , peer1 , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
483483
484- d := NewDestination (nlri , 0 , p1 )
484+ d := newDestination (nlri , 0 , p1 )
485485
486486 p1 .IsNexthopInvalid = false
487487 bestPath := d .GetBestPath ("" , 0 )
@@ -504,7 +504,7 @@ func TestDestination_Select_BestAndMultiPath(t *testing.T) {
504504 p1 := NewPath (bgp .RF_IPv4_UC , peer1 , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
505505 p2 := NewPath (bgp .RF_IPv4_UC , peer2 , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
506506
507- d := NewDestination (nlri , 0 , p1 , p2 )
507+ d := newDestination (nlri , 0 , p1 , p2 )
508508
509509 // Test best path selection
510510 selected := d .Select (DestinationSelectOption {Best : true })
@@ -650,7 +650,7 @@ func BenchmarkMultiPath(b *testing.B) {
650650
651651 b .Run ("Benchmark Calculate" , func (b * testing.B ) {
652652 for range b .N {
653- d := NewDestination (nlri , 0 )
653+ d := newDestination (nlri , 0 )
654654 b .StartTimer ()
655655 for j := range pathList {
656656 d .Calculate (logger , pathList [j ])
@@ -660,7 +660,7 @@ func BenchmarkMultiPath(b *testing.B) {
660660 })
661661
662662 b .Run ("Benchmark GetMultiBestPath" , func (b * testing.B ) {
663- d := NewDestination (nlri , 0 )
663+ d := newDestination (nlri , 0 )
664664 for j := range pathList {
665665 d .Calculate (logger , pathList [j ])
666666 }
@@ -682,7 +682,7 @@ func TestDestination_Calculate_AddAndWithdrawPath(t *testing.T) {
682682 p2 := NewPath (bgp .RF_IPv4_UC , nil , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
683683 nlri , _ = bgp .NewIPAddrPrefix (netip .MustParsePrefix ("13.2.5.0/24" ))
684684 p3 := NewPath (bgp .RF_IPv4_UC , nil , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
685- d := NewDestination (nlri , 0 , p1 , p2 , p3 )
685+ d := newDestination (nlri , 0 , p1 , p2 , p3 )
686686
687687 nlri , _ = bgp .NewIPAddrPrefix (netip .MustParsePrefix ("13.2.6.0/24" ))
688688 p4 := NewPath (bgp .RF_IPv4_UC , nil , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
@@ -696,7 +696,7 @@ func TestDestination_Calculate_AddAndWithdrawPath(t *testing.T) {
696696 // p1 is no implecit withdrawn
697697 nlri , _ = bgp .NewIPAddrPrefix (netip .MustParsePrefix ("13.2.3.0/24" ))
698698 p1 = NewPath (bgp .RF_IPv4_UC , nil , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), true )
699- d = NewDestination (nlri , 0 , p1 , p2 , p3 )
699+ d = newDestination (nlri , 0 , p1 , p2 , p3 )
700700 update = d .Calculate (logger , p4 )
701701 assert .Len (t , update .KnownPathList , 3 )
702702 assert .Len (t , update .KnownPathList , 3 )
@@ -708,7 +708,7 @@ func TestDestination_Calculate_AddAndWithdrawPath(t *testing.T) {
708708
709709 nlri , _ = bgp .NewIPAddrPrefix (netip .MustParsePrefix ("13.2.8.0/24" ))
710710 p5 := NewPath (bgp .RF_IPv4_UC , nil , bgp.PathNLRI {NLRI : nlri }, false , attrs , time .Now (), false )
711- d = NewDestination (nlri , 0 , p1 , p2 , p3 , p5 )
711+ d = newDestination (nlri , 0 , p1 , p2 , p3 , p5 )
712712 update = d .Calculate (logger , p4 )
713713
714714 assert .Len (t , update .KnownPathList , 4 )
0 commit comments