From 6b05d9db0f3e5aa2230d26083e800edc07b6d298 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 16 Nov 2018 16:07:10 +0900 Subject: api: rename NlriAny in api.Path to Nlri Also rename PathAttrsAny to PathAttrs. Both are the first choice rather than the binary format members. Support SortType member to ListPathRequest to add an option to return unordered paths. Signed-off-by: FUJITA Tomonori --- internal/pkg/apiutil/util.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'internal/pkg/apiutil') 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 { -- cgit v1.2.3