Skip to content

Fix nxos sh license usage for nxos 10+#2296

Open
mjbear wants to merge 2 commits intonetworktocode:masterfrom
mjbear:nxos_sh_lic_usage_issue2285
Open

Fix nxos sh license usage for nxos 10+#2296
mjbear wants to merge 2 commits intonetworktocode:masterfrom
mjbear:nxos_sh_lic_usage_issue2285

Conversation

@mjbear
Copy link
Collaborator

@mjbear mjbear commented Mar 12, 2026

resolves #2285

Fix and add support for NX-OS version 10+ show license usage output.

Copy link
Contributor

@jvanderaa jvanderaa left a comment

Choose a reason for hiding this comment

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

Looking good!

@michalis1
Copy link
Contributor

Hello @mjbear. Just checking in to see if you’re planning to merge this PR, as we need it for our deployment.

^\s*$$
^. -> Error

Version10
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this apply to the command output for all versions of NXOS? If not, should we add this line or block of text as conditional?

Copy link
Contributor

@matt852 matt852 left a comment

Choose a reason for hiding this comment

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

Added 1 comment requesting clarification

Copy link
Contributor

@matt852 matt852 left a comment

Choose a reason for hiding this comment

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

@mjbear Please review suggestions and update if applicable.

^. -> Error

Version10
^\s+Status:\s+${STATUS}$$
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
^\s+Status:\s+${STATUS}$$
^\s*$$
^\s+Status:\s+${STATUS}$$

The Version10 state is missing ^\s*$$ to handle blank lines. The raw test file (cisco_nxos_show_license_usage_ver10.raw) contains blank lines (line 1 is blank, line 4 is blank between sections). Without this, the ^. -> Error directive would trigger on those blank lines — though actually blank lines won't match ^. since . doesn't match empty. Let me re-check: ^\s*$$ is still needed because a line with only whitespace would match ^. and trigger Error. Looking at the raw file, line 1 appears to be a truly empty line and line 4 appears empty. An empty line won't match ^. (since . requires at least one character), but a line with trailing spaces would. To be safe and consistent with repository standards, ^\s*$$ should be added to the Version10 state.

Version10
^\s+Status:\s+${STATUS}$$
# overall License Authorization Status
^\s+Status:\s+\S+
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
^\s+Status:\s+\S+
^\s+Status:\s+.+

Fix the non-capturing status fallback regex to handle multi-word values:

@matt852 matt852 requested a review from jvanderaa March 26, 2026 14:53
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.

Cisco nxos >v10 changed output for show license usage

4 participants