当前位置: 首页>>代码示例>>Python>>正文


Python test_api_utils.get_supported_pollers函数代码示例

本文整理汇总了Python中test_api_utils.get_supported_pollers函数的典型用法代码示例。如果您正苦于以下问题:Python get_supported_pollers函数的具体用法?Python get_supported_pollers怎么用?Python get_supported_pollers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_supported_pollers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_2_pollers_by_id

    def test_2_pollers_by_id(self):
        msg = "Description: Display the poller data per node."
        if fit_common.VERBOSITY >= 2:
            print "\t{0}".format(msg)

        errorlist = []
        poller_list = ['driveHealth', 'sel', 'chassis', 'selInformation', 'sdr']
        for node in NODELIST:
            if fit_common.VERBOSITY >= 2:
                nodetype = get_rackhd_nodetype(node)
                print "Node: {}  Type: {}".format(node, nodetype)
            mondata = fit_common.rackhdapi("/api/2.0/nodes/" + node + "/pollers")
            self.assertIn(mondata['status'], [200], "Incorrect HTTP return code, expecting 200, received {}".format(mondata['status']))

            # check required fields
            for item in mondata['json']:
                if item['pollInterval'] == 0:
                    errorlist.append("Node: {} pollInterval field error: {}".format(node, item['pollInterval']))
                for subitem in ['node', 'config', 'createdAt', 'id', 'name', 'config']:
                    if subitem not in item:
                        errorlist.append("Node: {} field error: {}".format(node, subitem))

            # display poller data for the node
            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                if fit_common.VERBOSITY >= 2:
                    print "Poller: {}  ID: {} ".format(poller, str(poller_id))
                poll_data = fit_common.rackhdapi("/api/2.0/pollers/" + poller_id)
                if fit_common.VERBOSITY >= 3:
                    print fit_common.json.dumps(poll_data.get('json', ""), indent=4)

        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reported.")
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:35,代码来源:test_rackhd20_computenode_pollers.py

示例2: test_7_poller_error_counter

    def test_7_poller_error_counter(self):
        msg = "Description: Check for Poller Errors"
        if fit_common.VERBOSITY >= 2:
            print "\t{0}".format(msg)

        errorlist = []
        for node in NODELIST:
            if fit_common.VERBOSITY >= 2:
                nodetype = get_rackhd_nodetype(node)
                print "\nNode: {} Type: {}".format(node, nodetype)
            mondata = fit_common.rackhdapi("/api/2.0/nodes/" + node + "/pollers")
            self.assertIn(mondata['status'], [200], "Incorrect HTTP return code, expecting 200, received {}".format(mondata['status']))
            for item in mondata['json']:
                # check required fields
                if item['pollInterval'] == 0:
                    errorlist.append("Node: {} pollInterval field error: {}".format(node, item['pollInterval']))
                for subitem in ['node', 'config', 'createdAt', 'id', 'name', 'config', 'updatedAt']:
                    if subitem not in item:
                        errorlist.append("Node: {} field error: {}".format(node, subitem))
            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                poll_data = fit_common.rackhdapi("/api/2.0/pollers/" + poller_id)
                poll_fails = poll_data['json'].get('failureCount', 0)
                if poll_fails != 0:
                    errorlist.append("Node: {} Poller: {} {} reported {} failureCount".format(node, poller, poller_id, poll_fails))
        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reported in Pollers counters")
        else:
            if fit_common.VERBOSITY >= 2:
                print "No Poller errors found"
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:32,代码来源:test_rackhd20_computenode_pollers.py

示例3: test_1_verify_pollers

    def test_1_verify_pollers(self):
        msg = "Description: Check pollers created for node"
        if fit_common.VERBOSITY >= 2:
            print "\t{0}".format(msg)

        errorlist = []
        poller_list = ['driveHealth', 'sel', 'chassis', 'selInformation', 'sdr']
        if fit_common.VERBOSITY >= 2:
            print "Expected Pollers for a Node: ".format(poller_list)
        for node in NODELIST:
            if fit_common.VERBOSITY >= 2:
                nodetype = get_rackhd_nodetype(node)
                print "\nNode: {}  Type: {}".format(node, nodetype)
            mondata = fit_common.rackhdapi("/api/2.0/nodes/" + node + "/pollers")
            self.assertIn(mondata['status'], [200], "Incorrect HTTP return code, expecting 200, received {}".format(mondata['status']))

            poller_dict = test_api_utils.get_supported_pollers(node)
            if set(poller_list) == set(poller_dict):
                if fit_common.VERBOSITY >= 2:
                    print "Expected pollers instantiated on node"
                if fit_common.VERBOSITY >= 3:
                    print "Poller list retreived", poller_dict
            else:
                errorlist.append("Error: Node {0} Pollers not running {1}".format(node, list(set(poller_list) - set(poller_dict))))

        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reported.")
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:28,代码来源:test_rackhd20_computenode_pollers.py

示例4: test_5_poller_current_data

    def test_5_poller_current_data(self):
        msg = "Description: Display most current data from poller"
        if fit_common.VERBOSITY >= 2:
            print "\t{0}".format(msg)

        errorlist = []
        for node in NODELIST:
            if fit_common.VERBOSITY >= 2:
                nodetype = get_rackhd_nodetype(node)
                print "\nNode: {} Type: {}".format(node, nodetype)
            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                if fit_common.VERBOSITY >= 2:
                    print "Poller: {}  ID: {} ".format(poller, str(poller_id))
                monurl = "/api/2.0/pollers/" + str(poller_id) + "/data/current"
                mondata = fit_common.rackhdapi(url_cmd=monurl)
                if mondata['status'] not in [200, 201, 202, 204]:
                    errorlist.append("Error: Node {} Poller_ID {} Failed to get current poller data, status {}".format(node, poller_id, mondata['status']))
                else:
                    if fit_common.VERBOSITY >= 2:
                        print fit_common.json.dumps(mondata, indent=4)

        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reported.")
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:26,代码来源:test_rackhd20_computenode_pollers.py

示例5: test_6_poller_status_timestamp

    def test_6_poller_status_timestamp(self):
        msg = "Description: Display status and timestamp from current poll"
        if fit_common.VERBOSITY >= 2:
            print "\t{0}".format(msg)

        errorlist = []
        for node in NODELIST:
            nodetype = get_rackhd_nodetype(node)
            if fit_common.VERBOSITY >= 2:
                print "\nNode: {} Type: {}".format(node, nodetype)
            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                if fit_common.VERBOSITY >= 2:
                    print "Poller: {}  ID: {} ".format(poller, str(poller_id))
                monurl = "/api/2.0/pollers/" + str(poller_id) + "/data/current"
                mondata = fit_common.rackhdapi(url_cmd=monurl)
                if mondata['status'] == 200:
                    if fit_common.VERBOSITY >= 2:
                        print "Timestamp: {}".format(mondata['json'][0]['timestamp'])
                else:
                    errorlist.append("Error: Node {} Poller_ID {} Failed to get current poller data, status {}".format(node, poller_id, mondata['status']))
        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reported.")
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:25,代码来源:test_rackhd20_computenode_pollers.py

示例6: test_3_poller_headers

    def test_3_poller_headers(self):
        msg = "Description: Verify header data reported on the poller"
        if fit_common.VERBOSITY >= 2:
            print "\t{0}".format(msg)

        errorlist = []
        for node in NODELIST:
            mondata = fit_common.rackhdapi("/api/2.0/nodes/" + node + "/pollers")
            self.assertIn(mondata['status'], [200], "Incorrect HTTP return code, expecting 200, received {}".format(mondata['status']))
            if fit_common.VERBOSITY >= 2:
                nodetype = get_rackhd_nodetype(node)
                print "\nNode: {} Type: {}".format(node, nodetype)

            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                if fit_common.VERBOSITY >= 2:
                    print "Poller: {}  ID: {} ".format(poller, str(poller_id))
                poller_data = test_api_utils.get_poller_data_by_id(poller_id)
                if poller_data == []:
                    errorlist.append("Error: Node {} Poller ID {}, {} failed to return any data".format(node, poller_id, poller))
                if fit_common.VERBOSITY >= 3:
                    print fit_common.json.dumps(poller_data, indent=4)

        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reported.")
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:27,代码来源:test_rackhd20_computenode_pollers.py

