Network equipment automatic recovery method and device, equipment and medium

By searching for target response devices of the same device type in the network to obtain the target software image, the problem of network device software image corruption cannot be automatically recovered, and automatic recovery without additional cost is achieved.

CN120979907APending Publication Date: 2025-11-18ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510964596.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-14
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

In existing technologies, network devices cannot automatically recover when the software image is corrupted, and setting up server backups requires manual policy settings and additional costs.

Method used

By searching for target response devices of the same device type that store software images in the network, a download request is sent and a download reply message for the target software image is received. The target software image is then stored and loaded to restore the network device.

Benefits of technology

No dual-image backup or manual backup policy settings are required, avoiding additional costs and ensuring that network devices can automatically recover when the software image is corrupted.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120979907A_ABST
    Figure CN120979907A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an automatic recovery method and device for network equipment, equipment and a medium, which are used for solving the problems that in the prior art, when double mirror images are damaged at the same time, the network equipment cannot be ensured to be recovered to be normal, a client needs to manually set a backup strategy and set up a backup server for setup of server backup, and additional backup is generated. The method comprises the following steps: if it is detected that a software mirror image stored in a flash of search equipment fails to be loaded, searching target response equipment of which the equipment type is the same as that of the search equipment and which stores the software mirror image in a network; according to the method and the device, the downloading request is sent to the target response device, the downloading reply message carrying the target software mirror image and returned by the target response device is received, and the target software mirror image is stored and loaded, so that the correctness of the obtained target software mirror image is ensured, and the search device returns to normal; double mirror image backup is not needed, extra cost is not generated, a backup strategy does not need to be manually set in advance, a backup server does not need to be set up, and extra backup software is not generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication technology, and in particular to a method, apparatus, device and medium for automatic recovery of network devices. Background Technology

[0002] In communication networks, network devices are mostly embedded systems, typically using flash memory as their non-volatile storage module. This flash memory is divided into several areas to store boot programs, software images, configuration data, etc. Furthermore, to support new expansion needs, network devices usually also support software upgrade functionality.

[0003] Unexpected events may occur during software upgrades, such as sudden power outages or software malfunctions, leading to incomplete or corrupted software image data on the flash memory, preventing the network device from booting the system software normally. Therefore, methods to enable automatic recovery of network devices in the event of software image corruption have become an important means of ensuring the normal operation of network devices.

[0004] Currently, in the event of software image corruption, network devices typically employ two backup methods: dual mirroring or setting up a server, to enable automatic recovery. Dual mirroring requires a certain amount of flash memory capacity in the network device's hardware. By adding a system backup partition to the flash memory, the hardware can store two software images, allowing the network device to recover from the corruption of one image. However, dual mirroring incurs additional costs due to its flash memory capacity requirements, and it cannot guarantee recovery if both images are corrupted.

[0005] Setting up server backup requires customers to pre-configure backup policies, set up a backup server, and upload their own software images to the backup server. This allows the backup server to additionally back up the software image files. Additionally, the backup server address needs to be pre-configured on the network devices so that if the network device's software image is corrupted or malfunctions, the bootloader can automatically download the software image from the backup server for recovery. However, this method requires customers to manually configure backup policies, set up a backup server on the network, and back up the software images additionally as files.

[0006] In summary, existing dual-mirror backups incur additional costs, and cannot guarantee the recovery of network devices when both mirrors fail simultaneously. On the other hand, setting up server backups requires customers to manually configure backup policies, build backup servers, and generate additional backups. Summary of the Invention

[0007] This application provides a method, apparatus, device, and medium for automatic network device recovery, which solves the problems in the prior art where network devices cannot be guaranteed to recover normally when both mirrors are damaged at the same time, and where setting up server backups requires customers to manually set backup strategies and set up backup servers, resulting in additional backups.

[0008] In a first aspect, embodiments of this application provide a method for automatic recovery of a network device, applied to a search device, the method comprising:

[0009] If the software image stored in the flash memory of the search device fails to load, then search the network for a target response device of the same type as the search device that also stores the software image.

[0010] Send a download request to the target response device, receive a download reply message carrying the target software image from the target response device, store and load the target software image, and restore the search device to normal operation.

[0011] Secondly, embodiments of this application also provide a network device automatic recovery device, applied to a search device, the device comprising:

[0012] The search module is used to search for a target response device in the network that has the same device type as the search device and stores the software image if the software image stored in the flash memory of the search device fails to load.

[0013] The download module is used to send a download request to the target response device, receive a download reply message carrying the target software image from the target response device, store and load the target software image, and restore the search device to normal operation.

