Fix Ansible lint FQCN error (#227)

* Fix set_fact ansible-lint

* Fix assert ansible-lint

* Fix find ansible-lint

* Fix debug ansible-lint

* Add FQCN
pull/228/head^2
Ashwini Mhatre 2022-11-29 19:28:12 +05:30 committed by GitHub
parent baba9ca7ea
commit e5591508fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 338 additions and 335 deletions

View File

@ -0,0 +1,3 @@
---
trivial:
- Add FQCN for all short names.

View File

@ -10,7 +10,7 @@
ignore_errors: true
- name: "{{ parser }} Check argspec fail"
assert:
ansible.builtin.assert:
that: "{{ msg in argfail.errors }}"
vars:
msg: "parameters are mutually exclusive: command|template_path found in parser"
@ -26,7 +26,7 @@
ignore_errors: true
- name: "{{ parser }} Check argspec fail"
assert:
ansible.builtin.assert:
that: "{{ msg in argfail.errors }}"
vars:
msg: "parameters are mutually exclusive: command|text"
@ -40,7 +40,7 @@
ignore_errors: true
- name: "{{ parser }} Check argspec fail"
assert:
ansible.builtin.assert:
that: "{{ msg in argfail.errors }}"
vars:
msg: "one of the following is required: command, text"
@ -55,7 +55,7 @@
ignore_errors: true
- name: "{{ parser }} Check arspec fail"
assert:
ansible.builtin.assert:
that: "{{ msg in argfail.msg }}"
vars:
msg: "Parser name should be provided as a full name including collection"

View File

@ -4,11 +4,11 @@
command: "ifconfig"
parser:
name: ansible.utils.textfsm
set_fact: myfact
ansible.builtin.set_fact: myfact
register: ifconfig_out
- name: "{{ parser }} Check parser output"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ myfact is defined }}"

View File

@ -4,11 +4,11 @@
command: "df -h"
parser:
name: ansible.utils.ttp
set_fact: myfact
ansible.builtin.set_fact: myfact
register: df_h_out
- name: "{{ parser }} Check parser output"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ myfact is defined }}"

View File

@ -4,11 +4,11 @@
command: "ifconfig"
parser:
name: ansible.utils.textfsm
set_fact: myfact
ansible.builtin.set_fact: myfact
register: ifconfig_out
- name: "{{ parser }} Check parser output"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ myfact is defined }}"

View File

@ -4,11 +4,11 @@
command: "df -h"
parser:
name: ansible.utils.ttp
set_fact: myfact
ansible.builtin.set_fact: myfact
register: df_h_out
- name: "{{ parser }} Check parser output"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ myfact is defined }}"

View File

@ -3,74 +3,74 @@
ansible.builtin.set_fact:
os: "{{ ansible_distribution|d }}"
- include_tasks: argspec.yaml
- ansible.builtin.include_tasks: argspec.yaml
vars:
parser: "({{ inventory_hostname }}/argspec)"
- include_tasks: "nxos_json.yaml"
- ansible.builtin.include_tasks: "nxos_json.yaml"
vars:
parser: "(nxos/json)"
tags:
- json
- include_tasks: "nxos_textfsm.yaml"
- ansible.builtin.include_tasks: "nxos_textfsm.yaml"
vars:
parser: "(nxos/textfsm)"
tags:
- textfsm
- include_tasks: "nxos_ttp.yaml"
- ansible.builtin.include_tasks: "nxos_ttp.yaml"
vars:
parser: "(nxos/ttp)"
tags:
- ttp
- include_tasks: "nxos_xml.yaml"
- ansible.builtin.include_tasks: "nxos_xml.yaml"
vars:
parser: "(nxos/xml)"
tags:
- xml
- name: debug os
debug:
ansible.builtin.debug:
msg: "{{ os }}"
- include_tasks: "centos_textfsm.yaml"
- ansible.builtin.include_tasks: "centos_textfsm.yaml"
vars:
parser: "(centos/textfsm)"
when: os == 'centos'
tags:
- textfsm
- include_tasks: "centos_ttp.yaml"
- ansible.builtin.include_tasks: "centos_ttp.yaml"
vars:
parser: "(centos/ttp)"
when: os == 'centos'
tags:
- ttp
- include_tasks: "fedora_textfsm.yaml"
- ansible.builtin.include_tasks: "fedora_textfsm.yaml"
vars:
parser: "(fedora/textfsm)"
when: os == 'fedora'
tags:
- textfsm
- include_tasks: "fedora_ttp.yaml"
- ansible.builtin.include_tasks: "fedora_ttp.yaml"
vars:
parser: "(fedora/ttp)"
when: os == 'fedora'
tags:
- ttp
- include_tasks: "ubuntu_textfsm.yaml"
- ansible.builtin.include_tasks: "ubuntu_textfsm.yaml"
vars:
parser: "(ubuntu/textfsm)"
when: os == 'ubuntu'
tags:
- textfsm
- include_tasks: "ubuntu_ttp.yaml"
- ansible.builtin.include_tasks: "ubuntu_ttp.yaml"
vars:
parser: "(ubuntu/ttp)"
when: os == 'ubuntu'

View File

@ -10,7 +10,7 @@
register: nxos_json_text
- name: "{{ parser }} Confirm response"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ nxos_json_text['parsed'] is defined }}"

View File

@ -11,7 +11,7 @@
register: nxos_textfsm_text
- name: "{{ parser }} Confirm response"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ nxos_textfsm_text['parsed'] == nxos_textfsm_text['parsed'] }}"

View File

@ -12,7 +12,7 @@
register: nxos_ttp_text
- name: "{{ parser }} Confirm response"
assert:
ansible.builtin.assert:
that:
- "{{ POpqMQoJWTiDpEW is defined }}"
- "{{ nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"
@ -30,7 +30,7 @@
register: nxos_ttp_vars
- name: "{{ parser }} Confirm modified results"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ nxos_ttp_vars['parsed'][0][0][0]['var'] == 'some_text' }}"
@ -47,7 +47,7 @@
register: nxos_ttp_results
- name: "{{ parser }} Confirm modified results"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ (nxos_ttp_results['parsed'][0]|from_yaml)[0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"

View File

@ -11,7 +11,7 @@
register: nxos_xml_text
- name: "{{ parser }} Confirm response"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ nxos_xml_text['parsed'] == nxos_xml_text_parsed }}"

View File

@ -4,11 +4,11 @@
command: "ifconfig"
parser:
name: ansible.utils.textfsm
set_fact: myfact
ansible.builtin.set_fact: myfact
register: ifconfig_out
- name: "{{ parser }} Check parser output"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ myfact is defined }}"

View File

@ -4,11 +4,11 @@
command: "df -h"
parser:
name: ansible.utils.ttp
set_fact: myfact
ansible.builtin.set_fact: myfact
register: df_h_out
- name: "{{ parser }} Check parser output"
assert:
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ myfact is defined }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -27,6 +27,6 @@
combined: "{{ data_sources|ansible.utils.consolidate(fail_missing_match_value=False) }}"
- name: Assert result dicts
assert:
ansible.builtin.assert:
that:
- combined == combined_facts

View File

@ -4,7 +4,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ string in result.msg }}"
loop:
- "missing required arguments:"
@ -14,7 +14,7 @@
loop_var: string
when: "{{result.msg|type_debug != 'list'}}"
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "missing required arguments: after, before"
@ -31,10 +31,10 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ 'unable to convert to list' in result.msg }}"
when: "{{result.msg|type_debug != 'list'}}"
- assert:
- ansible.builtin.assert:
that: "{{ 'unable to convert to list' in result.msg[0] }}"
when: "{{result.msg|type_debug == 'list'}}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -10,7 +10,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "The regex '+', is not valid"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -13,11 +13,11 @@
},
}
- debug:
- ansible.builtin.debug:
msg: "{{ data|ansible.utils.from_xml() }}"
- name: Integration tests with and without default engine as xmltodict and
assert:
ansible.builtin.assert:
that: "{{ output == item.test }}"
loop:
- test: "{{ data|ansible.utils.from_xml() }}"
@ -33,7 +33,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "Error when using plugin 'from_xml': Input Xml is not valid"

