예제 #1
0
 def _test_host_storage_attributes(self):
     host = self.store.host
     storage = self.api.get(schema.HostStorage, base=host)
     assert isinstance(storage, schema.HostStorage)
     for stor in storage:
         assert isinstance(stor, schema.Storage)
         assert util.is_str(stor.id)
         assert util.is_str_href(stor.href)
         assert stor.type in ('ISCSI', 'FCP')
         assert stor.host is not None
         assert util.is_str_int(stor.host.id) or \
                     util.is_str_uuid(stor.host.id)
         assert util.is_str_href(stor.host.href)
         assert bool(stor.logical_unit) != bool(stor.volume_group)
         if stor.logical_unit:
             assert stor.logical_unit.id == stor.id
         else:
             assert stor.volume_group.id == stor.id
         # BUG: missing attributes
         if stor.type == 'ISCSI':
             assert util.is_str(stor.target)
         assert util.is_int(stor.size)
         if stor.logical_unit:
             assert util.is_int(stor.multipathing)
         elif stor.volume_group:
             assert util.is_str(volume_group.name)
             assert volume_group.logical_unit is not None
예제 #2
0
 def test_attributes(self):
     user = self.api.reload(self.store.user)
     assert isinstance(user, schema.User)
     assert util.is_str_uuid(user.id)
     assert util.is_str_href(user.href)
     assert util.is_str(user.name) and len(user.name) > 0
     assert user.description is None or util.is_str(user.description)
예제 #3
0
 def _test_network_attributes(self):
     cluster = self.store.cluster
     network = self.store.network
     atnetwork = self.store.atnetwork
     assert isinstance(atnetwork, schema.Network)
     assert util.is_str_uuid(atnetwork.id)
     assert atnetwork.id == network.id
     assert util.is_str_href(atnetwork.href)
     assert atnetwork.href != network.href
     assert atnetwork.href.startswith(cluster.href)
     assert atnetwork.href.endswith(network.id)
     assert util.is_str(atnetwork.name) and len(atnetwork.name) > 0
     assert atnetwork.name == network.name
     assert util.is_str(atnetwork.description) and len(atnetwork.description) > 0
     assert atnetwork.description == network.description
     assert atnetwork.status in ('OPERATIONAL', 'NON_OPERATIONAL')
     assert isinstance(atnetwork.data_center, schema.DataCenter)
     assert atnetwork.data_center.id == network.data_center.id
     assert isinstance(atnetwork.cluster, schema.Cluster)
     assert atnetwork.cluster.id == cluster.id
     assert util.is_bool(atnetwork.stp)
     assert atnetwork.stp == network.stp
     assert util.is_bool(atnetwork.display)
     assert isinstance(atnetwork.vlan, schema.VLAN)
     assert util.is_int(atnetwork.vlan.id)
     assert atnetwork.vlan.id == network.vlan.id
     assert isinstance(atnetwork.ip, schema.IP)
     assert util.is_str_ip(atnetwork.ip.address)
     assert util.is_str_ip(atnetwork.ip.netmask)
     assert util.is_str_ip(atnetwork.ip.gateway)
     assert atnetwork.ip.address == network.ip.address
     assert atnetwork.ip.netmask == network.ip.netmask
     assert atnetwork.ip.gateway == network.ip.gateway
예제 #4
0
 def test_attributes(self):
     template = self.store.template
     template = self.api.reload(template)
     assert util.is_str_uuid(template.id)
     assert util.is_str_href(template.href)
     assert util.is_str(template.name) and template.name
     if template.description:
         assert util.is_str(template.description)
     assert template.type in ('SERVER', 'DESKTOP')
     assert template.status in ('ILLEGAL', 'LOCKED', 'OK')
     assert template.origin in ('RHEV', 'VMWARE', 'XEN')
     assert isinstance(template.creation_time, datetime.datetime)
     assert util.is_int(template.memory)
     assert template.memory > 0
     assert template.cpu is not None
     assert template.cpu.topology is not None
     assert util.is_int(template.cpu.topology.cores)
     assert template.cpu.topology.cores > 0
     assert util.is_int(template.cpu.topology.sockets)
     assert template.cpu.topology.sockets > 0
     assert template.display is not None
     assert template.display.type in ('VNC', 'SPICE')
     assert util.is_int(template.display.monitors)
     assert template.display.monitors > 0
     assert template.os is not None
     assert util.is_str(template.os.type)
     assert template.os.boot is not None
     # Upper case?
     for dev in template.os.boot:
         assert dev.dev in ('cdrom', 'hd', 'network')
     assert util.is_bool(template.stateless)
     assert template.cluster is not None
     assert util.is_str_int(template.cluster.id) or util.is_str_uuid(template.cluster.id)
예제 #5
0
 def test_attributes(self):
     role = self.api.reload(self.store.role)
     assert isinstance(role, schema.Role)
     assert util.is_str_uuid(role.id)
     assert util.is_str_href(role.href)
     assert util.is_str(role.name) and len(role.name) > 0
     assert util.is_str(role.description)
예제 #6
0
 def test_attributes(self):
     pool = self.store.pool
     pool = self.api.reload(pool)
     assert util.is_str_int(pool.id) or util.is_str_uuid(pool.id)
     assert util.is_str_href(pool.href)
     assert util.is_str(pool.name) and pool.name
     if pool.description:
         assert util.is_str(pool.description)
예제 #7
0
 def test_cdrom_attributes(self):
     cdroms = self.store.cdrom
     for cdrom in cdroms:
         assert isinstance(cdrom, schema.CdRom)
         assert cdrom.id is not None
         assert util.is_str_href(cdrom.href) and \
                 cdrom.href.endswith(cdrom.id)
         if cdrom.file:
             assert util.is_str(cdrom.file) and len(cdrom.file) > 0
예제 #8
0
 def _test_file_attributes(self):
     dc = self.store.dc
     files = self.api.getall(schema.Files, base=dc)
     for file in files:
         assert util.is_str(file.id) and len(file.id) > 0
         assert util.is_str_href(file.href) and file.href.endswith(file.id)
         assert util.is_str(file.name)
         assert file.type in ('iso', 'vfd')
         assert isinstance(file.data_center, schema.DataCenter)
         assert file.data_center.id == dc.id
예제 #9
0
 def test_attributes(self):
     tag = self.api.reload(self.store.tag)
     assert isinstance(tag, schema.Tag)
     assert util.is_str_int(tag.id) or util.is_str_uuid(tag.id)
     assert util.is_str_href(tag.href)
     assert util.is_str(tag.name) and tag.name
     if tag.description:
         assert util.is_str(tag.description)
     assert tag.parent is not None
     assert isinstance(tag.parent.tag, schema.Tag)
     assert util.is_str_int(tag.parent.tag.id) or \
             util.is_str_uuid(tag.parent.tag.id)
예제 #10
0
 def test_attributes(self):
     vm = self.store.vm
     vm = self.api.reload(vm)
     assert util.is_str_uuid(vm.id)
     assert util.is_str_href(vm.href)
     assert util.is_str(vm.name)
     assert vm.description is None or util.is_str(vm.description)
     assert vm.type in ('SERVER', 'DESKTOP')
     assert vm.status in ('UNASSIGNED', 'DOWN', 'UP', 'POWERING_UP',
             'POWERED_DOWN', 'PAUSED', 'MIGRATING_FROM', 'MIGRATING_TO',
             'UNKNOWN', 'NOT_RESPONDING', 'WAIT_FOR_LAUNCH',
             'REBOOT_IN_PROGRESS', 'SAVING_STATE', 'RESTORING_STATE',
             'SUSPENDED', 'IMAGE_ILLEGAL', 'IMAGE_LOCKED', 'POWERING_DOWN')
     assert vm.origin in ('RHEV', 'VMWARE', 'XEN')
     assert util.is_date(vm.creation_time)
     assert util.is_int(vm.memory) and vm.memory > 0
     assert vm.cpu is not None
     assert vm.cpu.topology is not None
     assert util.is_int(vm.cpu.topology.cores)
     assert vm.cpu.topology.cores > 0
     assert util.is_int(vm.cpu.topology.sockets)
     assert vm.cpu.topology.sockets > 0
     assert vm.display is not None
     assert vm.display.type in ('VNC', 'SPICE')
     if vm.status == 'UP':
         assert util.is_int(vm.display.port)
         assert vm.display.port > 0
         assert util.is_str_host(vm.display.address)
     assert util.is_int(vm.display.monitors)
     assert vm.display.monitors > 0
     assert vm.os is not None
     assert util.is_str(vm.os.type)
     assert vm.os.boot is not None
     for dev in vm.os.boot:
         assert dev.dev in ('cdrom', 'hd', 'network')
     assert util.is_bool(vm.stateless)
     if vm.host is not None:
         assert util.is_str_int(vm.host.id) or util.is_str_uuid(vm.host.id)
     assert vm.cluster is not None
     assert util.is_str_int(vm.cluster.id) or util.is_str_uuid(vm.cluster.id)
     assert vm.template is not None
     assert util.is_str_uuid(vm.template.id)
     if vm.vmpool is not None:
         assert util.is_str_uuid(vm.vmpool.id)