[0014] Thirdly, embodiments of this application also provide an electronic device, which includes at least a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the steps of the network device automatic recovery method as described in any of the preceding claims.

[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the network device automatic recovery method as described in any of the preceding claims.

[0016] In this embodiment, if the software image stored in the flash memory of the search device fails to load, a target responding device with the same device type as the search device and storing the software image is searched in the network. A download request is sent to the target responding device, and a download reply message carrying the target software image is received from the target responding device. The target software image is stored and loaded, restoring the search device to normal operation. In other words, the search device ensures the correctness of the obtained target software image by searching for network devices with the same device type and locally storing the software image as target responding devices, and obtains the target software image from these target responding devices. This allows the search device to return to normal operation. Furthermore, it eliminates the need for dual-image backup, avoiding additional costs, and eliminates the need for manually setting backup strategies or building backup servers, thus preventing the generation of additional backup software. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This application provides a schematic diagram of an automatic recovery process for a network device.

[0019] Figure 2 This application provides a schematic diagram illustrating the process of a search device downloading a target software image and restoring it to normal operation.

[0020] Figure 3 This application provides a schematic diagram of network devices included in a network.

[0021] Figure 4 A schematic diagram illustrating the process of determining the preferred weights of each target candidate response device provided in an embodiment of this application;

[0022] Figure 5 This application provides a schematic diagram of an automatic recovery process for a network device.

[0023] Figure 6 A schematic diagram of an entity network provided in an embodiment of this application;

[0024] Figure 7 A schematic diagram of an automatic recovery device for network devices provided in this application embodiment;

[0025] Figure 8 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0026] To make the objectives and implementation methods of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the exemplary embodiments described are only some embodiments of this application, and not all embodiments.

[0027] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.

[0028] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.

[0029] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.

[0030] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.

[0031] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

[0032] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.

[0033] This application provides a method, apparatus, device, and medium for automatic network device recovery. In this method, if a software image stored in the flash memory of a search device fails to load, the method searches the network for a target responding device of the same device type that also stores the software image. A download request is sent to the target responding device, and a download reply message carrying the target software image is received from the target responding device. The target software image is then stored and loaded, restoring the search device to normal operation. In other words, the search device searches the network for a target responding device of the same device type that also stores the software image locally, and obtains the target software image from that device. This ensures the correctness of the obtained target software image, thus restoring the search device to normal operation. Furthermore, it eliminates the need for dual-image backup, avoiding additional costs, and eliminates the need for manually setting backup strategies or building backup servers, thus preventing the generation of additional backup software.

[0034] Example 1:

[0035] Figure 1 This application provides a schematic diagram of an automatic recovery process for a network device, applied to a search device. The process includes:

[0036] S101: If it is detected that the software image stored in the flash of the search device fails to load, then search the network for a target response device with the same device type as the search device and which stores the software image.

[0037] The automatic recovery method for network devices provided in this application is applied to a search device. The search device can be a network device that, when it detects that it has failed to load a software image, attempts to restore itself to normal operation. After detecting that it has failed to load a software image, the network device will enter the boot program stage so that it can subsequently restore itself to normal operation. Therefore, the search device is still a network device that is in the boot program stage.

[0038] In this embodiment, since the software images stored in any number of network devices of the same type are identical under normal operation, when the search device detects that the software image stored in its own flash fails to load, that is, when it determines that the software image stored in its own flash is incomplete or damaged, in order to obtain a target software image that is the same as the complete and correct software image stored in the search device under normal operation, the search device will search in the network and determine a target responding device that is the same type as the search device and stores a software image, so that the target software image can be obtained from the target responding device and the search device can be restored to normal operation based on the target software image.

[0039] It is understood that the target responding device found by the search device in the network is a network device whose system software is running normally and supports the device search function.

[0040] S102: Send a download request to the target response device, receive a download reply message carrying the target software image from the target response device, store and load the target software image, and restore the search device to normal operation.

[0041] After identifying the target response device, the search device sends a download request to the target response device, which is a software image download request. Upon receiving the download request, the target response device encapsulates the target software image running on the flash of the target response device in a download reply message and uploads the download reply message to the search device, which is a software image download reply message.

[0042] After receiving a download response message carrying the target software image from the target responding device, the search device parses the message, identifies the target software image, and stores it. The search device's bootloader then loads this stored image. Because the software image provides a consistent operating environment for the system software, ensuring it runs in the same way in different environments and avoiding errors and instability caused by environmental differences, the search device can automatically resume system operation and restore normal operation after loading the target software image.

[0043] Specifically, when storing the target software image, the target software image can be stored in the flash or memory of the search device.

