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_packet_relay.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_packet_relay
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.9"
short_description: CLI command to add/remove vrouter-packet-relay
description:
  - This module can be used to add packet relay configuration for DHCP on vrouter
    and remove packet relay configuration for DHCP on vrouter.
options:
  pn_cliswitch:
    description:
      - Target switch to run the CLI on.
    required: false
    type: str
  state:
    description:
      - vrouter-packet-relay configuration command.
    required: false
    choices: ['present', 'absent']
    type: str
    default: 'present'
  pn_forward_ip:
    description:
      - forwarding IP address.
    required: true
    type: str
  pn_nic:
    description:
      - NIC.
    required: true
    type: str
  pn_forward_proto:
    description:
      - protocol type to forward packets.
    required: false
    type: str
    choices: ['dhcp']
    default: 'dhcp'
  pn_vrouter_name:
    description:
      - name of service config.
    required: true
    type: str
s
- name: vRouter packet relay add
  pn_vrouter_packet_relay:
    pn_cliswitch: "sw01"
    pn_forward_ip: "192.168.10.1"
    pn_nic: "eth0.4092"
    pn_vrouter_name: "sw01-vrouter"

- name: vRouter packet relay remove
  pn_vrouter_packet_relay:
    pn_cliswitch: "sw01"
    state: "absent"
    pn_forward_ip: "192.168.10.1"
    pn_nic: "eth0.4092"
    pn_vrouter_name: "sw01-vrouter"
s�
command:
  description: the CLI command run on the target node.
  returned: always
  type: str
stdout:
  description: set of responses from the vrouter-packet-relay command.
  returned: always
  type: list
stderr:
  description: set of error responses from the vrouter-packet-relay 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|}t||�d}|r�|j�}n||kr�tnt}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.

    If nic_str exists on the given vRouter, return NIC_EXISTS as True else
    False.

    :param module: The Ansible module to fetch input parameters
    :param cli: The CLI string
    :return Booleans: VROUTER_EXISTS, NIC_EXISTS
    tpn_vrouter_nametpn_nics(vrouter-show format name no-show-headersisAvrouter-interface-show vrouter-name %s format nic no-show-headers(tparamsRtsplittTruetFalse(	tmoduletclitvrouter_nametnic_strt
check_vroutertouttVROUTER_EXISTStshowt
NIC_EXISTS((s\/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_packet_relay.pyt	check_clies


c
C`s5tdddd�}tdtdtdd�d	tdtddd
|j�dd�dtdtdd�d
tdtdd�dtdtddd
dgdd�dtdtdd��}td|dd	dddd
dggd	dddd
dggf�}|jd}|jd	}|jd}|jd
}|jd}|jd}||}	t||�}
t||
�\}}|tkr�|jdtdd|�n|tkr�|jdtdd|�n|	dks�|	dkr!|
d|	7}
|
d||f7}
|
d||f7}
nt	||
|�dS(s' This section is for arguments parsing tpresentsvrouter-packet-relay-addtabsentsvrouter-packet-relay-removetpn_cliswitchtrequiredttypetstrtstatetchoicestdefaultt
pn_forward_ipR
tpn_forward_prototdhcpRt
argument_spectrequired_iftfailedtmsgsvRouter %s does not exists"vRouter with nic %s does not exists %ss vrouter-name %s nic %ss forward-proto %s forward-ip %sN(
tdictRtkeysRRRR	Rt	fail_jsonR
(
t	state_mapR(Rt	cliswitchR"t
forward_iptnict
forward_protoRtcommandRRR((s\/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_packet_relay.pytmain�sH	'$!






		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.netvisorRRR5t__name__(((s\/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_vrouter_packet_relay.pyt<module>s


/	&	<

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