-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
787 additions
and
3 deletions.
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
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
Empty file.
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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import os | ||
| from netmiko import Netmiko | ||
|
|
||
| TEST_INTERFACE = "mgmtEth0/RP0/CPU0/0" # Guaranteed to exist in our XRd | ||
| XRD_LAB_IPS = os.environ.get("XRD_LAB_IPS") # Fed in by Makefile | ||
|
|
||
| # Lab access creds | ||
| USERNAME = "clab" | ||
| PASSWORD = "clab@123" | ||
| DEVICE_TYPE = "cisco_xr" | ||
|
|
||
| # Re-used constants for testing | ||
| CMD_SHOW_DESCRIPTION = f"show run int {TEST_INTERFACE} | i description" | ||
| TEST_DESCRIPTION = "Management Interface" | ||
|
|
||
|
|
||
| def test_show_version(connection): | ||
| output = connection.send_command("show version") | ||
| assert "Cisco IOS XR Software" in output | ||
|
|
||
|
|
||
| def test_configure_description(connection): | ||
| # Note: If any description existed before, it will be blanked out | ||
| connection.send_config_set(TEST_INTERFACE, f"description {TEST_DESCRIPTION}") | ||
| new_desc = connection.send_command(CMD_SHOW_DESCRIPTION) | ||
| assert new_desc == f"description {TEST_DESCRIPTION}" | ||
| connection.send_config_set(TEST_INTERFACE, "no description") # revert | ||
|
|
||
|
|
||
| lab_ips = XRD_LAB_IPS.split(" ") | ||
| print(lab_ips) | ||
|
|
||
| for ip in lab_ips: | ||
| # Create a variable that represents an SSH connection to our router. | ||
| connection = Netmiko( | ||
| username=USERNAME, password=PASSWORD, device_type=DEVICE_TYPE, ip=ip | ||
| ) | ||
| print(f"Testing 'show version' for lab {ip}...") | ||
| test_show_version(connection) | ||
|
|
||
| print(f"Testing basic description configuration change for lab {ip}...") | ||
| test_configure_description(connection) | ||
|
|
||
| print("Complete!") |
Oops, something went wrong.