How thedatabunny/ciscobubblewrap works
Project type and purpose
• This is a standalone Python CLI utility (“Cisco Bubble Wrap”) for network administrators to back up running configurations from Cisco IOS-XE devices.
• It integrates with Cisco’s RESTCONF API, fetches device configurations (YANG JSON), converts them to CLI format, and writes both formats to disk.
File structure
• Top-level script: save_cisco_config.py (the entry point)
• Configuration/examples: switches.txt.example (device list template)
• Dependencies: requirements.txt
• Documentation: README.md, CLAUDE.md
• Version control ignore: .gitignore
README for architectural insights
• Core components described under “Architecture”
• RESTCONF Client
• JSON to CLI Converter
• Batch Processor
• Logging System
• Outputs are stored under a configs/ directory (created at runtime).
• External dependencies: Cisco devices with RESTCONF enabled, Python requests.
Main components and their interactions
a. Components
• CLI Interface / Entry Point (save_cisco_config.py)
• Batch Processor (reads switches.txt, iterates devices)
• RESTCONF Client (handles HTTPS calls to devices)
• JSON-to-CLI Converter (transforms YANG JSON → CLI text)
• File System Storage (writes /configs/{device}_running-config.json and .cli)
• Logging System (file logger + console logger)
• External Cisco Devices (target systems with RESTCONF endpoint)
b. Relationships & Data Flow
2. CLI prompts for: device-list path, username, password
3. Batch Processor reads switches.txt → loops per device
4. For each device:
• Call RESTCONF Client → GET configuration (YANG JSON)
• Pass JSON to JSON-to-CLI Converter → produce CLI text
• Write both JSON and CLI outputs to disk under configs/
• Logging system logs each step (success/failure) to console + restconf_script.log
5. End of batch → summary output on console
c. Architectural patterns / design principles
• Single responsibility: each component has a focused role (network I/O, parsing, conversion, logging).
• Batch processing loop decouples network calls from user interaction.
• Conversion logic centralized in its own module (or class).
• Logging abstraction so both file and console sinks receive the same events.
d. Key technologies/frameworks
• Python 3.6+
• requests library for HTTPS/RESTCONF calls
• Python standard libraries: json, argparse (if used), logging, os