-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,67 @@ | ||
# pyATS_add_vlan | ||
# PyATS VLAN Trunk Interface Test | ||
|
||
## Overview | ||
This repository contains a PyATS test script to add a VLAN to a trunk interface on a Cisco switch and verify the configuration. The script is designed to automate the process of VLAN configuration on network devices, ensuring that the VLAN is correctly added and operational. | ||
|
||
## Prerequisites | ||
Before running the script, ensure you have the following: | ||
- Python 3.6+ | ||
- Cisco Test Automation Solution (PyATS) and Genie libraries | ||
- Access to the network devices (Cisco switch) with appropriate credentials | ||
- SSH access to the switch | ||
|
||
## Installation | ||
1. **Clone the repository**: | ||
```bash | ||
git clone <repository_url> | ||
cd <repository_directory> | ||
``` | ||
|
||
2. **Create and activate a virtual environment** (optional but recommended): | ||
```bash | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
``` | ||
|
||
3. **Install the required packages**: | ||
```bash | ||
pip install pyats[full] | ||
pip install genie | ||
``` | ||
|
||
## Configuration | ||
1. **Create a testbed file**: | ||
Define the network devices in a YAML file (e.g., `testbed.yaml`). Here is an example configuration: | ||
|
||
```yaml | ||
testbed: | ||
name: example_testbed | ||
devices: | ||
switch: | ||
os: ios | ||
type: switch | ||
connections: | ||
cli: | ||
protocol: ssh | ||
ip: 192.168.1.1 | ||
credentials: | ||
default: | ||
username: your_username | ||
password: your_password | ||
``` | ||
|
||
Replace the placeholders with your actual network details (IP addresses, usernames, passwords). | ||
|
||
2. **Update the test script**: | ||
If necessary, update the VLAN ID and the trunk interface name in the script (`test_add_vlan.py`): | ||
|
||
```python | ||
vlan_id = 10 | ||
interface_name = 'GigabitEthernet0/1' | ||
``` | ||
|
||
## Usage | ||
To run the test script, execute the following command: | ||
|
||
```bash | ||
python test_add_vlan.py --testbed testbed.yaml |