Closed tamilarasub closed 9 months ago
The bits
YANG type is not currently supported in pyangbind -- there have been a couple of requests - but it hasn't bubbled to the top of things that I have cycles to add right now. I'm happy to review a patch if you would like to contribute support. There was some existing work in https://github.com/robshakir/pyangbind/issues/155 which you might be able to base this on.
Thanks for your instant response. The ticket mentioned by you referring existing work is the current ticket id. Can you please provide me the actual ticket ID?
I believe the correct issue is #68. Is there any way to make pyangbind ignore building code for the bits type instead of it crashing?
It's been around 2 years for this issue, wondering if there is any ongoing work related to support of YANG built-in bits
type? I am facing similar issues with converting some Nokia YANG models that use this type:
# pyang --plugindir $PYBINDPLUGIN -f pybind -o nokia-conf-combined.py -p . nokia-combined/nokia-conf-combined.yang
could not find a match for types-bgp:ip-family-identifier-bits type -> ['bits']
could not find a match for types-bgp:bgp-family-type-bits type -> ['bits']
could not find a match for types-card:card-slot-bitmap type -> ['bits']
could not find a match for types-eth-cfm:mep-defect-flags type -> ['bits']
could not find a match for types-ipsec:multicast-protocol type -> ['bits']
could not find a match for types-l2tp:peer-roles type -> ['bits']
could not find a match for types-ldp:fec-type-bits type -> ['bits']
could not find a match for types-ldp:capabilities type -> ['bits']
could not find a match for types-ldp:fec-flags type -> ['bits']
could not find a match for types-ldp:label-status type -> ['bits']
could not find a match for types-lldp:system-capabilities type -> ['bits']
could not find a match for types-mpls:lsp-fc-bits type -> ['bits']
could not find a match for types-port:dwdm-wavetracker-report-alarms type -> ['bits']
could not find a match for types-port:ethernet-monitor-report-status type -> ['bits']
could not find a match for types-port:ethernet-report-alarms type -> ['bits']
could not find a match for types-port:coherent-optical-alarm type -> ['bits']
could not find a match for types-port:coherent-optical-defect-point type -> ['bits']
could not find a match for types-port:otu-report-alarms type -> ['bits']
could not find a match for types-port:sonet-report-alarms type -> ['bits']
could not find a match for types-port:tdm-report-alarm type -> ['bits']
could not find a match for types-port:transceiver-ddm-failure-bits type -> ['bits']
could not find a match for types-router:next-hop-flags type -> ['bits']
could not find a match for types-router:tunnel-flags type -> ['bits']
could not find a match for types-services:virt-scheduler-attribute type -> ['bits']
could not find a match for types-services:l2pt-protocols type -> ['bits']
could not find a match for types-services:eth-cfm-monitoring-bits type -> ['bits']
could not find a match for types-services:l2-sap-oper-flags type -> ['bits']
could not find a match for types-services:l3-sap-oper-flags type -> ['bits']
could not find a match for types-sros:cbf-classes type -> ['bits']
Traceback (most recent call last):
File "/usr/local/bin/pyang", line 533, in <module>
run()
File "/usr/local/bin/pyang", line 502, in run
emit_obj.emit(ctx, modules, fd)
File "/usr/local/lib/python3.8/site-packages/pyangbind/plugin/pybind.py", line 222, in emit
build_pybind(ctx, modules, fd)
File "/usr/local/lib/python3.8/site-packages/pyangbind/plugin/pybind.py", line 407, in build_pybind
build_typedefs(ctx, defn['typedef'])
File "/usr/local/lib/python3.8/site-packages/pyangbind/plugin/pybind.py", line 560, in build_typedefs
raise TypeError("could not resolve typedefs %s" % error_ids)
TypeError: could not resolve typedefs ['types-bgp:ip-family-identifier-bits', 'types-bgp:bgp-family-type-bits', 'types-card:card-slot-bitmap', 'types-eth-cfm:mep-defect-flags', 'types-ipsec:multicast-protocol', 'types-l2tp:peer-roles', 'types-ldp:fec-type-bits', 'types-ldp:capabilities', 'types-ldp:fec-flags', 'types-ldp:label-status', 'types-lldp:system-capabilities', 'types-mpls:lsp-fc-bits', 'types-port:dwdm-wavetracker-report-alarms', 'types-port:ethernet-monitor-report-status', 'types-port:ethernet-report-alarms', 'types-port:coherent-optical-alarm', 'types-port:coherent-optical-defect-point', 'types-port:otu-report-alarms', 'types-port:sonet-report-alarms', 'types-port:tdm-report-alarm', 'types-port:transceiver-ddm-failure-bits', 'types-router:next-hop-flags', 'types-router:tunnel-flags', 'types-services:virt-scheduler-attribute', 'types-services:l2pt-protocols', 'types-services:eth-cfm-monitoring-bits', 'types-services:l2-sap-oper-flags', 'types-services:l3-sap-oper-flags', 'types-sros:cbf-classes']
Support for bits type added in https://github.com/robshakir/pyangbind/pull/315
Hi,
I am trying to create a typedef for bits, but pyangbind is throwing error. But for other types (i.e. enum.. ) it is working fine. Am I missing anything?
Here is the file "debug-type.yang" module debug-type { namespace "http://example.com/debug-type"; prefix "debug-type"; typedef DEBUG_T{ type bits { bit encode { position 0; } bit decode { position 1; } } } }
Error: root@instance-000001a0:~/yang# pyang --plugindir $PYBINDPLUGIN -f pybind -o binding.py debug-type.yang could not find a match for debug-type:DEBUG_T type -> [u'bits'] Traceback (most recent call last): File "/usr/local/bin/pyang", line 455, in
run()
File "/usr/local/bin/pyang", line 424, in run
emit_obj.emit(ctx, modules, fd)
File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 224, in emit
build_pybind(ctx, modules, fd)
File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 412, in build_pybind
build_typedefs(ctx, defn['typedef'])
File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 563, in build_typedefs
raise TypeError("could not resolve typedefs %s" % error_ids)
TypeError: could not resolve typedefs [u'debug-type:DEBUG_T']