DMTF / YANG-to-Redfish-Converter

This tool converts a YANG model file to the corresponding Redfish schema, specified in OData CSDL, in accordance with the YANG-to-CSDL Mapping Specification.
Other
4 stars 5 forks source link

Having trouble with yang modules with "-" in name #12

Closed seiferteric closed 6 years ago

seiferteric commented 6 years ago

I am trying to convert some openconfig model and get these errors:

Traceback (most recent call last):
  File "yang_to_csdl_tool.py", line 159, in <module>
    execute(filename, args.output_grammar, args.target_dir, logger)
  File "yang_to_csdl_tool.py", line 58, in execute
    result = myparser.parse_text(content)
  File "/usr/local/lib/python3.6/dist-packages/modgrammar/__init__.py", line 508, in parse_text
    for result in self._parse_text(string, bol, eof, data, matchtype):
  File "/usr/local/lib/python3.6/dist-packages/modgrammar/__init__.py", line 455, in _parse_text
    count, obj = self._parse(pos, session, matchtype)
  File "/usr/local/lib/python3.6/dist-packages/modgrammar/__init__.py", line 395, in _parse
    raise ParseError(self.grammar, self.text.string, errpos, char, line=line, col=col, expected=expected)
modgrammar.ParseError: [line 7, column 13] Expected ';': Found '-telemetry";'
Traceback (most recent call last):
  File "yang_to_csdl_tool.py", line 159, in <module>
    execute(filename, args.output_grammar, args.target_dir, logger)
  File "yang_to_csdl_tool.py", line 58, in execute
    result = myparser.parse_text(content)
  File "/usr/local/lib/python3.6/dist-packages/modgrammar/__init__.py", line 508, in parse_text
    for result in self._parse_text(string, bol, eof, data, matchtype):
  File "/usr/local/lib/python3.6/dist-packages/modgrammar/__init__.py", line 455, in _parse_text
    count, obj = self._parse(pos, session, matchtype)
  File "/usr/local/lib/python3.6/dist-packages/modgrammar/__init__.py", line 395, in _parse
    raise ParseError(self.grammar, self.text.string, errpos, char, line=line, col=col, expected=expected)
modgrammar.ParseError: [line 7, column 13] Expected ';': Found '-if";'

Maybe the grammer/parser assumes there is no "-" in module names? The names of the modules above are "openconfig-telemetry" and "openconfig-if" respectively. I will look and see if I can find the source of the error. These yang models can be found here: https://github.com/openconfig/public/tree/master/release/models

tomasg2012 commented 6 years ago

The Yang converter is currently going through a backend change that will delegate all the grammar checking to the tool pyang, but may take until the week after this to be available on the public repo.

There are also some necessary underscore and dash changes that need to be addressed as well, but the issue above is a result of handwriting all the yang grammar to another library in the initial release.

On Mon, Mar 19, 2018, 12:14 PM Eric Seifert notifications@github.com wrote:

I am trying to convert some openconfig model and get these errors:

Traceback (most recent call last): File "yang_to_csdl_tool.py", line 159, in execute(filename, args.output_grammar, args.target_dir, logger) File "yang_to_csdl_tool.py", line 58, in execute result = myparser.parse_text(content) File "/usr/local/lib/python3.6/dist-packages/modgrammar/init.py", line 508, in parse_text for result in self._parse_text(string, bol, eof, data, matchtype): File "/usr/local/lib/python3.6/dist-packages/modgrammar/init.py", line 455, in _parse_text count, obj = self._parse(pos, session, matchtype) File "/usr/local/lib/python3.6/dist-packages/modgrammar/init.py", line 395, in _parse raise ParseError(self.grammar, self.text.string, errpos, char, line=line, col=col, expected=expected) modgrammar.ParseError: [line 7, column 13] Expected ';': Found '-telemetry";'

Traceback (most recent call last): File "yang_to_csdl_tool.py", line 159, in execute(filename, args.output_grammar, args.target_dir, logger) File "yang_to_csdl_tool.py", line 58, in execute result = myparser.parse_text(content) File "/usr/local/lib/python3.6/dist-packages/modgrammar/init.py", line 508, in parse_text for result in self._parse_text(string, bol, eof, data, matchtype): File "/usr/local/lib/python3.6/dist-packages/modgrammar/init.py", line 455, in _parse_text count, obj = self._parse(pos, session, matchtype) File "/usr/local/lib/python3.6/dist-packages/modgrammar/init.py", line 395, in _parse raise ParseError(self.grammar, self.text.string, errpos, char, line=line, col=col, expected=expected) modgrammar.ParseError: [line 7, column 13] Expected ';': Found '-if";'

Maybe the grammer/parser assumes there is no "-" in module names? The names of the modules above are "openconfig-telemetry" and "openconfig-if" respectively. I will look and see if I can find the source of the error. These yang models can be found here: https://github.com/openconfig/public/tree/master/release/models

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DMTF/YANG-to-Redfish-Converter/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUEXPghCNg5Hlb9HWo7NPbISR6WDiwBks5tf-eNgaJpZM4Swj1C .

seiferteric commented 6 years ago

Thank you for the quick response. BTW I work for Dell Networking and am working on our redfish implementation, it would be great if we could exchange email, mine is eric_e_seifert at dell dot com.

Thanks, Eric Seifert

tomasg2012 commented 6 years ago

I will send you an email.

seiferteric commented 6 years ago

This appears to be fixed in the pyang version (currently in the yang-plugin branch).

jcleung5549 commented 6 years ago

I've assigned all the YANG-to-Redfish issues to Tomas with the tag 'bug'. He will add the tag 'fixed' for any issues that he believes is fixed with the yang-plugin branch. Then the person who submitted the issue can validate the fix and note the verification in the comments and the task force can close.