'Tests that networking is auto-allocated for multiple servers.'

@decorators.idempotent_id('2e6cf129-9e28-4e8a-aaaa-045ea826b2a6')
def test_server_multi_create_auto_allocate(self):

    (_, servers) = compute.create_test_server(self.os_primary, networks='auto', wait_until='ACTIVE', min_count=3)
    server_nets = set()
    for server in servers:
        self.addCleanup(self.delete_server, server['id'])
        addresses = self.servers_client.list_addresses(server['id'])['addresses']
        self.assertEqual(1, len(addresses))
        server_nets.add(list(addresses.keys())[0])
    self.assertEqual(1, len(server_nets))
    search_opts = {'tenant_id': self.networks_client.tenant_id, 'shared': False, 'admin_state_up': True}
    nets = self.networks_client.list_networks(**search_opts).get('networks', [])
    self.assertEqual(1, len(nets))
    self.assertIn(nets[0]['name'], server_nets)
