def f(): host_config = NfsHostConfig(root_hosts=['1.1.1.1', '2.2.2.2'], ro_hosts=['3.3.3.3'], rw_hosts=['4.4.4.4', '5.5.5.5'], access_hosts=['6.6.6.6']) mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/not_found') share.modify(ro=False, host_config=host_config)
def f(): host_config = NfsHostConfig( root_hosts=['1.1.1.1', '2.2.2.2'], ro_hosts=['3.3.3.3'], rw_hosts=['4.4.4.4', '5.5.5.5'], access_hosts=['6.6.6.6']) mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/not_found') share.modify(ro=False, host_config=host_config)
def test_create_success(self): mover = self.get_mover_1() share = VNXNfsShare.create(cli=t_nas(), mover=mover, path='/EEE') assert_that(share.path, equal_to('/EEE')) assert_that(share.mover_id, equal_to(1)) assert_that(share.existed, equal_to(True)) assert_that(share.fs_id, equal_to(243))
def test_create_with_host_config(self): mover = self.get_mover_1() host_config = NfsHostConfig( root_hosts=['1.1.1.1', '2.2.2.2'], ro_hosts=['3.3.3.3'], rw_hosts=['4.4.4.4', '5.5.5.5'], access_hosts=['6.6.6.6']) share = VNXNfsShare.create(cli=t_nas(), mover=mover, path='/FFF', host_config=host_config) assert_that(share.fs_id, equal_to(247)) assert_that(share.path, equal_to('/FFF')) assert_that(share.existed, equal_to(True)) assert_that(share.access_hosts, has_item('6.6.6.6'))
def test_create_with_host_config(self): mover = self.get_mover_1() host_config = NfsHostConfig(root_hosts=['1.1.1.1', '2.2.2.2'], ro_hosts=['3.3.3.3'], rw_hosts=['4.4.4.4', '5.5.5.5'], access_hosts=['6.6.6.6']) share = VNXNfsShare.create(cli=t_nas(), mover=mover, path='/FFF', host_config=host_config) assert_that(share.fs_id, equal_to(247)) assert_that(share.path, equal_to('/FFF')) assert_that(share.existed, equal_to(True)) assert_that(share.access_hosts, has_item('6.6.6.6'))
def test_get_share_by_mover_id(self): mover = self.get_mover_1() shares = VNXNfsShare.get(t_nas(), mover=mover) assert_that(len(shares), equal_to(24)) share = next(s for s in shares if s.path == '/EEE') self.verify_share_eee(share)
def test_get_share_by_path_success(self): path = '/EEE' shares = VNXNfsShare.get(t_nas(), path=path) assert_that(len(shares), equal_to(1)) share = next(s for s in shares if s.path == path) self.verify_share_eee(share)
def test_mover_property(self): mover = self.get_mover_1() share = VNXNfsShare.get(cli=t_nas(), mover=mover, path='/EEE') mover = share.mover assert_that(mover.existed, equal_to(True)) assert_that(mover.role, equal_to('primary'))
def test_deny_hosts(self): mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/minjie_fs2') resp = share.deny_access('1.1.1.1', '2.2.2.2') assert_that(resp.is_ok(), equal_to(True))
def test_mover_property(self): mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/EEE') mover = share.mover assert_that(mover.existed, equal_to(True)) assert_that(mover.role, equal_to('primary'))
def test_modify_success(self): host_config = NfsHostConfig(access_hosts=['7.7.7.7']) mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/EEE') resp = share.modify(ro=True, host_config=host_config) assert_that(resp.is_ok(), equal_to(True))
def test_delete_success(self): mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/EEE') resp = share.delete() assert_that(resp.is_ok(), equal_to(True))
def test_get_share_by_path(self): path = '/EEE' shares = VNXNfsShare.get(t_nas(), path=path) assert_that(len(shares), equal_to(1)) share = next(s for s in shares if s.path == path) self.verify_share_eee(share)
def test_get_all_share(self): shares = VNXNfsShare.get(t_nas()) assert_that(len(shares), equal_to(26)) share = next(s for s in shares if s.path == '/EEE') self.verify_share_eee(share)
def test_fs_property(self): mover = self.get_mover_1() share = VNXNfsShare.get(cli=t_nas(), mover=mover, path='/EEE') fs = share.fs assert_that(fs.existed, equal_to(True)) assert_that(fs.fs_id, equal_to(243))
def test_remove_success(self): mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/EEE') resp = share.remove() assert_that(resp.is_ok(), equal_to(True))
def f(): mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/not_found') share.remove()
def test_fs_property(self): mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/EEE') fs = share.fs assert_that(fs.existed, equal_to(True)) assert_that(fs.fs_id, equal_to(243))
def get_nfs_share(self, mover=None, path=None): return VNXNfsShare.get(cli=self._file_cli, mover=mover, path=path)
def f(): mover = self.get_mover_1() VNXNfsShare.create(cli=t_nas(), mover=mover, path='/invalid')
def f(): mover = self.get_mover_1() share = VNXNfsShare(cli=t_nas(), mover=mover, path='/not_found') share.delete()
def f(): path = '/EEE' shares = VNXNfsShare.get(t_nas(), path=path) assert_that(len(shares), equal_to(1))