'Tests listing servers with IP filter regex.
The compute API will perform a regex match on the ip filter and include
all servers that have fixed IPs which match the filter.
For example, consider we have two servers. The first server has IP
10.1.1.1 and the second server has IP 10.1.1.10. If we list servers
with filter ip=10.1.1.1 we should get back both servers because
10.1.1.1 is a prefix of 10.1.1.10. If we list servers with filter
ip=10.1.1.10 then we should only get back the second server.'

def test_list_servers_with_ip_filters_regex(self):

    for port_id in (self.neutron.port_1['id'], self.neutron.port_2['id']):
        server = dict(name=port_id, imageRef=self.image_id, flavorRef=self.flavor_id, networks=[{'port': port_id}])
        server = self.api.post_server({'server': server})
        self.addCleanup(self.api.delete_server, server['id'])
        self.wait_until_active_or_timeout(server['id'])
    servers = self.api.get_servers(search_opts={'ip': self.neutron.port_1['fixed_ips'][0]['ip_address']})
    self.assertEqual(2, len(servers), ('Unexpected    number    of    servers    returned    when    filtering    by    ip=%s:    %s' % (self.neutron.port_1['fixed_ips'][0]['ip_address'], servers)))
    servers = self.api.get_servers(search_opts={'ip': self.neutron.port_2['fixed_ips'][0]['ip_address']})
    self.assertEqual(1, len(servers), ('Unexpected    number    of    servers    returned    when    filtering    by    ip=%s:    %s' % (self.neutron.port_2['fixed_ips'][0]['ip_address'], servers)))
    self.assertEqual(self.neutron.port_2['fixed_ips'][0]['ip_address'], servers[0]['addresses']['private-network'][0]['addr'])
