Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support needed to get RouteAnyPrefix() leaf and AsPath() leaves for BGP Rib #67

Closed
cprabha opened this issue Feb 16, 2023 · 5 comments
Closed

Comments

@cprabha
Copy link

cprabha commented Feb 16, 2023

Hi,

I have to get AsPath for all the prefixes in rib . Below is not supported, please could you check,
I have highglighed unsupported leaf in bold.

rib := at.NetworkInstance(ap.Name()).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, fmt.Sprintf("bgp-%s", ap.Name())).Bgp().Rib()
prefixPath := rib.AfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Ipv4Unicast().
Neighbor(setup.DUTIPList[ap.ID()].String()).AdjRibInPre().RouteAnyPrefix(0).Prefix()
pref := gnmi.Get(t, dut, prefixPath.State())
asPath := gnmi.Get(t, dut, rib.AttrSetAny().AsPath().State())

Thanks,
Prabha

@greg-dennis
Copy link
Contributor

greg-dennis commented Feb 16, 2023

@cprabha, what do you mean by RouteAnyPrefix(0).Prefix()? The Route list has three keys: path-id, endpoint, and color. Is the 0 meant to be a path-id and you want to a wildcard for the endpoint and color? If so, that would be available as AdjRibInPre().RouteAny().WithPathId(0).Prefix()

Also, you won't see AsPath() because it is an enclosing container for the as-segment list, and ygnmi always elides enclosing container for lists. If you want all the segments of the as-path use AttrSetAny().AsSegmentAny()

@cprabha
Copy link
Author

cprabha commented Feb 16, 2023

Thanks Greg,
It worked fine with AdjRibInPre().RouteAny().WithPathId(0).Prefix() and AttrSetAny().AsSegmentAny().

@cprabha cprabha closed this as completed Feb 16, 2023
@cprabha
Copy link
Author

cprabha commented Feb 16, 2023

@greg-dennis ,
asPath := gnmi.GetAll(t, ate, rib.AttrSetAny().AsSegmentAny().State()) ==> this is returning pointer instead of value .
Can you please check ?

Output

asPath
[]github.com/openconfig/ondatra/gnmi/oc.NetworkInstance_Protocol_Bgp_Rib_AttrSet_AsSegment len: 200, cap: 200, [{Index: 0, Member: []uint32 len: 5, cap: 8, [64500,64500,64500,64500,64502], Type: RibBgp_AsPathSegmentType_AS_SEQ (1)},{Index: *0, Member: ...
[0..99]:
[0]: *github.com/openconfig/ondatra/gnmi/oc.NetworkInstance_Protocol_Bgp_Rib_AttrSet_AsSegment {Index: *0, Member: []uint32 len: 5, cap: 8, [64500,64500,64500,64500,64502], Type: RibBgp_AsPathSegmentType_AS_SEQ (1)}
[1]: *github.com/openconfig/ondatra/gnmi/oc.NetworkInstance_Protocol_Bgp_Rib_AttrSet_AsSegment {Index: *0, Member: []uint32 len: 5, cap: 8, [64500,64500,64500,64500,64502], Type: RibBgp_AsPathSegmentType_AS_SEQ (1)}

Thanks,
Prabha

@greg-dennis
Copy link
Contributor

@cprabha, GetAll is returning a list of all the segments, which should be expected. Does that make sense?

@cprabha
Copy link
Author

cprabha commented Feb 16, 2023

got it, Thanks Greg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants