Automate FDM configuration backups and restores via REST API. Export your entire FDM config to a zip file, and import it to another (or the same) FDM device.
Stack: Python 3.8+, Cisco FDM REST API v6+
This is basically a disaster recovery tool. When FDM's built-in backup/restore isn't working or accessible, you can use this as an alternative method to export/import your configurations via the REST API.
# Clone and setup git clone https://github.com/anvesh-pathak/FDM-Import-Export.git cd FDM-Import-Export python3 -m venv myenv source myenv/bin/activate # or myenv\Scripts\activate on Windows pip3 install -r requirements.txt # Export config python3 fdm_config_retriever.py # Import config python3 fdm_config_importer.py
pip3 install requests urllib3
python3 fdm_config_retriever.py
You'll be prompted for:
Downloads a .zip file containing your full FDM configuration.
python3 fdm_config_importer.py
Prompts for:
.zip fileImportant: Import doesn't auto-deploy. After import completes, log into FDM GUI and deploy the changes manually.
Daily backups:
python3 fdm_config_retriever.py
# Save as: backup-$(date +%Y%m%d).zipDevice migration:
# Export from old FDM python3 fdm_config_retriever.py # IP: 10.1.1.10 # Import to new FDM python3 fdm_config_importer.py # IP: 10.1.1.20
Disaster recovery:
python3 fdm_config_importer.py
# Point to your latest backup zipThree simple classes following SOLID principles:
FDMBaseClient - Shared auth and API calls
├── FDMConfigRetriever - Export functionality
└── FDMConfigImporter - Import functionality
Everything in your FDM config:
Exported as a JSON array in a zip file.
| Endpoint | Purpose |
|---|---|
POST /fdm/token |
Authentication |
POST /action/configexport |
Start export job |
GET /jobs/configexportstatus/{id} |
Check export status |
GET /action/downloadconfigfile/{file} |
Download config |
POST /action/uploadconfigfile |
Upload config |
POST /action/configimport |
Start import job |
GET /jobs/configimportstatus/{id} |
Check import status |
ModuleNotFoundError: No module named 'requests'
pip3 install -r requirements.txt
Connection refused
Import failed: Cannot import configuration with X objects to be deployed
Authentication failed: 401
getpass (not echoed to terminal)PRs welcome! This is a simple tool, so keep it simple:
Anvesh Pathak - anvpatha@cisco.com
MIT - see LICENSE file
Note: Test in a lab before production use. Always validate backups work before you need them!
Owner
Contributors
Categories
Products
Secure FirewallProgramming Languages
PythonLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community