def data(TEST): # Stack TEST.heatclient_stacks = test_data_utils.TestDataContainer() stack_1 = stacks.Stack( stacks.StackManager(None), { 'id': 'stack-id-1', 'stack_name': 'overcloud', 'stack_status': 'RUNNING', 'outputs': [{ 'output_key': 'KeystoneURL', 'output_value': 'http://192.0.2.23:5000/v2', }], 'parameters': { 'plan_id': 'plan-1', 'one': 'one', 'two': 'two', } }) TEST.heatclient_stacks.add(stack_1) # Events TEST.heatclient_events = test_data_utils.TestDataContainer() event_1 = events.Event( events.EventManager(None), { 'id': 1, 'stack_id': 'stack-id-1', 'resource_name': 'Controller', 'resource_status': 'CREATE_IN_PROGRESS', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:26:15Z' }) event_2 = events.Event( events.EventManager(None), { 'id': 2, 'stack_id': 'stack-id-1', 'resource_name': 'Compute0', 'resource_status': 'CREATE_IN_PROGRESS', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:26:27Z' }) event_3 = events.Event( events.EventManager(None), { 'id': 3, 'stack_id': 'stack-id-1', 'resource_name': 'Compute1', 'resource_status': 'CREATE_IN_PROGRESS', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:26:44Z' }) event_4 = events.Event( events.EventManager(None), { 'id': 4, 'stack_id': 'stack-id-1', 'resource_name': 'Compute0', 'resource_status': 'CREATE_COMPLETE', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:27:14Z' }) event_5 = events.Event( events.EventManager(None), { 'id': 5, 'stack_id': 'stack-id-1', 'resource_name': 'Compute2', 'resource_status': 'CREATE_IN_PROGRESS', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:27:31Z' }) event_6 = events.Event( events.EventManager(None), { 'id': 6, 'stack_id': 'stack-id-1', 'resource_name': 'Compute1', 'resource_status': 'CREATE_COMPLETE', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:28:01Z' }) event_7 = events.Event( events.EventManager(None), { 'id': 7, 'stack_id': 'stack-id-1', 'resource_name': 'Controller', 'resource_status': 'CREATE_COMPLETE', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:28:59Z' }) event_8 = events.Event( events.EventManager(None), { 'id': 8, 'stack_id': 'stack-id-1', 'resource_name': 'Compute2', 'resource_status': 'CREATE_COMPLETE', 'resource_status_reason': 'state changed', 'event_time': '2014-01-01T07:29:11Z' }) TEST.heatclient_events.add(event_1, event_2, event_3, event_4, event_5, event_6, event_7, event_8) # Resource TEST.heatclient_resources = test_data_utils.TestDataContainer() resource_1 = resources.Resource( resources.ResourceManager(None), { 'id': '1-resource-id', 'stack_id': 'stack-id-1', 'resource_name': 'Compute0', 'logical_resource_id': 'Compute0', 'physical_resource_id': 'aa', 'resource_status': 'CREATE_COMPLETE', 'resource_type': 'Compute' }) resource_2 = resources.Resource( resources.ResourceManager(None), { 'id': '2-resource-id', 'stack_id': 'stack-id-1', 'resource_name': 'Controller', 'logical_resource_id': 'Controller', 'physical_resource_id': 'bb', 'resource_status': 'CREATE_COMPLETE', 'resource_type': 'Controller' }) resource_3 = resources.Resource( resources.ResourceManager(None), { 'id': '3-resource-id', 'stack_id': 'stack-id-1', 'resource_name': 'Compute1', 'logical_resource_id': 'Compute1', 'physical_resource_id': 'cc', 'resource_status': 'CREATE_COMPLETE', 'resource_type': 'Compute' }) resource_4 = resources.Resource( resources.ResourceManager(None), { 'id': '4-resource-id', 'stack_id': 'stack-id-4', 'resource_name': 'Compute2', 'logical_resource_id': 'Compute2', 'physical_resource_id': 'dd', 'resource_status': 'CREATE_COMPLETE', 'resource_type': 'Compute' }) TEST.heatclient_resources.add(resource_1, resource_2, resource_3, resource_4) # Server TEST.novaclient_servers = test_data_utils.TestDataContainer() s_1 = servers.Server( servers.ServerManager(None), { 'id': 'aa', 'name': 'Compute', 'created': '2014-06-26T20:38:06Z', 'image': { 'id': '1' }, 'flavor': { 'id': '1', }, 'status': 'ACTIVE', 'public_ip': '192.168.1.1' }) s_2 = servers.Server( servers.ServerManager(None), { 'id': 'bb', 'name': 'Controller', 'created': '2014-06-27T20:38:06Z', 'image': { 'id': '2' }, 'flavor': { 'id': '2', }, 'status': 'ACTIVE', 'public_ip': '192.168.1.2' }) s_3 = servers.Server( servers.ServerManager(None), { 'id': 'cc', 'name': 'Compute', 'created': '2014-06-28T20:38:06Z', 'image': { 'id': '1' }, 'flavor': { 'id': '1', }, 'status': 'BUILD', 'public_ip': '192.168.1.3' }) s_4 = servers.Server( servers.ServerManager(None), { 'id': 'dd', 'name': 'Compute', 'created': '2014-06-29T20:38:06Z', 'image': { 'id': '1' }, 'flavor': { 'id': '1', }, 'status': 'ERROR', 'public_ip': '192.168.1.4' }) TEST.novaclient_servers.add(s_1, s_2, s_3, s_4) # Image TEST.glanceclient_images = test_data_utils.TestDataContainer() image_1 = images.Image(images.ImageManager(None), { 'id': '2', 'name': 'overcloud-control' }) image_2 = images.Image(images.ImageManager(None), { 'id': '1', 'name': 'overcloud-compute' }) image_3 = images.Image(images.ImageManager(None), { 'id': '3', 'name': 'Object Storage Image' }) image_4 = images.Image(images.ImageManager(None), { 'id': '4', 'name': 'Block Storage Image' }) TEST.glanceclient_images.add(image_1, image_2, image_3, image_4)
def data(TEST): TEST.images = utils.TestDataContainer() TEST.snapshots = utils.TestDataContainer() TEST.metadata_defs = utils.TestDataContainer() # Snapshots snapshot_dict = {'name': u'snapshot', 'container_format': u'ami', 'id': 3, 'status': "active", 'owner': TEST.tenant.id, 'properties': {'image_type': u'snapshot'}, 'is_public': False, 'protected': False} snapshot_dict_no_owner = {'name': u'snapshot 2', 'container_format': u'ami', 'id': 4, 'status': "active", 'owner': None, 'properties': {'image_type': u'snapshot'}, 'is_public': False, 'protected': False} snapshot_dict_queued = {'name': u'snapshot 2', 'container_format': u'ami', 'id': 5, 'status': "queued", 'owner': TEST.tenant.id, 'properties': {'image_type': u'snapshot'}, 'is_public': False, 'protected': False} snapshot = images.Image(images.ImageManager(None), snapshot_dict) TEST.snapshots.add(snapshot) snapshot = images.Image(images.ImageManager(None), snapshot_dict_no_owner) TEST.snapshots.add(snapshot) snapshot = images.Image(images.ImageManager(None), snapshot_dict_queued) TEST.snapshots.add(snapshot) # Images image_dict = {'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', 'name': 'public_image', 'disk_format': u'qcow2', 'status': "active", 'size': 20 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': {'image_type': u'image'}, 'is_public': True, 'protected': False, 'min_ram': 0, 'created_at': '2014-02-14T20:56:53'} public_image = images.Image(images.ImageManager(None), image_dict) image_dict = {'id': 'a001c047-22f8-47d0-80a1-8ec94a9524fe', 'name': 'private_image', 'status': "active", 'size': 10 * 1024 ** 2, 'virtual_size': 20 * 1024 ** 2, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0, 'created_at': '2014-03-14T12:56:53'} private_image = images.Image(images.ImageManager(None), image_dict) image_dict = {'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c', 'name': 'protected_images', 'status': "active", 'owner': TEST.tenant.id, 'size': 2 * 1024 ** 3, 'virtual_size': None, 'min_disk': 30, 'container_format': 'novaImage', 'properties': {'image_type': u'image'}, 'is_public': True, 'protected': True, 'min_ram': 0, 'created_at': '2014-03-16T06:22:14'} protected_image = images.Image(images.ImageManager(None), image_dict) image_dict = {'id': '278905a6-4b52-4d1e-98f9-8c57bb25ba32', 'name': None, 'status': "active", 'size': 5 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': {'image_type': u'image'}, 'is_public': True, 'protected': False, 'min_ram': 0} public_image2 = images.Image(images.ImageManager(None), image_dict) image_dict = {'id': '710a1acf-a3e3-41dd-a32d-5d6b6c86ea10', 'name': 'private_image 2', 'status': "active", 'size': 30 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0} private_image2 = images.Image(images.ImageManager(None), image_dict) image_dict = {'id': '7cd892fd-5652-40f3-a450-547615680132', 'name': 'private_image 3', 'status': "active", 'size': 2 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0} private_image3 = images.Image(images.ImageManager(None), image_dict) # A shared image. Not public and not local tenant. image_dict = {'id': 'c8756975-7a3b-4e43-b7f7-433576112849', 'name': 'shared_image 1', 'status': "active", 'size': 8 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': 'someothertenant', 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0} shared_image1 = images.Image(images.ImageManager(None), image_dict) # "Official" image. Public and tenant matches an entry # in IMAGES_LIST_FILTER_TENANTS. image_dict = {'id': 'f448704f-0ce5-4d34-8441-11b6581c6619', 'name': 'official_image 1', 'status': "active", 'size': 2 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': 'officialtenant', 'container_format': 'aki', 'is_public': True, 'protected': False, 'min_ram': 0} official_image1 = images.Image(images.ImageManager(None), image_dict) image_dict = {'id': 'a67e7d45-fe1e-4c5c-bf08-44b4a4964822', 'name': 'multi_prop_image', 'status': "active", 'size': 20 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': {'description': u'a multi prop image', 'foo': u'foo val', 'bar': u'bar val'}, 'is_public': True, 'protected': False} multi_prop_image = images.Image(images.ImageManager(None), image_dict) # An image without name being returned based on current api image_dict = {'id': 'c8756975-7a3b-4e43-b7f7-433576112849', 'status': "active", 'size': 8 * 1024 ** 3, 'virtual_size': None, 'min_disk': 0, 'owner': 'someothertenant', 'container_format': 'aki', 'is_public': False, 'protected': False} no_name_image = images.Image(images.ImageManager(None), image_dict) TEST.images.add(public_image, private_image, protected_image, public_image2, private_image2, private_image3, shared_image1, official_image1, multi_prop_image) TEST.empty_name_image = no_name_image metadef_dict = { 'namespace': 'namespace_1', 'display_name': 'Namespace 1', 'description': 'Mock desc 1', 'resource_type_associations': [ { 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'mock name' } ], 'visibility': 'public', 'protected': True, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'cpu_mock:mock': { 'default': '1', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef) metadef_dict = { 'namespace': 'namespace_2', 'display_name': 'Namespace 2', 'description': 'Mock desc 2', 'resource_type_associations': [ { 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'mock name' } ], 'visibility': 'private', 'protected': False, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'hdd_mock:mock': { 'default': '2', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef) metadef_dict = { 'namespace': 'namespace_3', 'display_name': 'Namespace 3', 'description': 'Mock desc 3', 'resource_type_associations': [ { 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'mock name' } ], 'visibility': 'public', 'protected': False, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'gpu_mock:mock': { 'default': '2', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef) metadef_dict = { 'namespace': 'namespace_4', 'display_name': 'Namespace 4', 'description': 'Mock desc 4', 'resource_type_associations': [ { 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'mock name' } ], 'visibility': 'public', 'protected': True, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'ram_mock:mock': { 'default': '2', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef)
def data(TEST): TEST.images = utils.TestDataContainer() TEST.snapshots = utils.TestDataContainer() # Snapshots snapshot_dict = { 'name': u'snapshot', 'container_format': u'ami', 'id': 3, 'status': "active", 'owner': TEST.tenant.id, 'properties': { 'image_type': u'snapshot' }, 'is_public': False, 'protected': False } snapshot_dict_no_owner = { 'name': u'snapshot 2', 'container_format': u'ami', 'id': 4, 'status': "active", 'owner': None, 'properties': { 'image_type': u'snapshot' }, 'is_public': False, 'protected': False } snapshot_dict_queued = { 'name': u'snapshot 2', 'container_format': u'ami', 'id': 5, 'status': "queued", 'owner': TEST.tenant.id, 'properties': { 'image_type': u'snapshot' }, 'is_public': False, 'protected': False } snapshot = images.Image(images.ImageManager(None), snapshot_dict) TEST.snapshots.add(snapshot) snapshot = images.Image(images.ImageManager(None), snapshot_dict_no_owner) TEST.snapshots.add(snapshot) snapshot = images.Image(images.ImageManager(None), snapshot_dict_queued) TEST.snapshots.add(snapshot) # Images image_dict = { 'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', 'name': 'public_image', 'status': "active", 'size': 20 * 1024**3, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': { 'image_type': u'image' }, 'is_public': True, 'protected': False } public_image = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': 'a001c047-22f8-47d0-80a1-8ec94a9524fe', 'name': 'private_image', 'status': "active", 'size': 10 * 1024**2, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False } private_image = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c', 'name': 'protected_images', 'status': "active", 'owner': TEST.tenant.id, 'size': 2 * 1024**3, 'min_disk': 30, 'container_format': 'novaImage', 'properties': { 'image_type': u'image' }, 'is_public': True, 'protected': True } protected_image = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': '278905a6-4b52-4d1e-98f9-8c57bb25ba32', 'name': None, 'status': "active", 'size': 5 * 1024**3, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': { 'image_type': u'image' }, 'is_public': True, 'protected': False } public_image2 = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': '710a1acf-a3e3-41dd-a32d-5d6b6c86ea10', 'name': 'private_image 2', 'status': "active", 'size': 30 * 1024**3, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False } private_image2 = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': '7cd892fd-5652-40f3-a450-547615680132', 'name': 'private_image 3', 'status': "active", 'size': 2 * 1024**3, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False } private_image3 = images.Image(images.ImageManager(None), image_dict) # A shared image. Not public and not local tenant. image_dict = { 'id': 'c8756975-7a3b-4e43-b7f7-433576112849', 'name': 'shared_image 1', 'status': "active", 'size': 8 * 1024**3, 'min_disk': 0, 'owner': 'someothertenant', 'container_format': 'aki', 'is_public': False, 'protected': False } shared_image1 = images.Image(images.ImageManager(None), image_dict) # "Official" image. Public and tenant matches an entry # in IMAGES_LIST_FILTER_TENANTS. image_dict = { 'id': 'f448704f-0ce5-4d34-8441-11b6581c6619', 'name': 'official_image 1', 'status': "active", 'size': 2 * 1024**3, 'min_disk': 0, 'owner': 'officialtenant', 'container_format': 'aki', 'is_public': True, 'protected': False } official_image1 = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': 'a67e7d45-fe1e-4c5c-bf08-44b4a4964822', 'name': 'multi_prop_image', 'status': "active", 'size': 20 * 1024**3, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': { 'description': u'a multi prop image', 'foo': u'foo val', 'bar': u'bar val' }, 'is_public': True, 'protected': False } multi_prop_image = images.Image(images.ImageManager(None), image_dict) TEST.images.add(public_image, private_image, protected_image, public_image2, private_image2, private_image3, shared_image1, official_image1, multi_prop_image)
def data(TEST): TEST.images = utils.TestDataContainer() TEST.images_api = utils.TestDataContainer() TEST.snapshots = utils.TestDataContainer() TEST.metadata_defs = utils.TestDataContainer() TEST.imagesV2 = utils.TestDataContainer() # Snapshots snapshot_dict = { 'name': u'snapshot', 'container_format': u'ami', 'id': 3, 'status': "active", 'owner': TEST.tenant.id, 'properties': { 'image_type': u'snapshot' }, 'is_public': False, 'protected': False } snapshot_dict_no_owner = { 'name': u'snapshot 2', 'container_format': u'ami', 'id': 4, 'status': "active", 'owner': None, 'properties': { 'image_type': u'snapshot' }, 'is_public': False, 'protected': False } snapshot_dict_queued = { 'name': u'snapshot 2', 'container_format': u'ami', 'id': 5, 'status': "queued", 'owner': TEST.tenant.id, 'properties': { 'image_type': u'snapshot' }, 'is_public': False, 'protected': False } snapshot = images.Image(images.ImageManager(None), snapshot_dict) TEST.snapshots.add(api.glance.Image(snapshot)) snapshot = images.Image(images.ImageManager(None), snapshot_dict_no_owner) TEST.snapshots.add(api.glance.Image(snapshot)) snapshot = images.Image(images.ImageManager(None), snapshot_dict_queued) TEST.snapshots.add(api.glance.Image(snapshot)) # Images image_dict = { 'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', 'name': 'public_image', 'disk_format': u'qcow2', 'status': "active", 'size': 20 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': { 'image_type': u'image' }, 'is_public': True, 'protected': False, 'min_ram': 0, 'created_at': '2014-02-14T20:56:53' } public_image = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': 'a001c047-22f8-47d0-80a1-8ec94a9524fe', 'name': 'private_image', 'status': "active", 'size': 10 * 1024**2, 'virtual_size': 20 * 1024**2, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0, 'created_at': '2014-03-14T12:56:53' } private_image = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c', 'name': 'protected_images', 'status': "active", 'owner': TEST.tenant.id, 'size': 2 * 1024**3, 'virtual_size': None, 'min_disk': 30, 'container_format': 'novaImage', 'properties': { 'image_type': u'image' }, 'is_public': True, 'protected': True, 'min_ram': 0, 'created_at': '2014-03-16T06:22:14' } protected_image = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': '278905a6-4b52-4d1e-98f9-8c57bb25ba32', 'name': None, 'status': "active", 'size': 5 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': { 'image_type': u'image' }, 'is_public': True, 'protected': False, 'min_ram': 0 } public_image2 = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': '710a1acf-a3e3-41dd-a32d-5d6b6c86ea10', 'name': 'private_image 2', 'status': "active", 'size': 30 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0 } private_image2 = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': '7cd892fd-5652-40f3-a450-547615680132', 'name': 'private_image 3', 'status': "active", 'size': 2 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0 } private_image3 = images.Image(images.ImageManager(None), image_dict) # A shared image. Not public and not local tenant. image_dict = { 'id': 'c8756975-7a3b-4e43-b7f7-433576112849', 'name': 'shared_image 1', 'status': "active", 'size': 8 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': 'someothertenant', 'container_format': 'aki', 'is_public': False, 'protected': False, 'min_ram': 0 } shared_image1 = images.Image(images.ImageManager(None), image_dict) # "Official" image. Public and tenant matches an entry # in IMAGES_LIST_FILTER_TENANTS. image_dict = { 'id': 'f448704f-0ce5-4d34-8441-11b6581c6619', 'name': 'official_image 1', 'status': "active", 'size': 2 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': 'officialtenant', 'container_format': 'aki', 'is_public': True, 'protected': False, 'min_ram': 0 } official_image1 = images.Image(images.ImageManager(None), image_dict) image_dict = { 'id': 'a67e7d45-fe1e-4c5c-bf08-44b4a4964822', 'name': 'multi_prop_image', 'status': "active", 'size': 20 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': TEST.tenant.id, 'container_format': 'novaImage', 'properties': { 'description': u'a multi prop image', 'foo': u'foo val', 'bar': u'bar val' }, 'is_public': True, 'protected': False } multi_prop_image = images.Image(images.ImageManager(None), image_dict) # An image without name being returned based on current api image_dict = { 'id': 'c8756975-7a3b-4e43-b7f7-433576112849', 'status': "active", 'size': 8 * 1024**3, 'virtual_size': None, 'min_disk': 0, 'owner': 'someothertenant', 'container_format': 'aki', 'is_public': False, 'protected': False } no_name_image = images.Image(images.ImageManager(None), image_dict) TEST.images_api.add(public_image, private_image, protected_image, public_image2, private_image2, private_image3, shared_image1, official_image1, multi_prop_image) TEST.images.add(api.glance.Image(public_image), api.glance.Image(private_image), api.glance.Image(protected_image), api.glance.Image(public_image2), api.glance.Image(private_image2), api.glance.Image(private_image3), api.glance.Image(shared_image1), api.glance.Image(official_image1), api.glance.Image(multi_prop_image)) TEST.empty_name_image = api.glance.Image(no_name_image) image_v2_dicts = [{ 'checksum': 'eb9139e4942121f22bbc2afc0400b2a4', 'container_format': 'novaImage', 'created_at': '2014-02-14T20:56:53', 'direct_url': 'swift+config://ref1/glance/' 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5', 'disk_format': u'qcow2', 'file': '/v2/images/' 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5/file', 'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', 'kernel_id': 'f6ebd5f0-b110-4406-8c1e-67b28d4e85e7', 'locations': [{ 'metadata': {}, 'url': 'swift+config://ref1/glance/' 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5' }], 'min_ram': 0, 'name': 'public_image', 'image_type': u'image', 'min_disk': 0, 'owner': TEST.tenant.id, 'protected': False, 'ramdisk_id': '868efefc-4f2d-4ed8-82b1-7e35576a7a47', 'size': 20 * 1024**3, 'status': 'active', 'tags': ['active_image'], 'updated_at': '2015-08-31T19:37:45Z', 'virtual_size': None, 'visibility': 'public' }, { 'checksum': None, 'container_format': 'novaImage', 'created_at': '2014-03-16T06:22:14', 'disk_format': None, 'image_type': u'image', 'file': '/v2/images/885d1cb0-9f5c-4677-9d03-175be7f9f984/file', 'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c', 'locations': [], 'min_disk': 30, 'min_ram': 0, 'name': 'protected_images', 'owner': TEST.tenant.id, 'protected': True, 'size': 2 * 1024**3, 'status': "active", 'tags': ['empty_image'], 'updated_at': '2015-09-01T22:37:32Z', 'virtual_size': None, 'visibility': 'public' }, { 'checksum': 'e533283e6aac072533d1d091a7d2e413', 'container_format': 'novaImage', 'created_at': '2015-09-02T00:31:16Z', 'disk_format': 'qcow2', 'file': '/v2/images/10ca6b6b-48f4-43ac-8159-aa9e9353f5e4/file', 'id': 'a67e7d45-fe1e-4c5c-bf08-44b4a4964822', 'image_type': 'an image type', 'min_disk': 0, 'min_ram': 0, 'name': 'multi_prop_image', 'owner': TEST.tenant.id, 'protected': False, 'size': 20 * 1024**3, 'status': 'active', 'tags': ['custom_property_image'], 'updated_at': '2015-09-02T00:31:17Z', 'virtual_size': None, 'visibility': 'public', 'description': u'a multi prop image', 'foo': u'foo val', 'bar': u'bar val' }] for fixture in image_v2_dicts: apiresource = APIResourceV2(fixture) TEST.imagesV2.add(api.glance.Image(apiresource)) metadef_dict = { 'namespace': 'namespace_1', 'display_name': 'Namespace 1', 'description': 'Mock desc 1', 'resource_type_associations': [{ 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'mock name' }], 'visibility': 'public', 'protected': True, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'cpu_mock:mock': { 'default': '1', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef) metadef_dict = { 'namespace': 'namespace_2', 'display_name': 'Namespace 2', 'description': 'Mock desc 2', 'resource_type_associations': [{ 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'mock name' }], 'visibility': 'private', 'protected': False, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'hdd_mock:mock': { 'default': '2', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef) metadef_dict = { 'namespace': 'namespace_3', 'display_name': 'Namespace 3', 'description': 'Mock desc 3', 'resource_type_associations': [{ 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'mock name' }], 'visibility': 'public', 'protected': False, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'gpu_mock:mock': { 'default': '2', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef) metadef_dict = { 'namespace': 'namespace_4', 'display_name': 'Namespace 4', 'description': 'Mock desc 4', 'resource_type_associations': [{ 'created_at': '2014-08-21T08:39:43Z', 'prefix': 'mock', 'name': 'OS::Cinder::Volume', 'properties_target': 'user' }], 'visibility': 'public', 'protected': True, 'created_at': '2014-08-21T08:39:43Z', 'properties': { 'ram_mock:mock': { 'default': '2', 'type': 'integer', 'description': 'Number of mocks.', 'title': 'mocks' } } } metadef = Namespace(metadef_dict) TEST.metadata_defs.add(metadef)