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_logging.pyc

�
�Udac@s>idd6dgd6dd6ZdZdZdZd	d
lZd	d
lZd	dlmZmZm	Z	m
Z
mZd	dlmZm
Z
mZd	d
lmZidd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6Zigd&6gd'6d(gd)6d*d+d,d-d.gd/6gd06d1gd26gd36gd46Zd5d6d7d8d9gZd:�Zd;�Zd<�Zd=�Zd>�Zd?�Zd@�ZdA�ZdB�ZdC�ZdD�ZdE�ZdF�Z dG�Z!dH�Z"dI�Z#dJ�Z$dK�Z%dL�Z&dM�Z'dN�Z(dO�Z)e*dPkr:e)�nd
S(Qs1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys

---
module: nxos_logging
version_added: "2.4"
author: "Trishna Guha (@trishnaguha)"
short_description: Manage logging on network devices
description:
  - This module provides declarative management of logging
    on Cisco NX-OS devices.
options:
  dest:
    description:
      - Destination of the logs.
    choices: ['console', 'logfile', 'module', 'monitor', 'server']
  remote_server:
    description:
      - Hostname or IP Address for remote logging (when dest is 'server').
    version_added: '2.7'
  use_vrf:
    description:
      - VRF to be used while configuring remote logging (when dest is 'server').
    version_added: '2.7'
  interface:
    description:
      - Interface to be used while configuring source-interface for logging (e.g., 'Ethernet1/2', 'mgmt0')
    version_added: '2.7'
  name:
    description:
      - If value of C(dest) is I(logfile) it indicates file-name.
  facility:
    description:
      - Facility name for logging.
  dest_level:
    description:
      - Set logging severity levels.
    aliases: ['level']
  facility_level:
    description:
      - Set logging severity levels for facility based log messages.
  aggregate:
    description: List of logging definitions.
  state:
    description:
      - State of the logging configuration.
    default: present
    choices: ['present', 'absent']
  event:
    description:
      - Link/trunk enable/default interface configuration logging
    choices: ['link-enable', 'link-default', 'trunk-enable', 'trunk-default']
    version_added: '2.8'
  interface_message:
    description:
      - Add interface description to interface syslogs.
        Does not work with version 6.0 images using nxapi as a transport.
    choices: ['add-interface-description']
    version_added: '2.8'
  file_size:
    description:
      - Set logfile size
    version_added: '2.8'
  facility_link_status:
    description:
      - Set logging facility ethpm link status.
        Not idempotent with version 6.0 images.
    choices: ['link-down-notif', 'link-down-error', 'link-up-notif', 'link-up-error']
    version_added: '2.8'
  timestamp:
    description:
      - Set logging timestamp format
    choices: ['microseconds', 'milliseconds', 'seconds']
    version_added: '2.8'
  purge:
    description:
      - Remove any switch logging configuration that does not match what has been configured
        Not supported for ansible_connection local.
        All nxos_logging tasks must use the same ansible_connection type.

    type: bool
    default: no
    version_added: '2.8'
extends_documentation_fragment: nxos
s6
- name: configure console logging with level
  nxos_logging:
    dest: console
    level: 2
    state: present
- name: remove console logging configuration
  nxos_logging:
    dest: console
    level: 2
    state: absent
- name: configure file logging with level
  nxos_logging:
    dest: logfile
    name: testfile
    dest_level: 3
    state: present
- name: Configure logging logfile with size
  nxos_logging:
    dest: logfile
    name: testfile
    dest_level: 3
    file_size: 16384
- name: configure facility level logging
  nxos_logging:
    facility: daemon
    facility_level: 0
    state: present
- name: remove facility level logging
  nxos_logging:
    facility: daemon
    facility_level: 0
    state: absent
- name: Configure Remote Logging
  nxos_logging:
    dest: server
    remote_server: test-syslogserver.com
    facility: auth
    facility_level: 1
    use_vrf: management
    state: present
- name: Configure Source Interface for Logging
  nxos_logging:
    interface: mgmt0
    state: present
- name: Purge nxos_logging configuration not managed by this playbook
  nxos_logging:
    purge: true
- name: Configure logging timestamp
  nxos_logging:
    timestamp: milliseconds
    state: present
- name: Configure logging facility ethpm link status
  nxos_logging:
    facility: ethpm
    facility_link_status: link-up-notif
    state: present
- name: Configure logging message ethernet description
  nxos_logging:
    interface_message: add-interface-description
    state: present
- name: Configure logging event link enable
  nxos_logging:
    event: link-enable
    state: present
- name: Configure logging using aggregate
  nxos_logging:
    aggregate:
      - { dest: console, dest_level: 2 }
      - { dest: logfile, dest_level: 2, name: testfile }
      - { facility: daemon, facility_level: 0 }
    state: present
s�
commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  type: list
  sample:
    - logging console 2
    - logging logfile testfile 3
    - logging level daemon 0
i����N(t
get_configtload_configtrun_commandstsave_module_contexttread_module_context(tnxos_argument_spect
check_argstnormalize_interface(t
AnsibleModules logging event link-status enableslink-enables!logging event link-status defaultslink-defaults!logging event trunk-status enablestrunk-enables"logging event trunk-status defaults
trunk-defaultslogging timestamp microsecondstmicrosecondsslogging timestamp millisecondstmillisecondsslogging timestamp secondstsecondss
link-up errors
link-up-errors
link-up notifs
link-up-notifslink-down errorslink-down-errorslink-down notifslink-down-notifs3logging message interface type ethernet descriptionsadd-interface-descriptioniitpktmgritadjmgrtarpticmpv6tl2ribtnetstackiitmribiiitconsoletlogfiletmoduletmonitortservercCs�t�}|\}}x�|D]�}|d}|d=|dkr1||kr1|ddk	r�|dr�|dr�|dtt|d�kr�|jdj|d|d��n|dr�|ddkr�|jdj|dt|d��q�n|d	dk	r|jd
�n|dd*krE|jdj|d��n|ddkrr|jdj|d��n|dr�|jd�n|dr�|dtkr�|jdt|d�n|dr�|dtkr�|jdt|d�n|dr1|dtkr1|jdt|d�q1n|dkr||kr|ddkr�|dr�|dd+kr�|jdj|d|d��q�|ddkr|dr�|jdj|d	|d|d��q�|jdj|d	|d��q�|ddkr�|drs|drO|jd j|d|d|d��q�|jd!j|d|d��q�|dr�|jd"j|d|d��q�|jd#j|d��q�q�n|dr|ddkr�|drO|dr$|jd$j|d|d|d|d��q�|jd%j|d|d|d��q|dr�|jd&j|d|d|d��q|jd'j|d|d��q|dr�|jd(j|dt|d��qt||d|d�s|jd(j|d|d��qn|drH|jd)jt|d���n|drz|dtkrz|jt|d�n|dr�|dtkr�|jt|d�n|dr�|dtkr�|jt|d�q�qqW|S(,Ntstatetabsenttfacilitytdesttfacility_link_statustfacility_levelsno logging level {0} {1}tethpmtnamesno logging logfileRRRsno logging {0}Rsno logging server {0}t
remote_servert	interfacesno logging source-interfaceteventsno tmessaget	timestamptpresentRslogging {0} {1}t
dest_levelt	file_sizes logging logfile {0} {1} size {2}slogging logfile {0} {1}tuse_vrfs"logging server {0} {1} use-vrf {2}slogging server {0} {1}slogging server {0} use-vrf {1}slogging server {0}s/logging server {0} {1} facility {2} use-vrf {3}s#logging server {0} {1} facility {2}s+logging server {0} facility {1} use-vrf {2}slogging server {0} facility {1}slogging level {0} {1}s logging source-interface {0} {1}(RsmoduleR(RR(	tlisttNonetDEFAULT_LOGGING_LEVELtinttappendtformatt
STATIC_CLItmatch_facility_defaulttsplit_interface(RtupdatestcommandstwantthavetwR((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytmap_obj_to_commands�s�	

4$+

$



#


&


#c	Cs�t}d}idj|�d6dd6}t||�}x~|djd�D]i}tj||�}|rLt|jd��t|�krLt|jd	��t|�krLt}qLqLW|S(
sC Check wanted facility to see if it matches current device default s\S+\s+(\d+)\s+(\d+)sshow logging level {0}tcommandttexttoutputis
ii(	tFalseR3RtsplittretsearchR1tgrouptTrue(	RRt
want_leveltmatches_defaulttregexltcmdt
facility_datatlinetmo((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pyR5As
H
cCs>tjd|tj�}|r:|jd�|jd�fSdS(Ns
(\D+)(\S*)ii(RBRCtMRD(R&tmatch((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pyR6YscCs]d}|dk	rYtjdj||�|tj�}|rY|d|jd�}qYn|S(Nslogging level {0} {1} (\S+)t-i(R/RBRCR3RMRD(RKRRR!RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_facility_link_status_s$cCsVd}tjdj|d�|tj�}|rR|jd�}|rR|}qRn|S(Nslogging event {0} (\S+)s-statusi(R/RBRCR3RMRD(RKR'RRNR((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_event_statusjs%cCsdd}tjd|tj�}|r`|jd�}|dkrHd}q`|dkr`d}q`n|S(Nslogging event (\S+)islink-statustlinkstrunk-statusttrunk(R/RBRCRMRD(RKR'RNR((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_eventvs	cCs1d}tjd|tj�}|r-d}n|S(Ns3logging message interface type ethernet descriptionsadd-interface-description(R/RBRCRM(RKR(RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pyt
parse_message�s
	cCs[d}tjdj||�|tj�}|rW|jd�}|dkrWd}qWn|S(Ns"logging logfile {0} {1} size (\S+)it8192(R/RBRCR3RMRD(RKR$tlevelR,RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_file_size�s$cCs:d}tjd|tj�}|r6|jd�}n|S(Nslogging timestamp (\S+)i(R/RBRCRMRD(RKR)RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_timestamp�s
cCsXd}|dk	rT|dkrTtjd|tj�}|rQ|jd�}qQqTn|S(NRslogging logfile (\S+)i(R/RBRCRMRD(RKR R$RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pyt
parse_name�scCsOd}|rK|dkrKtjd|tj�}|rK|jd�}qKn|S(NRslogging server (\S+)i(R/RBRCRMRD(RKR R%RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_remote_server�scCs�d}d�}|r�|dkr�|dkrftjdj|�|tj�}|r�||�}q�q�|dkr�tjd|tj�}|r�||�}q�q�tjdj|�|tj�}|r�||�}q�n|S(NcSsId}|rEt|jd��tdd�krE|jd�}qEn|S(Niii(R/R1RDtrange(RNRW((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_match�s$RRslogging logfile {0} (\S+)slogging server (?:\S+) (\d+)slogging {0} (\S+)(R/RBRCR3RM(RKR R$R+R]RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_dest_level�s		!!cCs�d}|dkrEtjd|tj�}|r�|jd�}q�nH|dk	r�tjdj|�|tj�}|r�|jd�}q�n|S(NRslogging server (?:\S+) (\d+)islogging level {0} (\S+)(R/RBRCRMRDR3(RKRR R"RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_facility_level�s!cCs:d}tjd|tj�}|r6|jd�}n|S(Ns<logging server (?:\S+) (?:\d+) (?:\S+) (?:\S+) (?:\S+) (\S+)i(R/RBRCRMRD(RKRRN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_facility�s
cCsOd}|rK|dkrKtjd|tj�}|rK|jd�}qKn|S(NRs,logging server (?:\S+) (?:\d+) use-vrf (\S+)i(R/RBRCRMRD(RKR R-RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pyt
parse_use_vrf�scCs:d}tjd|tj�}|r6|jd�}n|S(Nslogging source-interface (\S*)i(R/RBRCRMRD(RKR&RN((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytparse_interfaces
cCs&g}t|ddg�}x�|jd�D]�}tjd|tj�rRd}nd}tjd|tj�}|dkr+|r+d}d}d}d}	d}
d}d}d}
d}|jd�tkr]|jd�}	t||	�}t	||	�}t
||	|�}|	d	kr't|�}
nt||
|	�}|	d
kr7t
|||�}
q7n�|jd�dkr�tjd|tj�}|jd�}
t||
|	�}|j�r�|}q7t||
|�}nb|jd�d
kr7|dkr7t|�}|r+t||�}|r4|d|}q4q7q+n|ji
|	d6|d6t||	�d6|d6|
d6|d6|d6t|�d6|d6|d
6|
d6t|�d6t|�d6�q+q+Widd6dd6idd6dd6g}t||�}x'|D]}t}tjd t|�tj�}|r�|jd�d!krh|jd"�d#krhd$}t}q�|jd�d%kr�|jd"�d&kr�d'}t}q�n|r�|ji
|jd�d6dd6dd6dd6|d6dd6dd6dd6dd6dd
6dd6dd6dd6�q�q�W|S((Ntflagss all | section loggings
sno (\S+)RR*s
logging (\S+)iRRRWslogging level (\S+)R'ROR R%R-R$RR+R"R&R!R,R(R)s0show logging | section enabled | section consoleR=R>R?s0show logging | section enabled | section monitors3Logging (\w+):(?:\s+) (?:\w+) (?:\W)Severity: (\w+)Ritcriticalt2Rt
notificationst5(RRARBRCRMR/RDt
DEST_GROUPRZR[R^R`R_RXtisdigitRPRTRQR2RaRbRURYRR@tstrRE(RtobjtdataRKRRNtevent_statusR$R+R RR%R!R,R"tmatch_facilityRWR'RRItdefault_datatflag((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytmap_config_to_obj
s�		!


*	*c	Cs�g}d|jkr�|jdr�i
dd6dd6dd6dd6dd6dd6dd	6dd
6dd6dd6dd
6dd6dd6}xZ|jdD]�}|j�}x'|D]}||kr�d||<q�q�W|ddk	r�t|d�|d<n|d	dk	rt|d	�|d	<n|d
r<t|d
�|d
<nd|kr\|jd|d<n|d
r}t|d
�|d
<n|j|�q�WnOd}d}d}|jddk	r�t|jd�}n|jd	dk	r�t|jd	�}n|jd
dk	rt|jd
�}n|ji|jdd6|jdd6|jdd6|jdd6|jdd6|d6|d	6t|jd
�d
6|jdd6|jdd6|jdd6|jdd6|d
6|jdd6�|S(Nt	aggregatetR R%R-R$RR+R"R&R!R'R,R(R)Rtinterface_message(tparamsR/tcopyRjRR2(	RRktargstctdtkeyR+R"R,((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytmap_params_to_objusp




	cCs�|st�}nxu|D]m}tj|�}|d}|d=|dkrj||kr�|j|�q�q||kr|j|�qqW|S(NRR(R.RvtremoveR2(twantsR9R;R((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytmerge_wants�s

cCsd|d<|S(NRR((th((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pyR�s
cCsDt|�}g|D]-}||kp1|j|�st|�^qS(N(R.R2R(thavesR}R((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytoutliers�sc
%Cs�tdtdt�dt�dt�dt�dt�dtdd	d
dg�dtdd	�d
t�dtdddddg�dtdddddg�dtddg�dtdd	�dtddddg�dtd d!dd!d"g�d#tdd$�d%td tdd&��}|jt�dd'dgfdd(dgfg}td)|d*|d+t�}t�}t||�itd,6}|r�||d-<nt	|�}t
t|�|�}t|�}t
|||f�}||d.<|r|jst||�nt|d,<nt||�|jjd%�r�t
|t||�|f�}	|	r}|jspt||	�nt|d,<n|d.c|	7<n|j|�d/S(0s+ main entry point for module execution
    R tchoicesR$RR%R-R+ttypeR1taliasesRWR"R&R!slink-down-notifslink-down-errors
link-up-notifs
link-up-errorR'slink-enableslink-defaultstrunk-enables
trunk-defaultRtsadd-interface-descriptionR,R)RRRRtdefaultR*RRrR.tpurgetboolRRt
argument_spectrequired_iftsupports_check_modetchangedtwarningsR8N(tdictRhR@tupdateR
R
RER.RR{R~R	RqR<t
check_modeRRRutgetR�t	exit_json(
R�R�RR�tresultR9tmerged_wantsR:R8t	pcommands((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pytmain�s\					
		



	

	
t__main__(+tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRBRvt&ansible.module_utils.network.nxos.nxosRRRRR	R
RRtansible.module_utils.basicR
R4R0RhR<R5R6RPRQRTRURXRYRZR[R^R_R`RaRbRqR{R~RR�R�t__name__(((sM/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_logging.pyt<module>sn


TJ(





	k						
		
					
		
	k	K				?

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