• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_api_utils.get_supported_pollers函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_api_20_get_pollers_by_id

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

        for node in self.NODELIST:
            api_data = fit_common.rackhdapi("/api/2.0/nodes/" + node + "/pollers")
            self.assertEqual(api_data['status'],
                             200,
                             "Incorrect HTTP return code, expected 200, got:{0}"
                             .format(str(api_data['status'])))
            for item in api_data['json']:
                # check required fields
                self.assertGreater(item['pollInterval'], 0, 'pollInterval field error')
                for subitem in ['node', 'config', 'createdAt', 'id',
                                'name', 'failureCount', 'leaseExpires', 'leaseToken', 'updatedAt']:
                    self.assertIn(subitem, item, subitem + ' field error')
            logs.info_2("\nNode: ")
            poller_dict = test_api_utils.get_supported_pollers(node)
            self.POLLERS[node] = poller_dict
            for poller in poller_dict:
                poller_id = poller_dict[poller]["poller_id"]
                logs.info_2("\nPoller: " + poller + " ID: " + str(poller_id))
                poll_data = fit_common.rackhdapi("/api/2.0/pollers/" + poller_id)
                logs.info_5(fit_common.json.dumps(poll_data['json'], indent=4))
开发者ID:PengTian0,项目名称:RackHD,代码行数:24,代码来源:test_rackhd20_ucs_pollers.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_awa_server_write.server_write函数代码示例发布时间:2022-05-27
下一篇:
Python test_ap_eap.int_eap_server_params函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap