CN116737571A - Redfish automatic test method, system, equipment and storage medium - Google Patents

Redfish automatic test method, system, equipment and storage medium Download PDF

Info

Publication number
CN116737571A
CN116737571A CN202310715899.4A CN202310715899A CN116737571A CN 116737571 A CN116737571 A CN 116737571A CN 202310715899 A CN202310715899 A CN 202310715899A CN 116737571 A CN116737571 A CN 116737571A
Authority
CN
China
Prior art keywords
tested
item
standard value
test
matching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310715899.4A
Other languages
Chinese (zh)
Other versions
CN116737571B (en
Inventor
叶立夫
马振鹏
杜少华
张苗苗
王春平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hexin Technology Co ltd
Hexin Technology Suzhou Co ltd
Original Assignee
Hexin Technology Co ltd
Hexin Technology Suzhou Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hexin Technology Co ltd, Hexin Technology Suzhou Co ltd filed Critical Hexin Technology Co ltd
Priority to CN202310715899.4A priority Critical patent/CN116737571B/en
Priority claimed from CN202310715899.4A external-priority patent/CN116737571B/en
Publication of CN116737571A publication Critical patent/CN116737571A/en
Application granted granted Critical
Publication of CN116737571B publication Critical patent/CN116737571B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/14Arrangements for monitoring or testing data switching networks using software, i.e. software packages
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A40/00Adaptation technologies in agriculture, forestry, livestock or agroalimentary production
    • Y02A40/80Adaptation technologies in agriculture, forestry, livestock or agroalimentary production in fisheries management
    • Y02A40/81Aquaculture, e.g. of fish

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of automatic test, and discloses a method, a system, equipment and a storage medium for automatically testing Redfish, which comprise the steps of creating a Redfish session according to a plurality of selected items to be tested, and acquiring a return value of the items to be tested according to the session numbers of the items to be tested; selecting a corresponding standard value acquisition mode according to the function type of the item to be tested to obtain a standard value corresponding to the item to be tested; and 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. The invention improves the acquisition efficiency of the standard value through different standard value acquisition modes, covers and tests most of universal interfaces of the Redfish through a secondary matching mode, has higher test coverage rate, ensures the implementation integrity of the test case through a data conversion matching mode, and improves the test efficiency and the test effect of the automatic test.

Description

Redfish automatic test method, system, equipment and storage medium
Technical Field
The invention relates to the technical field of automatic testing, in particular to a method, a system, equipment and a storage medium for automatically testing Redfish.
Background
Redfish is a management standard based on HTTPs service, and uses RESTful interface to realize device management. Each HTTPs operation submits or returns a resource or result in the UTF-8 coded JSON format, and provides a simpler and modern management function through a unified management interface, so that the server hardware can be subjected to omnibearing interface management, monitoring and adaptation, and the next development and test work can be conveniently carried out. OpenBMC is an open source version of BMC for better access and control of BMC.
At present, the existing OpenBMC Redfish test method mostly uses the OpenBMC Redfish interface description document provided by the product/project to test through software tools such as Postman, namely, test information is filled in, corresponding return value information bodies are returned by Postman, a tester judges whether the test is correct or not according to the return values, and finally, operations such as writing a test report are written. Therefore, a method for automatically testing the Redfish is needed to reduce the difficulty and complexity of the automated tester to manually test the OpenBMC Redfish.
Disclosure of Invention
In order to solve the technical problems, the invention provides a method, a system, equipment and a storage medium for automatically testing Redfish, which can solve the complex and complicated manual test and achieve the purpose of simply and efficiently realizing the automatic test of Redfish.
To achieve the above object, in a first aspect, the present invention provides a Redfish automated test method, the method comprising:
establishing a Redfish session according to a plurality of selected items to be tested, and acquiring a return value of the items to be tested according to the session number of the items to be tested;
selecting a corresponding standard value acquisition mode according to the function type of the item to be tested to obtain a standard value corresponding to the item to be tested;
and 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.
Further, the step of creating a Redfish session according to the selected number of items to be tested includes:
judging whether the number of the items to be tested is larger than a threshold value, if so, classifying the items to be tested according to the threshold value, creating a Redfish session for each group of the items to be tested in sequence, and if not, creating a Redfish session for all the items to be tested.
Further, the step of selecting a corresponding standard value obtaining mode 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, acquiring a standard value corresponding to the item to be tested through BMC Web, and if not, acquiring the standard value corresponding to the item to be tested through an ipmitool instruction.
Further, the step of matching the return value with the standard value includes:
according to the data types of the return value and the standard value, carrying out data conversion on the return value and the standard value;
and matching the converted return value with the converted standard value.
In a second aspect, the present invention provides a Redfish automated test system, the system comprising:
the return value acquisition module is used for creating a Redfish session according to the selected plurality of items to be tested and acquiring the return value of the items to be tested according to the session number of the items to be tested;
the standard value acquisition module is used for selecting a corresponding standard value acquisition mode according to the function type of the item to be tested so as to obtain a standard value corresponding to the item to be tested;
And the test result generation module is used for 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.
Further, the standard value obtaining module is further configured to obtain, through a BMC Web, a standard value corresponding to the item to be tested if the function type of the item to be tested is a hardware information obtaining function, and obtain, through an ipmitool instruction, the standard value corresponding to the item to be tested if not.
Further, the test result generation module comprises a first matching module;
and the first matching module is used for matching the return value with the standard value if the operation type of the item to be tested is only Get operation, so as to obtain a matching result of the item to be tested.
Further, the test result generation module comprises a second matching module;
the second matching module is configured to match the return value with the standard value if the operation type of the item to be tested includes Post operation, so as to obtain a first matching result;
if the first matching result is that the matching is successful, performing a corresponding newly added function by using Post operation; acquiring a first return value and a first standard value corresponding to the new function, matching the first return value with the first standard value to obtain a second matching result, and taking the second matching result as a matching result of the item to be tested;
And if the first matching result is unsuccessful, taking the first matching result as the matching result of the item to be tested.
Further, the test result generation module comprises a third matching module;
the third matching module is configured to match the return value with the standard value if the operation type of the item to be tested includes a Patch operation, so as to obtain a third matching result;
if the third matching result is that the matching is successful, executing a corresponding updating function by using a Patch operation; acquiring a second return value and a second standard value corresponding to the updating function, matching the second return value with the second standard value to obtain a fourth matching result, and taking the fourth matching result as a matching result of the item to be tested;
and if the third matching result is unsuccessful, taking the third matching result as the matching result of the item to be tested.
In a third aspect, embodiments of the present invention further provide a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the computer program.
In a fourth aspect, embodiments of the present invention also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above method.
The invention provides a method, a system, computer equipment and a storage medium for automatically testing Redfish, by which the difficulty and complexity of manually testing OpenBMC Redfish by an automatic tester can be reduced, so that the coverage rate and efficiency of URL testing of the OpenBMC Redfish are improved, and the testing effect of the automatic testing is further improved.
Drawings
FIG. 1 is a schematic flow diagram of testing OpenBMC Redfish based on Postman software;
FIG. 2 is a flow chart of a Redfish automated test method in accordance with an embodiment of the present invention;
FIG. 3 is a schematic flow chart of another embodiment of the Redfish automated test method;
fig. 4 is a schematic flow chart of step S20 in fig. 2;
fig. 5 is a schematic flow chart of step S30 in fig. 2;
FIG. 6 is a schematic diagram of another flow chart of step S30 in FIG. 2;
FIG. 7 is a schematic diagram of a third flow chart of a Redfish automated test method according to an embodiment of the present invention;
FIG. 8 is a schematic diagram showing test results of a Redfish automated test method according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of a test document generated by a Redfish automated test method in an embodiment of the present invention;
FIG. 10 is a schematic diagram of a Redfish automated test system according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of another configuration of a Redfish automated test system according to an embodiment of the present invention;
FIG. 12 is a schematic diagram of an implementation process of a Redfish automated test system in accordance with an embodiment of the present invention;
FIG. 13 is a schematic diagram of a Redfish automated test system selecting items to be tested in an embodiment of the present invention;
fig. 14 is an internal structural view of a computer device in the embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Before the technical scheme of the invention is explained, technical keywords related to the invention are explained: BMC: a baseboard management controller (Baseboard Management Controller) that monitors the machine's temperature, fan, health status, voltage, etc. independent of the machine's microsystems, to bring the machine into health status; openBMC: an open/open source version of BMC; redfish: an HTTPs service-based management standard is used for realizing equipment management by using a RESTful interface; ipmitool: an ipmi platform management tool in a command line mode, which can be used in a linux system, supports the ipmi1.5 specification and can realize the functions of acquiring information of a sensor, displaying log content of the system, remotely switching on and switching off a network and the like; python: a cross-platform computer programming language; python requests library: the requests library in Python is an HTTP library developed based on Python using an Apache2 Licensed license, and has a common operation such as get, post, patch; postman: a Chrome plug-in for debugging a web page and sending an HTTP request of the web page; BMC Web: based on the Web page above the BMC, a user can log in by inputting BMC IP in the browser and view the related hardware device information of the server, alarm log and the like.
Referring to fig. 1, in the current test method for OpenBMC Redfish, the OpenBMC Redfish interface description document provided by a product/project is mostly tested by software tools such as Postman, specifically, corresponding test requirements are filled in through a webpage provided by Postman to obtain a corresponding return value, and the filled information during test includes: (1) after clicking and transmitting the information, the message body of the corresponding return value (5) is obtained in the Postman, the tester can judge whether the message body is correct or not according to the return values, and finally, operations such as writing a test report and the like are carried out. In order to reduce the difficulty and complexity of an automated tester to the OpenBMC Redfish manual test, the invention provides an automated test method of the OpenBMC Redfish based on a Linux platform.
Referring to fig. 2, a Redfish automatic test method according to a first embodiment of the present invention includes steps S10 to S30:
step S10, a Redfish session is created according to a plurality of selected items to be tested, and a return value of the items to be tested is obtained according to the session number of the items to be tested.
The invention relates to an automatic test for OpenBMC Redfish, which needs to configure a test environment before the test, and comprises the following steps: installing python and ipmitool tools on the linux system, entering a test main path under a linux command line, and filling corresponding configuration parameters including bmcip, bmcwebip, systemip, account passwords and other information, for example, the following configuration information can be filled in:
bmcip=‘10.100.100.1’
bmcwebip=‘10.100.100.2’
systemip=‘10.100.100.3’
username=‘admin’
password=‘admin’
sysusername=‘root’
syspassword=‘1234567’
after the environment configuration is finished, a Test case (Test case) to be tested, which is an item to be tested, can be selected, and the invention can automatically Test each interface of the OpenBMC Redfish, for example SessionService, managers, public, systems, chassis, accountService, updateService, eventService, because the Redfish is a management standard based on the HTTPs service, it can be considered that one item to be tested is to Test the return value of one Redfish URL, for example (1) filled in fig. 1 is one Redfish URL to be tested, the return value corresponding to the URL is obtained by executing the Test case shown in fig. 1, in fact, one Redfish session can be established based on a plurality of items to be tested, if a plurality of cases are selected for testing, one Redfish session can be established for a plurality of selected cases, and although the number of times of establishing the Redfish session is reduced by the session establishment mode, a problem exists that when the number of cases is too large, the total time of the Test can be caused, and in order to avoid the case of overtime phenomenon, in the preferred embodiment, the invention is implemented in a BMC:
Judging whether the number of the items to be tested is larger than a threshold value, if so, classifying the items to be tested according to the threshold value, creating a Redfish session for each group of the items to be tested in sequence, and if not, creating a Redfish session for all the items to be tested.
Referring to fig. 3, in this embodiment, a threshold is set for the number of items to be tested, for example, the threshold is set to 20, after the test is started, it is first determined whether the total number of test cases exceeds the threshold, if not, a Redfish session is created through createsion, the ID number of the Redfish is obtained through GetSessionID, the test is performed according to the selected order until all the test cases are tested, and finally the ID number of the Redfish is deleted through delecessionid, and the test is ended.
If the threshold is exceeded, the test cases are divided into a plurality of test groups according to the threshold, one test group creates a Redfish session, and the test performed for each test group is identical to the step that does not exceed the threshold in the first half, wherein after the test is sequentially performed for one group of test cases, the ID number of the Redfish is deleted by Deleteless ID, and then the Redfish session is re-created for the next group of test cases until all test cases are performed, that is, the embodiment avoids the occurrence of a timeout condition by performing a plurality of times of create/delete session actions.
In the test process of one Redfish session, the Redfish session can be created through Createess, the ID number of the Redfish can be obtained through GetSessionID, and then the information returned by the test case, namely the URL, can be obtained based on the ID number.
After obtaining the ID number of the Redfish, the returned information of the URL of the OpenBMC Redfish may be obtained by using the requests in the Python requests library of Python, and of course, in order to verify whether the interface operates normally, standard information corresponding to the URL needs to be obtained for verification.
And step S20, selecting a corresponding standard value acquisition mode according to the function type of the item to be tested so as to obtain a standard value corresponding to the item to be tested.
For the acquisition of the standard value of the URL of the OpenBMC Redfish, the conventionally adopted method may use the ipmitool tool to execute the relevant ipmitool instruction to acquire standard information such as sensor information, system log content and the like, but most of the BMC parameter values acquired by the ipmitool are returned results by one instruction, so that the acquisition of the standard value is very complicated, and the acquisition efficiency of the standard value is affected.
If the function type of the item to be tested is a hardware information acquisition function, acquiring a standard value corresponding to the item to be tested through BMC Web, and if not, acquiring the standard value corresponding to the item to be tested through an ipmitool instruction.
Referring to fig. 4, in the standard obtaining process of the present embodiment, the function type of the test case is first determined, if the test case is used to obtain hardware information, such as information of a model number, a quantity, a product serial number, a firmware version number, etc. of a device such as a CPU, a memory, a hard disk, a PCIe card, a network card, etc., the standard value of the test case may be directly obtained through a BMC Web, which is a Web interface of a server BMC, and a user may obtain corresponding hardware information, such as parameter information of a model number, a quantity, a product serial number, etc. of a CPU, a memory, a hard disk, a PCIe card, a network card set, etc., through a BMC Web page, and may view corresponding SEL log alarm information. The embodiment utilizes the function of the BMC Web, the part of information can be obtained by executing an instruction, and meanwhile, a tester can directly log in the BMC Web to check the part of standard information value without using an ipmitool tool to perform complicated standard value obtaining operation; if the test case is another function, the corresponding standard value still needs to be obtained through the ipmitool instruction. According to the embodiment, different standard value acquisition modes are adopted for the test cases with different functions, so that the standard value acquisition efficiency is improved, and the test efficiency of the automatic test is further improved.
And 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.
In conventional automatic testing, for the interface function of the Redfish, the return information of the tested URL is basically obtained through the Get function, but in reality, for the URL in the Redfish, the corresponding operation type includes not only the Get operation, but also other operation types. As can be seen from the above description, the data transmission of the Redfish is based on the hypertext transfer protocol HTTP, and the Request format includes Method, request-URL and HTTP-Version, where the Method is the operation type corresponding to the URL, including Get, post, patch and Delete. The following is illustrative:
wherein 10.100.100.1 is a bmc ip address;
get is an acquisition operation, such as acquiring system account information:
GET operation, namely URL 10.100.100.1/redfish/v1/AccountService;
post is a new operation and an execution operation, such as adding an account:
POST operation, namely URL 10.100.100.1/redfish/v1/AccountService/Accounts, wherein the request body is { "username": "test01", "password": "123456" };
Patch is an update operation, such as updating an account password:
PATCH operation URL 10.100.100.1/redfish/v1/Account service/Account/test 01,
{“password”:“654321”};
detele is a delete operation, such as deleting an account:
DETELE operation, URL 10.100.100.1/redfish/v 1/Accountives/01;
that is, the OpenBMC Redfish includes a plurality of URLs, and each URL may have one or more operation types corresponding to the URL, for example, for account information, account information may be obtained through Get operation, an account may be newly added through Post operation, and for newly added account information, delete operation may be used to Delete.
When the conventional Redfish is subjected to automatic test, the return value of the URL is obtained only through the Get operation, and then whether the case operates normally is judged by comparing the return value with the standard value, but for other operations such as updating or adding, a specific test process is not provided, namely the test does not cover the functions such as modification or adding. In order to improve the test coverage of the Redfish automated test, the present invention provides a preferred embodiment in which different test flows are employed for different URLs.
Referring to fig. 5, in this embodiment, after obtaining the ID number of the Redfish, and using the requests in the Python requests library of Python to obtain the return information of the URL of the OpenBMC Redfish, determining the operation type of the URL, if the operation type of the URL has only Get operation, determining whether the test passes according to the matching result of the return value and the standard value, if the operation type of the URL also includes Post operation or Patch operation, comparing the standard value and the return value after executing the corresponding requests.post operation or requests.patch operation on the Redfish URL according to the operation type, generating the test result of the test item according to the comparison result, outputting the test process and the test result to log, and finishing the test process and the test result into documents in formats such as PDF, txt, etc. so as to check the specific condition of the test, and finally deleting the Redfish session to end the test.
Specifically, the matching process for URLs of different operation types includes:
and if the operation type of the item to be tested is only Get operation, matching the return value with the standard value to obtain a matching result of the item to be tested.
If the URL only supports Get operation, the test result can be judged only by matching the return value with the standard value, namely, the coverage test of the URL function is realized.
Further, if the operation type of the item to be tested comprises Post operation, matching the return value with the standard value to obtain a first matching result;
if the first matching result is successful, performing a corresponding new function by using Post operation, acquiring a first return value and a first standard value corresponding to the new function, matching the first return value with the first standard value to obtain a second matching result, and taking the second matching result as the matching result of the item to be tested;
and if the first matching result is unsuccessful, taking the first matching result as the matching result of the item to be tested.
And when the URL is successful in the first matching, a user is added through the Post function, then the return value and the standard value corresponding to the newly added function are acquired again through the return value and the standard value, the second matching is carried out, the test result of the URL is judged to be normal only under the condition that the second matching is successful, otherwise, the test result of the URL is judged to be abnormal. Through the secondary matching mode of the embodiment, the test coverage rate of the URL with the Post function can be improved, and the test result is more accurate, so that the test efficiency and the test effect of the automatic test are improved.
Further, if the operation type of the item to be tested comprises a Patch operation, matching the return value with the standard value to obtain a third matching result;
if the third matching result is successful, performing a corresponding updating function by using a Patch operation, acquiring a second return value and a second standard value corresponding to the updating function, matching the second return value with the second standard value to obtain a fourth matching result, and taking the fourth matching result as a matching result of the item to be tested;
and if the third matching result is unsuccessful, taking the third matching result as the matching result of the item to be tested.
And if the return state is in a closed state, updating the server ID lamp to be in an open state through the Patch function, and then re-acquiring the return value and the standard value corresponding to the updating function through the acquisition steps of the return value and the standard value, and performing second matching, wherein the test result of the URL is judged to be normal only if the second matching is successful. Through the secondary matching mode of the embodiment, the test coverage rate of the URL with the Patch function can be improved, and the test result is more accurate, so that the test efficiency and the test effect of the automatic test are improved.
Of course, for the case that the URL also supports Delete operation, the URL may be tested by secondary matching, for example, after the first matching is successful, the user information may be deleted by the Delete function, and then the rest of the user information may be queried by the Get function, so that whether the Delete operation is successful may be tested, and thus a more accurate determination may be made on the test result of the URL. Based on the test method provided by the invention, most of the universal interfaces of the OpenBMC Redfish can be tested, the test coverage rate is higher, so that the test result of the Redfish can be judged more accurately, the test method provided by the invention can be used for testing not only the URL part of the OpenBMC Redfish, but also the URL with an opened or fixed value, the URL return value is used for generating the test case, and meanwhile, the values obtained by using the ipmitool or BMC Web are compared, and the judgment is made according to the comparison result, namely, the invention can adapt to the functional test of more Redfish by independently adding case, and has extremely high expansibility.
Further, for the matching process of the return value and the standard value, it is conventional practice to directly carry out the comparison, but in the actual situation, some values cannot be directly used for the comparison, such as the case of letters, the character string with spaces, and the unit format of data, etc., in order to solve the problem, the present invention also provides a preferred embodiment to avoid the situation that some values cannot be compared.
In this embodiment, data of the return value and the standard value are subjected to unified data conversion, and then the converted return value and standard value are matched, wherein the converted types include a digital type, a character string type and a boolean type, and for the digital type, the return value and the standard value are subjected to unified conversion into float type data, and the same decimal place is reserved; for the character string type, uniformly converting the character string type and the character string type into str type data, uniformly adjusting space and case, such as uniformly adjusting to capitalization and deleting the space; for the Boolean type, both are uniformly converted into the bool type data. The data conversion process of the present embodiment will be described below by taking specific data as an example.
Referring to fig. 6, the comparison information is a return value and a standard value, and if the comparison information is of a digital type, such as a 5V voltage value, the return value is 5.10000, and the standard value is 5.1, so that the two values are uniformly converted into float types, and the same decimal place, such as the last two digits of the decimal point, is reserved, so that the return value and the standard value are both converted into 5.10. If the comparison information is of a string type, such as a memory model, the return value is M393A2K40D, and the standard value is M393A2K40D, the two cases are unified, i.e. both cases are converted into M393A2K40D. If the comparison information is of boolean type, for example, the heat dissipation policy can be turned on, the return value is True, and the standard value is True, at this time, the return value and the standard value are uniformly converted into True, and of course, the standard value may also be False, at this time, the standard value may be converted into False, and the uniformly converted return value and standard value can be directly matched.
Referring to fig. 7, the following describes in detail a test flow of the test method according to the present invention by a specific embodiment:
after the environment configuration is completed and the item to be tested is selected, testing is started, whether the Redfish URL only supports Get operation or not is judged, namely only has Get function, if yes, corresponding information, such as OpenBMC Redfish CUP page information, is obtained through the requests, and then whether the return value is consistent with the obtained standard value or not is judged to generate a test result.
If the Redfish URL also supports Post operation, performing first matching, for example, acquiring returned user information through the requests, and then performing matching with a corresponding standard value, after the first matching is successful, creating BMC user test01 through the requests, including passwords, user rights and the like, and performing second matching, namely acquiring newly added user information of the user test01 through the requests, and simultaneously acquiring a corresponding standard value, and then performing matching of the returned value and the standard value, and generating a test result according to a matching result.
If the Redfish URL also supports the Patch operation, first matching is performed, for example, the server ID lamp is acquired to be in an off state through the request, the return value is matched with the acquired standard value, after the first matching is successful, the server ID lamp is modified to be in an on state through the request, the return value in the state is acquired to be matched with the standard value, and a test result is generated according to the matching result.
In the step of obtaining the standard value, the standard value may be obtained by adopting the method provided by the invention through a BMC Web page or an ipmitool instruction, or other tools or instructions may be adopted to obtain the standard value, and the test result PASS or FAIL may be determined according to whether the matching is successful or not, if the test result is PASS, the test may be ended, if the test result is FAIL, retest may be performed or specific analysis may be performed on the test process, for example, the test result corresponding to each test case is printed out through the tool, as shown in fig. 8, so as to facilitate the test personnel to perform Debug analysis, and meanwhile, the test contents are arranged to generate PDF documents, timefile, tmp.log files, etc., so that the test result may be more intuitively seen, that is, as shown in fig. 9, the PDF may identify the PASS item and the FAIL item, the test content and the Debug value are recorded in detail, so that the test personnel may directly perform Debug on the FAIL item, and finally determine whether the test result passes the test or not, and the subsequent processing may not be determined in detail according to the actual condition.
Compared with the traditional method, the Redfish automatic test method has the problems of complicated manual test, incomplete test cases, low test coverage rate and the like, the invention improves the acquisition efficiency of the standard value by different standard value acquisition modes, covers and tests most of universal interfaces of the Redfish by a secondary matching mode, has higher test coverage rate, ensures the implementation integrity of the test cases by a data conversion matching mode, and improves the test efficiency and the test effect of the automatic test. Furthermore, the case can be added autonomously based on the realization logic provided by the invention to adapt to the function test of more Redfish, so the invention has extremely high expansibility.
Referring to fig. 10, based on the same inventive concept, a Redfish automated test system according to a second embodiment of the present invention includes:
the return value acquisition module 10 is configured to create a Redfish session according to a selected number of items to be tested, and acquire a return value of the items to be tested according to a session number of the items to be tested;
the standard value obtaining module 20 is configured to select a corresponding standard value obtaining manner according to the function type of the item to be tested, so as to obtain a standard value corresponding to the item to be tested;
and the test result generating module 30 is configured 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.
The invention provides an OpenBMC (open baseboard management controller) Redfish automatic test system based on a Linux platform, which can reduce the difficulty and complexity of an automatic tester on the OpenBMC Redfish manual test, can cover most of universal interfaces for testing the Redfish, has higher test coverage rate, and further improves the test efficiency and test effect of the Redfish automatic test.
Referring to fig. 11, in a preferred embodiment, the return value obtaining module 10 further includes:
The session creation module 11 is configured to determine whether the number of items to be tested is greater than a threshold, if yes, divide the items to be tested into groups according to the threshold, and create a Redfish session for each group of items to be tested in turn, if not, create a Redfish session for all the items to be tested.
Through the multiple session creation/deletion actions provided by the embodiment, the phenomenon of BMC session overtime caused by excessive test cases can be avoided, so that the execution efficiency of the test is improved.
Further, in another preferred embodiment, the standard value obtaining module 20 is further configured to obtain, through the BMC Web, a standard value corresponding to the item to be tested if the function type of the item to be tested is a hardware information obtaining function, and obtain, through the ipmitool instruction, the standard value corresponding to the item to be tested if not.
According to the embodiment, different standard value acquisition modes are adopted for the test cases with different functions, so that the standard value acquisition efficiency is improved, and the test efficiency of the automatic test is further improved.
Further, in another preferred embodiment, the test result generation module 30 further includes:
and the first matching module 31 is configured to match the return value with the standard value if the operation type of the item to be tested is only Get operation, so as to obtain a matching result of the item to be tested.
The invention can realize the coverage test of the URL function with the operation type of Get operation by one-time matching of the return value and the standard value, and further realize the automatic test of the Redfish.
Further, in another preferred embodiment, the test result generation module 30 further includes:
the second matching module 31 is configured to match the return value with the standard value if the operation type of the item to be tested includes Post operation, so as to obtain a first matching result;
if the first matching result is that the matching is successful, performing a corresponding newly added function by using Post operation; acquiring a first return value and a first standard value corresponding to the new function, matching the first return value with the first standard value to obtain a second matching result, and taking the second matching result as a matching result of the item to be tested;
and if the first matching result is unsuccessful, taking the first matching result as the matching result of the item to be tested.
Through the secondary matching mode of the embodiment, the test coverage rate of the URL with the Post function can be improved, and the test result is more accurate, so that the test efficiency and the test effect of the automatic test are improved.
Further, in another preferred embodiment, the test result generation module 30 further includes:
a third matching module 33, configured to, if the operation type of the item to be tested includes a Patch operation, match the return value with the standard value, and obtain a third matching result;
if the third matching result is that the matching is successful, executing a corresponding updating function by using a Patch operation; acquiring a second return value and a second standard value corresponding to the updating function, matching the second return value with the second standard value to obtain a fourth matching result, and taking the fourth matching result as a matching result of the item to be tested;
and if the third matching result is unsuccessful, taking the third matching result as the matching result of the item to be tested.
Through the secondary matching mode of the embodiment, the test coverage rate of the URL with the Patch function can be improved, and the test result is more accurate, so that the test efficiency and the test effect of the automatic test are improved.
Based on the test system provided by the invention, most of the universal interfaces of the OpenBMC Redfish can be tested, and the test system has higher test coverage rate, so that the test result of the Redfish can be judged more accurately, the test system provided by the invention can test not only the URL part of the OpenBMC Redfish, but also the URL with an opened or fixed value, the URL returns a value to generate a test case, and meanwhile, the values acquired by using the ipmitool or BMC Web are compared, and the judgment is made according to the comparison result, namely, the invention can adapt to the functional test of more Redfish by independently adding case, and has extremely high expansibility.
Further, in another preferred embodiment, the test result generation module 30 further includes:
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;
and matching the converted return value with the converted standard value.
The data conversion module provided by the embodiment can avoid the situation that the return value and the standard value cannot be matched or the matching result is inaccurate, so that the test system can completely implement the test case, and the accuracy of the test result is further improved.
In another preferred embodiment, the test system provided by the invention can be built based on the python UnitTest framework, and the universal interface according to OpenBMC Redfish can be divided into a plurality of universal test item modules, and the test flow of each test item module tests according to the related modules of the test system, and in this embodiment, the test system further comprises an environment configuration module (env. Py), a test item selection module (newcase. Txt), a main test program module (main. Py), an OpenBMC universal test item module (1-session service, 2-manager, 3-Public, 4-Systems, 5-Chassis, 6-acceuntservice, 7-update service, 8-EventService, a-pre), and a test document generation module (. Py), wherein when the test main test program module calls the OpenBMC universal test item module to test the test cases according to the test item selection module, the main test program module can call the return value acquisition module, the standard value acquisition module, and the test case generation module can be built based on the theoretical test results of the test system.
Referring to fig. 12, the implementation process of the Redfish automatic test system provided in the embodiment includes: firstly, a test environment of a server is built, namely, python and ipmitool tools are firstly installed on a linux system, a test main path is entered under a linux command line, then configuration parameters such as bmcip, account and the like of env.py files are filled in, then newcase.txt files are filled in to select test items to be operated, such as newcase.txt files shown in fig. 13, corresponding test items are left in an equal number, the right 1 is for executing a test, 0 is not for executing the test, then a test main program main.py is operated, an OpenBMC universal test item module is executed according to the selected test items to perform the test, 31 selected test items can be seen, a test file generation module is executed after the test is completed for generating a first 20 test items to be tested, PDF files, time.txt files and tmp.log files are generated for test personnel to check and analyze, then the session numbers are deleted, and all the test items to be tested are created again according to the test items to be tested until all the test items to be tested are completed.
The technical features and technical effects of the Redfish automatic test system provided by the embodiment of the invention are the same as those of the method provided by the embodiment of the invention, and are not repeated here. The various modules in the Redfish automated test system described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
Referring to FIG. 14, in one embodiment, an internal architecture diagram of a computer device, which may be a terminal or a server in particular. The computer device includes a processor, a memory, a network interface, a display, and an input device connected by a system bus. Wherein the processor of the computer device is configured 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 computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by the processor, implements a Redfish automated test method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those of ordinary skill in the art that the architecture shown in fig. 14 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer devices to which the present inventive arrangements may be applied, and that a particular computing device may include more or fewer components than those shown in the way, or may combine certain components, or have the same arrangement of components.
In addition, the embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the steps of the method when executing the computer program.
Furthermore, the embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when being executed by a processor, implements the steps of the method.
In summary, the method, the system, the equipment and the storage medium for automatically testing the Redfish provided by the embodiment of the invention are characterized in that a Redfish session is created according to a plurality of selected items to be tested, and the return value of the items to be tested is obtained according to the session number of the items to be tested; selecting a corresponding standard value acquisition mode according to the function type of the item to be tested to obtain a standard value corresponding to the item to be tested; and 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. The invention reduces the difficulty and complexity of the manual test of the OpenBMC Redfish by the automatic tester, improves the acquisition efficiency of the standard value by different standard value acquisition modes, covers and tests most of the universal interfaces of the Redfish by a secondary matching mode, has higher test coverage rate, and ensures the implementation integrity of the test case by a data conversion matching mode, thereby improving the test efficiency and the test effect of the automatic test of the Redfish.
In this specification, each embodiment is described in a progressive manner, and all the embodiments are directly the same or similar parts referring to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments. It should be noted that, any combination of the technical features of the foregoing embodiments may be used, and for brevity, all of the possible combinations of the technical features of the foregoing embodiments are not described, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few preferred embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the application. It should be noted that modifications and substitutions can be made by those skilled in the art without departing from the technical principles of the present application, and such modifications and substitutions should also be considered to be within the scope of the present application. Therefore, the protection scope of the patent of the application is subject to the protection scope of the claims.

Claims (11)

1. A method for automated testing of Redfish comprising:
establishing a Redfish session according to a plurality of selected items to be tested, and acquiring a return value of the items to be tested according to the session number of the items to be tested;
selecting a corresponding standard value acquisition mode according to the function type of the item to be tested to obtain a standard value corresponding to the item to be tested;
and 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.
2. The method for automated Redfish testing according to claim 1, wherein the step of creating a Redfish session from the selected number of items to be tested comprises:
judging whether the number of the items to be tested is larger than a threshold value, if so, classifying the items to be tested according to the threshold value, creating a Redfish session for each group of the items to be tested in sequence, and if not, creating a Redfish session for all the items to be tested.
3. The Redfish automation test method according to claim 1, wherein the step of selecting a corresponding standard value obtaining manner according to the function type of the item to be tested to obtain the standard value corresponding to the item to be tested comprises:
If the function type of the item to be tested is a hardware information acquisition function, acquiring a standard value corresponding to the item to be tested through BMC Web, and if not, acquiring the standard value corresponding to the item to be tested through an ipmitool instruction.
4. The Redfish automated test method of claim 1, wherein the step of matching the return value and the standard value comprises:
according to the data types of the return value and the standard value, carrying out data conversion on the return value and the standard value;
and matching the converted return value with the converted standard value.
5. A Redfish automated test system, comprising:
the return value acquisition module is used for creating a Redfish session according to the selected plurality of items to be tested and acquiring the return value of the items to be tested according to the session number of the items to be tested;
the standard value acquisition module is used for selecting a corresponding standard value acquisition mode according to the function type of the item to be tested so as to obtain a standard value corresponding to the item to be tested;
and the test result generation module is used for 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.
6. The Redfish automated test system according to claim 5, wherein the standard value obtaining module is further configured to obtain, through a BMC Web, a standard value corresponding to the item to be tested if the function type of the item to be tested is a hardware information obtaining function, and obtain, through an ipmitool instruction, the standard value corresponding to the item to be tested if not.
7. The Redfish automated test system of claim 5, wherein the test result generation module comprises a first matching module;
and the first matching module is used for matching the return value with the standard value if the operation type of the item to be tested is only Get operation, so as to obtain a matching result of the item to be tested.
8. The Redfish automated test system of claim 5, wherein the test result generation module comprises a second matching module;
the second matching module is configured to match the return value with the standard value if the operation type of the item to be tested includes Post operation, so as to obtain a first matching result;
if the first matching result is that the matching is successful, performing a corresponding newly added function by using Post operation; acquiring a first return value and a first standard value corresponding to the new function, matching the first return value with the first standard value to obtain a second matching result, and taking the second matching result as a matching result of the item to be tested;
And if the first matching result is unsuccessful, taking the first matching result as the matching result of the item to be tested.
9. The Redfish automated test system of claim 5, wherein the test result generation module comprises a third matching module;
the third matching module is configured to match the return value with the standard value if the operation type of the item to be tested includes a Patch operation, so as to obtain a third matching result;
if the third matching result is that the matching is successful, executing a corresponding updating function by using a Patch operation; acquiring a second return value and a second standard value corresponding to the updating function, matching the second return value with the second standard value to obtain a fourth matching result, and taking the fourth matching result as a matching result of the item to be tested;
and if the third matching result is unsuccessful, taking the third matching result as the matching result of the item to be tested.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 4 when the computer program is executed.
11. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 4.
CN202310715899.4A 2023-06-16 Redfish automated test methods, systems, devices, and storage media Active CN116737571B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310715899.4A CN116737571B (en) 2023-06-16 Redfish automated test methods, systems, devices, and storage media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310715899.4A CN116737571B (en) 2023-06-16 Redfish automated test methods, systems, devices, and storage media

Publications (2)

Publication Number Publication Date
CN116737571A true CN116737571A (en) 2023-09-12
CN116737571B CN116737571B (en) 2024-09-03

Family

ID=

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109254922A (en) * 2018-09-19 2019-01-22 郑州云海信息技术有限公司 A kind of automated testing method and device of server B MC Redfish function
CN110377347A (en) * 2019-06-29 2019-10-25 苏州浪潮智能科技有限公司 A kind of automatic inspection method and system of Redfish setting BIOS option
US20200272550A1 (en) * 2019-02-22 2020-08-27 Hongfujin Precision Electronics(Tianjin)Co.,Ltd. Computing device and method for analyzing device
CN113672451A (en) * 2021-07-21 2021-11-19 济南浪潮数据技术有限公司 BMC service detection method, device, equipment and readable storage medium
CN114817010A (en) * 2022-04-13 2022-07-29 深圳市同泰怡信息技术有限公司 Python-based Redfish automatic testing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109254922A (en) * 2018-09-19 2019-01-22 郑州云海信息技术有限公司 A kind of automated testing method and device of server B MC Redfish function
US20200272550A1 (en) * 2019-02-22 2020-08-27 Hongfujin Precision Electronics(Tianjin)Co.,Ltd. Computing device and method for analyzing device
CN110377347A (en) * 2019-06-29 2019-10-25 苏州浪潮智能科技有限公司 A kind of automatic inspection method and system of Redfish setting BIOS option
CN113672451A (en) * 2021-07-21 2021-11-19 济南浪潮数据技术有限公司 BMC service detection method, device, equipment and readable storage medium
CN114817010A (en) * 2022-04-13 2022-07-29 深圳市同泰怡信息技术有限公司 Python-based Redfish automatic testing method and device

Similar Documents

Publication Publication Date Title
US7877732B2 (en) Efficient stress testing of a service oriented architecture based application
CN108628748B (en) Automatic test management method and automatic test management system
US8555234B2 (en) Verification of soft error resilience
TWI533123B (en) Method and system for automated test and result comparison
US20060167919A1 (en) Intelligent platform management interface validating system and method
US20070220341A1 (en) Software testing automation framework
CN109408375B (en) Method and device for generating interface document
CN108923997B (en) Cloud service node automatic testing method and device based on python
US10705949B2 (en) Evaluation of library test suites using mutation testing
WO2017017691A1 (en) Testing computing devices
WO2021129335A1 (en) Operation monitoring method and apparatus, operation analysis method and apparatus
CN115080398A (en) Automatic interface test system and method
CN107273250B (en) Testing method and device of electronic insurance policy automatic underwriting system
JP7477572B2 (en) AUTOMATED CONTROL OF DISTRIBUTED COMPUTING DEVICES - Patent application
CN111414309A (en) Automatic test method of application program, computer equipment and storage medium
CN112363938A (en) Data processing method and device, electronic equipment and storage medium
Agarwal et al. There’s an app for that, but it doesn’t work. Diagnosing mobile applications in the wild
US20070055769A1 (en) Systems and methods for smart client remote data monitoring
CN111124828B (en) Data processing method, device, equipment and storage medium
CN116955193A (en) Interface testing method, device, equipment and storage medium
CN116737571B (en) Redfish automated test methods, systems, devices, and storage media
CN112015715A (en) Industrial Internet data management service testing method and system
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN116737571A (en) Redfish automatic test method, system, equipment and storage medium
CN109669829A (en) A kind of diagnosis adjustment method, device and server based on BMC

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant