Skip to content

python generated bundle class fails instantiate when model contains leaf 'logger' #996

@ygorelik

Description

@ygorelik

Current Behavior

When using IOS XE 16.12.1 Yang models, which contain leaf 'logger' in Cisco-IOS-XE-aaa.yang, the corresponding generated python class Native.Aaa.Accounting.Onep.Default.StartStop() fails instantiate yielding error:

ydk.errors.YModelError: Invalid value None for 'logger'. Got type: 'NoneType'. Expected types: 'Empty'

Steps to Reproduce

Generate bundle for IOS XE 16.12.1 then run simple script:

from ydk.models.cisco_ios_xe_16121 import Cisco_IOS_XE_native as xe_native

native = xe_native.Native()

Logs

File "ydk_config_gen_vlan.py", line 115, in <module>
    native = xe_native.Native()

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/models/cisco_ios_xe/Cisco_IOS_XE_native.py", line 1328, in __init__
    self.aaa = Native.Aaa()

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/models/cisco_ios_xe/Cisco_IOS_XE_native.py", line 1699076, in __init__
    self.accounting = Native.Aaa.Accounting()

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/models/cisco_ios_xe/Cisco_IOS_XE_native.py", line 1707588, in __init__
    self.onep = Native.Aaa.Accounting.Onep()

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/models/cisco_ios_xe/Cisco_IOS_XE_native.py", line 1709444, in __init__
    self.default = Native.Aaa.Accounting.Onep.Default()

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/models/cisco_ios_xe/Cisco_IOS_XE_native.py", line 1709503, in __init__
    self.start_stop = Native.Aaa.Accounting.Onep.Default.StartStop()

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/models/cisco_ios_xe/Cisco_IOS_XE_native.py", line 1709580, in __init__
    self.logger = None

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/models/cisco_ios_xe/Cisco_IOS_XE_native.py", line 1709602, in __setattr__
    self._perform_setattr(Native.Aaa.Accounting.Onep.Default.StartStop, [u'broadcast', u'logger'], name, value)

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/types/py_types.py", line 390, in _perform_setattr
    _validate_value(self._leafs[name], name, value, self.logger)

  File "/home/vagrant/venv/lib/python3.6/site-packages/ydk/types/py_types.py", line 847, in _validate_value
    raise _YModelError(err_msg)

ydk.errors.YModelError: Invalid value None for 'logger'. Got type: 'NoneType'. Expected types: 'Empty'

System Information

(venv) Yakovs-Air:ydk-gen ygorelik$ pip list | grep ydk
ydk                           0.8.4.post1
ydk-models-cisco-ios-xe-16121 16.12.1   

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions