diff options
Diffstat (limited to 'internal/pkg/apiutil/util.go')
-rw-r--r-- | internal/pkg/apiutil/util.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/pkg/apiutil/util.go b/internal/pkg/apiutil/util.go index 7c4aabc3..1dd25c79 100644 --- a/internal/pkg/apiutil/util.go +++ b/internal/pkg/apiutil/util.go @@ -68,8 +68,8 @@ func NewDestination(dst *api.Destination) *Destination { func NewPath(nlri bgp.AddrPrefixInterface, isWithdraw bool, attrs []bgp.PathAttributeInterface, age time.Time) *api.Path { t, _ := ptypes.TimestampProto(age) return &api.Path{ - AnyNlri: MarshalNLRI(nlri), - AnyPattrs: MarshalPathAttributes(attrs), + Nlri: MarshalNLRI(nlri), + Pattrs: MarshalPathAttributes(attrs), Age: t, IsWithdraw: isWithdraw, Family: ToApiFamily(nlri.AFI(), nlri.SAFI()), @@ -90,17 +90,17 @@ func getNLRI(family bgp.RouteFamily, buf []byte) (bgp.AddrPrefixInterface, error } func GetNativeNlri(p *api.Path) (bgp.AddrPrefixInterface, error) { - if len(p.Nlri) > 0 { - return getNLRI(ToRouteFamily(p.Family), p.Nlri) + if len(p.NlriBinary) > 0 { + return getNLRI(ToRouteFamily(p.Family), p.NlriBinary) } - return UnmarshalNLRI(ToRouteFamily(p.Family), p.AnyNlri) + return UnmarshalNLRI(ToRouteFamily(p.Family), p.Nlri) } func GetNativePathAttributes(p *api.Path) ([]bgp.PathAttributeInterface, error) { - pattrsLen := len(p.Pattrs) + pattrsLen := len(p.PattrsBinary) if pattrsLen > 0 { pattrs := make([]bgp.PathAttributeInterface, 0, pattrsLen) - for _, attr := range p.Pattrs { + for _, attr := range p.PattrsBinary { a, err := bgp.GetPathAttribute(attr) if err != nil { return nil, err @@ -113,7 +113,7 @@ func GetNativePathAttributes(p *api.Path) ([]bgp.PathAttributeInterface, error) } return pattrs, nil } - return UnmarshalPathAttributes(p.AnyPattrs) + return UnmarshalPathAttributes(p.Pattrs) } func ToRouteFamily(f *api.Family) bgp.RouteFamily { |