Skip to content

Commit f1a3e5f

Browse files
authored
Merge branch 'develop' into improve_paramiko_cleanup
2 parents 45c61e0 + 7d01387 commit f1a3e5f

File tree

94 files changed

+15994
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+15994
-575
lines changed

docs/netmiko/a10/a10_ssh.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,27 @@ <h2 class="section-title" id="header-classes">Classes</h2>
178178
# self.set_terminal_width()
179179
self.disable_paging(command=&#34;terminal length 0&#34;)
180180

181+
def check_config_mode(
182+
self, check_string: str = &#34;)#&#34;, pattern: str = &#34;)#&#34;, force_regex: bool = False
183+
) -&gt; bool:
184+
self.write_channel(self.RETURN)
185+
186+
# You can encounter an issue here (on router name changes) prefer delay-based solution
187+
if not pattern:
188+
output = self.read_channel_timing(read_timeout=10.0)
189+
else:
190+
output = self.read_until_pattern(pattern=pattern)
191+
192+
# A10 can do this &#39;LBR1_PROD-EXT_(NOLICENSE)#&#39; when not licensed (e.g. gns3)
193+
# Example, config: LBR1_PROD-EXT_(config)(NOLICENSE)#
194+
# Example, outside of config LBR1_PROD-EXT_(NOLICENSE)#
195+
output = output.replace(&#34;(NOLICENSE)&#34;, &#34;&#34;)
196+
197+
if force_regex:
198+
return bool(re.search(check_string, output))
199+
else:
200+
return check_string in output
201+
181202
def save_config(
182203
self, cmd: str = &#34;&#34;, confirm: bool = False, confirm_response: str = &#34;&#34;
183204
) -&gt; str:

docs/netmiko/a10/index.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,27 @@ <h2 class="section-title" id="header-classes">Classes</h2>
184184
# self.set_terminal_width()
185185
self.disable_paging(command=&#34;terminal length 0&#34;)
186186

187+
def check_config_mode(
188+
self, check_string: str = &#34;)#&#34;, pattern: str = &#34;)#&#34;, force_regex: bool = False
189+
) -&gt; bool:
190+
self.write_channel(self.RETURN)
191+
192+
# You can encounter an issue here (on router name changes) prefer delay-based solution
193+
if not pattern:
194+
output = self.read_channel_timing(read_timeout=10.0)
195+
else:
196+
output = self.read_until_pattern(pattern=pattern)
197+
198+
# A10 can do this &#39;LBR1_PROD-EXT_(NOLICENSE)#&#39; when not licensed (e.g. gns3)
199+
# Example, config: LBR1_PROD-EXT_(config)(NOLICENSE)#
200+
# Example, outside of config LBR1_PROD-EXT_(NOLICENSE)#
201+
output = output.replace(&#34;(NOLICENSE)&#34;, &#34;&#34;)
202+
203+
if force_regex:
204+
return bool(re.search(check_string, output))
205+
else:
206+
return check_string in output
207+
187208
def save_config(
188209
self, cmd: str = &#34;&#34;, confirm: bool = False, confirm_response: str = &#34;&#34;
189210
) -&gt; str:

docs/netmiko/arista/arista.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,12 @@ <h2 class="section-title" id="header-classes">Classes</h2>
171171
&#34;&#34;&#34;Prepare the session after the connection has been established.&#34;&#34;&#34;
172172
self.ansi_escape_codes = True
173173
self._test_channel_read(pattern=self.prompt_pattern)
174-
cmd = &#34;terminal width 511&#34;
175-
self.set_terminal_width(command=cmd, pattern=r&#34;Width set to&#34;)
174+
try:
175+
cmd = &#34;terminal width 511&#34;
176+
self.set_terminal_width(command=cmd, pattern=r&#34;Width set to&#34;)
177+
except NetmikoTimeoutException:
178+
# Continue on if setting &#39;terminal width&#39; fails
179+
pass
176180
self.disable_paging(cmd_verify=False, pattern=r&#34;Pagination disabled&#34;)
177181
self.set_base_prompt()
178182

@@ -369,6 +373,8 @@ <h3>Inherited members</h3>
369373
<pre><code class="python">class AristaFileTransfer(CiscoFileTransfer):
370374
&#34;&#34;&#34;Arista SCP File Transfer driver.&#34;&#34;&#34;
371375

376+
prompt_pattern = r&#34;[$&gt;#]&#34;
377+
372378
def __init__(
373379
self,
374380
ssh_conn: &#34;BaseConnection&#34;,
@@ -389,6 +395,7 @@ <h3>Inherited members</h3>
389395

390396
def remote_space_available(self, search_pattern: str = &#34;&#34;) -&gt; int:
391397
&#34;&#34;&#34;Return space available on remote device.&#34;&#34;&#34;
398+
search_pattern = self.prompt_pattern
392399
return self._remote_space_available_unix(search_pattern=search_pattern)
393400

394401
def check_file_exists(self, remote_cmd: str = &#34;&#34;) -&gt; bool:
@@ -427,6 +434,13 @@ <h3>Ancestors</h3>
427434
<li><a title="netmiko.cisco_base_connection.CiscoFileTransfer" href="../cisco_base_connection.html#netmiko.cisco_base_connection.CiscoFileTransfer">CiscoFileTransfer</a></li>
428435
<li><a title="netmiko.scp_handler.BaseFileTransfer" href="../scp_handler.html#netmiko.scp_handler.BaseFileTransfer">BaseFileTransfer</a></li>
429436
</ul>
437+
<h3>Class variables</h3>
438+
<dl>
439+
<dt id="netmiko.arista.arista.AristaFileTransfer.prompt_pattern"><code class="name">var <span class="ident">prompt_pattern</span></code></dt>
440+
<dd>
441+
<div class="desc"></div>
442+
</dd>
443+
</dl>
430444
<h3>Inherited members</h3>
431445
<ul class="hlist">
432446
<li><code><b><a title="netmiko.cisco_base_connection.CiscoFileTransfer" href="../cisco_base_connection.html#netmiko.cisco_base_connection.CiscoFileTransfer">CiscoFileTransfer</a></b></code>:
@@ -858,6 +872,9 @@ <h4><code><a title="netmiko.arista.arista.AristaBase" href="#netmiko.arista.aris
858872
</li>
859873
<li>
860874
<h4><code><a title="netmiko.arista.arista.AristaFileTransfer" href="#netmiko.arista.arista.AristaFileTransfer">AristaFileTransfer</a></code></h4>
875+
<ul class="">
876+
<li><code><a title="netmiko.arista.arista.AristaFileTransfer.prompt_pattern" href="#netmiko.arista.arista.AristaFileTransfer.prompt_pattern">prompt_pattern</a></code></li>
877+
</ul>
861878
</li>
862879
<li>
863880
<h4><code><a title="netmiko.arista.arista.AristaSSH" href="#netmiko.arista.arista.AristaSSH">AristaSSH</a></code></h4>

docs/netmiko/arista/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
5555
<pre><code class="python">class AristaFileTransfer(CiscoFileTransfer):
5656
&#34;&#34;&#34;Arista SCP File Transfer driver.&#34;&#34;&#34;
5757

58+
prompt_pattern = r&#34;[$&gt;#]&#34;
59+
5860
def __init__(
5961
self,
6062
ssh_conn: &#34;BaseConnection&#34;,
@@ -75,6 +77,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
7577

7678
def remote_space_available(self, search_pattern: str = &#34;&#34;) -&gt; int:
7779
&#34;&#34;&#34;Return space available on remote device.&#34;&#34;&#34;
80+
search_pattern = self.prompt_pattern
7881
return self._remote_space_available_unix(search_pattern=search_pattern)
7982

8083
def check_file_exists(self, remote_cmd: str = &#34;&#34;) -&gt; bool:
@@ -113,6 +116,13 @@ <h3>Ancestors</h3>
113116
<li><a title="netmiko.cisco_base_connection.CiscoFileTransfer" href="../cisco_base_connection.html#netmiko.cisco_base_connection.CiscoFileTransfer">CiscoFileTransfer</a></li>
114117
<li><a title="netmiko.scp_handler.BaseFileTransfer" href="../scp_handler.html#netmiko.scp_handler.BaseFileTransfer">BaseFileTransfer</a></li>
115118
</ul>
119+
<h3>Class variables</h3>
120+
<dl>
121+
<dt id="netmiko.arista.AristaFileTransfer.prompt_pattern"><code class="name">var <span class="ident">prompt_pattern</span></code></dt>
122+
<dd>
123+
<div class="desc"></div>
124+
</dd>
125+
</dl>
116126
<h3>Inherited members</h3>
117127
<ul class="hlist">
118128
<li><code><b><a title="netmiko.cisco_base_connection.CiscoFileTransfer" href="../cisco_base_connection.html#netmiko.cisco_base_connection.CiscoFileTransfer">CiscoFileTransfer</a></b></code>:
@@ -539,6 +549,9 @@ <h3>Inherited members</h3>
539549
<ul>
540550
<li>
541551
<h4><code><a title="netmiko.arista.AristaFileTransfer" href="#netmiko.arista.AristaFileTransfer">AristaFileTransfer</a></code></h4>
552+
<ul class="">
553+
<li><code><a title="netmiko.arista.AristaFileTransfer.prompt_pattern" href="#netmiko.arista.AristaFileTransfer.prompt_pattern">prompt_pattern</a></code></li>
554+
</ul>
542555
</li>
543556
<li>
544557
<h4><code><a title="netmiko.arista.AristaSSH" href="#netmiko.arista.AristaSSH">AristaSSH</a></code></h4>

0 commit comments

Comments
 (0)