%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/bridge.pyo

�
���^c@@sqdZddlmZmZmZddlZddlZddlZidd6Z	dddgZ
d	�Zd
�Zdd�Zd�Zd
�Zd�Zd�Zd�Zdd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zdd�Zd�Zdd�Z dd�Z!ddd�Z"ddd �Z#dd!dd"�Z$dS(#u8
Module for gathering and managing bridging information
i(tabsolute_importtprint_functiontunicode_literalsNulistulist_uFreeBSDuNetBSDuOpenBSDcC@spidd6dd6dd6dd6}td}x7|D]/}||kr3tjjj||�r3tSq3Wtd	fS(
uZ
    Confirm this module is supported by the OS and the system has
    required tools
    uifconfiguFreeBSDubrctluLinuxubrconfiguNetBSDuOpenBSDukernelu�The bridge execution module failed to load: requires one of the following tool/os combinations: ifconfig on FreeBSD/OpenBSD, brctl on Linux or brconfig on NetBSD.(t
__grains__tsalttutilstpathtwhichtTruetFalse(tsupported_os_tooltcur_ost_os((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt__virtual__s


%cC@stjjj|�S(u&
    Internal, returns tools path
    (RRRR(tostool((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
_tool_path(scC@s[td�}|r'dj||�}ndj|�}i}x�td|dt�j�D]�}|jd�rtqYn|j�}|s�qYnt|�dkr�|d}i|dd	6|d
d6||<t|�dkr�|dg||d
<q�nt|�dkrY|rY||d
j|d�qYqYW|rWy||SWqWt	k
rSdSXn|S(uO
    Internal, returns bridges and enslaved interfaces (GNU/Linux - brctl)
    ubrctlu{0} show {1}u{0} showucmd.runtpython_shellubridge nameiiuidiustpiu
interfacesN(Rtformatt__salt__R	t
splitlinest
startswithtsplittlentappendtKeyErrortNone(tbrtbrctltcmdtbrstlinetvalstbrname((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
_linux_brshow/s4#
 
cC@s,td�}tddj||�dt�S(u&
    Internal, creates the bridge
    ubrctlucmd.runu
{0} addbr {1}R(RRRR	(RR((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt_linux_bradd^scC@s,td�}tddj||�dt�S(u&
    Internal, deletes the bridge
    ubrctlucmd.runu
{0} delbr {1}R(RRRR	(RR((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt_linux_brdelgscC@s/td�}tddj|||�dt�S(u1
    Internal, adds an interface to a bridge
    ubrctlucmd.runu{0} addif {1} {2}R(RRRR	(RtifaceR((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt_linux_addifpscC@s/td�}tddj|||�dt�S(u6
    Internal, removes an interface from a bridge
    ubrctlucmd.runu{0} delif {1} {2}R(RRRR	(RR$R((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt_linux_delifyscC@s/td�}tddj|||�dt�S(u"
    Internal, sets STP state
    ubrctlucmd.runu{0} stp {1} {2}R(RRRR	(RtstateR((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
_linux_stp�scC@sVtddkrt|�Std�}i}|r?|||<n@dj|�}x.td|dt�j�D]}|||<qkWi}x�|D]�}dj||�}x�td|dt�j�D]{}igd6d	d
6||<|j�}|jd�r�||dj	|j
d�d
�d|kr<d||d
<q<q�q�Wq�W|rR||S|S(uN
    Internal, returns bridges and member interfaces (BSD-like: ifconfig)
    ukerneluNetBSDuifconfigu
{0} -g bridgeucmd.runRu{0} {1}u
interfacesunoustpumember:u iuSTPuyes(Rt_netbsd_brshowRRRR	RtlstripRRR(RtifconfigtifacesRRRR$((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt_bsd_brshow�s0

#
#"cC@sWtd�}|r'dj||�}ndj|�}i}t}x�td|dt�j�D]�}|jd�r�t}|jd�d}igd	6d
d6||<nd|kr�t}q_n|r_|r_tj	d
|�}|r%||d	j
|jd��d|kr"d||d<q"q%q_q_W|rSy||SWqStk
rOdSXn|S(uO
    Internal, returns bridges and enslaved interfaces (NetBSD - brconfig)
    ubrconfigu{0} {1}u{0} -aucmd.runRubridgeu:iu
interfacesunoustpuInterfaces:u\s*([a-z0-9]+)\s.*<.*>iuSTPuyesN(RRR	RRRRRtretmatchRtgroupRR(RtbrconfigRRt	start_intRR tm((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyR)�s8#
cC@s�td}td�}|s tStddj||�dt�dkrLtS|dkr�td�}tdd	j||�dt�dkr�tSntS(
u&
    Internal, creates the bridge
    ukerneluifconfigucmd.retcodeu{0} {1} create upRiuNetBSDubrconfigu
{0} {1} up(RRR	RRR(RtkernelR+R1((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
_bsd_bradd�s
cC@s6td�}|stStddj||�dt�S(u&
    Internal, deletes the bridge
    uifconfigucmd.runu{0} {1} destroyR(RR	RR(RR+((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
_bsd_brdel�s
cC@sutd}|dkr+td�}d}ntd�}d}|sK|rOtStddj||||�d	t�S(
u1
    Internal, adds an interface to a bridge
    ukerneluNetBSDubrconfiguadduifconfiguaddemucmd.runu{0} {1} {2} {3}R(RRR	RR(RR$R4Rtbrcmd((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
_bsd_addif�s
	cC@sutd}|dkr+td�}d}ntd�}d}|sK|rOtStddj||||�d	t�S(
u6
    Internal, removes an interface from a bridge
    ukerneluNetBSDubrconfigudeleteuifconfigudeletemucmd.runu{0} {1} {2} {3}R(RRR	RR(RR$R4RR7((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
_bsd_delifs
	cC@sitd}|dkr%td�}ntd�}|s?|rCtStddj||||�dt�S(ui
    Internal, sets STP state. On BSD-like, it is required to specify the
    STP physical interface
    ukerneluNetBSDubrconfiguifconfigucmd.runu{0} {1} {2} {3}R(RRR	RR(RR'R$R4R((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt_bsd_stp"s
cO@shtdtkrd}ntdj�}ttjtdj||��}t|�rd|||�SdS(u<
    Internal, dispatches functions by operating system
    ukernelubsdu_{0}_{1}N(	RtSUPPORTED_BSD_LIKEtlowertgetattrtsystmodulest__name__Rtcallable(tfunctargstkwargsR4t_os_func((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt_os_dispatch4s	"cC@s
td|�S(u%
    Returns bridges interfaces along with enslaved physical interfaces. If
    no interface is given, all bridges are shown, else only the specified
    bridge values are returned.

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.show
        salt '*' bridge.show br0
    ubrshow(RF(R((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytshowFs
cC@s>td�}|sdSg}x|D]}|j|�q#W|S(uv
    Returns the machine's bridges list

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.list
    ubrshowN(RFRR(RtbrlistR((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytlist_Vs

cC@s+|s
dStd|�}|r'|dSdS(u�
    Returns interfaces attached to a bridge

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.interfaces br0
    ubrshowu
interfacesN(RRF(Rtbr_ret((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt
interfacesjs

cG@s{td�}|sdSi}xX|D]P}xG|D]?}y%|||dkrZ|||<nWq0tk
rnq0Xq0Wq#W|S(u�
    Returns the bridge to which the interfaces are bond to

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.find_interfaces eth0 [eth1...]
    ubrshowu
interfacesN(RFRt	Exception(RCRtiflistR$R((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytfind_interfaces|s



cC@s
td|�S(ug
    Creates a bridge

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.add br0
    ubradd(RF(R((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytadd�s
cC@s
td|�S(uj
    Deletes a bridge

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.delete br0
    ubrdel(RF(R((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytdelete�s
cC@std||�S(u{
    Adds an interface to a bridge

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.addif br0 eth0
    uaddif(RF(RR$((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytaddif�s
cC@std||�S(u�
    Removes an interface from a bridge

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.delif br0 eth0
    udelif(RF(RR$((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytdelif�s
udisablecC@s}td}|dkr>idd6dd6}td|||�S|tkruidd6dd6}td||||�StSd	S(
u�
    Sets Spanning Tree Protocol state for a bridge

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.stp br0 enable
        salt '*' bridge.stp br0 disable

    For BSD-like operating systems, it is required to add the interface on
    which to enable the STP.

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.stp bridge0 enable fxp0
        salt '*' bridge.stp bridge0 disable fxp0
    ukerneluLinuxuonuenableuoffudisableustpu-stpN(RRFR;R	(RR'R$R4tstates((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pytstp�s
(%t__doc__t
__future__RRRR>R.tsalt.utils.pathRt__func_alias__R;R
RRR!R"R#R%R&R(R-R)R5R6R8R9R:RFRGRIRKRNRORPRQRRRT(((s7/usr/lib/python2.7/site-packages/salt/modules/bridge.pyt<module>s@
		/										&(								




Zerion Mini Shell 1.0