summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/apiutil/attribute.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-26 22:04:12 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-28 15:36:50 +0900
commit97ad6b32ee61fd439c2edefbc371f748cdf82046 (patch)
tree7e06da9270ed2fc826939f462662a75b9e7b1714 /internal/pkg/apiutil/attribute.go
parent23ac6ebb861a725273c6b663dc484becef55087c (diff)
api: change Family
fixes #1812 Avoid the cast and use strightforward data strcuture; two variables for afi and safi instead of squashing two into one variable. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'internal/pkg/apiutil/attribute.go')
-rw-r--r--internal/pkg/apiutil/attribute.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/pkg/apiutil/attribute.go b/internal/pkg/apiutil/attribute.go
index e149edbb..d87fff39 100644
--- a/internal/pkg/apiutil/attribute.go
+++ b/internal/pkg/apiutil/attribute.go
@@ -612,7 +612,7 @@ func NewMpReachNLRIAttributeFromNative(a *bgp.PathAttributeMpReachNLRI) *api.MpR
}
}
return &api.MpReachNLRIAttribute{
- Family: uint32(bgp.AfiSafiToRouteFamily(a.AFI, a.SAFI)),
+ Family: ToApiFamily(a.AFI, a.SAFI),
NextHops: nexthops,
Nlris: MarshalNLRIs(a.Value),
}
@@ -620,7 +620,7 @@ func NewMpReachNLRIAttributeFromNative(a *bgp.PathAttributeMpReachNLRI) *api.MpR
func NewMpUnreachNLRIAttributeFromNative(a *bgp.PathAttributeMpUnreachNLRI) *api.MpUnreachNLRIAttribute {
return &api.MpUnreachNLRIAttribute{
- Family: uint32(bgp.AfiSafiToRouteFamily(a.AFI, a.SAFI)),
+ Family: ToApiFamily(a.AFI, a.SAFI),
Nlris: MarshalNLRIs(a.Value),
}
}
@@ -1153,7 +1153,7 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
}
return bgp.NewPathAttributeClusterList(a.Ids), nil
case *api.MpReachNLRIAttribute:
- rf := bgp.RouteFamily(a.Family)
+ rf := ToRouteFamily(a.Family)
nlris, err := UnmarshalNLRIs(rf, a.Nlris)
if err != nil {
return nil, err
@@ -1182,7 +1182,7 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
attr.LinkLocalNexthop = linkLocalNexthop
return attr, nil
case *api.MpUnreachNLRIAttribute:
- rf := bgp.RouteFamily(a.Family)
+ rf := ToRouteFamily(a.Family)
nlris, err := UnmarshalNLRIs(rf, a.Nlris)
if err != nil {
return nil, err