Comments (4)
ygot generates structures based on compiled data tree of the YANG model, not its logical constructs. This means that it resolves uses
statements and includes the contents of the specified grouping
within the struct. In your case then containers a
and b
- and thus the structs Top_A
and Top_B
- are only identical because only one grouping
is used. If two were used, then the two would differ, and hence we couldn't generate a single struct. This approach would also be very fragile to internal refactoring of the YANG schema that would not affect the data tree structure.
Our design philosophy is that users need to know as little about YANG as possible to consume the models. Thus, I don't expect that there is a case whereby we want to generate code for grouping
statements ever. What would the use case for this be? Could you elaborate on how it would overcome the above issues?
r.
from ygot.
@robshakir Thanks for your answer.
I'm having trouble with the following model.
module test {
yang-version 1;
namespace "http://example.com";
prefix "test";
grouping g {
container c {
leaf value {
type uint8;
}
}
}
container top {
container config {
uses g;
}
container state {
uses g;
}
}
}
If I use generator
with -compress_paths
option, generator
generates two structures named Top_C
and Top_C_
which corresponds to /test/top/config/c
or /test/top/state/c
but which corresponds to which is not deterministic and changes occasionally ( I think it is caused by the fact that map iteration is not ordered ).
This behavior causes trouble to the application which uses the generated go file since I need to change the structure name manually every time the naming changes.
I thought if we can use the same structure for grouping g
, we can solve this problem.
Another solution would be adding some naming scheme or config/state structure when -compress_paths
is used. WDYT?
from ygot.
from ygot.
I see. Thanks a lot for your answer.
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
- [Question] From ygot gostruct or emittedJSON to gNMI Set Update 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 1
- "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.