Browse Source

Merge "Follow up for Juniper Junos OS device support"

Zuul 8 months ago
parent
commit
ebfe40fa42

+ 1
- 1
doc/source/configuration.rst View File

@@ -135,7 +135,7 @@ for the HPE 5900 Series device::
135 135
     password = password
136 136
     ip = <switch mgmt ip address>
137 137
 
138
-for the Juniper device::
138
+for the Juniper Junos OS device::
139 139
 
140 140
     [genericswitch:hostname-for-juniper]
141 141
     device_type = netmiko_juniper

+ 1
- 1
doc/source/supported-devices.rst View File

@@ -14,7 +14,7 @@ The following devices are supported by this plugin:
14 14
 * Brocade ICX (FastIron)
15 15
 * Ruijie switches
16 16
 * HPE 5900 Series switches
17
-* Juniper Junos
17
+* Juniper Junos OS switches
18 18
 
19 19
 This Mechanism Driver architecture allows easily to add more devices
20 20
 of any type.

+ 4
- 6
networking_generic_switch/devices/netmiko_devices/juniper.py View File

@@ -109,9 +109,6 @@ class Juniper(netmiko_devices.NetmikoSwitch):
109 109
         class DBLocked(Exception):
110 110
             """Switch configuration DB is locked by another user."""
111 111
 
112
-            def __init__(self, err):
113
-                self.err = err
114
-
115 112
         @tenacity.retry(
116 113
             # Log a message after each failed attempt.
117 114
             after=tenacity.after_log(LOG, logging.DEBUG),
@@ -134,15 +131,16 @@ class Juniper(netmiko_devices.NetmikoSwitch):
134 131
                 # Netmiko raises ValueError on commit failure, and appends the
135 132
                 # CLI output to the exception message. Raise a more specific
136 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 136
                     raise DBLocked(e)
139 137
                 raise
140 138
 
141 139
         try:
142 140
             commit()
143 141
         except DBLocked as e:
144
-            msg = ("Reached timeout waiting for switch configuration DB lock: "
145
-                   "%s" % e.err)
142
+            msg = ("Reached timeout waiting for switch configuration DB lock. "
143
+                   "Configuration might not be committed. Error: %s" % str(e))
146 144
             LOG.error(msg)
147 145
             raise exc.GenericSwitchNetmikoConfigError(
148 146
                 config=device_utils.sanitise_config(self.config), error=msg)

+ 4
- 4
releasenotes/notes/juniper-92d75d3086cf78a2.yaml View File

@@ -1,7 +1,7 @@
1 1
 ---
2 2
 features:
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 6
     The private configuration mode is used in order to provide a level of
7 7
     isolation between sessions, and to ensure that uncommitted changes are not
@@ -11,6 +11,6 @@ features:
11 11
     successful.
12 12
 
13 13
     A retry mechanism is used to handle temporary failures due to multiple
14
-    sessions attempting to lock the JunOS configuration database concurrently.
15
-    The retry mechanism is configured via the configuration options
16
-    ``ngs_commit_interval`` and ``ngs_commit_timeout``.
14
+    sessions attempting to lock the Junos OS configuration database
15
+    concurrently.  The retry mechanism is configured via the configuration
16
+    options ``ngs_commit_interval`` and ``ngs_commit_timeout``.

Loading…
Cancel
Save