Skip to main content

Build Status

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
    • <vendor_type> comes from Netmiko library

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

Metadata

Release files for netcli 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netcli 0.0.10
File Size Uploaded Provenance Actions
netcli-0.0.10.tar.gz 12.2 kB Without provenance Details for netcli-0.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for netcli 0.0.10
File Interpreter ABI Platform Actions
netcli-0.0.10-py3-none-any.whl Python 3 none any Details for netcli-0.0.10-py3-none-any.whl

Total release size: 24.1 kB

Release files / netcli-0.0.10.tar.gz

Download URL netcli-0.0.10.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7af7b3f1d8004de6d2c9226a2bdf31990ee24460e762af591473a2f58be90d85
BLAKE2b-256 checksum
How to use checksums
31cf9545d13e435873b46f2251b344e6e310aa17a686e023f09763fd0c4ec4ab
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / netcli-0.0.10-py3-none-any.whl

Download URL netcli-0.0.10-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33f6c421a23fe2efed94dbdd5d5bcf6fc2e1d75659a9f4ac1d1978cc00b1153c
BLAKE2b-256 checksum
How to use checksums
7102fe467fb2772e243d404c8418e891040598997950858220028f9ca0070045
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for netcli 0.0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page