Product: nv2cmd
Author: Josh Finlay josh@athenanetworks.com.au
Repository: https://github.com/AthenaNetworks/cumulus-nv2cmd
A Python script that converts Cumulus Linux NVUE configuration YAML to equivalent nv command sets for Cumulus Linux 5+.
This script:
- Executes
nv config showto get the current NVUE configuration in YAML format - Parses the YAML output
- Converts it into equivalent
nv setcommands that can be used to recreate the configuration
- Cumulus Linux 5+ with NVUE CLI (
nvcommand) - Python 3.6+
- PyYAML library
- Install dependencies:
pip install -r requirements.txt- Make the script executable:
chmod +x nv2cmdRun the script on a Cumulus Linux switch:
python3 nv2cmdOr directly:
./nv2cmdThe script will:
- Fetch the current configuration using
nv config show - Convert it to
nv setcommands - Output the commands to stdout
The script generates nv set commands that can be used to recreate the current configuration. Example output:
# Generated NVUE Commands
# Run these commands to recreate the current configuration
nv set interface swp1 ip ipv4 address 192.168.1.1/24
nv set interface swp1 bridge domain br_default
nv set system hostname switch01
nv set service ssh enable on
# Total commands: 4- Handles nested YAML configurations
- Special processing for interface configurations
- Supports common NVUE configuration sections (system, service, router, vrf, interface)
- Generates clean, executable
nv setcommands
- Complex configurations may require manual review
- Some advanced NVUE features might need custom handling
- Always test generated commands in a lab environment first
The script includes error handling for:
- Missing
nvcommand - YAML parsing errors
- Command execution failures