View File

@ -13,7 +13,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "missing required arguments: path"
@ -24,7 +24,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ item in result.msg }}"
loop:
- "missing required arguments:"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -8,7 +8,7 @@
- 1
- name: Simple test filter and lookup
assert:
ansible.builtin.assert:
that: "{{ item.result == item.expected }}"
loop:
- result: "{{ vars|ansible.utils.get_path('a') }}"
@ -48,7 +48,7 @@
- 0
- name: Simple test filter and lookup w/ wantlist
assert:
ansible.builtin.assert:
that: "{{ item.result == item.expected }}"
loop:
- result: "{{ vars|ansible.utils.get_path('a.b.c.d[0]', wantlist=True) }}"

View File

@ -17,7 +17,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "cannot be converted to a list"
@ -28,7 +28,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "missing required arguments: test"
@ -39,7 +39,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "cannot be converted to a list"
@ -50,7 +50,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ item in result.msg }}"
loop:
- "missing required arguments:"

View File

@ -37,13 +37,13 @@
# indices:
# - 2
#- name: Find numbers greater than 1, using loop
# debug:
# msg: "{{ data[item] }} is {{ test }} than {{ value }}"
# loop: "{{ data|ansible.utils.index_of(test, value) }}"
# vars:
# test: '>'
# value: 1
# - name: Find numbers greater than 1, using loop
# ansible.builtin.debug:
# msg: "{{ data[item] }} is {{ test }} than {{ value }}"
# loop: "{{ data|ansible.utils.index_of(test, value) }}"
# vars:
# test: '>'
# value: 1
# TASK [Find numbers great than 1, using loop] *******************************
# ok: [sw01] => (item=1) =>
@ -76,7 +76,7 @@
# - 3
- name: Find the index of all firewalls, use in a loop
debug:
ansible.builtin.debug:
msg: "The type of {{ device_type }} at index {{ item }} has name {{ data[item].name }}."
loop: "{{ data|ansible.utils.index_of('eq', device_type, 'type') }}"
vars:
@ -89,7 +89,7 @@
# msg: The type of firewall at index 3 has name fw02.example.corp.
- name: Find the index of all devices with a .corp name
debug:
ansible.builtin.debug:
msg: "The device named {{ data[item].name }} is a {{ data[item].type }}"
loop: "{{ data|ansible.utils.index_of('regex', expression, 'name') }}"
vars:
@ -140,7 +140,7 @@
# interface_idx: '128'
# - name: Show all interfaces and their address
# debug:
# ansible.builtin.debug:
# msg: "{{ interface.name }} has ip {{ address }}"
# loop: "{{ found|subelements('address_idxs') }}"
# vars:
@ -199,7 +199,7 @@
index: 3
- name: Find the description of loopback111, subinterface index 10
debug:
ansible.builtin.debug:
msg: |-
{{ data.interfaces.interface[int_idx|int]
.subinterfaces.subinterface[subint_idx|int]

View File

@ -38,7 +38,7 @@
# - 2
#- name: Find numbers greater than 1, using loop
# debug:
# ansible.builtin.debug:
# msg: "{{ data[item] }} is {{ test }} than {{ value }}"
# loop: "{{ lookup('ansible.utils.index_of', data, test, value) }}"
# vars:
@ -52,7 +52,7 @@
# msg: 3 is > than 1
- name: Find numbers greater than 1, using with
debug:
ansible.builtin.debug:
msg: "{{ data[item] }} is {{ params.test }} than {{ params.value }}"
with_ansible.utils.index_of: "{{ params }}"
vars:
@ -92,7 +92,7 @@
# - 3
- name: Find the index of all firewalls, use in a loop
debug:
ansible.builtin.debug:
msg: "The type of {{ device_type }} at index {{ item }} has name {{ data[item].name }}."
loop: "{{ lookup('ansible.utils.index_of', data, 'eq', device_type, 'type') }}"
vars:
@ -105,7 +105,7 @@
# msg: The type of firewall at index 3 has name fw02.example.corp.
- name: Find the index of all devices with a .corp name
debug:
ansible.builtin.debug:
msg: "The device named {{ data[item].name }} is a {{ data[item].type }}"
loop: "{{ lookup('ansible.utils.index_of', data, 'regex', expression, 'name') }}"
vars:
@ -215,7 +215,7 @@
index: 3
- name: Find the description of loopback111, subinterface index 10
debug:
ansible.builtin.debug:
msg: |-
{{ data.interfaces.interface[int_idx|int]
.subinterfaces.subinterface[subint_idx|int]

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -24,7 +24,7 @@
- b
- name: Some basic tests
assert:
ansible.builtin.assert:
that: "{{ item.test == item.result }}"
loop:
- test: "{{ complex.a|ansible.utils.index_of('eq', True) }}"
@ -70,7 +70,7 @@
e1: redhat
- name: Find index in list of dictionaries
assert:
ansible.builtin.assert:
that: "{{ item.test == item.result }}"
loop:
- test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', 'ansible', 'e1') }}"
@ -83,7 +83,7 @@
result: [0]
- name: Test a missing key in the list of dictionaries
assert:
ansible.builtin.assert:
that: "{{ item.test == item.result }}"
loop:
- test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', True, 'e2') }}"
@ -92,7 +92,7 @@
result: "0"
- name: Test a missing key in the list of dictionaries, fail on missing
assert:
ansible.builtin.assert:
that: "{{ item.test == item.result }}"
loop:
- test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', True, 'e2', fail_on_missing=True) }}"
@ -103,5 +103,5 @@
register: result
- name: Ensure the previous test failed
assert:
ansible.builtin.assert:
that: "{{ result.failed and 'not found in' in result.msg }}"

View File

@ -11,7 +11,7 @@
result1: "{{ value|ansible.utils.cidr_merge }}"
- name: Assert result for cidr_merge
assert:
ansible.builtin.assert:
that: "{{ result1 == cidr_result1 }}"
- name: cidr_merge with span action
@ -27,5 +27,5 @@
result2: "{{ value|ansible.utils.cidr_merge('span') }}"
- name: Assert result for cidr_merge(span)
assert:
ansible.builtin.assert:
that: "{{ result2 == cidr_result2 }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.hwaddr }}"
- name: Assert result for hwaddr.
assert:
ansible.builtin.assert:
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
- name: hwaddr filter test2
@ -12,5 +12,5 @@
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.hwaddr('cisco') }}"
- name: Assert result for hwaddr.
assert:
ansible.builtin.assert:
that: "{{ result1 == '1a2b.3c4d.5e6f' }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '192.168.1.5'|ansible.utils.ip4_hex }}"
- name: Assert result for ip4_hex.
assert:
ansible.builtin.assert:
that: "{{ result1 == 'c0a80105' }}"
- name: ip4_hex with delimiter
@ -12,5 +12,5 @@
result1: "{{ '192.168.1.5'|ansible.utils.ip4_hex(':') }}"
- name: Assert result for ip4_hex.
assert:
ansible.builtin.assert:
that: "{{ result1 == 'c0:a8:01:05' }}"

View File

@ -15,7 +15,7 @@
result1: "{{ value|ansible.utils.ipaddr }}"
- name: Assert result for ipaddr.
assert:
ansible.builtin.assert:
that: "{{ result1 == ipaddr_result1 }}"
- name: ipaddr filter with host string query
@ -23,7 +23,7 @@
result2: "{{ value|ansible.utils.ipaddr('host') }}"
- name: Assert result for ipaddr host query
assert:
ansible.builtin.assert:
that: "{{ result2 == ipaddr_result2 }}"
- name: ipaddr filter with public network query
@ -31,7 +31,7 @@
result3: "{{ value|ansible.utils.ipaddr('public') }}"
- name: Assert result for ipaddr public network query
assert:
ansible.builtin.assert:
that: "{{ result3== ipaddr_result3 }}"
- name: ipaddr filter with network query
@ -39,7 +39,7 @@
result4: "{{ value|ansible.utils.ipaddr('net') }}"
- name: Assert result for ipaddr network query
assert:
ansible.builtin.assert:
that: "{{ result4 == ipaddr_result4 }}"
- name: ipaddr filter with network/prefix query
@ -47,7 +47,7 @@
result5: "{{ '192.168.0.0/23' | ansible.utils.ipaddr('network/prefix') }}"
- name: Assert result for ipaddr filter with network/prefix query
assert:
ansible.builtin.assert:
that: "{{ result5 == '192.168.0.0/23' }}"
- name: ipaddr filter with chained filters
@ -55,20 +55,20 @@
result6: "{{ '192.168.255.0' | ansible.utils.ipaddr('network') | ansible.utils.ipmath(123) }}"
- name: Assert result for ipaddr filter with chained filters
assert:
ansible.builtin.assert:
that: "{{ result6 == '192.168.255.123' }}"
- debug:
- ansible.builtin.debug:
msg: "Test int input for ipaddr filter"
- name: set fact 1
set_fact:
ansible.builtin.set_fact:
ip1: "172.20.0.1"
- name: Set fact 2
set_fact:
ansible.builtin.set_fact:
ip2: "{{ ((ip1 | ansible.utils.ipaddr('int')) + 6) | ansible.utils.ipaddr }}"
- name: Assert result for ipaddr filter
assert:
ansible.builtin.assert:
that: "{{ ip2 == '172.20.0.7' }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '192.168.1.5'|ansible.utils.ipmath('5') }}"
- name: Assert result for ipmath.
assert:
ansible.builtin.assert:
that: "{{ result1 == '192.168.1.10' }}"
- name: Get the tenth previous address based on an IP address with Ipmath filter
@ -12,7 +12,7 @@
result1: "{{ '192.168.1.5'|ansible.utils.ipmath('-10') }}"
- name: Assert result for ipmath.
assert:
ansible.builtin.assert:
that: "{{ result1 == '192.168.0.251' }}"
- name: Get the next fifth address using CIDR notation with Ipmath filter
@ -20,7 +20,7 @@
result1: "{{ '192.168.1.1/24'|ansible.utils.ipmath('5') }}"
- name: Assert result for ipmath.
assert:
ansible.builtin.assert:
that: "{{ result1 == '192.168.1.6' }}"
- name: Get the previous fifth address using CIDR notation with Ipmath filter
@ -28,7 +28,7 @@
result1: "{{ '192.168.1.6/24'|ansible.utils.ipmath('-5') }}"
- name: Assert result for ipmath.
assert:
ansible.builtin.assert:
that: "{{ result1 == '192.168.1.1' }}"
- name: Get the next tenth address in IPv6 with Ipmath filter
@ -36,7 +36,7 @@
result1: "{{ '2001::1'|ansible.utils.ipmath('10') }}"
- name: Assert result for ipmath.
assert:
ansible.builtin.assert:
that: "{{ result1 == '2001::b' }}"
- name: Get the previous tenth address in IPv6 with Ipmath filter
@ -44,5 +44,5 @@
result1: "{{ '2001::5'|ansible.utils.ipmath('-10') }}"
- name: Assert result for ipmath.
assert:
ansible.builtin.assert:
that: "{{ result1 == '2000:ffff:ffff:ffff:ffff:ffff:ffff:fffb' }}"

View File

@ -4,7 +4,7 @@
result1: "{{ address | ansible.utils.ipsubnet }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result1 == '192.168.144.5/32' }}"
- name: check if given value is subnet
@ -12,7 +12,7 @@
result2: "{{ subnet | ansible.utils.ipsubnet }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result2 == '192.168.0.0/16' }}"
- name: Get the number of subnets a given subnet can be split into
@ -20,7 +20,7 @@
result3: "{{ subnet | ansible.utils.ipsubnet('20') }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result3 == '16' }}"
- name: Get the 1st subnet
@ -28,7 +28,7 @@
result4: "{{ subnet | ansible.utils.ipsubnet('20', '0') }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result4 == '192.168.0.0/20' }}"
- name: Get the last subnet
@ -36,7 +36,7 @@
result5: "{{ subnet | ansible.utils.ipsubnet('20', '-1') }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result5 == '192.168.240.0/20' }}"
- name: Get biggest subnet that contains that given IP address
@ -44,7 +44,7 @@
result6: "{{ address | ansible.utils.ipsubnet('20') }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result6 == '192.168.144.0/20' }}"
- name: Get the 1st subnet
@ -52,7 +52,7 @@
result7: "{{ address | ansible.utils.ipsubnet('18', '0') }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result7 == '192.168.128.0/18' }}"
- name: The rank of the IP in the subnet (the IP is the 36870nth /32 of the subnet)
@ -60,7 +60,7 @@
result8: "{{ address | ansible.utils.ipsubnet(subnet) }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: "{{ result8 == '36870' }}"
- name: Small subnets from a large supernet should return quickly
@ -68,7 +68,7 @@
result9: "{{ '2001:db8::/56' | ansible.utils.ipsubnet(120, 0) }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: result9 == '2001:db8::/120'
- name: Small subnets from a large supernet should return quickly at index
@ -76,5 +76,5 @@
result10: "{{ '2001:db8::/56' | ansible.utils.ipsubnet(120, 4) }}"
- name: Assert result for ipsubnet.
assert:
ansible.builtin.assert:
that: result10 == '2001:db8::400/120'

View File

@ -15,7 +15,7 @@
result1: "{{ value|ansible.utils.ipv4 }}"
- name: Assert result for ipv4.
assert:
ansible.builtin.assert:
that: "{{ result1 == result1_val }}"
- name: convert ipv4 to ipv6 filter
@ -23,7 +23,7 @@
result2: "{{ value|ansible.utils.ipv4('ipv6') }}"
- name: Assert result for ipv6.
assert:
ansible.builtin.assert:
that: "{{ result2 == result2_val }}"
- name: Ipv4 filter with address query
@ -31,7 +31,7 @@
result3: "{{ value|ansible.utils.ipv4('address') }}"
- name: Assert result for ipv4 filter with address query.
assert:
ansible.builtin.assert:
that: "{{ result3 == result3_val }}"
- name: ipv4 filter with single value
@ -39,5 +39,5 @@
result4: "{{ '192.24.2.1' | ansible.utils.ipv4('ipv6') }}"
- name: Assert result for ipv4 filter with single value
assert:
ansible.builtin.assert:
that: "{{ result4 == '::ffff:192.24.2.1/128' }}"

View File

@ -15,7 +15,7 @@
result1: "{{ value|ansible.utils.ipv6 }}"
- name: Assert result for ipv6.
assert:
ansible.builtin.assert:
that: "{{ result1 == ipv6_result1 }}"
- name: convert ipv6 to ipv4 filter
@ -23,7 +23,7 @@
result2: "{{ value|ansible.utils.ipv6('ipv4') }}"
- name: Assert result for ipv4.
assert:
ansible.builtin.assert:
that: "{{ result2 == ipv6_result2 }}"
- name: Ipv6 filter with address query
@ -31,7 +31,7 @@
result3: "{{ value|ansible.utils.ipv6('address') }}"
- name: Assert result for ipv6 filter with address query.
assert:
ansible.builtin.assert:
that: "{{ result3 == ipv6_result3 }}"
- name: ipv6 filter with single value
@ -39,5 +39,5 @@
result4: "{{ '::ffff:192.168.32.0/120' | ansible.utils.ipv6('ipv4') }}"
- name: Assert result for ipv6 filter with single value
assert:
ansible.builtin.assert:
that: "{{ result4 == '192.168.32.0/24' }}"

View File

@ -15,7 +15,7 @@
result1: "{{ value|ansible.utils.ipwrap }}"
- name: Assert result for ipwrap.
assert:
ansible.builtin.assert:
that: "{{ result1 == ipwrap_result1 }}"
- name: ipwrap filter with single value
@ -23,5 +23,5 @@
result4: "{{ 'fe80::100/10' | ansible.utils.ipwrap }}"
- name: Assert result for ipv6 filter with single value
assert:
ansible.builtin.assert:
that: "{{ result4 == '[fe80::100]/10' }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.macaddr }}"
- name: Assert result for macaddr.
assert:
ansible.builtin.assert:
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
- name: macaddr filter test2
@ -12,5 +12,5 @@
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.macaddr('cisco') }}"
- name: Assert result for macaddr.
assert:
ansible.builtin.assert:
that: "{{ result1 == '1a2b.3c4d.5e6f' }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '192.168.0.0/24'|ansible.utils.network_in_network('192.168.0.1') }}"
- name: Assert result for network_in_network.
assert:
ansible.builtin.assert:
that: "{{ result1 == True }}"
- name: network_in_network filter test2
@ -12,7 +12,7 @@
result1: "{{ '192.168.0.0/24'|ansible.utils.network_in_network('10.0.0.1') }}"
- name: Assert result for network_in_network
assert:
ansible.builtin.assert:
that: "{{ result1 == False }}"
- name: network_in_network filter test3
@ -20,5 +20,5 @@
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_network('192.168.0.0/24') }}"
- name: Assert result for network_in_network
assert:
ansible.builtin.assert:
that: "{{ result1 == True }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '192.168.0.0/24'|ansible.utils.network_in_usable('192.168.0.1') }}"
- name: Assert result for network_in_usable.
assert:
ansible.builtin.assert:
that: "{{ result1 == True }}"
- name: network_in_usable filter test2
@ -12,7 +12,7 @@
result1: "{{ '192.168.0.0/24'|ansible.utils.network_in_usable('192.168.0.255') }}"
- name: Assert result for network_in_usable
assert:
ansible.builtin.assert:
that: "{{ result1 == False }}"
- name: network_in_usable filter test3
@ -20,5 +20,5 @@
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_usable('192.168.0.255') }}"
- name: Assert result for network_in_usable
assert:
ansible.builtin.assert:
that: "{{ result1 == True }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '192.168.122.1/24'|ansible.utils.next_nth_usable(2) }}"
- name: Assert result for next_nth_usable.
assert:
ansible.builtin.assert:
that: "{{ result1 == '192.168.122.3' }}"
- name: next_nth_usable filter
@ -12,5 +12,5 @@
result1: "{{ '192.168.122.254/24'|ansible.utils.next_nth_usable(2) }}"
- name: Assert result for ipv4.
assert:
ansible.builtin.assert:
that: "{{ result1 == '' }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '10.0.0.0/8'|ansible.utils.nthhost(305) }}"
- name: Assert result for nthhost.
assert:
ansible.builtin.assert:
that: "{{ result1 == '10.0.1.49' }}"
- name: nthhost filter test2
@ -12,5 +12,5 @@
result1: "{{ '10.0.0.0/8'|ansible.utils.nthhost(-1) }}"
- name: Assert result for nthhost
assert:
ansible.builtin.assert:
that: "{{ result1 == '10.255.255.255' }}"

View File

@ -4,7 +4,7 @@
result1: "{{ '192.168.122.10/24'|ansible.utils.previous_nth_usable(2) }}"
- name: Assert result for previous_nth_usable.
assert:
ansible.builtin.assert:
that: "{{ result1 == '192.168.122.8' }}"
- name: previous_nth_usable filter
@ -12,5 +12,5 @@
result1: "{{ '192.168.122.1/24'|ansible.utils.previous_nth_usable(2) }}"
- name: Assert result for ipv4.
assert:
ansible.builtin.assert:
that: "{{ result1 == '' }}"

View File

@ -4,5 +4,5 @@
result1: "{{ ['192.168.0.34', '10.3.0.3', '192.168.2.34'] |ansible.utils.reduce_on_network('192.168.0.0/24') }}"
- name: Assert result for reduce_on_network.
assert:
ansible.builtin.assert:
that: "{{ result1 == ['192.168.0.34'] }}"

View File

@ -4,5 +4,5 @@
result1: "{{ 'fdcf:1894:23b5:d38c:0000:0000:0000:0000'|ansible.utils.slaac('c2:31:b3:83:bf:2b') }}"
- name: Assert result for slaac.
assert:
ansible.builtin.assert:
that: "{{ result1 == 'fdcf:1894:23b5:d38c:c031:b3ff:fe83:bf2b' }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -25,12 +25,12 @@
mtu: 600
is_enabled: false
- debug:
- ansible.builtin.debug:
msg: "{{ data|ansible.utils.keep_keys(target=['desc', 'interface_'], matching_parameter= 'starts_with') }}"
register: result
- name: Assert result dicts
assert:
ansible.builtin.assert:
that:
- keep['starts_with'] == result['msg']
@ -60,11 +60,11 @@
mtu: 600
is_enabled: false
- debug:
- ansible.builtin.debug:
msg: "{{ data|ansible.utils.keep_keys(target=['interface_name', 'is_enabled', 'vlan_id']) }}"
register: result
- name: Assert result dicts
assert:
ansible.builtin.assert:
that:
- keep_default['default'] == result['msg']

