def get_subnets_by_net_id(self, context, project_id, net_id):

        # FIXME(danwent):  Melange actually returns the subnet info
        # when we query for a particular interface.  We may want to
        # rework the ipam_manager python API to let us take advantage of
        # this, as right now we have to get all blocks and cycle through
        # them.
        subnet_v4 = None
        subnet_v6 = None
        tenant_id = project_id or FLAGS.quantum_default_tenant_id
        all_blocks = self.m_conn.get_blocks(tenant_id)
        for b in all_blocks['ip_blocks']:
            if b['network_id'] == net_id:
                subnet = {'network_id': b['network_id'],
                          'cidr': b['cidr'],
                          'gateway': b['gateway'],
                          'broadcast': b['broadcast'],
                          'netmask': b['netmask'],
                          'dns1': b['dns1'],
                          'dns2': b['dns2']}

                if IPNetwork(b['cidr']).version == 6:
                    subnet_v6 = subnet
                else:
                    subnet_v4 = subnet
        return (subnet_v4, subnet_v6)
Returns information about the IPv4 and IPv6 subnets
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/network/quantum/melange_ipam_lib.py/QuantumMelangeIPAMLib.get_subnets_by_net_id