Skip to content

Learn function is not working in pyats 25.1 #929

@luisantoniovillalobos

Description

@luisantoniovillalobos

Hello team.

I am trying to use learn function in a Cisco Router and I am seeing error related with ios xr parsers.

Below you can find my python script and output errors.

`from pyats.topology.loader import load
from pprint import pp

testbed = load('Router_Omar.yaml') #Cargar el archivo tetsbed
router1 = testbed.devices['Cisco8200'] #Definir el objeto del router
router1.connect() #conectarme al router
output = router1.learn('isis') #Guardar el resultado del feature learn en un objeto
pp(output) #Imprimir el resultado
router1.disconnect() #Desconectarme del dispositivo`

`root@b6a675571f97:/pyats# python learn_example.py

2025-02-21 12:35:12,402: %UNICON-INFO: +++ RB2.8202.41 logfile /tmp/RB2_8202_41-cli-20250221T123512402.log +++

2025-02-21 12:35:12,402: %UNICON-INFO: +++ Unicon plugin iosxr (unicon.plugins.iosxr) +++
The authenticity of host '10.225.251.41 (10.225.251.41)' can't be established.
ECDSA key fingerprint is SHA256:LU8NXqcnuk5wQ2LJmxJ9EC3loda68U+/ifSTK6t5ys4.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

2025-02-21 12:35:13,097: %UNICON-INFO: +++ connection to spawn: ssh -l cisco 10.225.251.41 -p 22, id: 140062886526160 +++

2025-02-21 12:35:13,097: %UNICON-INFO: connection to RB2.8202.41
yes
Warning: Permanently added '10.225.251.41' (ECDSA) to the list of known hosts.
Password:
Last login: Fri Feb 21 15:51:36 2025 from 10.25.128.159

RP/0/RP0/CPU0:RB2.8202.41#

2025-02-21 12:35:14,672: %UNICON-INFO: +++ initializing handle +++

2025-02-21 12:35:14,800: %UNICON-INFO: +++ RB2.8202.41(alias=Cisco8200) with via 'a': executing command 'terminal length 0' +++
terminal length 0
Fri Feb 21 18:35:14.416 UTC
RP/0/RP0/CPU0:RB2.8202.41#

2025-02-21 12:35:15,278: %UNICON-INFO: +++ RB2.8202.41(alias=Cisco8200) with via 'a': executing command 'terminal width 0' +++
terminal width 0
Fri Feb 21 18:35:14.888 UTC
RP/0/RP0/CPU0:RB2.8202.41#

2025-02-21 12:35:15,618: %UNICON-INFO: +++ RB2.8202.41(alias=Cisco8200) with via 'a': configure +++
configure terminal
Fri Feb 21 18:35:15.358 UTC
RP/0/RP0/CPU0:RB2.8202.41(config)#no logging console
RP/0/RP0/CPU0:RB2.8202.41(config)#logging console disable
RP/0/RP0/CPU0:RB2.8202.41(config)#line console
RP/0/RP0/CPU0:RB2.8202.41(config-line)#exec-timeout 0 0
RP/0/RP0/CPU0:RB2.8202.41(config-line)#absolute-timeout 0
RP/0/RP0/CPU0:RB2.8202.41(config-line)#session-timeout 0
RP/0/RP0/CPU0:RB2.8202.41(config-line)#line default
RP/0/RP0/CPU0:RB2.8202.41(config-line)#exec-timeout 0 0
RP/0/RP0/CPU0:RB2.8202.41(config-line)#absolute-timeout 0
RP/0/RP0/CPU0:RB2.8202.41(config-line)#session-timeout 0
RP/0/RP0/CPU0:RB2.8202.41(config-line)#commit
Fri Feb 21 18:35:17.406 UTC
RP/0/RP0/CPU0:RB2.8202.41(config-line)#end
RP/0/RP0/CPU0:RB2.8202.41#

2025-02-21 12:35:18,765: %UNICON-INFO: +++ RB2.8202.41(alias=Cisco8200) with via 'a': executing command 'show isis' +++
show isis
Fri Feb 21 18:35:18.380 UTC

IS-IS Router: b2
System Id: 0000.0000.0041
Hostname: RB2.8202.41
IS Levels: level-2-only
Manual area address(es):
39.752f.0100.0014.0000.9000.0001
Routing for area address(es):
39.752f.0100.0014.0000.9000.0001
Multi-Instance Id: 0
Job Id: 1004
PID: 9293
Respawn count: 1
Started: Tue Jan 14 20:08:56 2025
Null0 ready: Tue Jan 14 20:08:56 2025
LSP MTU: 1492
LSP Full: level-1: No, level-2: No
Non-stop forwarding: Disabled
Most recent startup mode: Cold Restart
TE connection status: Up
XTC connection status: Up
Overload Bit Level-2: configured, set
interarea prefixes suppressed, external prefixes suppressed
always set
set since Jan 14 2025 20:08:56.491 UTC
Maximum Metric: not configured
Topologies supported by IS-IS:
IPv4 Unicast
Rib connected
Level-2
Metric style (generate/accept): Wide/Wide
Metric: 16777214
TE Enabled
No protocols redistributed
Distance: 115
Advertise Passive Interface Prefixes Only: No
IPv6 Unicast
Rib connected
Level-2
Metric style (generate/accept): Wide/Wide
Metric: 16777214
No protocols redistributed
Distance: 115
Advertise Passive Interface Prefixes Only: No
SR-MPLS:
SRLB allocated: 15000 - 15999
SRGB allocated: 400000 - 465000
Interfaces supported by IS-IS b2:
Bundle-Ether441 is running actively (active in configuration)
Bundle-Ether2741 is running actively (active in configuration)
Bundle-Ether4154 is running actively (active in configuration)
Bundle-Ether4171 is running actively (active in configuration)
Loopback0 is running passively (passive in configuration)
RP/0/RP0/CPU0:RB2.8202.41#
Traceback (most recent call last):
File "/pyats/learn_example.py", line 7, in
output = router1.learn('isis') #Guardar el resultado del feature learn en un objeto
File "src/genie/conf/base/device.py", line 637, in genie.conf.base.device.Device.learn
File "/usr/local/lib/python3.10/site-packages/genie/libs/ops/isis/iosxr/isis.py", line 313, in learn
self.make()
File "/usr/local/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 328, in genie.ops.base.maker.Maker.make
File "src/genie/ops/base/maker.py", line 442, in genie.ops.base.maker.Maker._call_parser
File "src/genie/metaparser/_metaparser.py", line 308, in genie.metaparser._metaparser.MetaParser.parse
File "/usr/local/lib/python3.10/site-packages/genie/libs/parser/iosxr/show_isis.py", line 687, in cli
vrf_dict['is_levels'] = is_levels
UnboundLocalError: local variable 'vrf_dict' referenced before assignment`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions