
    Vh                     j    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 d dl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: nos
short_description: Use nos cliconf to run command on Extreme NOS platform
description:
  - This nos plugin provides low level abstraction apis for
    sending and receiving CLI commands from Extreme NOS network devices.
N)to_text)to_list)CliconfBasec                   :     e Zd Zd ZddZd ZddZ fdZ xZS )Cliconfc                 `   i }d|d<   | j                  d      }t        |d      j                         }t        j                  d|      }|r|j                  d      |d<   | j                  d	      }t        |d      j                         }t        j                  d
|t        j                        }|r|j                  d      |d<   | j                  d      }t        |d      j                         }t        j                  d|t        j                        }|r|j                  d      |d<   |S )Nnos
network_oszshow versionsurrogate_or_strict)errorsz'Network Operating System Version: (\S+)   network_os_versionzshow chassisz^Chassis Name:(\s+)(\S+)   network_os_modelz7show running-config | inc "switch-attributes host-name"z!switch-attributes host-name (\S+)network_os_hostname)getr   stripresearchgroupM)selfdevice_inforeplydatamatchs        i/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/network/plugins/cliconf/nos.pyget_device_infozCliconf.get_device_info.   s   $)L!(u%:;AAC		DdK05AK,-(u%:;AAC		5tRTTB.3kk!nK*+RSu%:;AAC		>bddK16QK-.    c                     d}|dvrt        d|z        |dk(  rd}|g n|}|dj                  |      z  }|j                         }| j                  |      S )N runningz/fetching configuration from %s is not supportedzshow running-config )
ValueErrorjoinr   send_command)r   sourceflagscmds       r    
get_configzCliconf.get_configI   sg    "NQWWXXY'Cmsxxiik  %%r"   c           
         i }g }g }| j                  d       t        |      D ]  }t        |t              r"|d   }|d   }|d   }|j	                  dd      }n|}d }d }d}|dk7  sC|d   d	k7  sL|j                  | j                  |||d
|             |j                  |        | j                  d       ||d<   ||d<   |S )Nzconfigure terminalcommandpromptanswernewlineTendr   !Frequestresponse)r)   r   
isinstancedictr   append)	r   r/   respresultsrequestsr,   r0   r1   r2   s	            r    edit_configzCliconf.edit_configV   s    ./7# 	%C#t$i.XX'')T2e|A#t00&&%QXYZ$	%  	% "Y"Zr"   c                 0    | j                  ||||||      S )N)r/   r0   r1   sendonlyr2   	check_all)r)   )r   r/   r0   r1   r?   r2   r@   s          r    r   zCliconf.getq   s-      Yakr  H   I  	Ir"   c                 R    t         t        |          }t        j                  |      S )N)superr
   get_capabilitiesjsondumps)r   result	__class__s     r    rC   zCliconf.get_capabilitiest   s!    w68zz&!!r"   )r%   N)NNFTF)	__name__
__module____qualname__r!   r-   r=   r   rC   __classcell__)rG   s   @r    r
   r
   ,   s"    6&6I" "r"   r
   )
__future__r   r   r   type__metaclass__DOCUMENTATIONr   rD   ansible.module_utils._textr   Oansible_collections.ansible.netcommon.plugins.module_utils.network.common.utilsr   ansible.plugins.cliconfr   r
    r"   r    <module>rT      s9   & C B 
  . c /J"k J"r"   