summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2018-07-27 10:31:29 +0100
committerMark Goddard <mark@stackhpc.com>2018-07-27 10:31:29 +0100
commita98cb0daf02d16be26462488c58370b9e19ad32f (patch)
tree71e5ab9bd6315727f909ed26ea6b2c7e1812bd1e
parent7b6d35f1d83dca4b45ca18458c55f032e02615bd (diff)
Follow up for Juniper Junos OS device support
Notes
Notes (review): Code-Review+1: Ilya Etingof <etingof@gmail.com> Code-Review+2: Dmitry Tantsur <divius.inside@gmail.com> Code-Review+2: Julia Kreger <juliaashleykreger@gmail.com> Workflow+1: Julia Kreger <juliaashleykreger@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 30 Jul 2018 21:01:41 +0000 Reviewed-on: https://review.openstack.org/586490 Project: openstack/networking-generic-switch Branch: refs/heads/master
-rw-r--r--doc/source/configuration.rst2
-rw-r--r--doc/source/supported-devices.rst2
-rw-r--r--networking_generic_switch/devices/netmiko_devices/juniper.py10
-rw-r--r--releasenotes/notes/juniper-92d75d3086cf78a2.yaml8
4 files changed, 10 insertions, 12 deletions
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 580e237..f114bf1 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -129,7 +129,7 @@ for the HPE 5900 Series device::
129 password = password 129 password = password
130 ip = <switch mgmt ip address> 130 ip = <switch mgmt ip address>
131 131
132for the Juniper device:: 132for the Juniper Junos OS device::
133 133
134 [genericswitch:hostname-for-juniper] 134 [genericswitch:hostname-for-juniper]
135 device_type = netmiko_juniper 135 device_type = netmiko_juniper
diff --git a/doc/source/supported-devices.rst b/doc/source/supported-devices.rst
index a7e342a..75e5972 100644
--- a/doc/source/supported-devices.rst
+++ b/doc/source/supported-devices.rst
@@ -14,7 +14,7 @@ The following devices are supported by this plugin:
14* Brocade ICX (FastIron) 14* Brocade ICX (FastIron)
15* Ruijie switches 15* Ruijie switches
16* HPE 5900 Series switches 16* HPE 5900 Series switches
17* Juniper Junos 17* Juniper Junos OS switches
18 18
19This Mechanism Driver architecture allows easily to add more devices 19This Mechanism Driver architecture allows easily to add more devices
20of any type. 20of any type.
diff --git a/networking_generic_switch/devices/netmiko_devices/juniper.py b/networking_generic_switch/devices/netmiko_devices/juniper.py
index 5f3b096..9445552 100644
--- a/networking_generic_switch/devices/netmiko_devices/juniper.py
+++ b/networking_generic_switch/devices/netmiko_devices/juniper.py
@@ -109,9 +109,6 @@ class Juniper(netmiko_devices.NetmikoSwitch):
109 class DBLocked(Exception): 109 class DBLocked(Exception):
110 """Switch configuration DB is locked by another user.""" 110 """Switch configuration DB is locked by another user."""
111 111
112 def __init__(self, err):
113 self.err = err
114
115 @tenacity.retry( 112 @tenacity.retry(
116 # Log a message after each failed attempt. 113 # Log a message after each failed attempt.
117 after=tenacity.after_log(LOG, logging.DEBUG), 114 after=tenacity.after_log(LOG, logging.DEBUG),
@@ -134,15 +131,16 @@ class Juniper(netmiko_devices.NetmikoSwitch):
134 # Netmiko raises ValueError on commit failure, and appends the 131 # Netmiko raises ValueError on commit failure, and appends the
135 # CLI output to the exception message. Raise a more specific 132 # CLI output to the exception message. Raise a more specific
136 # exception for a locked DB, on which tenacity will retry. 133 # exception for a locked DB, on which tenacity will retry.
137 if "error: configuration database locked" in str(e): 134 DB_LOCKED_MSG = "error: configuration database locked"
135 if DB_LOCKED_MSG in str(e):
138 raise DBLocked(e) 136 raise DBLocked(e)
139 raise 137 raise
140 138
141 try: 139 try:
142 commit() 140 commit()
143 except DBLocked as e: 141 except DBLocked as e:
144 msg = ("Reached timeout waiting for switch configuration DB lock: " 142 msg = ("Reached timeout waiting for switch configuration DB lock. "
145 "%s" % e.err) 143 "Configuration might not be committed. Error: %s" % str(e))
146 LOG.error(msg) 144 LOG.error(msg)
147 raise exc.GenericSwitchNetmikoConfigError( 145 raise exc.GenericSwitchNetmikoConfigError(
148 config=device_utils.sanitise_config(self.config), error=msg) 146 config=device_utils.sanitise_config(self.config), error=msg)
diff --git a/releasenotes/notes/juniper-92d75d3086cf78a2.yaml b/releasenotes/notes/juniper-92d75d3086cf78a2.yaml
index d57b2dd..3c4e796 100644
--- a/releasenotes/notes/juniper-92d75d3086cf78a2.yaml
+++ b/releasenotes/notes/juniper-92d75d3086cf78a2.yaml
@@ -1,7 +1,7 @@
1--- 1---
2features: 2features:
3 - | 3 - |
4 Adds a new driver, ``netmiko_juniper``, for Juniper JunOS devices. 4 Adds a new driver, ``netmiko_juniper``, for Juniper Junos OS devices.
5 5
6 The private configuration mode is used in order to provide a level of 6 The private configuration mode is used in order to provide a level of
7 isolation between sessions, and to ensure that uncommitted changes are not 7 isolation between sessions, and to ensure that uncommitted changes are not
@@ -11,6 +11,6 @@ features:
11 successful. 11 successful.
12 12
13 A retry mechanism is used to handle temporary failures due to multiple 13 A retry mechanism is used to handle temporary failures due to multiple
14 sessions attempting to lock the JunOS configuration database concurrently. 14 sessions attempting to lock the Junos OS configuration database
15 The retry mechanism is configured via the configuration options 15 concurrently. The retry mechanism is configured via the configuration
16 ``ngs_commit_interval`` and ``ngs_commit_timeout``. 16 options ``ngs_commit_interval`` and ``ngs_commit_timeout``.