Code Monkey home page Code Monkey logo

Comments (6)

robshakir avatar robshakir commented on June 26, 2024 2

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 update the config vs. replace it -- or include other parameters.

You can just take the JSON that is output by ygot and provide it to the device as a json_ietf_val in the gNMI TypedValue message.

The ygnmi library has some helpers around using gNMI, particularly with OpenConfig schemas, and would also provide some primitives around update and replace.

from ygot.

wenovus avatar wenovus commented on June 26, 2024 1

Agreed with Rob. ygnmi is very useful if you're interested in a lot of interactions with a gNMI server.

from ygot.

ejbrever avatar ejbrever commented on June 26, 2024 1

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")
i.Description = ygot.String("test_gnmi_ygot_pipeline")

ipv4 := i.GetOrCreateIpv4().GetOrCreateAddresses().GetOrCreateAddress()
ipv4.Address = ygot.String("1.1.1.1")
ipv4.Netmask = ygot.String("255.255.255.255")

ipv6 := i.GetOrCreateIpv6().GetOrCreateAddresses().GetOrCreateIpv6Address("9000::1")
ipv6.PrefixLength = ygot.Uint8(128)
ipv6.Zone = ygot.String("0")

You might just need to add the necessary flags for ygot to generate this. (i.e. -generate_append -generate_getters)

from ygot.

wenovus avatar wenovus commented on June 26, 2024 1

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.

from ygot.

pedroaston avatar pedroaston commented on June 26, 2024

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.
image
Still need to manually assemble the yang leaf path.

@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?

from ygot.

pedroaston avatar pedroaston commented on June 26, 2024

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

from ygot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.