The CLI that doesn't impose you any language
Project description
NETCLI
netcli is the CLI for the people who doesn't want to remember every command from every vendor gear.
Networking nowadays is moving away from traditional CLI operation, but there is still some debugging use-cases when a CLI interaction gives some benefits. However, when you spend more time coding than CLIing, you end up forgetting about specific CLI syntax, still necessary when you are managing a multi-vendor fleet.
To ovecome this issue, netcli lets you create your own CLI language, for interact with any device using your own custom commands.
netcli solves this problem using a simple approach:
- You have a config mode to handle your custom commands and the translation for all the specific vendors you are interested in.
- You have a connect mode to run an interactive CLI against your devices and enjoy your commands
Installation
pip install netcli
How to run it
Config
Your customs commands will be stored in
~/.my_netcli_commands.json
Add
$ netcli config add "bgp received routes neighbor:192.0.2.1"
Note:
- Use quotes to add your command
- Arguments should come at the end, using the pattern
<arg_name>:<default_value>
This will enter an interactive mode to provide:
- Description: Useful to remember what this command is doing
- Vendor specific implementations, using this format:
<vendor_type> - <vendor_command>
- important within
<vendorcommand>
you can place the arguments provided using[arg_name]
- Example:
show bgp summary [instance (vrf)]
- Every argument is between square brackets
[]
- Within the brackets, the parenthesis
()
is the keyword that will be replaced - If an argument keyword has the string value "None", the argument (and related text) will be omitted
- Every argument is between square brackets
<vendor_type>
comes from Netmiko library
- important within
Delete
$ netcli config delete "bgp received routes"
Show
$ netcli config show
It listes the custom commands with the description and ports.
If you need the vendor implementation, use --verbose
Interactive CLI
$ netcli connect <target> -v <vendor_type>
Enjoy it!
Notes:
- To overwrite a default value use
[<arg_name>:<new_value>]
- Execution of raw commands is possible starting the command with
r-
- Matching output of custom commands can be achieved by adding
|
and the string to match - Use
help
/h
to get extra help
Default options
You can overwrite default behaviours by using file ~/.netcli.cfg
to define some custom values to easy your operation:
{
"dns_suffix": ".opendns.com",
"global_delay_factor": 6,
"max_lines": 20
}
Supported values:
- dns_suffix is concatenated at the end of your target name
- max_lines limit the maximum number of lines to be returned to the CLI (this doesn't affect the logs)
- log_path full path to store the logging of the session. By default is the current directory with the timestamp (i.e. netcli_20190303-194937)
- timeout Netmiko timeout
- global_delay_factor Netmiko global_delay_factor
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file netcli-0.0.10.tar.gz
.
File metadata
- Download URL: netcli-0.0.10.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7af7b3f1d8004de6d2c9226a2bdf31990ee24460e762af591473a2f58be90d85 |
|
MD5 | f6769d3c481a4bec7e031397474d668f |
|
BLAKE2b-256 | 31cf9545d13e435873b46f2251b344e6e310aa17a686e023f09763fd0c4ec4ab |
File details
Details for the file netcli-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: netcli-0.0.10-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33f6c421a23fe2efed94dbdd5d5bcf6fc2e1d75659a9f4ac1d1978cc00b1153c |
|
MD5 | 7b6e2c5dc745dd53f488a458e58bdb91 |
|
BLAKE2b-256 | 7102fe467fb2772e243d404c8418e891040598997950858220028f9ca0070045 |