[0044] For example, if the target software image is stored in the flash memory of the search device, the target software image written in the flash memory will still exist regardless of whether the search device loses power or not. In other words, even if the search device loses power and then restarts, the search device can automatically return to normal.

[0045] As another example, storing the target software in the memory of the search device can reduce the number of flash write cycles and extend the flash lifespan. However, when the search device loses power, the target software image written in memory will disappear. In other words, writing the target software image into memory can only guarantee that the search device will recover normally for one time (i.e., before the power outage). After the search device recovers normally for one time, an alarm message can be sent to the user indicating that the search device needs to be upgraded, allowing the user to choose whether to perform the upgrade operation. Specifically, if the user selects to perform the upgrade operation, the target software image is written to the flash; if the user selects not to perform the upgrade operation, there is no need to write the target software image to the flash.

[0046] Additionally, it is understandable that if the searching device does not receive a download response message carrying the target software image from the target responding device, or if the searching device fails to store or load the target software image, the searching device will re-enter the process of searching for the target responding device.

[0047] To facilitate understanding, the process of downloading the target software image and restoring normal operation of the search device in this application embodiment is explained below through a specific example. See [link to example]. Figure 2 , Figure 2 This application provides a schematic diagram illustrating a process for a search device to download a target software image and restore it to normal operation. The process includes the following steps:

[0048] S201: The search device sends a download request to the target response device.

[0049] S202: After receiving the download request, the target response device obtains the target software image currently loaded and running in its own flash memory, fills it into the download reply message, and uploads it to the search device.

[0050] S203: The search device receives and parses the download reply message, obtains the target software image, writes the target software image into flash or memory, and loads and starts the software.

[0051] S204: The search device has returned to normal.

[0052] In this embodiment, the search device searches for network devices of the same type that have locally stored software images as target response devices in the network, and obtains the target software image from the target response device, ensuring the correctness of the obtained target software image and thus restoring the search device to normal operation. Furthermore, it eliminates the need for dual image backup, avoids additional costs, and eliminates the need for manually setting backup strategies or building backup servers in advance, thus preventing the generation of additional backup software. The method provided in this embodiment can prevent the network device from entering an unrecoverable state due to incomplete or damaged software images caused by unexpected power outages or other abnormalities during the upgrade process.

[0053] Example 2:

[0054] Based on the above embodiments, in this embodiment of the application, searching for a target response device in the network that has the same device type as the search device and stores a software image includes:

[0055] The search device sends search requests to the network at set time intervals;

[0056] If the search device receives a response message from the responding device, it parses the response message to determine the device model carried in the response message and whether the software image information is stored locally.

[0057] Based on the device model carried in the response message and the device model of the searched device, determine the candidate response devices that are the same type as the searched device.

[0058] Based on the information carried in the response messages of each candidate response device regarding whether a software image is stored locally, the target candidate response device that has a software image stored locally is determined.

[0059] Based on the target candidate response devices, determine the target response device.

[0060] After a search device detects a failure to load its software image and enters the boot process, its boot program sends search requests to the network at set time intervals. Multiple network devices (i.e., responding devices) that support the search function may exist in the network; this means that the responding device, under normal operating conditions, can receive and respond to search requests sent by the search device.

[0061] The time interval should not be too short, meaning the search device should not send search requests too frequently, to reduce the impact on network and response device load. For example, a time interval of one minute can be set; no specific limit is specified here.

[0062] If a responding device in the network receives a search request, it will fill the response message with reply information and return the response message to the searching device. The reply information includes at least the responding device's model number and whether it has locally stored the software image. The model number is a specific combination of numbers and letters assigned by the manufacturer to distinguish different products.

[0063] If the search device receives a response message from at least one responding device in the network within a set time interval after sending the search request, it parses each received response message to determine the device model of the corresponding responding device carried in each response message and whether the software image is stored locally.

[0064] Furthermore, it is understandable that if the search device does not receive a response message from any responding device in the network within the set time interval after the sending time, the step of sending the search request to the network at the set time interval will be re-executed.

[0065] After determining the device model of the corresponding responding device carried in each response message, the search device obtains its own device model and, for each response message, determines whether the device model of the responding device is the same as that of the search device. If they are the same, the device type of the responding device is determined to be the same as that of the search device, and the responding device is identified as a candidate responding device; if they are different, the device type of the responding device is determined to be different from that of the search device. Through this method, at least one candidate responding device with the same device type as the search device is identified.

[0066] After identifying at least one candidate response device, based on whether the response message of each candidate response device contains information about whether it locally stores a software image, the candidate response device that locally stores a software image is determined as the target candidate response device. The software image stored in each target candidate response device is identical to the software image stored in the flash memory of the search device under normal operating conditions.

