Skip to content

Conversation

@joewesch
Copy link
Collaborator

Closes: #752

NTC-4804

This PR adds a more robust config example as well as some edge cases for the HP Comware platform and adds a custom parser method to properly parse the different sections.

I also was confused which class to update initially, but then I noticed that the HPComwareConfigParser class wasn't really doing much by itself and was redundant. I consolidated the two classes and then added some deprecation warnings and updated the parser to directly use the HPEConfigParser class.

@itdependsnetworks
Copy link
Contributor

can you add a compliance check here: https://github.com/networktocode/netutils/tree/develop/tests/unit/mock/config/compliance/compliance

I am interested to see how you define the scope of the configs when there is a space at the start of the line, and would ask that we consider how that will work with GC

@joewesch
Copy link
Collaborator Author

can you add a compliance check here: https://github.com/networktocode/netutils/tree/develop/tests/unit/mock/config/compliance/compliance

I am interested to see how you define the scope of the configs when there is a space at the start of the line, and would ask that we consider how that will work with GC

Hmm, ok. In that case I'd probably just lstrip() all config lines without parents.

@itdependsnetworks
Copy link
Contributor

can you add a compliance check here: https://github.com/networktocode/netutils/tree/develop/tests/unit/mock/config/compliance/compliance
I am interested to see how you define the scope of the configs when there is a space at the start of the line, and would ask that we consider how that will work with GC

Hmm, ok. In that case I'd probably just lstrip() all config lines without parents.

That may come with other issues for compliance or remediation. Once you put in a compliance test I will take a look at how it works. Pinging @jeffkala on this as well.

@joewesch
Copy link
Collaborator Author

Ok, I have added the compliance tests as requested.

I have also changed the parser to allow the following to be equivalent so that you don't need to format the intended config in the same manner as the backup config (always separate sections by comments):

vlan 1
#
vlan 101
  name 101
vlan 1
vlan 101
  name 101

@@ -0,0 +1,208 @@
#
sysname NTC-Router
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the intended be the same spatially aware configs as the backup?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They don't even match across platforms sometimes.

Space

No Space

Copy link
Collaborator Author

@joewesch joewesch Jan 15, 2026

Choose a reason for hiding this comment

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

I made it space agnostic for single config lines. Both work. Do you want to require that the intended config match the space exactly?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to require that the intended config match the space exactly?

I don't know for sure. I just want to be purposeful and consider how it effects GC.

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.

hp_comware config parsing with initial space

3 participants