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

nxos_snmp_user: platform fixes for get_snmp_user #55832

Merged
merged 2 commits into from May 10, 2019

Conversation

chrisvanheuveln
Copy link
Contributor

SUMMARY

snmp user output behavior varies quite a bit for the different nxos platforms and required several workarounds:

  • N5K/N6k

    • These platforms do not support structured output for show snmp user.
    • The current code lands in an except clause when the output is not structured; so I added a new get_non_structured_snmp_user method to scrape the state from the regular cli output if it's present.
  • N9K-F

    • The group data in the JSON output is different for this platform; it has a different key (just group instead of TABLE_groups or group_names) and it is not indexed
    • For a single group the value is a string, for multiple groups it's a list
  • sanity test cleanup

    • N5K/N6K/N9K-F platforms will reject no snmp user <name> <role> when it's the last role defined for the user.
    • workaround is to use nxos_user to remove the user
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

modules/network/nxos/nxos_snmp_user

ADDITIONAL INFORMATION

Changes validated on:

  • N3K, N3K-F, N35, N6K, N7K, N9K, N9K-F
  • 6.0(2)A8
  • 7.0(3)I2, 7.0(3)I4, 7.0(3)I5, 7.0(3)I6, 7.0(3)I7
  • 7.3(2)D1
  • 7.3(3)N1, 7.3(4)N1
  • 8.3(2)
  • 9.2(2), 9.2(3)

snmp user output behavior varies quite a bit for the different nxos platforms and required several workarounds:

- N5K/N6k
 - These platforms do not support structured output for `show snmp user`.
 - The current code lands in an `except` clause when the output is not structured; so I added a new `get_non_structured_snmp_user` method to scrape the state from the regular cli output if it's present.

- N9K-F
 - The `group` data in the JSON output is different for this platform; it has a different key (just `group` instead of `TABLE_groups` or `group_names`) and it is not indexed
 - For a single group the value is a string, for multiple groups it's a list

- sanity
 - N5K/N6K/N9K-F platforms will reject `no snmp user <name> <role>` when it's the last role defined for the user.
 - workaround is to use `nxos_user` to remove the user

- Changes validated on:
 - `N3K, N3K-F, N35, N6K, N7K, N9K, N9K-F`
 - `6.0(2)A8`
 - `7.0(3)I2, 7.0(3)I4, 7.0(3)I5, 7.0(3)I6, 7.0(3)I7`
 - `7.3(2)D1`
 - `7.3(3)N1, 7.3(4)N1`
 - `8.3(2)`
 - `9.2(2), 9.2(3)`
@ansibot
Copy link
Contributor

ansibot commented Apr 26, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. cisco Cisco technologies core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category nxos Cisco NXOS community support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests. labels Apr 26, 2019
@chrisvanheuveln
Copy link
Contributor Author

Please cherry-pick to stable2.8

@trishnaguha trishnaguha self-assigned this May 2, 2019
@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. and removed needs_triage Needs a first human triage before being processed. labels May 2, 2019
Copy link
Member

@trishnaguha trishnaguha left a comment

Choose a reason for hiding this comment

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

Thanks for the PR

@trishnaguha trishnaguha merged commit 8c56c11 into ansible:devel May 10, 2019
trishnaguha pushed a commit to trishnaguha/ansible that referenced this pull request May 10, 2019
* nxos_snmp_user: platform fixes for get_snmp_user

snmp user output behavior varies quite a bit for the different nxos platforms and required several workarounds:

- N5K/N6k
 - These platforms do not support structured output for `show snmp user`.
 - The current code lands in an `except` clause when the output is not structured; so I added a new `get_non_structured_snmp_user` method to scrape the state from the regular cli output if it's present.

- N9K-F
 - The `group` data in the JSON output is different for this platform; it has a different key (just `group` instead of `TABLE_groups` or `group_names`) and it is not indexed
 - For a single group the value is a string, for multiple groups it's a list

- sanity
 - N5K/N6K/N9K-F platforms will reject `no snmp user <name> <role>` when it's the last role defined for the user.
 - workaround is to use `nxos_user` to remove the user

- Changes validated on:
 - `N3K, N3K-F, N35, N6K, N7K, N9K, N9K-F`
 - `6.0(2)A8`
 - `7.0(3)I2, 7.0(3)I4, 7.0(3)I5, 7.0(3)I6, 7.0(3)I7`
 - `7.3(2)D1`
 - `7.3(3)N1, 7.3(4)N1`
 - `8.3(2)`
 - `9.2(2), 9.2(3)`

* fix lint warning

(cherry picked from commit 8c56c11)
abadger pushed a commit that referenced this pull request May 21, 2019
* nxos_snmp_user: platform fixes for get_snmp_user

snmp user output behavior varies quite a bit for the different nxos platforms and required several workarounds:

- N5K/N6k
 - These platforms do not support structured output for `show snmp user`.
 - The current code lands in an `except` clause when the output is not structured; so I added a new `get_non_structured_snmp_user` method to scrape the state from the regular cli output if it's present.

- N9K-F
 - The `group` data in the JSON output is different for this platform; it has a different key (just `group` instead of `TABLE_groups` or `group_names`) and it is not indexed
 - For a single group the value is a string, for multiple groups it's a list

- sanity
 - N5K/N6K/N9K-F platforms will reject `no snmp user <name> <role>` when it's the last role defined for the user.
 - workaround is to use `nxos_user` to remove the user

- Changes validated on:
 - `N3K, N3K-F, N35, N6K, N7K, N9K, N9K-F`
 - `6.0(2)A8`
 - `7.0(3)I2, 7.0(3)I4, 7.0(3)I5, 7.0(3)I6, 7.0(3)I7`
 - `7.3(2)D1`
 - `7.3(3)N1, 7.3(4)N1`
 - `8.3(2)`
 - `9.2(2), 9.2(3)`

* fix lint warning

(cherry picked from commit 8c56c11)
@ansible ansible locked and limited conversation to collaborators Aug 5, 2019
@chrisvanheuveln chrisvanheuveln deleted the devel-snmp_user branch October 30, 2019 12:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. cisco Cisco technologies core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. networking Network category nxos Cisco NXOS community stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants