Skip to content

Conversation

@marcus-cain
Copy link
Contributor

Created new template for display version. Added multidude of test files with all sorts of variations from both comware 5 and comware 7

Updated the index file following longest match order

…es with all sorts of variations from both comware 5 and comware 7

Signed-off-by: Cain,Marcus <[email protected]>
@mjbear mjbear changed the title Created new template for 'display version' for HP Comware Create HP Comware display version Oct 13, 2025
@mjbear mjbear added the changes_requested Waiting on user to address feedback label Oct 13, 2025
@mjbear
Copy link
Collaborator

mjbear commented Oct 13, 2025

@marcus-cain
I sent a few suggestions.
(They're examples and not all-inclusive of each item to address.)

Thank you!

@marcus-cain
Copy link
Contributor Author

@mjbear
Thank you for the review. I agree with your recommendations... let me commit those and rescan this template to see if there are any other further improvements. Will rerun through my test sets after all changes/recommendations have been made.. Will post once done.

Thanks!

…ns. refactored white-space matching to be consistent with other templates to match single-white space character or more '\s+' instead of 0-white space characters. Additionally, improved capturing of model by using a non-greedy approach, which better improves and captures the device model

Signed-off-by: Cain,Marcus <[email protected]>
@marcus-cain
Copy link
Contributor Author

marcus-cain commented Oct 16, 2025

@mjbear - I have made some modifications to the template. You can see the difference here:
https://github.com/networktocode/ntc-templates/pull/2206/files/4edf4493e2f6b5756c0e85304825a921b5145be6..babb07aa48d7bd776a688f04559f0f24b939576d

I took your recommendation and got rid of wrapping optional characters in parenthesis. I also consolidated alot of the common/similar regex lines which cleaned up the redundant expressions accordingly.

I also replaced white-space character matching with \s+ instead of \s* to capture 1 or more whitespace character, as this is consistent with how other templates are matching white-space

The biggest improvement is that i updated the CaptureGroup for model to be a non-greedy. This really helped the data quality for model, because before it was capturing "spaces" and random "power supply and slot" information into the model because of the various ways that comware presents this information. So now with the model being non-greedy, i am able to specify all the various random words that come after the model, but isn't actually part of the model'

example:
Here are some photos of the raw output where the highlight text should not be captured as the model
image
image
image
image

So by taking a non-greedy approach, i was able to capture the model exactly by specifying the random words that comware shows after the model:
^\s*(HPE?|H3C)\s+${MODEL}\s+(\d+-slot|EI|HI|Switch|\(\d+W\)).+uptime\s+is\s+${UPTIME}$$

…ware 5 chassis devices. This change is covered by test sets 'cw5_1.yml', 'cw5_2.yml', 'cw5_3.yml'. With this change, comware5 and comware 7 chassis based devices are consistently parsed, where the main board is recognized by empty slot, and the line cards are represented by their slot numbers

Signed-off-by: Cain,Marcus <[email protected]>
software_version: "7.1.045"
uptime: "171 weeks, 5 days, 15 hours, 39 minutes"
- last_reboot_reason: "ColdReboot"
model: "5130-48G-PoE+-4SFP+ (370W) EI JG937A"
Copy link
Collaborator

@mjbear mjbear Oct 19, 2025

Choose a reason for hiding this comment

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

@marcus-cain
This yaml line has the wattage and so forth.
Maybe it didn't get updated?

software_version: "7.1.045"
uptime: "497 weeks, 5 days, 15 hours, 4 minutes"
- last_reboot_reason: "ColdReboot"
model: "5130 48G 4SFP+ 1-slot HI"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file also has extra characters after the model.
In this case, 1-slot HI

Is this expected @marcus-cain?

Copy link
Collaborator

@mjbear mjbear Oct 19, 2025

Choose a reason for hiding this comment

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

This cw5_1 file seems awful similar to cw5_2 (and thus its raw output too).
Is this correct @marcus-cain?

We should strive to keep test data to the cover the differences and reduce any duplication/redundancy.

In the case I've overlooked any meaningful differences, my apologies.

@mjbear
Copy link
Collaborator

mjbear commented Nov 1, 2025

Hi @marcus-cain
Did you see my messages about the following files?

(Here's a list, but see above for details. Thank you!)

  • cw7_4.yml
  • cw7_3.yml
  • cw5_1.yml

@mjbear
Copy link
Collaborator

mjbear commented Nov 22, 2025

Hi @marcus-cain Did you see my messages about the following files?

(Here's a list, but see above for details. Thank you!)

* cw7_4.yml

* cw7_3.yml

* cw5_1.yml

@marcus-cain
Great progress on this template!

There are a couple of remaining questions I'll link to below.

  1. wattage in yml question (cw7_3.yml)
  2. 1-slot HI question (cw7_4.yml)
  3. nearly identical raw output question
    • cw5_1.raw - when diffed against cw5_2.raw, there are no differences

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes_requested Waiting on user to address feedback question

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants