genieparser icon indicating copy to clipboard operation
genieparser copied to clipboard

Incorrect parsing for "show interfaces {interface} transceiver detail"

Open ravaghi opened this issue 4 years ago • 1 comments

The parser fails to convert N/A to float. I tried to remove the type conversion manually, but then I got Parser ShowInterfacesTransceiverDetail schema checking failed.

Traceback (most recent call last):
  File "ssh_test.py", line 244, in <module>
    output = get_interface_transceiver_detail(device, device_port)
  File "ssh_test.py", line 122, in get_interface_transceiver_detail
    transceiver_data = device.parse(f'show interfaces {device_port} transceiver detail')
  File "src/genie/conf/base/device.py", line 524, in genie.conf.base.device.Device.parse
  File "src/genie/conf/base/device.py", line 551, in genie.conf.base.device.Device._get_parser_output
  File "src/genie/metaparser/_metaparser.py", line 279, in genie.metaparser._metaparser.MetaParser.parse
  File "/usr/local/lib/python3.6/dist-packages/genie/libs/parser/iosxe/show_interface.py", line 3767, in cli
    intf_dict[stat]['Value'] = float(m.groupdict()['value'])
ValueError: could not convert string to float: 'N/A'

ravaghi avatar Oct 21 '21 08:10 ravaghi

You will also have to change the Value key to optional in the schema like so: Optional('Value'): float

danielgraziano avatar Oct 25 '21 14:10 danielgraziano