
    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_functionaX  
---
module: edit_ncsi
version_added: "1.0.0"
author:
    - WangBaoshan (@ispim)
short_description: Set ncsi information
description:
   - Set ncsi information on Inspur server.
notes:
   - Does not support C(check_mode).
options:
    nic_type:
        description:
            - Nic type.
            - Only NF3280A6 and NF3180A6 model supports C(Disable) Settings, but not support C(PHY) Settings.
            - M6 model only support C(OCP),C(OCP1),C(PCIE) settings.
        choices: ['PHY', 'OCP','OCP1', 'PCIE', 'auto', 'Disable']
        type: str
    mode:
        description:
            - NCSI mode, auto-Auto Failover,  manual-Manual Switch.
            - Only M6 model supports C(Disable) Settings
        choices: ['auto', 'manual', 'Disable']
        type: str
    interface_name:
        description:
            - Interface name, for example eth0.
            - Only the M5 model supports this parameter.
        type: str
    channel_number:
        description:
            - Channel number.
        choices: [0, 1, 2, 3]
        type: int
extends_documentation_fragment:
    - inspur.ispim.ism
a  
- name: NCSI test
  hosts: ism
  connection: local
  gather_facts: no
  vars:
    ism:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Set ncsi information"
    inspur.ispim.edit_ncsi:
      mode: "manual"
      nic_type: "PCIE"
      interface_name: "eth0"
      channel_number: 1
      provider: "{{ ism }}"
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)ism_argument_specget_connectionc                   *    e Zd Zd Zd Zd Zd Zd Zy)NCSIc                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     j/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/inspur/ispim/plugins/modules/edit_ncsi.py__init__zNCSI.__init__\   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zNCSI.init_moduleb   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )Nsetncsi
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzNCSI.run_commandh   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NCSI.show_resultn   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workz	NCSI.workr   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g d      t        dd      t        ddg d      	      } | j                  t               t        |       }|j	                          y )
NstrF)PHYOCPOCP1PCIEautoDisable)typerequiredchoices)r1   manualr2   )r3   r4   int)r            )nic_typemodeinterface_namechannel_number)r   updater   r
   r'   )r   ncsi_objs     r   mainrA   x   s`    55:kluu6ST7M	M *+M"HMMOr   __main__N)
__future__r   r   r   r3   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   9ansible_collections.inspur.ispim.plugins.module_utils.ismr   r   objectr
   rA   r(   r"   r   r   <module>rK      sV    C B%N,
 5 i6 :	 zF r   