#NEWLINE# def test_life_cycle( self ) : #NEWLINE# #INDENT# assert ( len ( self . d . get_allocated_networks ( ) ) == 0 ) #NEWLINE# assert ( len ( self . d . conn . listDefinedNetworks ( ) ) == 0 ) #NEWLINE# assert ( len ( self . d . conn . listDefinedDomains ( ) ) == 0 ) #NEWLINE# self . env . define ( ) #NEWLINE# nets = map ( str , self . d . get_allocated_networks ( ) ) #NEWLINE# assert ( sorted ( nets ) == [ '10.109.0.1/24' , '10.109.1.1/24' , '10.109.2.1/24' , '10.109.3.1/24' , '10.109.4.1/24' ] ) #NEWLINE# assert ( sorted ( self . d . conn . listDefinedNetworks ( ) ) == [ 'test_env_admin' , 'test_env_management' , 'test_env_private' , 'test_env_public' , 'test_env_storage' ] ) #NEWLINE# assert ( sorted ( self . d . conn . listDefinedDomains ( ) ) == [ 'test_env_admin' , 'test_env_slave-01' , 'test_env_slave-02' ] ) #NEWLINE# self . env . start ( ) #NEWLINE# networks = self . d . conn . listAllNetworks ( ) #NEWLINE# assert ( len ( networks ) == 5 ) #NEWLINE# for network in networks : #NEWLINE# #INDENT# assert network . isActive ( ) #NEWLINE# #UNINDENT# domains = self . d . conn . listAllDomains ( ) #NEWLINE# assert ( len ( domains ) == 3 ) #NEWLINE# for domain in domains : #NEWLINE# #INDENT# assert domain . isActive ( ) #NEWLINE# #UNINDENT# self . env . destroy ( ) #NEWLINE# networks = self . d . conn . listAllNetworks ( ) #NEWLINE# assert ( len ( networks ) == 5 ) #NEWLINE# for network in networks : #NEWLINE# #INDENT# assert network . isActive ( ) #NEWLINE# #UNINDENT# domains = self . d . conn . listAllDomains ( ) #NEWLINE# assert ( len ( domains ) == 3 ) #NEWLINE# for domain in domains : #NEWLINE# #INDENT# assert ( not domain . isActive ( ) ) #NEWLINE# #UNINDENT# self . env . erase ( ) #NEWLINE# assert ( len ( self . d . get_allocated_networks ( ) ) == 0 ) #NEWLINE# assert ( len ( self . d . conn . listAllNetworks ( ) ) == 0 ) #NEWLINE# assert ( len ( self . d . conn . listAllDomains ( ) ) == 0 )