mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.5 KiB
YAML
78 lines
1.5 KiB
YAML
---
|
|
- debug: msg="START net_interface ios/intent.yaml"
|
|
|
|
- name: Check intent arguments
|
|
net_interface:
|
|
name: GigabitEthernet0/2
|
|
state: up
|
|
tx_rate: ge(0)
|
|
rx_rate: le(0)
|
|
authorize: yes
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.failed == false"
|
|
|
|
- name: Check intent arguments (failed condition)
|
|
net_interface:
|
|
name: GigabitEthernet0/2
|
|
state: down
|
|
tx_rate: gt(0)
|
|
rx_rate: lt(0)
|
|
authorize: yes
|
|
provider: "{{ cli }}"
|
|
ignore_errors: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.failed == true"
|
|
- "'state eq(down)' in result.failed_conditions"
|
|
- "'tx_rate gt(0)' in result.failed_conditions"
|
|
- "'rx_rate lt(0)' in result.failed_conditions"
|
|
|
|
- name: Config + intent
|
|
net_interface:
|
|
name: GigabitEthernet0/2
|
|
enabled: False
|
|
state: down
|
|
authorize: yes
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.failed == false"
|
|
|
|
- name: Config + intent (fail)
|
|
net_interface:
|
|
name: GigabitEthernet0/2
|
|
enabled: False
|
|
authorize: yes
|
|
state: up
|
|
provider: "{{ cli }}"
|
|
ignore_errors: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.failed == true"
|
|
- "'state eq(up)' in result.failed_conditions"
|
|
|
|
- name: Aggregate config + intent (pass)
|
|
net_interface:
|
|
aggregate:
|
|
- name: GigabitEthernet0/2
|
|
enabled: True
|
|
state: up
|
|
authorize: yes
|
|
provider: "{{ cli }}"
|
|
ignore_errors: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.failed == false"
|