示例#1
0
    def test_create_host_existed(self):
        unity = t_unity()

        def f():
            # the 'flocker-3' is the Host_10 name
            unity.create_host("flocker-3")
        assert_that(f, raises(UnityHostNameInUseError))
示例#2
0
    def test_create_host_existed(self):
        unity = t_unity()

        def f():
            # the 'flocker-3' is the Host_10 name
            unity.create_host("flocker-3")

        assert_that(f, raises(UnityHostNameInUseError))
示例#3
0
 def test_get_initiator_by_name(self):
     unity = t_unity()
     wwn = "50:00:14:40:47:B0:0C:44:50:00:14:42:D0:0C:44:10"
     filtered = unity.get_initiator(initiator_id=wwn)
     assert_that(len(filtered), equal_to(1))
     assert_that(filtered, instance_of(UnityHostInitiatorList))
     initiator = filtered.first_item
     assert_that(initiator, instance_of(UnityHostInitiator))
     assert_that(initiator.existed, equal_to(True))
     assert_that(initiator.initiator_id, equal_to(wwn))
示例#4
0
 def test_get_initiator_by_name(self):
     unity = t_unity()
     wwn = "50:00:14:40:47:B0:0C:44:50:00:14:42:D0:0C:44:10"
     filtered = unity.get_initiator(initiator_id=wwn)
     assert_that(len(filtered), equal_to(1))
     assert_that(filtered, instance_of(UnityHostInitiatorList))
     initiator = filtered.first_item
     assert_that(initiator, instance_of(UnityHostInitiator))
     assert_that(initiator.existed, equal_to(True))
     assert_that(initiator.initiator_id, equal_to(wwn))
示例#5
0
    def test_get_capability_profile_service_levels(self):
        unity = t_unity()
        level_s = ServiceLevelEnum.SILVER
        level_p = ServiceLevelEnum.PLATINUM
        cp = unity.get_capability_profile(service_levels=[level_s, level_p])
        assert_that(cp, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp), 2)

        # use Enum or EnumList are both ok
        cp2 = unity.get_capability_profile(service_levels=level_s)
        assert_that(cp2, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp2), 1)
        assert_that(cp2[0].existed, equal_to(True))

        level_enum_list = ServiceLevelEnumList.parse([level_s, level_p])
        assert_that(level_enum_list, instance_of(ServiceLevelEnumList))
        cp3 = unity.get_capability_profile(service_levels=level_enum_list)
        assert_that(cp3, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp3), 2)
        assert_that(cp3[0].existed, equal_to(True))
示例#6
0
    def test_get_capability_profile_service_levels(self):
        unity = t_unity()
        level_s = ServiceLevelEnum.SILVER
        level_p = ServiceLevelEnum.PLATINUM
        cp = unity.get_capability_profile(service_levels=[level_s, level_p])
        assert_that(cp, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp), 2)

        # use Enum or EnumList are both ok
        cp2 = unity.get_capability_profile(service_levels=level_s)
        assert_that(cp2, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp2), 1)
        assert_that(cp2[0].existed, equal_to(True))

        level_enum_list = ServiceLevelEnumList.parse([level_s, level_p])
        assert_that(level_enum_list, instance_of(ServiceLevelEnumList))
        cp3 = unity.get_capability_profile(service_levels=level_enum_list)
        assert_that(cp3, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp3), 2)
        assert_that(cp3[0].existed, equal_to(True))
示例#7
0
    def test_get_capability_profile_usage_tags(self):
        unity = t_unity()
        tag = "capacity"
        cp = unity.get_capability_profile(usage_tags=tag)
        assert_that(cp, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp), 1)
        assert_that(cp[0].existed, equal_to(True))
        assert_that(tag, is_in(cp[0].usage_tags))

        cp2 = unity.get_capability_profile(usage_tags=[tag])
        assert_that(cp2, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp2), 1)
        assert_that(cp2[0].existed, equal_to(True))
        assert_that(tag, is_in(cp2[0].usage_tags))

        # None tags will not pass to rest url
        # it's same with get_capability_profile()
        cp3 = unity.get_capability_profile(usage_tags=None)
        assert_that(cp3, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp3), 2)
        assert_that(cp3[0].existed, equal_to(True))
