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

container inside container issue without leaf #2

Open
ravi-ski opened this issue May 8, 2023 · 0 comments
Open

container inside container issue without leaf #2

ravi-ski opened this issue May 8, 2023 · 0 comments

Comments

@ravi-ski
Copy link

ravi-ski commented May 8, 2023

Hi

bellow snippet is copied from yang file :
https://github.com/YangModels/yang/blob/main/experimental/ietf-extracted-YANG-modules/ietf-mac%402016-12-30.yang

container mac {
description
"MAC address forwarding. ";
container globalAttribute {
description
"MAC global attribute.";
leaf macAgeTimeEnable {
type macAgeTimeType;
default "enable";
description
"Whether MAC address aging is enabled.";

 }                                                                          
 leaf macAgingTime {                                                        
   when "not(../macAgeTimeEnable='disable') or                              
        ../macAgeTimeEnable='enable'";                                      
   type uint32 {                                                            
     range "60..1000000";                                                   
   }                                                                        
   default "300";                                                           
   description                                                              
     "Aging time.";                                                         
 }                                                                          

}

while using generator, failed to generate api files:

[INFO][CGenerator]: Generating API files:
dire name = mac_dir/src/plugin/api/mac
Traceback (most recent call last):
File "/home/workspace/sysrepo-plugin-generator/src/sysrepo-plugin-generator.py", line 42, in
generator.generate_files()
File "/home//workspace/sysrepo-plugin-generator/src/target/c/generator.py", line 327, in generate_files
self.__generate_api_files()
File "/home/workspace/sysrepo-plugin-generator/src/target/c/generator.py", line 430, in __generate_api_files
prefix, node_list = dir_functions[dir]
KeyError: 'mac_dir/src/plugin/api/mac'

With bellow workaround ( after adding leaf test-wa, api files where generated properly.
Could you please check is it a configuration issue or generator issue.

container mac {
description
"MAC address forwarding. ";

 **leaf test-wa{                                                              
   type boolean;                                                            
   default true;                                                            
   description                                                              
     "work around for key error while using plugin generator.";             
 }**                                                                          

container globalAttribute {
description
"MAC global attribute.";
leaf macAgeTimeEnable {
type macAgeTimeType;
default "enable";
description
"Whether MAC address aging is enabled.";

 }                                                                          
 leaf macAgingTime {                                                        
   when "not(../macAgeTimeEnable='disable') or                              
        ../macAgeTimeEnable='enable'";                                      
   type uint32 {                                                            
     range "60..1000000";                                                   
   }                                                                        
   default "300";                                                           
   description                                                              
     "Aging time.";                                                         
 }                                                                          

}

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

1 participant