[0067] After identifying the target candidate response devices, the target response device can be determined based on information such as the usage status of each candidate response device, including user online status and CPU utilization. Once the target response device is determined, the process of sending search requests to the network at set time intervals is stopped. In one possible implementation, the target response device can be the candidate response device with the lowest current utilization rate, thereby avoiding additional burden on the candidate response devices with higher utilization rates.

[0068] Furthermore, it is understood that if the search device receives a response message from at least one responding device in the network within a set time interval after the sending time, but the device type of the responding device corresponding to each received response message is different from that of the search device and / or the corresponding responding device does not have a software image stored locally, then the search device will re-execute the step of sending the search request to the network at the set time interval.

[0069] To facilitate understanding, the following will be explained... Figure 3 The diagram showing the network devices included in the network illustrates the process of searching for and downloading the target software image, which includes:

[0070] Step one: The search module of the search device sends search requests to the network at set time intervals. If a responding device (such as...) appears in the network... Figure 3 When the response device 1, response device 2, ..., response device N shown in the figure receive a search request, it will return a response message to the search module of the search device.

[0071] Step 2: When the search module of the search device receives a response reply message from at least one responding device in the network, it determines the device model of the corresponding responding device carried in each response reply message and whether the software image is stored locally, and determines the target responding device whose device type is the same as the search device and which stores the software image.

[0072] Step 3: After identifying the target response device, the search device's download module sends a download request to the target response device; receives and parses the download reply message returned by the target response device, obtains the target software image carried in the download reply message, writes the target software image into its own flash or memory and loads and starts it, so that the search device returns to normal.

[0073] In this embodiment of the application, searching for a target response device in the network device that has the same device type as the search device and stores a software image can ensure the correctness of the target software image subsequently obtained from the target response device.

[0074] Example 3:

[0075] Based on the above embodiments, in this embodiment of the application, determining the target response device according to the target candidate response device includes:

[0076] For each target candidate response device, the preferred weight of the target candidate response device is determined based on the user online status and the CPU utilization rate carried in the response message corresponding to the target candidate response device.

[0077] The candidate response device with the highest priority is selected as the target response device.

[0078] In this embodiment, after receiving a search request, the responding device in the network also fills the response message with the user's online status and CPU utilization as reply information. Therefore, after parsing the response message, the search device can also obtain the user's online status and CPU utilization carried in the response message.

[0079] After identifying the target candidate response devices, for each target candidate response device, the preferred weight is determined based on the user online status and CPU utilization carried in the response reply message corresponding to that target candidate response device.

[0080] Specifically, if the user corresponding to the target candidate response device is online, the preference weight of the target candidate response device will be reduced; and if the CPU utilization rate of the target candidate response device is higher, the preference weight of the target candidate response device will be lower. In other words, in this embodiment, the higher the utilization rate of the target candidate response device, the lower its preference weight will be.

[0081] After determining the preferred weights for each target candidate response device, since a higher preferred weight indicates a lower usage rate for the corresponding target candidate response device, in order to avoid causing additional burden to the target candidate response devices with higher usage rates, in this embodiment of the application, the target candidate response device with the highest preferred weight is determined as the target response device.

[0082] In this embodiment, based on the user online status and CPU utilization of each target candidate response device, the target candidate response device with the lowest utilization rate is determined as the target response device, which can avoid causing additional burden to the target candidate response device with a high utilization rate.

[0083] Example 4:

[0084] Based on the above embodiments, in this embodiment, the preferred weight of the target candidate response device is determined according to the user online status and CPU utilization carried in the response message corresponding to the target candidate response device, including:

[0085] Based on the user's online status carried in the response message corresponding to the target candidate response device, the first sub-occupancy weight value is determined; wherein, if the user's online status is online, the first sub-occupancy weight value is determined to be a first value, and if the user's online status is offline, the first sub-occupancy weight value is determined to be a second value; wherein, the first value is greater than the second value.

[0086] The second sub-occupancy weight value is determined based on the CPU utilization rate carried in the response message corresponding to the target candidate response device; where the higher the CPU utilization rate, the higher the second sub-occupancy weight value.

[0087] Based on the first sub-occupancy weight value and the second sub-occupancy weight value, determine the occupancy weight value corresponding to the target candidate response device;

[0088] Based on the occupancy weight value corresponding to the target candidate response device, the preferred weight corresponding to the target candidate response device is determined; wherein, the higher the occupancy weight value, the lower the preferred weight of the target candidate response device.

[0089] In this embodiment of the application, for each target candidate response device, the first sub-occupancy weight value corresponding to the user online status of the target candidate response device is determined based on the information on whether the user is online contained in the user online status carried in the response reply message corresponding to the target candidate response device.

[0090] Specifically, if a user is online, the first sub-weight is determined to be the first value; if a user is offline, the first sub-weight is determined to be the second value. The first value is greater than the second value. For example, the first value could be 100 and the second value could be 0; no specific restrictions are imposed here.

[0091] Furthermore, based on the CPU utilization rate carried in the response message corresponding to the target candidate response device, a second sub-occupancy weight value corresponding to the CPU utilization rate of the target candidate response device is determined. The higher the CPU utilization rate, the higher the second sub-occupancy weight value.

[0092] For example, the second sub-occupancy weight value corresponding to the CPU utilization of the target candidate response device can satisfy the formula: Second sub-occupancy weight value = CPU utilization × 100.

[0093] In another example, the second sub-occupancy weight value corresponding to the CPU utilization of the target candidate response device can satisfy the formula: second sub-occupancy weight value = [CPU utilization × 100], where [x] represents rounding, that is, in this embodiment of the application, the integer part of (CPU utilization × 100) can be taken as the second sub-occupancy weight value.

[0094] After obtaining the first sub-occupancy weight value and the second sub-occupancy weight value corresponding to the target candidate response device, in one possible implementation, the sum of the first sub-occupancy weight value and the second sub-occupancy weight value is determined based on the first sub-occupancy weight value and the second sub-occupancy weight value, and the sum is determined as the occupancy weight value corresponding to the target candidate response device.

[0095] In another possible implementation, in this embodiment of the application, an initial occupancy weight value is set for each target candidate response device, and the initial occupancy weight values ​​corresponding to each target candidate response device are all the same. Then, based on the first sub-occupancy weight value and the second sub-occupancy weight value corresponding to the target candidate response device, the sum of the first sub-occupancy weight value, the second sub-occupancy weight value, and the initial occupancy weight value is determined, and this sum is determined as the occupancy weight value corresponding to the target candidate response device. This embodiment of the application does not limit the specific value of the initial occupancy weight value; for example, the initial occupancy weight value can be 0.

[0096] It is understood that, in the embodiments of this application, the higher the weight value, the higher the utilization rate of the target candidate response device.

[0097] After obtaining the occupancy weight value corresponding to the target candidate response device, in one possible implementation, the occupancy weight values ​​of each target candidate response device are sorted in ascending or descending order, and the preferred weight corresponding to the target candidate response device with the smaller the occupancy weight value is determined to be higher. It can be understood that since a higher occupancy weight value indicates a higher utilization rate of the target candidate response device, in order to avoid placing an additional burden on the target candidate response device with a high utilization rate, in this embodiment of the application, a higher occupancy weight value corresponds to a lower preferred weight.

[0098] In another possible implementation, the preferred weight of the target candidate response device can be determined by means including but not limited to taking the reciprocal, based on the occupied weight value corresponding to the target candidate response device.

[0099] To facilitate understanding, the process of determining the preferred weights of each target candidate response device in this application embodiment is explained below through a specific example. See [link to example]. Figure 4 , Figure 4 This application provides a schematic diagram of a process for determining the preferred weights of each target candidate response device, which includes the following steps:

[0100] S401: Set initial occupancy weight values ​​for each target candidate response device, and obtain the user online status and CPU utilization carried in the response reply message corresponding to each target candidate response device.

[0101] S402: For each target candidate response device, determine whether the user's online status of the target candidate response device is offline. If yes, proceed to step S404; otherwise, proceed to step S403.

[0102] S403: For each target candidate response device, determine the first sub-occupancy weight value of the target candidate response device as the first value, and execute step S405.

[0103] S404: For each target candidate response device, determine the first sub-occupancy weight value of the target candidate response device as the second value, and execute step S405.

[0104] S405: For each target candidate response device, the weight value of the target candidate response device is determined by the formula: Weight Value = First Sub-weight Value + [100 × CPU Utilization].

[0105] Wherein, [100×CPU utilization] represents the second sub-occupancy weight value of the target candidate response device.

[0106] S406: Sort the occupancy weight values ​​of each target candidate response device in ascending or descending order, and determine that the target candidate response device with the smaller occupancy weight value has a higher priority.

[0107] Example 5:

[0108] Based on the above embodiments, in this embodiment of the application, the response message also carries an IP address, thus sending a download request to the target response device, including:

[0109] Based on the Internet Protocol (IP) address carried in the response message of the target responding device, a download request is sent to the target responding device corresponding to the IP address.

[0110] In this embodiment, after receiving a search request, the responding device in the network also fills its own IP address into the response reply message. In other words, the response reply message also carries an IP address. Therefore, after parsing the response reply message, the search device can also obtain the IP address carried in the response reply message.

[0111] Therefore, after identifying the target response device, in order to obtain the target software image stored in the flash of the target response device, in this embodiment of the application, a download request is sent to the target response device corresponding to the IP address based on the IP address carried in the response reply message corresponding to the target response device.

[0112] The above embodiments are described below with a specific example. See [link to example]. Figure 5 The diagram illustrates the automatic recovery process for network devices, including the following steps:

[0113] S501: If the search device detects that the software image stored in its own flash memory has failed to load, it sends a search request to the network at set time intervals through the boot program.

[0114] S502: If at least one responding device in the network receives the search request, it will return a response message to the search device.

[0115] Specifically, each responding device that receives a search request fills its device model, whether it has stored the software image locally, the user's online status, CPU usage, and IP address into the response message and uploads it to the search device.

[0116] S503: When the bootloader of the search device receives at least one response message, it determines that the target candidate response device has the same device type as the search device and stores the software image; and determines the preferred weight of each target candidate response device, determines the target candidate response device with the highest preferred weight as the target response device, and stops periodically sending search requests to the network.

[0117] Specifically, the search device determines target candidate response devices that have the same device type as the search device and store the software image based on the device model of the response device carried in each response reply message and whether it has stored the software image locally; and determines the preferred weight of each target candidate response device based on the user online status and CPU utilization carried in the response reply message corresponding to each target candidate response device.

[0118] S504: The search device sends a download request to the target response device based on the IP address carried in the response reply message corresponding to the target response device. The target response device fills the download reply message with the target software image running in its own flash and returns it to the search device.

[0119] S505: The search device receives and parses the download reply message, stores and loads the target software image carried in the download reply message, so that the search device can return to normal operation.

[0120] The above embodiments are illustrated below with a specific example of physical network topology. See [link to documentation]. Figure 6 The physical network topology diagram, Figure 6When a personal computer (PC) / server / cloud performs a network software upgrade on a network camera C1, an unexpected power outage during the upgrade image writing process can cause the network camera C1's usable software image to be incomplete or corrupted, preventing the network camera C1 from returning to normal. To restore normal operation, the network camera C1 uses itself as a search device and employs the automatic network device recovery method provided in this application embodiment. The specific process is as follows:

[0121] Step 1: Network camera C1 enters the boot process stage (at this time, it is in a no-system state). The PC / server / cloud cannot access network camera A, so network camera C1 sends search requests to the network at set time intervals.

[0122] Step 2: Network switches S1 and S2, and network cameras C2, C3, C4, and C5 in the network receive the search request message. Each of them fills the response message with information such as device model, IP address, CPU utilization, user online status, and whether the software image is stored locally, and returns the response message to network camera C1.

[0123] Among them, network switches S1 and S2, and network cameras C2, C3, C4, and C5 are the response devices in the embodiments of this application; and software images are stored in network switches S1 and S2, and network cameras C2, C3, C4, and C5.

[0124] Additionally, it should be noted that, Figure 6 The C and S appearing in the code indicate the device type of the network device, while 1, 2, 3, 4, and 5 are used to distinguish network devices of the same type and do not directly represent the device model.

[0125] Step 3: Since network switches S1 and S2 are different types of devices from network camera C1, network switches S1 and S2 do not occupy weight values.

[0126] For network cameras C2, C3, C4, and C5, which are the same device type as network camera C1 and have software images stored locally, according to... Figure 6 The user online status and CPU utilization of each network camera shown are calculated using the occupancy weight value. The occupancy weight values ​​of each network camera are sorted from low to high as follows: C5 (occupancy weight value 37), C3 (occupancy weight value 62), C4 (occupancy weight value 135), and C2 (occupancy weight value 155). Therefore, the preferred weights of each network camera are determined from high to low as: C5, C3, C4, and C2, and the network camera with the highest preferred weight, C5, is determined as the target response device.

[0127] Specifically, when a user is online, the first value corresponding to the first sub-weight value is 100, and when a user is offline, the second value corresponding to the first sub-weight value is 0.

[0128] Step 4: Network camera C1 sends a download request to the network device with the highest priority (network camera C5).

[0129] Step 5: After receiving the download request, network camera C5 fills the download response message with the target software image on its own flash used for loading and starting, and uploads it to network camera C1.

[0130] Step six: Network camera C1 receives the download reply message uploaded by network camera C5, parses the download reply message, obtains the target software image, and stores it in flash or memory. Then, it automatically loads the target software image to enable the system software to run normally.

[0131] Example 6:

