Comments (6)
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.
Agreed with Rob. ygnmi is very useful if you're interested in a lot of interactions with a gNMI server.
from ygot.
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.
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.
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.
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.
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)
- ytypes.GetNode consumes more CPU & memory than the deprecated util.GetNode
- how to resolve the dependency for gribi HOT 2
- Diff api does generate deletes for leaf list values HOT 6
- Can enum preserve their defined values while converting yang to gostruct using openconfig/ygot\@v0.25.4/generator/generator.go ? HOT 3
- ygot.Diff don't respect presence containers HOT 9
- Mandatory module name in the generated struct names HOT 3
- Preserve YANG elements order when generating structs HOT 1
- Doesn't choice and case statement in YANG result in oneof fields in proto? HOT 2
- ygot Validate error, when yang leaf type is union
- When will ygot have support for bits datatype for yang to go conversion HOT 2
- Device Returns Array for Each Interface HOT 3
- Allow ytypes.SetNode on intermediate nodes in compressed mode
- Identity Support in Ygot HOT 1
- Union field has nil value after xml.Unmarshal HOT 6
- ytypes.Unmarshal() treating 50 as a float64 even though I am converting 50 to string before unmarshalling HOT 7
- How to set LeafrefOptions IgnoreMissingData for UnmarshalSetRequest HOT 2
- Can't generate OC-YANG network-instance HOT 2
- ResolveLeafrefTarget Not returning correct vlaue in case of List inside choice where list's key is a leafref HOT 2
- "default value not supported for wrapper union values" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ygot.