diff --git a/route/bgp_path.go b/route/bgp_path.go index 598f63f9..46a06c9b 100644 --- a/route/bgp_path.go +++ b/route/bgp_path.go @@ -125,6 +125,7 @@ func (b *BGPPath) ToProto() *api.BGPPath { // BGPPathFromProtoBGPPath converts a proto BGPPath to BGPPath func BGPPathFromProtoBGPPath(pb *api.BGPPath, dedup bool) *BGPPath { + asPath := types.ASPathFromProtoASPath(pb.AsPath) p := &BGPPath{ BGPPathA: &BGPPathA{ NextHop: bnet.IPFromProtoIP(pb.NextHop).Ptr(), @@ -138,7 +139,8 @@ func BGPPathFromProtoBGPPath(pb *api.BGPPath, dedup bool) *BGPPath { OnlyToCustomer: pb.OnlyToCustomer, }, PathIdentifier: pb.PathIdentifier, - ASPath: types.ASPathFromProtoASPath(pb.AsPath), + ASPath: asPath, + ASPathLen: asPath.Length(), BMPPostPolicy: pb.BmpPostPolicy, } diff --git a/route/bgp_path_test.go b/route/bgp_path_test.go index 83235143..221a164d 100644 --- a/route/bgp_path_test.go +++ b/route/bgp_path_test.go @@ -75,6 +75,7 @@ func TestBGPPathFromProtoBGPPath(t *testing.T) { }, }, }, + ASPathLen: 2, Communities: &types.Communities{100, 200, 300}, LargeCommunities: &types.LargeCommunities{