View File

@ -1,11 +1,11 @@
---
- name: "in_any_network: :Check if 10.1.1.1 is in the provided network list"
assert:
ansible.builtin.assert:
that:
- "{{ '10.1.1.1' is ansible.utils.in_any_network networks }}"
- name: "in_any_network: Check if 8.8.8.8 is not in the provided network list"
assert:
ansible.builtin.assert:
that: "{{ '8.8.8.8' is not ansible.utils.in_any_network networks }}"
- name: "in_any_network: Test invalidness"
@ -13,5 +13,5 @@
criteria_check: "{{ '192.168.4.56' is ansible.utils.in_any_network networks }}"
- name: "in_any_network: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check == false }}"

View File

@ -1,10 +1,10 @@
---
- name: "in_network: Check if 10.1.1.1 is in 10.0.0.0/8"
assert:
ansible.builtin.assert:
that: "{{ '10.1.1.1' is ansible.utils.in_network '10.0.0.0/8' }}"
- name: "in_network: Check if 10.1.1.1 is not in 192.168.1.0/24"
assert:
ansible.builtin.assert:
that: "{{ '10.1.1.1' is not ansible.utils.in_network '192.168.1.0/24' }}"
- name: "in_network: Test invalidness"
@ -12,15 +12,15 @@
criteria_check1: "{{ '8.8.8.8' is ansible.utils.in_network '10.0.0.0/8' }}"
- name: "in_network: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "in_network: Check if 2001:db8:a::123 is in 2001:db8:a::/64"
assert:
ansible.builtin.assert:
that: "{{ '2001:db8:a::123' is ansible.utils.in_network '2001:db8:a::/64' }}"
- name: "in_network: Check if 2001:db8:a::123 is not in 10.0.0.0/8"
assert:
ansible.builtin.assert:
that: "{{ '2001:db8:a::123' is not ansible.utils.in_network '10.0.0.0/8' }}"
- name: "in_network: Test invalidness"
@ -28,5 +28,5 @@
criteria_check2: "{{ '2001:db8:a::123' is not ansible.utils.in_network '2001:db8:a::/64' }}"
- name: "in_network: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,10 +1,10 @@
---
- name: "in_one_network: Check if 10.1.1.1 is in the provided network list"
assert:
ansible.builtin.assert:
that: "{{ '10.1.1.1' is ansible.utils.in_one_network networks }}"
- name: "in_one_network: Check if 192.168.3.5 is not in the provided network list"
assert:
ansible.builtin.assert:
that: "{{ '192.168.3.5' is not ansible.utils.in_one_network networks }}"
- name: "in_one_network: Test invalidness"
@ -12,5 +12,5 @@
criteria_check: "{{ '172.168.2.16' is ansible.utils.in_one_network networks }}"
- name: "in_one_network: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check == false }}"

View File

@ -1,14 +1,14 @@
---
- name: "ip: Check if 10.1.1.1 is a valid IP address"
assert:
ansible.builtin.assert:
that: "{{ '10.1.1.1' is ansible.utils.ip }}"
- name: "ip: Check if 2001:db8:a::123 is a valid IP address"
assert:
ansible.builtin.assert:
that: "{{ '2001:db8:a::123' is ansible.utils.ip }}"
- name: "ip: Check if 10.0.0.0/8 is a valid IP address"
assert:
ansible.builtin.assert:
that: "{{ '10.0.0.0/8' is ansible.utils.ip }}"
- name: "ip: Test invalidness"
@ -16,7 +16,7 @@
criteria_check1: "{{ 'string' is ansible.utils.ip }}"
- name: "ip: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ip: Test invalidness"
@ -24,5 +24,5 @@
criteria_check2: "{{ '300.1.1.1' is ansible.utils.ip }}"
- name: "ip: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,10 +1,10 @@
---
- name: "ip_address: Check if 10.1.1.1 is a valid IP address"
assert:
ansible.builtin.assert:
that: "{{ '10.1.1.1' is ansible.utils.ip_address }}"
- name: "ip_address: Check if 2001:db8:a::123 is a valid IP address"
assert:
ansible.builtin.assert:
that: "{{ '2001:db8:a::123' is ansible.utils.ip_address }}"
- name: "ip_address: Test invalidness"
@ -12,7 +12,7 @@
criteria_check1: "{{ '10.0.0.0/8' is ansible.utils.ip_address }}"
- name: "ip_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ip_address: Test invalidness"
@ -20,7 +20,7 @@
criteria_check2: "{{ 'string' is ansible.utils.ip_address }}"
- name: "ip_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"
- name: "ip_address: Test invalidness"
@ -28,5 +28,5 @@
criteria_check3: "{{ '300.1.1.1' is ansible.utils.ip_address }}"
- name: "ip_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check3 == false }}"

View File

@ -1,10 +1,10 @@
---
- name: "ipv4: Check if 10.0.0.0/8 is a valid IPV4 address"
assert:
ansible.builtin.assert:
that: "{{ '10.0.0.0/8' is ansible.utils.ipv4 }}"
- name: "ipv4: Check if 192.168.1.250 is a valid IPV4 address"
assert:
ansible.builtin.assert:
that: "{{ '192.168.1.250' is ansible.utils.ipv4 }}"
- name: "ipv4: Test invalidness"
@ -12,7 +12,7 @@
criteria_check1: "{{ 'fe80::216:3eff:fee4:16f3' is ansible.utils.ipv4 }}"
- name: "ipv4: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv4: Test invalidness"
@ -20,5 +20,5 @@
criteria_check2: "{{ 'string' is ansible.utils.ipv4 }}"
- name: "ipv4: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "ipv4_address: Check if 192.168.1.250 is a valid IPV4 address"
assert:
ansible.builtin.assert:
that: "{{ '192.168.1.250' is ansible.utils.ipv4_address }}"
- name: "ipv4_address: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '10.0.0.0/8' is ansible.utils.ipv4_address }}"
- name: "ipv4_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv4_address: Test invalidness"
@ -16,7 +16,7 @@
criteria_check2: "{{ 'fe80::216:3eff:fee4:16f3' is ansible.utils.ipv4_address }}"
- name: "ipv4_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"
- name: "ipv4_address: Test invalidness"
@ -24,5 +24,5 @@
criteria_check3: "{{ 'string' is ansible.utils.ipv4_address }}"
- name: "ipv4_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check3 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "ipv4_hostmask: Check if 0.0.0.255 is a hostmask"
assert:
ansible.builtin.assert:
that: "{{ '0.0.0.255' is ansible.utils.ipv4_hostmask }}"
- name: "ipv4_hostmask: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '255.255.255.0' is ansible.utils.ipv4_hostmask }}"
- name: "ipv4_hostmask: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv4_hostmask: Test invalidness"
@ -16,5 +16,5 @@
criteria_check2: "{{ '10.1.1.1' is ansible.utils.ipv4_hostmask }}"
- name: "ipv4_hostmask: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "ipv4_netmask: Check if 255.255.255.0 is a netmask"
assert:
ansible.builtin.assert:
that: "{{ '255.255.255.0' is ansible.utils.ipv4_netmask }}"
- name: "ipv4_netmask: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '0.0.0.255' is ansible.utils.ipv4_netmask }}"
- name: "ipv4_netmask: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv4_netmask: Test invalidness"
@ -16,5 +16,5 @@
criteria_check2: "{{ '10.1.1.1' is ansible.utils.ipv4_netmask }}"
- name: "ipv4_netmask: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,10 +1,10 @@
---
- name: "ipv6: Check if fe80::216:3eff:fee4:16f3 is a valid IPV6 address"
assert:
ansible.builtin.assert:
that: "{{ 'fe80::216:3eff:fee4:16f3' is ansible.utils.ipv6 }}"
- name: "ipv6: Check if 2001:db8:a::/64 is a valid IPV6 address"
assert:
ansible.builtin.assert:
that: "{{ '2001:db8:a::/64' is ansible.utils.ipv6 }}"
- name: "ipv6: Test invalidness"
@ -12,7 +12,7 @@
criteria_check1: "{{ '10.1.1.1' is ansible.utils.ipv6 }}"
- name: "ipv6: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv6: Test invalidness"
@ -20,5 +20,5 @@
criteria_check2: "{{ 'string' is ansible.utils.ipv6 }}"
- name: "ipv6: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "ipv6_address: Check if fe80::216:3eff:fee4:16f3 is a valid IPV6 address"
assert:
ansible.builtin.assert:
that: "{{ 'fe80::216:3eff:fee4:16f3' is ansible.utils.ipv6_address }}"
- name: "ipv6_address: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '2001:db8:a::123/64' is ansible.utils.ipv6_address }}"
- name: "ipv6_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv6_address: Test invalidness"
@ -16,7 +16,7 @@
criteria_check2: "{{ '192.168.1.250' is ansible.utils.ipv6_address }}"
- name: "ipv6_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"
- name: "ipv6_address: Test invalidness"
@ -24,5 +24,5 @@
criteria_check3: "{{ 'string' is ansible.utils.ipv6_address }}"
- name: "ipv6_address: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check3 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "ipv6_ipv4_mapped: Check if ::FFFF:10.1.1.1 is a valid IPv4-mapped IPv6 address"
assert:
ansible.builtin.assert:
that: "{{ '::FFFF:10.1.1.1' is ansible.utils.ipv6_ipv4_mapped }}"
- name: "ipv6_ipv4_mapped: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '::AAAA:10.1.1.1' is ansible.utils.ipv6_ipv4_mapped }}"
- name: "ipv6_ipv4_mapped: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv6_ipv4_mapped: Test invalidness"
@ -16,5 +16,5 @@
criteria_check2: "{{ 'hello-world' is ansible.utils.ipv6_ipv4_mapped }}"
- name: "ipv6_ipv4_mapped: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "ipv6_sixtofour: Check if 2002:c0a8:6301:1::1 is a valid 6to4 address"
assert:
ansible.builtin.assert:
that: "{{ '2002:c0a8:6301:1::1' is ansible.utils.ipv6_sixtofour }}"
- name: "ipv6_sixtofour: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '2001:c0a8:6301:1::1' is ansible.utils.ipv6_sixtofour }}"
- name: "ipv6_sixtofour: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv6_sixtofour: Test invalidness"
@ -16,5 +16,5 @@
criteria_check2: "{{ 'helloworld' is ansible.utils.ipv6_sixtofour }}"
- name: "ipv6_sixtofour: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "ipv6_teredo: Check if 2001::c0a8:6301:1 is a valid 6to4 address"
assert:
ansible.builtin.assert:
that: "{{ '2001::c0a8:6301:1' is ansible.utils.ipv6_teredo }}"
- name: "ipv6_teredo: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '2002::c0a8:6301:1' is ansible.utils.ipv6_teredo }}"
- name: "ipv6_teredo: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "ipv6_teredo: Test invalidness"
@ -16,5 +16,5 @@
criteria_check2: "{{ 'helloworld' is ansible.utils.ipv6_teredo }}"
- name: "ipv6_teredo: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,10 +1,10 @@
---
- name: "loopback: Check if 127.10.10.10 is a valid loopback address"
assert:
ansible.builtin.assert:
that: "{{ '127.10.10.10' is ansible.utils.loopback }}"
- name: "loopback: Check if ::1 is a valid loopback address"
assert:
ansible.builtin.assert:
that: "{{ '::1' is ansible.utils.loopback }}"
- name: "loopback: Test invalidness"
@ -12,5 +12,5 @@
criteria_check: "{{ '10.1.1.1' is ansible.utils.loopback }}"
- name: "loopback: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check == false }}"

