%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/netbox.pyc

�
���^c@@sOdZddlmZmZmZddlZddlZddlmZy&ddl	Z	ddl
mZeZ
Wnek
r�eZ
nXeje�Zd2Zidd6d	d
6Zd�Zd�Zed
�Zd�Zd�Zd�Zd�Zded�Zd�Zd�Zdd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'ddddd�Z(d�Z)d �Z*dd!�Z+dd"�Z,dd#�Z-ddddddd$�Z.d%�Z/d&�Z0d'�Z1d(�Z2dd)�Z3ddd*�Z4d+�Z5dd,�Z6dd-�Z7d.�Z8dd/�Z9dd0d1�Z:dS(3u�
NetBox
======

Module to query NetBox

:codeauthor: Zach Moody <zmoody@do.co>
:maturity:   new
:depends:    pynetbox

The following config should be in the minion config file. In order to
work with ``secrets`` you should provide a token and path to your
private key file:

.. code-block:: yaml

  netbox:
    url: <NETBOX_URL>
    token: <NETBOX_USERNAME_API_TOKEN (OPTIONAL)>
    keyfile: </PATH/TO/NETBOX/KEY (OPTIONAL)>

.. versionadded:: 2018.3.0
i(tabsolute_importtunicode_literalstprint_functionN(tCommandExecutionError(tRequestErrorusecretsufilterufilter_ugetuget_cC@ststdfStSdS(u%
    pynetbox must be installed.
    uPThe netbox execution module cannot be loaded: pynetbox library is not installed.N(tHAS_PYNETBOXtFalsetTrue(((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt__virtual__3scC@s)tdd�}|s%td��n|S(Nu
config.getunetboxu8NetBox execution module configuration could not be found(t__salt__R(tconfig((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt_configAs
cC@sWi}t�jd�|d<|r;t�jd�|d<ntjt�jd�|�S(Nutokenukeyfileuprivate_key_fileuurl(Rtgettpynetboxtapi(t
auth_requiredtpynb_kwargs((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt_nb_objJs
cC@sYd|j�kr|d=nx6|j�D](\}}t|t�r)t|�q)q)W|S(Nuurl(tkeystitemst
isinstancetdictt_strip_url_field(t
input_dicttktv((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyRRs
cC@s|rt|�SiSdS(N(R(titerable((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt_dict[s
cC@sxtdt�}y#tt||�|�j|�SWn?tk
rs}tjdj|jj	j
|j|j��tSXdS(u
    POST a payload
    Ru
{}, {}, {}N(
RRtgetattrtcreateRtlogterrortformattreqtrequesttheaderstrequest_bodyR(tapptendpointtpayloadtnbte((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt_addbs#+cC@s4tjdd|�j�j�}tjdd|�S(u�'
    Slugify given value.
    Credit to Djangoproject https://docs.djangoproject.com/en/2.0/_modules/django/utils/text/#slugify
    u[^\w\s-]uu[-\s]+u-(tretsubtstriptlower(tvalue((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytslugifyns!cK@sntd|�}|r9tt||�|�j|�}n1td|�}tt||�|�j|�}|S(u�
    Helper function to do a GET request to Netbox.
    Returns the actual pynetbox object, which allows manipulation from other functions.
    Ruargs.clean_kwargs(RRRt	__utils__(R%R&tidRtkwargsR(titem((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt_getws$!cC@s/|jd�}t|�dkr%|S|dfS(Nu.iu0(tsplittlen(tif_namet
if_name_split((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt
_if_name_unit�scK@s�g}td|tkrtnt�}tt||�|�jtd|��}|r�g|D]}tt|��^q_}nt	|�S(uH
    Get a list of items from NetBox.

    app
        String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam``
    endpoint
        String of app endpoint, e.g., ``sites``, ``regions``, ``devices``
    kwargs
        Optional arguments that can be used to filter.
        All filter keywords are available in Netbox,
        which can be found by surfing to the corresponding API endpoint,
        and clicking Filters. e.g., ``role=router``

    Returns a list of dictionaries

    .. code-block:: bash

        salt myminion netbox.filter dcim devices status=1 role=router
    Ruargs.clean_kwargs(
RtAUTH_ENDPOINTSRRRtfilterR1RRtsorted(R%R&R3tretR(tnb_queryti((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytfilter_�s!(c	K@s4tt||d|d|tkr'tnt|��S(u
    Get a single item from NetBox.

    app
        String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam``
    endpoint
        String of app endpoint, e.g., ``sites``, ``regions``, ``devices``

    Returns a single dictionary

    To get an item based on ID.

    .. code-block:: bash

        salt myminion netbox.get dcim devices id=123

    Or using named arguments that correspond with accepted filters on
    the NetBox endpoint.

    .. code-block:: bash

        salt myminion netbox.get dcim devices name=my-router
    R2R(RR5R;RR(R%R&R2R3((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytget_�scC@sktddd|�}|rtSi|d6t|�d6}tdd|�}|rcii|d6d6StSdS(u�
    .. versionadded:: 2019.2.0

    Create a device manufacturer.

    name
        The name of the manufacturer, e.g., ``Juniper``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_manufacturer Juniper
    udcimu
manufacturerstnameunameuslugN(RBRR0R*(RCtnb_manR'tman((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_manufacturer�scC@s�tddd|�}|rtStddd|�}d
}|sOt|�}ni|d6|dd6t|�d	6}tdd|�}ii|d6d6}|r�|dj|d�n|r�|StSd
S(um
    .. versionadded:: 2019.2.0

    Create a device type. If the manufacturer doesn't exist, create a new manufacturer.

    model
        String of device model, e.g., ``MX480``
    manufacturer
        String of device manufacturer, e.g., ``Juniper``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_device_type MX480 Juniper
    udcimudevice-typestmodelu
manufacturersRCumodeluidumanufactureruslugN(RBRtNoneRFR0R*tupdate(RGtmanufacturertnb_typeRDtnew_manR'ttyptret_dict((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_device_type�s%cC@srtddd|�}|rtSi|d6t|�d6|d6}tdd|�}|rjii|d6d6StSdS(u�
    .. versionadded:: 2019.2.0

    Create a device role

    role
        String of device role, e.g., ``router``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_device_role router
    udcimudevice-rolesRCunameuslugucolorN(RBRR0R*(troletcolortnb_roleR'((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_device_roles!cC@sqtdddt|��}|r%tSi|d6t|�d6}tdd|�}|riii|d6d6StSdS(u�
    .. versionadded:: 2019.2.0

    Create a new device platform

    platform
        String of device platform, e.g., ``junos``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_platform junos
    udcimu	platformstslugunameuslugN(RBR0RR*(tplatformtnb_platformR'tplat((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_platformscC@sktddd|�}|rtSi|d6t|�d6}tdd|�}|rcii|d6d6StSdS(u�
    .. versionadded:: 2019.2.0

    Create a new device site

    site
        String of device site, e.g., ``BRU``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_site BRU
    udcimusitesRCunameuslugN(RBRR0R*(tsitetnb_siteR'((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_site9scC@s+yutddd|�}|s"tStddd|�}|sAtStddd|�}|s`tSidd6d	d
6}Wn?tk
r�}	tjdj|	jjj|	j	|	j��tSXi|d6|d
6t
|�d6|dd6|dd6|dd6}
tdd|
�}|r#ii|
d6d6StSdS(uU
    .. versionadded:: 2019.2.0

    Create a new device with a name, role, model, manufacturer and site.
    All these components need to be already in Netbox.

    name
        The name of the device, e.g., ``edge_router``
    role
        String of device role, e.g., ``router``
    model
        String of device model, e.g., ``MX480``
    manufacturer
        String of device manufacturer, e.g., ``Juniper``
    site
        String of device site, e.g., ``BRU``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_device edge_router router MX480 Juniper BRU
    udcimudevice-rolesRCudevice-typesRGusitesuActiveulabeliuvalueu
{}, {}, {}unameudisplay_nameusluguidudevice_typeudevice_roleusiteudevicesN(RBRRRRR R!R"R#R$R0R*(RCRPRGRJRYRRRKRZtstatusR)R'tnew_dev((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt
create_deviceTs(+)cK@s�td|�}tdddtd|�}x*|j�D]\}}t|||�q8Wy |j�ii|d6d6SWn?tk
r�}tjdj	|j
jj|j
|j��tSXdS(ud
    .. versionadded:: 2019.2.0

    Add attributes to an existing device, identified by name.

    name
        The name of the device, e.g., ``edge_router``
    kwargs
       Arguments to change in device, e.g., ``serial=JN2932930``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.update_device edge_router serial=JN2932920
    uargs.clean_kwargsudcimudevicesRRCu
{}, {}, {}N(R1R5RRtsetattrtsaveRRRR R!R"R#R$R(RCR3t	nb_deviceRRR)((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt
update_device�s
+uc
C@s�tddd|�}|stS|retddd|�}|set|�tddd|�}qeni|dd6|d6|d6|d	6|d
6dd6}|r�|d|d<ntdd
|�}	|	r�ii|d
6d6S|	SdS(u�
    .. versionadded:: 2019.2.0

    Add an inventory item to an existing device.

    device_name
        The name of the device, e.g., ``edge_router``.
    item_name
        String of inventory item name, e.g., ``Transceiver``.

    manufacturer_name
        String of inventory item manufacturer, e.g., ``Fiberstore``.

    serial
        String of inventory item serial, e.g., ``FS1238931``.

    part_id
        String of inventory item part id, e.g., ``740-01234``.

    description
        String of inventory item description, e.g., ``SFP+-10G-LR``.

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_inventory_item edge_router Transceiver part_id=740-01234
    udcimudevicesRCu
manufacturersuidudeviceunameudescriptionuserialupart_iduparentumanufactureruinventory-itemsN(RBRRFRHR*(
tdevice_namet	item_nametmanufacturer_nametserialtpart_idtdescriptionRaRDR'tdone((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_inventory_item�s "
#cC@s>tdddtd|�}|j�iii|d6d6d6S(u
    .. versionadded:: 2019.2.0

    Remove an item from a devices inventory. Identified by the netbox id

    item_id
        Integer of item to be deleted

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.delete_inventory_item 1354
    udcimuinventory-itemsRR2uDELETE(R5Rtdelete(titem_idtnb_inventory_item((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytdelete_inventory_item�s
cC@sQi|d6|d6}tdd|�}|rIiii||d6d6d6S|SdS(u,
    .. versionadded:: 2019.2.0

    Create an interface connection between 2 interfaces

    interface_a
        Interface id for Side A
    interface_b
        Interface id for Side B

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_interface_connection 123 456
    uinterface_auinterface_budcimuinterface-connectionsuidN(R*(tinterface_atinterface_bR'R>((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_interface_connection�s

cK@sB|std}ntddd|�}tddd|d|�S(um
    .. versionadded:: 2019.2.0

    Returns interfaces for a specific device using arbitrary netbox filters

    device_name
        The name of the device, e.g., ``edge_router``
    kwargs
        Optional arguments to be used for filtering

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.get_interfaces edge_router name="et-0/0/5"

    uidudcimudevicesRCu
interfacest	device_id(t__opts__RBRA(RcR3t
netbox_device((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytget_interfaces
s
c	C@si}td|�}td|�}x�|D]�}t|d�\}}||kr|ii|d6d6iid6d6||<n|dkrT|d||dd<|dr(||dkr�t|d�||dd<q(iiiiit|d�d6d6|6d6d6}td	|||�||<n|d
r�t|d
�||dd
<q�q+iit|�d6|dd6d6||dd|<|dr+t|d�||dd|dd<q+q+Wx.|D]&}|djd
�\}	}
|dd}t|�\}}dj|d�}|||ddkrgiit|�d6td6d6||dd|<n|||dd|kr�iiid6d6||dd||<nii|	d6t|
�d6d6||dd||dd|	<q�Wii|d6d6S(uv
    .. versionadded:: 2019.2.0

    Return a dictionary structured as standardised in the
    `openconfig-interfaces <http://ops.openconfig.net/branches/master/openconfig-interfaces.html>`_
    YANG model, containing physical and configuration data available in Netbox,
    e.g., IP addresses, MTU, enabled / disabled, etc.

    device_name: ``None``
        The name of the device to query the interface data for. If not provided,
        will use the Minion ID.

    CLI Example:

    .. code-block:: bash

        salt '*' netbox.openconfig_interfaces
        salt '*' netbox.openconfig_interfaces device_name=cr1.thn.lon
    Rcunameuconfigusubinterfaceu
subinterfacesu0uenabledudescriptionudictupdate.updateumtuuindexuaddressu/u	interfaceuipv{}ufamilyu	addressesuipu
prefix_lengthu
interfaces(	Rutget_ipaddressesR:tstrR1tintR6R R(Rctoc_ift
interfacestipaddressest	interfaceR8tif_unittsubif_descrt	ipaddresstipt
prefix_lengthtipvkey((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytopenconfig_interfaces%sf

$
"
"
/

!%8cC@s�i}td|�}x�|D]�}|ds2qnt|d�\}}|dd}||kr�ii|d6dd6dd6d6iid	6d
6||<ni||d
d	|<qWiii|d6d6d
6S(uw
    .. versionadded:: 2019.2.0

    Return a dictionary structured as standardised in the
    `openconfig-lacp <http://ops.openconfig.net/branches/master/openconfig-lacp.html>`_
    YANG model, with configuration data for Link Aggregation Control Protocol
    (LACP) for aggregate interfaces.

    .. note::
        The ``interval`` and ``lacp_mode`` keys have the values set as ``SLOW``
        and ``ACTIVE`` respectively, as this data is not currently available
        in Netbox, therefore defaulting to the values defined in the standard.
        See `interval <http://ops.openconfig.net/branches/master/docs/openconfig-lacp.html#lacp-interfaces-interface-config-interval>`_
        and `lacp-mode <http://ops.openconfig.net/branches/master/docs/openconfig-lacp.html#lacp-interfaces-interface-config-lacp-mode>`_
        for further details.

    device_name: ``None``
        The name of the device to query the LACP information for. If not provided,
        will use the Minion ID.

    CLI Example:

    .. code-block:: bash

        salt '*' netbox.openconfig_lacp
        salt '*' netbox.openconfig_lacp device_name=cr1.thn.lon
    RculagunameuSLOWuintervaluACTIVEu	lacp_modeuconfigumemberumembersu	interfaceu
interfacesulacp(RuR:(Rctoc_lacpRzR|R8R}t	parent_if((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytopenconfig_lacp�s(

cC@sWtddd|�}|stS|rQtddd|dd|�}	|	sQtSn|s`d}n|sod}ni|dd	6|d
6|d6|d6d
d6}
|dk	r�||
d<n|r�d|
d<n|r�|	d|
d<n|r�||
d<ntddd|dd|�}|s,tdd|
�}n|rOiii|
|d6d6d6S|SdS(u�
    .. versionadded:: 2019.2.0

    Attach an interface to a device. If not all arguments are provided,
    they will default to Netbox defaults.

    device_name
        The name of the device, e.g., ``edge_router``
    interface_name
        The name of the interface, e.g., ``TenGigE0/0/0/0``
    mac_address
        String of mac address, e.g., ``50:87:89:73:92:C8``
    description
        String of interface description, e.g., ``NTT``
    enabled
        String of boolean interface status, e.g., ``True``
    lag:
        Boolean of interface lag status, e.g., ``True``
    lag_parent
        String of interface lag parent name, e.g., ``ae13``
    form_factor
        Integer of form factor id, obtained through _choices API endpoint, e.g., ``200``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_interface edge_router ae13 description="Core uplink"
    udcimudevicesRCu
interfacesRruiduufalseudeviceunameudescriptionuenabledi�uform_factori�ulagumac_addressN(RBRRHR*(Rctinterface_nametmac_addressRhtenabledtlagt
lag_parenttform_factorRat
lag_interfaceR'tnb_interface((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_interface�s6%		


c	K@s�tddd|�}tdddtd|dd|�}|sDtS|sNtSx4td|�j�D]\}}t|||�qeWy0|j�iiit|�|j	6d6d6SWn?t
k
r�}tjd	j
|jjj|j|j��tSXd
S(u�
    .. versionadded:: 2019.2.0

    Update an existing interface with new attributes.

    device_name
        The name of the device, e.g., ``edge_router``
    interface_name
        The name of the interface, e.g., ``ae13``
    kwargs
        Arguments to change in interface, e.g., ``mac_address=50:87:69:53:32:D0``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.update_interface edge_router ae13 mac_address=50:87:69:53:32:D0
    udcimudevicesRCu
interfacesRRruiduargs.clean_kwargsu
{}, {}, {}N(RBR5RRR1RR_R`RR2RRRR R!R"R#R$(RcR�R3RaR�RRR)((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytupdate_interfaces%#
&+c	C@sttddd|�}tdddtd|dd|�}|rp|j�iiii|j|j6d6d6d6StS(	uF
    .. versionadded:: 2019.2.0

    Delete an interface from a device.

    device_name
        The name of the device, e.g., ``edge_router``.

    interface_name
        The name of the interface, e.g., ``ae13``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.delete_interface edge_router ae13
    udcimudevicesRCu
interfacesRRruiduDELETE(RBR5RRkRCR2R(RcR�RaR�((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytdelete_interface%s%
&cC@st||dd�S(uG
    .. versionadded:: 2019.2.0

    Update an interface to be a LAG.

    device_name
        The name of the device, e.g., ``edge_router``.

    interface_name
        The name of the interface, e.g., ``ae13``.

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.make_interface_lag edge_router ae13
    R�i�(R�(RcR�((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytmake_interface_lag?scC@s_tddd|�}tddd|dd|�}|rW|rWt||d|d�StSdS(	u�
    .. versionadded:: 2019.2.0

    Set an interface as part of a LAG.

    device_name
        The name of the device, e.g., ``edge_router``.

    interface_name
        The name of the interface to be attached to LAG, e.g., ``xe-1/0/2``.

    parent_name
        The name of the LAG interface, e.g., ``ae13``.

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.make_interface_child xe-1/0/2 ae13
    udcimudevicesRCu
interfacesRruidR�N(RBR�R(RcR�tparent_nameRat	nb_parent((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytmake_interface_childTs
cK@sB|std}ntddd|�}tddd|d|�S(uk
    .. versionadded:: 2019.2.0

    Filters for an IP address using specified filters

    device_name
        The name of the device to check for the IP address
    kwargs
        Optional arguments that can be used to filter, e.g., ``family=4``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.get_ipaddresses device_name family=4
    uidudcimudevicesRCuipamuip-addressesRr(RsRBRA(RcR3Rt((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyRvqs
c	
C@s�d}i|d6|d6}|r�|r�tddd|�}|sEtStddd|dd|�}|sntStd	d
d|d|dd
|�}|r�tj|�tS|d|d<ntd	d
|�}|r�ii|d
6d	6S|SdS(u
    .. versionadded:: 2019.2.0

    Add an IP address, and optionally attach it to an interface.

    ip_address
        The IP address and CIDR, e.g., ``192.168.1.1/24``
    family
        Integer of IP family, e.g., ``4``
    device
        The name of the device to attach IP to, e.g., ``edge_router``
    interface
        The name of the interface to attach IP to, e.g., ``ae13``

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_ipaddress 192.168.1.1/24 4 device=edge_router interface=ae13
    ufamilyuaddressudcimudevicesRCu
interfacesRruiduipamuip-addressestqtinterface_idtfamilyu	interfaceN(RHRBRRRR*(	t
ip_addressR�tdeviceR|tnb_addrR'RaR�tipaddr((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_ipaddress�s$%
cC@sHtdddtd|�}|rD|j�iii|d6d6d6StS(u.
    .. versionadded:: 2019.2.0

    Delete an IP address. IP addresses in Netbox are a combination of address
    and the interface it is assigned to.

    id
        The Netbox id for the IP address.

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.delete_ipaddress 9002
    uipamuip-addressesRR2u
ip-addressuDELETE(R5RRkR(t	ipaddr_idt	nb_ipaddr((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytdelete_ipaddress�s

cC@s�tddd|�}i}|rc|d|kr5tStjd||�tdj||���nfi|d6t|�d6}|r�||d<ntdd|�}|r�iii||d	6d6d6S|Sd
S(u
    .. versionadded:: 2019.2.0

    Create a new Netbox circuit provider

    name
        The name of the circuit provider
    asn
        The ASN of the circuit provider

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_circuit_provider Telia 1299
    ucircuitsu	providersRCuasnu-Duplicate provider with different ASN: %s: %su-Duplicate provider with different ASN: {}: {}unameusluguidN(RBRRRRR R0R*(RCtasntnb_circuit_providerR'tcircuit_provider((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_circuit_provider�s"
cC@s7|rtddd|�}ntddd|�}|S(u1
    .. versionadded:: 2019.2.0

    Get a circuit provider with a given name and optional ASN.

    name
        The name of the circuit provider
    asn
        The ASN of the circuit provider

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.get_circuit_provider Telia 1299
    ucircuitsu	providersR�RC(RB(RCR�R�((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytget_circuit_provider�scC@s|tdddt|��}|r%tSi|d6t|�d6}tdd|�}|rtiii||d6d6d6S|SdS(u�
    .. versionadded:: 2019.2.0

    Create a new Netbox circuit type.

    name
        The name of the circuit type

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_circuit_type Transit
    ucircuitsu
circuit-typesRTunameusluguidN(RBR0RR*(RCtnb_circuit_typeR'tcircuit_type((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_circuit_typesc	C@s�tdd|�}tdddt|��}|r�|r�i|d6|dd6|dd6}|ro||d	<ntddd
|�}|r�tStdd|�}|r�iii||d6d6d6S|SntSdS(u�
    .. versionadded:: 2019.2.0

    Create a new Netbox circuit

    name
        Name of the circuit
    provider_id
        The netbox id of the circuit provider
    circuit_type
        The name of the circuit type
    asn
        The ASN of the circuit provider
    description
        The description of the circuit

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_circuit NEW_CIRCUIT_01 Telia Transit 1299 "New Telia circuit"
    ucircuitsu	providersu
circuit-typesRTuciduiduproviderutypeudescriptiontcidN(RBR0RR*(	RCtprovider_idR�RhR�R�R't
nb_circuittcircuit((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_circuit.s"
uAcC@stddd|�}tddd|dd|�}tddd|�}|r|rtdd	d
|d�}	|	rxtSi|dd6|dd
6|ddd6|d6|d6}
|r�||
d<ntdd	|
�}|r�iii|
|d6d	6d6S|SndS(u?
    .. versionadded:: 2019.2.0

    Terminate a circuit on an interface

    circuit
        The name of the circuit
    interface
        The name of the interface to terminate on
    device
        The name of the device the interface belongs to
    speed
        The speed of the circuit, in Kbps
    xconnect_id
        The cross-connect identifier
    term_side
        The side of the circuit termination

    CLI Example:

    .. code-block:: bash

        salt myminion netbox.create_circuit_termination NEW_CIRCUIT_01 xe-0/0/1 myminion 10000 xconnect_id=XCON01
    udcimudevicesRCu
interfacesRruiducircuitsR�ucircuit-terminationsR�uciducircuitu	interfaceusiteu
port_speedu	term_sideuxconnect_idN(RBRR*(R�R|R�tspeedtxconnect_idt	term_sideRaR�R�tnb_terminationR'tcircuit_termination((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pytcreate_circuit_termination\s*


(usecrets(;t__doc__t
__future__RRRR+tloggingtsalt.exceptionsRR
tpynetbox.libRRRtImportErrorRt	getLoggert__name__RR;t__func_alias__RRRRRR*R0RHR5R:RARBRFRORSRXR[R^RbRjRnRqRuR�R�R�R�R�R�R�RvR�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/salt/modules/netbox.pyt<module>sx



													#				6	0		_:>	$			+	*	.

Zerion Mini Shell 1.0