Skip to content

Commit

Permalink
Add error messaging and fix syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sbyrnes committed Feb 2, 2025
1 parent 3cdac6a commit 11af276
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions internal-lab-setup-assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ poetry:
fi

test: poetry
XRD_LAB_IPS=$$(containerlab inspect --all | grep "cisco" | rev | cut -d ' ' -f8 | rev | sort -V); \
echo "$${XRD_LAB_IPS}"; \
XRD_LAB_IPS=$$(containerlab inspect --all | grep "cisco" | tr -d " \t\r" | rev | cut -d '│' -f2 | rev | sort -V); \
if [ -z "$${XRD_LAB_IPS}" ]; then echo "No labs found." && exit 0; fi; \
cd tester; \
echo "Installing dependencies..." && ~/.local/bin/poetry install --no-root; \
Expand Down
10 changes: 7 additions & 3 deletions internal-lab-setup-assets/tester/lab-tester/lab-tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@

def test_show_version(connection):
output = connection.send_command("show version")
assert "Cisco IOS XR Software" in output
assert (
"Cisco IOS XR Software" in output
), f"Show version does not have expected string 'Cisco IOS XR Software'. Output: {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}"
assert (
new_desc == f"description {TEST_DESCRIPTION}"
), f"'{new_desc}' on router does not match 'description {TEST_DESCRIPTION}'!"
connection.send_config_set(TEST_INTERFACE, "no description") # revert


lab_ips = XRD_LAB_IPS.split(" ")
lab_ips = XRD_LAB_IPS.split()
print(lab_ips)

for ip in lab_ips:
Expand Down

0 comments on commit 11af276

Please sign in to comment.