#NEWLINE# def _setup_networks( self ) : #NEWLINE# #INDENT# if self . demo_cloud . has_service ( 'network' ) : #NEWLINE# #INDENT# self . test_net = self . demo_cloud . create_network ( name = ( ext_nets . new_item_name + '_net' ) ) #NEWLINE# self . test_subnet = self . demo_cloud . create_subnet ( subnet_name = ( self . new_item_name + '_subnet' ) , network_name_or_id = self . test_net [ 'id' ] , cidr = '10.24.4.0/24' , enable_dhcp = True ) #NEWLINE# self . test_router = self . demo_cloud . create_router ( name = ( self . new_item_name + '_router' ) ) #NEWLINE# ext_nets = self . demo_cloud . search_networks ( filters = { #NEWLINE# #INDENT# 'router:external' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . demo_cloud . update_router ( name_or_id = self . test_router [ 'id' ] , ext_gateway_net_id = ext_nets [ 0 ] [ 'id' ] ) #NEWLINE# self . neutron . add_interface_router ( router = self . test_router [ 'id' ] , body = { #NEWLINE# #INDENT# 'subnet_id' : self . test_subnet [ 'id' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . nic = { #NEWLINE# #INDENT# 'net-id' : self . test_net [ 'id' ] , #NEWLINE# #UNINDENT# } #NEWLINE# self . addDetail ( 'networks-neutron' , content . text_content ( pprint . pformat ( self . demo_cloud . list_networks ( ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nets = self . demo_cloud . nova_client . networks . list ( ) #NEWLINE# self . addDetail ( 'networks-nova' , content . text_content ( pprint . pformat ( nets ) ) ) #NEWLINE# self . nic = { #NEWLINE# #INDENT# 'net-id' : nets [ 0 ] . id , #NEWLINE# #UNINDENT# }