diff options
author | Ricardo Carrillo Cruz <ricardo.carrillo.cruz@gmail.com> | 2017-10-25 12:44:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-25 12:44:25 +0200 |
commit | dc0aa750295e0c906c324c963ebdb4166347e4ab (patch) | |
tree | ac1f40d34a9f830b42acc1363143b3176afa1065 /test/integration/targets/ios_interface | |
parent | a9d8157e81d176a73abefefb251f4191025efaec (diff) | |
download | ansible-dc0aa750295e0c906c324c963ebdb4166347e4ab.tar.gz |
Introspect platform before running ios tests (#32125)
In some IOS tests, we can't just assume a certain interface, as
we test on IOS and IOS-XE and in our CI they scheme numbering is
different.
Introspect version on the tests where needed.
Diffstat (limited to 'test/integration/targets/ios_interface')
-rw-r--r-- | test/integration/targets/ios_interface/tests/cli/intent.yaml | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/integration/targets/ios_interface/tests/cli/intent.yaml b/test/integration/targets/ios_interface/tests/cli/intent.yaml index 4c670e067c..b0b6a4cac9 100644 --- a/test/integration/targets/ios_interface/tests/cli/intent.yaml +++ b/test/integration/targets/ios_interface/tests/cli/intent.yaml @@ -1,9 +1,23 @@ --- - debug: msg="START ios_interface cli/intent.yaml" +- name: Run show version + ios_command: + commands: show version + register: show_version_result + +- name: Set test interface to GigabitEthernet0/2 if we are on Cisco IOS + set_fact: test_interface=GigabitEthernet0/2 + when: "'Cisco IOS' in show_version_result.stdout[0]" + +- name: Set test interface to GigabitEthernet2 if we are on Cisco IOS-XE + set_fact: test_interface=GigabitEthernet2 + when: "'Cisco IOS-XE' in show_version_result.stdout[0]" + + - name: Check intent arguments ios_interface: - name: GigabitEthernet0/2 + name: "{{ test_interface }}" state: up tx_rate: ge(0) rx_rate: le(0) @@ -16,7 +30,7 @@ - name: Check intent arguments (failed condition) ios_interface: - name: GigabitEthernet0/2 + name: "{{ test_interface }}" state: down tx_rate: gt(0) rx_rate: lt(0) @@ -33,7 +47,7 @@ - name: Config + intent ios_interface: - name: GigabitEthernet0/2 + name: "{{ test_interface }}" enabled: False state: down authorize: yes @@ -45,7 +59,7 @@ - name: Config + intent (fail) ios_interface: - name: GigabitEthernet0/2 + name: "{{ test_interface }}" enabled: False authorize: yes state: up @@ -98,7 +112,7 @@ - name: Aggregate config + intent (pass) ios_interface: aggregate: - - name: GigabitEthernet0/2 + - name: "{{ test_interface }}" enabled: True state: up authorize: yes |