-
Notifications
You must be signed in to change notification settings - Fork 73
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
Go YDK fails to build unique types for cascading typedef statements in Yang model #675
Comments
Also: |
- update generator to differentiate typedefs with the same base type - added sanity test case - generated documentation is wrong (api model/builder issue)
- update generator to differentiate typedefs with the same base type - added sanity test case - generated documentation is wrong (api model/builder issue)
The reason why the go docstring comment is wrong: In the class constructor printer, we’re printing both the comment and the leaf at the same time by iterating through the class’s owned_elements, which is a list containing Property objects representing the leafs. The Property object’s property_type is used to create the comment. Notable lines in code: In the api builder, we fetch the type statement using the types extractor and pair the type statement with its corresponding Enum object (specifically by setting enum_type_stmt.parent.i_enum). This Enum object is then used to define the Property object and its property_type field. Notably, the types extractor returns the same enum_type_stmt for the statements representing CompInsttype and CompNicinsttype. Notable lines in code: Useful breakpoints:
|
- update generator to differentiate typedefs with the same base type - added sanity test case - generated documentation is wrong (api model/builder issue)
I've committed fixes that prevent the code from failing for now, but the issue with the api builder causes the documentation to be incorrect in both go and cpp. |
The #891 was resolved in YDK-0.8.2. There are no more code duplication and XE bundle in Go is compiling fine. Hence closing the issue. |
Steps to Reproduce
Include the following statements (taken from NXOS) into Yang model and then build go bundle:
In this model the "comp_NicInstType" type "cascades" or "repeats" definition of "comp_InstType"
The Go API builder creates duplicate statements like this one, which causes compiler syntax error
// CompInstType
type CompInstType int
const (
CompInstType_unknown CompInstType = 0
CompInstType_phys CompInstType = 1
CompInstType_virt CompInstType = 2
CompInstType_hv CompInstType = 3
)
The type CompNicInstType does not appear in the Go code.
Additional notes
The issue does not appear in C++ and Python bundle builders.
Logs
TBD
System Information
Ubuntu 14.1
The text was updated successfully, but these errors were encountered: