Skip to content

Commit

Permalink
added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
devan555 committed May 22, 2024
1 parent 5ac14b3 commit bfab6d5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/containerlab-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ jobs:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- run: ls
- run: pwd
- run: echo "REPO_NAME=${{ github.event.repository.name }}"
- run: whoami
# - run: ls
# - run: pwd
# - run: echo "REPO_NAME=${{ github.event.repository.name }}"
# - run: whoami
- run: ansible-playbook ~/clab_files/ansible_files/01_run_clab.yml -i containerlab_test/ansible-inventory.yml

- run: ansible-playbook containerlab_test/testcase1.yml -i containerlab_test/ansible-inventory.yml

- name: Destroy the Containerlab
if: always()
run: ansible-playbook ~/clab_files/ansible_files/02_destroy_clab.yml
23 changes: 23 additions & 0 deletions containerlab_test/test_case1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: cEOS Config
hosts: ceos
gather_facts: yes
tasks:
- name: Retrieve VLAN configuration
eos_command:
commands: show vlan
register: vlan_output

- name: Check if specific VLAN is present
set_fact:
vlan_present: "{{ 'VLAN 100' in vlan_output.stdout[0] }}"

- name: Fail if VLAN is not present
fail:
msg: "VLAN 10 is not present on the switch."
when: not vlan_present

- name: Debug message if VLAN is present
debug:
msg: "VLAN 10 is present on the switch."
when: vlan_present

0 comments on commit bfab6d5

Please sign in to comment.