-
Notifications
You must be signed in to change notification settings - Fork 105
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
[Question] From ygot gostruct or emittedJSON to gNMI Set Update #962
Comments
There isn't a standard package here because there are different ways that one might need to apply the config. For example, maybe you want to You can just take the JSON that is output by The |
Agreed with Rob. ygnmi is very useful if you're interested in a lot of interactions with a gNMI server. |
FYI, I know it's not the question you asked, but because I was looking at the similar Cisco schema recently, just wanted to share that you might want to use the helper funcs ygot supports, which really help with readability. I think roughly your code above would be the following (no long struct names, no initializing vars, you can work down the hierarchy of the model, and if you get autocomplete working on the generated structs, this just takes a few minutes to type out). i := device.GetOrCreateInterfaces().GetOrCreateInterface("Loopback666") ipv4 := i.GetOrCreateIpv4().GetOrCreateAddresses().GetOrCreateAddress() ipv6 := i.GetOrCreateIpv6().GetOrCreateAddresses().GetOrCreateIpv6Address("9000::1") You might just need to add the necessary flags for ygot to generate this. (i.e. -generate_append -generate_getters) |
Hey! Thank you all for the feedback 👍 I followed @robshakir's hint and placed the interface yang leaf in as a TypedValue. The below snippet configures a loopback interface on a router successfully. @wenovus I saw on another issue that you were looking into developing path struct generation without compressed paths. Have you abandoned it? I haven't properly checked ygnmi helpers. I may give it a better look in the future. PS: For question/discussion-related topics is there an openconfig slack or forum like space? |
Do you have a link to the issue? I probably need to update it if it's still an open issue. ygnmi already supports uncompressed structs as of this commit: openconfig/ygnmi@5559c6e The path struct generation in ygot is deprecated. It is planned to be deleted prior to v1 release (work which is currently on-pause). Per the OpenConfig website GitHub issues are the preferred channel: https://openconfig.net/about/contribute/. There is a also a public forum linked there but it's lower volume than the GitHub repos. |
Hey! It was issue #888. However, now that I've read it again, you did mention that path struct generation was implemented in ygnmi in that issue. I will check the path struct generation there. Closing this one. Thanks |
Hey there! I've been exploring the ygot package and played with generated code from the Cisco interfaces yang models. I manage to create manually (for now) with the code below, a perfect replica of the json model inside the router.
Code used to manually assemble:
![image](https://private-user-images.githubusercontent.com/36762762/318520157-f9eda1d9-f095-4812-926f-fdb54efcda28.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NTQ0MDAsIm5iZiI6MTcxOTY1NDEwMCwicGF0aCI6Ii8zNjc2Mjc2Mi8zMTg1MjAxNTctZjllZGExZDktZjA5NS00ODEyLTkyNmYtZmRiNTRlZmNkYTI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA5NDE0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYzMzU0MGRhNzgzZGZjYTMxZGI2MmUzN2JiYjMxMzU0YTZiZWY1ZjM1YzFlNzY2NjRiOGEyN2JlZDg2YTYyZTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nrXAIrDYFme7Rf_r2tgQDnGN3_13_pMWtCxou4ejGfo)
Resulting JSON:
![image](https://private-user-images.githubusercontent.com/36762762/318520546-8e8d5fac-6df5-456c-8b2b-3615352c33c8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2NTQ0MDAsIm5iZiI6MTcxOTY1NDEwMCwicGF0aCI6Ii8zNjc2Mjc2Mi8zMTg1MjA1NDYtOGU4ZDVmYWMtNmRmNS00NTZjLThiMmItMzYxNTM1MmMzM2M4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA5NDE0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYxNDI0MThhYTBiYWZiMTdlYzg3NTdlODUyN2I1MDMwYjFjMzQwOWQxMzlmOTViZDBhZmNlODIzNzllYzYwOWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.NHXdFMVxWOqYU64HpIea_yjxaB9Po10iGsnCcsvOusk)
From the examples and docs it seems the package currently does not transform a goStruct generated from the Yang into a gNMI SetRequest Update correct? Is there another openconfig package to tackle this issue?
Thanks 😄
The text was updated successfully, but these errors were encountered: