#NEWLINE# def import_enclosure( srv , sts , eg , ip , usr , pas , lic , baseline , force , forcefw , monitor ) : #NEWLINE# #INDENT# if ( not monitor ) : #NEWLINE# #INDENT# egroup = None #NEWLINE# egroups = srv . get_enclosure_groups ( ) #NEWLINE# for group in egroups : #NEWLINE# #INDENT# if ( group [ 'name' ] == eg ) : #NEWLINE# #INDENT# egroup = group #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( not egroup ) : #NEWLINE# #INDENT# print ( 'ERROR: Importing Enclosure' ) #NEWLINE# print ( ( 'Enclosure Group: "%s" has not been defined' % eg ) ) #NEWLINE# print ( '' ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# print ( 'Adding Enclosure' ) #NEWLINE# uri = '' #NEWLINE# if baseline : #NEWLINE# #INDENT# spps = sts . get_spps ( ) #NEWLINE# for spp in spps : #NEWLINE# #INDENT# if ( spp [ 'isoFileName' ] == baseline ) : #NEWLINE# #INDENT# uri = spp [ 'uri' ] #NEWLINE# if ( not uri ) : #NEWLINE# #INDENT# print ( 'ERROR: Locating Firmeware Baseline SPP' ) #NEWLINE# print ( ( 'Baseline: "%s" can not be located' % baseline ) ) #NEWLINE# print ( '' ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( not uri ) : #NEWLINE# #INDENT# add_enclosure = hpov . common . make_enclosure_dict ( ip , usr , pas , egroup [ 'uri' ] , licenseIntent = lic , force = force , forcefw = forcefw ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# add_enclosure = hpov . common . make_enclosure_dict ( ip , usr , pas , egroup [ 'uri' ] , licenseIntent = lic , firmwareBaseLineUri = uri , force = force , forcefw = forcefw ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# add_enclosure = hpov . common . make_monitored_enclosure_dict ( ip , usr , pas ) #NEWLINE# #UNINDENT# enclosure = srv . add_enclosure ( add_enclosure ) #NEWLINE# if ( 'enclosureType' in enclosure ) : #NEWLINE# #INDENT# print ( 'Type:          ' , enclosure [ 'enclosureType' ] ) #NEWLINE# print ( 'Name:          ' , enclosure [ 'name' ] ) #NEWLINE# print ( 'Rack:          ' , enclosure [ 'rackName' ] ) #NEWLINE# print ( 'Serial Number: ' , enclosure [ 'serialNumber' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pprint ( enclosure )