Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZddlmZddlmZmZddlmZmZddlmZddlmZmZd�Zdd�Z!d�Z"dd�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*e+d kre*�ndS(!i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiont
deprecatedtstatustnetworktsupported_bys�	
---
module: ios_interface
version_added: "2.4"
author: "Ganesh Nalawade (@ganeshrn)"
short_description: Manage Interface on Cisco IOS network devices
description:
  - This module provides declarative management of Interfaces
    on Cisco IOS network devices.
deprecated:
  removed_in: '2.13'
  alternative: ios_interfaces
  why: Newer and updated modules released with more functionality in Ansible 2.9
notes:
  - Tested against IOS 15.6
options:
  name:
    description:
      - Name of the Interface.
    required: true
  description:
    description:
      - Description of Interface.
  enabled:
    description:
      - Interface link status.
    type: bool
  speed:
    description:
      - Interface link speed.
  mtu:
    description:
      - Maximum size of transmit packet.
  duplex:
    description:
      - Interface link status
    default: auto
    choices: ['full', 'half', 'auto']
  tx_rate:
    description:
      - Transmit rate in bits per second (bps).
      - This is state check parameter only.
      - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html)
  rx_rate:
    description:
      - Receiver rate in bits per second (bps).
      - This is state check parameter only.
      - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html)
  neighbors:
    description:
      - Check the operational state of given interface C(name) for CDP/LLDP neighbor.
      - The following suboptions are available.
    suboptions:
        host:
          description:
            - "CDP/LLDP neighbor host for given interface C(name)."
        port:
          description:
            - "CDP/LLDP neighbor port to which given interface C(name) is connected."
  aggregate:
    description: List of Interfaces definitions.
  delay:
    description:
      - Time in seconds to wait before checking for the operational state on remote
        device. This wait is applicable for operational state argument which are
        I(state) with values C(up)/C(down), I(tx_rate) and I(rx_rate).
    default: 10
  state:
    description:
      - State of the Interface configuration, C(up) means present and
        operationally up and C(down) means present and operationally C(down)
    default: present
    choices: ['present', 'absent', 'up', 'down']
extends_documentation_fragment: ios
s�
- name: configure interface
  ios_interface:
      name: GigabitEthernet0/2
      description: test-interface
      speed: 100
      duplex: half
      mtu: 512

- name: remove interface
  ios_interface:
    name: Loopback9
    state: absent

- name: make interface up
  ios_interface:
    name: GigabitEthernet0/2
    enabled: True

- name: make interface down
  ios_interface:
    name: GigabitEthernet0/2
    enabled: False

- name: Check intent arguments
  ios_interface:
    name: GigabitEthernet0/2
    state: up
    tx_rate: ge(0)
    rx_rate: le(0)

- name: Check neighbors intent arguments
  ios_interface:
    name: Gi0/0
    neighbors:
    - port: eth0
      host: netdev

- name: Config + intent
  ios_interface:
    name: GigabitEthernet0/2
    enabled: False
    state: down

- name: Add interface using aggregate
  ios_interface:
    aggregate:
    - { name: GigabitEthernet0/1, mtu: 256, description: test-interface-1 }
    - { name: GigabitEthernet0/2, mtu: 516, description: test-interface-2 }
    duplex: full
    speed: 100
    state: present

- name: Delete interface using aggregate
  ios_interface:
    aggregate:
    - name: Loopback9
    - name: Loopback10
    state: absent
s*
commands:
  description: The list of configuration mode commands to send to the device.
  returned: always, except for the platforms that use Netconf transport to manage the device.
  type: list
  sample:
  - interface GigabitEthernet0/2
  - description test-interface
  - duplex half
  - mtu 512
N(tdeepcopy(tsleep(tto_text(t
AnsibleModule(texec_command(t
get_configtload_config(tios_argument_spect
check_args(t
NetworkConfig(tconditionaltremove_default_speccC`s@|r<dt|�ko#dknr<|jdd�ndS(Ni@i�%tmsgsmtu must be between 64 and 9600(tintt	fail_json(tvaluetmodule((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytvalidate_mtu�s)cC`sh|dkr|j}nxI|D]A}t�jd|�}t|�r||j|�|�qqWdS(Nsvalidate_%s(tNonetparamstglobalstgettcallable(Rtobjtparamtkeyt	validator((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytvalidate_param_values�s
cC`sJ|d|}dj|j�}tjd|tj�}|rBtStSdS(Nsinterface %ss
s	^shutdown(tjointchildrentretsearchtMtTruetFalse(t	configobjtnametcfgtmatch((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytparse_shutdown�scC`sS|d|}dj|j�}tjd||tj�}|rO|jd�SdS(Nsinterface %ss
s%s (.+)$i(R$R%R&R'R(tgroup(R+R,targR-R.((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytparse_config_argument�s
cC`s)x"|D]}|d|kr|SqWdS(NR,(R(R,tlstto((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytsearch_obj_in_list�s
cC`s-||kr|j|�n|j|�dS(N(tappend(t	interfacetcmdtcommands((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytadd_command_to_interface�scC`s�t|�}tddd|�}tjd|tj�}|sFt�St�}x�t|�D]�}i|d6t||d�d6t||d�d6t||d�d6t||d	�d	6t||�r�t	nt
d
6dd6}|j|�q\W|S(
Ntindentitcontentss^interface (\S+)R,tdescriptiontspeedtduplextmtutdisabletpresenttstate(R
RR&tfindallR(tlisttsetR2R/R)R*R6(RtconfigR+R.t	instancestitemR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytmap_config_to_obj�s"	
cC`s�g}|jjd�}|r�xy|D]�}x7|D]/}|j|�dkr2|j|||<q2q2Wt|||�|j�}|dr�t|d<n
t|d<|j|�q%Wn�i
|jdd6|jdd6|jdd6|jdd6|jdd6|jd	d	6|jd
d
6|jdd6|jdd6|jd
d
6}t||�|jdry|jitd6�n|jitd6�|j|�|S(Nt	aggregatetenabledRAR,R=R>R@R?RCtdelayttx_ratetrx_ratet	neighbors(	RRRR#tcopyR*R)R6tupdate(RRRKRIR!tdR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytmap_params_to_obj�s<







cC`s�t�}|\}}d}x�|D]�}|d}|d}|d}t||�}	d|}
|d	kr�|	r�|jd
|
�q"|dkr"|	r]xh|D]`}|j|�}|	j|�}
||
kr�|r�|dt|�}t|
||�q�q�q�W|r.|	jdt�r.t|
d|�q�|r�|	jdt�r�t|
d|�q�q�|j|
�xA|D]9}|j|�}|rq|j|dt|��qqqqW|r�|jd�q�q"q"W|S(NR>R=R?R@R,RARCs
interface tabsentsno RBtuptdownt tshutdownsno shutdown(sspeedsdescriptionsduplexsmtu(spresentRVRW(RER5R6RtstrR:R*(tupdatesR9twantthavetargstwR,RARCtobj_in_haveR7RIt	candidatetrunningR8R((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytmap_obj_to_commands$s@	







"cC`s�g}d}d}x�|D]�}|jd�}|jd�}|jd�}	|jd�}
|d(kr�|r�|	r�|
r�qn|dr�t|d�nd	|d
}t||�\}}
}|dkr�|jdt|d
d�d|d|�n|d)kr}tjdd|
tj�}d}|r@|j	d�}n|dksbt
||j��r}|jdd|�q}n|r�tjd*|
tj�}d}|r�|j	d�}n|dks�t
||j�dt
�r�|jd|�q�n|	rstjd+|
tj�}d}|r4|j	d�}n|dks\t
|	|j�dt
�rs|jd|	�qsn|
rg}g}|dkr�t|d�\}}}|dkr�|jdt|d
d�d|d|�q�n|r�|j�jd�}x�|D]�}|jd�}|dj�|d
krxu|D]j}|jd�rs|j|jd �dj��n|jd!�r;|j|jd �dj��q;q;WqqWn|dkrt|d"�\}}}|dkr|jdt|d
d�d|d|�qn|rytjd#|tj�}xG|D]<\}}}||d
kr6|j|�|j|�q6q6Wnx{|
D]p}|jd$�}|jd%�}|r�||kr�|jd&|�n|r�||kr�|jd'|�q�q�WqqW|S(,NRCRNRORPRVRWtchangedRMsshow interfaces %sR,iRterrorstsurrogate_then_replacetcommandtrcs%s (\w+)sline protocol isisstate seq(%s)s%s (\d+)soutput ratetcaststx_rate s
input ratesrx_rate sshow lldp neighbors detailsLocal Intf: s
sSystem Name:t:sPort Description:sshow cdp neighbors detailsFDevice ID: (.*?)
.*?Interface: (.*?),  Port ID .outgoing port.: (.*?)
thosttportshost sport (supsdown(supsdownsoutput rate (\d+)sinput rate (\d+)(RRR	RRR
R&R'R(R0RtstripR6Rtsplitt
startswithRDtS(RR\tresulttfailed_conditionsthave_neighbors_lldpthave_neighbors_cdpR_t
want_statetwant_tx_ratetwant_rx_ratetwant_neighborsRgRhtoutterrR.t
have_statethave_tx_ratethave_rx_ratet	have_hostt	have_porttlinestlinetfieldRIt
neighbors_cdpRktlocaliftremoteifRl((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytcheck_declarative_intent_paramsNs�
!
+"((.

#1.

cC`s\tdt�dt��}tdt�dt�dt�dt�dtdd	d
dg�dtd
tdd�dt�dt�dtddddd|�dtd
ddd�dtd
ddddddg��}t|�}tdt�|d<t|�td tddddd|��}|j|�|jt�dd gg}dd gg}td!|d"|d#|d$t�}t�}t||�it	d%6}|r�||d&<nt
|�}	t|�}
t|	|
f�}||d'<|r|j
st||�nt|d%<nt||	|�}|rKd(}
|jd)|
d*|�n|j|�d+S(,s+ main entry point for module execution
    RkRlR,R=R>R@R?tchoicestfullthalftautoRLtdefaultttypetboolRNRORPREtelementstdicttoptionsRMi
RRCRBRURVRWtrequiredRKt
argument_spectrequired_one_oftmutually_exclusivetsupports_check_modeRdtwarningsR9s:One or more conditional statements have not been satisfiedRRrN(R�R)RRRRRRRERR*RTRJRct
check_modeRR�Rt	exit_json(tneighbors_spectelement_spectaggregate_specR�R�R�RR�RqR\R]R9RrR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pytmain�s^							


		



	
t__main__(,t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR&RQRttimeR	tansible.module_utils._textR
tansible.module_utils.basicRtansible.module_utils.connectionRt$ansible.module_utils.network.ios.iosR
RRRt*ansible.module_utils.network.common.configRt)ansible.module_utils.network.common.utilsRRRRR#R/R2R5R:RJRTRcR�R�t__name__(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/ios/_ios_interface.pyt<module>s<


M=	
	
				+	*	[	F

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