�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
m Z d d
l m Z d � Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: pn_ipv6security_raguard
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.9"
short_description: CLI command to create/modify/delete ipv6security-raguard
description:
- This module can be used to add ipv6 RA Guard Policy, Update ipv6 RA guard Policy and Remove ipv6 RA Guard Policy.
options:
pn_cliswitch:
description:
- Target switch to run the CLI on.
required: false
type: str
state:
description:
- ipv6security-raguard configuration command.
required: false
choices: ['present', 'update', 'absent']
type: str
default: 'present'
pn_device:
description:
- RA Guard Device. host or router.
required: false
choices: ['host', 'router']
type: str
pn_access_list:
description:
- RA Guard Access List of Source IPs.
required: false
type: str
pn_prefix_list:
description:
- RA Guard Prefix List.
required: false
type: str
pn_router_priority:
description:
- RA Guard Router Priority.
required: false
type: str
choices: ['low', 'medium', 'high']
pn_name:
description:
- RA Guard Policy Name.
required: true
type: str
s�
- name: ipv6 security ragurad create
pn_ipv6security_raguard:
pn_cliswitch: "sw01"
pn_name: "foo"
pn_device: "host"
- name: ipv6 security ragurad create
pn_ipv6security_raguard:
pn_cliswitch: "sw01"
pn_name: "foo1"
pn_device: "host"
pn_access_list: "sample"
pn_prefix_list: "sample"
pn_router_priority: "low"
- name: ipv6 security ragurad modify
pn_ipv6security_raguard:
pn_cliswitch: "sw01"
pn_name: "foo1"
pn_device: "router"
pn_router_priority: "medium"
state: "update"
- name: ipv6 security ragurad delete
pn_ipv6security_raguard:
pn_cliswitch: "sw01"
pn_name: "foo"
state: "absent"
s�
command:
description: the CLI command run on the target node.
returned: always
type: str
stdout:
description: set of responses from the ipv6security-raguard command.
returned: always
type: list
stderr:
description: set of error responses from the ipv6security-raguard command.
returned: on error
type: list
changed:
description: indicates whether the CLI caused changes on the target.
returned: always
type: bool
( t
AnsibleModule( t pn_clit run_cli( t run_commandsc C` sO | j d } d } t | | � d } | r; | j � } n | | k rK t St S( s�
This method checks for idempotency using the ipv6security-raguard-show command.
If a name exists, return True if name exists else False.
:param module: The Ansible module to fetch input parameters
:param cli: The CLI string
t pn_names6 ipv6security-raguard-show format name parsable-delim ,i ( t paramsR t splitt Truet False( t modulet namet clit out( ( s\ /usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_ipv6security_raguard.pyt check_cliw s
c C` se d | } t | | � d } | r2 | j � } n | | k ra | j d t d d | | f � n d S( s�
This method checks for idempotency using provided command.
:param module: The Ansible module to fetch input parameters
:param cli: The CLI string
s %s format name no-show-headersi t failedt msgs %s name %s does not existsN( R R t fail_jsonR ( R t list_namet commandR R ( ( s\ /usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_ipv6security_raguard.pyt
check_list� s
c
C` s t d d d d d d � } t d t d t d d
� d t d t d d
d | j � d
d � d t d t d d
d d d g � d t d t d d
� d t d t d d
� d t d t d d
d d d d g � d t d t d d
� � } t d | d d d d g g f � } | j d } | j d } | j d } | j d } | j d } | j d } | j d } | | }
t | | � } t | � } |
d k r�| r�| r�| r�| r�| j d t d d � q�n |
d k r| t k r| j d t d d | � qn |
d k r<| t k r<| j d t d d | � q<n | d |
| f 7} |
d k r�| d k r�| d! | 7} | r�t
| | d"