diff options
Diffstat (limited to 'table/destination.go')
-rw-r--r-- | table/destination.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/table/destination.go b/table/destination.go index 7e0deb2b..3a1c1c45 100644 --- a/table/destination.go +++ b/table/destination.go @@ -18,6 +18,7 @@ package table import ( "bytes" "encoding/binary" + "encoding/json" "fmt" "net" "sort" @@ -124,11 +125,11 @@ type Destination struct { RadixKey string } -func NewDestination(nlri bgp.AddrPrefixInterface) *Destination { +func NewDestination(nlri bgp.AddrPrefixInterface, known ...*Path) *Destination { d := &Destination{ routeFamily: bgp.AfiSafiToRouteFamily(nlri.AFI(), nlri.SAFI()), nlri: nlri, - knownPathList: make([]*Path, 0), + knownPathList: known, withdrawList: make([]*Path, 0), newPathList: make([]*Path, 0), } @@ -856,6 +857,10 @@ type DestinationSelectOption struct { adj bool } +func (d *Destination) MarshalJSON() ([]byte, error) { + return json.Marshal(d.GetAllKnownPathList()) +} + func (old *Destination) Select(option ...DestinationSelectOption) *Destination { id := GLOBAL_RIB_NAME var vrf *Vrf |