I am using the pyang version supplied with ConfD package to sanitize the yang files. We are seeing error when supplied a deviation file with “–deviation-module” or “–deviation-module=”
/usr/bin/pyang -V -p /usr/src/confd/snmp/yang:/usr/share/f5-yang:openconfig:/usr/share/openconfig/lldp:/usr/share/openconfig/interfaces \
--tailf-sanitize \
--tailf-keep-info \
--tailf-keep-display-when \
--tailf-keep-actions \
--ignore-errors \
openconfig/openconfig-if-aggregate.yang \
-f yang \
-a f5-if-aggregate-ann.yang \
--deviation-module f5-openconfig-if-aggregate-deviations.yang \
-o yang-sanity/openconfig-if-aggregate.yang
Traceback (most recent call last):
File "/usr/lib/pyang/bin/pyang", line 411, in <module>
run()
File "/usr/lib/pyang/bin/pyang", line 307, in run
m = ctx.add_module(filename, text)
File "/usr/lib/pyang/pyang/__init__.py", line 103, in add_module
return self.add_parsed_module(module)
File "/usr/lib/pyang/pyang/__init__.py", line 132, in add_parsed_module
statements.validate_module(self, module)
File "/usr/lib/pyang/pyang/statements.py", line 96, in validate_module
iterate(module, phase)
File "/usr/lib/pyang/pyang/statements.py", line 91, in iterate
iterate(s, phase)
File "/usr/lib/pyang/pyang/statements.py", line 91, in iterate
iterate(s, phase)
File "/usr/lib/pyang/pyang/statements.py", line 53, in iterate
res = f(ctx, stmt)
File "/usr/lib/pyang/pyang/statements.py", line 214, in <lambda>
('reference_3', 'deviate'):lambda ctx, s:v_reference_deviate(ctx, s),
File "/usr/lib/pyang/pyang/statements.py", line 1896, in v_reference_deviate
idx = t.parent.substmts.index(t)
ValueError: <pyang.statements.Statement object at 0x7f6e04699b90> is not in list
make: *** [Makefile:476: openconfig-if-aggregate.swagger] Error 1
[root@partition-manager-builder partition-manager]#
Where as I could see yanger
is working and generating pyang file with the same set of annotation and deviation files.
Dependencies openconfig/openconfig-if-aggregate.yang f5-if-aggregate-ann.yang f5-openconfig-if-aggregate-deviations.yang
/usr/bin/yanger -p /usr/src/confd/snmp/yang:/usr/share/f5-yang:openconfig:/usr/share/openconfig/lldp:/usr/share/openconfig/interfaces \
-f tree \
--tailf-annotation-module f5-if-aggregate-ann.yang \
--deviation-module f5-openconfig-if-aggregate-deviations.yang \
openconfig/openconfig-if-aggregate.yang > openconfig-if-aggregate.pyang
[root@partition-manager-builder partition-manager]#
Can let me know how to supply deviation modules to pyang for yang sanitization?