Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/netvisor/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_loopback_interface.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
mZdd
lmZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: pn_vrouter_loopback_interface
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.9"
short_description: CLI command to add/remove vrouter-loopback-interface
description:
  - This module can be used to add loopback interface to a vRouter or
    remove loopback interface from a vRouter.
options:
  pn_cliswitch:
    description:
      - Target switch to run the CLI on.
    required: false
    type: str
  state:
    description:
      - State the action to perform. Use C(present) to add vrouter-loopback-interface
        and C(absent) to remove vrouter-loopback-interface.
    required: false
    type: str
    choices: ['present', 'absent']
    default: 'present'
  pn_ip:
    description:
      - loopback IP address.
    required: true
    type: str
  pn_index:
    description:
      - loopback index from 1 to 255.
    required: false
    type: str
  pn_vrouter_name:
    description:
      - name of service config.
    required: true
    type: str
s~
- name: Add vrouter loopback interface
  pn_vrouter_loopback_interface:
    state: "present"
    pn_cliswitch: "sw01"
    pn_vrouter_name: "sw01-vrouter"
    pn_ip: "192.168.10.1"

- name: Remove vrouter loopback interface
  pn_vrouter_loopback_interface:
    state: "absent"
    pn_cliswitch: "sw01"
    pn_vrouter_name: "sw01-vrouter"
    pn_ip: "192.168.10.1"
    pn_index: "2"
s�
command:
  description: the CLI command run on the target node.
  returned: always
  type: str
stdout:
  description: set of responses from the vrouter-loopback-interface command.
  returned: always
  type: list
stderr:
  description: set of error response from the vrouter-loopback-interface
               command.
  returned: on error
  type: list
changed:
  description: indicates whether the CLI caused changes on the target.
  returned: always
  type: bool
(t
AnsibleModule(tpn_clitrun_cli(trun_commandsc	C`s�|jd}|jd}d}t||�d}|rH|j�}n||krZtnt}|r�|d}|d|7}|d7}t||�d}|r�||j�kr�t}q�t}n||fS(s~
    This method checks if vRouter exists on the target node.
    This method also checks for idempotency using the vrouter-interface-show
    command.
    If the given vRouter exists, return VROUTER_EXISTS as True else False.

    :param module: The Ansible module to fetch input parameters
    :param cli: The CLI string
    :return Booleans: VROUTER_EXISTS, INTERFACE_EXISTS
    tpn_vrouter_nametpn_ips(vrouter-show format name no-show-headersis! vrouter-loopback-interface-show svrouter-name %s sformat ip no-show-headers(tparamsRtsplittTruetFalse(	tmoduletclitvrouter_nametinterface_ipt
check_vroutertouttVROUTER_EXISTStshowtINTERFACE_EXISTS((sb/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_loopback_interface.pyt	check_cli`s 



		cC`sHtdddd�}tdtdtdd�d	tdtddd
|j�dd�dtdtdd�d
tdtdd�dtdtdd��}td|dd	dddggd	dddd
ggf�}|jd}|jd	}|jd}|jd
}|jd}||}t||�}	t||	�\}
}|	d||f7}	|r�t|�dks�t|�dkr�|j	dtdd�n|r-|dkr-d}t
||�d}
|
r-|
j�}
xO|
D]D}|j�jd�}||kr�|j	dtdd|�q�q�Wq-n|dkr�|
tkrb|j	dtdd|�n|tkr�|j
dtdd|�n|r�|	d|7}	n|r�|	d|7}	q�n|dkr4|
tkr�|j	dtdd|�n|tkr|j
dtdd|�n|r4|	d|7}	q4nt||	|�d S(!s' This section is for arguments parsing tpresentsvrouter-loopback-interface-addtabsents!vrouter-loopback-interface-removetpn_cliswitchtrequiredttypetstrtstatetchoicestdefaultR
tpn_indexRt
argument_spectrequired_ifs %s vrouter-name %s ii�tfailedtmsgs!index should be in range 1 to 255s=vrouter-loopback-interface-show format index parsable-delim ,t,sindex with value %s existsvRouter %s does not existtskippeds!vRouter with loopback ip %s exists ip s index s(vRouter with loopback ip %s doesnt existN(tdictRtkeysRRRR	Rtintt	fail_jsonRRtstript	exit_jsonR
(t	state_mapR&Rt	cliswitchR"tiptindexRtcommandRRRRRtres((sb/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_loopback_interface.pytmain�s~	





*	

					t__main__N(t
__future__RRRR t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt-ansible.module_utils.network.netvisor.pn_nvosR	R
t.ansible.module_utils.network.netvisor.netvisorRRR8t__name__(((sb/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_loopback_interface.pyt<module>s


)	%	]

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]