Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error converting Openconfig Vlan yang #22

Closed
dorado18 opened this issue Jul 2, 2018 · 5 comments
Closed

Error converting Openconfig Vlan yang #22

dorado18 opened this issue Jul 2, 2018 · 5 comments
Assignees
Labels

Comments

@dorado18
Copy link

dorado18 commented Jul 2, 2018

The following error is reported when trying to convert file openconfig-vlan.yang:

Traceback (most recent call last):
  File "/home/ipedasia/prjs/swo/venv/bin/pyang", line 450, in <module>
    run()
  File "/home/ipedasia/prjs/swo/venv/bin/pyang", line 419, in run
    emit_obj.emit(ctx, modules, fd)
  File "/home/ipedasia/prjs/swo/YANG-to-Redfish-Converter/YANG-to-Redfish-Plugin/redfish.py", line 66, in emit
    xml_root = csdltree.build_tree(module, list_of_xml, logger)
  File "/home/ipedasia/prjs/swo/YANG-to-Redfish-Converter/YANG-to-Redfish-Plugin/rf/csdltree.py", line 145, in build_tree
    build_tree_repeat(item, schema_node, entity_node, main_node, list_of_xml, logger, prefix + csdlname + '.', topleveltypes=topleveltypes, toplevelimports=toplevelimports)
  File "/home/ipedasia/prjs/swo/YANG-to-Redfish-Converter/YANG-to-Redfish-Plugin/rf/csdltree.py", line 335, in build_tree_repeat
    annotation = handlers.handle_generic(yang_keyword, yang_arg, yang_children, target)
  File "/home/ipedasia/prjs/swo/YANG-to-Redfish-Converter/YANG-to-Redfish-Plugin/rf/statement_handlers.py", line 22, in handle_generic
    target, {'Term': redfishtypes.get_descriptive_properties_mapping(yang_keyword),
  File "/home/ipedasia/prjs/swo/YANG-to-Redfish-Converter/YANG-to-Redfish-Plugin/rf/redfishtypes.py", line 57, in get_descriptive_properties_mapping
    target_name = get_valid_csdl_identifier(property_name) 
  File "/home/ipedasia/prjs/swo/YANG-to-Redfish-Converter/YANG-to-Redfish-Plugin/rf/redfishtypes.py", line 33, in get_valid_csdl_identifier
    new_name = name.replace('-', '_').replace(':', '.').replace('"', '').replace('\'', '')
AttributeError: 'tuple' object has no attribute 'replace'

The problem seens to be an error of not recognizing the keywords 'openconfig-extensions' and 'openconfig-version' onlines 16 and 29 respectively on file openconfig-vlan.yang.

@tomasg2012
Copy link
Contributor

tomasg2012 commented Jul 3, 2018

This is an issue I had come across but hadn't done research on what the keywords actually meant, since they were not prefixed by any yang keywords. It seems pyang spits out something different as a result, but I don't know exactly why or what I'm supposed to do with it.

But in particular, what does the keyword mean? From what I'm reading, it has to do with language extensions? Does pyang support this, and should the converter in spite of that?

@dorado18
Copy link
Author

dorado18 commented Jul 3, 2018

'openconfig-extensions' is a module defined in openconfig-extensions.yang. Maybe this module is not being parsed correctly in the 'import' statement ?

When reaching "/home/ipedasia/prjs/swo/YANG-to-Redfish-Converter/YANG-to-Redfish-Plugin/rf/csdltree.py", line 335, 'yang_keyword' variable has as value a tuple ('openconfig-extensions', 'openconfig-version')

I don't know pyang nor the yang to csdl specification enough to answer your last questions.

Thanks

@tomasg2012
Copy link
Contributor

tomasg2012 commented Jul 3, 2018

I think it's clearly being imported seeing as the alias is properly parsed, but I'll have to do research to see if pyang is doing anything more about it, and what's contained in the conversion spec. Do you know if this format of "importname:importitem" in Yang files as a Keyword subsititute is only to deal with extensions?

I will report back or contact @jcleung5549 for more info about how to handle extensions. I believe they can be treated like a csdl Annotation with an enum.

e.g. <Annotation "YangCustom.Keyword" "oc_ext/openconfig_version">, where the latter is the extension generated as an enum for a term. A more complicated mockup may be necessary, and the spec must be checked.

@tomasg2012
Copy link
Contributor

Should perform better on the latest branch yang-plugin, along with e-mail based issues.

@jcleung5549
Copy link
Contributor

The latest update doesn't exhibit this problem. See issue #19 for the output from a current execution. Changed 'label' to "fixed". Issue originator should "close" issue, if satisfied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants