You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pyang's YIN parser improperly handles imports by revision for my carefully crafted test case. It dismisses the second import as part of "import cycle detection code" in yin_parser.py Line 293.
ifmodnameinmymodules:
# circular import; ignore here and detect in validationpass
[email protected]:9: warning: imported module "test-dep" not used
[email protected]:15: error: extension "extension" is not defined in module test-dep
Expected:
no error or warning
The test case is actually meant to demonstrate a bug in RFC 7950, Section 13, YIN format: the YANG <-> YIN mapping cannot be considered bidirectional (RFC claims this to be true) due to the fact that XML namespace bindings (needed by extensions) cannot replace the prefix:module mappings in module header statements. IMO, it was a mistake to "encode" YANG extension usages in YIN the way they currently are, as the "encoding" is inherently ambiguous for import by revision. Not to mention it requires needlessly complex YIN parser implementations (pyang's own implementation speaks for itself in this regard) that need to know the extension's definition to properly parse what should essentially be keyword:argument pairs expressed as XML.
The text was updated successfully, but these errors were encountered:
Indeed. It doesn't help that p1 and p2 don't need to match the prefix mappings in a YANG module (or even be supplied by an XML parser implementation to the application).
Another way out of this would be to issue a warning for such cases. If you reverse the order of import statements in my test case, pyang will pretend that everything checks out, which is not ideal either.
Hi,
pyang's YIN parser improperly handles imports by revision for my carefully crafted test case. It dismisses the second import as part of "import cycle detection code" in yin_parser.py Line 293.
Run with:
Result:
Expected:
no error or warning
The test case is actually meant to demonstrate a bug in RFC 7950, Section 13, YIN format: the YANG <-> YIN mapping cannot be considered bidirectional (RFC claims this to be true) due to the fact that XML namespace bindings (needed by extensions) cannot replace the prefix:module mappings in module header statements. IMO, it was a mistake to "encode" YANG extension usages in YIN the way they currently are, as the "encoding" is inherently ambiguous for import by revision. Not to mention it requires needlessly complex YIN parser implementations (pyang's own implementation speaks for itself in this regard) that need to know the extension's definition to properly parse what should essentially be keyword:argument pairs expressed as XML.
The text was updated successfully, but these errors were encountered: