Skip to content

Commit e514c17

Browse files
authored
Merge branch 'develop' into cisco_ap
2 parents aed5c50 + b7a2f56 commit e514c17

File tree

153 files changed

+16981
-644
lines changed

Some content is hidden

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

153 files changed

+16981
-644
lines changed

EXAMPLES.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ A set of common Netmiko use cases.
1111

1212
#### Available Device Types
1313
- [Available device types](#available-device-types-1)
14-
1514
#### Simple Examples
1615
- [Simple example](#simple-example)
1716
- [Connect using a dictionary](#connect-using-a-dictionary)
@@ -662,6 +661,9 @@ device = {
662661
commands = ["logging buffered 100000"]
663662
with ConnectHandler(**device) as net_connect:
664663
output = net_connect.send_config_set(commands)
664+
# use the appropriate function for your Netmiko platform:
665+
# commit for Cisco-XR, Juniper-Junos, Palo Alto; save_config for others
666+
# output += net_connect.commit()
665667
output += net_connect.save_config()
666668

667669
print()
@@ -713,6 +715,9 @@ device1 = {
713715
cfg_file = "config_changes.txt"
714716
with ConnectHandler(**device1) as net_connect:
715717
output = net_connect.send_config_from_file(cfg_file)
718+
# use the appropriate function for your Netmiko platform:
719+
# commit for Cisco-XR, Juniper-Junos, Palo Alto; save_config for others
720+
# output += net_connect.commit()
716721
output += net_connect.save_config()
717722

718723
print()

PLATFORMS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
- Maipu
5252
- MikroTik RouterOS
5353
- MikroTik SwitchOS
54+
- NEC Univerge IX Routers
5455
- NetApp cDOT
5556
- Netgear ProSafe
5657
- Nokia/Alcatel SR OS

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Netmiko aims to accomplish both of these operations and to do it across a very b
4141

4242
## Supported Platforms
4343

44-
[PLATFORMS](PLATFORMS.md)
44+
[PLATFORMS](https://github.com/ktbyers/netmiko/blob/develop/PLATFORMS.md)
4545

4646
<br />
4747

@@ -64,7 +64,7 @@ $ pip install netmiko
6464

6565
## Common Issues/FAQ
6666

67-
Answers to some [common questions](COMMON_ISSUES.md)
67+
Answers to some [common_questions](https://github.com/ktbyers/netmiko/blob/develop/COMMON_ISSUES.md)
6868

6969
<br />
7070

@@ -158,7 +158,7 @@ Contributors are welcome.
158158

159159
You can contribute to Netmiko in a variety of ways: answering questions on Slack (see below in Questions/Discussions), responding to issues, adding to the common issues, reporting/fixing bugs, or even adding your own device type.
160160

161-
Before contributing a new vendor/platform device type, remember that any code added needs to be supported in some fashion. To add a vendor/platform you can follow the outline [here](VENDOR.md). Once you've worked on your first pass of your driver and have it functional, you'll need to include test data in order for it to be merged into develop, you can see the general flow of how to do that [here](TESTING.md).
161+
Before contributing a new vendor/platform device type, remember that any code added needs to be supported in some fashion. To add a vendor/platform you can follow the outline [here](https://github.com/ktbyers/netmiko/blob/develop/VENDOR.md). Once you've worked on your first pass of your driver and have it functional, you'll need to include test data in order for it to be merged into develop, you can see the general flow of how to do that [here](https://github.com/ktbyers/netmiko/blob/develop/TESTING.md).
162162

163163
For all code contributions, please ensure that you have ran `black` against the code or your code will fail the Travis CI build.
164164

@@ -170,8 +170,20 @@ If you find an issue with Netmiko, then you can open an issue on this projects i
170170

171171
If you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/zt-km2k3upf-AkWHY4YEx3sI1R5irMmc7Q). Once you have entered the workspace, then you can join the #netmiko channel.
172172

173+
<br />
174+
175+
## Sponsors 2025
176+
177+
Special thanks to organizations and people that have helped support Netmiko development. In particular, these organizations have made meaningful contributions that help Netmiko keep moving forward:
178+
179+
<a href="https://slurpit.io/"><img src="https://github.com/ktbyers/netmiko/blob/develop/images/slurpit.png" width="200" alt="Slurp'it Logo"></a>
180+
<a href="https://netpicker.io/"><img src="https://github.com/ktbyers/netmiko/blob/develop/images/netpicker.png" width="200" alt="Netpicker Logo"></a>
173181

174-
---
175-
Kirk Byers
176-
Python for Network Engineers
177-
https://pynet.twb-tech.com
182+
<br />
183+
<br />
184+
185+
##
186+
Kirk Byers <br />
187+
Python for Network Engineers <br />
188+
https://pynet.twb-tech.com <br />
189+
<br />

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)