�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l m
Z
d d
l m Z d d l m Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: bcf_switch
author: "Ted (@tedelhourani)"
short_description: Create and remove a bcf switch.
description:
- Create and remove a Big Cloud Fabric switch.
version_added: "2.4"
options:
name:
description:
- The name of the switch.
required: true
fabric_role:
description:
- Fabric role of the switch.
choices: ['spine', 'leaf']
required: true
leaf_group:
description:
- The leaf group of the switch if the switch is a leaf.
required: false
mac:
description:
- The MAC address of the switch.
required: true
state:
description:
- Whether the switch should be present or absent.
default: present
choices: ['present', 'absent']
controller:
description:
- The controller IP address.
required: true
validate_certs:
description:
- If C(false), SSL certificates will not be validated. This should only be used
on personally controlled devices using self-signed certificates.
required: false
default: true
type: bool
access_token:
description:
- Big Cloud Fabric access token. If this isn't set then the environment variable C(BIGSWITCH_ACCESS_TOKEN) is used.
s�
- name: bcf leaf switch
bcf_switch:
name: Rack1Leaf1
fabric_role: leaf
leaf_group: R1
mac: 00:00:00:02:00:02
controller: '{{ inventory_hostname }}'
state: present
validate_certs: false
s # N( t
AnsibleModule( t Rest( t to_nativec C` s� y | j d p t j d } Wn6 t k
rV } | j d d | j d t j � � n X| j d } | j d } | j d } d | j d
} | j d } | j d } t | i d
d 6d | d 6d | d � }
|
j d d i �} | j
d k r| j d d j | j d � � n t
} xi | j D]^ }
t |
d | k |
d | k |
d | k f � r,|
j d d � | k } | r�Pq�q,q,W| d k r�| r�| j d t
� n | d k r�| r�| j d t
� n | r�| j d t � n | d k r~i | d 6| d 6| d 6| d 6} |
j d | | � } | j
d k rX| j d t � q~| j d d j | | j d � � n | d k r�|
j d | d i �} | j
d k r�| j d t � q�| j d d! j | | j d � � n d S("