View File

@ -1,18 +1,18 @@
---
- name: "mac: Check if 02:16:3e:e4:16:f3 is a valid MAC address"
assert:
ansible.builtin.assert:
that: "{{ '02:16:3e:e4:16:f3' is ansible.utils.mac }}"
- name: "mac: Check if 02-16-3e-e4-16-f3 is a valid MAC address"
assert:
ansible.builtin.assert:
that: "{{ '02-16-3e-e4-16-f3' is ansible.utils.mac }}"
- name: "mac: Check if 0216.3ee4.16f3 is a valid MAC address"
assert:
ansible.builtin.assert:
that: "{{ '0216.3ee4.16f3' is ansible.utils.mac }}"
- name: "mac: Check if 02163ee416f3 is a valid MAC address"
assert:
ansible.builtin.assert:
that: "{{ '02163ee416f3' is ansible.utils.mac }}"
- name: "mac: Check invalidness"
@ -20,5 +20,5 @@
criteria_check: "{{ 'string' is ansible.utils.mac }}"
- name: "mac: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check == false }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -1,10 +1,10 @@
---
- name: "multicast: Check if 224.0.0.1 is a valid multicast IP address"
assert:
ansible.builtin.assert:
that: "{{ '224.0.0.1' is ansible.utils.multicast }}"
- name: "multicast: Check if ff02::1 is a valid multicast IP address"
assert:
ansible.builtin.assert:
that: "{{ 'ff02::1' is ansible.utils.multicast }}"
- name: "multicast: Test invalidness"
@ -12,7 +12,7 @@
criteria_check1: "{{ '127.0.0.1' is ansible.utils.multicast }}"
- name: "multicast: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "multicast: Test invalidness"
@ -20,5 +20,5 @@
criteria_check2: "{{ 'helloworld' is ansible.utils.multicast }}"
- name: "multicast: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "private: Check if 10.1.1.1 is a private IP address"
assert:
ansible.builtin.assert:
that: "{{ '10.1.1.1' is ansible.utils.private }}"
- name: "private: Test invalidness"
@ -8,5 +8,5 @@
criteria_check: "{{ '8.8.8.8' is ansible.utils.private }}"
- name: "private: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "public: Check if 8.8.8.8 is a public IP address"
assert:
ansible.builtin.assert:
that: "{{ '8.8.8.8' is ansible.utils.public }}"
- name: "public: Test invalidness"
@ -8,5 +8,5 @@
criteria_check: "{{ '10.1.1.1' is ansible.utils.public }}"
- name: "public: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "reserved: Check if 253.0.0.1 is a reserved IP address"
assert:
ansible.builtin.assert:
that: "{{ '253.0.0.1' is ansible.utils.reserved }}"
- name: "reserved: Test invalidness"
@ -8,5 +8,5 @@
criteria_check: "{{ '128.146.1.7' is ansible.utils.reserved }}"
- name: "reserved: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check == false }}"

View File

@ -1,14 +1,14 @@
---
- name: "resolvable: Check if {{ good_name }} is resolvable or not"
assert:
ansible.builtin.assert:
that: "{{ good_name is ansible.utils.resolvable }}"
- name: "resolvable: Check if {{ ipv4_localhost }} is resolvable or not"
assert:
ansible.builtin.assert:
that: "{{ ipv4_localhost is ansible.utils.resolvable }}"
- name: "resolvable: Check if {{ ipv6_localhost }} is resolvable or not"
assert:
ansible.builtin.assert:
that: "{{ ipv6_localhost is ansible.utils.resolvable }}"
- name: "resolvable: Test invalidness"
@ -16,7 +16,7 @@
criteria_check1: "{{ bad_name is ansible.utils.resolvable }}"
- name: "resolvable: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "resolvable: Test invalidness"
@ -24,5 +24,5 @@
criteria_check2: "{{ 'invalidhost' is ansible.utils.resolvable }}"
- name: "resolvable: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "subnet_of: Check if 10.1.1.0/24 is a subnet of 10.0.0.0/8"
assert:
ansible.builtin.assert:
that: "{{ '10.1.1.0/24' is ansible.utils.subnet_of '10.0.0.0/8' }}"
- name: "subnet_of: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '10.0.0.0/8' is ansible.utils.subnet_of '10.1.1.0/24' }}"
- name: "subnet_of: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "subnet_of: Test invalidness"
@ -16,5 +16,5 @@
criteria_check2: "{{ '192.168.1.0/24' is ansible.utils.subnet_of '10.0.0.0/8' }}"
- name: "subnet_of: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: "supernet_of: Check if 10.0.0.0/8 is a supernet of 10.1.1.0/24"
assert:
ansible.builtin.assert:
that: "{{ '10.0.0.0/8' is ansible.utils.supernet_of '10.1.1.0/24' }}"
- name: "supernet_of: Test invalidness"
@ -8,7 +8,7 @@
criteria_check1: "{{ '10.1.1.0/24' is ansible.utils.supernet_of '10.0.0.0/8' }}"
- name: "supernet_of: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "supernet_of: Test invalidness"
@ -16,5 +16,5 @@
criteria_check2: "{{ '10.0.0.0/8' is ansible.utils.supernet_of '192.168.1.0/24' }}"
- name: "supernet_of: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,14 +1,14 @@
---
- name: "unspecified: Check if 0.0.0.0 is an unspecified IP address"
assert:
ansible.builtin.assert:
that: "{{ '0.0.0.0' is ansible.utils.unspecified }}"
- name: "unspecified: Check if 0:0:0:0:0:0:0:0 is an unspecified IP address"
assert:
ansible.builtin.assert:
that: "{{ '0:0:0:0:0:0:0:0' is ansible.utils.unspecified }}"
- name: "unspecified: Check if :: is an unspecified IP address"
assert:
ansible.builtin.assert:
that: "{{ '::' is ansible.utils.unspecified }}"
- name: "unspecified: Test invalidness"
@ -16,7 +16,7 @@
criteria_check1: "{{ '127.0.0.1' is ansible.utils.unspecified }}"
- name: "unspecified: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check1 == false }}"
- name: "unspecified: Test invalidness"
@ -24,5 +24,5 @@
criteria_check2: "{{ '::1' is ansible.utils.unspecified }}"
- name: "unspecified: Assert invalidness"
assert:
ansible.builtin.assert:
that: "{{ criteria_check2 == false }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -1,5 +1,5 @@
---
- debug:
- ansible.builtin.debug:
msg: "START param_list_compare integration tests on connection={{ ansible_connection }}"
- name: Setup supported resource module list json
@ -44,13 +44,13 @@
- "bgp_global"
- name: Get the final list of resources
set_fact:
ansible.builtin.set_fact:
final_network_resources: "{{ network_resources['modules']|ansible.utils.param_list_compare(provided_resources) }}"
- name: Assert final network resources
assert:
ansible.builtin.assert:
that:
- "{{ expected_network_resources | symmetric_difference(final_network_resources['actionable']) |length\
\ == 0 }}"
- debug:
- ansible.builtin.debug:
msg: "END param_list_compare integration tests on connection={{ ansible_connection }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -29,11 +29,11 @@
mtu: 600
enabled: false
- debug:
- ansible.builtin.debug:
msg: "{{ data|ansible.utils.remove_keys(target=['notes', 'comment']) }}"
register: result
- name: Assert result dicts
assert:
ansible.builtin.assert:
that:
- remove['default'] == result['msg']

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -25,11 +25,11 @@
mtu: 600
enabled: false
- debug:
- ansible.builtin.debug:
msg: "{{ data|ansible.utils.replace_keys(target=[{'before':'interface_name', 'after':'name'}]) }}"
register: result
- name: Assert result dicts
assert:
ansible.builtin.assert:
that:
- replace['default'] == result['msg']

