Network provisioning method and apparatus
By using the device discovery message during the network start process, indicating that the network device exits the backoff status and updating the backoff duration, the problem of long-term waiting in the start process caused by the backoff status caused by the network device being in the backoff status is solved, and the start success rate and user experience are improved.
Patent Information
- Application Number
- PCT/CN2024/128897
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-12
- Filing Date
- 2024-10-31
- Publication Date
- 2025-06-19
AI Technical Summary
During the start of the network, if the network device is in a backoff state, it will cause the start process to wait for a long time or even fail to time out.
The device discovery message sent through the terminal indicates that the network device exits the backoff status and updates the backoff duration in the non-backoff status to reduce the duration of the next backoff status.
It effectively avoids long waits during the start process, improves the start success rate, and reduces the user's waiting time.
Smart Images

Figure CN2024128897_19062025_PF_FP_ABST
Abstract
Description
Network deployment method and device
[0001] This application claims priority to Chinese patent application No. 202311705621.5, filed on December 12, 2023, entitled “Network Deployment Method and Apparatus,” the entire contents of which are incorporated herein by reference. Technical Field
[0002] The present application relates to the field of network technology, and in particular to a network deployment method and device. Background Art
[0003] Network deployment refers to the process of accessing the network through terminals such as mobile phones after network construction is complete, configuring the network, and ensuring normal network functions.
[0004] A related technology involves a cloud-based deployment method. This method involves: a terminal sending a device discovery message to each network device; each network device feeding back device information to the terminal; and each network device sending registration information to the cloud to complete network deployment. If device registration fails, the device enters a backoff state and will not attempt to register again for the backoff duration (e.g., 30 minutes).
[0005] If a network device is in the backoff state during deployment, the device will not be able to register after receiving the device discovery message. This will cause deployment to wait for a long time and may even lead to deployment failure due to timeout.
[0006] Summary of the Invention
[0007] The present application provides a network deployment method and apparatus, which can avoid long waiting times during the deployment process.
[0008] In a first aspect, the present application provides a network deployment method. The method can be performed by a network device. The method includes: the network device receiving a device discovery message sent by a terminal, the device discovery message being used to instruct the network device to exit a backoff state; when the network device is in the backoff state, the network device exits the backoff state based on the instruction in the device discovery message; the network device sending device information of the network device to the terminal; and the network device sending registration information to the cloud.
[0009] The backoff state refers to a state in which the network device does not attempt to register again within the backoff duration (eg, 30 minutes) after registration fails.
[0010] In this implementation, the device discovery message sent by the terminal to the network device is used for device discovery on the one hand, so that the network device can send device information to the terminal after receiving the device discovery message; on the other hand, the device discovery message is also used to instruct the terminal to exit the backoff state. In this way, during the startup process, even if a network device is in the backoff state, it will exit the backoff state due to the instruction of the device discovery message, which solves the problem of startup timeout caused by the device being in the backoff state during startup in the related technology.
[0011] In one example, the device discovery message is a constrained application protocol (CoAP) message. CoAP messages are lightweight protocol messages that can save transmission resources, reduce power consumption, and optimize interaction time.
[0012] In other examples, the device discovery message may also be other protocol messages, such as a user datagram protocol (UDP) private protocol message.
[0013] When a CoAP message is used as a device discovery message, the CoAP message includes a device type, which is a terminal type. The CoAP message whose device type is a terminal type is used to instruct the network device to exit the backoff state.
[0014] In this implementation, the device type field in the CoAP message is set to the type of the terminal to indicate the network device, so that the network device can exit the backoff state.
[0015] Exemplarily, a CoAP message may include a header, an identifier (token), an option field, and a payload. The device type may be carried in the payload.
[0016] In the implementation of the present application, the device information includes device address information, device serial number information and device model information.
[0017] By feeding back device information to the terminal, on the one hand, the terminal can subsequently perform initial configuration operations on the network device based on the obtained device information, and on the other hand, the terminal can send the device information to the cloud, so that the cloud can authenticate the network device based on the device information.
[0018] In the implementation of this application, the registration information includes the device address information, device serial number information, and device model information. Since the terminal has already sent the device information fed back by the network device to the terminal, the network device can complete the authentication registration by sending the same or corresponding registration information as the device information to the cloud.
[0019] In one example, the device address information may be the media access control address (MAC) of the network device. The device serial number information may be the electronic serial number (ESN). The device model information may include the device manufacturer, device type, and device model.
[0020] Optionally, the device discovery message provided in the embodiment of the present application can not only instruct the network device to exit the backoff state when in the backoff state, but can also instruct the network device to shorten the backoff duration when in the non-backoff state. Accordingly, the method can also include:
[0021] When the state of the network device is the non-backoff state, the network device updates the backoff duration in the backoff state so that the backoff duration is reduced when the network device enters the backoff state next time.
[0022] Although the device discovery message instructs the network device to exit the backoff state, it may fail to register again after exiting, causing it to enter the backoff state again. Since no device discovery messages will be received from the terminal between re-entering the backoff state and the start timeout failure, the device discovery message cannot be used to exit the backoff state. Therefore, the backoff duration is updated through the device discovery message to ensure that even if the backoff state is entered again, the backoff duration is not too long, thus avoiding the start timeout caused by re-entering the backoff state.
[0023] For example, when updating the backoff duration, the backoff duration may be updated to 0, thereby avoiding start timeout to the greatest extent possible.
[0024] Optionally, the method may further include: the network device broadcasts a master device query message; if no response from the master device is received within a timeout, the network device sets itself as the master device, where the master device is the management device of the network where the network device is located; and the network device sends the master device information to the terminal.
[0025] The master device is the management device in the deployed network. Terminals can control and configure devices on the network through this master device. Other devices besides the master device are slave devices or backup devices, also known as managed devices.
[0026] In related technologies, the master device in a network setup is designated. If the designated master device fails, management and configuration of the entire network's devices will no longer be possible, requiring manual re-designation. In the implementation of this application, the master device is determined by election. This way, even if the master device fails, a new master device can be elected without manual designation, improving the user experience.
[0027] In one example, the master device query message is a CoAP message and includes device priority information, which is used for master device election.
[0028] In this implementation, using CoAP messages as master device query messages can save transmission resources, reduce power consumption, and optimize interaction time.
[0029] In other examples, the master device query message may also be other protocol messages, such as message queuing telemetry transport (MQTT) and / or hypertext transfer protocol (HTTP) messages.
[0030] Optionally, the method may further include: when a response from the master device is received, the network device periodically receives a heartbeat message sent by the master device; when no heartbeat message sent by the master device is received within a timeout, the network device elects a new master device based on the priority of each device in the network.
[0031] In this implementation, the master device and other devices maintain communication through heartbeat messages. When the heartbeat message times out, it indicates that the master device may be faulty. In this case, a new master device is elected without manual designation, which improves the user experience.
[0032] In a second aspect, the present application provides a network deployment method. The method can be executed by a terminal. The method includes: the terminal broadcasting a device discovery message, the device discovery message being used to instruct a network device to exit a backoff state; and the terminal receiving device information of the network device sent by the network device.
[0033] Optionally, the device discovery message is a restricted application protocol CoAP message, and the CoAP message includes a device type, which is a type of the terminal;
[0034] A CoAP message whose device type is terminal is used to instruct a network device to exit the backoff state.
[0035] Optionally, the device discovery message is further used to instruct the network device to update the backoff duration in the backoff state when the network device is in the non-backoff state, so that the backoff duration is reduced when the network device enters the backoff state next time.
[0036] In a third aspect, the present application provides a network deployment device. The device includes:
[0037] a receiving unit, configured to receive a device discovery message sent by a terminal, wherein the device discovery message is used to instruct a network device to exit a backoff state;
[0038] a control unit, configured to control the network device to exit the backoff state based on the device discovery message when the network device is in the backoff state;
[0039] The sending unit is used to send device information of the network device to the terminal and send registration information to the cloud.
[0040] Optionally, the device discovery message is a restricted application protocol CoAP message, and the CoAP message includes a device type, which is a type of the terminal;
[0041] A CoAP message whose device type is terminal is used to instruct a network device to exit the backoff state.
[0042] Optionally, the control unit is further configured to, when the state of the network device is a non-backoff state, update the backoff duration in the backoff state, so that the backoff duration is reduced when the network device enters the backoff state next time.
[0043] Optionally, the sending unit is further configured to broadcast a master device query message;
[0044] The control unit is further configured to set itself as a master device if no response is received from the master device within a timeout period. The master device is a management device of the network where the network device is located.
[0045] The sending unit is further used to send the information of the main device to the terminal.
[0046] Optionally, the master device query message is a CoAP message, and the master device query message includes device priority information, and the device priority information is used for master device election.
[0047] Optionally, the receiving unit is further configured to periodically receive a heartbeat message sent by the master device when a response from the master device is received;
[0048] The control unit is also used to elect a new master device according to the priority of each device in the network when the heartbeat message sent by the master device is not received within a timeout period.
[0049] In a fourth aspect, the present application provides a network deployment device. The device includes:
[0050] A sending unit, configured to broadcast a device discovery message, wherein the device discovery message is used to instruct a network device to exit a backoff state;
[0051] The receiving unit is configured to receive device information of the network device sent by the network device.
[0052] Optionally, the device discovery message is a restricted application protocol CoAP message, and the CoAP message includes a device type, which is a type of the terminal;
[0053] A CoAP message whose device type is terminal is used to instruct a network device to exit the backoff state.
[0054] Optionally, the device discovery message is further used to instruct the network device to update the backoff duration in the backoff state when the network device is in the non-backoff state, so that the backoff duration is reduced when the network device enters the backoff state next time.
[0055] In a fifth aspect, an electronic device is provided, which is the aforementioned network device or terminal.
[0056] The electronic device includes a processor and a memory. The memory is used to store software programs and modules. The processor implements the method of the first aspect or any possible implementation of the first aspect, or implements the method of the second aspect or any possible implementation of the second aspect, by running or executing the software programs and / or modules stored in the memory.
[0057] Optionally, there are one or more processors and one or more memories.
[0058] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
[0059] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated on the same chip as the processor or be set on different chips. This application does not limit the type of memory and the setting method of the memory and the processor.
[0060] In a sixth aspect, a computer program product is provided. The computer program product includes computer program code, which, when executed by a computer, causes the computer to perform the method of the first aspect or any possible implementation of the first aspect, or the method of the second aspect or any possible implementation of the second aspect.
[0061] In the seventh aspect, the present application provides a computer-readable storage medium, which is used to store program codes executed by a processor, wherein the program codes include methods for implementing any possible implementation of the above-mentioned first aspect, or implementing the above-mentioned second aspect or any possible implementation of the second aspect.
[0062] In the eighth aspect, a chip is provided, comprising a processor, the processor being used to call and execute instructions stored in a memory from the memory, so that an electronic device equipped with the chip executes a method in any possible implementation of the above-mentioned first aspect, or executes a method in any possible implementation of the above-mentioned second aspect or the second aspect.
[0063] In a ninth aspect, another chip is provided. The another chip includes an input interface, an output interface, a processor, and a memory. The input interface, the output interface, the processor, and the memory are connected via an internal connection path. The processor is configured to execute code in the memory. When the code is executed, the processor is configured to execute the method in any possible implementation of the first aspect, or the method in the second aspect or any possible implementation of the second aspect.
[0064] In a tenth aspect, a communication system is provided, which includes the network device and terminal as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] FIG1 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0066] FIG2 is a flow chart of a network deployment method provided in an embodiment of the present application;
[0067] FIG3 is a flow chart of a network deployment method provided in an embodiment of the present application;
[0068] FIG4 is a flow chart of a network deployment method provided in an embodiment of the present application;
[0069] FIG5 is a flow chart of a network deployment method provided in an embodiment of the present application;
[0070] FIG6 is a schematic diagram of a network architecture provided in an embodiment of the present application;
[0071] FIG7 is a flow chart of a network deployment provided by an embodiment of the present application;
[0072] FIG8 is a schematic diagram of a network architecture provided in an embodiment of the present application;
[0073] FIG9 is a flowchart of a network deployment provided by an embodiment of the present application;
[0074] FIG10 is a block diagram of a network deployment device provided in an embodiment of the present application;
[0075] FIG11 is a block diagram of a network deployment device provided in an embodiment of the present application;
[0076] FIG12 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0078] The network deployment method provided in this application can be applied to small office & home office (SOHO) scenarios. SOHO scenarios include small and medium-sized enterprise offices, stores and supermarkets, warehouses / factories, home decoration villas, commercial real estate, etc.
[0079] FIG1 is a schematic diagram of a system architecture provided by an embodiment of the present application. Referring to FIG1 , the system architecture includes a terminal 10 , a network device 11 , and a cloud 12 .
[0080] The terminal 10 can be a mobile phone, tablet, wearable device, or other smart terminal. The system architecture includes multiple network devices 11, which form a network in a SOHO scenario. The multiple network devices 11 may include access points (APs), local area network switches (LSWs), and access routers (ARs). The cloud 12 includes a registration center device and a cloud server (e.g., a vendor cloud or a carrier cloud).
[0081] The terminal 10 can access the network composed of network devices 11 via wireless or wired means. After access, the network can be configured or controlled in the terminal 10 application (APP). AR can connect to the cloud 12 via the Internet. The terminal 10 can also access the cloud 12 via the Internet. After each network device 11 is registered with the cloud 12, the network can be remotely configured or controlled through the cloud 12 in the terminal 10 application.
[0082] When performing the start-up operation, the terminal 10 sends a device discovery message to each network device 11; each network device 11 feeds back device information to the terminal 10; the terminal 10 sends the received device information to the cloud 12; each network device 11 sends registration information to the cloud 12 for registration; the cloud 12 authenticates the network device 11 based on the device information sent by the terminal 10; after the authentication is passed, the terminal 10 can control the network through the cloud 12 to complete the network start-up. Among them, the terminal 10 can send the device information to the registration center, and the registration center synchronizes it to the cloud server. When the network device 11 registers, it first sends the registration information to the registration center. After the registration center authenticates the registration information, it feeds back the address of the cloud server to the network device 11. The network device 11 implements the cloud process based on the address of the cloud server.
[0083] Registration failures can occur due to network issues such as anomalies on the Internet (e.g., anomalies on the AR egress side) or Domain Name System (DNS) errors. If network device 11 fails to register, it enters a backoff state and will not attempt registrations again for the backoff duration (e.g., 30 minutes). After entering the backoff state, it will need to wait 30 minutes before re-registration can begin. However, this 30-minute delay will cause the start timeout to fail.
[0084] Figure 2 is a flow chart of a network deployment method provided in an embodiment of the present application. The method can be executed by the network device shown in Figure 1. As shown in Figure 2, the method includes the following steps.
[0085] S101: A network device receives a device discovery message sent by a terminal. The device discovery message is used to instruct the network device to exit a backoff state.
[0086] The backoff state refers to a state in which the network device does not attempt to register again within the backoff duration (eg, 30 minutes) after registration fails.
[0087] S102: When the state of the network device is the backoff state, the network device exits the backoff state based on the device discovery message.
[0088] S103: The network device sends device information of the network device to the terminal.
[0089] After receiving the device information of the network device, the terminal sends the received device information to the cloud.
[0090] S104: The network device sends registration information to the cloud.
[0091] In an embodiment of the present application, the device discovery message sent by the terminal to the network device is used for device discovery on the one hand, so that the network device can send device information to the terminal after receiving the device discovery message; on the other hand, the device discovery message is also used to instruct the terminal to exit the backoff state. In this way, during the startup process, even if a network device is in the backoff state, it will exit the backoff state due to the instruction of the device discovery message, which solves the problem of startup timeout caused by the device being in the backoff state during startup in the related technology.
[0092] FIG3 is a flow chart of a network deployment method provided in an embodiment of the present application. The method can be executed by the terminal shown in FIG1. As shown in FIG3, the method includes the following steps.
[0093] S201: The terminal broadcasts a device discovery message, which is used to instruct the network device to exit the backoff state.
[0094] S202: The terminal receives device information of the network device sent by the network device.
[0095] After receiving the device information of the network device, the terminal sends the received device information to the cloud.
[0096] In an embodiment of the present application, the device discovery message sent by the terminal to the network device is used for device discovery on the one hand, so that the network device can send device information to the terminal after receiving the device discovery message; on the other hand, the device discovery message is also used to instruct the terminal to exit the backoff state. In this way, during the startup process, even if a network device is in the backoff state, it will exit the backoff state due to the instruction of the device discovery message, which solves the problem of startup timeout caused by the device being in the backoff state during startup in the related technology.
[0097] Figure 4 is a flow chart of a network deployment method provided in an embodiment of the present application. The method can be executed by the network device and terminal shown in Figure 1. As shown in Figure 4, the method includes the following steps.
[0098] S301: The terminal broadcasts a device discovery message. The network device receives the device discovery message sent by the terminal.
[0099] In addition to instructing a network device to exit the backoff state when in the backoff state, the device discovery message provided in the embodiment of the present application can also instruct the network device to shorten the backoff duration in the backoff state when in the non-backoff state.
[0100] In one example, the device discovery message is a restricted application protocol CoAP message. CoAP messages are lightweight protocol messages that can save transmission resources, reduce power consumption, and optimize interaction time.
[0101] In other examples, the device discovery message may also be other protocol messages, such as a UDP private protocol message.
[0102] When a CoAP message is used as a device discovery message, the CoAP message includes a device type, which is a terminal type. The CoAP message whose device type is a terminal type is used to instruct the network device to exit the backoff state.
[0103] In this implementation, the device type field in the CoAP message is set to the type of the terminal to indicate the network device, so that the network device can exit the backoff state.
[0104] Exemplarily, a CoAP message may include a header, an identifier (token), an option field, and a payload. The device type may be carried in the payload.
[0105] In a CoAP message, the header length may be 4 bytes; the identifier length may be variable, ranging from 0 to 8 bytes; the option field may include multiple type length values (TLVs); and the payload may be an optional field.
[0106] Illustratively, in response to the deployment operation, the terminal generates and broadcasts a SOHO device discovery message (soho_device_discover) through the APP used for deployment. The device type carried in the message is a mobile phone (indicating a type of terminal), represented by deviceType(0x50).
[0107] In the above soho_device_discover message, the option field may include multiple options, and the multiple options may be used to carry the terminal address, message type (device discovery type) and encoding format, etc.
[0108] In the above soho_device_discover message, the payload may include multiple custom fields, which are used to carry the terminal address, device type, device priority, etc.
[0109] Different device types can be represented by different values. For example, the device type corresponding to the terminal is a mobile phone, and the value is 50. Other devices such as switches and APs use other values to represent the type.
[0110] In an embodiment of the present application, when a network device (such as an AP or LSW) receives a device discovery message, it will copy the device discovery message and send it to the message processing module, which will send the message to the CoAP protocol processing part; at the same time, the network device broadcasts the message to other devices in the network.
[0111] The CoAP protocol processing portion of the message processing module in the network device processes the message and determines the message type based on the device type field and message type field carried in the message. If the device type field and message type field determine that the message is a device discovery message sent by the terminal, S302 is executed; otherwise, S302 is not executed.
[0112] S302: When the network device is in the backoff state, the network device exits the backoff state based on the device discovery message. When the network device is in the non-backoff state, the network device updates the backoff duration in the backoff state so that the backoff duration is reduced the next time the network device enters the backoff state.
[0113] Although the device discovery message instructs the network device to exit the backoff state, it may fail to register again after exiting, causing it to enter the backoff state again. Since no device discovery messages will be received from the terminal between re-entering the backoff state and the start timeout failure, the device discovery message cannot be used to exit the backoff state. Therefore, the backoff duration is updated through the device discovery message to ensure that even if the backoff state is entered again, the backoff duration is not too long, thus avoiding the start timeout caused by re-entering the backoff state.
[0114] For example, when updating the backoff duration, the backoff duration may be updated to 0, thereby avoiding start timeout to the greatest extent possible.
[0115] After the backoff duration is updated, if a subsequent network device enters the backoff state again, the duration is calculated according to the updated backoff duration.
[0116] Optionally, the network device may also restore the backoff duration when a trigger condition is met, where the trigger condition may be a successful registration or the number of registration messages sent within a period exceeds a threshold.
[0117] S303: The network device sends the device information of the network device to the terminal. The terminal receives the device information of the network device sent by the network device.
[0118] After receiving the device information of the network device, the terminal sends the received device information to the cloud.
[0119] In the implementation of the present application, the device information includes device address information, device serial number information and device model information.
[0120] In one example, the device address information may be the MAC address of the network device. The device serial number information may be the ESN. The device model information may include the device manufacturer, device type, and device model.
[0121] By feeding back device information to the terminal, on the one hand, the terminal can subsequently perform initial configuration operations on the network device based on the obtained device information, and on the other hand, the terminal can send the device information to the cloud, so that the cloud can authenticate the network device based on the device information.
[0122] The device information may be carried in a CoAP message and sent.
[0123] S304: The network device sends registration information to the cloud.
[0124] After the network device exits the backoff state, it re-triggers the registration center's cloud migration process.
[0125] When a network device registers, it first sends the registration information to the registration center. The registration center authenticates the registration information and then feeds back the address of the cloud server to the network device. The network device then implements the cloud access process based on the address of the cloud server.
[0126] In the implementation of this application, the registration information includes the device address information, device serial number information, and device model information. Since the terminal has already sent the device information fed back by the network device to the terminal, the network device can complete the authentication registration by sending the same or corresponding registration information as the device information to the cloud.
[0127] The present application provides a cloud management backoff solution based on CoAP messages. This solution targets mobile app deployment in SOHO scenarios. By integrating device discovery functionality into the mobile app, after the mobile app connects to the network, it broadcasts a CoAP discovery message to the network. Upon receiving the CoAP discovery message, the network device identifies the CoAP message type and then exits the backoff state or updates the backoff duration, optimizing the mobile app deployment time and improving deployment usability.
[0128] During initial deployment or network configuration in a SOHO scenario, to reduce the complexity of network device management, a single device in the network must manage the entire network. This management device is also called the master device. The master device must be capable of discovering, configuring, and maintaining the entire network, while the managed devices are referred to as backup or slave devices. In related technologies, the master device is statically designated, but an abnormality in the master device can lead to a loss of network management capabilities. To address this issue, this application provides a master selection solution based on CoAP.
[0129] Figure 5 is a flow chart of a network deployment method provided by an embodiment of the present application. The method can be executed by the network device and terminal shown in Figure 1. As shown in Figure 5, the method includes the following steps.
[0130] S401: The network device broadcasts a master device query message.
[0131] In one example, the master device query message is a CoAP message and includes device priority information, which is used for master device election.
[0132] In this implementation, using CoAP messages as master device query messages can save transmission resources, reduce power consumption, and optimize interaction time.
[0133] In other examples, the master device query message may also be other protocol messages, such as MQTT and / or HTTP messages.
[0134] For example, a master device query message of the CoAP message type includes fields such as message type (iotbus_query_master), device model (deviceModel), device ESN (deviceSn), MAC address (deviceMac), Internet Protocol (IP) address (deviceIp), and device priority information (devicePriority). The format of the master device query message can be seen in Table 1 below.
[0135] The priority field indicates the priority of the device in ascending order based on its network position (AP, LSW, and AR). The higher the priority, the greater the chance of being elected as the master device.
[0136] Table 1
[0137] S402: When no response is received from the master device within a timeout period, the network device sets itself as the master device, which is the management device of the network where the network device is located.
[0138] After the master device starts up and joins the network, it sends a master query message to check whether there is a master device on the network. If a master device exists, it will receive a response from the master device, indicating that the network has a master device. In this case, no election will be held, and the network device can set the election status to "elected." If no master device exists, it will time out without receiving a response from the master device. In this case, an election will be held, and the election status will be set to "electing" during the waiting period. The device will then set itself as the master device, changing the election status to "elected."
[0139] Figure 6 is a schematic diagram of a network architecture provided by an embodiment of the present application. As shown in Figure 6, the network architecture includes a gateway 380, a core switch 310, an access switch 210, and an access point (AP). S380 assumes that vlanif1 has an address by default and configures a Dynamic Host Configuration Protocol (DHCP) server. 310, 210, and the AP act as DHCP clients to obtain an address.
[0140] The 380 and 310 can function as master devices, while the 210 and AP cannot. The device priority order from highest to lowest is 380, 310, 280, and AP.
[0141] Figure 7 is a flow chart of a network deployment provided by an embodiment of the present application. Figure 7 illustrates the master election process under the network architecture of Figure 6. The process shown in Figure 7 generally precedes the method shown in any of Figures 2 to 4. As shown in Figure 7, the master election process includes:
[0142] S11, 380 starts, and the election status is idle.
[0143] S12 and 380 broadcast a master device query message, and the election state switches to electing.
[0144] 380 resends the master device query message every 2 seconds and retries twice; if there is no reply within 5 seconds, execute S13.
[0145] S13 and 380 will select themselves as the master device and the election state will switch to elected.
[0146] After S14 and 310 are started, they obtain addresses through DHCP and the election status is idle.
[0147] S15 and 310 broadcast the master device query message, and the election state switches to electing.
[0148] S16, 380 sends the information of the master device to 310; 310 receives the information of the master device.
[0149] The information of the master device may be carried in a CoAP message and sent.
[0150] S17, 310 stores the information of the master device, ends the election, and switches the election state to elected.
[0151] As shown in FIG7 , the other 310 processes are similar. 210 and AP do not have master capabilities. The master device broadcasts a device discovery message to query the device information of these devices, as shown in S18 and S19 in FIG7 .
[0152] Here, the device that sends the device discovery message is 380, not the terminal. Therefore, the device discovery message is only used for device discovery, and is not used to exit the backoff state.
[0153] S403: The network device sends the information of the master device to the terminal.
[0154] The network device sends the master device information to the terminal, so that the terminal can associate the APP's management device with the master device and subsequently perform network management and configuration through the master device. The master device information may include the master device's device information and information indicating that the device is the master device.
[0155] S404: When receiving a response from the master device, the network device periodically receives a heartbeat message sent by the master device.
[0156] The master device periodically sends heartbeat messages. After receiving the heartbeat messages, the backup device sends a heartbeat response to maintain the heartbeat connection between the master and backup devices.
[0157] The master device may send the heartbeat message at a period of 3-5 seconds, for example, 3 seconds, and the backup device may send back a heartbeat response within 1 second after receiving the heartbeat message.
[0158] S405: When the heartbeat message sent by the master device is not received within a timeout period, the network device elects a new master device according to the priority of each device in the network.
[0159] If the master device fails and the backup device does not receive a heartbeat message within three cycles, a network re-election is triggered. This allows the terminal app to automatically connect to the new master device for network management within 10 seconds, reducing the user-perceived device management interruption time.
[0160] This application does not impose any restrictions on the election method during re-election. For example, it can be determined through negotiation based on the priority of each network device.
[0161] Figure 8 is a schematic diagram of a network architecture provided by an embodiment of the present application. As shown in Figure 8, the network architecture includes a gateway AR, a core switch 310, an access switch 210, and an access point (AP). The AR is configured as a DHCP server, and 310, 210, and the AP act as DHCP clients to obtain addresses.
[0162] The 310 can function as the master device, while the AR, 210, and AP cannot. The device priority order from highest to lowest is AR, 310, 280, and AP.
[0163] Figure 9 is a flow chart of a network deployment provided by an embodiment of the present application. Figure 9 illustrates the master selection process under the network architecture of Figure 8. The process shown in Figure 9 can be performed before or after the methods shown in any of Figures 2 to 4, or simultaneously. As shown in Figure 9, the master selection process includes:
[0164] S21: The master device 310 is abnormal and the heartbeat detection times out. The backup device 310 re-enters the election process and the election status is idle.
[0165] S22: The standby device 310 broadcasts a master device query message, and the election state switches to electing.
[0166] The backup device 310 resends the query message to the master device every 2 seconds and retries twice; if there is no reply within 5 seconds, S23 is executed.
[0167] S23: The standby device 310 selects itself as the master device, and the election state switches to elected.
[0168] In one example, if there are multiple backup devices 310, when one backup device 310 first sets itself as the master device and receives a master query message from another backup device 310, the master device information (the information of the 310 that set itself as the master device) can be sent to the backup device 310. The backup device 310 that receives the master device information stores the master device information and sets itself as the backup device, ending the election process. During the above-mentioned re-election process, the actual order in which different 310s enter the election may vary.
[0169] In other examples, if multiple backup devices 310 simultaneously enter the election state, they can determine the master device through negotiation because they have the same priority. For example, each backup device 310 receives a master query message from another backup device 310 and learns that there are multiple backup devices 310 with the same priority. In this case, each backup device 310 will not directly set itself as the master device. Instead, the master device can be determined through election negotiation, while the others continue to serve as backup devices.
[0170] In other examples, if multiple backup devices with different priorities enter the election state simultaneously, the device with the highest priority can be elected as the master device. For example, if backup device 380 receives a master query message from another backup device 310 and learns that the priorities of the other backup devices are lower than its own, backup device 380 will directly set itself as the master device, then reply to the master query message from the other device and send the master device information (the information of 310 setting itself as the master device) to the backup device 310; the backup device 310 that receives the master device information stores the master device information and sets itself as the backup device, ending the election process.
[0171] As shown in FIG9 , 210 and AP do not have master capabilities. The master device broadcasts a device discovery message to query the device information of these devices, as shown in S24 and S25 in FIG9 .
[0172] In this implementation, the master device and other devices maintain communication through heartbeat messages. When the heartbeat message times out, it indicates that the master device may be faulty. In this case, a new master device is elected without manual designation, which improves the user experience.
[0173] The embodiments of the present application provide a device master selection solution based on the CoAP soft bus. By introducing a new CoAP message to query the master device, the master device in the network can be quickly discovered; smooth switching of the entire network device management after network anomalies or master device failures can be achieved, thereby improving the user experience; and through the CoAP soft bus master selection, rapid perception and management capabilities of network expansion and device failures can be achieved.
[0174] Figure 10 is a block diagram of a network deployment device provided in an embodiment of the present application. The network deployment device can be implemented as all or part of a network device through software, hardware, or a combination of both. The network deployment device may include: a receiving unit 501, a control unit 502, and a sending unit 503.
[0175] The receiving unit 501 is configured to receive a device discovery message sent by a terminal, where the device discovery message is used to instruct a network device to exit a backoff state;
[0176] A control unit 502 is configured to control the network device to exit the backoff state based on the device discovery message when the network device is in the backoff state;
[0177] The sending unit 503 is used to send device information of the network device to the terminal; and send registration information to the cloud.
[0178] Optionally, the device discovery message is a restricted application protocol CoAP message, and the CoAP message includes a device type, which is a type of the terminal;
[0179] A CoAP message whose device type is terminal is used to instruct a network device to exit the backoff state.
[0180] Optionally, the control unit 502 is further configured to update the backoff duration in the backoff state when the state of the network device is the non-backoff state, so that the backoff duration is reduced when the network device enters the backoff state next time.
[0181] Optionally, the sending unit 503 is further configured to broadcast a master device query message;
[0182] The control unit 502 is further configured to set itself as the master device if no response is received from the master device within a timeout period. The master device is the management device of the network where the network device is located.
[0183] The sending unit 503 is further configured to send the information of the master device to the terminal.
[0184] Optionally, the master device query message is a CoAP message, and the master device query message includes device priority information, and the device priority information is used for master device election.
[0185] Optionally, the receiving unit 501 is further configured to periodically receive a heartbeat message sent by the master device when a response from the master device is received;
[0186] The control unit 502 is further configured to elect a new master device according to the priorities of the devices in the network when no heartbeat message sent by the master device is received within a timeout period.
[0187] Figure 11 is a block diagram of a network deployment device provided by an embodiment of the present application. The network deployment device can be implemented as all or part of a terminal through software, hardware, or a combination of both. The network deployment device may include: a sending unit 601 and a receiving unit 602.
[0188] The sending unit 601 is used to broadcast a device discovery message, which is used to instruct the network device to exit the backoff state;
[0189] The receiving unit 602 is configured to receive device information of a network device sent by the network device.
[0190] Optionally, the device discovery message is a restricted application protocol CoAP message, and the CoAP message includes a device type, which is a type of the terminal;
[0191] A CoAP message whose device type is terminal is used to instruct a network device to exit the backoff state.
[0192] Optionally, the device discovery message is further used to instruct the network device to update the backoff duration in the backoff state when the network device is in the non-backoff state, so that the backoff duration is reduced when the network device enters the backoff state next time.
[0193] It should be noted that the network deployment device provided in the above embodiments uses the division of the aforementioned functional units as an example for network deployment. In actual applications, the aforementioned functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to perform all or part of the functions described above. Furthermore, the network deployment device provided in the above embodiments and the network deployment method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0194] An embodiment of the present application further provides a communication system, which includes a network deployment device as shown in FIG. 10 and FIG. 11 .
[0195] Figure 12 shows a schematic diagram of the structure of an electronic device 150 provided in an embodiment of the present application. The electronic device 150 shown in Figure 12 is used to perform the operations involved in the network deployment method shown in any of Figures 2 to 9 . The electronic device 150 can be the aforementioned network device or terminal. The electronic device 150 can be implemented using a general bus architecture.
[0196] As shown in FIG. 12 , the electronic device 150 includes at least one processor 151 , a memory 153 , and at least one communication interface 154 .
[0197] The processor 151 is, for example, a general-purpose central processing unit (CPU), a digital signal processor (DSP), a network processor (NP), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the solution of the present application. For example, the processor 151 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. It can implement or execute the various logic blocks, modules, and circuits described in conjunction with the disclosure of the embodiments of the present application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0198] Optionally, the electronic device 150 further includes a bus. The bus is used to transmit information between the components of the electronic device 150. The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, for example. Buses can be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG12 shows only one thick line, but this does not imply that there is only one bus or only one type of bus.
[0199] The memory 153 is, for example, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 153 is, for example, independent and connected to the processor 151 via a bus. The memory 153 can also be integrated with the processor 151.
[0200] The communication interface 154 uses any transceiver-like device to communicate with other devices or communication networks. The communication network can be Ethernet, a radio access network (RAN), or a wireless local area network (WLAN). The communication interface 154 can include a wired communication interface and a wireless communication interface. Specifically, the communication interface 154 can be an Ethernet interface, a Fast Ethernet (FE) interface, a Gigabit Ethernet (GE) interface, an Asynchronous Transfer Mode (ATM) interface, a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof. The Ethernet interface can be an optical interface, an electrical interface, or a combination thereof. In an embodiment of the present application, the communication interface 154 can be used for the electronic device 150 to communicate with other devices.
[0201] In a specific implementation, as an example, the processor 151 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG12 . Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0202] In a specific implementation, as an embodiment, the electronic device 150 may include multiple processors, such as the processor 151 and the processor 155 shown in FIG12 . Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0203] In a specific implementation, as an embodiment, the electronic device 150 may further include an output device and an input device. The output device communicates with the processor 151 and can display information in a variety of ways. For example, the output device can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device communicates with the processor 151 and can receive user input in a variety of ways. For example, the input device can be a mouse, a keyboard, a touch screen device, or a sensor device.
[0204] In some embodiments, the memory 153 is used to store program code 1510 for executing the solution of the present application, and the processor 151 can execute the program code 1510 stored in the memory 153. That is, the electronic device 150 can implement the network deployment method provided in the method embodiment by executing the program code 1510 in the memory 153 via the processor 151. The program code 1510 may include one or more software modules. Optionally, the processor 151 itself may also store program code or instructions for executing the solution of the present application.
[0205] In a specific embodiment, the electronic device 150 of the embodiment of the present application may correspond to the controller in the above-mentioned method embodiments, and the processor 151 in the electronic device 150 reads the instructions in the memory 153, so that the electronic device 150 shown in Figure 12 can execute all or part of the operations performed by the controller.
[0206] Specifically, the processor 151 is used to receive a device discovery message sent by the terminal, which is used to instruct the network device to exit the backoff state; when the network device is in the backoff state, the network device is controlled to exit the backoff state based on the device discovery message; the device information of the network device is sent to the terminal; and the registration information is sent to the cloud.
[0207] Alternatively, the processor 151 is configured to broadcast a device discovery message, where the device discovery message is used to instruct the network device to exit the backoff state; and receive device information of the network device sent by the network device.
[0208] For the sake of brevity, other optional implementations will not be described here in detail.
[0209] Each step of the network deployment method shown in any of Figures 2 to 9 is completed by hardware integrated logic circuits or software instructions in the processor of electronic device 150. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, they are not described in detail here.
[0210] An embodiment of the present application further provides a chip comprising an input interface, an output interface, a processor, and a memory. The input interface, the output interface, the processor, and the memory are connected via an internal connection path. The processor is configured to execute code in the memory. When the code is executed, the processor is configured to perform any of the aforementioned network deployment methods.
[0211] It should be understood that the processor may be a CPU, or other general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the ARM architecture.
[0212] Furthermore, in an optional embodiment, there are one or more processors and one or more memories. Alternatively, the memories may be integrated with the processors, or provided separately from the processors. The memories may include read-only memory and random access memory, and provide instructions and data to the processors. The memories may also include non-volatile random access memory. For example, the memories may also store reference blocks and target blocks.
[0213] The memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be ROM, PROM, EPROM, EEPROM, or flash memory. The volatile memory may be RAM, which serves as an external cache. By way of example and not limitation, many forms of RAM are available, including, for example, SRAM, DRAM, SDRAM, DDR SDRAM, ESDRAM, SLDRAM, and DR RAM.
[0214] In an embodiment of the present application, a computer-readable storage medium is further provided. The computer-readable storage medium stores computer instructions. When the computer instructions stored in the computer-readable storage medium are executed by an electronic device, the electronic device executes the network deployment method provided above.
[0215] In an embodiment of the present application, a computer program product including instructions is further provided. When the computer program product is run on an electronic device, the electronic device executes the network deployment method provided above.
[0216] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive).
[0217] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0218] The above are merely optional embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
[0219] Unless otherwise defined, the technical or scientific terms used herein shall have the usual meaning understood by persons of ordinary skill in the field to which this application belongs. The words “first”, “second”, “third” and similar terms used in the patent application specification and claims of this application do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as “a” or “an” do not indicate a quantitative limitation, but rather indicate the presence of at least one. Words such as “include” or “comprising” and similar words mean that the elements or objects appearing before “include” or “comprising” cover the elements or objects listed after “include” or “comprising” and their equivalents, and do not exclude other elements or objects.
[0220] The above is only an embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A network deployment method, characterized in that: The method comprises: The network device receives a device discovery message sent by a terminal, wherein the device discovery message is used to instruct the network device to exit a backoff state; When the state of the network device is a backoff state, the network device exits the backoff state based on the device discovery message; The network device sends device information of the network device to the terminal; The network device sends registration information to the cloud.
2. The method according to claim 1, characterized in that The device discovery message is a restricted application protocol CoAP message, and the CoAP message includes a device type, and the device type is a type of the terminal; The CoAP message whose device type is the type of the terminal is used to instruct the network device to exit the backoff state.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: When the state of the network device is a non-backoff state, the network device updates the backoff duration in the backoff state so that the backoff duration is reduced when the network device enters the backoff state next time.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: The network device broadcasts a master device query message; In the case where no response is received from the master device within a timeout period, the network device sets itself as the master device, and the master device is the management device of the network where the network device is located; The network device sends the information of the master device to the terminal.
5. The method according to claim 4, characterized in that The master device query message is a CoAP message, and the master device query message includes device priority information, and the device priority information is used for master device election.
6. The method according to claim 4 or 5, characterized in that: The method further comprises: When receiving a response from the master device, the network device periodically receives a heartbeat message sent by the master device; In the case where the heartbeat message sent by the master device is not received within a timeout period, the network device elects a new master device according to the priority of each device in the network.
7. A network deployment method, characterized in that: The method comprises: The terminal broadcasts a device discovery message, wherein the device discovery message is used to instruct the network device to exit the backoff state; The terminal receives the device information of the network device sent by the network device.
8. The method according to claim 7, characterized in that The device discovery message is a restricted application protocol CoAP message, and the CoAP message includes a device type, and the device type is a type of the terminal; The CoAP message whose device type is the type of the terminal is used to instruct the network device to exit the backoff state.
9. The method according to claim 7 or 8, characterized in that: The device discovery message is further used to instruct the network device to update the backoff duration in the backoff state when the state of the network device is a non-backoff state, so that the backoff duration is reduced when the network device enters the backoff state next time.
10. A network deployment device, characterized in that: The device comprises: A receiving unit, configured to receive a device discovery message sent by a terminal, wherein the device discovery message is used to instruct the network device to exit a backoff state; A control unit, configured to control the network device to exit the backoff state based on the device discovery message when the state of the network device is the backoff state; The sending unit is used to send the device information of the network device to the terminal; and send registration information to the cloud.
11. A network deployment device, characterized in that: The device comprises: A sending unit, used for broadcasting a device discovery message, wherein the device discovery message is used for instructing a network device to exit a backoff state; A receiving unit is used to receive the device information of the network device sent by the network device.
12. A network device, characterized in that: The network device comprises a processor and a memory, wherein the memory is used to store a software program, and the processor runs or executes the software program stored in the memory so that the network device implements the method according to any one of claims 1 to 6.
13. A terminal, characterized in that: The terminal includes a processor and a memory, the memory is used to store a software program, and the processor runs or executes the software program stored in the memory so that the terminal implements the method according to any one of claims 7 to 9.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes executed by a processor, wherein the program codes include instructions for implementing the method according to any one of claims 1 to 9.
15. A computer program product, characterized in that The computer program product comprises program codes, and when a computer runs the computer program product, the computer executes the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Network opening method and device
CN120151881A
Multicast service negotiation method and device
CN103414646A
Registration method and device in Ethernet passive optical network (EPON)
CN106789143A
Techniques for performing network switching operations
CN116368828A