Anons79 Mini Shell

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

�
�Udac@sLidd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZmZd	dlm	Z	m
Z
d	d
lmZidd6dd6dd6dd6dd6dd6dd6dd6Z
idd6dd6d d6d!d6d!d6ed6d"d6Zd#�Zd$�Zd%�Zd&�Zd'�Zd(�Zd)�Zed*krHe�nd
S(+s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys*
---
module: nxos_vpc
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages global VPC configuration
description:
  - Manages global VPC configuration
author:
  - Jason Edelman (@jedelman8)
  - Gabriele Gerbino (@GGabriele)
notes:
  - Tested against NXOSv 7.3.(0)D1(1) on VIRL
  - The feature vpc must be enabled before this module can be used
  - If not using management vrf, vrf must be globally on the device
    before using in the pkl config
  - Although source IP isn't required on the command line it is
    required when using this module.  The PKL VRF must also be configured
    prior to using this module.
  - Both pkl_src and pkl_dest are needed when changing PKL VRF.
options:
  domain:
    description:
      - VPC domain
    required: true
  role_priority:
    description:
      - Role priority for device. Remember lower is better.
  system_priority:
    description:
      - System priority device.  Remember they must match between peers.
  pkl_src:
    description:
      - Source IP address used for peer keepalive link
  pkl_dest:
    description:
      - Destination (remote) IP address used for peer keepalive link
      - pkl_dest is required whenever pkl options are used.
  pkl_vrf:
    description:
      - VRF used for peer keepalive link
      - The VRF must exist on the device before using pkl_vrf.
      - "(Note) 'default' is an overloaded term: Default vrf context for pkl_vrf is 'management'; 'pkl_vrf: default' refers to the literal 'default' rib."
    default: management
  peer_gw:
    description:
      - Enables/Disables peer gateway
    type: bool
  # TBD: no support for peer_gw_exclude_gw
  # peer_gw_exclude_gw:
  #   description:
  #     - Range of VLANs to be excluded from peer-gateway
  #   type: str
  auto_recovery:
    description:
      - Enables/Disables auto recovery on platforms that support disable
      - timers are not modifiable with this attribute
      - mutually exclusive with auto_recovery_reload_delay
    type: bool
  auto_recovery_reload_delay:
    description:
      - Manages auto-recovery reload-delay timer in seconds
      - mutually exclusive with auto_recovery
    type: str
    version_added: "2.9"
  delay_restore:
    description:
      - manages delay restore command and config value in seconds
    type: str
  delay_restore_interface_vlan:
    description:
      - manages delay restore interface-vlan command and config value in seconds
      - not supported on all platforms
    type: str
    version_added: "2.9"
  delay_restore_orphan_port:
    description:
      - manages delay restore orphan-port command and config value in seconds
      - not supported on all platforms
    type: str
    version_added: "2.9"
  state:
    description:
      - Manages desired state of the resource
    required: true
    choices: ['present','absent']
s�
- name: configure a simple asn
  nxos_vpc:
    domain: 100
    role_priority: 1000
    system_priority: 2000
    pkl_dest: 192.168.100.4
    pkl_src: 10.1.100.20
    peer_gw: true
    auto_recovery: true

- name: configure
  nxos_vpc:
    domain: 100
    role_priority: 32667
    system_priority: 2000
    peer_gw: true
    pkl_src: 10.1.100.2
    pkl_dest: 192.168.100.4
    auto_recovery: true

- name: Configure VPC with delay restore and existing keepalive VRF
  nxos_vpc:
    domain: 10
    role_priority: 28672
    system_priority: 2000
    delay_restore: 180
    peer_gw: true
    pkl_src: 1.1.1.2
    pkl_dest: 1.1.1.1
    pkl_vrf: vpckeepalive
    auto_recovery: true
s
commands:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["vpc domain 100",
            "peer-keepalive destination 192.168.100.4 source 10.1.100.20 vrf management",
            "auto-recovery", "peer-gateway"]
i����N(t
get_configtload_configtrun_commands(tnxos_argument_spect
check_args(t
AnsibleModulesrole priority {role_priority}t
role_prioritys!system-priority {system_priority}tsystem_prioritysdelay restore {delay_restore}t
delay_restores;delay restore interface-vlan {delay_restore_interface_vlan}tdelay_restore_interface_vlans5delay restore orphan-port {delay_restore_orphan_port}tdelay_restore_orphan_ports{peer_gw} peer-gatewaytpeer_gws{auto_recovery} auto-recoveryt
auto_recoverys7auto-recovery reload-delay {auto_recovery_reload_delay}tauto_recovery_reload_delayt60t10t0t32667i�cCsGg}x:|D]2}t|t�r2|j|�q
|j|�q
W|S(N(t
isinstancetlisttextendtappend(t
command_liststflat_command_listtcommand((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pytflatten_list�s
cCs�y(t|dg�d}|dd}Wnttfk
rBgSXg}|r�x.|D]#}|jt|dj���qVWn|S(Nsshow vrf all | jsonit	TABLE_vrftROW_vrftvrf_name(RtKeyErrortAttributeErrorRtstrtlower(tmoduletbodyt	vrf_tabletvrf_listteach((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pytget_vrf_list�s
$cCs�t}t|dg�d}|dddd}tjd|�rMt}nPtjd|�r�t|dg�d}|d	}tjd
|�r�t}q�n|S(Nsshow inventory | jsonit	TABLE_invtROW_invt	productidtN7KtN9Ksshow hardware | jsontkickstart_ver_strs	7.0\(3\)F(tFalseRtretsearchtTrue(R&tautotdatatpidtver((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pytget_auto_recovery_default�s	
cCs�t|dg�d}|r/t|d�}n5t|dg�d}|r^|j�d}nd}i}|dkr�t|ddg�}|r�||d	<x'tj�D]}tj|�||<q�Wt|�|d
<|jd�}x�|D]�}d|kr|j�}|d
|d<nd|krC|j�}|d
|d<ntj	d|�rr|j�}|d
|d<nd|kr�|j�}|d
|d<nd|kr�|j�}|d
|d<nd|kr	d|kr�t
nt|d
<|j�}|d
|d<nd|kr4d|kr't
nt|d<nd|kr�tj	d|�}	|	r�xB|	j�j�D]+}
|	j
|
�rk|	j
|
�||
<qkqkWq�q�q�Wq�n|S(Nsshow vpc | jsonis
vpc-domain-idsshow run vpc | inc domainisnot configuredtflagssvpc alltdomainRs
s
role priorityi����Rssystem-priorityRsdelay restore \d+R
sdelay restore interface-vlanRsdelay restore orphan-portRs
auto-recoverysno Rspeer-gatewayRspeer-keepalive destinations^destination (?P<pkl_dest>[\d.]+)(?:.* source (?P<pkl_src>[\d.]+))*(?:.* vrf (?P<pkl_vrf>\S+))*(RR$tsplitRtPARAM_TO_DEFAULT_KEYMAPtkeystgetR:R3R4R2R5t	groupdicttgroup(R&R'R<tvpctruntkeytvpc_listR*tlinetmtpkl((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pytget_vpc�s\

		*cCs�g|j�D]}|jd�r
|^q
}x�|D]x}|jj|�}|j|�s5|r�|||kr�||||<q�|dkr�||r�||||<q�q5q5WdS(s�peer-keepalive dependency checking.
    1. 'destination' is required with all pkl configs.
    2. If delta has optional pkl keywords present, then all optional pkl
       keywords in existing must be added to delta, otherwise the device cli
       will remove those values when the new config string is issued.
    3. The desired behavior for this set of properties is to merge changes;
       therefore if an optional pkl property exists on the device but not
       in the playbook, then that existing property should be retained.
    Example:
      CLI:       peer-keepalive dest 10.1.1.1 source 10.1.1.2 vrf orange
      Playbook:  {pkl_dest: 10.1.1.1, pkl_vrf: blue}
      Result:    peer-keepalive dest 10.1.1.1 source 10.1.1.2 vrf blue
    RIN(R?t
startswithtparamsR@tNone(R&tdeltatexistingtitpkl_existingRItparam((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pytpkl_dependenciess.
c	Cs�t|�}|jd�}g}d|kr�dj|�}d|kr^|dj|�7}nd|kr�|dj|�7}n|j|�nd|kr�|jd�s�d	|d<q�d
|d<nd|kr�|jd�s�d	|d<q�d
|d<nxj|D]b}tj|�}|dk	r|j|�j�}d|krS|jd
�n|j|�qqW|ss|r�|jddj|��n|S(NR<tpkl_dests%peer-keepalive destination {pkl_dest}tpkl_srcs source {pkl_src}tpkl_vrfs vrf {pkl_vrf}RtnotRspeer-gatewaysterminal dont-askisvpc domain {0}(tdictR@tformatRtCONFIG_ARGSRMtstriptinsert(	R&RCR<ROtdomain_onlytcommandstpkl_commandRRR((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pytget_commands_to_config_vpc4s8




cCs�tdtdtdd�dtdtdd�dtdtdd�dtdt�dtdt�d	tdt�d
tdtdd�dtdtdd�d
tdtdd�dtdtdd�dtdtdd�dtdtdd�dtdddgdd��
}|jt�d(g}td|d|dt�}t�}t||�itd6|d6}|jd}|jd}|jd}|jd}|jd}	|jd	}
|jd
}|jd}|jd
}
|jd}|jd}|jd}|jd}td|d|d|d|d|	d	|
d
|d|d
|
d|d|d|�}|	s�|r�|j	dd�q�|
r�|
dkr�|j	dd�q�|j	dd�q�n|
r�|
j
�t|�kr�|j	dd �q�ntd!�|j�D��}t
|�}g}|dkr�i}xr|j�D]d\}}t|�j
�dkr�|d	kr�tj|�}n|j|�|kr>|||<q>q>W|rBt|||�t||||�}|j|�qBn^|dkrB|rB||dkr|j	dd"�q?|jd#�|jd$j|��qBnt|�}||d%<|r�t|d<|js�t||�d&|kr�|jd'�q�q�n|j|�dS()NR<trequiredttypeR$RRRURTRVRtboolRRR
RRtstatetchoicestabsenttpresenttdefaultt
argument_spectmutually_exclusivetsupports_check_modetchangedtwarningstmsgs=dest IP for peer-keepalive is required when src IP is presentt
managementsCdest and src IP for peer-keepalive are required when vrf is presents:dest IP for peer-keepalive is required when vrf is presentseThe VRF you are trying to use for the peer keepalive link is not on device yet. Add it first, please.css-|]#\}}|dk	r||fVqdS(N(RM(t.0tktv((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pys	<genexpr>�ssCYou are trying to remove a domain that does not exist on the devicesterminal dont-asksno vpc domain {0}R_t	configurei(RR(RYR5R2tupdateRR
RR	RLt	fail_jsonR%R+titemsRJR$R>R@RSRaRRZRt
check_modeRtpopt	exit_json(RjRkR&RntresultsR<RRRURTRVRRRR
RRRetargstproposedROR_RNREtvalueRtcmds((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pytmain[s�
			













	$


	
t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR3t&ansible.module_utils.network.nxos.nxosRRRRR	tansible.module_utils.basicR
R[R2R>RR+R:RJRSRaR�t__name__(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_vpc.pyt<module>sF


Y"


	
			7		'	k

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