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

Modified cisco_asa_show_object-group_network.template #302

Conversation

joewesch
Copy link
Contributor

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT

cisco_asa_show_object-group_network.template, cisco_asa, show object-group network
cisco_asa_show_object-group_network.template, cisco_asa, show running-config object-group network

SUMMARY

On the ASA, if you run show object-group network or show running-config object-group network you get the same output except for the colon after the word description. I have modified the existing cisco_asa_show_object-group_network.template to accept the colon as an optional character for it to work for both commands.

I plan to add the show running-config object network template soon, and didn't want the show running-config object-group network command to conflict.

…config object-group network` by making the colon in the description optional
Copy link
Contributor

@jmcgill298 jmcgill298 left a comment

Choose a reason for hiding this comment

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

@Jaydubya35 I think what you are trying to do is accomplished with a regex in the last column of the output.

templates/index Outdated
@@ -95,6 +95,7 @@ checkpoint_gaia_fw_stat.template, .*, checkpoint_gaia, fw stat
cisco_asa_show_running-config_crypto_ikev1.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] cr[[ypto]] ikev1
cisco_asa_show_running-config_tunnel-group.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] tu[[nnel-group]]
cisco_asa_show_running-config_crypto_map.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] cr[[ypto]] m[[ap]]
cisco_asa_show_object-group_network.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] object-[[group]] n[[etwork]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cisco_asa_show_object-group_network.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] object-[[group]] n[[etwork]]

templates/index Outdated
@@ -95,6 +95,7 @@ checkpoint_gaia_fw_stat.template, .*, checkpoint_gaia, fw stat
cisco_asa_show_running-config_crypto_ikev1.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] cr[[ypto]] ikev1
cisco_asa_show_running-config_tunnel-group.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] tu[[nnel-group]]
cisco_asa_show_running-config_crypto_map.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] cr[[ypto]] m[[ap]]
cisco_asa_show_object-group_network.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] object-[[group]] n[[etwork]]
cisco_asa_show_vpn-sessiondb_detail_l2l.template, .*, cisco_asa, sh[[ow]] vpn-[[sessiondb]] d[[etail]] l[[2l]]
cisco_asa_show_crypto_ikev1_sa_detail.template, .*, cisco_asa, sh[[ow]] cry[[pto]] ikev1 sa d[[etail]]
cisco_asa_show_object-group_network.template, .*, cisco_asa, sh[[ow]] ob[[ject-group]] n[[etwork]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cisco_asa_show_object-group_network.template, .*, cisco_asa, sh[[ow]] ob[[ject-group]] n[[etwork]]
cisco_asa_show_object-group_network.template, .*, cisco_asa, sh[[ow]] (?:ru[[nning-config]] |)ob[[ject-group]] n[[etwork]]

@joewesch
Copy link
Contributor Author

joewesch commented Jan 1, 2019

The problem with your suggestion is the difference between the minimum letters of the syntax object-group to run to differentiate object-groups from single objects when running it with running-config.

"show object-group network" = sh ob n
"show running-config object-group network" = sh ru object- n
"show running-config object network" = sh ru o n

As you can see object and object-group would conflict with your proposed single regex. If you would still like a combined regex for the single template, the logical OR would need to contain the full object- when combined with running-config. Maybe something like this:

sh[[ow]] (ru[[nning-config]] object-[[group]]|ob[[ject-group]]) n[[etwork]]

Let me know if you would prefer it that way or the split way that I originally committed.

@jmcgill298
Copy link
Contributor

How were you testing that my proposal doesn't work? I tested with the ntc_show_command Ansible module, and it was able to read the index file and locate the template for both commands.

The branch as you currently have it does not have a template for show running-config object-group network, so it still won't be able to parse based on the command syntax.

Joe Wesch added 2 commits January 2, 2019 15:17
… into cisco_asa_show_running-config_object-group_network
@joewesch
Copy link
Contributor Author

joewesch commented Jan 2, 2019

Sorry, I should have specified it has the potential to conflict with #306. In that PR I added show run object network to the index. As long as your new regex is below that one it works fine.

Working example with your solution:

cisco_asa_show_running-config_object_network.template, .*, cisco_asa, sh[[ow]] ru[[nning-config]] o[[bject]] n[[etwork]]
cisco_asa_show_object-group_network.template, .*, cisco_asa, sh[[ow]] (?:ru[[nning-config]] |)ob[[ject-group]] n[[etwork]]

But, if the order was reversed (since longer commands should come first in the index file according to your own guidelines) it would no longer work as show run ob network would trigger on the index line that you provided. My solution would work either above or below show run object network.

I have provided a new commit with this change. Please review and let me know your thoughts.

@jmcgill298
Copy link
Contributor

The order needs to be maintained, but this should work: sh[[ow]] (?:ru[[nning-config]] object-[[group]]|ob[[ject-group]]) n[[etwork]]

@joewesch
Copy link
Contributor Author

joewesch commented Jan 2, 2019

Are you sure? You have ?: still in the parentheses so the entire section is optional and show network will also match.

@joewesch
Copy link
Contributor Author

joewesch commented Jan 2, 2019

Sorry, I mixed up non-capturing and optional. Yes, it will work with ?:

@jmcgill298 jmcgill298 merged commit d1dec0a into networktocode:master Jan 3, 2019
@joewesch joewesch deleted the cisco_asa_show_running-config_object-group_network branch June 29, 2021 16:58
jvanderaa pushed a commit that referenced this pull request Nov 10, 2021
* Modified `show object-group network` to also work with `show running-config object-group network` by making the colon in the description optional

* Update index file to account for both versions of the command

* Update test files to include additional data
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.

2 participants