Hardware clock test method, apparatus and device, and storage medium
By deploying network time servers and automated operation and maintenance tools within the LAN, the hardware clock synchronization test machine is automatically registered and synchronized, which solves the problems of low efficiency and poor accuracy in the existing technology, and achieves efficient and accurate hardware clock synchronization test.
Patent Information
- Application Number
- CN202411126818.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-11-15
AI Technical Summary
The existing hardware clock synchronization test method is inefficient and difficult to ensure the accuracy of the test results, mainly due to manual operation, the test omissions and the accuracy of the network time server.
Using a clustered automatic insulating hardware clock test method, the network time server is deployed in the LAN through the preset hardware clock synchronization system platform, synchronizes with the external network time server, and uses automated operation and maintenance tools to automatically register and synchronize the test machine. , automatically test based on the hardware clock test type.
It improves the efficiency and accuracy of hardware clock synchronization testing, avoids test omissions caused by manual operations, and ensures the accuracy of time synchronization and the reliability of test results.
Smart Images

Figure CN118972303A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of server and information technology, and in particular to a hardware clock testing method, device, equipment and storage medium. Background Art
[0002] With the rapid development of server and information technology and the advent of the current 5G era, the time precision and accuracy of hardware products such as servers will directly affect their use effect and the quality and security of data transmission.
[0003] However, in the existing hardware clock synchronization solution, the test of the hardware clock is still in the manual testing stage. The tester needs to manually build a network time server in the local area network, and then connect the machine to be tested to the local area network. After success, manually interrupt the time synchronization between the machine to be tested and the network time server, and then manually synchronize the time between the machine to be tested and the network time server again, and manually obtain the time difference. This is inefficient, and because it is difficult for testers to accurately control the duration, it is impossible to guarantee whether there will be test omissions, and thus the test quality cannot be guaranteed; for the network time server built in the local area network, due to network limitations, its accuracy cannot be guaranteed, and thus the accuracy of the test results of the machine to be tested is also not guaranteed. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a hardware clock test method, device, equipment and storage medium, which can perform batch operations on machines that need to perform hardware clock synchronization tests through cluster-based automatic management, and can effectively ensure the accuracy of test results and the accuracy of time synchronization under the condition of avoiding test omissions due to manual work, thereby improving synchronization efficiency. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a hardware clock testing method, comprising:
[0006] Deploy the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronize the time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform;
[0007] Automatically manage each machine to be tested through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested;
[0008] Using the current platform time of the preset hardware clock synchronization system platform to synchronize the local hardware clocks of the currently registered machines to be tested;
[0009] After the time synchronization of the local hardware clock of each of the machines to be tested is completed by using the current platform time, a corresponding hardware clock test operation is performed on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested.
[0010] Optionally, the local machine where the preset hardware clock synchronization system platform is located is deployed as a network time server of the current local area network, and synchronizes time with an external network time server, including:
[0011] Create a first Playbook script for an automated operation and maintenance tool; the first Playbook script is used to define, install and configure a network time server for a local machine where the preset hardware clock synchronization system platform is located;
[0012] By configuring the host list of the automated operation and maintenance tool under a preset target path, a host definition operation for the local machine based on the Internet Protocol address of the local machine is completed;
[0013] After completing the host definition operation on the local machine, the local machine is deployed as a network time server of the current local area network based on the first Playbook script, and time is synchronized with the external network time server.
[0014] Optionally, the automatically managing each machine to be tested through the preset hardware clock synchronization system platform to register each machine to be tested to the preset hardware clock synchronization system platform includes:
[0015] Enable automatic management service of the preset hardware clock synchronization system platform;
[0016] The automatic management service is used to perform resource discovery on the current local area network based on the resource discovery script of the automated operation and maintenance tool to determine the machines to be tested in the current local area network, and the information of the machines to be tested in the current local area network is registered in the configuration management database of the preset hardware clock synchronization system platform.
[0017] Optionally, the using the automatic management service and performing resource discovery on the current local area network based on a resource discovery script of an automated operation and maintenance tool to determine each machine to be tested in the current local area network, and registering information of each machine to be tested in the current local area network into a configuration management database of the preset hardware clock synchronization system platform includes:
[0018] Creating a resource discovery script for an automated operation and maintenance tool based on a preset scripting language, and using the resource discovery script as a dynamic host list for the automated operation and maintenance tool;
[0019] Using the dynamic host list to perform resource discovery on the current local area network to determine each machine to be tested in the current local area network;
[0020] Create a second Playbook script for the automated operation and maintenance tool, and use the second Playbook script to call the preset target interface of the configuration management database based on the preset application interface, so as to register the information of each machine to be tested in the current local area network into the configuration management database by using the called preset target interface.
[0021] Optionally, the using the current platform time of the preset hardware clock synchronization system platform to synchronize the local hardware clocks of the currently registered machines to be tested includes:
[0022] Acquire information of each of the currently registered machines to be tested; the information of the machines to be tested includes first Internet Protocol address information of a baseboard management controller of the machine to be tested and second Internet Protocol address information of an operating system of the machine to be tested;
[0023] Using the current platform time of the preset hardware clock synchronization system platform, the first Internet protocol address information corresponding to each of the machines to be tested, and the first user name information and the first password information corresponding to the baseboard management controller, the time synchronization operation of the baseboard management controller corresponding to each of the machines to be tested that are currently registered is completed;
[0024] Based on the secure shell protocol, the second Internet protocol address information corresponding to each of the machines to be tested, and the second user name information and the second password information corresponding to the operating system, the operating system connection is performed, the preset hardware clock synchronization system platform is connected to the operating system corresponding to each of the machines to be tested, and then the local system time of each of the machines to be tested is synchronized using the current platform time of the preset hardware clock synchronization system platform to obtain the updated local system time of each of the machines to be tested;
[0025] The local hardware clocks of the currently registered machines to be tested are synchronized based on the updated local system time of the machines to be tested.
[0026] Optionally, the information of the machine to be tested further includes third Internet Protocol address information of a power distribution unit of the machine to be tested;
[0027] Accordingly, performing a corresponding hardware clock test operation on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested includes:
[0028] For the machine to be tested whose hardware clock test type is the first preset test type, based on the corresponding third Internet protocol address information and the third user name information and third password information corresponding to the power distribution unit, connecting the preset hardware clock synchronization system platform to the power distribution unit;
[0029] Powering off the power supply corresponding to the machine to be tested in the power distribution unit to complete the corresponding AC power off operation, until the power off time of the machine to be tested reaches a preset test time, and completing the corresponding first test operation;
[0030] After powering on the power distribution unit connected to the machine to be tested that has been cut off from AC power, and starting the machine to be tested based on out-of-band instructions, corresponding time difference information is determined based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested to obtain a corresponding first test result.
[0031] Optionally, performing a corresponding hardware clock test operation on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested includes:
[0032] For the machine to be tested whose hardware clock test type is the second preset test type, updating the machine state of the machine to be tested to a standby state until the standby time of the machine to be tested reaches the preset test time, and completing the corresponding second test operation;
[0033] After the standby state of the machine to be tested is released, corresponding time difference information is determined based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested to obtain a corresponding second test result.
[0034] Optionally, after determining the corresponding time difference information based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested, the method further includes:
[0035] Comparing the time difference information in the first test result or the second test result with a corresponding standard value to obtain a corresponding comparison result;
[0036] When the comparison result indicates that the time difference information is less than the standard value, the first test result or the second test result corresponding to the machine to be tested is obtained, which is used to indicate that the corresponding test operation meets the standard.
[0037] In a second aspect, the present application discloses a hardware clock testing device, comprising:
[0038] A network time server deployment module is used to deploy the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronize the time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform;
[0039] An automatic management module, used to automatically manage each machine to be tested through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested;
[0040] A clock synchronization module, used to synchronize the local hardware clocks of the currently registered machines to be tested using the current platform time of the preset hardware clock synchronization system platform;
[0041] The clock test module is used to perform corresponding hardware clock test operations on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested after completing the time synchronization of the local hardware clock of each of the machines to be tested using the current platform time.
[0042] In a third aspect, the present application discloses an electronic device, comprising:
[0043] Memory, used to store computer programs;
[0044] The processor is used to execute the computer program to implement the steps of the hardware clock testing method disclosed above.
[0045] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed hardware clock testing method are implemented.
[0046] It can be seen that the present application deploys the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronizes time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform; automatically manages each machine to be tested through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested; uses the current platform time of the preset hardware clock synchronization system platform to synchronize the local hardware clock of each machine to be tested that has been currently registered; after completing the time synchronization of the local hardware clock of each machine to be tested using the current platform time, perform corresponding hardware clock test operations on each machine to be tested based on the hardware clock test type of each machine to be tested.
[0047] Beneficial effect: The present application first deploys the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronizes time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform; then, each machine to be tested is automatically managed through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested; then, the current platform time of the preset hardware clock synchronization system platform is used to synchronize the local hardware clock of each machine to be tested that has been currently registered; then, after completing the time synchronization of the local hardware clock of each machine to be tested using the current platform time, corresponding hardware clock test operations are performed on each machine to be tested based on the hardware clock test type of each machine to be tested. That is, the present application provides a cluster-type automatic management hardware clock test method, after the machine where the preset hardware clock synchronization system platform is located is deployed as the network time server of the current local area network, all the machines to be tested in the current local area network are automatically managed to complete the machine registration, and then the time of the currently registered machines to be tested is synchronized based on the current platform time of the preset hardware clock synchronization system platform, and after synchronization, the corresponding test is automatically completed based on the configured hardware clock test type. In this way, batch operations can be performed on machines that need to be tested for hardware clock synchronization through cluster-type automatic management, and the accuracy of the test results and the accuracy of time synchronization can be effectively guaranteed under the condition of avoiding test omissions due to manual labor, thereby improving synchronization efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A flowchart of a hardware clock testing method provided by an embodiment of the present invention;
[0050] Figure 2 A schematic diagram of a specific hardware clock test process provided by an embodiment of the present invention;
[0051] Figure 3 A partial code schematic diagram of a first Playbook script provided by an embodiment of the present invention;
[0052] Figure 4 A partial code schematic diagram of a first Playbook script provided by an embodiment of the present invention;
[0053] Figure 5 A partial code schematic diagram of a second Playbook script provided by an embodiment of the present invention;
[0054] Figure 6 A specific hardware clock test flow chart provided for an embodiment of the present invention
[0055] Figure 7 A schematic diagram of the structure of a hardware clock test device disclosed in this application;
[0056] Figure 8 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0059] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0060] Next, a hardware clock testing method provided by an embodiment of the present invention is described in detail. Figure 1 A hardware clock testing method provided by an embodiment of the present invention comprises:
[0061] Step S11: deploy the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronize time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform.
[0062] Specifically, in this embodiment, combined with Figure 2 As shown, first, the network time server (i.e., NTP server, Network Time Protocol server) is automatically deployed, that is, the local machine where the preset hardware clock synchronization system platform is located is deployed as the network time server of the current local area network, and time is synchronized with the external network time server, including: creating a first Playbook script for the automated operation and maintenance tool; the first Playbook script is used to define, install and configure the network time server for the local machine where the preset hardware clock synchronization system platform is located; by configuring the host list of the automated operation and maintenance tool under the preset target path, the host definition operation for the local machine based on the Internet Protocol address of the local machine is completed; after completing the host definition operation for the local machine, the local machine is deployed as the network time server of the current local area network based on the first Playbook script, and time is synchronized with the external network time server. It can be understood that with respect to the first Playbook script, deploy_ntp_server.yml can be taken as an example, and the specific code content can be as follows Figure 3 and Figure 4 After creating the first Playbook script, configure the host list (Ansible Inventory) of the automated operation and maintenance tool (Ansible) in the / etc / ansible / hosts path to define the target host [ntp_server]. The corresponding code can be as follows:
[0063] 192.168.0.100 #IP (Internet Protocol) address of the NTP server.
[0064] After that, use the automated operation and maintenance tool to run the first Playbook script. The corresponding code can be as follows:
[0065] ansible-playbook deploy_ntp_server.yml.
[0066] In this way, compared with the manually built NTP server, this application can effectively ensure the accuracy of the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, thereby ensuring the accuracy of the test results of subsequent machines to be tested.
[0067] What needs to be understood is that, regarding the preset hardware clock synchronization system platform, Spring, SpringMVC (also known as Spring Web Model-View-Controller, a lightweight Web framework), and MyBati are used to build the system platform (i.e., the preset hardware clock synchronization system platform), B / S architecture (Browser / Server, browser / server mode) is adopted, and JAVA, Oracle, JDBC (Java Data Base Connectivity, its existence establishes a communication channel between JAVA programs and database systems) and other tools are used. The design principles of loose coupling and high cohesion are adopted to make the created preset hardware clock synchronization system platform have good reusability, modifiability, and scalability.
[0068] Step S12: automatically managing each machine to be tested through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configuring a corresponding hardware clock test type for each machine to be tested.
[0069] Specific, combined Figure 2As shown, in this embodiment, the automatic management of each machine to be tested by the preset hardware clock synchronization system platform to register each machine to be tested to the preset hardware clock synchronization system platform includes: starting the automatic management service of the preset hardware clock synchronization system platform; using the automatic management service and based on the resource discovery script of the automated operation and maintenance tool to perform resource discovery on the current local area network to determine each machine to be tested in the current local area network, and registering the information of each machine to be tested in the current local area network into the configuration management database of the preset hardware clock synchronization system platform. It should be understood that after completing the automatic deployment of the NTP server, the system platform automatically manages the machine to be tested based on the resource discovery script of the automated operation and maintenance tool, and the system platform can be accessed on the machine to be tested, and the machine is registered under the system platform access page, and the information related to the clock step test of the accessed machine can be displayed after logging into the system platform. In this way, batch operations can be performed on machines that need to undergo hardware clock synchronization tests, thereby facilitating the subsequent automated testing of the hardware clocks of machines in the current local area network.
[0070] At the same time, the corresponding hardware clock test type should be configured for the registered standby machine based on actual needs. The hardware clock test types include but are not limited to AC (Alternating Current) power-off hardware clock test and DC (Direct Current) hardware clock test (that is, hardware clock test in standby state).
[0071] In addition, if the automatic management service of the preset hardware clock synchronization system platform is turned off and the information of the machine to be tested cannot be automatically managed to the system platform, you can log in to the preset hardware clock synchronization system platform and manually add the information of the machine to be tested under the test machine information management to complete the corresponding machine registration.
[0072] Step S13: using the current platform time of the preset hardware clock synchronization system platform to synchronize the local hardware clocks of the currently registered machines to be tested.
[0073] Specific, combined Figure 2As shown, in this embodiment, the current platform time of the preset hardware clock synchronization system platform is synchronized to the RTC (Real-Time Clock) time of each currently registered machine to be tested, including: BMC (Baseboard Management Controller) time synchronization and hardware time synchronization. That is, the use of the current platform time of the preset hardware clock synchronization system platform to synchronize the local hardware clocks of each currently registered machine to be tested includes: obtaining information about each currently registered machine to be tested; the information of the machine to be tested includes the first Internet Protocol address information of the baseboard management controller of the machine to be tested and the second Internet Protocol address information of the operating system of the machine to be tested; using the current platform time of the preset hardware clock synchronization system platform, the first Internet Protocol address information corresponding to each machine to be tested, and the first user name information and the first password information corresponding to the baseboard management controller, to complete the registration with each currently registered machine to be tested. The corresponding time synchronization operation of the baseboard management controller; based on the secure shell protocol, the second Internet protocol address information corresponding to each of the machines to be tested, and the second user name information and second password information corresponding to the operating system, the operating system is connected, and the preset hardware clock synchronization system platform is connected to the operating system corresponding to each of the machines to be tested, and then the local system time of each of the machines to be tested is synchronized using the current platform time of the preset hardware clock synchronization system platform to obtain the updated local system time of each of the machines to be tested; based on the updated local system time of each of the machines to be tested, the local hardware clocks of the currently registered machines to be tested are synchronized. It should be understood that time synchronization is performed in combination with the information of the machines to be tested that have completed registration.
[0074] Taking hardware clock synchronization as an example, in a specific implementation, first, the hardware clock synchronization system platform is preset to use the OS (Operating System) IP information (i.e., the second Internet Protocol address information), username and password (i.e., the second username information, the second password information) of the machine to be tested obtained in the previous step, SSH to the OS, use the platform as the NTP server, set the system time of the machine to be tested, and synchronize it with the platform time; then synchronize the current platform time of the system platform to the hardware clock, for example, by using the "hwclock-w" command; then close the clock synchronization between the system platform and the machine to be tested. In this way, there is no need for manual intervention, and the system platform and the machine to be tested are automatically synchronized by using the information of the registered machine after management, and the synchronization is interrupted after the synchronization is completed. Therefore, after the first clock test is completed, if you want to perform the second or more clock tests, on the basis that the machine information has not changed, there is no need to rebuild and deploy a new NTP server, nor is there a need to reconnect for new hardware and software clock synchronization. The system platform can directly reopen the hardware and software clock synchronization of the machine to be tested, thereby improving the test efficiency.
[0075] Step S14: after completing the time synchronization of the local hardware clock of each of the machines to be tested by using the current platform time, performing a corresponding hardware clock test operation on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested.
[0076] In this embodiment, after synchronization is completed, the clock synchronization between the system platform and the machine to be tested is interrupted, and a clock test is performed according to the corresponding hardware clock test type. That is, the information of the machine to be tested also includes the third Internet Protocol address information of the power distribution unit of the machine to be tested; accordingly, the corresponding hardware clock test operation is performed on each machine to be tested based on the hardware clock test type of each machine to be tested, including: for the machine to be tested whose hardware clock test type is the first preset test type (that is, AC power-off hardware clock test), based on the corresponding third Internet Protocol address information and the third user name information and third password information corresponding to the power distribution unit, the preset hardware clock synchronization system is connected through a connection tool such as telnet. The system platform is connected to the power distribution unit; the power supply corresponding to the machine to be tested in the power distribution unit is powered off to complete the corresponding AC power off operation, until the power off time of the machine to be tested reaches the preset test time, and the corresponding first test operation is completed; after the power distribution unit connected to the machine to be tested that has been AC powered off is powered on, and the machine to be tested is turned on based on the out-of-band instruction, the corresponding time difference information is determined based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested, so as to obtain the corresponding first test result. It can be seen that when performing the AC power off hardware clock test, the system platform is first connected to the corresponding power distribution unit, and the power supply corresponding to the machine to be tested in the power distribution unit is powered off, and the power off state is maintained until the time reaches the preset test time and then powered on again, and then the corresponding first test result can be automatically obtained by entering the system platform. Among them, the preset test time can be set and adjusted based on actual needs.
[0077] At the same time, in this embodiment, there is also a DC hardware clock test, which performs a corresponding hardware clock test operation on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested, including: for the machine to be tested whose hardware clock test type is the second preset test type (i.e., the DC hardware clock test), the machine state of the machine to be tested is updated to a standby state until the standby time of the machine to be tested reaches the preset test time, and the corresponding second test operation is completed; after the standby state of the machine to be tested that has been on standby is released, the corresponding time difference information is determined based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested to obtain the corresponding second test result. It can be seen that the DC hardware clock test does not need to be powered off, and the machine to be tested can be directly put on standby and maintained for a corresponding time, and then the standby state is canceled, and the system is entered to automatically obtain the corresponding second test result. In this way, there is no need to manually accurately control the test time, and there is no need to manually collect the test results. After completing the test, the corresponding test results can be automatically obtained by logging into the system platform, which is not easy to omission, thereby ensuring the accuracy of the test results.
[0078] It should be pointed out that regarding different types of clock tests, such as the test sequence of AC power-off hardware clock test and DC hardware clock test, in the process of batch testing the machines to be tested, in a specific implementation, different interfaces, a first test interface and a second test interface, can be provided to simultaneously perform two types of tests, and the test sequence of the machines to be tested of the same type can be determined by the time of machine registration, and the test sequence of the machines to be tested that are registered first is in the first place. For example, for AC testing (also known as AC power-off hardware clock testing), after the AC power is cut off for the machine to be tested in the first rank, the AC power can be cut off for the machine to be tested in the second rank, and so on, the same is true for DC testing (also known as DC hardware clock testing). In this way, the test efficiency can be effectively improved. In another specific embodiment, by providing a unified test interface to perform clock tests in sequence, the test sequence of the machine can be determined based on the registration sequence. In this way, omissions can be avoided. It can be understood that the above-mentioned implementation modes all support users to customize the test order of the machines to be tested based on their needs, which can be specifically achieved by configuring priorities. Machines with priorities are tested before machines to be tested without priorities, and machines with first priorities are tested before machines to be tested with second priorities. Machines to be tested with the same priority level may have different test orders based on other test order-dependent information (including but not limited to registration time, completion time of software and hardware clock synchronization, and unified machine number).
[0079] Furthermore, after obtaining the test results, that is, after determining the corresponding time difference information based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested, it also includes: comparing the time difference information in the first test result or the second test result with the corresponding standard value to obtain a corresponding comparison result; when the comparison result indicates that the time difference information is less than the standard value, obtaining the first test result or the second test result corresponding to the machine to be tested, which is used to characterize that the corresponding test operation has met the standard.
[0080] In summary, the present application first deploys the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronizes the time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform; then, each machine to be tested is automatically managed through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested; then, the current platform time of the preset hardware clock synchronization system platform is used to synchronize the local hardware clocks of each machine to be tested that has been currently registered; then, after completing the time synchronization of the local hardware clocks of each machine to be tested using the current platform time, corresponding hardware clock test operations are performed on each machine to be tested based on the hardware clock test type of each machine to be tested. That is, the present application provides a cluster-type automatic management hardware clock test method, after the machine where the preset hardware clock synchronization system platform is located is deployed as the network time server of the current local area network, all the machines to be tested in the current local area network are automatically managed to complete the machine registration, and then the time of the currently registered machines to be tested is synchronized based on the current platform time of the preset hardware clock synchronization system platform, and after synchronization, the corresponding test is automatically completed based on the configured hardware clock test type. In this way, batch operations can be performed on machines that need to be tested for hardware clock synchronization through cluster-type automatic management, and the accuracy of the test results and the accuracy of time synchronization can be effectively guaranteed under the condition of avoiding test omissions due to manual labor, thereby improving synchronization efficiency.
[0081] Further, such as Figure 6 As shown in the figure, after the time network server is automatically deployed, the automatic management of the current LAN and the automatic registration of the machine to be tested are realized by creating and running the corresponding resource discovery script and the second Playbook script, which specifically includes the following steps:
[0082] Step S21: After enabling the automatic management service of the preset hardware clock synchronization system platform, a resource discovery script of the automated operation and maintenance tool is created based on a preset scripting language, and the resource discovery script is used as a dynamic host list of the automated operation and maintenance tool.
[0083] In this embodiment, a Python script can be used as a dynamic inventory to realize the resource discovery script as a dynamic host inventory of the automated operation and maintenance tool to discover and return resources. The specific code example is as follows Figure 5 shown.
[0084] Step S22: using the dynamic host list to perform resource discovery on the current local area network to determine each machine to be tested in the current local area network.
[0085] In this embodiment, it is also necessary to configure Ansible to use the Inventory Script, such as by configuring ansible.cfg. Specifically, set inventory = inventory.py in the project's ansible.cfg file or the global Ansible configuration file, so that the script will be used by default each time Ansible is run, so that the dynamic host list can be used to discover resources on the current LAN to automatically determine each machine to be tested in the current LAN.
[0086] Step S23: Create a second Playbook script for the automated operation and maintenance tool, and use the second Playbook script to call the preset target interface of the configuration management database based on the preset application interface, so as to use the called preset target interface to register the information of each machine to be tested in the current local area network into the configuration management database of the preset hardware clock synchronization system platform.
[0087] In this embodiment, a new Ansible Playbook is created to obtain the second Playbook script of the automated operation and maintenance tool. The second Playbook script uses the Http API module (Hypertext Transfer Protocol Application Programming Interface module, an application programming interface based on the hypertext transfer protocol, allowing different software applications to communicate and exchange data) to call the CMDB (Configuration Management Database, also known as the configuration management database) API, so as to automatically write the resources discovered by the Inventory into the database.
[0088] In summary, in this embodiment, no manual intervention is required, and the corresponding resource discovery script and the second Playbook script are used to automatically discover resources in the current local area network, and the automatic registration of the machine to be tested is completed based on the discovered resources. In this way, the quality of subsequent tests is guaranteed and the test efficiency is improved.
[0089] Figure 7 A schematic diagram of the structure of a hardware clock test device provided by an embodiment of the present invention, the device comprising:
[0090] The network time server deployment module 11 is used to deploy the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronize the time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform;
[0091] The automatic management module 12 is used to automatically manage each machine to be tested through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested;
[0092] The clock synchronization module 13 is used to synchronize the local hardware clocks of the currently registered machines to be tested by using the current platform time of the preset hardware clock synchronization system platform;
[0093] The clock test module 14 is used to perform corresponding hardware clock test operations on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested, after completing the time synchronization of the local hardware clock of each of the machines to be tested using the current platform time.
[0094] It can be seen that after deploying the machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, the present application automatically manages all the machines to be tested in the current local area network to complete the machine registration, and then synchronizes the time of the currently registered machines to be tested based on the current platform time of the preset hardware clock synchronization system platform, and automatically completes the corresponding test based on the configured hardware clock test type after synchronization. In this way, batch operations can be performed on machines that need to undergo hardware clock synchronization tests through cluster-based automatic management, and the accuracy of test results and the accuracy of time synchronization can be effectively guaranteed while avoiding test omissions due to manual work, thereby improving synchronization efficiency.
[0095] In some specific embodiments, the network time server deployment module 11 may specifically include:
[0096] A first script creation unit, used to create a first Playbook script for the automated operation and maintenance tool; the first Playbook script is used to define, install and configure a network time server for a local machine where the preset hardware clock synchronization system platform is located;
[0097] A host definition unit, configured to complete a host definition operation for the local machine based on the Internet Protocol address of the local machine by configuring a host list of the automated operation and maintenance tool under a preset target path;
[0098] The first script application unit is used to deploy the local machine as a network time server of the current local area network based on the first Playbook script after completing the host definition operation on the local machine, and synchronize time with the external network time server.
[0099] In some specific embodiments, the automatic management module 12 includes:
[0100] A management service activation unit, used to activate the automatic management service of the preset hardware clock synchronization system platform;
[0101] The machine registration unit is used to use the automatic management service and perform resource discovery on the current local area network based on the resource discovery script of the automated operation and maintenance tool to determine each machine to be tested in the current local area network, and register the information of each machine to be tested in the current local area network into the configuration management database of the preset hardware clock synchronization system platform.
[0102] In some specific embodiments, the machine registration unit includes:
[0103] A resource discovery script determination subunit is used to create a resource discovery script for an automated operation and maintenance tool based on a preset scripting language, and use the resource discovery script as a dynamic host list for the automated operation and maintenance tool;
[0104] A resource discovery subunit, used to perform resource discovery on the current local area network using the dynamic host list to determine each machine to be tested in the current local area network;
[0105] The second script creation and application sub-unit is used to create a second Playbook script for the automated operation and maintenance tool, and use the second Playbook script to call the preset target interface of the configuration management database based on the preset application program interface, so as to use the called preset target interface to register the information of each machine to be tested in the current local area network into the configuration management database.
[0106] In some specific embodiments, the clock synchronization module 13 includes:
[0107] A machine information acquisition unit, used to acquire information about each of the currently registered machines to be tested; the information of the machines to be tested includes first Internet Protocol address information of the baseboard management controller of the machine to be tested and second Internet Protocol address information of the operating system of the machine to be tested;
[0108] A baseboard management controller time synchronization unit, used to use the current platform time of the preset hardware clock synchronization system platform, the first Internet protocol address information corresponding to each of the machines to be tested, and the first user name information and the first password information corresponding to the baseboard management controller to complete the time synchronization operation of the baseboard management controller corresponding to each of the machines to be tested that are currently registered;
[0109] An operating system connection unit, used to connect the operating system based on the secure shell protocol, the second Internet protocol address information corresponding to each of the machines to be tested, and the second user name information and second password information corresponding to the operating system, connect the preset hardware clock synchronization system platform to the operating system corresponding to each of the machines to be tested, and then synchronize the local system time of each of the machines to be tested using the current platform time of the preset hardware clock synchronization system platform to obtain the updated local system time of each of the machines to be tested;
[0110] The hardware clock synchronization unit is used to synchronize the local hardware clocks of the currently registered machines to be tested based on the updated local system time of the machines to be tested.
[0111] In some specific embodiments, the information of the machine to be tested further includes third Internet Protocol address information of a power distribution unit of the machine to be tested;
[0112] Accordingly, in some specific embodiments, the clock test module 14 includes:
[0113] A power distribution unit connection unit, for the machine to be tested whose hardware clock test type is the first preset test type, based on the corresponding third Internet interconnection protocol address information and the third user name information and third password information corresponding to the power distribution unit, connecting the preset hardware clock synchronization system platform to the power distribution unit;
[0114] An AC power off unit, used to power off the power supply corresponding to the machine to be tested in the power distribution unit to complete the corresponding AC power off operation, until the power off time of the machine to be tested reaches a preset test time, and then complete the corresponding first test operation;
[0115] The first test result acquisition unit is used to determine corresponding time difference information based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested after powering on the power distribution unit connected to the machine to be tested that has been cut off from AC power and starting the machine to be tested based on an out-of-band instruction, so as to obtain a corresponding first test result.
[0116] In some specific embodiments, the clock test module 14 includes:
[0117] A machine state updating unit, for the machine to be tested whose hardware clock test type is a second preset test type, updates the machine state of the machine to be tested to a standby state until the standby time of the machine to be tested reaches the preset test time, and completes the corresponding second test operation;
[0118] The second test result acquisition unit is used to determine the corresponding time difference information based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested after the standby state of the machine to be tested is released, so as to obtain the corresponding second test result.
[0119] In some specific embodiments, the hardware clock testing device further includes:
[0120] A comparison result obtaining unit, used for comparing the time difference information in the first test result or the second test result with a corresponding standard value to obtain a corresponding comparison result;
[0121] A result processing unit is configured to obtain, when the comparison result indicates that the time difference information is less than the standard value, the first test result or the second test result corresponding to the machine to be tested and used to indicate that the corresponding test operation meets the standard.
[0122] Figure 8 A structural diagram of an electronic device provided by an embodiment of the present invention, such as Figure 8 As shown, the electronic device includes: a memory 20 for storing a computer program;
[0123] The processor 21 is used to implement the steps of the hardware clock testing method in the above embodiment when executing a computer program.
[0124] The electronic device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.
[0125] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0126] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the hardware clock test method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. Data 203 may include but is not limited to program code, etc.
[0127] In some embodiments, the electronic device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power source 25 , and a communication bus 26 .
[0128] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the electronic device for hardware clock testing, and may include more or less components than those shown in the figure.
[0129] It is understandable that if the hardware clock test method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the current technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk or optical disk and other media that can store program codes.
[0130] Based on this, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned hardware clock testing method are implemented.
[0131] The above is a detailed introduction to a hardware clock test method provided by an embodiment of the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0132] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0133] The above is a detailed introduction to a hardware clock test method provided by the present invention. This article uses specific examples 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. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A hardware clock testing method, characterized in that: include: Deploy the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronize the time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform; Automatically manage each machine to be tested through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested; Using the current platform time of the preset hardware clock synchronization system platform to synchronize the local hardware clocks of the currently registered machines to be tested; After the time synchronization of the local hardware clock of each of the machines to be tested is completed by using the current platform time, a corresponding hardware clock test operation is performed on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested.
2. The hardware clock testing method according to claim 1, characterized in that: The method of deploying the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network and performing time synchronization with the external network time server includes: Create a first Playbook script for an automated operation and maintenance tool; the first Playbook script is used to define, install and configure a network time server for a local machine where the preset hardware clock synchronization system platform is located; By configuring the host list of the automated operation and maintenance tool under a preset target path, a host definition operation for the local machine based on the Internet Protocol address of the local machine is completed; After completing the host definition operation on the local machine, the local machine is deployed as a network time server of the current local area network based on the first Playbook script, and time is synchronized with the external network time server.
3. The hardware clock testing method according to claim 1, characterized in that: The method of automatically managing each machine to be tested through the preset hardware clock synchronization system platform to register each machine to be tested to the preset hardware clock synchronization system platform includes: Enable automatic management service of the preset hardware clock synchronization system platform; The automatic management service is used to perform resource discovery on the current local area network based on the resource discovery script of the automated operation and maintenance tool to determine the machines to be tested in the current local area network, and the information of the machines to be tested in the current local area network is registered in the configuration management database of the preset hardware clock synchronization system platform.
4. The hardware clock testing method according to claim 3, characterized in that: The method of using the automatic management service and the resource discovery script based on the automated operation and maintenance tool to perform resource discovery on the current local area network to determine each machine to be tested in the current local area network, and registering the information of each machine to be tested in the current local area network into the configuration management database of the preset hardware clock synchronization system platform includes: Creating a resource discovery script for an automated operation and maintenance tool based on a preset scripting language, and using the resource discovery script as a dynamic host list for the automated operation and maintenance tool; Using the dynamic host list to perform resource discovery on the current local area network to determine each machine to be tested in the current local area network; Create a second Playbook script for the automated operation and maintenance tool, and use the second Playbook script to call the preset target interface of the configuration management database based on the preset application interface, so as to register the information of each machine to be tested in the current local area network into the configuration management database by using the called preset target interface.
5. The hardware clock testing method according to any one of claims 1 to 4, characterized in that: The step of using the current platform time of the preset hardware clock synchronization system platform to synchronize the local hardware clocks of the currently registered machines to be tested includes: Acquire information of each of the currently registered machines to be tested; the information of the machines to be tested includes first Internet Protocol address information of a baseboard management controller of the machine to be tested and second Internet Protocol address information of an operating system of the machine to be tested; Using the current platform time of the preset hardware clock synchronization system platform, the first Internet protocol address information corresponding to each of the machines to be tested, and the first user name information and the first password information corresponding to the baseboard management controller, the time synchronization operation of the baseboard management controller corresponding to each of the machines to be tested that are currently registered is completed; Based on the secure shell protocol, the second Internet protocol address information corresponding to each of the machines to be tested, and the second user name information and the second password information corresponding to the operating system, the operating system connection is performed, the preset hardware clock synchronization system platform is connected to the operating system corresponding to each of the machines to be tested, and then the local system time of each of the machines to be tested is synchronized using the current platform time of the preset hardware clock synchronization system platform to obtain the updated local system time of each of the machines to be tested; The local hardware clocks of the currently registered machines to be tested are synchronized based on the updated local system time of the machines to be tested.
6. The hardware clock testing method according to claim 5, characterized in that: The information of the machine to be tested also includes the third Internet Protocol address information of the power distribution unit of the machine to be tested; Accordingly, performing a corresponding hardware clock test operation on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested includes: For the machine to be tested whose hardware clock test type is the first preset test type, based on the corresponding third Internet protocol address information and the third user name information and third password information corresponding to the power distribution unit, connecting the preset hardware clock synchronization system platform to the power distribution unit; Powering off the power supply corresponding to the machine to be tested in the power distribution unit to complete the corresponding AC power off operation, until the power off time of the machine to be tested reaches a preset test time, and completing the corresponding first test operation; After powering on the power distribution unit connected to the machine to be tested that has been cut off from AC power, and starting the machine to be tested based on out-of-band instructions, corresponding time difference information is determined based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested to obtain a corresponding first test result.
7. The hardware clock testing method according to claim 6, characterized in that: The performing a corresponding hardware clock test operation on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested includes: For the machine to be tested whose hardware clock test type is the second preset test type, updating the machine state of the machine to be tested to a standby state until the standby time of the machine to be tested reaches the preset test time, and completing the corresponding second test operation; After the standby state of the machine to be tested is released, corresponding time difference information is determined based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested to obtain a corresponding second test result.
8. The hardware clock testing method according to claim 7, characterized in that: After the corresponding time difference information is determined based on the current platform time of the preset hardware clock synchronization system platform and the current hardware clock information of the machine to be tested, the method further includes: Comparing the time difference information in the first test result or the second test result with a corresponding standard value to obtain a corresponding comparison result; When the comparison result indicates that the time difference information is less than the standard value, the first test result or the second test result corresponding to the machine to be tested is obtained, which is used to indicate that the corresponding test operation meets the standard.
9. A hardware clock testing device, characterized in that: include: A network time server deployment module is used to deploy the local machine where the preset hardware clock synchronization system platform is located as the network time server of the current local area network, and synchronize the time with the external network time server, so as to use the external network time server to synchronize and update the current platform time of the preset hardware clock synchronization system platform; An automatic management module, used to automatically manage each machine to be tested through the preset hardware clock synchronization system platform, so as to register each machine to be tested to the preset hardware clock synchronization system platform, and configure a corresponding hardware clock test type for each machine to be tested; A clock synchronization module, used to synchronize the local hardware clocks of the currently registered machines to be tested using the current platform time of the preset hardware clock synchronization system platform; The clock test module is used to perform corresponding hardware clock test operations on each of the machines to be tested based on the hardware clock test type of each of the machines to be tested after completing the time synchronization of the local hardware clock of each of the machines to be tested using the current platform time.
10. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the hardware clock testing method according to any one of claims 1 to 8.
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 hardware clock testing method according to any one of claims 1 to 8 are implemented.
