當前位置: 首頁>>代碼示例>>Python>>正文


Python NailgunClient.add_syslog_server方法代碼示例

本文整理匯總了Python中fuelweb_test.models.nailgun_client.NailgunClient.add_syslog_server方法的典型用法代碼示例。如果您正苦於以下問題:Python NailgunClient.add_syslog_server方法的具體用法?Python NailgunClient.add_syslog_server怎麽用?Python NailgunClient.add_syslog_server使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fuelweb_test.models.nailgun_client.NailgunClient的用法示例。


在下文中一共展示了NailgunClient.add_syslog_server方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import add_syslog_server [as 別名]
class FuelWebClient(object):
    def __init__(self, admin_node_ip, environment):
        self.admin_node_ip = admin_node_ip
        self.client = NailgunClient(admin_node_ip)
        self._environment = environment
        super(FuelWebClient, self).__init__()

    @property
    def environment(self):
        """Environment Model
        :rtype: EnvironmentModel
        """
        return self._environment

    @staticmethod
    @logwrap
    def get_cluster_status(ssh_remote, smiles_count, networks_count=1):
        checkers.verify_service_list(ssh_remote, smiles_count)
        checkers.verify_glance_index(ssh_remote)
        checkers.verify_network_list(networks_count, ssh_remote)

    @logwrap
    def _ostf_test_wait(self, cluster_id, timeout):
        wait(
            lambda: all([run["status"] == "finished" for run in self.client.get_ostf_test_run(cluster_id)]),
            timeout=timeout,
        )
        return self.client.get_ostf_test_run(cluster_id)

    @logwrap
    def _tasks_wait(self, tasks, timeout):
        return [self.task_wait(task, timeout) for task in tasks]

    @logwrap
    def add_syslog_server(self, cluster_id, host, port):
        self.client.add_syslog_server(cluster_id, host, port)

    @logwrap
    def assert_cluster_floating_list(self, node_name, expected_ips):
        current_ips = self.get_cluster_floating_list(node_name)
        assert_equal(set(expected_ips), set(current_ips))

    @logwrap
    def assert_cluster_ready(self, node_name, smiles_count, networks_count=1, timeout=300):
        remote = self.environment.get_ssh_to_remote(
            self.get_nailgun_node_by_devops_node(self.environment.get_virtual_environment().node_by_name(node_name))[
                "ip"
            ]
        )
        _wait(
            lambda: self.get_cluster_status(remote, smiles_count=smiles_count, networks_count=networks_count),
            timeout=timeout,
        )

    @logwrap
    def assert_ostf_run_certain(self, cluster_id, tests_must_be_passed, timeout=10 * 60):
        set_result_list = self._ostf_test_wait(cluster_id, timeout)
        tests_pass_count = 0
        tests_count = len(tests_must_be_passed)
        result = False
        for set_result in set_result_list:
            success = [test for test in set_result["tests"] if test["status"] == "success"]
            for test_id in success:
                for test_class in tests_must_be_passed:
                    if test_id["id"].find(test_class) > -1:
                        tests_pass_count += 1
                        logger.debug("Passed OSTF test {} found".format(test_class))
        if tests_pass_count == tests_count:
            result = True
        assert_true(result)

    @logwrap
    def assert_ostf_run(self, cluster_id, should_fail=0, failed_test_name=None, timeout=15 * 60):

        set_result_list = self._ostf_test_wait(cluster_id, timeout)
        failed_tests_res = []
        failed = 0
        actual_failed_names = []
        test_result = {}
        for set_result in set_result_list:

            failed += len(
                filter(lambda test: test["status"] == "failure" or test["status"] == "error", set_result["tests"])
            )

            [actual_failed_names.append(test["name"]) for test in set_result["tests"] if test["status"] != "success"]

            [test_result.update({test["name"]: test["status"]}) for test in set_result["tests"]]

            [
                failed_tests_res.append({test["name"]: test["message"]})
                for test in set_result["tests"]
                if test["status"] != "success"
            ]

        logger.info("OSTF test statuses are : {0}".format(test_result))

        if failed_test_name:
            for test_name in failed_test_name:
                assert_true(
#.........這裏部分代碼省略.........
開發者ID:piousbox,項目名稱:fuel-main,代碼行數:103,代碼來源:fuel_web_client.py

示例2: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import add_syslog_server [as 別名]
class FuelWebClient(object):

    def __init__(self, admin_node_ip, environment):
        self.admin_node_ip = admin_node_ip
        self.client = NailgunClient(admin_node_ip)
        self._environment = environment
        super(FuelWebClient, self).__init__()

    @property
    def environment(self):
        """
        :rtype: EnvironmentModel
        """
        return self._environment

    @staticmethod
    @logwrap
    def get_cluster_status(ssh_remote, smiles_count, networks_count=1):
        verify_service_list(ssh_remote, smiles_count)
        verify_glance_index(ssh_remote)
        verify_network_list(networks_count, ssh_remote)

    @logwrap
    def _ostf_test_wait(self, cluster_id, timeout):
        wait(
            lambda: all([run['status'] == 'finished'
                         for run in
                         self.client.get_ostf_test_run(cluster_id)]),
            timeout=timeout)
        return self.client.get_ostf_test_run(cluster_id)

    @logwrap
    def _tasks_wait(self, tasks, timeout):
        return [self.task_wait(task, timeout) for task in tasks]

    @logwrap
    def add_syslog_server(self, cluster_id, host, port):
        self.client.add_syslog_server(cluster_id, host, port)

    @logwrap
    def assert_cluster_floating_list(self, node_name, expected_ips):
        current_ips = self.get_cluster_floating_list(node_name)
        assert_equal(set(expected_ips), set(current_ips))

    @logwrap
    def assert_cluster_ready(self, node_name, smiles_count,
                             networks_count=1, timeout=300):
        remote = self.environment.get_ssh_to_remote(
            self.get_nailgun_node_by_devops_node(
                self.environment.get_virtual_environment().
                node_by_name(node_name))['ip']
        )
        _wait(
            lambda: self.get_cluster_status(
                remote,
                smiles_count=smiles_count,
                networks_count=networks_count),
            timeout=timeout)

    @logwrap
    def assert_ostf_run(self, cluster_id, should_fail=0, should_pass=0,
                        timeout=10 * 60):

        set_result_list = self._ostf_test_wait(cluster_id, timeout)

        passed = 0
        failed = 0
        for set_result in set_result_list:
            passed += len(filter(lambda test: test['status'] == 'success',
                                 set_result['tests']))
            failed += len(
                filter(
                    lambda test: test['status'] == 'failure' or
                    test['status'] == 'error',
                    set_result['tests']
                )
            )
        assert_true(
            passed >= should_pass, 'Passed tests, pass: {} should pass: {}'
                                   ''.format(passed, should_pass))
        assert_true(
            failed <= should_fail, 'Failed tests,  fails: {} should fail: {}'
                                   ''.format(failed, should_fail))

    def assert_release_state(self, release_name, state='available'):
        for release in self.client.get_releases():
            if release["name"].find(release_name) != -1:
                assert_equal(release['state'], state)
                return release["id"]

    @logwrap
    def assert_task_success(self, task, timeout=110 * 60, interval=5):
        task = self.task_wait(task, timeout, interval)
        assert_equal(
            task['status'], 'ready',
            "Task '{name}' has incorrect status. {} != {}".format(
                task['status'], 'ready', name=task["name"]
            )
        )

#.........這裏部分代碼省略.........
開發者ID:korshenin,項目名稱:fuel-main,代碼行數:103,代碼來源:fuel_web_client.py

示例3: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import add_syslog_server [as 別名]
class FuelWebClient(object):

    def __init__(self, admin_node_ip, environment):
        self.admin_node_ip = admin_node_ip
        self.client = NailgunClient(admin_node_ip)
        self._environment = environment
        super(FuelWebClient, self).__init__()

    @property
    def environment(self):
        """Environment Model
        :rtype: EnvironmentModel
        """
        return self._environment

    @staticmethod
    @logwrap
    def get_cluster_status(ssh_remote, smiles_count, networks_count=1):
        checkers.verify_service_list(ssh_remote, smiles_count)
        checkers.verify_glance_index(ssh_remote)
        checkers.verify_network_list(networks_count, ssh_remote)

    @logwrap
    def _ostf_test_wait(self, cluster_id, timeout):
        logger.info('Wait OSTF tests at cluster #%s for %s seconds',
                    cluster_id, timeout)
        wait(
            lambda: all([run['status'] == 'finished'
                         for run in
                         self.client.get_ostf_test_run(cluster_id)]),
            timeout=timeout)
        return self.client.get_ostf_test_run(cluster_id)

    @logwrap
    def _tasks_wait(self, tasks, timeout):
        return [self.task_wait(task, timeout) for task in tasks]

    @logwrap
    def add_syslog_server(self, cluster_id, host, port):
        logger.info('Add syslog server %s:%s to cluster #%s',
                    host, port, cluster_id)
        self.client.add_syslog_server(cluster_id, host, port)

    @logwrap
    def assert_cluster_floating_list(self, node_name, expected_ips):
        logger.info('Assert floating IPs at node %s. Expected %s',
                    node_name, expected_ips)
        current_ips = self.get_cluster_floating_list(node_name)
        assert_equal(set(expected_ips), set(current_ips),
                     'Current floating IPs {0}'.format(current_ips))

    @logwrap
    def assert_cluster_ready(self, node_name, smiles_count,
                             networks_count=1, timeout=300):
        logger.info('Assert cluster services are UP')
        remote = self.environment.get_ssh_to_remote_by_name(node_name)
        _wait(
            lambda: self.get_cluster_status(
                remote,
                smiles_count=smiles_count,
                networks_count=networks_count),
            timeout=timeout)

    @logwrap
    def assert_ostf_run_certain(self, cluster_id, tests_must_be_passed,
                                timeout=10 * 60):
        logger.info('Assert OSTF tests are passed at cluster #%s: %s',
                    cluster_id, tests_must_be_passed)
        set_result_list = self._ostf_test_wait(cluster_id, timeout)
        tests_pass_count = 0
        tests_count = len(tests_must_be_passed)
        result = False
        for set_result in set_result_list:
            success = [test for test in set_result['tests']
                       if test['status'] == 'success']
            for test_id in success:
                for test_class in tests_must_be_passed:
                    if test_id['id'].find(test_class) > -1:
                        tests_pass_count += 1
                        logger.info('Passed OSTF tests %s found', test_class)
        if tests_pass_count == tests_count:
            result = True
        assert_true(result)

    @logwrap
    def assert_ostf_run(self, cluster_id, should_fail=0,
                        failed_test_name=None, timeout=15 * 60):
        logger.info('Assert OSTF run at cluster #%s. '
                    'Should fail %s tests named %s',
                    cluster_id, should_fail, failed_test_name)
        set_result_list = self._ostf_test_wait(cluster_id, timeout)
        failed_tests_res = []
        failed = 0
        actual_failed_names = []
        test_result = {}
        for set_result in set_result_list:

            failed += len(
                filter(
                    lambda test: test['status'] == 'failure' or
#.........這裏部分代碼省略.........
開發者ID:igajsin,項目名稱:fuel-main,代碼行數:103,代碼來源:fuel_web_client.py

示例4: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import add_syslog_server [as 別名]
class FuelWebClient(object):

    def __init__(self, admin_node_ip, environment):
        self.admin_node_ip = admin_node_ip
        self.client = NailgunClient(admin_node_ip)
        self._environment = environment
        super(FuelWebClient, self).__init__()

    @property
    def environment(self):
        """Environment Model
        :rtype: EnvironmentModel
        """
        return self._environment

    @staticmethod
    @logwrap
    def get_cluster_status(ssh_remote, smiles_count, networks_count=1):
        checkers.verify_service_list(ssh_remote, smiles_count)
        checkers.verify_glance_index(ssh_remote)
        checkers.verify_network_list(networks_count, ssh_remote)

    @logwrap
    def _ostf_test_wait(self, cluster_id, timeout):
        logger.info('Wait OSTF tests at cluster #%s for %s seconds',
                    cluster_id, timeout)
        wait(
            lambda: all([run['status'] == 'finished'
                         for run in
                         self.client.get_ostf_test_run(cluster_id)]),
            timeout=timeout)
        return self.client.get_ostf_test_run(cluster_id)

    @logwrap
    def _tasks_wait(self, tasks, timeout):
        return [self.task_wait(task, timeout) for task in tasks]

    @logwrap
    def add_syslog_server(self, cluster_id, host, port):
        logger.info('Add syslog server %s:%s to cluster #%s',
                    host, port, cluster_id)
        self.client.add_syslog_server(cluster_id, host, port)

    @logwrap
    def assert_cluster_floating_list(self, node_name, expected_ips):
        logger.info('Assert floating IPs at node %s. Expected %s',
                    node_name, expected_ips)
        current_ips = self.get_cluster_floating_list(node_name)
        assert_equal(set(expected_ips), set(current_ips),
                     'Current floating IPs {0}'.format(current_ips))

    @logwrap
    def assert_cluster_ready(self, node_name, smiles_count,
                             networks_count=1, timeout=300):
        logger.info('Assert cluster services are UP')
        remote = self.environment.get_ssh_to_remote(
            self.get_nailgun_node_by_devops_node(
                self.environment.get_virtual_environment().
                node_by_name(node_name))['ip']
        )
        _wait(
            lambda: self.get_cluster_status(
                remote,
                smiles_count=smiles_count,
                networks_count=networks_count),
            timeout=timeout)

    @logwrap
    def assert_ostf_run_certain(self, cluster_id, tests_must_be_passed,
                                timeout=10 * 60):
        logger.info('Assert OSTF tests are passed at cluster #%s: %s',
                    cluster_id, tests_must_be_passed)
        set_result_list = self._ostf_test_wait(cluster_id, timeout)
        tests_pass_count = 0
        tests_count = len(tests_must_be_passed)
        result = False
        for set_result in set_result_list:
            success = [test for test in set_result['tests']
                       if test['status'] == 'success']
            for test_id in success:
                for test_class in tests_must_be_passed:
                    if test_id['id'].find(test_class) > -1:
                        tests_pass_count += 1
                        logger.info('Passed OSTF tests %s found', test_class)
        if tests_pass_count == tests_count:
            result = True
        assert_true(result)

    @logwrap
    def assert_ostf_run(self, cluster_id, should_fail=0,
                        failed_test_name=None, timeout=15 * 60):
        logger.info('Assert OSTF run at cluster #%s. '
                    'Should fail %s tests named %s',
                    cluster_id, should_fail, failed_test_name)
        set_result_list = self._ostf_test_wait(cluster_id, timeout)
        failed_tests_res = []
        failed = 0
        actual_failed_names = []
        test_result = {}
        for set_result in set_result_list:
#.........這裏部分代碼省略.........
開發者ID:shaikapsar,項目名稱:fuel-main,代碼行數:103,代碼來源:fuel_web_client.py

示例5: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import add_syslog_server [as 別名]
class FuelWebClient(object):
    def __init__(self, admin_node_ip, environment):
        self.admin_node_ip = admin_node_ip
        self.client = NailgunClient(admin_node_ip)
        self._environment = environment
        super(FuelWebClient, self).__init__()

    @property
    def environment(self):
        """
        :rtype: EnvironmentModel
        """
        return self._environment

    @staticmethod
    @logwrap
    def get_cluster_status(ssh_remote, smiles_count, networks_count=1):
        verify_service_list(ssh_remote, smiles_count)
        verify_glance_index(ssh_remote)
        verify_network_list(networks_count, ssh_remote)

    @logwrap
    def _ostf_test_wait(self, cluster_id, timeout):
        wait(
            lambda: all([run["status"] == "finished" for run in self.client.get_ostf_test_run(cluster_id)]),
            timeout=timeout,
        )
        return self.client.get_ostf_test_run(cluster_id)

    @logwrap
    def _tasks_wait(self, tasks, timeout):
        return [self.task_wait(task, timeout) for task in tasks]

    @logwrap
    def add_syslog_server(self, cluster_id, host, port):
        self.client.add_syslog_server(cluster_id, host, port)

    @logwrap
    def assert_cluster_floating_list(self, node_name, expected_ips):
        current_ips = self.get_cluster_floating_list(node_name)
        assert_equal(set(expected_ips), set(current_ips))

    @logwrap
    def assert_cluster_ready(self, node_name, smiles_count, networks_count=1, timeout=300):
        remote = self.environment.get_ssh_to_remote(
            self.get_nailgun_node_by_devops_node(self.environment.get_virtual_environment().node_by_name(node_name))[
                "ip"
            ]
        )
        _wait(
            lambda: self.get_cluster_status(remote, smiles_count=smiles_count, networks_count=networks_count),
            timeout=timeout,
        )

    @logwrap
    def assert_ostf_run(self, cluster_id, should_fail=0, should_pass=0, timeout=10 * 60):

        set_result_list = self._ostf_test_wait(cluster_id, timeout)

        passed = 0
        failed = 0
        for set_result in set_result_list:
            passed += len(filter(lambda test: test["status"] == "success", set_result["tests"]))
            failed += len(
                filter(lambda test: test["status"] == "failure" or test["status"] == "error", set_result["tests"])
            )
        assert_true(passed >= should_pass, "Passed tests, pass: {} should pass: {}" "".format(passed, should_pass))
        assert_true(failed <= should_fail, "Failed tests,  fails: {} should fail: {}" "".format(failed, should_fail))

    def assert_release_state(self, release_name, state="available"):
        for release in self.client.get_releases():
            if release["name"].find(release_name) != -1:
                assert_equal(release["state"], state)
                return release["id"]

    @logwrap
    def assert_task_success(self, task, timeout=90 * 60, interval=5):
        task = self.task_wait(task, timeout, interval)
        assert_equal(
            task["status"],
            "ready",
            "Task '{name}' has incorrect status. {} != {}".format(task["status"], "ready", name=task["name"]),
        )

    @logwrap
    def assert_task_failed(self, task, timeout=70 * 60, interval=5):
        task = self.task_wait(task, timeout, interval)
        assert_equal(
            "error",
            task["status"],
            "Task '{name}' has incorrect status. {} != {}".format(task["status"], "error", name=task["name"]),
        )

    @logwrap
    def create_cluster(
        self, name, settings=None, release_name=help_data.OPENSTACK_RELEASE, mode=DEPLOYMENT_MODE_SIMPLE, port=5514
    ):
        """
        :param name:
        :param release_name:
#.........這裏部分代碼省略.........
開發者ID:justasabc,項目名稱:fuel-main,代碼行數:103,代碼來源:fuel_web_client.py


注:本文中的fuelweb_test.models.nailgun_client.NailgunClient.add_syslog_server方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。