def test_get_all_by_ipv6_regexp(self):
        """Test searching by IPv6 address"""

        c = context.get_admin_context()
        instance_id1 = self._create_instance({'display_name': 'woot'})
        instance_id2 = self._create_instance({
                'display_name': 'woo',
                'id': 20})
        instance_id3 = self._create_instance({
                'display_name': 'not-woot',
                'id': 30})

        vif_ref1 = db.virtual_interface_create(c,
                {'address': '12:34:56:78:90:12',
                 'instance_id': instance_id1,
                 'network_id': 1})
        vif_ref2 = db.virtual_interface_create(c,
                {'address': '90:12:34:56:78:90',
                 'instance_id': instance_id2,
                 'network_id': 1})
        vif_ref3 = db.virtual_interface_create(c,
                {'address': '34:56:78:90:12:34',
                 'instance_id': instance_id3,
                 'network_id': 1})

        # This will create IPv6 addresses of:
        # 1: fd00::1034:56ff:fe78:9012
        # 20: fd00::9212:34ff:fe56:7890
        # 30: fd00::3656:78ff:fe90:1234

        instances = self.compute_api.get_all(c,
                search_opts={'ip6': '.*1034.*'})
        self.assertEqual(len(instances), 1)
        self.assertEqual(instances[0].id, instance_id1)

        instances = self.compute_api.get_all(c,
                search_opts={'ip6': '^fd00.*'})
        self.assertEqual(len(instances), 3)
        instance_ids = [instance.id for instance in instances]
        self.assertTrue(instance_id1 in instance_ids)
        self.assertTrue(instance_id2 in instance_ids)
        self.assertTrue(instance_id3 in instance_ids)

        instances = self.compute_api.get_all(c,
                search_opts={'ip6': '^.*12.*34.*'})
        self.assertEqual(len(instances), 2)
        instance_ids = [instance.id for instance in instances]
        self.assertTrue(instance_id2 in instance_ids)
        self.assertTrue(instance_id3 in instance_ids)

        db.virtual_interface_delete(c, vif_ref1['id'])
        db.virtual_interface_delete(c, vif_ref2['id'])
        db.virtual_interface_delete(c, vif_ref3['id'])
        db.instance_destroy(c, instance_id1)
        db.instance_destroy(c, instance_id2)
        db.instance_destroy(c, instance_id3)
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/tests/test_compute.py/ComputeTestCase.test_get_all_by_ipv6_regexp/original