Skip to content

Conversation

@jdrew82
Copy link
Contributor

@jdrew82 jdrew82 commented Mar 18, 2022

Here's my second attempt at a parser for Nokia SrOS. This time, I'm using the tab indented format that is standard for their configuration backups. This uses the standard space-based parser but also uses the section banners as parents for the section stripping out the section title from the 'echo "System Configuration"` portion. This theoretically allows the end-user to simply put in "System Configuration" when wanting to compare sections and it should parse the full block.

jdrew82 added 3 commits March 18, 2022 11:49
…arents

In order to allow the config section banners to be used for specifying a section in parsing I've simplified it so those banner names are the parent for the section. Should allow for a user to specify "System Configuration" for a section and get the full block.
Realized I could use the inherited method just as well as the one I'd written so getting rid of unnecessary code.
@@ -0,0 +1,5562 @@
exit all
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to include this in the example? I am a bit torn (if I understand this correctly), what is the expected result, but we should be purposeful in our decision.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was simply copying this example from @h4ndzdatm0ld TTP repo with the assumption this is a standard format for configurations.

Copy link
Contributor

Choose a reason for hiding this comment

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

@itdependsnetworks @jdrew82 I am happy to share a ContainerLab setup with a Nokia SROS device for the team to use for current and future testing or integrations, etc. If interested, please let me know. Also, the basic 'show config' (admin display-config) equivalent of SROS will always include exit all at the end.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, on the needing more configs to test, I could dig up some old configs but they will need some sanitizing.

Copy link
Contributor

Choose a reason for hiding this comment

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

that would be great.

@itdependsnetworks
Copy link
Contributor

Looking good, but we def need more config tests.

Copy link
Collaborator

@jeffkala jeffkala left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@jeffkala
Copy link
Collaborator

Approved this PR, the final test that was added was properly being sent in as post processed config for SROS.

line (str): A config line from the device that has been found to be a section title.

Returns:
str|bool: The section's title from the section banner, else False.
Copy link
Collaborator

@qduk qduk Apr 22, 2022

Choose a reason for hiding this comment

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

I never thought about adding the | to specify or. That's cool.

@jeffkala jeffkala merged commit a97c7d7 into networktocode:develop Apr 22, 2022
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.

6 participants