Skip to content

Conversation

@markgoddard
Copy link

No description provided.

Change-Id: I54c687e364b0bea0ec07c9fa97910aa1aadeb895
Extracts the sending of netmiko configuration commands into a separate method.
This allows subclasses to implement as necessary.

Change-Id: I8eea36c5ae93230df6c626a0ac9e2225d8f2da0e
@markgoddard markgoddard self-assigned this Oct 13, 2017
@markgoddard markgoddard force-pushed the juniper-private-config branch from 0233aa2 to 11fd666 Compare October 13, 2017 11:50
@markgoddard
Copy link
Author

@pheller I can't seem to add you as a reviewer, but please feel free to comment.

Copy link
Member

@oneswig oneswig 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, 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'])
Copy link
Member

Choose a reason for hiding this comment

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

Great opener.

Copy link
Author

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)
Copy link
Member

Choose a reason for hiding this comment

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

cute

Copy link
Author

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):
Copy link
Member

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?

Copy link
Author

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):
Copy link
Member

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.

Copy link
Author

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
@markgoddard markgoddard force-pushed the juniper-private-config branch from 11fd666 to 704fa30 Compare October 18, 2017 16:44
@markgoddard markgoddard merged commit 94d744e into stackhpc/pike Oct 26, 2017
@markgoddard markgoddard deleted the juniper-private-config branch October 26, 2017 16:02
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