MCPcopy
hub / github.com/osrg/gobgp / NewAsPathAttributeFromNative

Function NewAsPathAttributeFromNative

pkg/apiutil/attribute.go:320–331  ·  view source on GitHub ↗
(a *bgp.PathAttributeAsPath)

Source from the content-addressed store, hash-verified

318}
319
320func NewAsPathAttributeFromNative(a *bgp.PathAttributeAsPath) (*api.AsPathAttribute, error) {
321 segments := make([]*api.AsSegment, 0, len(a.Value))
322 for _, param := range a.Value {
323 segments = append(segments, &api.AsSegment{
324 Type: api.AsSegment_Type(param.GetType()),
325 Numbers: param.GetAS(),
326 })
327 }
328 return &api.AsPathAttribute{
329 Segments: segments,
330 }, nil
331}
332
333func NewNextHopAttributeFromNative(a *bgp.PathAttributeNextHop) (*api.NextHopAttribute, error) {
334 return &api.NextHopAttribute{

Callers 2

MarshalPathAttributesFunction · 0.85
Test_AsPathAttributeFunction · 0.85

Calls 3

AsSegment_TypeTypeAlias · 0.92
GetTypeMethod · 0.65
GetASMethod · 0.65

Tested by 1

Test_AsPathAttributeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…