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

odd question #17

Open
snmpboy opened this issue Aug 8, 2024 · 2 comments
Open

odd question #17

snmpboy opened this issue Aug 8, 2024 · 2 comments

Comments

@snmpboy
Copy link

snmpboy commented Aug 8, 2024

Since there are few people writing issues, I will ask what may be a dumb question. Yang-rs will nicely output xml from a yang model. At least when I feed it a YANG model it has done so. Is it possible to build a huge data tree structure to keep in memory. Maybe two trees. One for config and one for data (state) since RFC's seem to keep those separate as do the models I have seen so far. If that can be done, then you can create a restful API with JSON payloads that would simply build out the XML and then send it to the device and get what you want. In some cases like lists, no JSON payload is necessary, just send back all items in the list. Is this feasible?

@rwestphal
Copy link
Member

Hi @snmpboy. My apologies for the late reply, I was traveling.

Is it possible to build a huge data tree structure to keep in memory. Maybe two trees. One for config and one for data (state) since RFC's seem to keep those separate as do the models I have seen so far.

Yes, definitely. You can either use the same or separate trees for config and state, depending on your requirements.

If that can be done, then you can create a restful API with JSON payloads that would simply build out the XML and then send it to the device and get what you want. In some cases like lists, no JSON payload is necessary, just send back all items in the list. Is this feasible?

Sure. In the Holo routing stack, for example, there's a gRPC frontend that works more or less like that. You can feed JSON payloads to change the running configuration, or request state data in the JSON format, among several other things.

Links for reference:

So yes, you could create a restful API similar to that. Let me know if that answers your question.

@snmpboy
Copy link
Author

snmpboy commented Aug 22, 2024 via email

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