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

Nokia srl prompt stripping #3531

Merged
merged 5 commits into from
Nov 8, 2024
Merged

Nokia srl prompt stripping #3531

merged 5 commits into from
Nov 8, 2024

Conversation

ktbyers
Copy link
Owner

@ktbyers ktbyers commented Nov 8, 2024

No description provided.

@ktbyers
Copy link
Owner Author

ktbyers commented Nov 8, 2024

@jeffkala Added some tests and converted the one method to a private method (as more consistent with standard Netmiko behavior).

def _strip_context_items(self, a_string: str) -> str:
"""Strip NokiaSRL-specific output.

Nokia will put extra context is line 1 of the prompt, such as:
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
Nokia will put extra context is line 1 of the prompt, such as:
Nokia will put extra context in the 1st line of the prompt, such as:

@@ -53,6 +53,32 @@ def session_preparation(self) -> None:
self.disable_paging(command=command, cmd_verify=True, pattern=r"#")
self.set_base_prompt()

def strip_prompt(self, *args: Any, **kwargs: Any) -> str:
"""Strip the line1 of multiline prompt from the output."""
Copy link
Contributor

Choose a reason for hiding this comment

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

is this statement correct about the 1st line? Shouldn't the strip tackle the two lines?

Copy link
Contributor

Choose a reason for hiding this comment

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

Still calling super which I'd assume would strip the original prompt.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I updated the docstrings, the super() call will get rid of A:srl1#.

The _strip_context_items call will get rid of things like --{ running }...

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I see, by "prompt" you mean only one line of the SR Linux prompt.
Ok, lgtm

@ktbyers
Copy link
Owner Author

ktbyers commented Nov 8, 2024

Look good @jeffkala @hellt ?

@ktbyers ktbyers merged commit 5e77f23 into develop Nov 8, 2024
34 checks passed
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.

3 participants