Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/nic_assert.yml

raw symbols SCIP
1 - name: Get NIC information.
2 ansible.builtin.uri:
3 url: "https://{{ hostname }}{{ api_system }}/EthernetInterfaces/{{ nic_data.Id }}"
4 validate_certs: "{{ validate_certs }}"
5 ca_path: "{{ ca_path | default(omit) }}"
6 method: "{{ idrac_gather_facts_uri_method }}"
7 user: "{{ username }}"
8 password: "{{ password }}"
9 headers: "{{ idrac_gather_facts_uri_headers }}"
10 body_format: "{{ idrac_gather_facts_uri_body_format }}"
11 status_code: "{{ idrac_gather_facts_uri_status_code }}"
12 return_content: "{{ idrac_gather_facts_uri_return_content }}"
13 register: nic_result
14 no_log: true
15
16 - name: Set nic facts
17 ansible.builtin.set_fact:
18 api_response: "{{ nic_result.json | ansible.utils.remove_keys(target=
19 ['@odata.context', '@odata.id', '@odata.type', '@odata.etag',
20 '[email protected]', '[email protected]',
21 '[email protected]', '[email protected]',
22 '[email protected]']) }}"
23
24 - name: Set the keys diff
25 ansible.builtin.set_fact:
26 diff_keys: "{{ nic_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}"
27
28 - name: Set a diff of dict
29 ansible.builtin.set_fact:
30 diff_data: "{{ diff_data | combine({item: nic_data[item]}) }}"
31 loop: "{{ nic_data.keys() }}"
32 when:
33 - diff_keys | length == 0
34 - nic_data[item] != api_response[item]
35 - item not in exclude_keys
36
37 - name: Assert the difference in Keys
38 ansible.builtin.assert:
39 that:
40 - (diff_keys | length) == 0
41 - (diff_data | length) == 0
42 fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
43 success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"