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

Cisco XR commit failure handling not working properly #1860

Open
tdorssers opened this issue Jul 29, 2020 · 3 comments
Open

Cisco XR commit failure handling not working properly #1860

tdorssers opened this issue Jul 29, 2020 · 3 comments
Labels

Comments

@tdorssers
Copy link

The commit command is an interactive command and the code tries to handle the situation where other commits have occurred during the configuration session. However send_command_expect is used instead of send_command_timing and therefore the code to handle the alt_error_marker is never reached.
I propose to change output += self.send_command_expect( into output += self.send_command_timing( of the following section of cisco_xr.py.

        # Enter config mode (if necessary)
        output = self.config_mode()
        output += self.send_command_expect(
            command_string,
            strip_prompt=False,
            strip_command=False,
            delay_factor=delay_factor,
        )
        if error_marker in output:
            raise ValueError(f"Commit failed with the following errors:\n\n{output}")
        if alt_error_marker in output:
            # Other commits occurred, don't proceed with commit
            output += self.send_command_timing(
                "no", strip_prompt=False, strip_command=False, delay_factor=delay_factor
            )
            raise ValueError(f"Commit failed with the following errors:\n\n{output}")

Before the proposed change, netmiko incorrectly raises NetmikoTimeoutException with message Timed-out reading channel, pattern not found in output. After the proposed change, netmiko correctly raises ValueError with message Commit failed with the following errors:.
Thanks,
Tim

@ktbyers
Copy link
Owner

ktbyers commented Jul 29, 2020

We should also add a test case for this into our IOS-XR tests. I am probably only testing the normal case where there are no other pending commits (I am assuming this is why my standard commit tests on IOS-XR are working properly).

@tdorssers
Copy link
Author

It looks like test_clear_msg() in test_netmiko_commit.py ends with assert True is True, so the test case always succeeds if I am not mistaken.

@ktbyers
Copy link
Owner

ktbyers commented Jul 29, 2020

Yes, it looks to me like that test was never fully implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants