1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/iosxr_config/tests/cli/commit_label.yaml
Deepak Agrawal bf544c2200
Add support for commit label in iosxr_config (#42931)
* Add support for commit label in iosxr_config

* sanity pep8 etc fixes
2018-07-24 17:16:26 +05:30

70 lines
1.5 KiB
YAML

---
- debug: msg="START cli/commit_label.yaml on connection={{ ansible_connection }}"
- name: setup
iosxr_config:
commands:
- no description
- no shutdown
parents:
- interface Loopback999
match: none
- name: get a unique and valid label
set_fact:
label: "ansible_{{ 1001 | random | to_uuid | truncate(20, true, '_') }}"
- name: configure device with a label and a comment
iosxr_config:
src: basic/config.j2
comment: "this is sensible commit message"
label: "{{ label }}"
register: result
- assert:
that:
- "result.changed == true"
- name: setup
iosxr_config:
commands:
- no description
- no shutdown
parents:
- interface Loopback999
match: none
- name: Try to commit with old label, fail with a msg that label is alreay used
iosxr_config:
src: basic/config.j2
label: "{{ label }}"
register: result
ignore_errors: true
- assert:
that:
- "result.changed == false"
- "'already used' in result.msg"
- name: setup
iosxr_config:
commands:
- no description
- no shutdown
parents:
- interface Loopback999
match: none
- name: Try to commit with invalid chars($) in label
iosxr_config:
src: basic/config.j2
label: 'ansible_iosxr_config_$'
register: result
ignore_errors: true
- assert:
that:
- "result.changed == false"
- "'only contain alphabets' in result.msg"
- debug: msg="END cli/commit_label.yaml on connection={{ ansible_connection }}"