
    Vh                     z    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZmZ  G d de      Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functionaf  
---
module: edit_vlan
version_added: "1.0.0"
author:
    - WangBaoshan (@ieisystem)
short_description: Set vlan information
description:
   - Set vlan information on ieisystem Server.
notes:
   - Does not support C(check_mode).
options:
    interface_name:
        description:
            - Set interface name. Select the LAN interface to be configured.
        choices: ['eth0', 'eth1', 'bond0']
        required: true
        type: str
    vlan_status:
        description:
            - Enable or disable vlan.
        choices: ['enable', 'disable']
        type: str
    vlan_id:
        description:
            - The Identification for VLAN configuration(2-4094).
        type: int
    vlan_priority:
        description:
            - The priority for VLAN configuration(1-7).
        type: int
extends_documentation_fragment:
    - ieisystem.inmanage.inmanage
a;  
- name: Vlan test
  hosts: inmanage
  connection: local
  gather_facts: false
  vars:
    inmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Set vlan information"
    ieisystem.inmanage.edit_vlan:
      interface_name: "eth0"
      vlan_status: "disable"
      provider: "{{ inmanage }}"

  - name: "Set vlan information"
    ieisystem.inmanage.edit_vlan:
      interface_name: "eth0"
      vlan_status: "enable"
      vlan_id: 2
      vlan_priority: 1
      provider: "{{ inmanage }}"
a1  
message:
    description: Messages returned after module execution.
    returned: always
    type: str
state:
    description: Status after module execution.
    returned: always
    type: str
changed:
    description: Check to see if a change was made on the device.
    returned: always
    type: bool
)AnsibleModule)inmanage_argument_specget_connectionc                   *    e Zd Zd Zd Zd Zd Zd Zy)Networkc                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     p/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ieisystem/inmanage/plugins/modules/edit_vlan.py__init__zNetwork.__init__^   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zNetwork.init_moduled   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )Nsetvlan
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzNetwork.run_commandj   sJ    +4<(%dkk2<< I-&*DLL# .r   c                 P     | j                   j                  di | j                   y)zShow resultN )r   	exit_jsonr   r   s    r   show_resultzNetwork.show_resultp   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workzNetwork.workt   s    r   N)__name__
__module____qualname__r   r   r    r$   r'   r"   r   r   r
   r
   ]   s    @+.r   r
   c            	          t        t        ddg d      t        ddddg      t        dd	      t        dd	      
      } | j                  t               t        |       }|j	                          y )NstrT)eth0eth1bond0)typerequiredchoicesFenabledisableint)r0   r1   )interface_namevlan_statusvlan_idvlan_priority)r   updater   r
   r'   )r   net_objs     r   mainr<   z   sb    ?XYeeh	=RS%%06	M /0m$GLLNr   __main__N)
__future__r   r   r   r0   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   Dansible_collections.ieisystem.inmanage.plugins.module_utils.inmanager   r   objectr
   r<   r(   r"   r   r   <module>rF      sV    C B!F8
 5 yf :
 zF r   