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

Can't generate OC-YANG network-instance #977

Closed
qin-nz opened this issue Jun 17, 2024 · 2 comments
Closed

Can't generate OC-YANG network-instance #977

qin-nz opened this issue Jun 17, 2024 · 2 comments

Comments

@qin-nz
Copy link
Member

qin-nz commented Jun 17, 2024

ygot version: latest c52408e2
OC-YANG version: latest c00868ed

Run following command:

OC_ROOT='~/code/github.com/openconfig/public'
go run ~/code/github.com/openconfig/ygot/generator/generator.go \
  -generate_fakeroot -fakeroot_name=device -compress_paths=true -shorten_enum_leaf_names -typedef_enum_with_defmod \
  -output_file=./ocyang.go -package_name=ocyang -path=$OC_ROOT -exclude_modules=ietf-interfaces \
  $OC_ROOT/release/models/network-instance/openconfig-network-instance.yang

Got errors:

F0617 14:33:56.501129 4170258 generator.go:384] ERROR Generating GoStruct Code: path "/openconfig-network-instance/network-instances/network-instance/protocols/protocol/isis/interfaces/interface/weighted-ecmp/config/load-balancing-weight": default value not supported for wrapper union values, please generate using simplified union leaves

Is it a bug ? (Maybe releate to #582 #613 #961 )

@wenovus
Copy link
Collaborator

wenovus commented Jun 17, 2024

This was due to a feature addition for union leaf defaults some time ago.

Are you able to modify your downstream code to use the flag generate_simple_unions?

The recommended list of enum flags to use is

 -shorten_enum_leaf_names \ 
 -trim_enum_openconfig_prefix \ 
 -typedef_enum_with_defmod \ 
 -enum_suffix_for_simple_union_enums \ 
 -generate_simple_unions \

ygot/exampleoc/update.sh

Lines 18 to 29 in c52408e

-package_name=exampleoc -generate_fakeroot -fakeroot_name=device -compress_paths=true \
-shorten_enum_leaf_names \
-trim_enum_openconfig_prefix \
-typedef_enum_with_defmod \
-enum_suffix_for_simple_union_enums \
-exclude_modules=ietf-interfaces \
-generate_rename \
-generate_append \
-generate_getters \
-generate_leaf_getters \
-generate_populate_defaults \
-generate_simple_unions \

@qin-nz
Copy link
Member Author

qin-nz commented Jun 18, 2024

Thanks a lot ~

@qin-nz qin-nz closed this as completed Jun 18, 2024
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