bspendlove / netmiko Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ktbyers/netmiko
Multi-vendor library to simplify Paramiko SSH connections to network devices
License: MIT License
This project forked from ktbyers/netmiko
Multi-vendor library to simplify Paramiko SSH connections to network devices
License: MIT License
Huawei SmartAX devices sometimes shows an extra prompt that you need to handle with a return
for a lot of commands, here is an example:
device#display current-configuration
{ <cr>|ont<K>|port<K>|section<K>|service-port<K>|simple<K>||<K> }:
To progress with obtaining the output, a return needs to be sent. The current update handles this in a 'hacky' way and just sends a return if { <cr
is found in the output. However there must be a cleaner solution to this problem.
Currently uses the Cisco Base Class, however issues occur with some commands that prompt that additional commands, prompt example below:
{ <cr>|wrr-weight<K> }:
This prompt doesn't appear with commands like:
device(config)#sysname testlab.xyz
Huawei SmartAX devices can use the command scroll
to disable the paging output. However, you need to manually send a return after the command scroll
because of the following prompt as shown below:
device>scroll
{ <cr>|number<U><10,512> }:
This is currently handled by the disable_paging method to use send_command
instead of write_channel
. Not entirely sure if I should use the send_command
or fix this up slightly...
Example of a working script using the huawei_smartax
device_type:
config_set = [
'undo acl 2224',
'acl 2224',
'rule permit source 192.0.2.0 0.0.0.3',
'rule permit source 192.0.2.4 0.0.0.3',
'rule permit source 192.0.2.8 0.0.0.3'
]
if ssh_device:
ssh_device.enable()
find_acl_2224 = ssh_device.send_command("display current-configuration | include acl 2224")
if "acl 2224" in find_acl_2224:
print("found acl 2224\n", "send_config_set test...")
print(ssh_device.send_config_set(config_set))
output = ssh_device.send_command("display acl 2224")
if output:
print(output)
else:
print("ACL not found...")
Output:
$ python huawei_general_testing.py
found acl 2224
send_config_set test...
config
huawei.test-lab.xyz(config)#undo acl 2224
huawei.test-lab.xyz(config)#acl 2224
huawei.test-lab.xyz(config-acl-basic-2224)#rule permit source 192.0.2.0 0.0.0.3
huawei.test-lab.xyz(config-acl-basic-2224)#rule permit source 192.0.2.4 0.0.0.3
huawei.test-lab.xyz(config-acl-basic-2224)#rule permit source 192.0.2.8 0.0.0.3
huawei.test-lab.xyz(config-acl-basic-2224)#return
huawei.test-lab.xyz#
Basic ACL 2224, 3 rules
Acl's step is 5
rule 5 permit source 192.0.2.0 0.0.0.3 (0 times matched)
rule 10 permit source 192.0.2.4 0.0.0.3 (0 times matched)
rule 15 permit source 192.0.2.8 0.0.0.3 (0 times matched)
Intensive testing will be in place to try to break the Netmiko device_type huawei_smartax
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.