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

Created cisco_xr_show_bgp_vrf_all_neighbors_advertised-routes.textfsm #1907

Merged
merged 107 commits into from
Nov 27, 2024

Conversation

jorlandobr
Copy link
Contributor

Added new template cisco_xr_show_bgp_vrf_all_neighbors_advertised-routes . Included test case and Index modification.

cisco_xr_show_ipv4_interface.textfsm, .*, cisco_xr, sh[[ow]] ip[[v4]](?: vrf \S+)? int[[erface]]

can now serve both "show ipv4 interface" and "show ipv4 vrf interface" commands
Added fields of interest:
Secondary IP address
Secondary IP prefix lenght
VRF ID
Output ACL
Input ACL
RPF Check
Test file with values for secondary IP and mask lenght, access list, RPF
jorlandobr and others added 2 commits November 22, 2024 12:26
…vertised-routes.textfsm

Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
…vertised-routes.textfsm

Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>

ROUTES
^${NETWORK}\/${PREFIX_LENGTH}\s+${NEXT_HOP}\s+${FROM}\s+${AS_PATH} -> Record
^\s*$$ -> End
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you did here, haha.
Hopscotch right to the End once you see a blank line. 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way easier to finish the job :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a disadvantage though in that once the first blank line is hit then it goes straight to jail, err End. (Monopoly joke 😆)

I would say jumping to End in this manner may not be desirable though in the long term.

😁 As long as it is ok with @jmcgill298 and the other maintainers then I suppose that's fine.

Copy link
Contributor

@jmcgill298 jmcgill298 Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, I'm not sure what this buys us, it seems there is just one more line to catch, so it should be easy enough to look for ^Processed. We will also need to have an ^. -> Error line in this section too. NVM, I just missed that

Copy link
Contributor

@mjbear mjbear Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the syntax on lots of other templates, my $0.02 is not to redirect to end and instead handle the lines.

Allowing this state redirect to End does not align with the project requirement of matching all lines.
I'm wrong, technically the blank line is matched as is Processed.

Is there an advantage of redirecting to End rather than just matching it and being done with the line at that point? I'm inclined to say keep it simple and there's little sense in explicitly redirecting to End.

(Granted there are non-compliant templates from before that project requirement, but those will have to be retroactively identified. Holiday wish list [err, to-do list 😆] of sorts, haha.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you generate the YML files from the JSON output? I am using nornir.tech to convert from JSON to YML. But after I have to check cases, spacing...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorlandobr
There are development helper scripts you can use.

I have a fix for the blank entry that I'll be submitting shortly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper scripts, I don't find it. To access them should I use git and download the project to my local machine?

I can't use git at work. Will try this at home.

The blank fix worked!

Copy link
Contributor

@mjbear mjbear Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper scripts, I don't find it. To access them should I use git and download the project to my local machine?

@jorlandobr
Yeah, git clone your fork, switch to your branches where you're developing and run the helper script(s).

I can't use git at work. Will try this at home.

You might be able to use GitHub Codespaces from your browser, but there are "core hours" limits per month based on plans. When you're not using your Codespace, you can stop it here (or delete it when you're done with it).

I was able to get the below to function in case it is of use to you.

# Go to your fork repo and choose the branch you're working on
# Click on the green Code button > Codespaces tab > Create codespace on <branch_name>
# Codespace launches in a new web browser tab

# From the VS Code Terminal
git switch <your_branch_name>
poetry shell
poetry install

# nothing but an example, hehe
python cli.py gen-yaml-folder -f tests/cisco_xr/show_ip_bgp_summary/

💡 Don't forget to conserve your Codespace hours by stopping it here (or delete it when you're done with it).

The blank fix worked!

💯 😁
Yep, thank you, thank you, haha. 🙇


ROUTES
^${NETWORK}\/${PREFIX_LENGTH}\s+${NEXT_HOP}\s+${FROM}\s+${AS_PATH} -> Record
^\s*$$ -> End
Copy link
Contributor

@jmcgill298 jmcgill298 Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, I'm not sure what this buys us, it seems there is just one more line to catch, so it should be easy enough to look for ^Processed. We will also need to have an ^. -> Error line in this section too. NVM, I just missed that

…vertised-routes.textfsm

Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
…vertised-routes.textfsm

Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
@mjbear
Copy link
Contributor

mjbear commented Nov 27, 2024

@jorlandobr
I opened jorlandobr/pull/1 with some test data changes.
Thank you!

This documentation on workflow and branching might be helpful too. It's generally a pain to develop on one's primary branch (ex: master or main are common primary branches).

…vertised-routes.textfsm

Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
@jorlandobr
Copy link
Contributor Author

@jorlandobr I opened jorlandobr/pull/1 with some test data changes. Thank you!

This documentation on workflow and branching might be helpful too. It's generally a pain to develop on one's primary branch (ex: master or main are common primary branches).

Thanks for your help!

I'll start to learn this new tool :-)

@jmcgill298 jmcgill298 merged commit d1f4cf7 into networktocode:master Nov 27, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

3 participants