2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_interface intent test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-12-28 12:11:09 +01:00
|
|
|
|
|
|
|
- set_fact: testint1="{{ nxos_int1 }}"
|
|
|
|
- set_fact: testint2="{{ nxos_int2 }}"
|
|
|
|
|
|
|
|
- name: "Setup: Put interfaces into a default state"
|
|
|
|
nxos_config:
|
|
|
|
lines:
|
|
|
|
- "default interface {{ testint1 }}"
|
|
|
|
- "default interface {{ testint2 }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-28 12:11:09 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Check intent arguments
|
|
|
|
nxos_interface:
|
|
|
|
name: "{{ testint2 }}"
|
|
|
|
admin_state: up
|
|
|
|
tx_rate: ge(0)
|
|
|
|
rx_rate: ge(0)
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-28 12:11:09 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
|
|
|
|
2019-05-08 17:50:22 +02:00
|
|
|
- name: "Clear interface {{ testint2 }} counters before next task"
|
|
|
|
nxos_command:
|
|
|
|
commands: "clear counters interface {{ testint2 }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-12-28 12:11:09 +01:00
|
|
|
- name: Check intent arguments (failed condition)
|
|
|
|
nxos_interface:
|
|
|
|
name: "{{ testint2 }}"
|
|
|
|
admin_state: down
|
2019-05-08 17:50:22 +02:00
|
|
|
tx_rate: gt(10000)
|
2017-12-28 12:11:09 +01:00
|
|
|
rx_rate: lt(0)
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-28 12:11:09 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
2019-05-08 17:50:22 +02:00
|
|
|
- "'tx_rate gt(10000)' in result.failed_conditions"
|
2017-12-28 12:11:09 +01:00
|
|
|
- "'rx_rate lt(0)' in result.failed_conditions"
|
|
|
|
|
|
|
|
- name: aggregate definition of interface
|
|
|
|
nxos_interface:
|
|
|
|
aggregate:
|
|
|
|
- { name: "{{ testint1 }}", description: "Test aggregation on first interface" }
|
|
|
|
- { name: "{{ testint2 }}", mode: layer3 }
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-28 12:11:09 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "TearDown: Put interfaces into a default state"
|
|
|
|
nxos_config:
|
|
|
|
lines:
|
|
|
|
- "default interface {{ testint1 }}"
|
|
|
|
- "default interface {{ testint2 }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-28 12:11:09 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_interface intent test"
|