View File

@ -12,9 +12,9 @@
ignore_errors: true
register: result
- debug:
- ansible.builtin.debug:
var: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "'5' is not a valid boolean"
@ -25,9 +25,9 @@
ignore_errors: true
register: result
- debug:
- ansible.builtin.debug:
var: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "missing required arguments: var"

View File

@ -11,7 +11,7 @@
empty_mapping: {}
- name: Test filter and lookup plugin with empty list and mapping
assert:
ansible.builtin.assert:
that: "{{ item.result == item.expected }}"
loop:
- result: "{{ a|ansible.utils.to_paths }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -8,7 +8,7 @@
- 1
- name: Test filter and lookup plugin, simple and prepend
assert:
ansible.builtin.assert:
that: "{{ item.result == item.expected }}"
loop:
- result: "{{ a|ansible.utils.to_paths }}"
@ -36,7 +36,7 @@
- 0
- name: Test filter and lookup plugin, wantlist and prepend
assert:
ansible.builtin.assert:
that: "{{ item.result == item.expected }}"
loop:
- result: "{{ a|ansible.utils.to_paths(wantlist=True) }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -7,11 +7,11 @@
"interface-configuration":
output: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<interface-configurations xmlns=\"http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg\">\n\t<interface-configuration></interface-configuration>\n</interface-configurations>"
- debug:
- ansible.builtin.debug:
msg: "{{ data|ansible.utils.to_xml() }}"
- name: Integration tests with and without default engine as xmltodict and
assert:
ansible.builtin.assert:
that: "{{ output == item.test }}"
loop:
- test: "{{ data|ansible.utils.to_xml() }}"
@ -29,7 +29,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that: "{{ msg in result.msg }}"
vars:
msg: "Error when using plugin 'to_xml': engine: dicttoxml is not supported"

View File

@ -16,7 +16,7 @@
value: 20
register: updated
- assert:
- ansible.builtin.assert:
that: "{{ updated.a == expected.a }}"
vars:
expected:
@ -38,7 +38,7 @@
- true
register: updated
- assert:
- ansible.builtin.assert:
that: "{{ updated.a == expected.a }}"
vars:
expected:
@ -58,7 +58,7 @@
index: "{{ a.b.c|ansible.utils.index_of('eq', 2) }}"
register: updated
- assert:
- ansible.builtin.assert:
that: "{{ updated.a == expected.a }}"
vars:
expected:

View File

@ -5,7 +5,7 @@
ignore_errors: true
register: result1
- assert:
- ansible.builtin.assert:
that: "{{ msg in result1.msg }}"
vars:
msg: "does not appear to be an IPv4 or IPv6 network"
@ -16,7 +16,7 @@
ignore_errors: true
register: result2
- assert:
- ansible.builtin.assert:
that: "{{ msg in result2.msg }}"
vars:
msg: "does not appear to be an IPv4 or IPv6 network"
@ -27,7 +27,7 @@
ignore_errors: true
register: result3
- assert:
- ansible.builtin.assert:
that: "{{ msg in result3.msg }}"
vars:
msg: "has host bits set"
@ -38,7 +38,7 @@
ignore_errors: true
register: result4
- assert:
- ansible.builtin.assert:
that: "{{ msg in result4.msg }}"
vars:
msg: "does not appear to be an IPv4 or IPv6 network"
@ -49,7 +49,7 @@
ignore_errors: true
register: result5
- assert:
- ansible.builtin.assert:
that: "{{ msg in result5.msg }}"
vars:
msg: "does not appear to be an IPv4 or IPv6 network"
@ -60,7 +60,7 @@
ignore_errors: true
register: result6
- assert:
- ansible.builtin.assert:
that: "{{ msg in result6.msg }}"
vars:
msg: "does not appear to be an IPv4 or IPv6 network"
@ -71,7 +71,7 @@
ignore_errors: true
register: result7
- assert:
- ansible.builtin.assert:
that: "{{ msg in result7.msg }}"
vars:
msg: "does not appear to be an IPv4 or IPv6 network"

View File

@ -5,7 +5,7 @@
result1: "{{ '10.1.1.1' | ansible.utils.usable_range }}"
- name: Assert result for 10.1.1.1
assert:
ansible.builtin.assert:
that: "{{ result1 == result1_val }}"
- name: Expand and produce list of usable IP addresses in 10.0.0.0/28
@ -13,7 +13,7 @@
result2: "{{ '10.0.0.0/28' | ansible.utils.usable_range }}"
- name: Assert result for 10.0.0.0/28
assert:
ansible.builtin.assert:
that: "{{ result2 == result2_val }}"
- name: Expand and produce list of usable IP addresses in 192.0.2.0/24
@ -21,7 +21,7 @@
result3: "{{ '192.0.2.0/24' | ansible.utils.usable_range }}"
- name: Assert result for 192.0.2.0/24
assert:
ansible.builtin.assert:
# Since the list is huge, asserting only on number of ips
that: "{{ result3.number_of_ips == result3_val.number_of_ips }}"
@ -31,7 +31,7 @@
result4: "{{ '2001:db8:abcd:0012::0/126' | ansible.utils.usable_range }}"
- name: Assert result for 2001:db8:abcd:0012::0/126
assert:
ansible.builtin.assert:
that: "{{ result4 == result4_val }}"
- name: "Expand and produce list of usable IP addresses in 2001:db8:abcd:12::"
@ -39,5 +39,5 @@
result5: "{{ '2001:db8:abcd:12::' | ansible.utils.usable_range }}"
- name: "Assert result for 2001:db8:abcd:12::"
assert:
ansible.builtin.assert:
that: "{{ result5 == result5_val }}"

View File

