CiscoTestAutomation / genieparser

sub-component of Genie that parse the device output into structured datastructure
Apache License 2.0
251 stars 388 forks source link

ShowIpOspfMplsTrafficEngLink - "show ip ospf mpls traffic-eng link" Parser Fails on ASR920 Running IOS-XE 17.06.03 #887

Open ZacharyPuls opened 1 month ago

ZacharyPuls commented 1 month ago

When learning OSPF on a TE-enabled ASR-920-24SZ-M running IOS-XE 17.06.03, Genie fails with the following error:

Issue while parsing: <class 'genie.libs.parser.iosxe.show_ospf.ShowIpOspfMplsTrafficEngLink'>

Traceback (most recent call last):
  File "src/genie/cli/commands/learn.py", line 365, in genie.cli.commands.learn.LearnCommand._retrieve_ops
  File "/home/zpuls/pyats-tests/.venv/lib/python3.10/site-packages/genie/libs/ops/ospf/iosxe/ospf.py", line 1017, in learn
    self.make(final_call=True)
  File "/home/zpuls/pyats-tests/.venv/lib/python3.10/site-packages/genie/ops/base/base.py", line 111, in make
    self.maker.make(*args, **kwargs)
  File "src/genie/ops/base/maker.py", line 326, in genie.ops.base.maker.Maker.make
  File "src/genie/ops/base/maker.py", line 438, in genie.ops.base.maker.Maker._call_parser
  File "src/genie/metaparser/_metaparser.py", line 342, in genie.metaparser._metaparser.MetaParser.parse
  File "src/genie/metaparser/_metaparser.py", line 322, in genie.metaparser._metaparser.MetaParser.parse
  File "src/genie/metaparser/util/schemaengine.py", line 419, in genie.metaparser.util.schemaengine.Schema.validate
genie.metaparser.util.exceptions.SchemaMissingKeyError: Show Command: show ip ospf mpls traffic-eng link
Missing keys: [['vrf', 'default', 'address_family', 'ipv4', 'instance', '13329', 'areas', '0.0.0.0', 'mpls', 'te', 'link_hash_bucket', 7, 'link_fragments', 26, 'network_type'], ['vrf', 'default', 'address_family', 'ipv4', 'instance', '13329', 'areas', '0.0.0.0', 'mpls', 'te', 'link_hash_bucket', 39, 'link_fragments', 28, 'network_type']]

Configuration:

router ospf 13329
 router-id 10.9.1.98
 auto-cost reference-bandwidth 100000
 nsr
 nsf cisco
 area 0 authentication message-digest
 timers throttle spf 10 100 1000
 timers throttle lsa 10 100 1000
 redistribute connected
 network 10.9.1.98 0.0.0.0 area 0
 network 10.9.5.188 0.0.0.3 area 0
 network 10.9.5.192 0.0.0.3 area 0
 bfd all-interfaces
 mpls traffic-eng router-id Loopback0
 mpls traffic-eng area 0
!
[...]
interface Loopback0
 description KCBBASR31 Router ID
 ip address 10.9.1.98 255.255.255.255
 ip ospf network point-to-point
 load-interval 30
!
[...]
mpls traffic-eng tunnels
mpls traffic-eng signalling advertise explicit-null
mpls traffic-eng nsr

"show platform"/"show version":

KCBBASR31#show platform
Chassis type: ASR-920-24SZ-M

Slot      Type                State                 Insert time (ago) 
--------- ------------------- --------------------- ----------------- 
 0/0      24xGE-4x10GE-FIXED-Sok                    1y18w         
R0        ASR-920-24SZ-M      ok, active            1y18w         
F0                            ok, active            1y18w         
P0        ASR920-PSU0         ok                    1y18w         
P1        ASR920-PSU1         ok                    1y18w         
P2        ASR920-FAN          ok                    1y18w         

