Command Line tool to export IP Fabric Tables to Excel
Project description
IP Fabric Tables to Excel
This Command Line Tool is used to convert IP Fabric tables to a single Microsoft Excel file.
Requirements:
- Python 3.8+
- IP Fabric Python SDK
- IP Fabric API Token or Username/Password
Set up .env file:
cat .env
IPF_TOKEN='mylongtokenstring123456789'
IPF_URL='https://ipfabric.is.awesome'
Installation:
Pip/PyPI
pip install ipfabric-tables-to-excel
Local Installation
- Clone the repository:
git clone
- Change directory to the repository:
cd ipfabric-tables-to-excel
- Install the package:
pip install -r requirements.txt
Usage:
Poetry
Ensure you have Poetry installed:
pip install -U poetry
Install the dependencies:
poetry install
Run the tool:
poetry run ipfabric-tables-to-excel --help
Pip/PyPI
Run the tool:
ipfabric-tables-to-excel --help
Local Installation Usage
Run the tool:
python ipf_tables_to_excel/main.py --help
🚀 IP Fabric Tables to Excel Exporter! 🚀
Retrieving only running, loading, loaded snapshots. To load all snapshots set `unloaded` to True.
usage: main.py [-h] [--ipf-tables tables/spanning-tree/inconsistencies/ports-multiple-neighbors [tables/spanning-tree/inconsistencies/ports-multiple-neighbors ...]]
[--device_hostname device_name [device_name ...]] [--print-tables PRINT_TABLES]
fetch tables from IP Fabric and insert into a single excel file with multiple sheets
options:
-h, --help show this help message and exit
--ipf-tables tables/spanning-tree/inconsistencies/ports-multiple-neighbors [tables/spanning-tree/inconsistencies/ports-multiple-neighbors ...]
API or Front end URL for IP Fabric tables to fetch. Can be used multiple times.
--device_hostname device_name [device_name ...]
Device Hostname to fetch data for. Can be used multiple times. If not provided, all devices will be used.
--print-tables PRINT_TABLES
Print first 3 rows of each table fetched
--output-file-name OUTPUT_FILE_NAME
Name or Path of the output file. Default is output.xlsx
Examples:
Poetry
poetry run ipfabric-tables-to-excel --ipf-tables tables/networks/routes --device_hostname L1EXOS1 --ipf-tables inventory/hosts --device_hostname L21PE192 --output-file-name "testing"
🚀 IP Fabric Tables to Excel Exporter! 🚀
Retrieving only running, loading, loaded snapshots. To load all snapshots set `unloaded` to True.
🔄Fetching data for tables/networks/routes...for device L1EXOS1...
🔄Fetching data for tables/networks/routes...for device L21PE192...
🔄Fetching data for inventory/hosts...for device L1EXOS1...
🔄Fetching data for inventory/hosts...for device L21PE192...
Exporting data to excel...
Export complete. Check output.xlsx
👋 Bye!
Pip/PyPI
ipfabric-tables-to-excel --ipf-tables tables/management/dns/settings --device_hostname L1EXOS1 --ipf-tables inventory/hosts --device_hostname L21PE192
🚀 IP Fabric Tables to Excel Exporter! 🚀
Retrieving only running, loading, loaded snapshots. To load all snapshots set `unloaded` to True.
🔄Fetching data for tables/management/dns/settings...for device L1EXOS1...
🔄Fetching data for tables/management/dns/settings...for device L21PE192...
🔄Fetching data for inventory/hosts...for device L1EXOS1...
🔄Fetching data for inventory/hosts...for device L21PE192...
Exporting data to excel...
Sheet name L21PE192_management_dns_settings is too long. Truncating to 31 characters.
Export complete. Check output.xlsx
👋 Bye!
Known Limitations
- Not all tables are supported. Only tables with a 'sn' and the 'inventory/hosts' table are supported.
- Example,
technology/interfaces/connectivity-matrix/connectivity-matrix
is not supported. There is no 'sn' column.- This table has both a
local_sn
andremote_sn
column. This tool only supports tables with a single 'sn' column. - This table is curated from
technology/interfaces/connectivity-matrix/unmanaged-neighbors-detail
table which has a 'sn' column.
- This table has both a
- Example,
ipfabric-tables-to-excel --ipf-tables technology/interfaces/connectivity-matrix/connectivity-matrix --device_hostname L1EXOS1 --ipf-tables technology/interfaces/connectivity-matrix/unmanaged-neighbors-detail --device_hostname L21PE192
🚀 IP Fabric Tables to Excel Exporter! 🚀
Retrieving only running, loading, loaded snapshots. To load all snapshots set `unloaded` to True.
🔄Fetching data for technology/interfaces/connectivity-matrix/connectivity-matrix...for device L1EXOS1...
Cant fetch data for technology/interfaces/connectivity-matrix/connectivity-matrix.
Error: Client error '422 Unprocessable Entity' for url
'https://sa-eu-demo-main01a.hel1-cloud.ipf.cx/api/v6.7/tables/interfaces/connectivity-matrix?format=%7B%22dataType%22:%22json%22%7D&filters=%7B%22and%22:[%7B%22sn%22:[%22eq%22,%22SIM0
067-0000%22]%7D]%7D&columns=[%22localMedia%22,%22siteName%22,%22id%22,%22remoteInt%22,%22localInt%22,%22remoteHost%22,%22localHost%22,%22protocol%22,%22remoteSn%22,%22remoteMedia%22,%
22localSn%22]&snapshot=4253eade-b1af-4061-ac07-caf84bf0626c'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422
Does Table technology/interfaces/connectivity-matrix/connectivity-matrix support the filter {'and': [{'sn': ['eq', 'SIM0067-0000']}]}?
🔄Fetching data for technology/interfaces/connectivity-matrix/connectivity-matrix...for device L21PE192...
Cant fetch data for technology/interfaces/connectivity-matrix/connectivity-matrix.
Error: Client error '422 Unprocessable Entity' for url
'https://sa-eu-demo-main01a.hel1-cloud.ipf.cx/api/v6.7/tables/interfaces/connectivity-matrix?format=%7B%22dataType%22:%22json%22%7D&filters=%7B%22and%22:[%7B%22sn%22:[%22eq%22,%227798
8032%22]%7D]%7D&columns=[%22localMedia%22,%22siteName%22,%22id%22,%22remoteInt%22,%22localInt%22,%22remoteHost%22,%22localHost%22,%22protocol%22,%22remoteSn%22,%22remoteMedia%22,%22lo
calSn%22]&snapshot=4253eade-b1af-4061-ac07-caf84bf0626c'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422
Does Table technology/interfaces/connectivity-matrix/connectivity-matrix support the filter {'and': [{'sn': ['eq', '77988032']}]}?
🔄Fetching data for technology/interfaces/connectivity-matrix/unmanaged-neighbors-detail...for device L1EXOS1...
🔄Fetching data for technology/interfaces/connectivity-matrix/unmanaged-neighbors-detail...for device L21PE192...
Exporting data to excel...
Sheet name L1EXOS1_technology_interfaces_connectivity-matrix_unmanaged-neighbors-detail is too long. Truncating to 31 characters.
Sheet name L21PE192_technology_interfaces_connectivity-matrix_unmanaged-neighbors-detail is too long. Truncating to 31 characters.
Export complete. Check output.xlsx
👋 Bye!
Project details
Release history Release notifications | RSS feed
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 ipfabric_tables_to_excel-0.1.1.tar.gz
.
File metadata
- Download URL: ipfabric_tables_to_excel-0.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.4 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b43b4cdc50f852d878ae3dbfae336038b4ef9e8b58174100f5e830270b0affc |
|
MD5 | 347d8ee5d99ad95fd977b3279bc07785 |
|
BLAKE2b-256 | 812b149f183d927ea19ea783c4ef89c6cb6cba026774294161304b8cc94af7b3 |
File details
Details for the file ipfabric_tables_to_excel-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: ipfabric_tables_to_excel-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.4 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f5f0adc0b4e6c041266103296cb794542ef680b49f77e1e4aaaf169ad50f7cb |
|
MD5 | 58f9799c69d20d593a71c9f09c364f31 |
|
BLAKE2b-256 | 9e883f4f7b816b2a8c1fdd5d54249aeef65b2232e856b454ffd30fb48e02963a |