CiscoDevNet / ydk-gen

Generate model-driven APIs from YANG models
http://ciscodevnet.github.io/ydk-gen/
Apache License 2.0
136 stars 74 forks source link

No meta data for bits type defined in typedef statement #937

Open ygorelik opened 5 years ago

ygorelik commented 5 years ago

Current Behavior

When yang model contains typedef statement, which defines bits type, the generated bundle defines corresponding class, but its meta data is missing.

Steps to Reproduce

  1. Take yang model which contains typedef statement defining bits type. Example from ydktest-types.yang:
  typedef Ydk-bits-type {
    description "this is bits type value";
    type bits {
      bit disable-nagle {
        position 0;
      }
      bit auto-sense-speed {
        position 1;
      }
    }
  }
  1. Generate bundle, which includes the specified yang file.
  2. Check that generated file _ydktesttypes.py contains definition of corresponding class:

    class YdkBitsType(FixedBitsDict):
    """
    YdkBitsType
    
    this is bits type value
    Keys are:- auto\-sense\-speed , disable\-nagle
    
    """
    
    def __init__(self):
        dictionary_ = { 
            'auto-sense-speed': False,
            'disable-nagle': False,
        }
        pos_map_ = { 
            'auto-sense-speed': 1,
            'disable-nagle': 0,
        }
        super().__init__(dictionary_, pos_map_)
  3. Check the meta data file _./_meta/_ydktesttypes.py, note that metatable is missing component MetaInfoClass_, which describes class YdkBitsType.

System Information

YDK-0.5.5 and 0.8.3.

ygorelik commented 5 years ago

Applicable only to YDK-0.5.5 as 'bits' type is implemented in C++.