示例7: test_4_poller_default_cache

    def test_4_poller_default_cache(self):
        msg = "Description: Check number of polls being kept for poller ID"
        if fit_common.VERBOSITY >= 2:
            print "\t{0}".format(msg)

        for node in NODELIST:
            if fit_common.VERBOSITY >= 2:
                nodetype = get_rackhd_nodetype(node)
                print "Node: {}  Type: {}".format(node, nodetype)
        errorlist = []
        for node in NODELIST:
            nodetype = get_rackhd_nodetype(node)
            if fit_common.VERBOSITY >= 2:
                print "\nNode: {} Type: {}".format(node, nodetype)

            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                poller_data = test_api_utils.get_poller_data_by_id(poller_id)
                poll_len = len(poller_data)
                if fit_common.VERBOSITY >= 2:
                    print "Poller: {}  ID: {} ".format(poller, str(poller_id))
                    print "Number of polls for "+ str(poller_id) + ": " + str(len(poller_data))
                if poll_len > 10:
                    errorlist.append('Error: Poller {} ID: {} - Number of cached polls should not exceed 10'.format(poller_id, poller))
                elif poll_len == 0:
                    errorlist.append('Error: Poller {} ID: {} - Pollers not running'.format(poller_id, poller))

        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reported.")
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:31,代码来源:test_rackhd20_computenode_pollers.py

示例8: test_nodes_id_pollers

    def test_nodes_id_pollers(self):
        msg = "Description: Display the poller updated-at per node."
        print "\t{0}".format(msg)

        node = 0
        errorlist = []
        for node in NODELIST:
            if fit_common.VERBOSITY >= 2:
                print "Node: {}".format(node)
            mondata = fit_common.rackhdapi("/api/1.1/nodes/" + node + "/pollers")
            self.assertIn(mondata['status'], [200], "Incorrect HTTP return code, expecting 200, received {}".format(mondata['status']))
            for item in mondata['json']:
                # check required fields
                if item['pollInterval'] == 0:
                    errorlist.append("Node: {} pollInterval field error: {}".format(node, item['pollInterval']))
                for subitem in ['node', 'config', 'createdAt', 'id', 'name', 'config', 'updatedAt']:
                    if subitem not in item:
                        errorlist.append("Node: {} field error: {}".format(node, subitem))
            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                poll_data = fit_common.rackhdapi("/api/1.1/pollers/" + poller_id)
                if fit_common.VERBOSITY >= 2:
                    print "\nPoller: {}  ID: {} ".format(poller, str(poller_id))
                    print "Created At: {}".format(fit_common.json.dumps(poll_data['json']['createdAt']))
                    print "Updated At: {}".format(fit_common.json.dumps(poll_data['json']['updatedAt']))
        if errorlist != []:
            print "{}".format(fit_common.json.dumps(errorlist, indent=4))
            self.assertEqual(errorlist, [], "Error reporterd.")
开发者ID:miramm,项目名称:fit_tests,代码行数:29,代码来源:test_rackhd11_computenode_pollers.py

