Excel2Config
Excel2Config simple CLI tool generates network configuration based on Excel sheets which include Jinja2 template and data tables.
Requirements
For Windows, select the Add Python 3.x to PATH checkbox during installation.
Installation
pip install excel2config
Installation Check
After installation excel2config command added to System Path and can be executed from any path easily as below:
> excel2config -h
usage: excel2config [-h] [excelfile]
positional arguments:
excelfile excel file path [e.g. srlinux_config_1.xlsx] (OPTIONAL, default: config.xlsx)
options:
-h, --help show this help message and exit
Usage
Simple Usage
Run excel2config command with Excel File Path from any path and check text output files in Output Folder:
excel2config <Excel_File_Path>
Example for Windows:
PS C:\Users\alg\desktop> excel2config C:\Users\alg\Desktop\test\config.xlsx
2022-07-17 09:07:40.275 INFO : OUTPUT FOLDER CREATED <OUTPUTS_config_20220717-090740>
2022-07-17 09:07:40.447 INFO : [C:\Users\alg\Desktop\test\config.xlsx] / [<Worksheet "NETWORK_INSTANCE">] START!
2022-07-17 09:07:40.463 INFO : [C:\Users\alg\Desktop\test\config.xlsx] / [<Worksheet "NETWORK_INSTANCE">] DONE!
2022-07-17 09:07:40.479 INFO : ALL DONE!
!!! ALL DONE! Press any key to exit...
PS C:\Users\alg\desktop> dir OUTPUTS_config_20220717-090740
Directory: C:\Users\alg\desktop\OUTPUTS_config_20220717-090740
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 17/07/2022 09:07 426 leaf1.txt
-a---- 17/07/2022 09:07 258 leaf2.txt
PS C:\Users\alg\desktop>
Excel File
Only .xlsx Excel file format supported.
For new features (e.g. Custom Jinja Function) check latest example Excel in project /examples folder.
In Excel File first sheet is GLOBAL_VARS, this sheet optional and only for global template variables such as host-based (e.g. leaf1), all-host (ALL) and generator (GEN).
GLOBAL_VARS Excel Sheet:
Besides GLOBAL_VARS sheet, other sheets have two parts:
- Jinja2 Template (A2 cell): Jinja2 "IF", "FOR" and Filters can be used in template cell.
- Data Tables (Header rows start with B2 cell, Variable rows start with B3 cell): Range and generator supported in variable rows.
Sheet name and Data Header name must have only [A-Za-z0-9_] (alphanumeric with underscore) characters and not start with numeric characters.
Sheet name starts with underscore "_" will be ignored. (e.g. _TEST)
As below example Jinja template render with every data table line and append host (e.g. leaf1) output text file.
INTERFACE_CONFIG Excel Sheet:
INTERFACE_CONFIG "leaf1.txt" outputs:
interface ethernet 1/1/1
description red_1
no shutdown
mtu 1500
vrf member red
no ip redirects
ip address 10.1.1.100/24
OTHER_CONFIG Excel Sheet:
Example Excel file and outputs are in project /examples folder.
EOF
Metadata
Release files for excel2config 2023.7.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| excel2config-2023.7.8.tar.gz | 10.4 kB | Without provenance | Details for excel2config-2023.7.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| excel2config-2023.7.8-py3-none-any.whl | Python 3 | none | any | Details for excel2config-2023.7.8-py3-none-any.whl |
Total release size: 19.8 kB
Release files / excel2config-2023.7.8.tar.gz
| Download URL | excel2config-2023.7.8.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
820388914286855cf0d077a58b36d449c48b7c708359757e4b5a3023352ff07e
|
|
BLAKE2b-256 checksum How to use checksums |
5cb7368206ed14e38b1ec12ea5695882ffa39aafe18574c8318060cf0384d8c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.5
|
Release files / excel2config-2023.7.8-py3-none-any.whl
| Download URL | excel2config-2023.7.8-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa51c7bade4eee9716163b7dfb53a8cbd57ea36362b160481fa19bd3ae8313d5
|
|
BLAKE2b-256 checksum How to use checksums |
78189dfa270788575406e782d74f7e1d422fec04d962a4d6e41216aa23d7f910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.5
|
Security for excel2config 2023.7.8
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.