Skip to main content

Python tool to automate connecting to network devices and retrieve information and/or make configration changes

Project description

latest release downloads

Playbook Orchestration tool for Network Engineers. Orchestration Tool for Network Engineers.

PyPlaybook.py:

Python tool to automate and orchestrate connecting to network devices and retrieve information and/or make configuration changes. This tool will allow you to read playbook(s) from an Excel workbook (see Playbook_template.xlsx) and get inquiry and/or config commands and run them against a single or multiple device(s). If the Excel workbook contains multiple tabs/sheets the tool will read all tabs from left to right and execute the statements in the playbook accordingly.(check the excel template for more information on the format and naming convention and sample show and config statements.)

Port Range VLAN changes.py:

This tool will assign/change a port/port range into a vlan on an L2 switch(es) and also add the VLAn to the uplink port on the L2 switch and also add the new VLAN on the distro/core. The port(s) and VLAN information gets read from an excel workbook (see the Port Range VLAN changes.xlsx template).

These programs have been designed to connect to multiple devices at the same time by using Multi Threads which will reduce the amount of time it will take significantly if the tasks are ran as linear process.

These programs require the following prerequisites Python version and packages:

Dependencies:

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
sudo apt install python3-pip
sudo python3.7 -m pip install --upgrade pip
sudo ln -s /usr/bin/python3.7 /usr/bin/python

Required Python Version and Libraries:

- Python 3.x.x or Higher (recommended version 3.7.2)
- Python packages:
  - netmiko
  - xlrd
  - pandas
  - pandas.io
  - PyYAML

To install the packages:

  - Linux: sudo pip install xlrd pandas pandas.io netmiko PyYAML
  - Windows(run as administrator): pip install xlrd pandas pandas.io netmiko PyYAML
  • To install the packages for Windows, open a command prompt as an administator and run the same commomand. Make sure you have the lates Python version and PIP has been installed)
  • Once you have your Python environment setup just drop the Python tools into a folder in the computer you installed Python and give it a go after you finish reading the rest of this Readme file.
  • The tools need to be run from the CLI and the file containing the playbook (Excel Workbook) needs to be passed as an argument.
  • To create your playbook(s) you can use the Excel Workbooks provided in the repository. Make sure you don't remove the first row on the first tab of the spreadsheet since all the supported device_type are included on this row and can be selected on the device_type column from the drop down list.
  • For help on how to run the PyPlaybook.py, run the program without any parameters or with the '-h' flag.
    -e.g:
    - python PyPlaybook.py
    usage: PyPlaybook.py [-h] -i INPUTFILE -w W [-v]
    - PyPlaybook.py: error: the following arguments are required: -i/--inputfile, -w
  • PyPlaybook.py -h
    • usage: PyPlaybook.py [-h] -i INPUTFILE -w W -ts TS -qs QS [-v]
    • Playbook Runner by David Morfe
    • optional arguments:
      -h, --help show this help message and exit
      -i INPUTFILE, --inputfile INPUTFILE
      inputfile name is required.
      -w W specify if configuration should be save into Startup
      Config. 'Y' to write config 'N' to preserve Startup
      Config. If this flag is not specified or any other
      value is entered the default will be no to write the
      config changes. Default: 'N'
      -ts TS Number of Threads to be created. Must be a number from
      1 thru 4 If a number greater than 4 is entered, the
      maximum Thread number will be used. Default: '2'
      -qs QS Queue size. Must be a number from 1 thru 50. If a
      number greater than 50 is entered, the maximum Queue
      number will used. Default: '20'
      -v, --version show program's version number and exit

These Python programs will create a '.log' file in the current directory from where the programs are ran. The name of the .log file is automatically generated based on the device name and the IP address of the device.

Error handling added to connection object and error loggin added to save error(s) to error.log.

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

PyPlaybook-0.0.2.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

PyPlaybook-0.0.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file PyPlaybook-0.0.2.tar.gz.

File metadata

  • Download URL: PyPlaybook-0.0.2.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for PyPlaybook-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4a6183cfca44716548b2d4f0bc86eb807984427e9b0bbab2c573d49d119eda08
MD5 0c46c5ef3e40493662cbfdd4de4597d3
BLAKE2b-256 4760ea1b313e4c49dc216746fbc1e9e1e5200a8d5c9f6c2844bfbe17cbdb09b1

See more details on using hashes here.

File details

Details for the file PyPlaybook-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: PyPlaybook-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for PyPlaybook-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 042e4c3f6011c6198e4a6a42f4689b42247d3c6c8a67f59922a052f53a17154e
MD5 033787a81080c8c8e5ea45e908d46f05
BLAKE2b-256 fe1a7b7604d48090929fad4070c426189f2fabbd57e02e0b4a2fac9b9923488d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page