
    Vh
                     r    d Z ddlmZmZmZ ddlmZmZmZ ddl	m
Z
 eZdZdZdZed        Z G d	 d
e      Zy)z1
Test plugin file for netaddr tests: supernet_of
    )absolute_importdivisionprint_function)_is_subnet_of_need_ipaddress
ip_network)_validate_argsa  
    name: supernet_of
    author: Priyam Sahoo (@priyamsahoo)
    version_added: "2.2.0"
    short_description: Test if a network is a supernet of another network
    description:
        - This plugin checks if the first network is a supernet of the second network amongst the provided network addresses
    options:
        network_a:
            description:
            - A string that represents the first network address
            - 'For example: C(10.1.1.0/24)'
            type: str
            required: True
        network_b:
            description:
            - A string that represents the second network address
            - 'For example: C(10.0.0.0/8)'
            type: str
            required: True
    notes:
a  

- name: Check if 10.0.0.0/8 is a supernet of 10.1.1.0/24
  ansible.builtin.set_fact:
    data: "{{ '10.0.0.0/8' is ansible.utils.supernet_of '10.1.1.0/24' }}"

# TASK [Check if 10.0.0.0/8 is a supernet of 10.1.1.0/24] ************************
# ok: [localhost] => {
#     "ansible_facts": {
#         "data": true
#     },
#     "changed": false
# }

- name: Check if 10.0.0.0/8 is not a supernet of 192.168.1.0/24
  ansible.builtin.set_fact:
    data: "{{ '10.0.0.0/8' is not ansible.utils.supernet_of '192.168.1.0/24' }}"

# TASK [Check if 10.0.0.0/8 is not a supernet of 192.168.1.0/24] *****************
# ok: [localhost] => {
#     "ansible_facts": {
#         "data": true
#     },
#     "changed": false
# }
z
  data:
    description:
      - If jinja test satisfies plugin expression C(true)
      - If jinja test does not satisfy plugin expression C(false)
c                     | |d}t        dt        |       	 t        t        |      t        |             S # t        $ r Y yw xY w)z3Test if an network is a supernet of another network)	network_a	network_bsupernet_ofF)r	   DOCUMENTATIONr   r   	Exception)r   r   paramss      j/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ansible/utils/plugins/test/supernet_of.py_supernet_ofr   P   sH     %9=F=-8Z	2Jy4IJJ s   6 	AAc                       e Zd ZdZdeiZd Zy)
TestModuleznetwork jinja testr   c                     | j                   S )N)test_map)selfs    r   testszTestModule.testsb   s    }}    N)__name__
__module____qualname____doc__r   r   r    r   r   r   r   ]   s    |,Hr   r   N)r   
__future__r   r   r   Kansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utilsr   r   r   Aansible_collections.ansible.utils.plugins.plugin_utils.base.utilsr	   type__metaclass__r   EXAMPLESRETURNr   objectr   r   r   r   <module>r'      s_    A @ 
 ] .6
 	 	 r   