@ -17,6 +17,7 @@ SCCI functionalities shared between different iRMC modules.
"""
import functools
import re
import time
import defusedxml . ElementTree as ET
@ -28,6 +29,14 @@ from scciclient.irmc import snmp
DEBUG = False
S4_PATTERN = re . compile ( r " ^iRMC \ s*S4$ " )
S5_PATTERN = re . compile ( r " ^iRMC \ s*S5$ " )
FW_VERSION_HEAD_PATTERN = re . compile ( r " ^ \ d[ \ d.]* " )
FW_VERSION_TAIL_PATTERN = re . compile ( r " [a-zA-Z]*$ " )
S4_FD_SUPPORT_UPPER = 9.21
S5_FD_SUPPORT_UPPER = 1.25
class SCCIError ( Exception ) :
""" SCCI Error
@ -90,6 +99,14 @@ OpCode SCCI Command String Description
0x0203 ResetFirmware Perform a BMC Reset
0x0251 ConnectRemoteFdImage Connect or Disconnect a Floppy Disk image on a
Remote Image Mount ( NFS or CIFS Share )
This command was deprecated at following
version :
iRMC S4 : 9.62 F
( 9.21 F still supports virtual FD )
iRMC S5 : 1.60 P
( 1.25 P still supports virtual FD )
0x0252 ConnectRemoteCdImage Connect or Disconnect a CD / DVD . iso image on a
Remote Image Mount ( NFS or CIFS Share )
0x0253 ConnectRemoteHdImage Connect or Disconnect a Hard Disk image on a
@ -627,6 +644,53 @@ def get_irmc_version(report):
return version
def get_irmc_version_str ( report ) :
""" extract iRMC OS and iRMC firmware version from SCCI report
This function returns iRMC OS name and iRMC firmware version
: param report : SCCI report element
: returns : a tuple of string ( iRMC OS name , iRMC FW version )
"""
version = get_irmc_version ( report )
return version . get ( ' Name ' ) , version . find ( ' Firmware ' ) . text
def support_virtual_fd_str ( irmc_os , fw_version ) :
""" determine iRMC supports virtual floppy disk
This function determines whether iRMC supports virtual floppy disk
based on provided iRMC OS & iRMC firmware version
: param irmc_os : string representing iRMC OS
: param fw_version : string representing iRMC firmware version
: returns : boolean
"""
version_head = FW_VERSION_HEAD_PATTERN . match ( fw_version )
if S4_PATTERN . match ( irmc_os ) :
if version_head and float ( version_head . group ( ) ) < = S4_FD_SUPPORT_UPPER :
return True
elif S5_PATTERN . match ( irmc_os ) :
if version_head and float ( version_head . group ( ) ) < = S5_FD_SUPPORT_UPPER :
return True
return False
def support_virtual_fd ( report ) :
""" determine iRMC supports virtual floppy disk
This function determines whether iRMC supports virtual floppy disk
based on SCCI report
: param report : SCCI report element
: returns : boolean
"""
irmc_os , fwv = get_irmc_version_str ( report )
return support_virtual_fd_str ( irmc_os , fwv )
def get_essential_properties ( report , prop_keys ) :
""" get essential properties