Redfish automated testing method, system, device and storage medium

Through the Redfish automated testing method, session management and standard value acquisition optimization are used to solve the complexity and time-consuming problems of OpenBMC Redfish testing, improve test efficiency and coverage, and achieve accurate and complete test results.

CN116737571BActive Publication Date: 2024-09-03SUZHOU POWERCORE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310715899.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2024-09-03
Estimated Expiration
2043-06-16

AI Technical Summary

Technical Problem

The existing OpenBMC Redfish testing method is complex and time-consuming, and involves a lot of repetitive work, causing automation testers to face difficulties and cumbersome problems.

Method used

Provides a Redfish automated testing method that creates a Redfish session, obtains return values ​​and standard values, matches them based on operation types, generates test results, optimizes standard value acquisition through BMC Web or ipmitool, and uses secondary matching to improve test coverage.

Benefits of technology

It reduces the difficulty and tediousness of manual testing of OpenBMC Redfish by automated testers, improves testing efficiency and coverage, and ensures the accuracy and completeness of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116737571B
    Figure CN116737571B
Patent Text Reader

Abstract

The present invention relates to the field of automated testing technology, and discloses a Redfish automated testing method, system, device and storage medium, including creating a Redfish session according to a number of selected items to be tested, and obtaining the return value of the item to be tested according to the session number of the item to be tested; selecting a corresponding standard value acquisition method according to the functional type of the item to be tested to obtain the standard value corresponding to the item to be tested; matching the return value and the standard value according to the operation type of the item to be tested, and generating a test result of the item to be tested according to the matching result. The present invention improves the acquisition efficiency of the standard value through different standard value acquisition methods, covers and tests most of the general interfaces of Redfish through secondary matching, has a high test coverage rate, and ensures the integrity of the test case implementation through data conversion matching, thereby improving the test efficiency and test effect of automated testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated testing technology, and in particular to a Redfish automated testing method, system, device and storage medium. Background Art

[0002] Redfish is a management standard based on HTTPs services, which uses RESTful interfaces to implement device management. Each HTTPs operation submits or returns a resource or result in UTF-8 encoded JSON format, and provides simpler and more modern management functions through a unified management interface, which can perform comprehensive interface management, monitoring, and adaptation of server hardware, facilitating the next step of development and testing. OpenBMC is an open source version of BMC, which is used to better access and control BMC.

[0003] At present, the existing OpenBMC Redfish testing methods are mostly carried out through the OpenBMCRedfish interface description documents provided by the product / project, and through software tools such as Postman. That is, by filling in the test information and having Postman return the corresponding return value message body, the tester determines whether it is correct based on these return values, and finally writes a test report and other operations. The existing testing methods are not only very complicated to operate, but also time-consuming, with a lot of repetitive work, and very cumbersome. Therefore, there is an urgent need for a method that can perform automated testing on Redfish to reduce the difficulty and cumbersomeness of manual testing of OpenBMC Redfish by automated testers. Summary of the invention

[0004] In order to solve the above technical problems, the present invention provides a Redfish automated testing method, system, device and storage medium, so as to solve the complexity and tediousness of manual testing and achieve the purpose of simply and efficiently realizing Redfish automated testing.

[0005] In order to achieve the above object, in a first aspect, the present invention provides a Redfish automated testing method, the method comprising:

[0006] Creating a Redfish session according to the selected items to be tested, and obtaining a return value of the item to be tested according to the session number of the item to be tested;

[0007] According to the function type of the item to be tested, a corresponding standard value acquisition method is selected to obtain the standard value corresponding to the item to be tested;

[0008] According to the operation type of the item to be tested, the return value and the standard value are matched, and a test result of the item to be tested is generated according to the matching result.

[0009] Furthermore, the step of creating a Redfish session according to the selected plurality of items to be tested includes:

[0010] It is determined whether the number of the items to be tested is greater than a threshold. If so, the items to be tested are divided into groups according to the threshold, and a Redfish session is created for each group of the items to be tested in turn. If not, a Redfish session is created for all the items to be tested.

[0011] Furthermore, the step of selecting a corresponding standard value acquisition method according to the function type of the item to be tested to obtain the standard value corresponding to the item to be tested includes:

[0012] If the function type of the item to be tested is a hardware information acquisition function, the standard value corresponding to the item to be tested is acquired through the BMC Web; if not, the standard value corresponding to the item to be tested is acquired through the ipmitool command.

[0013] Furthermore, the step of matching the return value with the standard value includes:

[0014] Performing data conversion on the return value and the standard value according to the data types of the return value and the standard value;

[0015] The converted return value and the converted standard value are matched.

[0016] In a second aspect, the present invention provides a Redfish automated testing system, the system comprising:

[0017] A return value acquisition module, used to create a Redfish session according to the selected items to be tested, and obtain the return value of the item to be tested according to the session number of the item to be tested;

[0018] A standard value acquisition module, used to select a corresponding standard value acquisition method according to the function type of the item to be tested, so as to obtain the standard value corresponding to the item to be tested;

[0019] The test result generating module is used to match the return value with the standard value according to the operation type of the item to be tested, and generate the test result of the item to be tested according to the matching result.

[0020] Furthermore, the standard value acquisition module is also used to obtain the standard value corresponding to the item to be tested through BMC Web if the function type of the item to be tested is a hardware information acquisition function, and if not, obtain the standard value corresponding to the item to be tested through an ipmitool instruction.

[0021] Further, the test result generation module includes a first matching module;

[0022] The first matching module is used to match the return value with the standard value to obtain a matching result of the item to be tested if the operation type of the item to be tested is only a Get operation.

[0023] Further, the test result generation module includes a second matching module;

[0024] The second matching module is used for matching the return value with the standard value to obtain a first matching result if the operation type of the item to be tested includes a Post operation;

[0025] If the first matching result is a successful match, use the Post operation to execute the corresponding new function; obtain a first return value and a first standard value corresponding to the new function, match the first return value with the first standard value to obtain a second matching result, and use the second matching result as the matching result of the item to be tested;

[0026] If the first matching result is a match failure, the first matching result is used as the matching result of the item to be tested.

[0027] Further, the test result generation module includes a third matching module;

[0028] The third matching module is used for matching the return value with the standard value to obtain a third matching result if the operation type of the item to be tested includes a Patch operation;

[0029] If the third matching result is a successful match, use the Patch operation to execute the corresponding update function; obtain the second return value and the second standard value corresponding to the update function, match the second return value and the second standard value to obtain a fourth matching result, and use the fourth matching result as the matching result of the item to be tested;

[0030] If the third matching result is a match failure, the third matching result is used as the matching result of the item to be tested.

[0031] In a third aspect, an embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0032] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0033] The present invention provides a Redfish automated testing method, system, computer device and storage medium. The method can reduce the difficulty and tediousness of manual testing of OpenBMC Redfish by automated testers, thereby improving the coverage and efficiency of URL testing of OpenBMC Redfish and further improving the testing effect of automated testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 This is a flow chart of testing OpenBMC Redfish based on Postman software;

[0035] Figure 2 It is a schematic diagram of the process of the Redfish automated testing method in an embodiment of the present invention;

[0036] Figure 3 It is another flow chart of the Redfish automated testing method in an embodiment of the present invention;

[0037] Figure 4 yes Figure 2 Schematic diagram of the process of step S20;

[0038] Figure 5 yes Figure 2 Schematic diagram of the process of step S30;

[0039] Figure 6 yes Figure 2 Another flow chart of step S30;

[0040] Figure 7 1 is a third flow chart of the Redfish automated testing method according to an embodiment of the present invention;

[0041] Figure 8 1 is a schematic diagram showing the test results of the Redfish automated testing method according to an embodiment of the present invention;

[0042] Fig. 9 It is a schematic diagram of a test document generated by the Redfish automated testing method in an embodiment of the present invention;

[0043] Fig.10 It is a schematic diagram of the structure of the Redfish automated testing system in an embodiment of the present invention;

[0044] Fig.11 is another structural schematic diagram of the Redfish automated testing system in an embodiment of the present invention;

[0045] Fig.12 It is a schematic diagram of the implementation process of the Redfish automated testing system in an embodiment of the present invention;

[0046] Fig.13 It is a schematic diagram of selecting items to be tested by the Redfish automated testing system in an embodiment of the present invention;

[0047] Fig.14 It is a diagram of the internal structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] Before describing the technical solution of the present invention, the technical keywords involved in the present invention are explained first: BMC: Baseboard Management Controller, a micro-system independent of the machine, monitoring the temperature, fan, health status, voltage, etc. of the machine to keep the machine in a healthy state; OpenBMC: an open / open source version of BMC; Redfish: a management standard based on HTTPs service, using RESTful interface to achieve device management; Ipmitool: an ipmi platform management tool in command line mode that can be used in Linux system, supporting ipmi1.5 specification, and can achieve functions such as obtaining sensor information, displaying system log content, and remote network power on and off; Python: a cross-platform computer programming language; Python requests library: the requests library in Python is an HTTP library developed based on Python using the Apache2Licensed license, with common operations such as get, post, and patch; Postman: a Chrome plug-in for web page debugging and sending web page HTTP requests; BMC Web: a web page based on BMC, users can log in by entering the BMC IP in the browser, and view server-related hardware device information and alarm logs on it.

[0050] See also Figure 1 At present, the test method for OpenBMC Redfish is mostly carried out through the OpenBMC Redfish interface description document provided by the product / project, and through software tools such as Postman. Specifically, the corresponding test requirements are filled in through the web page provided by Postman to obtain the corresponding return value. The information filled in during the test includes: ① test URL, ② request header information, ③ request body information, ④ request method. After clicking to send the above information, the corresponding ⑤ return value message body will be obtained in Postman. The tester will judge whether it is correct based on these return values, and finally write a test report and other operations. The existing test method is not only very complicated to operate, but also time-consuming, with more repetitive work, and very cumbersome. In order to reduce the difficulty and cumbersomeness of manual testing of OpenBMC Redfish by automated testers, the present invention provides an automated testing method for OpenBMC Redfish based on a Linux platform.

[0051] See also Figure 2 , a Redfish automated testing method proposed in the first embodiment of the present invention includes steps S10 to S30:

[0052] Step S10: creating a Redfish session according to the selected items to be tested, and obtaining the return value of the items to be tested according to the session numbers of the items to be tested.

[0053] The present invention is an automated test for OpenBMC Redfish. Before the test, the test environment needs to be configured. The configuration steps include: installing Python and ipmitool tools on the Linux system, entering the test main path under the Linux command line, and then filling in the corresponding configuration parameters, including bmcip, bmcwebip, systemip, and account password information. For example, the following configuration information can be filled in:

[0054] bmcip='10.100.100.1'

[0055] bmcwebip = '10.100.100.2'

[0056] systemip = '10.100.100.3'

[0057] username='admin'

[0058] password='admin'

[0059] sysusername = 'root'

[0060] syspassword = '1234567'

[0061] After the environment configuration is completed, you can select the test items, that is, the test cases (Testcases) that need to be tested. The present invention can automatically test various interfaces of OpenBMC Redfish, such as SessionService, Managers, Public, Systems, Chassis, AccountService, UpdateService, EventService, etc. Since Redfish is a management standard based on HTTPs services, it can be considered that a test item is a test of the return value of a Redfish URL, such as Figure 1 The ① in the table is a Redfish URL to be tested. Figure 1The test case shown is used to obtain the return value corresponding to the URL. In fact, a Redfish session can be established based on multiple items to be tested. Therefore, if multiple cases are selected for testing, a Redfish session can be established for the selected multiple cases. Although this session establishment method reduces the number of times to establish Redfish sessions, there is a problem that when the number of cases is too large, the total test time will be too long, and the BMC session timeout phenomenon will occur in a Redfish session. In order to avoid this situation, the present invention provides a preferred embodiment. In this embodiment:

[0062] It is determined whether the number of the items to be tested is greater than a threshold. If so, the items to be tested are divided into groups according to the threshold, and a Redfish session is created for each group of the items to be tested in turn. If not, a Redfish session is created for all the items to be tested.

[0063] See also Figure 3 In this embodiment, a threshold is first set for the number of items to be tested, for example, the threshold is set to 20. After the test starts, it is first determined whether the total number of test cases exceeds the threshold. If not, a Redfish session is created through CreateSession, and the Redfish ID number is obtained through GetSessionID. The test is executed in the selected order until all test cases are tested. Finally, the Redfish ID number is deleted through DeleteSessionID to end the test.

[0064] If the threshold is exceeded, the test cases are divided into multiple test groups according to the threshold, and a Redfish session is created for each test group. The test performed on each test group is consistent with the first half of the above steps that do not exceed the threshold. The difference is that after a group of test cases are tested sequentially, the Redfish ID number is deleted through DeleteSessionID, and then a Redfish session is recreated for the next group of test cases until all test cases are executed. That is to say, this embodiment avoids the occurrence of timeout by performing multiple create / delete session actions.

[0065] In the test process of a Redfish session, a Redfish session can be created through CreateSession, and the Redfish ID number can be obtained through GetSessionID, and then the information returned by the test case, that is, the URL, can be obtained based on the ID number. It should be noted that the automated testing method provided by the present invention can use Python language to use Pythonrequests library to build scripts to implement automated testing. Of course, other languages ​​can also be used to build scripts. No specific limitation is made here. The following only takes Python language as an example to illustrate the testing method provided by the present invention.

[0066] After getting the Redfish ID, you can use the requests.get function in the Python requests library to get the return information of the OpenBMC Redfish URL. Of course, in order to verify whether the interface is running properly, you also need to obtain the standard information corresponding to the URL for verification.

[0067] Step S20: selecting a corresponding standard value acquisition method according to the function type of the item to be tested, so as to obtain the standard value corresponding to the item to be tested.

[0068] For obtaining the standard value of the URL of OpenBMC Redfish, the conventional method is to use the ipmitool tool to execute the relevant ipmitool instructions to obtain standard information such as sensor information and system log content. However, most of the BMC parameter values ​​obtained by ipmitool are one instruction and one return result. Therefore, it is very cumbersome to obtain the standard value, which affects the efficiency of obtaining the standard value. In order to solve this problem, the present invention provides a preferred embodiment to optimize the method of obtaining the standard value. In this embodiment:

[0069] If the function type of the item to be tested is a hardware information acquisition function, the standard value corresponding to the item to be tested is acquired through the BMC Web; if not, the standard value corresponding to the item to be tested is acquired through the ipmitool command.

[0070] See also Figure 4In the standard acquisition process of this embodiment, the function type of the test case will be determined first. If the test case is used to obtain hardware information, such as the model, quantity, product serial number, firmware version number and other information of devices such as CPU, memory, hard disk, PCIe card, network card, etc., the standard value of the test case can be directly obtained through BMC Web. BMC Web is a Web interface of the server BMC. Users can obtain the corresponding hardware information through the BMC Web page, such as the model, quantity, product serial number and other parameter information of CPU, memory, hard disk, PCIe card, network card settings, etc., and can view the corresponding SEL log alarm information. This embodiment uses this function of BMC Web to obtain the above-mentioned part of information by executing one instruction. At the same time, the tester can directly log in to BMC Web to view this part of the standard information value without using the ipmitool tool to perform tedious standard value acquisition operations; if the test case is other functions, it is still necessary to obtain the corresponding standard value through the ipmitool instruction. This embodiment improves the efficiency of obtaining standard values ​​by adopting different standard value acquisition methods for test cases with different functions, and further improves the test efficiency of automated testing.

[0071] Step S30: matching the return value with the standard value according to the operation type of the item to be tested, and generating a test result of the item to be tested according to the matching result.

[0072] In conventional automated testing, for Redfish interface functions, the Get function is basically used to obtain the return information of the test URL. However, in fact, for the URL in Redfish, the corresponding operation type not only includes the Get operation, but also may include other operation types. From the above introduction, it can be seen that Redfish's data transmission is based on the Hypertext Transfer Protocol HTTP, and its Request format includes Method, Request-URL and HTTP-Version, where Method is the operation type corresponding to the URL, including Get, Post, Patch and Delete. The following is an example:

[0073] Among them, 10.100.100.1 is the BMC IP address;

[0074] Get is a get operation, such as getting system account information:

[0075] GET operation: URL: 10.100.100.1 / redfish / v1 / AccountService;

[0076] Post is for adding and executing operations, such as adding a new account:

[0077] POST operation: URL: 10.100.100.1 / redfish / v1 / AccountService / Accounts, request body is {"username":"test01","password":"123456"};

[0078] Patch is an update operation, such as updating an account password:

[0079] PATCH operation: URL: 10.100.100.1 / redfish / v1 / AccountService / Accounts / test01,

[0080] {"password":"654321"};

[0081] Delete is a deletion operation, such as deleting an account:

[0082] DETELE operation: URL: 10.100.100.1 / redfish / v1 / AccountService / Accounts / 01;

[0083] That is to say, OpenBMC Redfish contains multiple URLs, and each URL can correspond to one or more types of operations. For example, for account information, you can use the Get operation to obtain account information, or you can use the Post operation to add a new account. For the newly added account information, you can also use the Delete operation to delete it.

[0084] When performing automated testing on conventional Redfish, the return value of the URL is obtained only through the Get operation, and then the return value is compared with the standard value to determine whether the case is running normally. However, for other operations such as update or add, no specific test process is given, that is, the test does not cover the modification or addition functions. In order to improve the test coverage of Redfish automated testing, the present invention provides a preferred embodiment, in which different test processes are used for different URLs.

[0085] See also Figure 5In this embodiment, after obtaining the ID number of Redfish and using requests.get in Pythonrequests library of Python to obtain the return information of the URL of OpenBMC Redfish, the operation type of the URL will be judged. If the operation type of the URL only has the Get operation, then the test is judged whether it passes according to the matching result between the return value and the standard value. If the operation type of the URL also includes the Post operation or the Patch operation, then after performing the corresponding requests.post operation or requests.patch operation on the Redfish URL according to the operation type, the standard value is compared with the return value, and the test result of the test item is generated according to the comparison result. At the same time, the test process and test results are output to the log and organized into documents such as PDF, txt and other formats to facilitate viewing the specific situation of the test. Finally, the Redfish session is deleted to end this test.

[0086] Specifically, the matching process of URLs of different operation types includes:

[0087] If the operation type of the item to be tested is only a Get operation, the return value is matched with the standard value to obtain a matching result of the item to be tested.

[0088] Among them, if the URL only supports the Get operation, then the test result can be determined by simply matching the return value with the standard value, that is, the coverage test of the URL function is achieved.

[0089] Further, if the operation type of the item to be tested includes a Post operation, the return value is matched with the standard value to obtain a first matching result;

[0090] If the first matching result is a successful match, a Post operation is used to execute a corresponding new function, a first return value and a first standard value corresponding to the new function are obtained, the first return value is matched with the first standard value to obtain a second matching result, and the second matching result is used as the matching result of the item to be tested;

[0091] If the first matching result is a match failure, the first matching result is used as the matching result of the item to be tested.

[0092] Among them, for the case where the URL also supports the Post operation, the return value obtained by the Get function is first matched with the standard value. If the match is unsuccessful, the test result of the URL is considered abnormal. If the match is successful, a second match is required. During the second match, the corresponding Post addition operation will be performed on the URL. For example, if the URL is to query user information, a user will be added through the Post function after the first match is successful. Then, through the above-mentioned return value and standard value acquisition steps, the return value and standard value corresponding to the new function are re-acquired, and a second match is performed. Only when the second match is successful, the test result of the URL is determined to be normal, otherwise, the test result of the URL is considered abnormal. Through this secondary matching method of the present embodiment, the test coverage of the URL with the Post function can be improved, and the test results can be made more accurate, thereby improving the test efficiency and test effect of the automated test.

[0093] Further, if the operation type of the item to be tested includes a Patch operation, the return value is matched with the standard value to obtain a third matching result;

[0094] If the third matching result is a successful match, use the Patch operation to execute the corresponding update function, obtain the second return value and the second standard value corresponding to the update function, match the second return value and the second standard value to obtain a fourth matching result, and use the fourth matching result as the matching result of the item to be tested;

[0095] If the third matching result is a match failure, the third matching result is used as the matching result of the item to be tested.

[0096] Among them, for the case where the URL also supports the Patch operation, the return value obtained by the Get function is first matched with the standard value. If the match is unsuccessful, the test result of the URL is considered abnormal. If the match is successful, a second match is required. During the second match, the corresponding Patch update operation will be performed on the URL. For example, if the URL is to query the status of the server ID light, if the return status is off, after the first match is successful, the server ID light will be updated to the on state through the Patch function, and then the return value and standard value corresponding to the update function are re-obtained through the above-mentioned return value and standard value acquisition steps, and a second match is performed. Only when the second match is successful, the test result of the URL is determined to be normal, otherwise, the test result of the URL is considered abnormal. Through this secondary matching method of the present embodiment, the test coverage of the URL with the Patch function can be improved, and the test results can be made more accurate, thereby improving the test efficiency and test effect of the automated test.

[0097] Of course, for the case where the URL also supports the Delete operation, similarly, the URL can also be tested through a secondary match. For example, for user information, after the first match is successful, the user information can be deleted through the Delete function, and then the remaining user information can be queried through the Get function to test whether the Delete operation is successful, thereby making a more accurate judgment on the test result of the URL. Based on the test method provided by the present invention, most of the common interfaces of OpenBMC Redfish can be tested, with a high test coverage rate, so that a more accurate judgment can be made on the test result of Redfish, and the test method provided by the present invention can not only test the common URL part of OpenBMC Redfish, but also test the development or fixed value URL, generate a test case through the URL return value, and compare the value obtained by ipmitool or BMC Web, and make a judgment based on the comparison result. In other words, the present invention can adapt to more Redfish functional tests by adding cases independently, and has extremely high scalability.

[0098] Furthermore, for the matching process between the return value and the standard value, the conventional practice is to compare them directly. However, in actual situations, some values ​​cannot be directly used for comparison, such as the case of letters, character strings with spaces, and the unit format of data, etc. In order to solve this problem, the present invention also provides a preferred embodiment to avoid the situation where some values ​​cannot be compared.

[0099] In this embodiment, the return value and the standard value data are first uniformly converted, and then the converted return value and the standard value are matched. The conversion types include numeric type, string type, and Boolean type. For numeric type, the return value and the standard value are uniformly converted to float type data, and the same decimal places are retained; for string type, both are uniformly converted to str type data, and spaces and case are uniformly adjusted, such as uniformly adjusted to uppercase and spaces are deleted; for Boolean type, both are uniformly converted to bool type data. The data conversion process of this embodiment is described below using specific data as an example.

[0100] See also Figure 6, the comparison information is the return value and the standard value. If the comparison information is a digital type, such as a 5V voltage value, the return value is 5.10000, and the standard value is 5.1, so both are converted to float type and retain the same decimal places, such as two decimal places, so the return value and the standard value are converted to 5.10. If the comparison information is a string type, such as a memory model, the return value is M393A2K40D, and the standard value is m393a2k40d, so the uppercase and lowercase letters of the two are unified, that is, they are both converted to M393A2K40D. If the comparison information is of Boolean type, for example, the heat dissipation strategy is able to be turned on, the return value is True, and the standard value is "True", then both are uniformly converted to True. Of course, the standard value may also be "False", in which case the standard value will be converted to False. The uniformly converted return value and standard value can be directly matched. The data conversion method provided in this embodiment can avoid the situation where the return value and the standard value cannot be matched or the matching result is inaccurate, thereby ensuring the integrity of the test case implemented by the test method of the present invention and further improving the accuracy of the test results.

[0101] See also Figure 7 The test process of the test method provided by the present invention is described in detail below through specific embodiments:

[0102] After the environment configuration is completed and the test items are selected, start the test to determine whether the Redfish URL only supports the Get operation, that is, it only has the Get function. If so, obtain the corresponding information through requests.get, such as the OpenBMC Redfish CUP page information, and then determine whether the return value is consistent with the obtained standard value to generate the test result.

[0103] If the Redfish URL also supports the Post operation, the first match is performed first, such as obtaining the returned user information through requests.get, and then matching it with the corresponding standard value. After the first match is successful, create the BMC user test01 including the password and user permissions through requests.post, and then perform the second match, that is, obtain the user information of the newly added user test01 through requests.get, and obtain the corresponding standard value at the same time, and then match the returned value with the standard value, and generate the test result according to the matching result.

[0104] If the Redfish URL also supports the Patch operation, the first match is performed first. For example, the server ID light is obtained in the off state through requests.get, and then the return value is matched with the obtained standard value. After the first match is successful, the server ID light is changed to the on state through requests.patch, and then the return value in this state is obtained and matched with the standard value, and the test result is generated according to the matching result.

