ansible/test/integration/targets/nxos_interface/tests/common/intent.yaml
Nathaniel Case e9d7fa0418
HTTP(S) API connection plugin (#39224)
* HTTPAPI connection

* Punt run_commands to cliconf or httpapi

* Fake enable_mode on eapi

* Pull changes to nxos

* Move load_config to edit_config for future-preparedness

* Don't fail on lldp disabled

* Re-enable check_rc on nxos' run_commands

* Reorganize nxos httpapi plugin for compatibility

* draft docs for connection: httpapi

* restores docs for connection:local for eapi

* Add _remote_is_local to httpapi
2018-05-17 18:47:15 -04:00

60 lines
1.5 KiB
YAML

- debug: msg="START connection={{ ansible_connection }} nxos_interface intent test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- 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 }}"
ignore_errors: yes
- name: Check intent arguments
nxos_interface:
name: "{{ testint2 }}"
admin_state: up
tx_rate: ge(0)
rx_rate: ge(0)
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)
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 }
register: result
- assert:
that:
- "result.changed == true"
- name: "TearDown: Put interfaces into a default state"
nxos_config:
lines:
- "default interface {{ testint1 }}"
- "default interface {{ testint2 }}"
ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_interface intent test"