#NEWLINE# def create_subnet( self , name , network_id , cidr_ip , ip_version , start , end ) : #NEWLINE# #INDENT# subnet = None #NEWLINE# subnets = self . shell . quantum . list_subnets ( ) [ 'subnets' ] #NEWLINE# for snet in subnets : #NEWLINE# #INDENT# if ( ( snet [ 'cidr' ] == cidr_ip ) and ( snet [ 'network_id' ] == network_id ) ) : #NEWLINE# #INDENT# subnet = snet #NEWLINE# #UNINDENT# #UNINDENT# if ( not subnet ) : #NEWLINE# #INDENT# metadata_ip = cidr_ip . replace ( '0/24' , '3' ) #NEWLINE# allocation_pools = [ { #NEWLINE# #INDENT# 'start' : start , #NEWLINE# 'end' : end , #NEWLINE# #UNINDENT# } ] #NEWLINE# subnet = { #NEWLINE# #INDENT# 'subnet' : { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'network_id' : network_id , #NEWLINE# 'ip_version' : ip_version , #NEWLINE# 'cidr' : cidr_ip , #NEWLINE# 'host_routes' : [ { #NEWLINE# #INDENT# 'destination' : '169.254.169.254/32' , #NEWLINE# 'nexthop' : metadata_ip , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'gateway_ip' : None , #NEWLINE# 'allocation_pools' : allocation_pools , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# subnet = self . shell . quantum . create_subnet ( subnet ) [ 'subnet' ] #NEWLINE# #UNINDENT# return subnet