#NEWLINE# @ classmethod #NEWLINE# def load( cls , neutron_subnet_id , ctx ) : #NEWLINE# #INDENT# 'Load an IPAM subnet from the database given its neutron ID.\n\n        :param neutron_subnet_id: neutron subnet identifier.\n        ' #NEWLINE# ipam_subnet = ipam_db_api . IpamSubnetManager . load_by_neutron_subnet_id ( ctx . session , neutron_subnet_id ) #NEWLINE# if ( not ipam_subnet ) : #NEWLINE# #INDENT# LOG . error ( _LE ( 'IPAM subnet referenced to Neutron subnet %s does not exist' ) , neutron_subnet_id ) #NEWLINE# raise n_exc . SubnetNotFound ( subnet_id = neutron_subnet_id ) #NEWLINE# #UNINDENT# pools = [ ] #NEWLINE# for pool in ipam_subnet . allocation_pools : #NEWLINE# #INDENT# pools . append ( netaddr . IPRange ( pool [ 'first_ip' ] , pool [ 'last_ip' ] ) ) #NEWLINE# #UNINDENT# neutron_subnet = cls . _fetch_subnet ( ctx , neutron_subnet_id ) #NEWLINE# return cls ( ipam_subnet [ 'id' ] , ctx , cidr = neutron_subnet [ 'cidr' ] , allocation_pools = neutron_subnet_id , gateway_ip = neutron_subnet [ 'gateway_ip' ] , tenant_id = neutron_subnet [ 'tenant_id' ] , subnet_id = neutron_subnet_id )