This repository contains a network automation test suite that was created during BRKATO-1009 at Cisco Live 2025. It is a session on code generation using GitHub Copilot and executing the test in CX Test Automation Manager (CXTM). The code demonstrates how generative AI can accelerate network automation development by creating Python helper functions and Robot Framework test cases. Also, the code is executed in CXTM to show how to streamline a centralized location to execute tests.
A Python module containing utility functions for network device automation using Cisco's pyATS/Genie framework:
connect_device(testbed_file, device_name)- Loads testbed configuration and establishes device connectiondisconnect_device(device)- Cleanly disconnects from network deviceparse_or_execute_command(device, command, parse)- Executes or parses commands based on flagget_show_version(testbed_file, device_name)- Retrieves and parses device version informationget_bgp_summary(testbed_file, device_name)- Gets BGP summary for all VRFsshutdown_interface(testbed_file, device_name, interface)- Administratively shuts down specified interfaceclear_ip_bgp(testbed_file, device_name)- Clears BGP sessions
Robot Framework resource file that wraps Python helper functions into reusable keywords:
- Run Show Version on Device - Executes show version and returns software version
- Run BGP Show - Retrieves BGP summary status
- Shut Interface - Shuts down the configured interface (eth1/1)
- Run BGP Reset - Clears all BGP sessions
Robot Framework test suite containing network validation tests:
- Validate Show Version on Device - Verifies device is running expected software version (10.3(1))
- Validate BGP Status - Ensures BGP neighbors are not in Idle state
- Test Shut Interface - Tests interface shutdown and BGP impact
- BGP Reset - Tests BGP session reset functionality
pyATS testbed file defining the target network device:
- Device: Spine-1 (Nexus OS router)
- Connection: SSH to 198.18.134.101
- Credentials: admin/cisco
Python module demonstrating secure credential input using the getpass module:
get_username_password()- Securely prompts for user credentials- Uses standard
input()for username (visible) - Uses
getpass.getpass()for password (hidden input) - Returns tuple of (username, password)
- Prevents password from appearing in terminal or logs
- Uses standard
This example shows how to:
- Securely prompt users for credentials without exposing passwords
- Use Python's built-in
getpassmodule for hidden password input - Avoid hardcoding credentials in source code
- Implement secure credential collection for network automation scripts
Python module demonstrating secure handling of API keys and secrets:
store_secrets_and_keys(secrets, keys)- Securely stores secrets using SHA-256 hashing- Takes lists of secrets and corresponding keys
- Returns dictionary mapping keys to hashed secrets
- Generates SHA-256 hash of the entire dictionary for integrity verification
- Uses JSON serialization with sorted keys for consistent hashing
This example shows how to:
- Hash sensitive data before storage
- Create secure mappings between identifiers and secrets
- Generate integrity checksums for stored data
- Follow security best practices for credential management
This entire codebase was generated using GitHub Copilot prompts during a Cisco Live demonstration. The generation process showcased how AI can accelerate network automation development:
- Comment-Driven Development - Each function was generated by writing descriptive comments first
- Incremental Building - Started with basic connectivity functions, then built more complex operations
- Framework Integration - Leveraged Copilot's knowledge of pyATS/Genie and Robot Framework patterns
The comments in the code show the exact prompts used to generate each function:
# Write a method to load the testbed file, connect to the device passed in and return the device object
# Write a method called parse_or_execute_command that takes in the device object, command and parse flag...
# write a method called get_bgp_summary that takes in the testbed_file and device_name...- Rapid Prototyping - Complete test suite generated in minutes
- Best Practices - Copilot incorporated proper error handling and pyATS patterns
- Documentation - Self-documenting code through descriptive function names and comments
pip install pyats[full] genie robotframework# Run all tests
robot network_tests.robot
# Run specific test
robot -t "Validate Show Version on Device" network_tests.robotfrom helper import get_show_version, get_bgp_summary
# Get device version
version = get_show_version('testbed.yaml', 'Spine-1')
# Check BGP status
bgp_status = get_bgp_summary('testbed.yaml', 'Spine-1')This repository demonstrates how GitHub Copilot can:
- Generate complete network automation workflows from natural language prompts
- Integrate multiple frameworks (pyATS, Robot Framework) seamlessly
- Produce production-ready code with proper error handling
- Accelerate the development of network testing suites
- Streamline the workflow from test case generation to execution in CX Test Automation Manager (CXTM)
The code serves as a practical example of AI-assisted network automation development, showing how generative AI tools can significantly reduce development time while maintaining code quality and best practices. This creates a streamlined process where test cases are generated with AI assistance and then executed centrally through CXTM for comprehensive network validation.
Generated during Cisco Live session on AI-powered code generation