
    Vh
                     n    d Z ddlmZmZmZ ddl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)z2
Test plugin file for netaddr tests: ipv4_netmask
    )absolute_importdivisionprint_function)_need_ipaddress
ip_network)_validate_argsa  
    name: ipv4_netmask
    author: Priyam Sahoo (@priyamsahoo)
    version_added: "2.2.0"
    short_description: Test if an address is a valid netmask
    description:
        - This plugin checks if the provided ip address is a valid IPv4 netmask or not
    options:
        mask:
            description:
            - A string that represents the value against which the test is going to be performed
            - 'For example: C(0.1.255.255) or C(255.255.255.0)'
            type: str
            required: True
    notes:
a  

#### Simple examples

- name: Check if 255.255.255.0 is a netmask
  ansible.builtin.set_fact:
    data: "{{ '255.255.255.0' is ansible.utils.ipv4_netmask }}"

# TASK [Check if 255.255.255.0 is a netmask] *******************************************
# ok: [localhost] => {
#     "ansible_facts": {
#         "data": true
#     },
#     "changed": false
# }

- name: Check if 255.255.255.128 is a netmask
  ansible.builtin.set_fact:
    data: "{{ '255.255.255.128' is ansible.utils.ipv4_netmask }}"

# TASK [Check if 255.255.255.128 is a netmask] *****************************************
# ok: [localhost] => {
#     "ansible_facts": {
#         "data": true
#     },
#     "changed": false
# }

- name: Check if 255.255.255.127 is not a netmask
  ansible.builtin.set_fact:
    data: "{{ '255.255.255.127' is not ansible.utils.ipv4_netmask }}"

# TASK [Check if 255.255.255.127 is not a netmask] *************************************
# 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        dj                  |             }t	        |j
                        | k(  S # t        $ r Y yw xY w)zTest for a valid IPv4 netmaskmaskipv4_netmaskz10.0.0.0/{mask})r
   F)r   DOCUMENTATIONr   formatstrnetmask	Exception)r
   paramsnetworks      k/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ansible/utils/plugins/test/ipv4_netmask.py_ipv4_netmaskr   W   s]     d^F>=&9.5545@A7??#t++ s   2A
 
	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.testsj   s    }}    N)__name__
__module____qualname____doc__r   r   r    r   r   r   r   e   s    .Hr   r   N)r   
__future__r   r   r   Kansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utilsr   r   Aansible_collections.ansible.utils.plugins.plugin_utils.base.utilsr   type__metaclass__r   EXAMPLESRETURNr   objectr   r    r   r   <module>r)      s[    A @ ] "'R
 
 
 r   