mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-18 06:59:19 -07:00
Convert nxos_interface to DI (#34240)
* Convert nxos_interface to DI Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add integration test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * commit for ganeshrn's comment Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
a3c185bfa8
commit
80ba767204
9 changed files with 670 additions and 1503 deletions
|
@ -0,0 +1,63 @@
|
|||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_interface intent test"
|
||||
|
||||
- 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 }}"
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Check intent arguments
|
||||
nxos_interface:
|
||||
name: "{{ testint2 }}"
|
||||
admin_state: up
|
||||
tx_rate: ge(0)
|
||||
rx_rate: ge(0)
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == false"
|
||||
|
||||
- name: Check intent arguments (failed condition)
|
||||
nxos_interface:
|
||||
name: "{{ testint2 }}"
|
||||
admin_state: down
|
||||
tx_rate: gt(0)
|
||||
rx_rate: lt(0)
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "'tx_rate gt(0)' in result.failed_conditions"
|
||||
- "'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 }
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "TearDown: Put interfaces into a default state"
|
||||
nxos_config:
|
||||
lines:
|
||||
- "default interface {{ testint1 }}"
|
||||
- "default interface {{ testint2 }}"
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_interface intent test"
|
|
@ -33,7 +33,7 @@
|
|||
interface: "{{ testint }}"
|
||||
mode: layer3
|
||||
description: 'Configured by Ansible - Layer3'
|
||||
admin_state: 'up'
|
||||
admin_state: up
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
@ -55,7 +55,7 @@
|
|||
interface: "{{ testint }}"
|
||||
mode: layer2
|
||||
description: 'Configured by Ansible - Layer2'
|
||||
admin_state: 'down'
|
||||
admin_state: down
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue