#NEWLINE# def get_enclosures( con , srv , net , name , report ) : #NEWLINE# #INDENT# enclosures = srv . get_enclosures ( ) #NEWLINE# for enc in enclosures : #NEWLINE# #INDENT# if ( ( name is None ) or ( name == enc [ 'name' ] ) ) : #NEWLINE# #INDENT# if report : #NEWLINE# #INDENT# print ( '\n{0:15} {1:13} {2:15}\t\t\t{3:9} {4:10} {5:13}' . format ( 'Enclosure Name' , 'Serial Number' , 'Enclosure Model' , 'Rack Name' , 'FW Managed' , 'Baseline Name' ) ) #NEWLINE# print ( '\n{0:15} {1:13} {2:15}\t\t\t{3:9} {4:10} {5:13}' . format ( '--------------' , '-------------' , '---------------' , '---------' , '----------' , '-------------' ) ) #NEWLINE# print ( '\n{0:15} {1:13} {2:15}\t{3:9} {4:10} {5:13}' . format ( enc [ 'name' ] , enc [ 'serialNumber' ] , enc [ 'enclosureType' ] , enc [ 'rackName' ] , enc [ 'isFwManaged' ] , enc [ 'fwBaselineName' ] ) ) #NEWLINE# print ( '\n\n' ) #NEWLINE# print ( '{0:7}  {1:13} {2:15} {3:9}' . format ( 'OA Bay' , 'Role' , 'IP Address' , 'Firmware Version' ) ) #NEWLINE# print ( '{0:7}  {1:13} {2:15} {3:9}' . format ( '------' , '----' , '----------' , '----------------' ) ) #NEWLINE# for oa in enc [ 'oa' ] : #NEWLINE# #INDENT# print ( '{0:7}  {1:13} {2:15} {3:9}' . format ( oa [ 'bayNumber' ] , oa [ 'role' ] , oa [ 'ipAddress' ] , oa [ 'fwVersion' ] ) ) #NEWLINE# #UNINDENT# print ( '\n\n' ) #NEWLINE# print ( '\n{0:15} {1:13} {2:15} {3:20} {4:25} {5:20} {6:10}' . format ( 'Server Name' , 'Serial Num' , 'Model' , 'Systerm ROM' , 'iLO Firmware Verision' , 'State' , 'Licensing' ) ) #NEWLINE# print ( '{0:15} {1:13} {2:15} {3:20} {4:25} {5:20} {6:10}\n' . format ( '-----------' , '----------' , '-----------' , '-----------' , '----------------------' , '-------' , '----------' ) ) #NEWLINE# for dev in enc [ 'deviceBays' ] : #NEWLINE# #INDENT# if ( ( 'devicePresence' in dev ) and ( dev [ 'devicePresence' ] == 'present' ) and ( 'deviceUri' in dev ) ) : #NEWLINE# #INDENT# ser = con . get ( dev [ 'deviceUri' ] ) #NEWLINE# print ( '{0:15} {1:13} {2:15} {3:20} {4:25} {5:20} {6:10}' . format ( con [ 'name' ] , ser [ 'serialNumber' ] , ser [ 'shortModel' ] , ser [ 'romVersion' ] , ser [ 'mpFirmwareVersion' ] , ser [ 'state' ] , ser [ 'licensingIntent' ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# print ( '\n\n' ) #NEWLINE# print ( '\n{0:25} {1:45} {2:15} {3:15}' . format ( 'Interconnect Name' , 'Module' , 'Serial Number' , 'FW Version' ) ) #NEWLINE# print ( '{0:25} {1:45} {2:15} {3:15}\n' . format ( '-----------------' , '------' , '-------------' , '----------' ) ) #NEWLINE# for ics in enc [ 'interconnectBays' ] : #NEWLINE# #INDENT# if ( ( 'interconnectUri' in ics ) and ( ics [ 'interconnectUri' ] is not None ) ) : #NEWLINE# #INDENT# ic = con . get ( ics [ 'interconnectUri' ] ) #NEWLINE# print ( '{0:25} {1:45} {2:15} {3:15}' . format ( ic [ 'name' ] , ic [ 'model' ] , ic [ 'serialNumber' ] , ic [ 'firmwareVersion' ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# print ( '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pprint ( enc )