Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for "n*Nd" route types for IOSXE when using learn routing. #190

Open
fiblund opened this issue Nov 18, 2022 · 5 comments
Open

Error for "n*Nd" route types for IOSXE when using learn routing. #190

fiblund opened this issue Nov 18, 2022 · 5 comments
Assignees

Comments

@fiblund
Copy link

fiblund commented Nov 18, 2022

Hi :)

First of all - Fantastic tool! :)

I have tested using pyATS to learn routing from IOSXE routers in SD-WAN mode, and I get an error for routes with the type "n*Nd".

n*Nd is a NAT default route:
n - NAT
Nd - NAT DIA

    • candidate default

Here is the traceback
(venv) ➜ pyats git:(main) ✗ more pre_change/routing_iosxe_DEBEREVOR01_exception.txt

Issue while building the feature

Traceback (most recent call last):
  File "src/genie/cli/commands/learn.py", line 365, in genie.cli.commands.learn.LearnCommand._retrieve_ops
  File "/Users/frederikfibiger-lundberg/projects/pyats/venv/lib/python3.9/site-packages/genie/libs/ops/routing/iosxe/routing.py", line 143, in learn
    self.make(final_call=True)
  File "/Users/frederikfibiger-lundberg/projects/pyats/venv/lib/python3.9/site-packages/genie/ops/base/base.py", line 103, in make
    self.maker.make(*args, **kwargs)
  File "src/genie/ops/base/maker.py", line 315, in genie.ops.base.maker.Maker.make
  File "src/genie/ops/base/maker.py", line 427, in genie.ops.base.maker.Maker._call_parser
  File "src/genie/metaparser/_metaparser.py", line 308, in genie.metaparser._metaparser.MetaParser.parse
  File "/Users/frederikfibiger-lundberg/projects/pyats/venv/lib/python3.9/site-packages/genie/libs/parser/iosxe/show_routing.py", line 50, in cli
    return parser.parse(output=out)
  File "src/genie/metaparser/_metaparser.py", line 308, in genie.metaparser._metaparser.MetaParser.parse
  File "/Users/frederikfibiger-lundberg/projects/pyats/venv/lib/python3.9/site-packages/genie/libs/parser/iosxe/show_routing.py", line 439, in cli
    route_dict['source_protocol'] = source_protocol
UnboundLocalError: local variable 'source_protocol' referenced before assignment

I have managed to fix the issue locally by adding the following code:
229: # added to support "n*Nd" route types, which are used in Cisco SD-WAN for NAT DIA routes
230: source_protocol_dict['nat_dia'] = ['n', 'Nd']

image

@Taarini Taarini self-assigned this Nov 22, 2022
@Taarini
Copy link
Contributor

Taarini commented Nov 22, 2022

Hi

Can you please share the os, platform and device output for the above. It would be helpful in debugging

@fiblund
Copy link
Author

fiblund commented Nov 23, 2022

Of course, I should have thought about that :)

Attached the relevant files

Platform: C8300-1N1S-6T
OS: Cisco IOS XE Software, Version 17.06.03a
Cisco IOS Software [Bengaluru], c8000be Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 17.6.3a, RELEASE SOFTWARE (fc1)

(venv) ➜  egmont git:(main) ✗ pyats learn routing --testbed-file test_tb.yaml 
Enter default password for device DEBEREVOR01: 

Learning '['routing']' on devices '['DEBEREVOR01']'
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00,  2.56s/it]
+==============================================================================+
| Genie Learn Summary for device DEBEREVOR01                                   |
+==============================================================================+
|  Connected to DEBEREVOR01                                                    |
|  -   Log: ./connection_DEBEREVOR01.txt                                       |
|------------------------------------------------------------------------------|
|  Could not learn feature 'routing'                                           |
|  -  Exception:      ./routing_iosxe_DEBEREVOR01_exception.txt                |
|  -  Ops structure:  ./routing_iosxe_DEBEREVOR01_ops.txt                      |
|  -  Device Console: ./routing_iosxe_DEBEREVOR01_console.txt                  |
|==============================================================================|

connection_DEBEREVOR01.txt
routing_iosxe_DEBEREVOR01_console.txt
routing_iosxe_DEBEREVOR01_exception.txt
routing_iosxe_DEBEREVOR01_ops.txt

@Taarini
Copy link
Contributor

Taarini commented Nov 24, 2022

Hi

Yes that fixes the problem.

Can you please contribute to the genieparser community.
All you need to do is create a PR in genieparser community and add the above changes along with the expected output and parsed output as unit test to justify your changes.

Below is the link to guide you through parser contribution,
https://pubhub.devnetcloud.com/media/pyats-development-guide/docs/writeparser/writeparser.html

@fiblund
Copy link
Author

fiblund commented Nov 28, 2022

Hi @Taarini

I've created and related the pull request :) Hoping I've filled everything out correctly - My first ever time contributing, so if there are any errors or things I could have done better/smarter, please let me know :)

Thanks for the help

@Taarini
Copy link
Contributor

Taarini commented Nov 29, 2022

Yes all good approved the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants