yang
yang copied to clipboard
Consider default in use
Normally, it's okay to use 'create' operation on a node when it does not exist in a configuration data tree. However, if there are default values in use, 'create' operation could be invalid. The PR fixes this scenario when generating Netconf edit-config.
Unit tests are added.
(pyats-2401) [yuekyang@yangtest-lnx tests]$ python -m unittest test_ncdiff
Error in Netconf reply when getting /netconf-state/schemas from YANG module 'ietf-netconf-monitoring':
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<rpc-error>
<error-type>rpc</error-type>
<error-tag>missing-attribute</error-tag>
<error-severity>error</error-severity>
<error-info>
<bad-attribute>message-id</bad-attribute>
<bad-element>rpc</bad-element>
</error-info>
</rpc-error>
</rpc-reply>
Error in Netconf reply when getting /modules-state/module from YANG module 'ietf-yang-library':
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<rpc-error>
<error-type>rpc</error-type>
<error-tag>missing-attribute</error-tag>
<error-severity>error</error-severity>
<error-info>
<bad-attribute>message-id</bad-attribute>
<bad-element>rpc</bad-element>
</error-info>
</rpc-error>
</rpc-reply>
........................................
----------------------------------------------------------------------
Ran 40 tests in 0.593s
OK
(pyats-2401) [yuekyang@yangtest-lnx tests]$ python -m unittest test_running_config
...........................................
----------------------------------------------------------------------
Ran 43 tests in 0.030s
OK
(pyats-2401) [yuekyang@yangtest-lnx tests]$