CN114221854A - Method and device for recovering network information in gateway, electronic equipment and storage medium - Google Patents

Method and device for recovering network information in gateway, electronic equipment and storage medium Download PDF

Info

Publication number
CN114221854A
CN114221854A CN202111348034.6A CN202111348034A CN114221854A CN 114221854 A CN114221854 A CN 114221854A CN 202111348034 A CN202111348034 A CN 202111348034A CN 114221854 A CN114221854 A CN 114221854A
Authority
CN
China
Prior art keywords
network information
coordinator
backup
control module
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111348034.6A
Other languages
Chinese (zh)
Other versions
CN114221854B (en
Inventor
黎婷婷
傅晓明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lumi United Technology Co Ltd
Original Assignee
Lumi United Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lumi United Technology Co Ltd filed Critical Lumi United Technology Co Ltd
Priority to CN202111348034.6A priority Critical patent/CN114221854B/en
Priority claimed from CN202111348034.6A external-priority patent/CN114221854B/en
Publication of CN114221854A publication Critical patent/CN114221854A/en
Application granted granted Critical
Publication of CN114221854B publication Critical patent/CN114221854B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application discloses a method and a device for recovering network information in a gateway, electronic equipment and a storage medium, wherein the method is applied to a main control module, and comprises the following steps: acquiring current network information from a coordinator and acquiring backup network information from the main control module; detecting whether the network information is the same as the backup network information; and if the current network state of the coordinator is different and is characterized to be abnormal, sending the backup network information to the coordinator to replace the network information so as to restore the network state of the coordinator to a normal state. The method and the device can solve the problem of network information loss, can timely, efficiently and automatically recover the network information, and improve user experience.

Description

Method and device for recovering network information in gateway, electronic equipment and storage medium
Technical Field
The present application relates to the field of communications, and in particular, to a method and an apparatus for recovering network information in a gateway, an electronic device, and a storage medium.
Background
At present, in a device communication process, network information of a coordinator in a ZigBee network is usually stored in a flash memory of a coordinator chip, but when the voltage of the coordinator chip is unstable or abnormally restarted, the ZigBee coordinator network information stored in the flash memory of the coordinator chip may be lost, so that after the coordinator chip is restarted, wrong network information is read from the coordinator chip, that is, the read network information in the coordinator is different from the network information in the original network, under such a situation, the coordinator cannot communicate with devices in the original network, and thus device data of each device in the ZigBee network cannot be normally reported to a cloud, and the device is in an offline state. For the offline device, if the offline device is to be restored to the online state, the offline device is added to the new ZigBee network created by the coordinator again by adopting factory restoration settings. However, after the factory setting is restored, the configuration information of the equipment itself is lost, and reconfiguration is required to enable all the equipment to reach the normal working state before abnormality, and the process is large in processing workload, high in labor cost and low in efficiency.
Disclosure of Invention
In view of the foregoing problems, embodiments of the present application provide a method and an apparatus for recovering network information in a gateway, an electronic device, and a storage medium, so as to improve the foregoing problems.
In a first aspect, an embodiment of the present application provides a method for recovering network information in a gateway, where the method is applied to a master control module, and the method includes: acquiring current network information from a coordinator and acquiring backup network information from the main control module; detecting whether the network information is the same as the backup network information; and if the current network state of the coordinator is different and is characterized to be abnormal, sending the backup network information to the coordinator to replace the network information so as to restore the network state of the coordinator to a normal state.
In a second aspect, an embodiment of the present application provides an apparatus for recovering network information in a gateway, including: the first acquisition module is used for acquiring the current network information from the coordinator; the second acquisition module is used for acquiring backup network information from the main control module; the first detection module is used for detecting whether the network information is the same as the backup network information; and the sending module is used for sending the backup network information to the coordinator to replace the network information so as to restore the network state of the coordinator to a normal state.
In some exemplary embodiments of the present application, the apparatus for restoring network information in the gateway further includes: the network information backup condition detection module is used for detecting whether the backup condition of the network information is met; and the backup module is used for backing up the network information if the backup condition is met.
In some exemplary embodiments of the present application, the network information includes a list of child devices and an output frame count value; backup modules, including but not limited to: the device comprises a first detection unit, a first backup unit and a second backup unit. The first detection unit is used for detecting whether the backup network information exists in the main control module or not if the backup condition is met; the first backup unit is used for updating the sub-device list and the output frame count value in the backup network information according to the sub-device list and the output frame count value in the network information if the first detection unit detects that the backup network information exists in the main control module; and the second backup unit is used for backing up all the network information to the main control module if the first detection unit detects that the main control module does not have the backup network information.
In some exemplary embodiments of the present application, the backup condition includes at least one of: after the master control module is started, the delay time reaches a first set time; after the main control module is started, the current time of the main control module is within a set backup time period; the network information's subset list and/or the output frame count value is updated.
In some exemplary embodiments of the present application, the network information recovery processing apparatus in the gateway further includes: the second detection unit is used for detecting whether the query condition of the network information is met; and if the query condition of the network information is met, turning to a first acquisition module.
In some exemplary embodiments of the present application, the query condition includes at least one of: after the master control module is started, the delay time reaches a third set time; after the main control module is started, the current time of the main control module is within a set query time period; the sub-device list and/or output frame count value of the network information in the coordinator is updated.
In some exemplary embodiments of the present application, the network information recovery processing apparatus in the gateway further includes: a network information receiving module, configured to receive first network information reported by the coordinator, where the first network information is current network information reported after the coordinator is reset; the second detection module is used for detecting whether the first network information is the same as the backup network information; and if not, executing the step of sending the backup network information to the coordinator again to replace the network information.
In some exemplary embodiments of the present application, the network information recovery processing apparatus in the gateway further includes: a network information receiving unit, configured to receive first network information reported by the coordinator, where the first network information is current network information reported after the coordinator is reset. And the information reporting unit is used for stopping executing the step of sending the backup network information to the coordinator to replace the network information if the execution times reach a time threshold value, and reporting fault information to a server, wherein the fault information is used for indicating that the current network state of the coordinator is abnormal.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor; a memory having stored thereon computer readable instructions which, when executed by the processor, implement a method for recovering network information in a gateway as described above.
In a fourth aspect, the present application provides a computer-readable storage medium, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the method for recovering network information in a gateway is implemented as described above.
According to the scheme, the network information is backed up in the main control module, and under the condition that the network information in the coordinator is determined to be different from the backup network information in the main control module, the network information in the coordinator is recovered based on the backup network information in the main control module so as to replace abnormal network information in the coordinator, so that the problem that other equipment in the network cannot communicate with the coordinator due to the abnormal network information in the coordinator can be effectively solved, and the abnormal network information can be timely recovered when the network information in the coordinator is abnormal.
In addition, in the scheme, when the network information in the coordinator is detected to be different from the backup network information in the main control module, the backup network information in the main control module is automatically restored to the coordinator, the process is automatically carried out in the gateway device, the situation that the sub-device is offline is avoided, and the non-inductive restoration of the network information is realized. For the user, the device is always normal; an engineer can query the gateway log to know the abnormal recovery condition of the coordinator. Therefore, the scheme can effectively solve the problem of network information abnormity and timely, efficiently and automatically recover and restore the network information. In the scheme, because the abnormal network information in the coordinator is restored in time according to the backup network information in the main control module, the equipment does not need to be restored to factory settings, reconfigured and the like, and only the network information in the coordinator is restored, so that the processing workload is greatly reduced, and the restoration efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a schematic diagram of a Zigbee network system.
Fig. 2 is a flowchart illustrating a method for recovering network information in a gateway according to an exemplary embodiment of the present application.
FIG. 3 is a flow chart illustrating steps prior to step 220 according to one embodiment of the present application.
Fig. 4 is a flowchart illustrating steps subsequent to step 240 according to an embodiment of the present application.
Fig. 5 is a timing diagram illustrating a method for recovering network information in a gateway according to an embodiment of the present application.
Fig. 6 is a flowchart illustrating a method for recovering network information in a gateway according to an embodiment of the present application.
Fig. 7 is a block diagram illustrating an apparatus for restoring network information in a gateway according to an example embodiment.
FIG. 8 is a block diagram of one embodiment of a backup module in a corresponding embodiment of FIG. 7.
Fig. 9 is a hardware block diagram of an electronic device shown in accordance with an exemplary embodiment of the present application.
While specific embodiments of the invention have been shown by way of example in the drawings and will be described in detail hereinafter, such drawings and description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by way of specific embodiments.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The ZigBee technology is a wireless communication technology applied to short distance and low speed, and is mainly used for data transmission between various electronic devices with short distance, low power consumption and low transmission speed, and typical applications of periodic data, intermittent data and low reaction time data transmission. Due to the uniqueness of the ZigBee technology, the ZigBee technology is more and more commonly applied in the communication field.
Fig. 1 is a schematic diagram of a ZigBee network system. As shown in fig. 1, the ZigBee network system includes three kinds of nodes, i.e., a Coordinator (Coordinator)110, a routing node (Router)120, and an End node (End Device) 130.
Wherein the coordinator 110 may be integrated in the gateway. The Gateway (Gateway) is also called an internetwork connector and a protocol converter. The gateway realizes network interconnection above a network layer, is a complex network interconnection device and is only used for interconnection of two networks with different high-level protocols. Instead of the bridge simply communicating the information, the gateway repackages the received information to accommodate the needs of the destination system.
The coordinator 110 is a convergence point of information of each node in the ZigBee network system, is a core node of the network, and is responsible for building, maintaining, and managing the ZigBee network. The coordinator is also a main node in the ZigBee network, and only one coordinator in one ZigBee network manages other nodes in the network.
The routing node 120 is responsible for forwarding data packets, performing routing path finding and routing maintenance of data, allowing the node to join the network and assisting the communication of its child nodes; the routing node is a relay of the end node and the coordinator.
The end node 130 may be directly communicatively coupled to the coordinator 110 or may be communicatively coupled to the coordinator 110 via the routing node 120. The terminal node 130 may be a computer, a mobile phone, an intelligent printer, an intelligent fax machine, an intelligent camera, an intelligent air conditioner, an intelligent door lock, a human body sensor equipped with a communication module (e.g., a ZigBee module, a Wi-Fi module, a bluetooth module, etc.), a door and window sensor, a temperature and humidity sensor, a water sensor, a natural gas alarm, a smoke alarm, a wall switch, a wall socket, a wireless switch wireless wall switch, a magic cube controller, a curtain motor, etc., which are not limited herein.
In a specific embodiment, the step of establishing a complete ZigBee network comprises two steps: network initialization and nodes (end node 130, routing node 120) join the network. The method comprises the following steps that initialization of the ZigBee network can only be initiated by a coordinator, in the initialization process, the coordinator firstly scans channels and determines channels for communication of equipment in the ZigBee network; then the coordinator selects a network identifier (PAN ID, the value of which is less than or equal to 0x3FFF) for the ZigBee network; the initialization of the ZigBee network is realized through the two steps. There are two address modes in a ZigBee network: an extended address (64 bits) and a short address (16 bits), so that the network identifier selected by the coordinator is identified by a PAN (Personal Area network) ID if it is identified by a short address, and by an EXPAN (extended PAN) ID if it is identified by an extended address. It will be appreciated that in particular embodiments, both PAN ID and EXPAN ID may be used to identify the same ZigBee network.
If a node wants to join the ZigBee network, the node sends a correlation request command to the coordinator after scanning to obtain the relevant information of the coordinator, and after receiving the correlation request command sent by the node, the coordinator allocates a short address to the node if agreeing to join the ZigBee network, generates an association response command (Association response command) and returns the association response command to the node.
As described above, in the ZigBee network, the network information of the ZigBee network is maintained by the coordinator, wherein the network information may include various parameters as shown in table 1 below:
TABLE 1
Figure BDA0003354933650000061
The channel is used for indicating a channel where the ZigBee network is located, namely the coordinator performs channel scanning in the above, and the channel is a channel identifier of a channel determined by the ZigBee network; panid refers to a 16-bit short address of the ZigBee network; expanid refers to a 64-bit extended address of the ZigBee network; the outfc (outlying frame counter) refers to an output frame count value of the coordinator, and the output frame count value is included in the auxiliary header as a means for preventing replay attack. All devices have their own output frame count values that are used to maintain a list of neighbor and sub-frame counters. Each time a device sends a packet, it increments its output frame count value. The receiving device verifies whether the frame count value of the transmitting device has been incremented from the last value it sees. If it is not increased, the packet will be silently discarded. If the receiving device is not the final destination, the data packet including the frame count value of the routing device is decrypted and modified, then the data packet is re-encrypted and sent to the next hop; mac address refers to the physical address of the coordinator; nwk key (network key) refers to a network key, which is a key used by each device in the network for data encryption; key sequence Number (key sequence Number) and key type are two kinds of attributes of the network key; key seqNum refers to the serial number of the network key; the key type refers to the type of the network key; the child table refers to a list of all child devices in the network, which are the above-mentioned device of the terminal node and the device of the routing node.
In addition, the gateway can also establish network connection with the server side. The server may be one server, a server cluster composed of a plurality of servers, or even a cloud computing center composed of a plurality of servers, which is not limited herein. The server refers to an electronic device that provides a background service for a user, for example, the background service includes a monitoring service of a coordinator.
In the ZigBee network, network information is generally stored in a flash memory (flash) of the coordinator chip, but when the coordinator chip voltage is unstable or abnormally restarted, the network information stored in the flash memory of the coordinator chip may be lost, thereby causing the network information read from the flash memory of the coordinator chip to be erroneous or not read from the flash memory of the coordinator chip after the coordinator chip is restarted. In this case, since the network information read by the coordinator is different from the actual network information in the ZigBee network, the coordinator cannot communicate with the devices in the ZigBee network, and the device data in the ZigBee network cannot be reported to the cloud, so that the devices in the ZigBee network are in an offline state.
All the devices in the ZigBee network have the same network key in the same channel and the same domain network address, in other words, all the devices in the ZigBee network have the same set of network information, and if the network information of a certain device changes, the device cannot perform data interaction with other devices in the original network.
For the offline device, if the offline device is to be restored to the online state, the offline device is added to the new ZigBee network created by the coordinator again by adopting factory restoration settings. However, after the factory setting is restored, the configuration information of the equipment itself is lost, and reconfiguration is required to enable all the equipment to reach the normal working state before abnormality, and the process is large in processing workload, high in labor cost and low in efficiency.
In order to solve the problem, the scheme of the application is provided, by backing up the network information in the coordinator, and when the network information in the coordinator is abnormal, restoring the network information in the coordinator based on the backed-up network information.
The following describes in detail a method, an apparatus, an electronic device, and a computer-readable storage medium for recovering network information in a gateway according to embodiments of the present application.
Fig. 2 is a flowchart illustrating a method for recovering network information in a gateway, which is applied to a master control module according to an embodiment of the present application. The method specifically comprises the following steps:
step 210, obtaining the current network information from the coordinator.
Step 220, obtaining backup network information from the main control module.
The main control module of the gateway is a core component of a mainboard of the gateway, is a bridge between other modules in the gateway and is also a brain for controlling the running work of the gateway. In some embodiments, a proxy process is provided in the master control module of the gateway to recover the network information in the coordinator according to the method of the present application. In other words, the proxy process refers to a process in the master control module of the gateway for recovering the network information in the coordinator. In other embodiments, the agent process may be disposed in other modules, and is not limited herein.
The backup network information refers to network information which is backed up to the main control module by the coordinator in a normal network state. In some embodiments, a master control flash memory is provided in the master control module, and the master control flash memory is used for storing backup network information.
It should be noted that the backup network information in the main control module is the backed-up network information, that is, when the network information in the coordinator is normal, the network information in the coordinator is backed up to the main control module to serve as a data base for recovering the network information. Compared with the storage space of the coordinator, the storage space of the master control module is larger, and generally, the storage space of the flash memory of the coordinator is at a level of K (1024bytes), and the storage space of the master control module is at a level of M (1M ═ 1024K), so that the storage space occupied by the network information backed up in the master control module is very small, and further, the network information backup in the master control module hardly affects the normal operation of the master control.
In some embodiments of the present application, the query condition of the network information is preset, so that, before step 210, the method further includes: and detecting whether the query condition of the network information is met, and if the query condition is met, executing the step of acquiring the current network information from the coordinator. Otherwise, if the query condition is not met, continuously detecting whether the query condition of the network information is met.
The query condition of the network information can be set according to actual needs. For example, the query condition of the network information may be that the main control module delays for a third set time period after being started, so that, after the main control module is started, if the delay time period reaches the third set time period, step 210 and step 220 are executed. The third set time period may be set according to actual needs, for example, 1 minute, 2 minutes, and the like.
In some embodiments, the query condition of the network information may also be that after the master control module is started, the current time of the master control module is within a set query time period, and the set query time period may be set as needed, for example, the query time period is set to a time period from 3 to 4 points in the early morning of each day. In a specific embodiment, a certain time point or certain time points within the set query time period may be further designated as query time points, and when the main control module detects that the current time is the query time point, it is determined that the query condition of the network information is reached. In some embodiments, a randomly selected time point within the query time period may also be set as the query time point.
The nodes in the ZigBee network change along with the time extension, for example, a new node is added into the ZigBee network or the node exits from the ZigBee network, a sub-device list is maintained in the coordinator, the sub-device list indicates devices added into the ZigBee network, the addition of the new node into the ZigBee network corresponds to the new addition of a device identifier in the sub-device list, and the exit of the node from the ZigBee network corresponds to the deletion of the device identifier in the sub-device list.
In some embodiments, the query condition of the network information may also be that the list of the child devices is updated, and the update may be that the device identifier is deleted or that the device identifier is newly added. Therefore, before step 210, the agent process acquires the sub device list from the coordinator, compares the currently acquired sub device list with the sub device list acquired last time, and determines that the query condition of the network information is satisfied if it is determined through the comparison that the currently acquired sub device list is different from the sub device list acquired last time.
In some embodiments, the network information query condition may also be that the output frame count value is updated, and the update may be that the output frame count value becomes larger or smaller. Accordingly, the output frame count value is acquired from the coordinator, the currently acquired output frame count value is compared with the last acquired output frame count value, and if it is determined through the comparison that the currently acquired output frame count value is different from the last acquired output frame count value, it is determined that the query condition of the network information is satisfied.
In some embodiments of the present application, the network information backup condition may also be that it is detected that the sub-device list and the output frame count value are updated at the same time, and if it is detected that the sub-device list and the output frame count value of the network information in the coordinator are updated at the same time, it is determined that the network information backup condition is satisfied.
In some embodiments, since when a new device joins the ZigBee network, the coordinator needs to send an association response command to the device, the association response command indicating that the device is allowed to join the ZigBee network; if one device exits from the ZigBee network, the coordinator is required to send a disconnection command to the device or the device sends a disconnection command to the coordinator, and the disconnection command is used for indicating the coordinator to be separated from the device, namely the device exits from the ZigBee network, so that whether a new device is added in the ZigBee network can be determined by monitoring whether the coordinator sends a correlation response command; whether a device exits in the ZigBee network may be determined by monitoring whether the coordinator transmits a disconnection command or receives a disconnection command. In some embodiments, the query condition of the network information may also be that the coordinator is monitored to send an association response command, the coordinator sends a disconnection command, or the coordinator receives a disconnection command, so that if the coordinator is monitored to meet one of the above three conditions, the query condition of the network information is determined to be reached.
In some embodiments, the query condition of the network information may also be a delay of a second set time period after confirming that the device is newly added to the ZigBee network or deleted (i.e., the device exits the ZigBee network), so that the steps 210 and 220 are performed after the delay of the second set time period after confirming that the device is newly added to the ZigBee network or deleted. Similarly, the second set time period may be set as required, for example, 3 minutes, 5 minutes, etc., and is not particularly limited herein.
Step 230, it is detected whether the network information is the same as the backup network information.
And 240, if the current network state of the characterization coordinator is different, sending backup network information to the coordinator to replace the network information so as to restore the network state of the coordinator to a normal state.
As described above, the network information includes a plurality of parameters, as shown in table 1 above. In some embodiments, parameter types may be set for various parameters, for example, the parameter types include a first parameter type and a second parameter type, where, in the parameters shown in table 1, a parameter whose parameter type is the first parameter type may refer to a parameter that may be updated in real time, but does not cause network information to be abnormal after being updated. For example, the parameter of which the parameter type is the first parameter type may be the key frame count value and the sub device list in table 1. The parameter with the parameter type of the second parameter type may refer to a parameter that may cause network traffic abnormality after being changed, for example, channel (channel identifier), panid, expanid, mac address, nwk key, key seqNum, and the like in table 1.
After the network information is acquired from the coordinator and the backup network information is acquired from the main control module, the parameters are respectively compared, so that parameters (which may be called as difference parameters for convenience of distinguishing) different from parameters in the backup network information in the network information acquired from the coordinator are determined.
Then, the parameter type to which the difference parameter belongs is determined, i.e. whether the difference parameter belongs to the first parameter type or the second parameter type is determined. In some embodiments, in step 240, if it is determined that the difference parameter belongs to the second parameter type, the network information recovery is triggered, that is, "sending the backup network information to the coordinator to replace the network information so as to recover the network state of the coordinator to the normal state" in step 240 is executed; otherwise, if it is determined that the difference parameter belongs to the first parameter type, the network information recovery may not be triggered, that is, the step 240 of sending the backup network information to the coordinator to replace the network information so as to recover the network state of the coordinator to the normal state is not executed, and at this time, only the difference parameter belonging to the first parameter type is backed up to the main control module so as to update the corresponding parameter in the main control module.
And because the backup network information in the main control module is the backed-up network information and is accurate network information, the backup network information in the main control module is written into the coordinator to replace the network information in the coordinator, so that the network information in the coordinator is restored.
In a specific embodiment, the master control module may write the backup network information acquired from the master control module into the coordinator through an interface of the coordinator, so as to replace the abnormal network information in the coordinator.
According to the scheme, the network information is backed up in the main control module, and under the condition that the network information in the coordinator is determined to be different from the backup network information in the main control module and the difference parameter belongs to the second parameter type, the network information in the coordinator is recovered based on the backup network information in the main control module so as to replace abnormal network information in the coordinator, so that the problem that other equipment in the network cannot communicate with the coordinator due to the abnormal network information in the coordinator can be effectively solved, and the abnormal network information can be timely recovered when the network information in the coordinator is abnormal.
In addition, in the scheme, when the master control module detects that the network information in the coordinator is different from the backup network information in the master control flash memory, the backup network information in the master control module is automatically restored to the coordinator, the process is automatically carried out in the gateway device, the situation that the sub-device is offline is avoided, and the non-inductive restoration of the network information is realized. For the user, the device is always normal; an engineer can query the gateway log to know the abnormal recovery condition of the coordinator. Therefore, the scheme can effectively solve the problem of network information abnormity and timely, efficiently and automatically recover and restore the network information.
In the prior art, due to the abnormal network information in the coordinator, other devices in the network are in an offline state. However, after the factory setting is restored, the configuration information of the device itself is lost, and it is necessary to reconfigure all the devices to a normal working state before an abnormality, which results in a large processing workload, high labor cost, and low efficiency. In the scheme, because the abnormal network information in the coordinator is restored in time according to the backup network information in the main control module, the equipment does not need to be restored to factory settings, reconfigured and the like, and only the network information in the coordinator is restored, so that the processing workload is greatly reduced, and the restoration efficiency is improved.
In the prior art, network information in the coordinator generally has an abnormality due to unstable voltage of the coordinator chip or abnormal restart of the coordinator chip, and in the present solution, the network information is not backed up to other places in the coordinator but is backed up to the main control module outside the coordinator, so that the unstable voltage of the coordinator chip or the restart of the coordinator chip does not affect the network information in the main control module, and therefore, it can be ensured that the network information restored to the coordinator is accurate network information, and the coordinator can perform normal communication with other devices after the network information in the coordinator is effectively restored.
Fig. 3 is a flowchart illustrating steps before step 220 according to an embodiment of the present application, and as shown in fig. 3, before step 220, the method further includes:
step 310, detecting whether a backup condition of the network information is satisfied.
In step 320, if the backup condition is satisfied, the network information is backed up.
In some embodiments of the present application, the backup condition of the network information may be a delay of a first set time period after the master control module is started, where the first set time period may be set according to actual needs, for example, set to 30 seconds, 45 seconds, and the like. It is understood that the first set period of time is less than the third set period of time. Of course, the first set time period may be equal to the third set time period.
In some embodiments of the present application, the backup condition of the network information may also be that after the master control module is started, the current time of the master control module is within a set backup time period, and the set backup time period may be set according to needs, for example, the backup time period is set to a time period from 2 to 3 points in the morning every day. In a specific embodiment, one or more backup time points may be further specified within the set backup time period, and when the current time reaches the backup time point, it is determined that the backup condition of the network information is satisfied. In other embodiments, a randomly selected time point within the backup time period may be set as the backup time point.
In some embodiments of the present application, the backup condition of the network information may also be that a sub-device information update in the network information in the coordinator is detected, and if a sub-device list update of the network information in the coordinator is detected (for example, a sub-device list currently acquired from the coordinator), it is determined that the backup condition of the network information is satisfied.
In some embodiments of the present application, the backup condition of the network information may be further that the output frame count value is detected to be updated, and the updating may be that the output frame count value becomes larger or smaller. Accordingly, the output frame count value is acquired from the coordinator, the currently acquired output frame count value is compared with the last acquired output frame count value, and if it is determined through the comparison that the currently acquired output frame count value is different from the last acquired output frame count value, it is determined that the backup condition of the network information is satisfied.
In some embodiments of the present application, the network information backup condition may also be that it is detected that the sub-device information and the output frame count value are updated at the same time, and if it is detected that the sub-device list of the network information and the output frame count value in the coordinator are updated at the same time, it is determined that the network information backup condition is satisfied.
In some embodiments of the present application, the backup condition of the network information may also be that a fourth set time length is delayed after the coordinator sends an association response command, the coordinator sends a disconnection command, or the coordinator receives the disconnection command, and the fourth set time length may be used for the coordinator to update the list of the child devices in the network information. And if the delay time after the coordinator sends the association response command, the coordinator sends the disconnection command or the coordinator receives the disconnection command reaches the fourth set time after monitoring, determining that the backup condition of the network information is met.
Of course, the backup conditions of the network information listed above are only exemplary examples and should not be considered as limiting the scope of application of the present application.
In some embodiments, step 320 further comprises: detecting whether backup network information exists in the main control module; if the backup network information exists, updating the sub-equipment list and the output frame count value in the backup network information according to the sub-equipment list and the output frame count value in the network information; if not, the network information is completely backed up to the main control module.
In this embodiment, if it is detected that the backup network information exists in the main control module, it indicates that at least one network information backup is performed in the main control module, and in the same ZigBee network, information such as a channel (channel), a network identifier (PAN ID, expanid), and a MAC Address (MAC Address) in the network information is kept unchanged, and what may be changed is a sub-device list and an output frame count value in the network information. Therefore, when the backup network information exists in the main control module, only the sub-device list and the output frame count value in the network information in the coordinator can be backed up in the main control module, that is, only the sub-device list and the output frame count value in the backup network information in the main control module are updated, and other parameters are not updated.
On the contrary, if it is detected that the backup network information does not exist in the main control module, it indicates that the network information has not been backed up in the main control module, and therefore, in this case, the first network information is completely backed up in the main control module. In the subsequent process, only part of parameters in the network information can be updated based on the network information which is backed up in the main control module.
In summary, in this embodiment, after the network information backup is performed in the main control module for the first time, all subsequent backups use the network information of the first backup as a reference (it can be understood that the network information of the first backup is network information obtained by the coordinator creating the ZigBee network), only the child device list (child table) and the output frame counter (outgoing frame counter) are updated, and other parameters are not updated. Compared with the method for updating all the network information in the main control module, the method only updates the sub-device list and the output frame count value, greatly reduces the data updating amount, shortens the backup time, and improves the network information backup rate and efficiency.
Fig. 4 is a flowchart illustrating steps after step 240 according to an embodiment of the present application, and as shown in fig. 4, after step 240, the method further includes:
step 410, receiving first network information reported by the coordinator, wherein the first network information refers to current network information reported after the coordinator is reset.
In some embodiments, after the proxy process restores the backup network information in the master control module to the coordinator, the gateway master may pull down a reset (reset) pin in the coordinator to implement hardware reset of the coordinator. By performing a reset operation on the coordinator, the coordinator can read the network information from its own flash memory and report the read network information to the gateway. It is to be understood that, in this step, since the coordinator is reset after the network information in the coordinator is restored, if the network information is successfully restored, the network information read from the flash memory of the coordinator is the network information restored in the coordinator.
Step 420, detecting whether the first network information is the same as the backup network information. If not, go to step 240; if the two are the same, the operation is ended.
In step 420, comparing the parameter value of each parameter in the first network information reported by the coordinator with the parameter value of the corresponding parameter in the backup network information in the main control module one by one, and if the parameter value of each parameter in the first network information reported by the coordinator is the same as the parameter value of the corresponding parameter in the backup network information in the main control module, confirming that the two network information are the same, thereby indicating that the network information in the coordinator is successfully restored; on the contrary, if the parameter value of at least one parameter in the first network information reported by the coordinator is different from the parameter value of the corresponding parameter in the backup network information in the main control module, the two pieces of network information are determined to be different, and then the network information recovery failure in the coordinator is indicated.
And in case that the recovery of the network information in the coordinator is determined to fail, the step 240 is carried out, and the step of recovering the backup network information in the gateway main control module to the coordinator is repeatedly carried out.
Fig. 5 is a timing diagram illustrating a method for recovering network information in a gateway according to an embodiment of the present application. As shown in fig. 5, includes:
step 510, the coordinator reports the current network information.
And step 520, if the agent process detects that the network information reported by the agent process is abnormal, performing network information recovery operation on the coordinator, and controlling the gateway master control to perform hardware reset on the coordinator.
And after receiving the network information reported by the coordinator, the agent process reads the backup network information from the main control module so as to judge whether the network information in the coordinator is abnormal. If the abnormal condition exists, the network information recovery operation is performed on the coordinator, and the process of the network information recovery operation refers to the above description, which is not described herein again.
Step 530, the coordinator reports the network information again after resetting.
And 540, the agent process confirms whether the network information in the coordinator is successfully recovered, and if the network information in the coordinator is not successfully recovered, the agent process performs network information recovery operation on the coordinator again. And if the backup network information is unsuccessful, writing the backup network information in the main control module into the coordinator again.
In some embodiments of the present application, in order to improve efficiency, a threshold of the number of times that the coordinator repeatedly performs the network information recovery operation may be further set, and if the number of times that the coordinator continuously performs the network information recovery operation reaches the threshold of the number of times, the coordinator is stopped from performing the network information recovery operation again (that is, the step 240 is stopped from being performed again), and fault information is reported to the server, where the fault information is used to indicate that the network information in the coordinator is abnormal. Fig. 6 is a flowchart illustrating a method for recovering network information in a gateway according to an embodiment of the present application, in this embodiment, a main control module is provided with a main control flash memory, and the main control flash memory is used for storing backup network information, and as shown in fig. 6, the method includes:
step 610, backing up the network information to the master control flash memory.
Step 620, network information in the coordinator is obtained.
Step 630, judging whether the network information in the coordinator is the same as the backup network information in the master control flash memory; if the number of the restoration times is the same as the number of the restoration times, returning to the step 620, and if the number of the restoration times is not the same as the number of the restoration times, executing the step 640.
And step 640, performing network information recovery operation on the coordinator, and adding 1 to the recovery frequency accumulation. And performing network information recovery operation on the coordinator, namely writing the backup network information in the main control flash memory into the coordinator to replace the abnormal network information in the coordinator.
Step 650, judging whether the recovery times reach a time threshold value; if so, reporting fault information to the server; if not, the process returns to step 620 to perform the network information recovery operation again on the coordinator. The number threshold may be set according to actual needs, for example, the number threshold is 5, and is not particularly limited herein.
In this embodiment, by setting the number threshold, when the number of times of recovery of continuously performing network information recovery reaches the number threshold, the network information recovery operation is stopped again, thereby preventing the dead loop from being entered. And when the recovery times reach a time threshold value, reporting fault information to the cloud end to the server end, so that an engineer can conveniently perform fault troubleshooting according to the log of the coordinator.
Fig. 7 is a block diagram illustrating an apparatus for recovering network information in a gateway according to an exemplary embodiment of the present application, where the apparatus 700 for recovering network information in a gateway illustrated in fig. 7 includes, but is not limited to: a first obtaining module 710, a second obtaining module 720, a first detecting module 730, and a recovering module 740. The first obtaining module 710 is configured to obtain current network information from the coordinator; and a second obtaining module 720, obtaining the backup network information from the main control module. The first detecting module 730 is configured to detect whether the network information is the same as the backup network information. The sending module 740 is configured to send the backup network information to the coordinator to replace the network information, so that the network state of the coordinator is restored to a normal state.
In some exemplary embodiments of the present application, the apparatus for restoring network information in the gateway further includes: the network information backup condition detection module is used for detecting whether the backup condition of the network information is met; and the backup module is used for backing up the network information if the backup condition is met.
In some exemplary embodiments of the present application, the network information includes a list of child devices and an output frame count value; as shown in fig. 8, the backup module 800, includes but is not limited to: a first detection unit 810, a first backup unit 820, and a second backup unit 830. A first detecting unit 810, configured to detect whether backup network information exists in the main control module if a backup condition is met; a first backup unit 820, configured to update a sub-device list and an output frame count value in the backup network information according to the sub-device list and the output frame count value in the network information if the first detection unit 810 detects that the backup network information exists in the main control module; the second backup unit 830 is configured to backup all the network information to the main control module if the first detection unit 810 detects that the backup network information does not exist in the main control module.
In some exemplary embodiments of the present application, the backup condition includes at least one of: after the master control module is started, the delay time length reaches a first set time length; after the main control module is started, the current time of the main control module is within a set backup time period; the network information's subset list and/or output frame count values are updated.
In some exemplary embodiments of the present application, the network information recovery processing apparatus in the gateway further includes: the second detection unit is used for detecting whether the query condition of the network information is met; if the query condition of the network information is satisfied, go to the first obtaining module 710.
In some exemplary embodiments of the present application, the query condition includes at least one of: after the main control module is started, the delay time reaches a third set time; after the main control module is started, the current time of the main control module is within a set query time period; the sub-device list of network information and/or the output frame count value in the coordinator is updated.
In some exemplary embodiments of the present application, the network information recovery processing apparatus in the gateway further includes: the network information receiving module is used for receiving first network information reported by the coordinator, wherein the first network information is current network information reported after the coordinator is reset; the second detection module is used for detecting whether the first network information is the same as the backup network information; if not, the step of sending the backup network information to the coordinator to replace the network information is executed again.
In some exemplary embodiments of the present application, the network information recovery processing apparatus in the gateway further includes: and the network information receiving unit is used for receiving the first network information reported by the coordinator, wherein the first network information is the current network information reported by the coordinator after being reset. And the information reporting unit is used for stopping executing the step of sending the backup network information to the coordinator to replace the network information if the execution times reach the time threshold value, and reporting fault information to the server, wherein the fault information is used for indicating that the current network state of the coordinator is abnormal.
An embodiment of the present application further provides an electronic device, as shown in fig. 9, where the electronic device 900 includes a processor 910 and one or more memories 920, where the one or more memories 920 are used to store program instructions executed by the processor 910, and when the processor 910 executes the program instructions, the method for recovering network information in a gateway is implemented. The electronic device may be a gateway or the like.
Further, processor 910 may include one or more processing cores. The processor 910 executes or executes instructions, programs, code sets, or instruction sets stored in the memory 920 and invokes data stored in the memory 920. Alternatively, the processor 910 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 910 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is to be understood that the modem may be implemented by a communication chip without being integrated into the processor.
In an embodiment of the present application, a computer-readable storage medium has stored thereon computer-readable instructions, which, when executed by a processor, implement the method for recovering network information in a gateway as described above.
The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium includes a non-volatile computer-readable storage medium. The computer readable storage medium has a storage space for program code for performing any of the method steps of the above-described method. The program code can be read from or written to one or more computer program products. The program code may be compressed, for example, in a suitable form.
The above-mentioned embodiments are merely preferred examples of the present invention, and are not intended to limit the embodiments of the present invention, and those skilled in the art can easily make various changes and modifications according to the main concept and spirit of the present invention, so the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (11)

1. A method for recovering network information in a gateway is applied to a master control module, and the method comprises the following steps:
acquiring current network information from a coordinator and acquiring backup network information from the main control module;
detecting whether the network information is the same as the backup network information;
and if the current network state of the coordinator is different and is characterized to be abnormal, sending the backup network information to the coordinator to replace the network information so as to restore the network state of the coordinator to a normal state.
2. The method of claim 1, wherein the step of obtaining the backup network information from the master control module is preceded by the method further comprising:
detecting whether a backup condition of the network information is met;
and if the backup condition is met, backing up the network information.
3. The method of claim 2, wherein the network information comprises a list of sub-devices and an output frame count value;
if the backup condition is met, the step of backing up the network information comprises the following steps:
if the backup condition is met, detecting whether the backup network information exists in the main control module;
if the backup network information exists, updating the sub-equipment list and the output frame count value in the backup network information according to the sub-equipment list and the output frame count value in the network information; if not, all the network information is backed up to the main control module.
4. The method of claim 3, wherein the backup condition comprises at least one of:
after the master control module is started, the delay time reaches a first set time;
after the main control module is started, the current time of the main control module is within a set backup time period;
the list of child devices and/or the output frame count value in the network information is updated.
5. The method of claim 1, wherein the step of obtaining current network information from the coordinator is preceded by the method further comprising:
detecting whether a query condition of the network information is met;
and if the query condition is met, executing the step of acquiring the current network information from the coordinator.
6. The method of claim 5, wherein the network information comprises a list of sub-devices and an output frame count value, and wherein the query condition comprises at least one of:
after the master control module is started, the delay time reaches a third set time;
after the main control module is started, the current time of the main control module is within a set query time period;
the list of child devices and/or the output frame count value in the network information is updated.
7. The method of any of claims 1-6, wherein after the step of sending the backup network information to the coordinator to replace the network information, the method further comprises:
receiving first network information reported by the coordinator, wherein the first network information refers to current network information reported after the coordinator is reset;
detecting whether the first network information is the same as the backup network information;
and if not, executing the step of sending the backup network information to the coordinator again to replace the network information.
8. The method of claim 7, further comprising:
accumulating the execution times of the step of sending the backup network information to the coordinator to replace the network information;
and if the execution times reach a time threshold value, stopping executing the step of sending the backup network information to the coordinator to replace the network information, and reporting fault information to a server, wherein the fault information is used for indicating that the current network state of the coordinator is abnormal.
9. An apparatus for recovering network information in a gateway, comprising:
the first acquisition module is used for acquiring the current network information from the coordinator;
the second acquisition module is used for acquiring backup network information from the main control module;
the first detection module is used for detecting whether the network information is the same as the backup network information;
and the sending module is used for sending the backup network information to the coordinator to replace the network information so as to restore the network state of the coordinator to a normal state.
10. An electronic device, comprising:
a processor;
a memory having computer-readable instructions stored thereon which, when executed by the processor, implement the method of any one of claims 1-8.
11. A computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1-8.
CN202111348034.6A 2021-11-15 Method and device for recovering network information in gateway, electronic equipment and storage medium Active CN114221854B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111348034.6A CN114221854B (en) 2021-11-15 Method and device for recovering network information in gateway, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111348034.6A CN114221854B (en) 2021-11-15 Method and device for recovering network information in gateway, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114221854A true CN114221854A (en) 2022-03-22
CN114221854B CN114221854B (en) 2024-07-05

Family

ID=

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8064438B1 (en) * 2004-11-22 2011-11-22 At&T Intellectual Property Ii, L.P. Method and apparatus for determining the configuration of voice over internet protocol equipment in remote locations
US20120079074A1 (en) * 2009-06-09 2012-03-29 Koninklijke Philips Electronics N.V. Network communication system
JP2013206298A (en) * 2012-03-29 2013-10-07 Sharp Corp Control device having startup function and restoration function of network, system having control device, method for restoring network and program for making computer execute method
CN107360034A (en) * 2017-07-25 2017-11-17 美的智慧家居科技有限公司 Gateway restoration methods, device and its equipment
US20190089447A1 (en) * 2017-06-23 2019-03-21 Futurewei Technologies, Inc. System and method for radio link failure
CN111767173A (en) * 2020-06-30 2020-10-13 平安科技(深圳)有限公司 Network equipment data processing method and device, computer equipment and storage medium
CN112732482A (en) * 2020-12-30 2021-04-30 北京浪潮数据技术有限公司 Cifs service backup switching method, device, equipment and readable storage medium
CN113014459A (en) * 2019-12-20 2021-06-22 西门子(中国)有限公司 Gateway recovery method and device of intelligent home system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8064438B1 (en) * 2004-11-22 2011-11-22 At&T Intellectual Property Ii, L.P. Method and apparatus for determining the configuration of voice over internet protocol equipment in remote locations
US20120079074A1 (en) * 2009-06-09 2012-03-29 Koninklijke Philips Electronics N.V. Network communication system
CN102460531A (en) * 2009-06-09 2012-05-16 皇家飞利浦电子股份有限公司 Network communication system
JP2013206298A (en) * 2012-03-29 2013-10-07 Sharp Corp Control device having startup function and restoration function of network, system having control device, method for restoring network and program for making computer execute method
US20190089447A1 (en) * 2017-06-23 2019-03-21 Futurewei Technologies, Inc. System and method for radio link failure
CN107360034A (en) * 2017-07-25 2017-11-17 美的智慧家居科技有限公司 Gateway restoration methods, device and its equipment
CN113014459A (en) * 2019-12-20 2021-06-22 西门子(中国)有限公司 Gateway recovery method and device of intelligent home system
CN111767173A (en) * 2020-06-30 2020-10-13 平安科技(深圳)有限公司 Network equipment data processing method and device, computer equipment and storage medium
CN112732482A (en) * 2020-12-30 2021-04-30 北京浪潮数据技术有限公司 Cifs service backup switching method, device, equipment and readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
NAZRUL ISLAM;MD.JAMINUL HAQUE BIDDUT: "An analytical study to minimize load of Zigbee network based on statistical modeling", 2015 IEEE INTERNATIONAL WIE CONFERENCE ON ELECTRICAL AND COMPUTER ENGINEERING, 21 March 2016 (2016-03-21) *
胡昕: "基于ZIGBEE技术的嵌入式智能家居系统的研究", 中国优秀硕士学位论文数据库, 16 September 2017 (2017-09-16) *

Similar Documents

Publication Publication Date Title
CN102904818B (en) A kind of ARP information entry updating method and device
US11765018B2 (en) Control plane device switching method and apparatus, and forwarding-control separation system
EP2245472B1 (en) System and method for network recovery from multiple link failures
US10708132B2 (en) Technique for handling a status change in an interconnect node
CN110891018B (en) Network traffic recovery method and device, SDN controller and storage medium
CN114866365B (en) Arbitration machine election method, device, intelligent equipment and computer readable storage medium
CN111371592B (en) Node switching method, device, equipment and storage medium
US20110267961A1 (en) Connectivity fault management for ethernet tree (e-tree) type services
CN101340377B (en) Method, apparatus and system for data transmission in double layer network
CN106411574B (en) Management control method and device
CN111767167A (en) Method, system, server and storage medium for migrating gateway data
CN104160667A (en) Method, Device, and System for Dual-Uplink Tangent Ring Convergence
KR101075462B1 (en) Method to elect master nodes from nodes of a subnet
CN107360012B (en) Link state processing method and network node equipment
CN111083049A (en) User table item recovery method and device, electronic equipment and storage medium
CN111130886A (en) Network port switching method and device, board card and network port switching system
CN112231154A (en) Dual-computer hot standby switching method and device
CN114221854B (en) Method and device for recovering network information in gateway, electronic equipment and storage medium
CN114221854A (en) Method and device for recovering network information in gateway, electronic equipment and storage medium
CN108616423B (en) Offline device monitoring method and device
JP5304200B2 (en) Network management system, network management method, manager and agent
KR101625399B1 (en) Method and apparatus for controlling tcp connection in software defined network
CN114143904A (en) CPE management method based on 5G fusion network shunt
CN109818870B (en) Multicast routing method, device, service board and machine readable storage medium
CN112787846A (en) Equipment discovery method and device and computer equipment

Legal Events

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