Baseboard management controller testing method, device, electronic equipment and storage medium
Through serial port connection and data stream processing, the problems of frequent login and session timeouts in BMC tests are solved, and the BMC test is automated, which improves the testing efficiency and accuracy.
Patent Information
- Application Number
- CN202410917557.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-10
AI Technical Summary
During the BMC testing process, the independent IP and session time limits that store the BMC result in frequent login and rebuilding connections, which increases the cumbersomeness and efficiency of the test.
Test with BMC through serial port connection, send the command line to be executed and obtain the execution results, use the data stream to determine whether the command line execution is successful or failed, and repeat the test process when it fails to realize automated testing.
Reduces repeated operations of execution failure caused by session timeout, improves the efficiency and accuracy of BMC tests, and supports the automated development of BMC tests.
Smart Images

Figure CN118467275B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of BMC testing, and in particular to a baseboard management controller testing method, device, electronic equipment and storage medium. Background Art
[0002] BMC (Baseboard Management Controller) is an independent system, which can be divided into storage BMC and server BMC.
[0003] The server BMC is used to manage the physical health characteristics of the server, such as temperature, voltage, fan, and power status. The characteristics of BMC include its own hardware interface (such as LAN / Serial) and software (such as Firmware / Linux). It follows the IPMI protocol and provides a unified access interface. As a server-specific module, it provides management interfaces such as temperature, voltage, fan, and bus monitoring to facilitate remote management of the server. BMC uses an independent power supply and remains in working condition when the system is shut down. The main functions of BMC include local and remote diagnosis, console support, hardware management, and troubleshooting. BMC testing is the process of testing the above-mentioned various interfaces and fault logs.
[0004] There are some differences between storage BMC and server BMC. First, storage BMC uses a fixed IP (Internet Protocol). It can only trust storage and does not provide interface trust to the outside. If BMC is accessed through the network, the query is completed through the storage IP bridge to BMC; secondly, in the storage development system, the mutual trust between BMC and storage can be accessed through the ipmitool tool in the storage command line mode, but this method cannot be used in the customer system. It can only be directly connected to the storage through minicom and switched to the BMC user to use BMC command operations. This method is mainly used to query hardware information, fault injection, simulate abnormal start and stop, log capture, etc. Finally, because the BMC session has a time limit, repeated logins are required during the test process, and rebuilding the connection will also cause the execution data results to be lost. Therefore, for testers, the manual test operation process requires frequent and repeated logins to the BMC, which greatly increases the cumbersomeness of the test. At the same time, the repeated execution of instructions caused by the session closure will also affect the test efficiency. Summary of the invention
[0005] In view of the above problems, embodiments of the present invention are proposed to provide a baseboard management controller testing method, device, electronic device and storage medium that overcome the above problems or at least partially solve the above problems.
[0006] In a first aspect, an embodiment of the present invention discloses a baseboard management controller testing method, the method comprising:
[0007] Establish a serial port connection with the baseboard management controller BMC to be tested;
[0008] If the connection is successful, sending the command line to be executed to the BMC, so that the BMC generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream;
[0009] Acquire the data code stream, and determine whether the to-be-executed command line is executed successfully based on the data code stream;
[0010] If the execution of the command line to be executed is successful, the execution result is obtained from the data code stream; if the execution of the command line to be executed fails, the process jumps to sending the command line to be executed to the BMC.
[0011] Optionally, whether the serial port connection with the BMC is successful is determined by:
[0012] Establishing a serial communication channel with the BMC through a serial communication tool;
[0013] Sending a startup instruction to the BMC via the serial communication channel;
[0014] If the feedback data returned by the BMC is obtained, the serial port connection with the BMC fails; if the feedback data returned by the BMC is not obtained, the serial port connection with the BMC succeeds.
[0015] Optionally, establishing a serial communication channel with the BMC through a serial communication tool includes:
[0016] The serial communication tool is started through an interactive shell to establish a serial communication channel with the BMC.
[0017] Optionally, the feedback data includes first feedback data and second feedback data, the first feedback data is used to indicate that the serial port is occupied, and the second feedback data is used to indicate that a configuration file of the serial port connection parameters is wrong.
[0018] Optionally, determining whether the to-be-executed command line is executed successfully based on the data code stream includes:
[0019] Formatting the data code stream to obtain a target data code stream in a target format;
[0020] Obtain the last row of data from the target data code stream;
[0021] Determine whether the command line to be executed is executed successfully based on the last line of data.
[0022] Optionally, determining whether the to-be-executed command line is executed successfully based on the last line of data includes:
[0023] If the last line of data includes a confirmation prompt, the command line to be executed is executed successfully;
[0024] If the last line of data includes the target prompt, the execution of the command line to be executed fails;
[0025] If the last line of data includes an interactive prompt, then input login information. If the login information is correct, the command line to be executed is executed successfully. If the login information is incorrect, the command line to be executed fails to execute.
[0026] If the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the execution of the command line to be executed fails.
[0027] Optionally, if the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the method further includes:
[0028] The entry instruction for entering the BMC command line window is used as the command line to be executed, and the process jumps to sending the command line to be executed to the BMC.
[0029] Optionally, if the login information is incorrect, the method further includes:
[0030] Check whether the re-login conditions are met;
[0031] If the conditions are met, the login information is used as the command line to be executed, and the process jumps to sending the command line to be executed to the BMC.
[0032] Optionally, the detecting whether a re-login condition is met includes:
[0033] Subtract 1 from the remaining number of logins to the BMC to obtain the current remaining number of logins; the remaining number of logins is determined before sending the command line to be executed to the BMC;
[0034] Check whether the current remaining number of logins is greater than 0;
[0035] If so, the re-login condition is met; if not, the re-login condition is not met.
[0036] Optionally, if the last line of data includes a target prompt, the method further includes:
[0037] Detecting whether a re-execution condition for re-executing the command line to be executed is met;
[0038] If the number of remaining logins is satisfied, the process will reset the number of remaining logins and jump to sending a command line to be executed to the BMC.
[0039] Optionally, the detecting whether a re-execution condition for re-executing the command line to be executed is met includes:
[0040] Subtract 1 from the remaining execution times to obtain the current remaining execution times; the remaining execution times are determined before sending the command line to be executed to the BMC;
[0041] Check whether the current remaining number of executions is greater than 0;
[0042] If so, the re-execution condition is met; if not, the re-execution condition is not met.
[0043] Optionally, the acquiring the execution result from the data code stream includes:
[0044] The second to last row of data is obtained from the target data code stream converted from the data code stream as the execution result.
[0045] In a second aspect, an embodiment of the present invention discloses a baseboard management controller testing device, the device comprising:
[0046] A connection module, used for serially connecting to a baseboard management controller BMC to be tested;
[0047] A sending module, configured to send a command line to be executed to the BMC if the connection is successful, so that the BMC generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream;
[0048] An acquisition module, used for acquiring the data code stream;
[0049] A detection module, which determines whether the command line to be executed is executed successfully based on the data code stream;
[0050] The acquisition module is further configured to acquire the execution result from the data code stream if the execution of the command line to be executed is successful; and to call the sending module if the execution of the command line to be executed fails.
[0051] In a third aspect, the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the baseboard management controller testing method as described above are implemented.
[0052] In a fourth aspect, the present invention further discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the baseboard management controller testing method as described above are implemented.
[0053] The embodiments of the present invention include the following advantages:
[0054] The test device is connected to the baseboard management controller BMC to be tested through a serial port; if the connection is successful, a command line to be executed is sent to the BMC, so that the BMC generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream; the data code stream is obtained, and based on the data code stream, it is determined whether the command line to be executed is executed successfully; if the command line to be executed is executed successfully, the execution result is obtained from the data code stream; if the command line to be executed fails to execute, the command line to be executed is sent to the BMC. In this way, the test device is directly connected to the device to be tested through a serial port. After the connection is successful, the command line to be executed can be executed and the execution result can be captured when the execution is successful. If the execution fails, the test process is repeated, realizing the foundation of direct BMC automated testing. Testers do not need to pay attention to the problem of execution failure caused by BMC session timeout, reducing the need for repeated manual operations due to execution failure caused by session timeout, providing the most core support for the automated development of BMC testing, and improving test efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flow chart of the steps of a baseboard management controller testing method provided by an embodiment of the present invention;
[0056] Figure 2 is a schematic diagram of communication between a test device provided by an embodiment of the present invention and a storage device to be tested;
[0057] Figure 3 is a structural block diagram of an electronic device provided by an embodiment of the present invention;
[0058] Figure 4 It is a structural block diagram of a computer-readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0060] like Figure 1 , shows a flow chart of a baseboard management controller testing method provided by an embodiment of the present invention, the method may include the following steps:
[0061] Step 101 : Establish a serial port connection with a baseboard management controller BMC to be tested.
[0062] Specifically, the embodiment of the present invention can be applied to a test device, the test device can be directly connected to a storage device to be tested through a serial port, the storage device is provided with a baseboard management controller BMC, a serial port communication tool can be run in the test device, and a user can interact with the BMC through the serial port communication tool to perform data exchange, thereby implementing a test of the BMC. Among them, the serial port communication tool can use minicom or other tools, and in actual applications, it can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0063] like Figure 2 , showing a communication schematic diagram between the test device of an embodiment of the present invention and the storage device to be tested, the storage device may include a memory channel storage MCS and a baseboard management controller BMC, the MCS and the BMC may exchange data through the IPMI protocol, the test device and the storage device may exchange data through IP, and may also exchange data with the BMC through minicom.
[0064] Step 102: If the connection is successful, send the command line to be executed to the BMC, so that the BMC generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream.
[0065] When the test device is successfully connected to the BMC, the test device can automatically send the command line to be executed to the BMC through the serial communication tool. After obtaining the command line to be executed, the BMC executes the command line to be executed to obtain the execution result, and sends the execution result to the test device through the data code stream.
[0066] In one embodiment, whether the serial port connection with the BMC is successful is determined by:
[0067] Establishing a serial communication channel with the BMC through a serial communication tool;
[0068] Sending a startup instruction to the BMC via the serial communication channel;
[0069] If the feedback data returned by the BMC is obtained, the serial port connection with the BMC fails; if the feedback data returned by the BMC is not obtained, the serial port connection with the BMC succeeds.
[0070] Specifically, after the test device is physically connected to the storage device through the serial port, the serial communication tool can establish a serial communication channel with the BMC. After the establishment is completed, the serial communication tool can send a startup command to the BMC through the serial communication channel. For example, the startup command is "minicom -c on BMC test", where "BMC test" is the file name of the configuration file. If the serial communication tool obtains feedback data returned by the BMC for the startup command, it means that the connection between the test device and the BMC in the storage device has failed to be established. If the serial communication tool does not obtain feedback data, it means that the connection between the test device and the BMC in the storage device has been successfully established.
[0071] The feedback data may include first feedback data and second feedback data. The first feedback data is used to indicate that the serial port is occupied, for example, the first feedback data may be "is locked"; the second feedback data is used to indicate that the configuration file of the serial port connection parameters is wrong, for example, the second feedback data may be "cannont create lockfile". For the first feedback data, a cyclic connection may be performed, and when the serial port is released, the connection is successful; for the second feedback data, a prompt message may be generated to prompt that the configuration file is wrong, and the user may modify the configuration file. In this way, the user may establish a connection with the BMC through a serial communication tool, and detect whether the connection is successfully established through feedback data. If successful, subsequent automated testing may be performed. If failed, the specific fault may be determined based on the feedback data, which is convenient for fault location.
[0072] It should be noted that if the test device and the storage device are connected for the first time, the serial port connection parameters need to be set before the connection. The serial port connection parameters include but are not limited to the port and baud rate. After the setting is completed, the serial port connection parameters can be used to generate a configuration file. The configuration file can be loaded through the above-mentioned startup command when the test device and the storage device are connected for the first time.
[0073] In one embodiment, establishing a serial communication channel with the BMC through a serial communication tool includes:
[0074] The serial communication tool is started through an interactive shell to establish a serial communication channel with the BMC.
[0075] Specifically, the user can start the serial communication tool through the interactive shell in the test device, and then establish a serial communication channel with the BMC through the serial communication tool. Since the interactive shell can execute command lines, based on this feature, the interactive shell can be used to automatically send the command lines to be executed to the BMC and capture the execution results, thereby realizing the automated testing of the BMC and improving the test efficiency.
[0076] Step 103: Acquire the data code stream, and determine whether the command line to be executed is executed successfully based on the data code stream.
[0077] After obtaining the data code stream, the test equipment can determine whether the command to be executed is executed successfully based on the data code stream. If the execution is successful, the execution result can be obtained from the data code stream for subsequent processing; if the execution fails, the fault needs to be determined and resolved.
[0078] In one embodiment, determining whether the to-be-executed command line is successfully executed based on the data code stream includes:
[0079] Formatting the data code stream to obtain a target data code stream in a target format;
[0080] Obtain the last row of data from the target data code stream;
[0081] Determine whether the command line to be executed is executed successfully based on the last line of data.
[0082] Specifically, due to the uncertainty of the format of the data code stream, in order to facilitate unified processing of data code streams in different formats and improve test efficiency and versatility, the data code stream can be formatted to obtain a target data code stream in a target format. For example, the data code stream can be formatted as a target data code stream in utf-8, and then the target data code stream can be segmented to obtain the last line of data, and based on the last line of data, it can be determined whether the command line to be executed is executed successfully.
[0083] Of course, the target format may be other formats besides UTF-8. In practical applications, it may be set according to actual needs, and the embodiment of the present invention does not limit this.
[0084] Furthermore, when segmenting the target data code stream, the characters in the target data code stream can be identified. When the code stream separator is identified, the target data code stream can be segmented. The code stream separator is defined before the test. All instructions and characters include but are not limited to:
[0085] BMC command line window entry command: $%&*2
[0086] BMC command line confirmation prompt: ~#
[0087] BMC command line code stream separator: \r
[0088] BMC command line target prompt:#
[0089] Interactive prompt:
[0090] Login user prompt: starts with IEIB and ends with ogin:
[0091] Password entry prompt: ends with assword:.
[0092] That is to say, when "\r" is recognized, the position of the character is segmented to obtain the last line of data. Of course, the specific definitions of instructions and characters can be defined as other contents besides the above, and in practical applications, they can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0093] It should be noted that, since "Login:" and "login:" are different, "Login:" and "login:" can be identified at the same time by identifying "ogin:", thereby achieving fuzzy recognition and improving recognition efficiency. Similarly, "Password:" and "password:" are also different, and "password:" and "password:" can be identified at the same time by "assword:".
[0094] Of course, you can also define "Login:" and "login:" at the same time, and define "Password:" and "password:" at the same time, so as to achieve accurate recognition and avoid misidentification. In practical applications, whether fuzzy recognition or accurate recognition is used can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0095] In one embodiment, determining whether the to-be-executed command line is successfully executed based on the last line of data includes:
[0096] If the last line of data includes a confirmation prompt, the command line to be executed is executed successfully;
[0097] If the last line of data includes the target prompt, the execution of the command line to be executed fails;
[0098] If the last line of data includes an interactive prompt, then input login information. If the login information is correct, the command line to be executed is executed successfully. If the login information is incorrect, the command line to be executed fails to execute.
[0099] If the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the execution of the command line to be executed fails.
[0100] Specifically, if the last line of data includes a confirmation prompt “~#”, for example, the last line of data ends with “~#”, it means that the command line to be executed is executed successfully.
[0101] If the last line of data includes the target prompt "#", for example, the last line of data ends with "#", it means that the execution of the command line to be executed fails.
[0102] If the last line of data includes an interactive prompt, the login information can be automatically entered. For example, if the last line of data starts with "IEIB" and ends with "ogin:", the test device can automatically enter the user name through the interactive shell and send the user name to the BMC. The BMC generates a password entry prompt in response to the user name and sends the password entry prompt to the test device through the data code stream. After obtaining the data code stream, the test device formats it to obtain the target data code stream, and then divides the target data code stream to obtain the last line of data. At this time, the last line of data ends with "assword:", the test device can automatically enter the password through the interactive shell and send the password to the BMC. After the BMC and the test device repeat the above actions, if the last line of data includes a confirmation prompt "~#", for example, the last line of data ends with "~#", it means that the login is successful, that is, the command line to be executed is executed successfully; if the last line of data does not include the confirmation prompt "~#", it means that the login failed, that is, the command line to be executed failed.
[0103] If the last line of data does not include a confirmation prompt, an interactive prompt, or a target prompt, it also indicates that the execution of the command line to be executed has failed.
[0104] It should be noted that if the last line of data includes a confirmation prompt, a target prompt, or an interactive prompt, it means that the BMC command line window has been switched to, but if the last line of data does not include any of the confirmation prompt, the interactive prompt, and the target prompt, it means that the BMC command line window has not been switched to. In this way, the last line of data can be used to confirm whether the command line to be executed is executed successfully, and in the case of execution failure, the specific fault can be determined, thereby realizing fault location, which is convenient for subsequent fault handling.
[0105] In one embodiment, if the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the method further includes:
[0106] The entry instruction for entering the BMC command line window is used as the command line to be executed, and the process jumps to sending the command line to be executed to the BMC.
[0107] Specifically, if the last line of data does not include any of the confirmation prompt, interactive prompt, and target prompt, it means that the BMC command line window has not been cut in yet, so the cut-in command "$%&*2" can be used to cut in the BMC command line window. In other words, the cut-in command is sent to the BMC as a command line to be executed and the above process is repeated, thereby realizing automatic re-entry in the event of failure to cut in the BMC command line window, thereby realizing BMC test automation and improving test accuracy and efficiency.
[0108] In one embodiment, if the login information is incorrect, the method further includes:
[0109] Check whether the re-login conditions are met;
[0110] If the conditions are met, the login information is used as the command line to be executed, and the process jumps to sending the command line to be executed to the BMC.
[0111] Specifically, due to objective factors such as session timeout, the login information may be incorrect, resulting in login failure. Therefore, if the login information is incorrect due to factors such as session timeout, you can log in again. However, if the login information itself is incorrect, that is, the user name and / or password itself is incorrect, then the re-login will still fail. Therefore, before re-login, you can check whether the re-login conditions are met. If they are met, you can use the login information to re-login. In other words, the login information is sent to the BMC as a command to be executed and the above process is repeated, thereby achieving automatic re-login in the case of login failure, avoiding the situation where login failure is caused by objective factors, and then realizing BMC test automation, improving the accuracy and efficiency of the test.
[0112] In one embodiment, the detecting whether the re-login condition is met includes:
[0113] Subtract 1 from the remaining number of logins to the BMC to obtain the current remaining number of logins; the remaining number of logins is determined before sending the command line to be executed to the BMC;
[0114] Check whether the current remaining number of logins is greater than 0;
[0115] If so, the re-login condition is met; if not, the re-login condition is not met.
[0116] Specifically, since the current login has failed, before logging in again, the remaining number of logins to the BMC can be reduced by 1 to obtain the current remaining number of logins. If the current remaining number of logins is greater than 0, the re-login condition is met. If the current remaining number of logins is equal to 0, the re-login condition is not met, that is, no re-login is required. In this way, it can be ensured that automatic re-login can be performed when the login information is correct but the login still fails, and it can also be ensured that the login will not be automatically re-logined indefinitely when the login information is wrong, thereby improving the accuracy and efficiency of the test.
[0117] In one embodiment, if the last line of data includes a target prompt, the method further includes:
[0118] Detecting whether a re-execution condition for re-executing the command line to be executed is met;
[0119] If the number of remaining logins is satisfied, the process will reset the number of remaining logins and jump to sending a command line to be executed to the BMC.
[0120] Specifically, due to objective factors such as session timeout, the execution of the pending command line may fail. Therefore, if the pending command line fails, it can be re-executed. However, in order to avoid the failure of execution due to customer factors, before re-execution, it can be detected whether the re-execution conditions are met. If they are met, it can be re-executed and the current remaining number of logins can be reset. In other words, the above process is repeated for re-execution, thereby achieving automatic re-execution in the case of execution failure, avoiding the situation of execution failure due to objective factors, and ensuring that it can still be automatically re-executed when the current remaining number of logins is 0, thereby realizing BMC test automation and improving the accuracy and efficiency of the test.
[0121] In one embodiment, the detecting whether a re-execution condition for re-executing the to-be-executed command line is met includes:
[0122] Subtract 1 from the remaining execution times to obtain the current remaining execution times; the remaining execution times are determined before sending the command line to be executed to the BMC;
[0123] Check whether the current remaining number of executions is greater than 0;
[0124] If so, the re-execution condition is met; if not, the re-execution condition is not met.
[0125] Specifically, since the current execution has failed, before re-execution, the remaining execution times can be reduced by 1 to obtain the current remaining execution times. If the current remaining execution times are greater than 0, then the re-execution condition is met. If the current remaining execution times are equal to 0, then the re-execution condition is not met, that is, no re-execution is performed. In this way, it can be ensured that the execution can be automatically re-executed when the execution fails due to objective factors, and it can also be ensured that the execution will not be automatically re-executed indefinitely, which improves the accuracy and efficiency of the test.
[0126] It should be noted that before the test device sends the command line to be executed to the BMC, the user can set the remaining login times and the remaining execution times in the test device. In actual applications, the specific values of the remaining login times and the remaining execution times can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0127] Step 104: if the execution of the command line to be executed is successful, the execution result is obtained from the data code stream; if the execution of the command line to be executed fails, the process jumps to sending the command line to be executed to the BMC.
[0128] If the execution of the command line to be executed is successful, the execution result corresponding to the command line to be executed can be obtained from the data code stream, and the execution result can be used to pass to subsequent jobs. If the execution of the command line to be executed fails, the step of sending the command line to be executed to the BMC can be jumped to repeat the execution. Of course, before repeated execution, it can be detected whether repeated execution is required based on the remaining number of logins and the remaining number of executions. That is to say, the embodiment of the present invention can also realize continuous repeated execution in the case of failed logins and failed execution. In actual applications, whether the remaining number of logins and the remaining number of executions need to be set can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0129] In one embodiment, obtaining the execution result from the data code stream includes:
[0130] The second to last row of data is obtained from the target data code stream converted from the data code stream as the execution result.
[0131] Specifically, after the data code stream is formatted into the target data code stream, the last line of data can be identified according to the prompt, and then the second to last line of data can be determined as the execution result according to the last line of data. In this way, the execution result of the command line to be executed can be automatically obtained through the defined prompt, realizing the automated testing of the BMC and improving the testing efficiency.
[0132] In an embodiment of the present invention, the test device is connected to the baseboard management controller BMC to be tested through a serial port; if the connection is successful, a command line to be executed is sent to the BMC, so that the BMC generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream; the data code stream is obtained, and based on the data code stream, it is determined whether the command line to be executed is executed successfully; if the command line to be executed is executed successfully, the execution result is obtained from the data code stream; if the command line to be executed fails to execute, it jumps to the sending of the command line to be executed to the BMC. In this way, the test device is directly connected to the device to be tested through a serial port. After the connection is successful, the command line to be executed can be executed and the execution result can be captured when the execution is successful. When the execution fails, the test process is repeated, realizing the foundation of direct BMC automated testing. Testers do not need to pay attention to the problem of execution failure caused by BMC session timeout, reducing the need for repeated manual operations due to execution failure caused by session timeout, providing the most core support for the automated development of BMC testing, and improving test efficiency and accuracy.
[0133] The present invention also provides a baseboard management controller testing device, the device comprising:
[0134] A connection module, used for serially connecting to a baseboard management controller BMC to be tested;
[0135] A sending module, configured to send a command line to be executed to the BMC if the connection is successful, so that the BMC generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream;
[0136] An acquisition module, used for acquiring the data code stream;
[0137] A detection module, used to determine whether the to-be-executed command line is successfully executed based on the data code stream;
[0138] The acquisition module is further configured to acquire the execution result from the data code stream if the execution of the command line to be executed is successful; and to call the sending module if the execution of the command line to be executed fails.
[0139] Optionally, it also includes:
[0140] A pipeline establishment module, used to establish a serial communication pipeline with the BMC through a serial communication tool;
[0141] The sending module further sends a startup instruction to the BMC through the serial communication channel;
[0142] The determination module is configured to determine that if the feedback data returned by the BMC is obtained, the serial port connection with the BMC fails; if the feedback data returned by the BMC is not obtained, the serial port connection with the BMC succeeds.
[0143] Optionally, the pipeline establishment module is specifically used to:
[0144] The serial communication tool is started through an interactive shell to establish a serial communication channel with the BMC.
[0145] Optionally, the feedback data includes first feedback data and second feedback data, the first feedback data is used to indicate that the serial port is occupied, and the second feedback data is used to indicate that a configuration file of the serial port connection parameters is wrong.
[0146] Optionally, the detection module includes:
[0147] A formatting submodule, used for formatting the data code stream to obtain a target data code stream in a target format;
[0148] An acquisition submodule, used for acquiring the last row of data from the target data code stream;
[0149] The detection submodule is used to determine whether the command line to be executed is executed successfully based on the last line of data.
[0150] Optionally, the detection submodule is specifically used to:
[0151] If the last line of data includes a confirmation prompt, the command line to be executed is executed successfully;
[0152] If the last line of data includes the target prompt, the execution of the command line to be executed fails;
[0153] If the last line of data includes an interactive prompt, then input login information. If the login information is correct, the command line to be executed is executed successfully. If the login information is incorrect, the command line to be executed fails to execute.
[0154] If the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the execution of the command line to be executed fails.
[0155] Optionally, the detection submodule is further used to:
[0156] If the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the entry instruction for entering the BMC command line window is used as the command line to be executed, and the sending module is called.
[0157] Optionally, the detection submodule is further used to:
[0158] If the login information is incorrect, check whether the re-login conditions are met;
[0159] If the conditions are met, the login information is used as a command line to be executed and the sending module is called.
[0160] Optionally, the detection submodule is further used to:
[0161] Subtract 1 from the remaining number of logins to the BMC to obtain the current remaining number of logins; the remaining number of logins is determined before sending the command line to be executed to the BMC;
[0162] Check whether the current remaining number of logins is greater than 0;
[0163] If so, the re-login condition is met; if not, the re-login condition is not met.
[0164] Optionally, the detection submodule is further used to:
[0165] If the last line of data includes a target prompt, detecting whether a re-execution condition for re-executing the to-be-executed command line is met;
[0166] If satisfied, the current remaining number of logins is reset and the sending module is called.
[0167] Optionally, the detection submodule is further used to:
[0168] Subtract 1 from the remaining execution times to obtain the current remaining execution times; the remaining execution times are determined before sending the command line to be executed to the BMC;
[0169] Check whether the current remaining number of executions is greater than 0;
[0170] If so, the re-execution condition is met; if not, the re-execution condition is not met.
[0171] Optionally, the acquisition module is specifically used to:
[0172] The second to last row of data is obtained from the target data code stream converted from the data code stream as the execution result.
[0173] like Figure 3 , showing a structural block diagram of an electronic device 30 provided in an embodiment of the present invention, including:
[0174] A processor 301, a memory 302, and a computer program 3021 stored in the memory 302 and capable of running on the processor 301. When the computer program 3021 is executed by the processor 301, each process of the above-mentioned baseboard management controller test method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0175] like Figure 4 , shows a structural block diagram of a computer-readable storage medium 40 provided in an embodiment of the present invention. A computer program 401 is stored on the computer-readable storage medium 40. When the computer program 401 is executed by the processor, the various processes of the above-mentioned baseboard management controller test method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0176] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0177] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0178] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0179] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0180] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0181] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0182] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0183] The above is a detailed introduction to a baseboard management controller testing method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A baseboard management controller testing method, characterized in that: The method comprises: Establish a serial port connection with the baseboard management controller to be tested; If the connection is successful, sending the command line to be executed to the baseboard management controller, so that the baseboard management controller generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream; Acquire the data code stream, and determine whether the to-be-executed command line is executed successfully based on the data code stream; If the execution of the command line to be executed is successful, the execution result is obtained from the data code stream; if the execution of the command line to be executed fails, the step of jumping to sending the command line to be executed to the baseboard management controller; The step of establishing a serial port connection with the baseboard management controller to be tested includes: Start a serial communication tool through an interactive shell to establish a serial communication channel with the baseboard management controller; Whether the serial port connection with the baseboard management controller is successful is determined by: Establishing a serial communication channel with the baseboard management controller through a serial communication tool; Sending a startup instruction to the baseboard management controller through the serial communication channel; If the feedback data returned by the baseboard management controller is obtained, the serial port connection with the baseboard management controller fails; if the feedback data returned by the baseboard management controller is not obtained, the serial port connection with the baseboard management controller is successful; The step of determining whether the command line to be executed is executed successfully based on the data code stream includes: Formatting the data code stream to obtain a target data code stream in a target format; Obtain the last row of data from the target data code stream; Determining whether the command line to be executed is executed successfully based on the last line of data; Wherein, obtaining the execution result from the data code stream includes: The second to last row of data is obtained from the target data code stream converted from the data code stream as the execution result.
2. The baseboard management controller testing method according to claim 1, characterized in that: The feedback data includes first feedback data and second feedback data, the first feedback data is used to indicate that the serial port is occupied, and the second feedback data is used to indicate that a configuration file of a serial port connection parameter is wrong.
3. The baseboard management controller testing method according to claim 2, characterized in that: The determining whether the to-be-executed command line is executed successfully based on the last line of data includes: If the last line of data includes a confirmation prompt, the command line to be executed is executed successfully; If the last line of data includes the target prompt, the execution of the command line to be executed fails; If the last line of data includes an interactive prompt, then input login information. If the login information is correct, the command line to be executed is executed successfully. If the login information is incorrect, the command line to be executed fails to execute. If the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the execution of the command line to be executed fails.
4. The baseboard management controller testing method according to claim 3, characterized in that: If the last line of data does not include the confirmation prompt, the interaction prompt, and the target prompt, the method further includes: The entry instruction for entering the command line window of the baseboard management controller is used as the command line to be executed, and the process jumps to sending the command line to be executed to the baseboard management controller.
5. The baseboard management controller testing method according to claim 3, characterized in that: If the login information is incorrect, the method further includes: Check whether the re-login conditions are met; If the conditions are met, the login information is used as a command line to be executed, and the process jumps to sending the command line to be executed to the baseboard management controller.
6. The baseboard management controller testing method according to claim 5, characterized in that: The detecting whether the re-login condition is met includes: Subtract 1 from the remaining number of logins to the baseboard management controller to obtain the current remaining number of logins; the remaining number of logins is determined before sending a command line to be executed to the baseboard management controller; Check whether the current remaining number of logins is greater than 0; If so, the re-login condition is met; if not, the re-login condition is not met.
7. The baseboard management controller testing method according to claim 3, characterized in that: If the last line of data includes a target prompt, the method further includes: Detecting whether a re-execution condition for re-executing the command line to be executed is met; If satisfied, the current remaining number of logins is reset, and the process jumps to sending a command line to be executed to the baseboard management controller.
8. The baseboard management controller testing method according to claim 7, characterized in that: The detecting whether a re-execution condition for re-executing the command line to be executed is met includes: Subtract 1 from the remaining execution times to obtain the current remaining execution times; the remaining execution times are determined before sending the command line to be executed to the baseboard management controller; Check whether the current remaining number of executions is greater than 0; If so, the re-execution condition is met; if not, the re-execution condition is not met.
9. A baseboard management controller testing device, characterized in that: The device comprises: A connection module is used to establish a serial port connection with a baseboard management controller to be tested; wherein the connection module is specifically used to: start a serial port communication tool through an interactive shell to establish a serial port communication pipeline with the baseboard management controller; wherein the connection module is specifically used to: establish a serial port communication pipeline with the baseboard management controller through the serial port communication tool; send a startup instruction to the baseboard management controller through the serial port communication pipeline; if feedback data returned by the baseboard management controller is obtained, the serial port connection with the baseboard management controller fails; if feedback data returned by the baseboard management controller is not obtained, the serial port connection with the baseboard management controller is successful; A sending module, configured to send a command line to be executed to the baseboard management controller if the connection is successful, so that the baseboard management controller generates an execution result in response to the command line to be executed, and returns the execution result through a data code stream; An acquisition module, used for acquiring the data code stream; A detection module is used to determine whether the command line to be executed is executed successfully based on the data code stream; wherein the detection module is specifically used to: format the data code stream to obtain a target data code stream in a target format; obtain the last line of data from the target data code stream; and determine whether the command line to be executed is executed successfully based on the last line of data; The acquisition module is also used to obtain the execution result from the data code stream if the execution of the command line to be executed is successful; if the execution of the command line to be executed fails, the sending module is called; wherein the acquisition module is specifically used to: obtain the second to last line of data from the target data code stream converted from the data code stream as the execution result.
10. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the baseboard management controller testing method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the baseboard management controller testing method according to any one of claims 1 to 8 are implemented.