示例#8
0
    def test_get_capability_profile_usage_tags(self):
        unity = t_unity()
        tag = "capacity"
        cp = unity.get_capability_profile(usage_tags=tag)
        assert_that(cp, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp), 1)
        assert_that(cp[0].existed, equal_to(True))
        assert_that(tag, is_in(cp[0].usage_tags))

        cp2 = unity.get_capability_profile(usage_tags=[tag])
        assert_that(cp2, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp2), 1)
        assert_that(cp2[0].existed, equal_to(True))
        assert_that(tag, is_in(cp2[0].usage_tags))

        # None tags will not pass to rest url
        # it's same with get_capability_profile()
        cp3 = unity.get_capability_profile(usage_tags=None)
        assert_that(cp3, instance_of(UnityCapabilityProfileList))
        assert_that(len(cp3), 2)
        assert_that(cp3[0].existed, equal_to(True))
示例#9
0
 def test_get_initiator_by_id(self):
     unity = t_unity()
     initiator = unity.get_initiator(_id="HostInitiator_2")
     assert_that(initiator, instance_of(UnityHostInitiator))
     assert_that(initiator.id, equal_to("HostInitiator_2"))
示例#10
0
 def test_get_host_list(self):
     unity = t_unity()
     hosts = unity.get_host()
     assert_that(hosts, instance_of(UnityHostList))
     assert_that(len(hosts), equal_to(7))
示例#11
0
 def test_get_spa(self):
     unity = t_unity()
     sp = unity.get_sp('spa')
     assert_that(sp, instance_of(UnityStorageProcessor))
     assert_that(sp.get_id(), equal_to('spa'))
示例#12
0
 def test_get_doc_enum_member(self):
     unity = t_unity()
     doc = unity.get_doc(HealthEnum.NON_RECOVERABLE)
     assert_that(doc, contains_string('OK But Minor Warning'))
示例#13
0
 def test_get_host_by_address_not_found(self):
     unity = t_unity()
     hosts = unity.get_host(address='8.8.8.9')
     assert_that(len(hosts), equal_to(0))
示例#14
0
 def test_get_dns_server(self):
     unity = t_unity()
     dns_servers = unity.get_dns_server()
     assert_that(dns_servers, instance_of(UnityFileDnsServerList))
     assert_that(len(dns_servers), equal_to(1))
示例#15
0
 def test_create_nas_server(self):
     unity = t_unity()
     sp = unity.get_sp(_id='spa')
     pool = unity.get_pool(_id='pool_1')
     nas_server = unity.create_nas_server('nas3', sp, pool)
     assert_that(nas_server.existed, equal_to(True))
示例#16
0
 def test_get_file_interface(self):
     unity = t_unity()
     fi_list = unity.get_file_interface()
     assert_that(fi_list, instance_of(UnityFileInterfaceList))
     assert_that(len(fi_list), equal_to(1))
示例#17
0
 def test_get_ip_ports(self):
     unity = t_unity()
     ip_ports = unity.get_ip_port()
     assert_that(ip_ports, instance_of(UnityIpPortList))
     assert_that(len(ip_ports), equal_to(8))
示例#18
0
 def test_create_nas_server(self):
     unity = t_unity()
     sp = unity.get_sp(_id='spa')
     pool = unity.get_pool(_id='pool_1')
     nas_server = unity.create_nas_server('nas3', sp, pool)
     assert_that(nas_server.existed, equal_to(True))
示例#19
0
 def test_get_nas_servers(self):
     unity = t_unity()
     nas_servers = unity.get_nas_server()
     assert_that(nas_servers, instance_of(UnityNasServerList))
     assert_that(len(nas_servers), equal_to(3))
示例#20
0
 def test_get_snap_by_name(self):
     unity = t_unity()
     snap = unity.get_snap(name='2016-03-15_10:56:08')
     assert_that(snap.name, equal_to('2016-03-15_10:56:08'))
     assert_that(snap.existed, equal_to(True))
示例#21
0
 def test_get_snaps_all(self):
     unity = t_unity()
     snaps = unity.get_snap()
     assert_that(snaps, instance_of(UnitySnapList))
     assert_that(len(snaps), equal_to(3))
示例#22
0
 def test_get_pools(self):
     unity = t_unity()
     pools = unity.get_pool()
     assert_that(pools, instance_of(UnityPoolList))
     assert_that(len(pools), equal_to(2))
示例#23
0
 def test_get_snap_by_name(self):
     unity = t_unity()
     snap = unity.get_snap(name='2016-03-15_10:56:08')
     assert_that(snap.name, equal_to('2016-03-15_10:56:08'))
     assert_that(snap.existed, equal_to(True))
示例#24
0
 def test_get_nfs_server(self):
     unity = t_unity()
     nfs_servers = unity.get_nfs_server()
     assert_that(nfs_servers, instance_of(UnityNfsServerList))
     assert_that(len(nfs_servers), equal_to(1))
示例#25
0
 def test_get_file_interface(self):
     unity = t_unity()
     fi_list = unity.get_file_interface()
     assert_that(fi_list, instance_of(UnityFileInterfaceList))
     assert_that(len(fi_list), equal_to(1))
示例#26
0
 def test_get_dns_server(self):
     unity = t_unity()
     dns_servers = unity.get_dns_server()
     assert_that(dns_servers, instance_of(UnityFileDnsServerList))
     assert_that(len(dns_servers), equal_to(1))
示例#27
0
 def test_get_nfs_share(self):
     unity = t_unity()
     shares = unity.get_nfs_share()
     assert_that(shares, instance_of(UnityNfsShareList))
     assert_that(len(shares), equal_to(2))
示例#28
0
 def test_get_file_system(self):
     unity = t_unity()
     filesystems = unity.get_filesystem()
     assert_that(filesystems, instance_of(UnityFileSystemList))
     assert_that(len(filesystems), equal_to(3))
示例#29
0
 def test_system_get_cifs_share_by_name(self):
     unity = t_unity()
     cs = unity.get_cifs_share(name='cs1')
     assert_that(cs, instance_of(UnityCifsShare))
     assert_that(cs.name, equal_to('cs1'))
示例#30
0
 def test_get_nfs_share(self):
     unity = t_unity()
     shares = unity.get_nfs_share()
     assert_that(shares, instance_of(UnityNfsShareList))
     assert_that(len(shares), equal_to(2))
示例#31
0
 def test_get_doc_resource(self):
     unity = t_unity()
     doc = unity.get_doc(unity.get_snap())
     assert_that(
         doc, contains_string('For a file system or VMware NFS datastore'))
示例#32
0
 def test_get_host_by_address_found(self):
     unity = t_unity()
     host = unity.get_host(address='8.8.8.8')
     assert_that(host.type, equal_to(HostTypeEnum.SUBNET))
示例#33
0
 def test_get_pools(self):
     unity = t_unity()
     pools = unity.get_pool()
     assert_that(pools, instance_of(UnityPoolList))
     assert_that(len(pools), equal_to(2))
示例#34
0
 def test_get_host_by_address_not_found(self):
     unity = t_unity()
     hosts = unity.get_host(address='8.8.8.9')
     assert_that(len(hosts), equal_to(0))
示例#35
0
 def test_get_initiators(self):
     unity = t_unity()
     initiators = unity.get_initiator()
     assert_that(initiators, instance_of(UnityHostInitiatorList))
     assert_that(len(initiators), equal_to(4))
示例#36
0
 def test_system_info(self):
     unity = t_unity()
     assert_that(unity.info, instance_of(UnityBasicSystemInfo))
示例#37
0
 def test_get_portal_list(self):
     unity = t_unity()
     portals = unity.get_iscsi_portal()
     assert_that(portals, instance_of(UnityIscsiPortalList))
示例#38
0
 def test_system_get_cifs_share_by_name(self):
     unity = t_unity()
     cs = unity.get_cifs_share(name='cs1')
     assert_that(cs, instance_of(UnityCifsShare))
     assert_that(cs.name, equal_to('cs1'))
示例#39
0
 def test_get_snaps_all(self):
     unity = t_unity()
     snaps = unity.get_snap()
     assert_that(snaps, instance_of(UnitySnapList))
     assert_that(len(snaps), equal_to(3))
示例#40
0
 def f():
     unity = t_unity()
     unity.get_filesystem(name='not_found')
示例#41
0
 def test_get_nas_servers(self):
     unity = t_unity()
     nas_servers = unity.get_nas_server()
     assert_that(nas_servers, instance_of(UnityNasServerList))
     assert_that(len(nas_servers), equal_to(3))
示例#42
0
 def test_get_doc_enum_member(self):
     unity = t_unity()
     doc = unity.get_doc(HealthEnum.NON_RECOVERABLE)
     assert_that(doc, contains_string('OK But Minor Warning'))
示例#43
0
 def test_get_ip_ports(self):
     unity = t_unity()
     ip_ports = unity.get_ip_port()
     assert_that(ip_ports, instance_of(UnityIpPortList))
     assert_that(len(ip_ports), equal_to(8))
示例#44
0
 def test_get_doc_enum(self):
     unity = t_unity()
     doc = unity.get_doc(HealthEnum)
     assert_that(doc, contains_string('OK But Minor Warning'))
示例#45
0
 def test_get_nfs_server(self):
     unity = t_unity()
     nfs_servers = unity.get_nfs_server()
     assert_that(nfs_servers, instance_of(UnityNfsServerList))
     assert_that(len(nfs_servers), equal_to(1))
示例#46
0
 def test_get_doc_resource(self):
     unity = t_unity()
     doc = unity.get_doc(unity.get_snap())
     assert_that(doc, contains_string(
         'For a file system or VMware NFS datastore'))
示例#47
0
 def test_get_file_system(self):
     unity = t_unity()
     filesystems = unity.get_filesystem()
     assert_that(filesystems, instance_of(UnityFileSystemList))
     assert_that(len(filesystems), equal_to(3))
示例#48
0
 def test_get_sp_all(self):
     unity = t_unity()
     sps = unity.get_sp()
     assert_that(sps, instance_of(UnityStorageProcessorList))
     assert_that(len(sps), equal_to(2))
示例#49
0
 def test_get_host_by_address_found(self):
     unity = t_unity()
     host = unity.get_host(address='8.8.8.8')
     assert_that(host.type, equal_to(HostTypeEnum.SUBNET))
示例#50
0
 def test_get_spa(self):
     unity = t_unity()
     sp = unity.get_sp('spa')
     assert_that(sp, instance_of(UnityStorageProcessor))
     assert_that(sp.get_id(), equal_to('spa'))
示例#51
0
 def test_system_info(self):
     unity = t_unity()
     assert_that(unity.info, instance_of(UnityBasicSystemInfo))
示例#52
0
 def test_get_initiators(self):
     unity = t_unity()
     initiators = unity.get_initiator()
     assert_that(initiators, instance_of(UnityHostInitiatorList))
     assert_that(len(initiators), equal_to(4))
示例#53
0
 def f():
     unity = t_unity()
     unity.get_filesystem(name='not_found')
示例#54
0
 def test_get_host_list(self):
     unity = t_unity()
     hosts = unity.get_host()
     assert_that(hosts, instance_of(UnityHostList))
     assert_that(len(hosts), equal_to(7))
示例#55
0
 def test_get_doc_enum(self):
     unity = t_unity()
     doc = unity.get_doc(HealthEnum)
     assert_that(doc, contains_string('OK But Minor Warning'))
示例#56
0
 def test_get_ethernet_list(self):
     unity = t_unity()
     ports = unity.get_ethernet_port()
     assert_that(ports, instance_of(UnityEthernetPortList))
示例#57
0
 def test_get_sp_all(self):
     unity = t_unity()
     sps = unity.get_sp()
     assert_that(sps, instance_of(UnityStorageProcessorList))
     assert_that(len(sps), equal_to(2))
示例#58
0
 def test_get_portal_list(self):
     unity = t_unity()
     portals = unity.get_iscsi_portal()
     assert_that(portals, instance_of(UnityIscsiPortalList))
示例#59
0
 def test_get_ethernet_list(self):
     unity = t_unity()
     ports = unity.get_ethernet_port()
     assert_that(ports, instance_of(UnityEthernetPortList))
示例#60
0
 def test_get_initiator_by_id(self):
     unity = t_unity()
     initiator = unity.get_initiator(_id="HostInitiator_2")
     assert_that(initiator, instance_of(UnityHostInitiator))
     assert_that(initiator.id, equal_to("HostInitiator_2"))