
    Vhd
                     f    d Z ddlmZmZmZ ddlmZmZmZ e	Z
dZdZdZed        Z G d d	e      Zy
)z*
Test plugin file for netaddr tests: ipv4
    )absolute_importdivisionprint_function)_need_ipaddress_validate_args
ip_networkaG  
    name: ipv4
    author: Priyam Sahoo (@priyamsahoo)
    version_added: "2.2.0"
    short_description: Test if something is an IPv4 address or network
    description:
        - This plugin checks if the provided value is a valid host or network IP address with IPv4 addressing scheme
    options:
        ip:
            description:
            - A string that represents the value against which the test is going to be performed
            - 'For example: C(10.1.1.1), C(10.0.0.0/8), or C(fe80::216:3eff:fee4:16f3)'
            type: str
            required: True
    notes:
a  

#### Simple examples

- name: Check if 10.0.0.0/8 is a valid IPv4 address
  ansible.builtin.set_fact:
    data: "{{ '10.0.0.0/8' is ansible.utils.ipv4 }}"

# TASK [Check if 10.0.0.0/8 is a valid IPv4 address] ***************************
# ok: [localhost] => {
#     "ansible_facts": {
#         "data": true
#     },
#     "changed": false
# }

- name: Check if 192.168.1.250 is a valid IPv4 address
  ansible.builtin.set_fact:
    data: "{{ '192.168.1.250' is ansible.utils.ipv4 }}"

# TASK [Check if 192.168.1.250 is a valid IPv4 address] ********************
# ok: [localhost] => {
#     "ansible_facts": {
#         "data": true
#     },
#     "changed": false
# }

- name: Check if fe80::216:3eff:fee4:16f3 is not a valid IPv4 address
  ansible.builtin.set_fact:
    data: "{{ 'fe80::216:3eff:fee4:16f3' is not ansible.utils.ipv4 }}"

# TASK [Check if fe80::216:3eff:fee4:16f3 is not a valid IPv4 address] *********
# 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| i}t        dt        |       	 t        |       j                  dk(  S # t        $ r Y yw xY w)z/Test if something in an IPv4 address or networkipipv4   F)r   DOCUMENTATIONr   version	Exception)r
   paramss     c/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ansible/utils/plugins/test/ipv4.py_ipv4r   W   sE     BZF6=&1"~%%** s   / 	;;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.testsi   s    }}    N)__name__
__module____qualname____doc__r   r   r    r   r   r   r   d   s    Hr   r   N)r   
__future__r   r   r   Kansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utilsr   r   r   type__metaclass__r   EXAMPLESRETURNr   objectr   r   r   r   <module>r&      sZ    A @  "'R
 	 	 r   