
    Vhl                     ~    d dl mZmZmZ eZdZd dlZd dlZd dl	m
Z
 d dlmZmZ d dlmZ d dlmZmZ  G d d	e      Zy)
    )absolute_importdivisionprint_functiona  
---
deprecated:
  removed_in: 6.0.0
  why: This collection and all content in it is unmaintained and deprecated.
  alternative: Unknown.
author: Unknown (!UNKNOWN)
name: ironware
short_description: Use ironware cliconf to run command on Extreme Ironware platform
description:
  - This ironware plugin provides low level abstraction apis for
    sending and receiving CLI commands from Extreme Ironware network devices.
N)chain)to_bytesto_text)to_list)CliconfBaseenable_modec                   T     e Zd Zd Zedd       Zed        ZddZ fdZd Z	 xZ
S )	Cliconfc                 :   i }d|d<   | j                  d      }t        |d      j                         }t        j                  d|      }|r|j                  d      |d<   t        j                  d	|t        j                        }|r|j                  d      |d
<   |S )Nironware
network_oszshow versionsurrogate_or_strict)errorszIronWare : Version (\S+),   network_os_versionz-^(?:System Mode\:|System\:) (CES|CER|MLX|XMR)network_os_model)send_commandr   stripresearchgroupM)selfdevice_inforeplydatamatchs        n/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/network/plugins/cliconf/ironware.pyget_device_infozCliconf.get_device_info0   s    $.L!!!.1u%:;AAC		6=05AK,-		JDRTRVRVW.3kk!nK*+    c                     |dvrt        d|z        |dk(  rd}|'|ddj                  |      z   z  }nd}|t        d      | j                  |      S )N)runningstartupz/fetching configuration from %s is not supportedr%   zshow running-config zshow configurationz,flags are only supported with running-config)
ValueErrorjoinr   )r   sourceflagsformatcmds        r!   
get_configzCliconf.get_configA   sq    //NQWWXXY'C sSXXe_,, 'C  !OPP  %%r#   c                 `    t        dgt        |      dg      D ]  }| j                  |        y )Nzconfigure terminalend)r   r	   r   )r   commandr-   s      r!   edit_configzCliconf.edit_configR   s3    ./1AE7K 	#Cc"	#r#   c                 0    | j                  ||||||      S )N)r1   promptanswersendonlynewline	check_all)r   )r   r1   r4   r5   r6   r7   r8   s          r!   getzCliconf.getW   s-      Yakr  H   I  	Ir#   c                 R    t         t        |          }t        j                  |      S )N)superr   get_capabilitiesjsondumps)r   result	__class__s     r!   r<   zCliconf.get_capabilitiesZ   s!    w68zz&!!r#   c                 V    | j                   j                  r| j                  d       yy)zT
        Make sure we are in the operational cli mode
        :return: None
        z)#)config_contextN)_connection	connected_update_cli_prompt_context)r   s    r!   set_cli_prompt_contextzCliconf.set_cli_prompt_context^   s)    
 %%++4+@ &r#   )r%   Ntext)NNFTF)__name__
__module____qualname__r"   r   r.   r2   r9   r<   rF   __classcell__)r@   s   @r!   r   r   .   sA    " & &  # #I"Ar#   r   )
__future__r   r   r   type__metaclass__DOCUMENTATIONr   r=   	itertoolsr   ansible.module_utils._textr   r   Oansible_collections.ansible.netcommon.plugins.module_utils.network.common.utilsr	   ansible.plugins.cliconfr
   r   r    r#   r!   <module>rU      s<   & C B 
   8 c <6Ak 6Ar#   