Slot      CPLD Version        Firmware Version                        
--------- ------------------- --------------------------------------- 
R0        2101121B            15.6(48r)S                          
F0        2101121B            15.6(48r)S                          

KCBBASR31#show version
Cisco IOS XE Software, Version 17.06.03
Cisco IOS Software [Bengaluru], ASR920 Software (PPC_LINUX_IOSD-UNIVERSALK9_NPE-M), Version 17.6.3, RELEASE SOFTWARE (fc4)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2022 by Cisco Systems, Inc.
Compiled Wed 30-Mar-22 20:29 by mcpre

Cisco IOS-XE software, Copyright (c) 2005-2022 by cisco Systems, Inc.
All rights reserved.  Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0.  The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY.  You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0.  For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.

ROM: IOS-XE ROMMON

KCBBASR31 uptime is 1 year, 18 weeks, 3 days, 7 hours, 42 minutes
Uptime for this control processor is 1 year, 18 weeks, 3 days, 7 hours, 48 minutes
System returned to ROM by reload at 02:30:14 CDT Thu May 11 2023
System restarted at 02:54:50 CDT Thu May 11 2023
System image file is "bootflash:asr920-universalk9_npe.17.06.03.SPA.bin"
Last reload reason: Reload Command

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

License Level: advancedmetroipaccess
License Type: Permanent
Next reload license Level: advancedmetroipaccess

Smart Licensing Status: Smart Licensing is DISABLED

cisco ASR-920-24SZ-M (Freescale P2020) processor (revision 1.2 GHz) with 864538K/6147K bytes of memory.
Processor board ID [REDACTED]
24 Gigabit Ethernet interfaces
4 Ten Gigabit Ethernet interfaces
32768K bytes of non-volatile configuration memory.
3670016K bytes of physical memory.
1328927K bytes of eMMC flash at bootflash:.

Configuration register is 0x2102

Show command output:

KCBBASR31#show ip ospf mpls traffic-eng link                                                                      

            OSPF Router with ID (10.9.1.98) (Process ID 13329)

  Area 0 has 2 MPLS TE links. Area instance is 13.

  Links in hash bucket 7.
    Link is associated with fragment 26. Link instance is 13
      Link connected to Point-to-Point network
      Link ID : 10.9.1.95
      Interface Address : 10.9.5.194
      Neighbor Address : 10.9.5.193
      Admin Metric te: 10 igp: 4294967295
      Maximum bandwidth : 1250000000
      Maximum reservable bandwidth : 0
      Number of Priority : 8
      Priority 0 : 0            Priority 1 : 0          
      Priority 2 : 0            Priority 3 : 0          
      Priority 4 : 0            Priority 5 : 0          
      Priority 6 : 0            Priority 7 : 0          
      Affinity Bit : 0x0

  Links in hash bucket 39.
    Link is associated with fragment 28. Link instance is 13
      Link connected to Point-to-Point network
      Link ID : 10.9.1.95
      Interface Address : 10.9.5.190
      Neighbor Address : 10.9.5.189
      Admin Metric te: 10 igp: 4294967295
      Maximum bandwidth : 1250000000
      Maximum reservable bandwidth : 0
      Number of Priority : 8
      Priority 0 : 0            Priority 1 : 0          
      Priority 2 : 0            Priority 3 : 0          
      Priority 4 : 0            Priority 5 : 0          
      Priority 6 : 0            Priority 7 : 0          
      Affinity Bit : 0x0

The issue appears to be in src/genie/libs/parser/iosxe/show_ospf.py on line 5227, the type regex is missing a '-' for "Point-to-Point".

SohanTirpude commented 1 month ago

Hello @ZacharyPuls,

In your PR, unit tests are missing. Kindly follow this documentation: https://pubhub.devnetcloud.com/media/pyats-development-guide/docs/writeparser/writeparser.html#folder-based-testing-asa-ios-and-iosxe to add one or refer any PRs that are already merged.

Thank you.