[0132] Based on the same technical concept and the above embodiments, this application provides a network device automatic recovery device applied to a search device. Figure 7 This application provides a schematic diagram of the structure of an automatic recovery device for network devices, as shown in the embodiments. Figure 7 As shown, the device includes:

[0133] The search module 701 is used to search for a target response device in the network that has the same device type as the search device and stores a software image if the software image stored in the flash memory of the search device fails to load.

[0134] The download module 702 is used to send a download request to the target response device, receive a download reply message carrying the target software image returned by the target response device, store and load the target software image, and restore the search device to normal operation.

[0135] In one possible implementation, the search module 701 is specifically configured to send search requests to the network at set time intervals; if the search device receives a response reply message from the responding device, it parses the response reply message to determine the device model carried in the response reply message and whether the software image is stored locally; based on the device model carried in the response reply message and the device model of the search device, it determines each candidate responding device with the same device type as the search device; based on the information carried in the response reply messages of each candidate responding device regarding whether the software image is stored locally, it determines the target candidate responding device that stores the software image locally; and based on the target candidate responding device, it determines the target responding device.

[0136] In one possible implementation, the search module 701 is specifically used to determine the preferred weight of each target candidate response device based on the user online status and CPU utilization carried in the response reply message corresponding to the target candidate response device; and to determine the target candidate response device with the highest preferred weight as the target response device.

[0137] In one possible implementation, the search module 701 is specifically configured to: determine a first sub-occupancy weight value based on the user's online status carried in the response message corresponding to the target candidate response device; wherein, if the user's online status is online, the first sub-occupancy weight value is determined to be a first value, and if the user's online status is offline, the first sub-occupancy weight value is determined to be a second value; wherein, the first value is greater than the second value; determine a second sub-occupancy weight value based on the CPU utilization carried in the response message corresponding to the target candidate response device; wherein, the higher the CPU utilization, the higher the second sub-occupancy weight value; determine the occupancy weight value corresponding to the target candidate response device based on the first and second sub-occupancy weight values; and determine the preferred weight corresponding to the target candidate response device based on the occupancy weight value corresponding to the target candidate response device; wherein, the higher the occupancy weight value, the lower the preferred weight of the target candidate response device.

[0138] In one possible implementation, the response message also carries an IP address. The download module 702 is specifically used to send a download request to the target response device corresponding to the IP address based on the IP address carried in the response message of the target response device.

[0139] Example 7:

[0140] Based on the same technical concept, this application also provides an electronic device. Figure 8 This application provides a schematic diagram of an electronic device structure, such as... Figure 8 As shown, it includes: processor 801, communication interface 802, memory 803 and communication bus 804, wherein processor 801, communication interface 802 and memory 803 communicate with each other through communication bus 804.

[0141] The memory 803 stores a computer program. When the program is executed by the processor 801, the processor 801 performs the following steps:

[0142] If the software image stored in the flash memory of the search device fails to load, then search the network for a target response device of the same type as the search device that also stores the software image.

[0143] Send a download request to the target response device, receive a download reply message carrying the target software image from the target response device, store and load the target software image, and restore the search device to normal operation.

[0144] In one possible implementation, the processor 801 is specifically configured to send search requests to the network at set time intervals; if the search device receives a response reply message from the responding device, it parses the response reply message to determine the device model carried in the response reply message and whether the software image is stored locally; based on the device model carried in the response reply message and the device model of the search device, it determines each candidate responding device with the same device type as the search device; based on the information carried in the response reply messages of each candidate responding device regarding whether the software image is stored locally, it determines the target candidate responding device with the software image stored locally; and based on the target candidate responding device, it determines the target responding device.

[0145] In one possible implementation, the processor 801 is specifically configured to determine the preferred weight of each target candidate response device based on the user online status and CPU utilization carried in the response reply message corresponding to the target candidate response device; and to determine the target candidate response device with the highest preferred weight as the target response device.

[0146] In one possible implementation, the processor 801 is specifically configured to: determine a first sub-occupancy weight value based on the user's online status carried in the response message corresponding to the target candidate response device; wherein, if the user's online status is online, the first sub-occupancy weight value is determined to be a first value, and if the user's online status is offline, the first sub-occupancy weight value is determined to be a second value; wherein, the first value is greater than the second value; determine a second sub-occupancy weight value based on the CPU utilization carried in the response message corresponding to the target candidate response device; wherein, the higher the CPU utilization, the higher the second sub-occupancy weight value; determine the occupancy weight value corresponding to the target candidate response device based on the first sub-occupancy weight value and the second sub-occupancy weight value; and determine the preferred weight corresponding to the target candidate response device based on the occupancy weight value corresponding to the target candidate response device; wherein, the higher the occupancy weight value, the lower the preferred weight of the target candidate response device.