示例9: test_verify_poller_error_counter

 def test_verify_poller_error_counter(self):
     msg = "Description: Check for Poller Errors"
     print "\t{0}".format(msg)
     errorlist = []
     for node in NODELIST:
         mon_data = fit_common.rackhdapi("/api/1.1/nodes/" + node + "/pollers")
         self.assertIn(mon_data['status'], [200], "Incorrect HTTP return code")
         for item in mon_data['json']:
             # check required fields
             self.assertGreater(item['pollInterval'], 0, 'pollInterval field error')
             for subitem in ['node', 'config', 'createdAt', 'id', 'name', 'config', 'updatedAt']:
                 self.assertIn(subitem, item, subitem + ' field error')
         poller_dict = test_api_utils.get_supported_pollers(node)
         for poller in poller_dict:
             poller_id = poller_dict[poller]["poller_id"]
             poll_data = fit_common.rackhdapi("/api/1.1/pollers/" + poller_id)
             poll_fails = poll_data['json'].get('failureCount', 0)
             if poll_fails != 0:
                 errorlist.append("Node: {} Poller: {} {} reported {} failureCount".format(node,
                                                                                           poller,
                                                                                           poller_id,
                                                                                           poll_fails))
     if errorlist != []:
         print "{}".format(fit_common.json.dumps(errorlist, indent=4))
         self.assertEqual(errorlist, [], "Error reported in Pollers")
     else:
         if fit_common.VERBOSITY >- 2:
             print ("No Poller errors found")
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:28,代码来源:test_rackhd11_switch_pollers.py

示例10: test_get_current_poller_data

    def test_get_current_poller_data(self):
        msg = "Description: Display most current data from poller"
        print "\t{0}".format(msg)

        for node in NODELIST:
            print "\nNode: ", node
            nodetype = get_rackhd_nodetype(node)
            # Run test against managed nodes only
            if nodetype != "unknown" and nodetype != "Unmanaged":
                poller_dict = test_api_utils.get_supported_pollers(node)

                for poller in poller_dict:
                    poller_id = poller_dict[poller]["poller_id"]
                    print "\nPoller: " + poller + " ID: " + str(poller_id)
                    monurl = "/api/1.1/pollers/" + str(poller_id) + "/data/current"
                    mondata = fit_common.rackhdapi(url_cmd=monurl)
                    if fit_common.VERBOSITY >= 2:
                        print fit_common.json.dumps(mondata, indent=4)
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:18,代码来源:test_rackhd11_switch_pollers.py

示例11: test_verify_poller_data

    def test_verify_poller_data(self):
        msg = "Description: Check number of polls being kept for poller ID"
        print "\t{0}".format(msg)

        for node in NODELIST:
            print "\nNode: ", node
            nodetype = get_rackhd_nodetype(node)
            # Run test against managed nodes only
            if nodetype != "unknown" and nodetype != "Unmanaged":
                poller_dict = test_api_utils.get_supported_pollers(node)

                for poller in poller_dict:
                    poller_id = poller_dict[poller]["poller_id"]
                    print "\nPoller: " + poller + " ID: " + str(poller_id)
                    poller_data = test_api_utils.get_poller_data_by_id(poller_id)
                    poll_len = len(poller_data)
                    print "Number of polls for "+ str(poller_id) + ": " + str(len(poller_data))
                    self.assertLessEqual(poll_len, 10, 'Number of cached polls should not exceed 10')
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:18,代码来源:test_rackhd11_switch_pollers.py

示例12: test_verify_poller_headers

    def test_verify_poller_headers(self):
        msg = "Description: Verify header data reported on the poller"
        print "\t{0}".format(msg)

        for node in NODELIST:
            mon_data = fit_common.rackhdapi("/api/1.1/nodes/" + node + "/pollers")
            self.assertIn(mon_data['status'], [200], "Incorrect HTTP return code")
            nodetype = get_rackhd_nodetype(node)
            print "\nNode: {} Type: {}".format(node, nodetype)
            # Run test against managed nodes only
            if nodetype != "unknown" and nodetype != "Unmanaged":
                poller_dict = test_api_utils.get_supported_pollers(node)

                for poller in poller_dict:
                    poller_id = poller_dict[poller]["poller_id"]
                    print "\nPoller: " + poller + " ID: " + str(poller_id)
                    poller_data = test_api_utils.get_poller_data_by_id(poller_id)
                    if fit_common.VERBOSITY >= 3:
                        print fit_common.json.dumps(poller_data, indent=4)
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:19,代码来源:test_rackhd11_switch_pollers.py

