summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-07-30 21:01:41 +0000
committerGerrit Code Review <review@openstack.org>2018-07-30 21:01:41 +0000
commitebfe40fa42de38b7288ee6a053eaba9db73618e7 (patch)
treeb30750a41aec32bf911e1ada8af48d2d890ffb21
parent9ee62e043ded31f9a017417074c4c0163f9231f6 (diff)
parenta98cb0daf02d16be26462488c58370b9e19ad32f (diff)
Merge "Follow up for Juniper Junos OS device support"
-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 26eec23..c61f1c8 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -135,7 +135,7 @@ for the HPE 5900 Series device::
135 password = password 135 password = password
136 ip = <switch mgmt ip address> 136 ip = <switch mgmt ip address>
137 137
138for the Juniper device:: 138for the Juniper Junos OS device::
139 139
140 [genericswitch:hostname-for-juniper] 140 [genericswitch:hostname-for-juniper]
141 device_type = netmiko_juniper 141 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``.