[0147] In one possible implementation, the response message also carries an IP address, and the processor 801 is specifically used to send a download request to the target response device corresponding to the IP address based on the IP address carried in the response message corresponding to the target response device.

[0148] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0149] Communication interface 802 is used for communication between the above-mentioned electronic device and other devices.

[0150] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0151] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital instruction processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0152] Example 8:

[0153] Based on the same technical concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by an electronic device. When the program is run on the electronic device, it causes the electronic device to implement any of the above embodiments.

[0154] The aforementioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in an electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), optical storage such as CDs, DVDs, BDs, HVDs, etc., and semiconductor storage such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs), etc.

[0155] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0156] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0157] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0158] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0159] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for automatic recovery of network devices, characterized in that, Applied to a search device, the method includes: If it is detected that the software image stored in the flash memory of the search device fails to load, then search the network for a target response device of the same type as the search device that stores the software image. A download request is sent to the target response device, and a download reply message carrying the target software image is received from the target response device. The target software image is stored and loaded, so that the search device can return to normal operation.

2. The method according to claim 1, characterized in that, The search for target response devices in the network that are of the same type as the searched device and store the software image includes: The search device sends search requests to the network at set time intervals; If the search device receives a response message from the responding device, it parses the response message to determine the device model carried in the response message and whether the software image is stored locally. Based on the device model carried in the response message and the device model of the search device, determine each candidate response device that has the same device type as the search device; Based on the information carried in the response message of each candidate response device regarding whether a software image is stored locally, the target candidate response device that stores the software image locally is determined. The target response device is determined based on the target candidate response device.

3. The method according to claim 2, characterized in that, The step of determining the target response device based on the target candidate response device includes: For each target candidate response device, the preferred weight of the target candidate response device is determined based on the user online status and CPU utilization carried in the response reply message corresponding to the target candidate response device. The target candidate response device with the highest preferred weight is determined as the target response device.

4. The method according to claim 3, characterized in that, The step of determining the preferred weight of the target candidate response device based on the user online status and CPU utilization carried in the response message corresponding to the target candidate response device includes: Based on the user's online status carried in the response message corresponding to the target candidate response device, a first sub-occupancy weight value is determined; wherein, if the user's online status is online, the first sub-occupancy weight value is determined to be a first value, and if the user's online status is offline, the first sub-occupancy weight value is determined to be a second value; wherein, the first value is greater than the second value. The second sub-occupancy weight value is determined based on the CPU utilization rate carried in the response message corresponding to the target candidate response device; wherein, the higher the CPU utilization rate, the higher the second sub-occupancy weight value. Based on the first sub-occupancy weight value and the second sub-occupancy weight value, determine the occupancy weight value corresponding to the target candidate response device; Based on the occupancy weight value corresponding to the target candidate response device, the preferred weight corresponding to the target candidate response device is determined; wherein, the higher the occupancy weight value, the lower the preferred weight of the target candidate response device.

5. The method according to claim 2, characterized in that, If the response message also carries an IP address, then sending a download request to the target response device includes: The download request is sent to the target response device corresponding to the IP address carried in the response message of the target response device.

6. An automatic recovery device for network equipment, characterized in that, Applied to a search device, the device includes: The search module is used to search the network for a target response device that has the same device type as the search device and stores the software image if the software image stored in the flash memory of the search device fails to load. The download module is used to send a download request to the target response device, receive a download reply message carrying the target software image returned by the target response device, store and load the target software image, and restore the search device to normal operation.

7. The apparatus according to claim 6, characterized in that, The search module is specifically used to send search requests to the network at set time intervals; if the search device receives a response reply message from the responding device, it parses the response reply message to determine the device model carried in the response reply message and whether the software image is stored locally; based on the device model carried in the response reply message and the device model of the search device, it determines each candidate responding device with the same device type as the search device; based on the information carried in the response reply messages of each candidate responding device regarding whether the software image is stored locally, it determines the target candidate responding device that stores the software image locally. The target response device is determined based on the target candidate response device.

8. The apparatus according to claim 7, characterized in that, The search module is specifically used to determine the preferred weight of each target candidate response device based on the user online status and CPU utilization carried in the response reply message corresponding to the target candidate response device; and to determine the target candidate response device with the highest preferred weight as the target response device.

9. An electronic device, characterized in that, The electronic device includes at least a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the steps of the network device automatic recovery method as described in any one of claims 1-5.

10. A computer storage medium, characterized in that, It stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the network device automatic recovery method according to any one of claims 1-5.