
    Vh                     r    d dl mZmZmZ eZddgddZdZdZdZ	d d	l
mZ d d
lmZmZ d Zedk(  r e        yy)    )absolute_importdivisionprint_functionz1.1preview	certified)metadata_versionstatussupported_byu  
---
module: ucs_vlans
short_description: Configures VLANs on Cisco UCS Manager
description:
- Configures VLANs on Cisco UCS Manager.
extends_documentation_fragment: cisco.ucs.ucs
options:
  state:
    description:
    - If C(present), will verify VLANs are present and will create if needed.
    - If C(absent), will verify VLANs are absent and will delete if needed.
    choices: [present, absent]
    default: present
    type: str
  name:
    description:
    - The name assigned to the VLAN.
    - The VLAN name is case sensitive.
    - This name can be between 1 and 32 alphanumeric characters.
    - "You cannot use spaces or any special characters other than - (hyphen), \"_\" (underscore), : (colon), and . (period)."
    - You cannot change this name after the VLAN is created.
    required: yes
    type: str
  multicast_policy:
    description:
    - The multicast policy associated with this VLAN.
    - This option is only valid if the Sharing Type field is set to None or Primary.
    type: str
  fabric:
    description:
    - "The fabric configuration of the VLAN.  This can be one of the following:"
    - "common - The VLAN applies to both fabrics and uses the same configuration parameters in both cases."
    - "A — The VLAN only applies to fabric A."
    - "B — The VLAN only applies to fabric B."
    - For upstream disjoint L2 networks, Cisco recommends that you choose common to create VLANs that apply to both fabrics.
    choices: [common, A, B]
    default: common
    type: str
  id:
    description:
    - The unique string identifier assigned to the VLAN.
    - A VLAN ID can be between '1' and '3967', or between '4048' and '4093'.
    - You cannot create VLANs with IDs from 4030 to 4047. This range of VLAN IDs is reserved.
    - The VLAN IDs you specify must also be supported on the switch that you are using.
    - VLANs in the LAN cloud and FCoE VLANs in the SAN cloud must have different IDs.
    - Optional if state is absent.
    type: str
  sharing:
    description:
    - The Sharing Type field.
    - "Whether this VLAN is subdivided into private or secondary VLANs. This can be one of the following:"
    - "none - This VLAN does not have any secondary or private VLANs. This is a regular VLAN."
    - "primary - This VLAN can have one or more secondary VLANs, as shown in the Secondary VLANs area. This VLAN is a primary VLAN in the private VLAN domain."
    - "isolated - This is a private VLAN associated with a primary VLAN. This VLAN is an Isolated VLAN."
    - "community - This VLAN can communicate with other ports on the same community VLAN as well as the promiscuous port. This VLAN is a Community VLAN."
    choices: [none, primary, isolated, community]
    default: none
    type: str
  native:
    description:
    - Designates the VLAN as a native VLAN.
    choices: ['yes', 'no']
    default: 'no'
    type: str
requirements:
- ucsmsdk
author:
- David Soper (@dsoper2)
- CiscoUcs (@CiscoUcs)
a;  
- name: Configure VLAN
  cisco.ucs.ucs_vlans:
    hostname: 172.16.143.150
    username: admin
    password: password
    name: vlan2
    id: '2'
    native: 'yes'

- name: Remove VLAN
  cisco.ucs.ucs_vlans:
    hostname: 172.16.143.150
    username: admin
    password: password
    name: vlan2
    state: absent
z
#
)AnsibleModule)	UCSModuleucs_argument_specc                     t        j                         } | j                  t        dd      t        d      t        ddg d      t        d      t        ddg d	      t        dd
dd
g      t        ddddg             t	        | ddddggg      }t        |      }d}ddlm} d}	 d}d}d}|j                  d   dk7  r|d|j                  d   z   z  }|dz   |j                  d   z   }	|j                  j                  |	      }
|
rd}|j                  d   dk(  rG|r>|j                  s5|j                  j                  |
       |j                  j                          d}n|rct        |j                  d         }|j                  d   |d<   |j                  d   |d<   |j                  d   |d<    |
j                  d$i |rd}|s|j                  s |||j                  d   |j                  d   |j                  d   |j                  d   |j                  d          }
|j                  j                  |
d       |j                  j                          d}||j$                  d#<   |r |j&                  d$i |j$                    |j(                  d$i |j$                   y # t         $ r'}d}d!t#        |      z  |j$                  d"<   Y d }~ud }~ww xY w)%NstrT)typerequired)r   common)r   AB)r   defaultchoicesnone)r   primaryisolated	communitynoyespresentabsent)namemulticast_policyfabricidsharingnativestater%   r"   )supports_check_moderequired_ifFr   )
FabricVlanz
fabric/lanr!   /z/net-r   )r"   r$   default_netr#   r    mcast_policy_name)parent_mo_or_dnr   r"   r*   r#   r+   zsetup error: %s msgchanged )r   copyupdatedictr   r    ucsmsdk.mometa.fabric.FabricVlanr(   paramslogin_handlequery_dn
check_mode	remove_mocommitcheck_prop_matchadd_mo	Exceptionr   result	fail_json	exit_json)argument_specmoduleucserrr(   r.   	mo_existsprops_matchdn_basednmokwargses                g/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/ucs/plugins/modules/ucs_vlans.pymainrL   p   s   %**,Mut,5):NOU%9efudmDy9h:OP    i$(
F F
C
C <G08	=="h.sV]]8444Gwv!66&&r*I==!X-(($$..r2$$++-t!45(.h(?}%$*MM)$<y!.4mm<N.O*+&2&&00"&K((#(/#]]62!==.$*MM($; &i 8*0--8J*KB $$++B5$$++- $CJJy
&3::&F"szz"  8.Q7

58s   -F4J+ +	K4KK__main__N)
__future__r   r   r   r   __metaclass__ANSIBLE_METADATADOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   6ansible_collections.cisco.ucs.plugins.module_utils.ucsr   r   rL   __name__r/       rK   <module>rX      s`    A @(-(k$/1 FP&
 5 _P#f zF rW   