-
Notifications
You must be signed in to change notification settings - Fork 4
Juniper private config #2
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
Conversation
Change-Id: I54c687e364b0bea0ec07c9fa97910aa1aadeb895
Extracts the sending of netmiko configuration commands into a separate method. This allows subclasses to implement as necessary. Change-Id: I8eea36c5ae93230df6c626a0ac9e2225d8f2da0e
0233aa2 to
11fd666
Compare
|
@pheller I can't seem to add you as a reviewer, but please feel free to comment. |
oneswig
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some minor observations.
| self.switch.del_network(33, '0ae071f55be943e480eae41fefe85b21') | ||
| mock_exec.assert_called_with(['delete vlans 0ae071f55be943e480eae41fefe85b21']) | ||
| mock_exec.assert_called_with( | ||
| ['delete vlans 0ae071f55be943e480eae41fefe85b21']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great opener.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have to keep pep8 happy.
| result = self.switch.send_config_set(connect_mock, ['spam ham aaaa']) | ||
| self.assertFalse(connect_mock.enable.called) | ||
| connect_mock.send_config_set.assert_called_once_with( | ||
| config_commands=['spam ham aaaa'], exit_config_mode=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the standard NGS test string.
| message = _("Netmiko connection error: %(config)s, error: %(error)s") | ||
|
|
||
|
|
||
| class GenericSwitchNetmikoConfigError(GenericSwitchException): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you annotated code paths where this exception could now be thrown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I haven't, I'll do that.
| # another session has a lock. We use a retry mechanism to work around | ||
| # this. | ||
|
|
||
| class DBLocked(Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now seen this in the wild, the log message is not terrifically helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poor error reporting is due to ktbyers/netmiko#601. I backported my fix for the issue and added it to the neutron server container.
The switch configuration may contain a password field, which we should not be including in an exception message. This change adds a function for sanitising switch configuration, and uses it when raising exceptions with switch device configuration. Change-Id: Ic5d6de7b8f44f23afabbc468945c6f69d5b829d7 Closes-Bug: #1683839
This ensures that we don't bury useful exception information within a default exception. Change-Id: Id0142865341bd4f3cb5195a0ba6a4477b0dd0dc6
The private configuration mode provides each session with a private configuration candidate to edit. Changes made in other sessions are not shown, and uncommitted changes will be discarded when the session ends. This allows separate neutron server processes and threads to make changes without affecting eachother or other users. Change-Id: Ib80e33fa2d2002c537bc574a2839fe0c829c75f6
If another session has a lock on the configuration when we try to commit configuration changes to a Juniper switch, our commit will fail. This can be worked around by retrying the commit until it succeeds. We try at 5 second intervals for up to 60 seconds. Change-Id: Ic52fae43c18dffa97d6513987110744147004b46
11fd666 to
704fa30
Compare
No description provided.