示例13: test_get_id_pollers

    def test_get_id_pollers(self):
        msg = "Description: Display the poller data per node."
        print "\t{0}".format(msg)

        for node in NODELIST:
            mon_data = fit_common.rackhdapi("/api/1.1/nodes/" + node + "/pollers")
            self.assertIn(mon_data['status'], [200], "Incorrect HTTP return code")
            for item in mon_data['json']:
                # check required fields
                self.assertGreater(item['pollInterval'], 0, 'pollInterval field error')
                for subitem in ['node', 'config', 'createdAt', 'id', 'name', 'config']:
                    self.assertIn(subitem, item, subitem + ' field error')

            print "\nNode: ", node
            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                print "\nPoller: " + poller + " ID: " + str(poller_id)
                poll_data = fit_common.rackhdapi("/api/1.1/pollers/" + poller_id)
                if fit_common.VERBOSITY >= 2:
                    print fit_common.json.dumps(poll_data['json'], indent=4)
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:21,代码来源:test_rackhd11_switch_pollers.py

示例14: test_get_poller_status_timestamp

    def test_get_poller_status_timestamp(self):
        msg = "Description: Display status and timestamp from current poll"
        print "\t{0}".format(msg)

        for node in NODELIST:
            print "\nNode: ", node
            nodetype = get_rackhd_nodetype(node)
            # Run test against managed nodes only
            if nodetype != "unknown" and nodetype != "Unmanaged":
                poller_dict = test_api_utils.get_supported_pollers(node)

                for poller in poller_dict:
                    poller_id = poller_dict[poller]["poller_id"]
                    print "\nPoller: " + poller + " ID: " + str(poller_id)
                    monurl = "/api/1.1/pollers/" + str(poller_id) + "/data/current"
                    mondata = fit_common.rackhdapi(url_cmd=monurl)
                    print "Return status", mondata['status']
                    if mondata['status'] == 200:
                        print "Timestamp:", mondata['json'][0]['timestamp']
                        if fit_common.VERBOSITY >= 2:
                            print fit_common.json.dumps(mondata['json'][0], indent=4)
开发者ID:lhw4d4,项目名称:fit_tests,代码行数:21,代码来源:test_rackhd11_switch_pollers.py

示例15: test_get_nodes_id_pollers

    def test_get_nodes_id_pollers(self):
        msg = "Description: Display the poller updated-at per node."
        print "\t{0}".format(msg)

        node = 0
        for node in NODELIST:
            print "\nNode: ", node
            mon_data = fit_common.rackhdapi("/api/2.0/nodes/" + node + "/pollers")
            self.assertIn(mon_data['status'], [200], "Incorrect HTTP return code")
            for item in mon_data['json']:
                # check required fields
                self.assertGreater(item['pollInterval'], 0, 'pollInterval field error')
                for subitem in ['node', 'config', 'createdAt', 'id', 'name', 'config', 'updatedAt']:
                    self.assertIn(subitem, item, subitem + ' field error')
            poller_dict = test_api_utils.get_supported_pollers(node)
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                print "\nPoller: " + poller + " ID: " + str(poller_id)
                poll_data = fit_common.rackhdapi("/api/2.0/pollers/" + poller_id)
                pprint.pprint("Created At: {}".format(poll_data['json']['createdAt']))
                pprint.pprint("Updated At: {}".format(poll_data['json']['updatedAt']))
开发者ID:miramm,项目名称:fit_tests,代码行数:21,代码来源:test_rackhd20_switch_pollers.py


注:本文中的test_api_utils.get_supported_pollers函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。