[0105] In the above-mentioned standard value acquisition step, the standard value can be obtained by using the BMC Web page or ipmitool command provided by the present invention. Of course, other tools or commands can also be used to obtain the standard value, and the test result PASS or FAIL is determined according to whether the match is successful or not. If the test result is PASS, the test can be terminated. If the test result is FAIL, the test can be retested or the test process can be specifically analyzed, such as printing out the test results corresponding to each test case through the tool, that is, Figure 8 As shown, it is convenient for testers to perform debug analysis. At the same time, the test content is organized into PDF documents, timefile.txt files, and tmp.log files, so that the test results can be seen more intuitively. Fig. 9 As shown, PDF can identify PASS items and FAIL items, while txt and log files record the test content and debug values ​​in more detail, making it easier for testers to debug the FAIL items directly and ultimately determine whether the results of this part of the test pass the test. The subsequent processing process can be determined based on the actual situation, so I will not go into details here.

[0106] The Redfish automated testing method provided in this embodiment has the problems of cumbersome manual testing, incomplete test cases, and low test coverage compared to the traditional method. The present invention improves the acquisition efficiency of standard values ​​through different standard value acquisition methods, covers and tests most of the common interfaces of Redfish through secondary matching, has a high test coverage, and ensures the integrity of the test case implementation through data conversion matching, thereby improving the test efficiency and test effect of automated testing. Furthermore, cases can be added autonomously based on the implementation logic provided by the present invention to adapt to more Redfish functional tests, so the present invention also has extremely high scalability.

[0107] See also Fig.10 Based on the same inventive concept, a Redfish automated testing system proposed in the second embodiment of the present invention includes:

[0108] The return value acquisition module 10 is used to create a Redfish session according to the selected items to be tested, and obtain the return value of the item to be tested according to the session number of the item to be tested;

[0109] The standard value acquisition module 20 is used to select a corresponding standard value acquisition method according to the function type of the item to be tested, so as to obtain the standard value corresponding to the item to be tested;

[0110] The test result generating module 30 is used to match the return value with the standard value according to the operation type of the item to be tested, and generate the test result of the item to be tested according to the matching result.

[0111] The present invention provides an OpenBMC Redfish automated testing system based on a Linux platform, which can reduce the difficulty and tediousness of manual testing of OpenBMC Redfish by automated testers, and can cover most of the common interfaces of Redfish, has a high test coverage rate, and further improves the test efficiency and test effect of Redfish automated testing.

[0112] See also Fig.11 In a preferred embodiment, the return value acquisition module 10 further includes:

[0113] The session creation module 11 is used to determine whether the number of the items to be tested is greater than a threshold. If so, the items to be tested are divided into groups according to the threshold and a Redfish session is created for each group of the items to be tested in turn. If not, a Redfish session is created for all the items to be tested.

[0114] Through the multiple create / delete session actions provided in this embodiment, the BMC session timeout phenomenon caused by too many test cases can be avoided, thereby improving the execution efficiency of the test.

[0115] Further, in another preferred embodiment, the standard value acquisition module 20 is also used to obtain the standard value corresponding to the item to be tested through BMC Web if the function type of the item to be tested is a hardware information acquisition function; if not, obtain the standard value corresponding to the item to be tested through the ipmitool instruction.

[0116] This embodiment improves the efficiency of obtaining standard values ​​by adopting different standard value acquisition methods for test cases with different functions, and further improves the test efficiency of automated testing.

[0117] Furthermore, in another preferred embodiment, the test result generating module 30 further includes:

[0118] The first matching module 31 is configured to match the return value with the standard value to obtain a matching result of the item to be tested if the operation type of the item to be tested is only a Get operation.

[0119] The present invention can realize coverage testing of URL functions whose operation type is Get operation through one-time matching of the return value and the standard value, and further realizes the automated testing of Redfish.

[0120] Furthermore, in another preferred embodiment, the test result generating module 30 further includes:

[0121] A second matching module 31 is configured to match the return value with the standard value to obtain a first matching result if the operation type of the item to be tested includes a Post operation;

[0122] If the first matching result is a successful match, use the Post operation to execute the corresponding new function; obtain a first return value and a first standard value corresponding to the new function, match the first return value with the first standard value to obtain a second matching result, and use the second matching result as the matching result of the item to be tested;

[0123] If the first matching result is a match failure, the first matching result is used as the matching result of the item to be tested.

[0124] Through the secondary matching method of this embodiment, the test coverage of URLs with the Post function can be improved, making the test results more accurate, thereby improving the test efficiency and test effect of the automated test.

[0125] Furthermore, in another preferred embodiment, the test result generating module 30 further includes:

[0126] A third matching module 33 is used to match the return value with the standard value to obtain a third matching result if the operation type of the item to be tested includes a Patch operation;

[0127] If the third matching result is a successful match, use the Patch operation to execute the corresponding update function; obtain the second return value and the second standard value corresponding to the update function, match the second return value and the second standard value to obtain a fourth matching result, and use the fourth matching result as the matching result of the item to be tested;

[0128] If the third matching result is a match failure, the third matching result is used as the matching result of the item to be tested.

[0129] Through the secondary matching method of this embodiment, the test coverage of URLs with Patch functions can be improved, making the test results more accurate, thereby improving the test efficiency and test effect of automated testing.

[0130] Based on the test system provided by the present invention, most of the common interfaces of OpenBMC Redfish can be tested, with a high test coverage rate, so that a more accurate judgment can be made on the test results of Redfish, and the test system provided by the present invention can not only test the common URL part of OpenBMC Redfish, but also test the development or fixed value URL, generate test cases through the URL return value, and use the value obtained by ipmitool or BMCWeb for comparison, and make a judgment according to the comparison result, that is, the present invention can adapt to more Redfish functional tests by adding cases independently, and has extremely high scalability.

[0131] Furthermore, in another preferred embodiment, the test result generating module 30 further includes:

[0132] A data conversion module 34, configured to perform data conversion on the return value and the standard value according to the data types of the return value and the standard value;

[0133] The converted return value and the converted standard value are matched.

[0134] The data conversion module provided in this embodiment can avoid the situation where the return value and the standard value cannot be matched or the matching result is inaccurate, so that the test system of the present invention can fully implement the test case, further improving the accuracy of the test results.

[0135] In another preferred embodiment, the test system provided by the present invention can be built based on the UnitTest framework of python, and can be divided into multiple general test item modules according to the general interface of OpenBMC Redfish. The test process of each test item module is tested according to the relevant modules of the above-mentioned test system. In addition, this embodiment also includes an environment configuration module (env.py), a test item selection module (newcase.txt), a test main program module (Main.py), OpenBMC general test item modules (1-SessionService, 2-Managers, 3-Public, 4-Systems, 5-Chassis, 6-AccountService, 7-UpdateService, 8-EventService, a-pretest) and a test document generation module (log.py). Among them, when the test main program module calls the OpenBMC general test item module according to the test item selection module to test the test case, it will call the above-mentioned return value acquisition module, standard value acquisition module, and test result generation module to test the test case. Based on this theory, a complete test system can be built.

[0136] See also Fig.12 The implementation process of the Redfish automated test system provided in this embodiment includes: first, setting up the server test environment, that is, first installing Python and ipmitool tools on the Linux system, entering the test main path under the Linux command line, and then filling in the configuration parameters of the env.py file such as bmcip, account and other information, and then filling in the newcase.txt file to select the test items to be run, such as Fig.13 In the newcase.txt file shown in the figure, the left side of the equal sign indicates the corresponding test item, the right side indicates 1 for executing the test, and 0 for not executing the test. Then, the test main program Main.py is run to execute the OpenBMC general test item module according to the selected test item. It can be seen that there are 31 items to be tested. Assuming the threshold is 20, a Redfish session is generated for the first 20 items to be tested for testing. After the test is completed, the test document generation module is executed to generate a PDF document, timefile.txt file, and tmp.log file for the tester to view and analyze. Then, the session number is deleted, and a Redfish session is created again according to other items to be tested until all items to be tested are tested.

[0137] The technical features and technical effects of the Redfish automated testing system proposed in the embodiment of the present invention are the same as those of the method proposed in the embodiment of the present invention, and are not described in detail here. Each module in the above-mentioned Redfish automated testing system can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0138] See also Fig.14 , an internal structure diagram of a computer device in one embodiment, the computer device can specifically be a terminal or a server. The computer device includes a processor, a memory, a network interface, a display and an input device connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the Redfish automated testing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0139] It can be understood by those skilled in the art that Fig.14 The structure shown in the figure is merely a block diagram of a portion of the structure related to the present application scheme, and does not constitute a limitation on the computer device to which the present application scheme is applied. The specific computing device may include more or fewer components than those shown in the figure, or combine certain components, or have the same component arrangement.

[0140] In addition, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0141] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.

[0142] In summary, the Redfish automated testing method, system, device and storage medium proposed in the embodiments of the present invention, the method creates a Redfish session according to a number of selected items to be tested, and obtains the return value of the item to be tested according to the session number of the item to be tested; selects a corresponding standard value acquisition method according to the functional type of the item to be tested to obtain the standard value corresponding to the item to be tested; matches the return value and the standard value according to the operation type of the item to be tested, and generates the test result of the item to be tested according to the matching result. The present invention reduces the difficulty and tediousness of manual testing of OpenBMC Redfish by automated testers, improves the efficiency of acquiring standard values ​​through different standard value acquisition methods, and covers and tests most of the common interfaces of Redfish through secondary matching, has a high test coverage rate, and ensures the integrity of test case implementation through data conversion matching, thereby improving the test efficiency and test effect of Redfish automated testing.

[0143] Each embodiment in this specification is described in a progressive manner, and the same or similar parts of each embodiment can be directly referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. It should be noted that the technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0144] The above-mentioned embodiments only express several preferred implementation modes of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in the technical field, several improvements and substitutions can be made without departing from the technical principles of the present invention, and these improvements and substitutions should also be regarded as the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be based on the protection scope of the claims.

Claims

1. A Redfish automated testing method, characterized in that: include: Creating a Redfish session according to the selected items to be tested, and obtaining the return value of the item to be tested according to the session number of the item to be tested; including: determining whether the number of the items to be tested is greater than a threshold, if so, dividing the items to be tested into groups according to the threshold, and creating a Redfish session for each group of the items to be tested in turn, if not, creating a Redfish session for all the items to be tested; According to the function type of the item to be tested, a corresponding standard value acquisition method is selected to obtain the standard value corresponding to the item to be tested; According to the operation type of the item to be tested, the return value and the standard value are matched, and a test result of the item to be tested is generated according to the matching result, specifically including: If the operation type of the item to be tested is only a Get operation, the matching result between the return value and the standard value is used as the test result of the item to be tested; If the operation type of the item to be tested also includes a Post operation or a Patch operation, the return value obtained through the Get operation is matched with the standard value. If the match is successful, a corresponding new operation or update operation is performed on the item to be tested, and the return value and the standard value of the item to be tested after the operation are obtained and matched to obtain the test result of the item to be tested; Before matching the return value with the standard value, the method further includes: Performing data conversion on the return value and the standard value, the conversion types including numeric type, string type and Boolean type; When the conversion type is a numeric type, the return value and the standard value are uniformly converted to float type data, and the same decimal places are retained; When the conversion type is a string type, the return value and the standard value are uniformly converted to str type data, and the spaces and upper and lower case are uniformly adjusted; When the conversion type is a Boolean type, the return value and the standard value are uniformly converted into bool type data.

2. The Redfish automated testing method according to claim 1, characterized in that: The step of selecting a corresponding standard value acquisition method according to the function type of the item to be tested to obtain the standard value corresponding to the item to be tested includes: If the function type of the item to be tested is a hardware information acquisition function, the standard value corresponding to the item to be tested is acquired through the BMC Web; if not, the standard value corresponding to the item to be tested is acquired through the ipmitool command.

3. The Redfish automated testing method according to claim 1, characterized in that: The step of matching the return value with the standard value comprises: Performing data conversion on the return value and the standard value according to the data types of the return value and the standard value; The converted return value and the converted standard value are matched.

4. A Redfish automated testing system, characterized in that: include: The return value acquisition module is used to create a Redfish session according to the selected items to be tested, and obtain the return value of the items to be tested according to the session number of the items to be tested; including: judging whether the number of the items to be tested is greater than a threshold, if so, dividing the items to be tested into groups according to the threshold, and creating a Redfish session for each group of the items to be tested in turn, if not, creating a Redfish session for all the items to be tested; A standard value acquisition module, used to select a corresponding standard value acquisition method according to the function type of the item to be tested, so as to obtain the standard value corresponding to the item to be tested; A test result generating module is used to match the return value with the standard value according to the operation type of the item to be tested, and generate a test result of the item to be tested according to the matching result, specifically including: If the operation type of the item to be tested is only a Get operation, the matching result between the return value and the standard value is used as the test result of the item to be tested; If the operation type of the item to be tested also includes a Post operation or a Patch operation, the return value obtained through the Get operation is matched with the standard value. If the match is successful, a corresponding new operation or update operation is performed on the item to be tested, and the return value and the standard value of the item to be tested after the operation are obtained and matched to obtain the test result of the item to be tested; Before matching the return value with the standard value, the method further includes: Performing data conversion on the return value and the standard value, the conversion types including numeric type, string type and Boolean type; When the conversion type is a numeric type, the return value and the standard value are uniformly converted to float type data, and the same decimal places are retained; When the conversion type is a string type, the return value and the standard value are uniformly converted to str type data, and the spaces and upper and lower case are uniformly adjusted; When the conversion type is a Boolean type, the return value and the standard value are uniformly converted into bool type data.

5. The Redfish automated testing system according to claim 4, characterized in that: The standard value acquisition module is further used to obtain the standard value corresponding to the item to be tested through BMC Web if the function type of the item to be tested is a hardware information acquisition function, and if not, obtain the standard value corresponding to the item to be tested through an ipmitool instruction.

6. The Redfish automated testing system according to claim 4, characterized in that: The test result generating module comprises a first matching module; The first matching module is used to match the return value with the standard value to obtain a matching result of the item to be tested if the operation type of the item to be tested is only a Get operation.

7. The Redfish automated testing system according to claim 4, characterized in that: The test result generation module includes a second matching module; The second matching module is used for matching the return value with the standard value to obtain a first matching result if the operation type of the item to be tested includes a Post operation; If the first matching result is a successful match, use the Post operation to execute the corresponding new function; obtain a first return value and a first standard value corresponding to the new function, match the first return value with the first standard value to obtain a second matching result, and use the second matching result as the matching result of the item to be tested; If the first matching result is a match failure, the first matching result is used as the matching result of the item to be tested.

8. The Redfish automated testing system according to claim 4, characterized in that: The test result generation module includes a third matching module; The third matching module is used for matching the return value with the standard value to obtain a third matching result if the operation type of the item to be tested includes a Patch operation; If the third matching result is a successful match, use the Patch operation to execute the corresponding update function; obtain the second return value and the second standard value corresponding to the update function, match the second return value and the second standard value to obtain a fourth matching result, and use the fourth matching result as the matching result of the item to be tested; If the third matching result is a match failure, the third matching result is used as the matching result of the item to be tested.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.