@ -1,6 +1,6 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
@ -10,5 +10,5 @@
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -1,11 +1,11 @@
---
- name: Recursively find all test files
find:
ansible.builtin.find:
file_type: file
paths: "{{ role_path }}/tests"
recurse: true
delegate_to: localhost
register: found
- include: "{{ item.path }}"
- ansible.builtin.include_tasks: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -20,7 +20,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ fail_config|ansible.utils.validate(rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks[0].found == 'interface Eth1/1'"
- "data_criteria_checks[1].found == 'interface Loopback 10'"
@ -30,7 +30,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ warn_config|ansible.utils.validate(rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"
@ -38,7 +38,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ pass_config|ansible.utils.validate(rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"
@ -48,7 +48,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- '"is not one of \"warn\" or \"fail\"" in result["msg"]'

View File

@ -20,7 +20,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ lookup('ansible.utils.validate', fail_config, rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks[0].found == 'interface Eth1/1'"
- "data_criteria_checks[1].found == 'interface Loopback 10'"
@ -30,7 +30,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ lookup('ansible.utils.validate', warn_config, rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"
@ -38,7 +38,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ lookup('ansible.utils.validate', pass_config, rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"
@ -48,7 +48,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- '"is not one of \"warn\" or \"fail\"" in result["msg"]'

View File

@ -24,7 +24,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "'errors' in result"
- "result['errors'][0].found == 'interface Eth1/1'"
@ -45,7 +45,7 @@
engine: ansible.utils.config
register: result
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "'warnings' in result"
@ -60,7 +60,7 @@
engine: ansible.utils.config
register: result
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "'warnings' not in result"
@ -75,7 +75,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- '"is not one of \"warn\" or \"fail\"" in result["msg"]'

View File

@ -20,7 +20,7 @@
ansible.builtin.set_fact:
is_data_valid: "{{ fail_config is ansible.utils.validate(criteria=rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == false"
@ -28,7 +28,7 @@
ansible.builtin.set_fact:
is_data_valid: "{{ warn_config is ansible.utils.validate(criteria=rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == true"
@ -36,7 +36,7 @@
ansible.builtin.set_fact:
is_data_valid: "{{ pass_config is ansible.utils.validate(criteria=rules, engine='ansible.utils.config') }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == true"
@ -46,7 +46,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- '"is not one of \"warn\" or \"fail\"" in result["msg"]'

View File

@ -3,7 +3,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ show_interfaces|ansible.utils.validate([oper_status, enable_check, crc_error_check], engine='ansible.utils.jsonschema') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks[0].data_path == 'GigabitEthernet0/0/0/0.oper_status'"
- "data_criteria_checks[1].data_path == 'GigabitEthernet0/0/0/1.enabled'"
@ -13,7 +13,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ show_interfaces|ansible.utils.validate(in_rate_check) }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"
@ -23,7 +23,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "'value of draft must be one of: draft3, draft4, draft6, draft7, got: draft0' in result.msg"
@ -33,7 +33,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "result['failed'] == true"
@ -45,7 +45,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'data\\' option value is invalid' in result.msg"
@ -56,7 +56,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'criteria\\' option value is invalid' in result.msg"
@ -73,7 +73,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ data|ansible.utils.validate([oper_status_up_criteria, enabled_check_criteria, crc_error_check_criteria]) }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks[0].data_path == 'GigabitEthernet0/0/0/0.oper_status'"
- "data_criteria_checks[1].data_path == 'GigabitEthernet0/0/0/1.enabled'"
@ -83,6 +83,6 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ data|ansible.utils.validate(in_rate_check_criteria) }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"

View File

@ -5,7 +5,7 @@
vars:
ansible_validate_jsonschema_draft: draft7
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks[0].data_path == 'GigabitEthernet0/0/0/0.oper_status'"
- "data_criteria_checks[1].data_path == 'GigabitEthernet0/0/0/1.enabled'"
@ -17,7 +17,7 @@
vars:
ansible_validate_jsonschema_draft: draft7
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"
@ -29,7 +29,7 @@
vars:
ansible_validate_jsonschema_draft: draft7
- assert:
- ansible.builtin.assert:
that:
- "'value of draft must be one of: draft3, draft4, draft6, draft7, got: draft0' in result.msg"
@ -41,7 +41,7 @@
vars:
ansible_validate_jsonschema_draft: draft0
- assert:
- ansible.builtin.assert:
that:
- "'value of draft must be one of: draft3, draft4, draft6, draft7, got: draft0' in result.msg"
@ -51,7 +51,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "result['failed'] == true"
@ -63,7 +63,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'data\\' option value is invalid' in result.msg"
@ -74,7 +74,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'criteria\\' option value is invalid' in result.msg"
@ -91,7 +91,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ lookup('ansible.utils.validate', data, [oper_status_up_criteria, enabled_check_criteria, crc_error_check_criteria], engine='ansible.utils.jsonschema') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks[0].data_path == 'GigabitEthernet0/0/0/0.oper_status'"
- "data_criteria_checks[1].data_path == 'GigabitEthernet0/0/0/1.enabled'"
@ -101,6 +101,6 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ lookup('ansible.utils.validate', data, in_rate_check_criteria, engine='ansible.utils.jsonschema') }}"
- assert:
- ansible.builtin.assert:
that:
- "data_criteria_checks == []"

View File

@ -12,7 +12,7 @@
vars:
ansible_validate_jsonschema_draft: draft7
- assert:
- ansible.builtin.assert:
that:
- "'errors' in result"
- "result['errors'][0].data_path == 'GigabitEthernet0/0/0/0.oper_status'"
@ -33,7 +33,7 @@
vars:
ansible_validate_jsonschema_draft: draft7
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "'All checks passed' in result.msg"
@ -48,7 +48,7 @@
vars:
ansible_validate_jsonschema_draft: draft0
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "result['failed'] == true"
@ -62,7 +62,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "result['failed'] == true"
@ -76,7 +76,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'data\\' option value is invalid' in result.msg"
@ -89,7 +89,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'criteria\\' option value is invalid' in result.msg"
@ -107,7 +107,7 @@
vars:
ansible_validate_jsonschema_draft: draft7
- assert:
- ansible.builtin.assert:
that:
- "'errors' in result"
- "result['errors'][0].data_path == 'GigabitEthernet0/0/0/0.oper_status'"
@ -128,7 +128,7 @@
vars:
ansible_validate_jsonschema_draft: draft7
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "'All checks passed' in result.msg"
@ -139,7 +139,7 @@
criteria: "{{ lookup('ansible.builtin.file', 'criteria/check_list_data.json') }}"
engine: ansible.utils.jsonschema
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "'All checks passed' in result.msg"

View File

@ -3,7 +3,7 @@
ansible.builtin.set_fact:
is_data_valid: "{{ show_interfaces is ansible.utils.validate(engine='ansible.utils.jsonschema', criteria=[oper_status, enable_check, crc_error_check], draft='draft7') }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == false"
@ -11,7 +11,7 @@
ansible.builtin.set_fact:
is_data_valid: "{{ show_interfaces is ansible.utils.validate(criteria=in_rate_check) }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == true"
@ -21,7 +21,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "'value of draft must be one of: draft3, draft4, draft6, draft7, got: draft0' in result.msg"
@ -31,7 +31,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "'errors' not in result"
- "result['failed'] == true"
@ -43,7 +43,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'data\\' option value is invalid' in result.msg"
@ -54,7 +54,7 @@
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result['failed'] == true"
- "'\\'criteria\\' option value is invalid' in result.msg"
@ -71,7 +71,7 @@
ansible.builtin.set_fact:
is_data_valid: "{{ show_interfaces is ansible.utils.validate(engine='ansible.utils.jsonschema', criteria=[oper_status_up_criteria, enabled_check_criteria, crc_error_check_criteria], draft='draft7') }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == false"
@ -83,7 +83,7 @@
ansible.builtin.set_fact:
data_criteria_checks: "{{ data|ansible.utils.validate(in_rate_check_criteria) }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == true"
@ -96,6 +96,6 @@
ansible.builtin.set_fact:
is_data_valid: "{{ data is ansible.utils.validate(engine='ansible.utils.jsonschema', criteria=[criteria_1], draft='draft7') }}"
- assert:
- ansible.builtin.assert:
that:
- "is_data_valid == true"