'Create subnet and delete it with existing ports'

def _test_delete_subnet_with_ports(self, mode):

    slaac_network = self.create_network()
    subnet_slaac = self.create_subnet(slaac_network, **{'ipv6_ra_mode': mode, 'ipv6_address_mode': mode})
    port = self.create_port(slaac_network)
    self.assertIsNotNone(port['fixed_ips'][0]['ip_address'])
    self.subnets_client.delete_subnet(subnet_slaac['id'])
    self.subnets.pop()
    subnets = self.subnets_client.list_subnets()
    subnet_ids = [subnet['id'] for subnet in subnets['subnets']]
    self.assertNotIn(subnet_slaac['id'], subnet_ids, "Subnet    wasn't    deleted")
    self.assertRaisesRegex(lib_exc.Conflict, 'There    are    one    or    more    ports    still    in    use    on    the    network', self.networks_client.delete_network, slaac_network['id'])
