genieparser
genieparser copied to clipboard
updated P2 pattern to make sn optional
Description
Changed P2 regex to make sn
field optional
Motivation and Context
show_inventory.py was only parsing lines that included a serial number
Nice! I think that fixed the line endings. I also went ahead and removed trailing white space from the lines.
Please add a changelog (instructions are in this repos README)
Also, it seems one of the unit tests is failing
2022-02-07T12:34:39: %AETEST-INFO: +------------------------------------------------------------------------------+
2022-02-07T12:34:39: %AETEST-INFO: | Starting section ShowInventoryRaw |
2022-02-07T12:34:39: %AETEST-INFO: +------------------------------------------------------------------------------+
2022-02-07T12:34:39: %AETEST-INFO: +..............................................................................+
2022-02-07T12:34:39: %AETEST-INFO: : Starting STEP 1: iosxe -> ShowInventoryRaw :
2022-02-07T12:34:39: %AETEST-INFO: +..............................................................................+
2022-02-07T12:34:39: %AETEST-INFO: +..............................................................................+
2022-02-07T12:34:39: %AETEST-INFO: : Starting STEP 1.1: Test Golden -> iosxe -> ShowInventoryRaw :
2022-02-07T12:34:39: %AETEST-INFO: +..............................................................................+
2022-02-07T12:34:39: %AETEST-INFO: +..............................................................................+
2022-02-07T12:34:39: %AETEST-INFO: : Starting STEP 1.1.1: Gold -> iosxe -> ShowInventoryRaw -> golden_outpu :
2022-02-07T12:34:39: %AETEST-INFO: : t :
2022-02-07T12:34:39: %AETEST-INFO: +..............................................................................+
2022-02-07T12:34:39: %SCRIPT-ERROR: Traceback (most recent call last):
2022-02-07T12:34:39: %SCRIPT-ERROR: File "/ws/lumcclel-ott/unicon_dev/pypi/genie/src/genie/metaparser/_metaparser.py", line 292, in parse
2022-02-07T12:34:39: %SCRIPT-ERROR: output = Schema(self.schema).validate(
2022-02-07T12:34:39: %SCRIPT-ERROR: File "/ws/lumcclel-ott/unicon_dev/pypi/genie/src/genie/metaparser/util/schemaengine.py", line 284, in validate
2022-02-07T12:34:39: %SCRIPT-ERROR: matchValue = Schema(sv, path).validate(
2022-02-07T12:34:39: %SCRIPT-ERROR: File "/ws/lumcclel-ott/unicon_dev/pypi/genie/src/genie/metaparser/util/schemaengine.py", line 359, in validate
2022-02-07T12:34:39: %SCRIPT-ERROR: matchValue = Schema(sv, path).validate(
2022-02-07T12:34:39: %SCRIPT-ERROR: File "/ws/lumcclel-ott/unicon_dev/pypi/genie/src/genie/metaparser/util/schemaengine.py", line 359, in validate
2022-02-07T12:34:39: %SCRIPT-ERROR: matchValue = Schema(sv, path).validate(
2022-02-07T12:34:39: %SCRIPT-ERROR: File "/ws/lumcclel-ott/unicon_dev/pypi/genie/src/genie/metaparser/util/schemaengine.py", line 252, in validate
2022-02-07T12:34:39: %SCRIPT-ERROR: raise SchemaTypeError(self.path, self.schema, data, command=command)
2022-02-07T12:34:39: %SCRIPT-ERROR: genie.metaparser.util.exceptions.SchemaTypeError: name.slot R0.sn: Expected type '<class 'str'>' but got type 'None'(<class 'NoneType'>)
2022-02-07T12:34:39: %SCRIPT-ERROR:
2022-02-07T12:34:39: %SCRIPT-ERROR: The above exception was the direct cause of the following exception:
2022-02-07T12:34:39: %SCRIPT-ERROR:
2022-02-07T12:34:39: %SCRIPT-ERROR: Traceback (most recent call last):
2022-02-07T12:34:39: %SCRIPT-ERROR: File "/ws/lumcclel-ott/unicon_dev/pypi/external_genieparser/src/genie/libs/parser/utils/unittests.py", line 574, in test_golden
2022-02-07T12:34:39: %SCRIPT-ERROR: parsed_output = obj.parse(**arguments)
2022-02-07T12:34:39: %SCRIPT-ERROR: File "/ws/lumcclel-ott/unicon_dev/pypi/genie/src/genie/metaparser/_metaparser.py", line 315, in parse
2022-02-07T12:34:39: %SCRIPT-ERROR: raise Exception("Parser {cls} schema checking failed".format(
2022-02-07T12:34:39: %SCRIPT-ERROR: Exception: Parser ShowInventoryRaw schema checking failed
Caught an assertion failure while executing STEP 1.1.1: Gold -> iosxe -> ShowInventoryRaw -> golden_output:
Traceback (most recent call last):
File "/ws/lumcclel-ott/unicon_dev/pypi/external_genieparser/src/genie/libs/parser/utils/unittests.py", line 618, in test_golden
raise AssertionError("Device output and expected output do not match")
AssertionError: Device output and expected output do not match
You can test your changes with the following command
python folder_parsing_job.py -o iosxe -c ShowInventoryRaw
from the genieparser/tests
directory
@aclaughan Are you still working on this PR?