diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-16 16:07:10 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-16 16:49:49 +0900 |
commit | 6b05d9db0f3e5aa2230d26083e800edc07b6d298 (patch) | |
tree | 5f48740cdce76c4c2d9daf9ca43011d1c417218a /internal/pkg/apiutil | |
parent | 8856dd599a7327bc099ed9cb4798539794d4dba7 (diff) |
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 <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'internal/pkg/apiutil')
-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 { |