A Python-based automation tool for migrating Cisco Modeling Lab (CML) environments from version 2.x to 2.9, handling lab extraction, configuration backup, and preparation for import into the new environment.
This tool addresses the lack of in-place upgrade options between CML 2.x and 2.9 by providing automated lab migration capabilities. It connects to your existing CML 2.x environment, extracts all labs with their configurations, and prepares them for import into CML 2.9.
git clone <repository-url> cd cml-migration-tool
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your CML credentials and settings
Create a .env
file in the project root:
# CML Server Configuration CML_HOST=192.168.1.32 CML_PORT=443 CML_USERNAME=your_username CML_PASSWORD=your_secure_password # Migration Settings OUTPUT_DIR=./Labs MAX_RETRIES=3 CONVERGENCE_CHECK_INTERVAL=5 MAX_CONVERGENCE_WAIT=300
For production environments, consider:
verify=False
Run the complete migration process:
python cml_migrator.py
from cml_migrator import CMLMigrator # Initialize migrator migrator = CMLMigrator( host='192.168.1.32', username='admin', password='secure_password' ) # Authenticate if migrator.authenticate(): # Get all labs labs = migrator.get_labs() # Migrate specific lab migrator.migrate_lab('lab-uuid-here')
Labs/
├── Lab_Name_1.yaml # Lab topology file
├── Lab_Name_2.yaml
Authentication Failures
# Check credentials and network connectivity
curl -k https://192.168.1.32/api/v0/authok
SSL Certificate Errors
Convergence Timeout
MAX_CONVERGENCE_WAIT
in configurationEnable debug logging:
import logging logging.basicConfig(level=logging.DEBUG)
After running this tool:
Labs/
directory to your CML 2.9 environmentThis tool is designed to work with supported Cisco Modeling Lab APIs and follows Cisco best practices for:
MIT License
For issues and questions:
See CHANGELOG.md for version history and updates.
Note: This tool is designed for CML 2.x to 2.9 migration. Always test in a non-production environment first and ensure you have proper backups before migration.
Owner
Contributors
Categories
Products
Cisco Modeling LabsProgramming Languages
PythonLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community