Method, device, equipment and system for determining network topology and storage medium

By sending detection instructions to multiple nodes in the communication network and obtaining round-trip time information, the problem of difficulty in determining the network topology in large communication networks is solved, and accurate and efficient network topology determination is achieved.

CN119520366APending Publication Date: 2025-02-25HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311128709.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-08-25
Filing Date
2023-08-30
Publication Date
2025-02-25

Smart Images

  • Figure CN119520366A_ABST
    Figure CN119520366A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a device, equipment and a system for determining a network topology, and a storage medium, and relates to the technical field of communication. Taking a controller to execute the method as an example, a first detection instruction is sent to a plurality of nodes respectively, the first detection instruction is used for the plurality of nodes to return first topology reference information, and any first topology reference information comprises round-trip time of message transmission between a first node and at least one second node. The first node is any node which receives the first detection instruction in the plurality of nodes, and the second node is a node except the first node in the plurality of nodes; receiving first topology reference information respectively sent by the plurality of nodes; and determining a plurality of network topologies based on the first topology reference information respectively sent by the plurality of nodes, wherein the plurality of network topologies comprise a network topology taking each node in the plurality of nodes as a root node. According to the method, a third-party tool is not needed, the general applicability of the method is improved, internal information of equipment does not need to be read, and the safety problem does not exist.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese patent application No. 202311090727.9 filed on August 25, 2023, with invention name “Network topology restoration method, device, equipment and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of communication technology, and in particular to a method, device, equipment, system and storage medium for determining a network topology. Background Art

[0003] With the development of communication technology, the network scale is getting larger and larger, and the number of nodes in the network is also increasing. However, since the network scale may be expanded by different manufacturers, or the network topology is not recorded during the network construction process, it will lead to the need to determine the network topology corresponding to multiple nodes in advance in various scenarios based on network topology implementation, such as measuring the network delay between multiple nodes. Among them, the network topology can refer to the physical topology corresponding to the physical link, or it can refer to the logical topology corresponding to the routing path. Summary of the invention

[0004] The present application provides a method, apparatus, device, system and storage medium for determining a network topology, which are used to determine a network topology.

[0005] In a first aspect, a method for determining a network topology is provided, the method comprising: sending a first detection instruction to a plurality of nodes respectively, the first detection instruction being used for the plurality of nodes to return first topology reference information, any first topology reference information comprising a round-trip time for transmitting a message between the first node and at least one second node, the first node being any node among the plurality of nodes that receives the first detection instruction, and the second node being a node among the plurality of nodes other than the first node; receiving first topology reference information respectively sent by the plurality of nodes; determining a plurality of network topologies based on the first topology reference information respectively sent by the plurality of nodes, the plurality of network topologies comprising a network topology with each of the plurality of nodes as a root node.

[0006] The method determines the network topology between each node by the round-trip time of the message transmission between each node, without the need for third-party tools, thus improving the universal applicability of the method, and without the need to read the internal information of the device, and without security issues. Among them, since the first topology reference information can indicate the topological relationship between the nodes, the accuracy of the multiple network topologies determined is high, and since multiple network topologies with each node as the root node can be determined, the multiple network topologies determined are more comprehensive.

[0007] In a possible implementation, multiple network topologies include a first network topology with a first node as a root node; a method for determining multiple network topologies based on first topology reference information respectively sent by multiple nodes may include determining multiple pairs of parent nodes and child nodes that satisfy parent-child relationship conditions based on first topology reference information respectively sent by multiple nodes, the parent-child relationship conditions including that a difference between a first round-trip time and a second round-trip time is less than a first threshold, the first round-trip time is the round-trip time for transmitting a message between the root node and the child node, the second round-trip time is the sum of a third round-trip time and a fourth round-trip time, the third round-trip time is the round-trip time for transmitting a message between the root node and the parent node, and the fourth round-trip time is the round-trip time for transmitting a message between the parent node and the child node; the first network topology is determined based on the root node, multiple pairs of parent nodes and child nodes, and all nodes in the first network topology except the root node and the child node are child nodes of the root node.

[0008] The topological relationship between the parent node and the child node is determined by the parent-child relationship condition, and then the network topology is determined based on the determined topological relationship between the parent node and the child node. Since any two nodes will satisfy the parent-child relationship condition if they have a parent-child relationship, the parent node and the child node with a parent-child relationship can be accurately and comprehensively determined, further making the accuracy of the determined network topology higher.

[0009] In one possible implementation, any first topology reference information also includes the clock deviation between the first node and at least one second node, and the parent-child relationship condition also includes that the difference between the first clock deviation and the second clock deviation is less than a second threshold, the first clock deviation is the clock deviation between the root node and the child node, the second clock deviation is the sum of the third clock deviation and the fourth clock deviation, the third clock deviation is the clock deviation between the root node and the parent node, and the fourth clock deviation is the clock deviation between the parent node and the child node.

[0010] Since any two nodes may sometimes satisfy the parent-child relationship condition that the difference between the first round-trip time and the second round-trip time is less than the first threshold if there is no parent-child relationship, by adding the parent-child relationship condition that the difference between the first clock deviation and the second clock deviation is less than the second threshold, the error rate of the determined parent nodes and child nodes can be effectively reduced, thereby further improving the accuracy of the determined network topology.

[0011] In a possible implementation, after determining multiple network topologies based on first topology reference information respectively sent by multiple nodes, when the multiple network topologies include at least two nodes to be detected whose parent-child relationship is to be determined, second detection instructions can also be sent to the at least two nodes to be detected respectively, and the second detection instructions are used for at least two nodes to be detected to return second topology reference information, and any second topology reference information includes the round-trip time for transmitting messages between the first node to be detected and at least one second node to be detected, the first node to be detected is any node to be detected among the at least two nodes to be detected that receives the second detection instruction, and the second node to be detected is a node to be detected among the at least two nodes to be detected other than the first node to be detected; receiving second topology reference information respectively sent by at least two nodes to be detected; and updating the multiple network topologies based on the second topology reference information respectively sent by at least two nodes to be detected to obtain updated network topologies.

[0012] After determining multiple network topologies, for the situation where there are at least two nodes to be detected in the multiple network topologies including the parent-child relationship to be determined, for example, if the number of at least one second node in the process of determining multiple network topologies is less than the total number of nodes in the multiple nodes except the first node, the received first topology reference information does not include the round-trip time for transmitting messages between each node in the multiple nodes, which in turn causes some nodes to be unable to determine whether there is a parent-child relationship. Therefore, the method obtains the second topology reference information by re-determining the network topology process, and updates the multiple network topologies previously determined, so as to determine a more accurate and sound updated network topology. Furthermore, the process of determining the network topology can be performed again later to further update the multiple network topologies determined in the second round.

[0013] In a possible implementation, before sending the second detection instruction to at least two nodes to be detected respectively, it is also necessary to determine the nodes to be detected in multiple network topologies whose parent-child relationships are to be determined. Optionally, the method of determining the nodes to be detected in multiple network topologies whose parent-child relationships are to be determined may include determining multiple pairs of parent nodes and child nodes in multiple network topologies that have parent-child relationships; determining that any pair of nodes does not have a parent-child relationship when it is determined that there is a loop between any pair of nodes and the first node based on the topological relationships of the multiple network topologies and routing rules, and the routing rules include connecting any two nodes among the multiple nodes through a routing path; and using the nodes among the multiple nodes except any pair of nodes and multiple pairs of parent nodes and child nodes as the nodes to be detected in the multiple network topologies whose parent-child relationships are to be determined.

[0014] The method can deduce node pairs without parent-child relationships through multiple determined network topologies, so that in the next round of updating of multiple network topologies, the acquisition of the round-trip time for transmitting messages between node pairs without parent-child relationships can be saved, that is, the parent-child relationship is no longer detected for node pairs without parent-child relationships, which reduces the detection redundancy in the process of determining the network topology and saves resources.

[0015] In a possible implementation, multiple network topologies indicate the existence of a first loop, the first loop includes a third node, a fourth node, and a fifth node among multiple nodes, there is no parent-child relationship or grandparent-grandchild relationship between the fourth node and the fifth node in the network topology with the third node as the root node, there is no parent-child relationship or grandparent-grandchild relationship between the third node and the fifth node in the network topology with the fourth node as the root node, and there is no parent-child relationship or grandparent-grandchild relationship between the third node and the fourth node in the network topology with the fifth node as the root node. The loop in the network topology can be detected through the topological relationship between the above three nodes, and therefore, a method for detecting the loop is provided.

[0016] In a second aspect, a method for determining a network topology is provided, which is applied to a first node, where the first node is any node among a plurality of nodes, and the first node receives a first detection instruction sent by a controller; first topology reference information is obtained based on the first detection instruction, and the first topology reference information includes a round-trip time for transmitting a message between the first node and at least one second node, and the second node is a node among the plurality of nodes other than the first node; the first topology reference information is sent to the controller, and the first topology reference information is used by the controller to determine a plurality of network topologies based on the first topology reference information sent by the plurality of nodes respectively, and the plurality of network topologies include a network topology with each of the plurality of nodes as a root node.

[0017] In this method, each node reports the round-trip time of the message transmitted between each node to the controller, so that the controller can determine the network topology between each node based on the round-trip time of the message transmitted between each node, without the need for third-party tools, thereby improving the universal applicability of the method, and without the need to read the internal information of the device, there is no security problem. Among them, since the first topology reference information can indicate the topological relationship between the nodes, the accuracy of the multiple network topologies determined is high, and since multiple network topologies with each node as the root node can be determined, the multiple network topologies determined are more comprehensive.

[0018] In a possible implementation, the first topology reference information further includes clock deviations between the first node and at least one second node, so that the controller can determine a more accurate network topology according to the clock deviations between the nodes.

[0019] In a possible implementation, the method of obtaining the first topology reference information based on the first detection instruction may include: sending a detection message to at least one second node based on the first detection instruction, obtaining the sending time corresponding to at least one detection message; receiving a response message corresponding to the detection message returned by at least one node, obtaining the receiving time corresponding to at least one response message, wherein any response message includes the sending time of any response message and the receiving time of the detection message corresponding to any response message; and obtaining the round-trip time of the message transmitted between the first node and at least one second node according to the sending time and receiving time corresponding to at least one detection message, and the sending time and receiving time corresponding to at least one response message. This makes the round-trip time of the message transmitted between the determined nodes more accurate.

[0020] In a possible implementation, the method of sending a detection message to at least one second node based on the first detection instruction can be to send a detection message to at least one second node based on the first detection instruction through the user datagram protocol (UDP); the method of receiving a response message corresponding to the detection message returned by at least one node can be to receive a response message corresponding to the detection message returned by at least one node through UDP. Since the nodes are detected through UDP, and the detection message or response message sent through UDP belongs to the application layer, it is transparent to the node, has high security and high deployability.

[0021] In a third aspect, a device for determining a network topology is provided, the device comprising:

[0022] A transceiver module, used to perform the reception and / or transmission related operations performed by the first communication device in the first aspect or any possible implementation manner of the first aspect;

[0023] The processing module is used to perform other operations besides the reception and / or transmission related operations performed by the first communication device in the first aspect or any possible implementation manner of the first aspect.

[0024] In a possible implementation, the transceiver module includes a receiving module and / or a sending module. The receiving module is used to perform reception-related operations, and the sending module is used to perform sending-related operations.

[0025] In one possible implementation, a transceiver module is used to send a first detection instruction to multiple nodes respectively, the first detection instruction is used for the multiple nodes to return first topology reference information, any first topology reference information includes a round-trip time for transmitting a message between the first node and at least one second node, the first node is any node among the multiple nodes that receives the first detection instruction, and the second node is a node among the multiple nodes other than the first node; receiving the first topology reference information respectively sent by the multiple nodes; a processing module is used to determine multiple network topologies based on the first topology reference information respectively sent by the multiple nodes, the multiple network topologies including a network topology with each of the multiple nodes as a root node.

[0026] In one possible implementation, multiple network topologies include a first network topology with a first node as a root node; a processing module is used to determine multiple pairs of parent nodes and child nodes that satisfy parent-child relationship conditions based on first topology reference information sent by multiple nodes respectively, and the parent-child relationship conditions include that the difference between a first round-trip time and a second round-trip time is less than a first threshold, the first round-trip time is the round-trip time for transmitting a message between the root node and the child node, the second round-trip time is the sum of a third round-trip time and a fourth round-trip time, the third round-trip time is the round-trip time for transmitting a message between the root node and the parent node, and the fourth round-trip time is the round-trip time for transmitting a message between the parent node and the child node; the first network topology is determined based on the root node, multiple pairs of parent nodes and child nodes, and nodes in the first network topology except the root node and the child node are all child nodes of the root node.

[0027] In one possible implementation, any first topology reference information also includes the clock deviation between the first node and at least one second node, and the parent-child relationship condition also includes that the difference between the first clock deviation and the second clock deviation is less than a second threshold, the first clock deviation is the clock deviation between the root node and the child node, the second clock deviation is the sum of the third clock deviation and the fourth clock deviation, the third clock deviation is the clock deviation between the root node and the parent node, and the fourth clock deviation is the clock deviation between the parent node and the child node.

[0028] In a possible implementation, the transceiver module is also used to send second detection instructions to at least two nodes to be detected respectively when multiple network topologies include at least two nodes to be detected whose parent-child relationship is to be determined. The second detection instruction is used for at least two nodes to be detected to return second topology reference information. Any second topology reference information includes the round-trip time for transmitting messages between the first node to be detected and at least one second node to be detected. The first node to be detected is any node to be detected among the at least two nodes to be detected that receives the second detection instruction, and the second node to be detected is a node to be detected among the at least two nodes to be detected other than the first node to be detected; receive the second topology reference information respectively sent by the at least two nodes to be detected; the processing module is also used to update the multiple network topologies based on the second topology reference information respectively sent by the at least two nodes to be detected to obtain an updated network topology.

[0029] In one possible implementation, the processing module is also used to determine multiple pairs of parent nodes and child nodes that have parent-child relationships in multiple network topologies; when it is determined that there is a loop between any pair of nodes and the first node based on the topological relationships of the multiple network topologies and routing rules, determine that there is no parent-child relationship between any pair of nodes, and the routing rules include that any two of the multiple nodes are connected by a routing path; and use the nodes among the multiple nodes except any pair of nodes and multiple pairs of parent nodes and child nodes as nodes to be detected in the multiple network topologies for which the parent-child relationship is to be determined.

[0030] In one possible implementation, multiple network topologies indicate the existence of a first loop, the first loop including a third node, a fourth node, and a fifth node among the multiple nodes, no parent-child relationship or grandparent-grandchild relationship exists between the fourth node and the fifth node in the network topology with the third node as the root node, no parent-child relationship or grandparent-grandchild relationship exists between the third node and the fifth node in the network topology with the fourth node as the root node, and no parent-child relationship or grandparent-grandchild relationship exists between the third node and the fourth node in the network topology with the fifth node as the root node.

[0031] In a fourth aspect, a device for determining a network topology is provided. The device is applied to a first node, where the first node is any node among a plurality of nodes. The device includes:

[0032] A transceiver module, used to perform the reception and / or transmission related operations performed by the first communication device in the second aspect or any possible implementation manner of the second aspect;

[0033] The processing module is used to perform other operations besides the reception and / or transmission related operations performed by the first communication device in the second aspect or any possible implementation manner of the second aspect.

[0034] In a possible implementation, the transceiver module includes a receiving module and / or a sending module. The receiving module is used to perform reception-related operations, and the sending module is used to perform sending-related operations.

[0035] In one possible implementation, the transceiver module is used to receive a first detection instruction sent by a controller; the processing module is used to obtain first topology reference information based on the first detection instruction, the first topology reference information including the round-trip time for transmitting messages between the first node and at least one second node, the second node being a node among multiple nodes other than the first node; the transceiver module is also used to send the first topology reference information to the controller, the first topology reference information is used by the controller to determine multiple network topologies based on the first topology reference information sent by multiple nodes respectively, the multiple network topologies including a network topology with each of the multiple nodes as a root node.

[0036] In a possible implementation manner, the first topology reference information further includes a clock deviation between the first node and at least one second node.

[0037] In one possible implementation, a transceiver module is used to send a detection message to at least one second node based on a first detection instruction, and obtain a sending time corresponding to at least one detection message; receive a response message corresponding to the detection message returned by at least one node, and obtain a receiving time corresponding to at least one response message, wherein any response message includes a sending time of any response message and a receiving time of a detection message corresponding to any response message; and a processing module is used to obtain a round-trip time for transmitting a message between the first node and at least one second node based on the sending time and receiving time corresponding to at least one detection message, and the sending time and receiving time corresponding to at least one response message.

[0038] In a possible implementation, the transceiver module is used to send a detection message to at least one second node through UDP based on the first detection instruction; and receive a response message corresponding to the detection message returned by at least one node through UDP.

[0039] In a fifth aspect, a network device is provided, comprising: a processor, the processor being coupled to a memory, the memory storing at least one program instruction or code, the at least one program instruction or code being loaded and executed by the processor, so that the network device implements the method for determining the network topology as described in any one of the first aspect or the second aspect above.

[0040] Optionally, the number of the processors is one or more, and the number of the memories is one or more.

[0041] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.

[0042] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated with the processor on the same chip or can be set on different chips. This application does not limit the type of memory and the setting method of the memory and the processor.

[0043] In a sixth aspect, a system for determining a network topology is provided, the system for determining a network topology comprising a controller and a plurality of nodes;

[0044] The controller is used to execute the method described in the first aspect or any possible implementation of the first aspect, and any node among the multiple nodes is used to execute the method described in the second aspect or any possible implementation of the second aspect.

[0045] In the seventh aspect, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the instruction is loaded and executed by a processor so that a computer implements the method in the above-mentioned first aspect or any possible implementation of the first aspect, or implements the above-mentioned second aspect or any possible implementation of the second aspect.

[0046] In an eighth aspect, a computer program (product) is provided, wherein the computer program (product) comprises: a computer program code, and when the computer program code is executed by a computer, the computer executes the methods in the above aspects.

[0047] In a ninth aspect, a chip is provided, comprising a processor for calling and executing instructions stored in a memory from the memory, so that a communication device equipped with the chip executes the methods in the above aspects.

[0048] In the tenth aspect, another chip is provided, comprising: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the methods in the above aspects.

[0049] It should be understood that the beneficial effects achieved by the technical solutions of the third to tenth aspects of the present application and the corresponding possible implementation methods can be referred to the technical effects of the first and second aspects and their corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A schematic diagram of a loop-based asymmetric network delay calculation provided in an embodiment of the present application;

[0051] Figure 2 A process diagram of a traceroute method provided in an embodiment of the present application;

[0052] Figure 3 A schematic diagram of an implementation environment of a method for determining a network topology provided in an embodiment of the present application;

[0053] Figure 4 A schematic diagram of an implementation environment of another method for determining a network topology provided in an embodiment of the present application;

[0054] Figure 5 An interactive schematic diagram of a method for determining a network topology provided in an embodiment of the present application;

[0055] Figure 6 A schematic diagram of a principle of detecting the existence of a loop provided in an embodiment of the present application;

[0056] Figure 7 A schematic diagram of another principle of detecting the existence of a loop provided in an embodiment of the present application;

[0057] Figure 8 A schematic diagram of a detection non-redundancy principle provided in an embodiment of the present application;

[0058] Fig. 9 A flowchart of a process for determining a network topology provided in an embodiment of the present application;

[0059] Fig.10 A schematic diagram of a process for determining a network topology provided in an embodiment of the present application;

[0060] Fig.11 A schematic diagram of the structure of a device for determining a network topology provided in an embodiment of the present application;

[0061] Fig.12 A schematic diagram of the structure of a network device provided in an embodiment of the present application;

[0062] Fig.13 A schematic diagram of the structure of a network device provided in an embodiment of the present application;

[0063] Fig.14 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0065] With the development of communication technology, more and more scenarios require the determination of network topology. For example, network topology visualization and network traffic optimization all require the connection relationship and routing path between network nodes. The following is a reliance on prior network topology detection in the field of network measurement and clock synchronization.

[0066] In the scenario of measuring network delay, methods for measuring network delay include network time protocol (NTP) and IEEE1588 protocol, etc., which are all measured under the assumption that one-way delay (OWD) is symmetrical. However, since the clocks of the host devices at both ends of the network link are not completely consistent, there will be a clock deviation between the two host devices, which will cause millisecond errors in OWD in different directions between the two host devices, that is, asymmetric delay. Among them, delay refers to the time required for the sending host device to send a data packet to the receiving host device through the network link. The IEEE 1588 protocol is the abbreviation of the precision clock synchronization protocol for networked measurement and control systems defined by the Institute of Electrical and Electronics Engineers (IEEE). In a wide area network, the OWD asymmetry between the two host devices is more obvious. Therefore, a method based on loop calculation of network asymmetric delay can be used to improve the measurement accuracy of network delay. For example, see Figure 1The schematic diagram of calculating the network asymmetric delay based on the loop is shown. For any two nodes among nodes A, B and C, the clock deviations between any two points are calculated as a, b, c, d, e and f respectively, where a+b=100, c+d=200, f+e=2000; the constraint equations corresponding to the loop are a+c+f=1250 and b+d+e=1050, and it can be known that the clock deviation caused by the asymmetry in the clockwise and counterclockwise directions is 200. In other words, the calculation of the network asymmetric delay based on the loop requires the detection of the loops in the network topology to form the constraint equations corresponding to the loops. Among them, the loop is divided into a physical loop and a detection loop. The physical loop refers to starting from any node and returning to the node along different physical links; and the detection loop refers to the physical loop formed by the actual physical link corresponding to the routing information during neighbor detection. In order to calculate the network asymmetric delay based on the loop, the network topology needs to be determined to detect the loop according to the determined network topology. For example, given n nodes in any network, how to determine the network topology corresponding to the n nodes. Among them, a node can correspond to an Internet Protocol (IP) address, then the n nodes can be called an IP set. The above method for calculating the asymmetric network delay requires the existence of a loop between nodes A, B and C, that is, the three network links between them need to be independent of each other. If they are not independent, for example, if the network link between node A and node B passes through node C, the above method will fail. Therefore, before calculating the asymmetric network delay, it is necessary to determine the network topology between the nodes in advance.

[0067] In the related art, the network topology can be determined according to a traceroute method, which can be based on messages such as the Internet Control Message Protocol (ICMP), UDP or Transmission Control Protocol (TCP). Figure 2As shown, the sending client sends a first message to the destination host device, and the survival time (TTL) of the first message is 1. When the first hop node receives the first message, it will reduce the TTL by 1. If TTL=0, the first hop node will discard the first message and return a first ICMP timeout message to the sending client. After receiving the first message, the sending client records the routing information of the first hop, and then continues to send the second message to the destination host device, and the TTL of the second message is 2. Similarly, when the first hop node receives the second message, it will reduce the TTL by 1, so TTL=1; when the second hop node receives the second message, it will reduce the TTL by 1 again. If TTL=0, the second hop node will discard the second message and return a second ICMP timeout message to the sending client, so that the sending client receives the second message and records the routing information of the second hop. By analogy, when the sending client sends the fourth message with TTL=4, the sending client receives an ICMP timeout message from the destination host device, and then the sending client ends the traceroute, during which the routing information of each hop on the path between the sending client and the destination host device is recorded.

[0068] Alternatively, in the related art, the routing topology can be determined based on the routing table and other information inside the device. The routing table and other information inside the device includes the next hop information of the device. According to the next hop information, the neighbor routing information can be obtained, and then the routing table information inside the next device corresponding to the neighbor routing information can be gradually obtained to determine the routing topology. However, both methods in the related art require the use of third-party tools. The third-party tool used in the first related art is the traceroute program, and the third-party tool used in the second related art is the internal information of the device. In addition, the first related art requires that all nodes support traceroute to be implemented, and some nodes will not return ICMP timeout messages because the firewall function is enabled, which will lead to the failure of routing topology determination; the second related art requires information inside the network device such as routing table information, which will cause security issues.

[0069] The embodiment of the present application provides a method for determining network topology, which determines the network topology by detecting the round trip time (RTT) between nodes. The network topology can be determined without the help of third-party tools and there is no security problem. The round trip time can also be called the round trip delay. Figure 3 , Figure 3 A schematic diagram of an implementation environment of a method for determining a network topology provided in an embodiment of the present application. Figure 3As shown, the implementation environment includes a controller and multiple nodes, wherein the controller communicates with the multiple nodes via wired or wireless means. Optionally, the controller sends detection tasks to the multiple nodes, so that the multiple nodes report the topology reference information between any two nodes to the controller based on the detection tasks, and then the controller can determine the network topology according to the topology reference information between any two nodes, and obtain the following Figure 3 Network topology 1 or network topology 2 is shown.

[0070] For example, the method is applied to the NTP scenario, and the topology reference information includes RTT and offset. RTT represents the round trip time, and offset represents the clock deviation. Figure 4 , Figure 4 A schematic diagram of an implementation environment of another method for determining a network topology provided in an embodiment of the present application. Figure 4 In the example, the controller is an NTP server, multiple nodes are multiple NTP clients, multiple NTP clients and NTP servers form an NTP cluster, the NTP server is the control node of the NTP cluster, and each NTP client is a node of the topology to be determined. The NTP server sends the detection task that needs to be detected to each NTP client, and each NTP client detects each other based on the detection task and reports the RTT and offset obtained by the detection to the NTP server, and then the NTP server determines the network topology based on the RTT and offset reported by each NTP client.

[0071] Take the controller and the first node interacting to execute the method as an example, see Figure 5 , Figure 5 The interactive schematic diagram of a method for determining a network topology provided in an embodiment of the present application. The method can be applied to Figure 3 or Figure 4 In the implementation environment shown, the controller is, for example, Figure 3 The controller shown in the figure has the first node as Figure 3 Any of the multiple nodes shown. Figure 5 As shown, the method for determining the network topology includes but is not limited to the following steps 501 to 504.

[0072] In step 501, the controller sends a first detection instruction to multiple nodes respectively. The first detection instruction is used for multiple nodes to return first topology reference information. Any first topology reference information includes the round-trip time for transmitting a message between a first node and at least one second node. The first node is any node among the multiple nodes that receives the first detection instruction, and the second node is a node among the multiple nodes other than the first node.

[0073] In an embodiment of the present application, for a given plurality of nodes, the controller may generate a corresponding first detection instruction for each node, and then send the corresponding first detection instruction to the plurality of nodes respectively. The embodiment of the present application does not limit the form or content of the first detection instruction, and it is sufficient to instruct the first node to return the first topology reference information. Optionally, the first topology reference information refers to information that can be used to indicate a topological relationship between each node. For example, the first topology reference information may be the round-trip time for transmitting a message between the first node and at least one second node detected by the first node. Among them, the round-trip time may be referred to as RTT, and the round-trip time for transmitting a message between the first node and the second node refers to the time required for the message to travel back and forth between the first node and the second node once. In a scenario of delay symmetry, the round-trip time is twice the one-way delay from the first node to the second node.

[0074] Exemplarily, multiple nodes are numbered in the order of 0, 1, 2, etc. Taking the first detection instruction sent to node i as an example, i is a positive integer, and the first detection instruction includes multiple node pair sets, and the multiple node pair sets can be {k nodes <n i , n j >}, where 0= <i<=n,0=<j<=n,i≠j,n j is different from n i Sending the first detection instruction to node i can instruct node i to detect the first topology reference information, for example, the first topology reference information includes node i and k nodes n respectively j The round trip time of transmitting messages between <n i , n j >The corresponding round trip time is reported to the controller.

[0075] Optionally, the at least one second node may be all nodes in the plurality of nodes except the first node, or the at least one second node may be some nodes in the plurality of nodes except the first node. In the case where the number of the plurality of nodes is large, the at least one second node may be determined as some nodes in the plurality of nodes except the first node, so as to avoid excessive network load caused by simultaneously detecting a large number of second nodes, that is, to avoid network congestion caused by determining the network topology.

[0076] In a possible implementation, any first topology reference information also includes a clock deviation between the first node and at least one second node. The clock deviation can be referred to as offset, and the clock deviation between the first node and the second node refers to the relative difference between the clock of the first node and the clock of the second node, that is, the difference between the clock of the first node and the clock of the second node at the same time. In this case, the first detection instruction can also instruct the first node to detect the clock deviation between the first node and at least one second node, and report the detected clock deviation between the first node and at least one second node to the controller. The first detection instruction sent to node i includes {k <n i , n j >} as an example, the first detection instruction can also instruct node i to detect the nodes i and k nodes n respectively. j The clock deviation between <n i , n j >The corresponding clock deviations are reported to the controller.

[0077] Step 502: The first node receives a first detection instruction sent by a controller, and acquires first topology reference information based on the first detection instruction.

[0078] In one possible implementation, a method for obtaining first topology reference information based on a first detection instruction may include sending a detection message to at least one second node based on the first detection instruction, and obtaining a sending time corresponding to at least one detection message; receiving a response message corresponding to the detection message returned by at least one node, and obtaining a receiving time corresponding to at least one response message, wherein any response message includes a sending time of any response message and a receiving time of a detection message corresponding to any response message; and obtaining the first topology reference information according to the sending time and receiving time corresponding to at least one detection message, and the sending time and receiving time corresponding to at least one response message.

[0079] In the case where the first reference topology information includes the round-trip time, the round-trip time of the message transmitted between the first node and at least one second node is obtained according to the sending time and receiving time corresponding to at least one detection message, and the sending time and receiving time corresponding to at least one reply message; in the case where the first reference topology information includes the clock deviation, the clock deviation between the first node and at least one second node is obtained according to the sending time and receiving time corresponding to at least one detection message, and the sending time and receiving time corresponding to at least one reply message; in the case where the first reference topology information includes the round-trip time and the clock deviation, the round-trip time and the clock deviation of the message transmitted between the first node and at least one second node are obtained according to the sending time and receiving time corresponding to at least one detection message, and the sending time and receiving time corresponding to at least one reply message. Thus, the round-trip time and the clock deviation of the message transmitted between the determined nodes are more accurate.

[0080] Among them, the manner in which the first node and at least one second node exchange detection messages and responses is not limited in the embodiments of the present application. Optionally, the first node can send a detection message to at least one second node via UDP, and at least one second node returns a response message corresponding to the detection message to the first node via UDP. The detection message and the response message are sent via UDP. Since the detection message or the response message belongs to the application layer, it is transparent to the node, has high security and high deployability. Compared with TCP, it can also increase the probability of at least one second node returning a response message corresponding to the detection message, thereby improving the success rate of being able to detect the round-trip time of the message transmitted between the first node and at least one second node.

[0081] Optionally, for any detection message sent by the first node to any second node, taking the sending time corresponding to any detection message as T1 and the first receiving time as T2, and the second sending time corresponding to the response message of any detection message as T3 and the second receiving time as T4 as an example, the round-trip time for transmitting the message between the first node and any second node is determined as RTT 12 ,RTT 12 =(T4-T3)-(T2-T1), determine the clock deviation between the first node and any second node as offset 12 , offset 12=[(T2-T1)-(T4-T3)] / 2. Alternatively, by using a support vector machine (SVM) to obtain the round trip time and clock deviation of the message transmitted between the first node and any second node based on T1, T2, T3 and T4, the accuracy of the obtained round trip time and clock deviation can be improved, and the influence of network noise and clock speed deviation can be eliminated. SVM is a generalized linear classifier that performs binary classification on data in a supervised learning manner.

[0082] Step 503: The first node sends first topology reference information to the controller.

[0083] In the embodiment of the present application, after the first node detects and obtains the first topology reference information, the first topology reference information can be reported to the controller. The implementation method of the nodes other than the first node among the multiple nodes is the same as the implementation method of the first node, and the embodiment of the present application will not be repeated, and then the multiple nodes all send the detected first topology reference information to the controller, so that the controller can obtain the multiple first topology reference information detected by the multiple nodes.

[0084] Step 504: The controller receives first topology reference information respectively sent by the multiple nodes, and determines multiple network topologies based on the first topology reference information respectively sent by the multiple nodes, wherein the multiple network topologies include a network topology with each of the multiple nodes as a root node.

[0085] In the embodiments of the present application, the network topology may refer to the physical topology corresponding to the physical link, or may refer to the logical topology corresponding to the routing path. For example, the network topology may refer to the physical layout of various devices interconnected by the transmission medium, and may refer to the specific physical, logical, or virtual arrangement between the members constituting the network. The topological structure of the network topology includes bus topology, star topology, ring topology, and tree topology. The tree topology is a hierarchical structure shaped like an inverted tree, with the root node at the top, branches below the root node, and each branch may have sub-branches. That is, the tree topology is formed by adding branches to the bus network, and its transmission medium may have multiple branches, but it does not form a closed loop.

[0086] In a possible implementation, multiple network topologies include a first network topology with a first node as a root node; a method for determining multiple network topologies based on first topology reference information respectively sent by multiple nodes may include: determining multiple pairs of parent nodes and child nodes that satisfy parent-child relationship conditions based on first topology reference information respectively sent by multiple nodes, the parent-child relationship conditions including that a difference between a first round-trip time and a second round-trip time is less than a first threshold, the first round-trip time is the round-trip time for transmitting a message between the root node and the child node, the second round-trip time is the sum of a third round-trip time and a fourth round-trip time, the third round-trip time is the round-trip time for transmitting a message between the root node and the parent node, and the fourth round-trip time is the round-trip time for transmitting a message between the parent node and the child node; determining the first network topology based on the root node, multiple pairs of parent nodes and child nodes, and all nodes in the first network topology except the root node and the child node are child nodes of the root node.

[0087] Therefore, the topological relationship between the parent node and the child node is determined by the parent-child relationship condition, and then the network topology is determined based on the determined topological relationship between the parent node and the child node. Since any two nodes will satisfy the parent-child relationship condition if they have a parent-child relationship, it is possible to accurately and comprehensively determine the parent node and child node that have a parent-child relationship, thereby further making the accuracy of the determined network topology higher.

[0088] For example, when the root node is node n0, for node n i and node n j , if node n i and node n j If the parent-child relationship condition is met, then node n is determined i and node n j There is a parent-child relationship, and the parent-child relationship conditions include RTT (n0, n j )=RTT(n0,n i )+RTT(n i , n j )+θ, determine the node n i is node n j The parent node of the parent-child relationship condition includes RTT (n0, n i )=RTT(n0,n j )+RTT(n j , n i )+θ, determine the node n i is node n j The child node of j ) refers to nodes n0 and n j The round-trip time for transmitting a message between them, θ represents the measurement error of the round-trip time, θ is less than a first threshold, and the first threshold can be set according to experience or flexibly adjusted according to an application scenario.

[0089] In a possible implementation, any first topology reference information also includes the clock deviation between the first node and at least one second node, and the parent-child relationship condition also includes that the difference between the first clock deviation and the second clock deviation is less than the second threshold, the first clock deviation is the clock deviation between the root node and the child node, the second clock deviation is the sum of the third clock deviation and the fourth clock deviation, the third clock deviation is the clock deviation between the root node and the parent node, and the fourth clock deviation is the clock deviation between the parent node and the child node. Since any two nodes may sometimes happen to meet the parent-child relationship condition that the difference between the first round-trip time and the second round-trip time is less than the first threshold if there is no parent-child relationship, therefore, by adding the parent-child relationship condition that the difference between the first clock deviation and the second clock deviation is less than the second threshold, the error rate of the determined parent node and child node can be effectively reduced, that is, the accuracy of the determined network topology is further improved.

[0090] In this case, when the root node is node n0, for node n i and node n j , the parent-child relationship also includes offset(n0, n j )=offset(n0,n i )+offset(n i , n j )+β, or, the parent-child relationship condition also includes offset(n0, n i )=offset(n0,n j )+offset(n j , n i )+β. Among them, offset(n0,n j ) refers to nodes n0 and n j The clock deviation between β and β represents the measurement error of the clock deviation, β is less than the second threshold, and the second threshold can be set according to experience or flexibly adjusted according to the application scenario.

[0091] According to the above-mentioned parent-child relationship conditions, it is possible to detect whether there is a loop in the network topology. In one possible implementation, multiple network topologies indicate the existence of a first loop, the first loop includes a third node, a fourth node, and a fifth node among multiple nodes, there is no parent-child relationship or grandparent-grandchild relationship between the fourth node and the fifth node in the network topology with the third node as the root node, there is no parent-child relationship or grandparent-grandchild relationship between the third node and the fifth node in the network topology with the fourth node as the root node, and there is no parent-child relationship or grandparent-grandchild relationship between the third node and the fourth node in the network topology with the fifth node as the root node. The loop in the network topology can be detected by the topological relationship between the above-mentioned three nodes, and therefore, a method for detecting loops is provided.

[0092] Take the topology reference information including RTT as an example, combined with Figure 6 and Figure 7 The principle of detecting the existence of a loop is explained with examples. Figure 6 , if there is a loop between nodes A, B and C, then nodes A, B and C are all connected. Therefore, the sum of the RTTs of the links between any two pairs of nodes among A, B and C is usually not equal to the RTT of the link between the third pair of nodes. Figure 6 As shown, RTT AB +RTT BC ≠RTT AC ,RTT AC +RTT CB ≠RTT AB ,RTT BA +RTT AC ≠RTT BC See also Figure 7 , there is no loop between nodes A, B, C and D, then nodes A, B, C and D are connected in a unidirectional chain, therefore, nodes A, B, C and D satisfy Figure 7 The RTT relationship shown is RTT AB +RTT BC =RTT AC ,RTT BC +RTT CD =RTT BD ,RTT AC +RTT CD =RTT AD ,RTT AB +RTT BC +RTT CD =RTT AD When the topology reference information also includes offset, nodes A, B, C, and D satisfy Figure 7 The offset relationship shown is offset AB +offset BC =offset AC , offset BC +offset CD =offset BD , offset AC +offset CD =offset AD , offset AB +offset BC +offset CD=offset AD .

[0093] Using the above principle of detecting loop existence, if the real network topology includes loop-free situations between any number of nodes, then any number of nodes will satisfy Figure 7 The RTT relationship shown in FIG. 1 is a relationship between the loop-free state and the loop-free state. The loop-free state can be accurately detected according to the method. For example, if the real network topology includes 50 loop-free states, the method can detect at least 50 loop-free states, that is, the method can detect 100% of the loop-free network topologies.

[0094] In addition, for loops in real network topologies, it is likely that Figure 6 However, it is possible that the RTT between the nodes in the loop happens to satisfy Figure 7 The RTT relationship shown in the figure satisfies Figure 7 The RTT relationships shown in the figure will all be determined as no loop, thus causing the loop situation to be mistakenly detected as no loop situation, resulting in more no loop situations being detected than the actual no loop situation. Figure 1 In the asymmetric loop delay scenario shown in the figure, nodes A, B, and C do not satisfy the offset when there is a loop. AB +offset BC =offset AC Therefore, we can determine whether Figure 7 Based on the RTT relationship shown in the figure to determine the loop-free situation, add Figure 7 The offset relations shown in the figure jointly determine the loop-free situation. That is, when any number of nodes simultaneously satisfy Figure 7 The RTT relationship shown and Figure 7 In the case of the offset relationship shown, it is determined that the arbitrary multiple nodes are in a loop-free situation, thereby reducing the occurrence of false detection of the loop-free situation and improving the accuracy of the determined network topology.

[0095] Since after the completion of multiple network topologies in this round, there are multiple network topologies including at least two nodes to be detected whose parent-child relationship is to be determined, for example, if the number of at least one second node in the process of determining multiple network topologies in this round is less than the total number of nodes in the multiple nodes except the first node, the received first topology reference information does not include the round-trip time of the message transmission between each node in the multiple nodes, which leads to the inability of some nodes to determine whether there is a parent-child relationship. Or, in this round, some nodes fail to successfully detect the corresponding first topology reference information or the first topology reference information is lost during the reporting process, etc., all of which lead to multiple network topologies including at least two nodes to be detected whose parent-child relationship is to be determined. Therefore, the method obtains the second topology reference information through the process of determining the network topology in the next round, and updates the multiple network topologies determined in the previous round, so as to determine a more accurate and sound updated network topology. Furthermore, the multiple network topologies determined in the previous round can be further updated through the process of determining the network topology in the next round.

[0096] In a possible implementation, after determining multiple network topologies based on first topology reference information respectively sent by multiple nodes, when the multiple network topologies include at least two nodes to be detected whose parent-child relationship is to be determined, second detection instructions can also be sent to the at least two nodes to be detected, respectively. The second detection instruction is used for at least two nodes to be detected to return second topology reference information, and any second topology reference information includes the round-trip time of transmitting messages between the first node to be detected and at least one second node to be detected. The first node to be detected is any node to be detected that receives the second detection instruction among the at least two nodes to be detected, and the second node to be detected is a node to be detected other than the first node to be detected among the at least two nodes to be detected; receiving the second topology reference information respectively sent by the at least two nodes to be detected; updating the multiple network topologies based on the second topology reference information respectively sent by the at least two nodes to be detected to obtain updated network topologies. The process of detecting the network topology based on the second detection instruction is similar to the process of detecting the network topology based on the first detection instruction, and will not be repeated here.

[0097] Wherein, before the controller sends the second detection instruction to at least two nodes to be detected respectively, it is also necessary to determine the nodes to be detected in multiple network topologies whose parent-child relationship is to be determined. Optionally, the method of determining the nodes to be detected in multiple network topologies whose parent-child relationship is to be determined may include determining multiple pairs of parent nodes and child nodes in multiple network topologies that have parent-child relationships; determining that any pair of nodes does not have a parent-child relationship when it is determined that there is a loop between any pair of nodes and the first node based on the topological relationships of the multiple network topologies and routing rules; and using the nodes other than any pair of nodes and multiple pairs of parent nodes and child nodes in the multiple nodes as the nodes to be detected in the multiple network topologies whose parent-child relationship is to be determined.

[0098] In an embodiment of the present application, the routing rule includes that any two nodes among a plurality of nodes are connected by a routing path, that is, there is only one link between any two nodes at the same time, and the link may refer to a physical link or a routing path corresponding to the routing information. In the case where the link refers to a physical link, the determined network topology is a physical topology, and in the case where the link refers to a routing path corresponding to the routing information, the determined network topology is a logical topology. Thus, node pairs without a parent-child relationship can be derived through the multiple network topologies that have been determined, so that in the next round of updating of multiple network topologies, the acquisition of the round-trip time for transmitting messages between node pairs without a parent-child relationship can be saved, that is, the node pairs without a parent-child relationship are no longer detected, thereby reducing the detection redundancy in the process of determining the network topology.

[0099] That is, the embodiment of the present application provides a non-redundant detection method, which can reduce redundant detection based on multiple initial topologies that have been detected. Figure 8 The method of detecting non-redundancy is described, such as Figure 8 As shown, if the multiple initial topologies detected include known 1 and known 2, known 1 includes nodes 0, 1 and 3, which are loops, where node 0 is the root node, and nodes 1 and 3 are child nodes of node 0; known 2 includes nodes 0, 1 and 2, which are loop-free, where node 0 is the root node, and nodes 1 and 3 are child nodes of node 0, and node 2 is a child node of node 1. Then, based on known 1, known 2 and routing rules, it can be deduced by contradiction that nodes 0, 2 and 3 are loops, and then there is no need to detect the topological reference information between nodes 2 and 3, achieving the effect of reducing redundant detection.

[0100] The proof by contradiction is as follows: Assuming that nodes 0, 2, and 3 are acyclic, then nodes 0, 2, and 3 either satisfy the RTT 02 +RTT 23 =RTT 03 , or meet the RTT 03 +RTT 32 =RTT 02 If RTT is met 02 +RTT 23 =RTT 03 , then node 3 is the child of node 2. If node 3 is the child of node 2, then according to 2 and the routing rule, node 3 should also be the child of node 1. If RTT is satisfied 03 +RTT 32 =RTT 02, then node 2 is the child of node 3. If node 2 is the child of node 3, then according to known 2 and routing rules, node 3 should also be the child of node 1. However, according to known 1, it can be concluded that node 3 is not the child of node 1. Therefore, RTT 02 +RTT 23 =RTT 03 and RTT 03 +RTT 32 =RTT 02 If none of the above conditions hold, it is determined that nodes 0, 2, and 3 are in a cycle.

[0101] Below, we take the topology reference information including RTT and offset, and the network topology as a tree topology as an example. Fig. 9 and Fig.10 The process of determining the network topology corresponding to n nodes by the controller is illustrated by an example, where n is a positive integer. Fig. 9 As shown, n nodes whose network topology needs to be determined are input into the controller, as well as the maximum number of detection sessions k for each node in a single round of detection, where k is a positive integer less than n. Optionally, n nodes can correspond to n routing information. The controller generates n initial network topologies with the n nodes as root nodes, and each initial network topology initializes other n-1 nodes as child nodes of the root node. For example, taking n as 5, see Fig.10 The initialization corresponds to the four initial network topologies shown in FIG. 1 . In the initial network topology where node 0 is the root node, nodes 1, 2, 3, and 4 are all child nodes of node 0. At the same time, the controller generates a set of node pairs that need to perform a detection session in the first round and sends a detection instruction to n nodes. For example, the set of node pairs that need to perform a detection session in the first round is {any i, k nodes <n i , n j >,n j is different from n i the other k nodes of}.

[0102] In the embodiment of the present application, after receiving the detection instruction sent by the controller, n nodes detect the nodes that need to conduct detection sessions in this round through the UDP protocol, and use the SVM method to calculate the RTT and offset based on the generated receiving and sending timestamp information and report them to the controller. After receiving the RTT and offset reported by each node, the controller determines the node pairs with parent-child relationship according to the parent-child relationship condition. Since the node pairs with parent-child relationship meet Figure 7The acyclic situation shown in the figure, therefore, the root node and the node pair with the parent-child relationship are in a chain topological relationship, and then the nodes with the parent-child relationship can be updated to the chain topological relationship in the n initial network topologies. For the node pairs that are not determined to have a parent-child relationship, the topological relationship is not updated, that is, the nodes in the node pairs that are not determined to have a parent-child relationship are kept in their respective subtrees. In addition, the node pairs completed in this round of detection can be <n i , n j >If the node pair marked as 1 is checked, then the node pairs not marked as checked are the node pairs whose parent-child relationship is not confirmed, that is, the node pairs whose parent-child relationship is to be determined.

[0103] Then, the controller generates a set of node pairs that need to conduct detection sessions in the next round based on the unmarked checked node pairs, and sends detection instructions to each node. Optionally, the unmarked checked nodes can be excluded based on the principle of non-redundancy in detection, and the excluded unmarked checked node pairs are used as the set of node pairs that need to conduct detection sessions in the next round. Similarly, after the n nodes receive the detection instructions sent by the controller, they detect the nodes that need to conduct detection sessions in this round through the UDP protocol, and use the SVM method to calculate the RTT and offset based on the generated receiving and sending timestamp information and report them to the controller. And so on, until the set of node pairs that need to conduct detection sessions in the next round is empty, that is, until there are no node pairs that need to be detected, the network topology obtained from the last detection update is used as the n network topologies corresponding to the n nodes. Exemplarily, the n network topologies correspond to Fig.10 The final state of the network topology shown, wherein, since the network topology determined by this method is a tree structure, the network topology with node 0 as the root node lacks a link between node 3 and node 4 compared to the actual network topology, that is, lacks a loop topology relationship between node 0, node 3 and node 4.

[0104] Exemplarily, after determining n network topologies, it is also possible to determine whether there is a loop in the n network topologies, that is, to detect the loop. The method for determining whether there is a loop in the n network topologies is that for the nodes in the n network topologies that are in the form of a long chain, it can be directly determined that there is no loop; for any three nodes that are not in the form of a long chain in the n network topologies, if in the network topology with any node as the root node, the other two nodes do not have a parent-child relationship or a grandparent-grandchild relationship, that is, the other two nodes are not in the same subtree, then any three nodes are a loop. For example, see Fig.10As shown, there are no long chain of nodes 0, 3 and 4. In the final state of the network topology with node 0 as the root node, there is no parent-child relationship or grandparent-grandchild relationship between node 3 and node 4. In the final state of the network topology with node 3 as the root node, there is no parent-child relationship or grandparent-grandchild relationship between node 0 and node 4. In the final state of the network topology with node 4 as the root node, there is no parent-child relationship or grandparent-grandchild relationship between node 0 and node 3. It is determined that nodes 0, 3 and 4 are in a loop.

[0105] exist Fig. 9 In the process of determining the network topology shown, the UDP protocol is secure and does not require nodes to support the traceroute tool. In addition, the network topology of n nodes is determined based on the precise measurement of the RTT and clock deviation between each node, and a tree-like network topology with each node as the root node can be determined by the controller. Moreover, for each round of the process of issuing detection instructions, different node pair sets can be reasonably allocated to different nodes in real time based on the RTT and clock deviation.

[0106] The method provided in the embodiment of the present application determines the network topology between each node by the round-trip time of the message transmitted between each node, without the need for third-party tools, thereby improving the universal applicability of the method, and without the need to read the internal information of the device, and there is no security problem. Among them, since the first topology reference information can indicate the topological relationship between the nodes, the accuracy of the multiple network topologies determined is high, and since multiple network topologies with each node as the root node can be determined, the multiple network topologies determined are more comprehensive.

[0107] The above describes the method for determining the network topology of the embodiment of the present application. Corresponding to the above method, the embodiment of the present application also provides a device for determining the network topology. Fig.11 is a schematic diagram of a network topology determination device provided in an embodiment of the present application. The device is applied to a controller or a first node. The controller may be the above-mentioned Figure 3-5 The controller shown in the figure, the first node can be the above Figure 3-5 Any of the multiple nodes shown. Fig.11 As shown in the following multiple modules, the Fig.11 The network topology determination device shown can perform Figure 5 It should be understood that the device may include more additional modules than the modules shown or omit some of the modules shown, and the embodiments of the present application are not limited to this. Fig.11 As shown, the device comprises:

[0108] The transceiver module 1101 is used to execute Figure 5The receiving and / or sending related operations performed by the controller in the method for determining the network topology shown in the figure, or for performing Figure 5 Other operations besides the receiving and / or sending related operations performed by the first node in the method for determining the network topology shown;

[0109] Processing module 1102, for executing Figure 5 Other operations other than the receiving and / or sending related operations performed by the controller in the method for determining the network topology shown in the figure, or for performing Figure 5 Other operations besides the receiving and / or sending related operations performed by the first node in the method for determining the network topology shown.

[0110] In the transceiver module 1101, for executing Figure 5 The receiving and / or sending related operations performed by the controller in the method for determining the network topology shown in the figure, the processing module 1102 is used to perform Figure 5 The method for determining the network topology shown is a case where other operations besides the reception and / or transmission related operations are performed by the controller.

[0111] In one possible implementation, the transceiver module 1101 is used to send a first detection instruction to multiple nodes respectively, the first detection instruction is used for the multiple nodes to return first topology reference information, any first topology reference information includes the round-trip time for transmitting a message between the first node and at least one second node, the first node is any node among the multiple nodes that receives the first detection instruction, and the second node is a node among the multiple nodes other than the first node; receiving the first topology reference information sent by the multiple nodes respectively; the processing module 1102 is used to determine multiple network topologies based on the first topology reference information sent by the multiple nodes respectively, the multiple network topologies including a network topology with each of the multiple nodes as a root node.

[0112] In one possible implementation, multiple network topologies include a first network topology with a first node as a root node; a processing module 1102 is used to determine multiple pairs of parent nodes and child nodes that satisfy parent-child relationship conditions based on first topology reference information sent by multiple nodes respectively, and the parent-child relationship conditions include that the difference between a first round-trip time and a second round-trip time is less than a first threshold, the first round-trip time is the round-trip time for transmitting a message between the root node and the child node, the second round-trip time is the sum of a third round-trip time and a fourth round-trip time, the third round-trip time is the round-trip time for transmitting a message between the root node and the parent node, and the fourth round-trip time is the round-trip time for transmitting a message between the parent node and the child node; the first network topology is determined based on the root node, multiple pairs of parent nodes and child nodes, and nodes in the first network topology except the root node and the child node are all child nodes of the root node.

[0113] In one possible implementation, any first topology reference information also includes the clock deviation between the first node and at least one second node, and the parent-child relationship condition also includes that the difference between the first clock deviation and the second clock deviation is less than a second threshold, the first clock deviation is the clock deviation between the root node and the child node, the second clock deviation is the sum of the third clock deviation and the fourth clock deviation, the third clock deviation is the clock deviation between the root node and the parent node, and the fourth clock deviation is the clock deviation between the parent node and the child node.

[0114] In a possible implementation, the transceiver module 1101 is also used to send a second detection instruction to the at least two nodes to be detected respectively when multiple network topologies include at least two nodes to be detected whose parent-child relationship is to be determined. The second detection instruction is used for the at least two nodes to be detected to return second topology reference information. Any second topology reference information includes the round-trip time for transmitting a message between the first node to be detected and at least one second node to be detected. The first node to be detected is any node to be detected among the at least two nodes to be detected that receives the second detection instruction, and the second node to be detected is a node to be detected among the at least two nodes to be detected other than the first node to be detected; receiving the second topology reference information respectively sent by the at least two nodes to be detected; the processing module 1102 is also used to update the multiple network topologies based on the second topology reference information respectively sent by the at least two nodes to be detected to obtain an updated network topology.

[0115] In one possible implementation, the processing module 1102 is also used to determine multiple pairs of parent nodes and child nodes that have parent-child relationships in multiple network topologies; when it is determined that there is a loop between any pair of nodes and the first node based on the topological relationships of the multiple network topologies and routing rules, determine that there is no parent-child relationship between any pair of nodes, and the routing rules include that any two of the multiple nodes are connected by a routing path; and use the nodes among the multiple nodes except any pair of nodes, multiple pairs of parent nodes and child nodes as nodes to be detected in the multiple network topologies for which the parent-child relationship is to be determined.

[0116] In one possible implementation, multiple network topologies indicate the existence of a first loop, the first loop including a third node, a fourth node, and a fifth node among the multiple nodes, no parent-child relationship or grandparent-grandchild relationship exists between the fourth node and the fifth node in the network topology with the third node as the root node, no parent-child relationship or grandparent-grandchild relationship exists between the third node and the fifth node in the network topology with the fourth node as the root node, and no parent-child relationship or grandparent-grandchild relationship exists between the third node and the fourth node in the network topology with the fifth node as the root node.

[0117] In the transceiver module 1101, for executing Figure 5In the method for determining the network topology shown in FIG. 1 , other operations other than the operations related to receiving and / or sending performed by the first node are performed. The processing module 1102 is used to perform Figure 5 In the method for determining the network topology shown, other operations besides the reception and / or transmission related operations are performed by the first node.

[0118] In one possible implementation, the transceiver module 1101 is used to receive a first detection instruction sent by a controller; the processing module 1102 is used to obtain first topology reference information based on the first detection instruction, the first topology reference information including the round-trip time for transmitting messages between the first node and at least one second node, the second node being a node among multiple nodes other than the first node; the transceiver module 1101 is also used to send the first topology reference information to the controller, the first topology reference information is used by the controller to determine multiple network topologies based on the first topology reference information sent by multiple nodes respectively, the multiple network topologies including a network topology with each of the multiple nodes as a root node.

[0119] In a possible implementation manner, the first topology reference information further includes a clock deviation between the first node and at least one second node.

[0120] In one possible implementation, the transceiver module 1101 is used to send a detection message to at least one second node based on a first detection instruction, and obtain a sending time corresponding to at least one detection message; receive a response message corresponding to the detection message returned by at least one node, and obtain a receiving time corresponding to at least one response message, wherein any response message includes a sending time of any response message and a receiving time of the detection message corresponding to any response message; the processing module 1102 is used to obtain a round-trip time for transmitting messages between the first node and at least one second node according to the sending time and receiving time corresponding to at least one detection message, and the sending time and receiving time corresponding to at least one response message.

[0121] In a possible implementation, the transceiver module 1101 is used to send a detection message to at least one second node through UDP based on the first detection instruction; and receive a response message corresponding to the detection message returned by at least one node through UDP.

[0122] It should be understood that the above Fig.11When the device provided realizes its functions, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here. Fig.11 The effective effect of the provided device can be found in Figure 5 The beneficial effects of the method shown will not be described in detail here.

[0123] See also Fig.12 , Fig.12 A schematic diagram of the structure of a network device 2000 provided by an exemplary embodiment of the present application is shown. Fig.12 The network device 2000 shown is used to perform the above Figure 5 The operations involved in the method for determining the network topology shown in the figure. The network device 2000 is, for example, a switch, a router, etc. The network device 2000 can be implemented by a general bus architecture.

[0124] like Fig.12 As shown, the network device 2000 includes at least one processor 2001 , a memory 2003 , and at least one communication interface 2004 .

[0125] The processor 2001 is, for example, a general-purpose central processing unit (CPU), a digital signal processor (DSP), a network processor (NP), a graphics processing unit (GPU), a neural-network processing units (NPU), 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 2001 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 various logic blocks, modules, and circuits described in conjunction with the disclosure of the embodiments of the present invention. The processor can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.

[0126] Optionally, the network device 2000 further includes a bus. The bus is used to transmit information between the components of the network device 2000. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.

[0127] The memory 2003 is, for example, a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical 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 the 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 2003 is, for example, independent and connected to the processor 2001 via a bus. The memory 2003 can also be integrated with the processor 2001.

[0128] The communication interface 2004 uses any transceiver type device for communicating with other devices or communication networks, and the communication network can be Ethernet, radio access network (radio access network, RAN) or wireless local area network (wireless local area networks, WLAN) and the like. The communication interface 2004 can include a wired communication interface and can also include a wireless communication interface. Specifically, the communication interface 2004 can be an Ethernet interface, a Fast Ethernet (Fast Ethernet, FE) interface, a Gigabit Ethernet (Gigabit Ethernet, GE) interface, an Asynchronous Transfer Mode (Asynchronous Transfer Mode, ATM) interface, a wireless local area network (wireless local area networks, 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 2004 can be used for the network device 2000 to communicate with other devices.

[0129] In a specific implementation, as an embodiment, the processor 2001 may include one or more CPUs, such as Fig.120 and CPU1 shown in FIG. Each of these processors may be a single-core CPU processor or a multi-core CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0130] In a specific implementation, as an embodiment, the network device 2000 may include multiple processors, such as Fig.12 2001 and 2005 are shown in FIG. Each of these processors may be a single-core CPU or a multi-core CPU. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).

[0131] In a specific implementation, as an embodiment, the network device 2000 may further include an output device and an input device. The output device communicates with the processor 2001 and may display information in a variety of ways. For example, the output device may 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 2001 and may receive user input in a variety of ways. For example, the input device may be a mouse, a keyboard, a touch screen device, or a sensor device.

[0132] In some embodiments, the memory 2003 is used to store the program code 2010 for executing the solution of the present application, and the processor 2001 can execute the program code 2010 stored in the memory 2003. That is, the network device 2000 can implement the method for determining the network topology provided by the method embodiment through the processor 2001 and the program code 2010 in the memory 2003. The program code 2010 may include one or more software modules. Optionally, the processor 2001 itself can also store the program code or instruction for executing the solution of the present application.

[0133] In a specific embodiment, the network device 2000 of the embodiment of the present application may correspond to the first network device in each of the above-mentioned method embodiments, and the processor 2001 in the network device 2000 reads the instruction in the memory 2003, so that Fig.12 The illustrated network device 2000 is capable of performing all or part of the operations performed by the first node.

[0134] Specifically, processor 2001 is used to receive a first detection instruction sent by the controller; obtain first topology reference information based on the first detection instruction, the first topology reference information including the round-trip time for transmitting messages between the first node and at least one second node, the second node being a node other than the first node among multiple nodes; send the first topology reference information to the controller, the first topology reference information is used by the controller to determine multiple network topologies based on the first topology reference information sent by multiple nodes respectively, the multiple network topologies including a network topology with each of the multiple nodes as a root node.

[0135] For the sake of brevity, other optional implementations are not described here in detail.

[0136] The network device 2000 may also correspond to the above Fig.11 In the network topology determination device shown, each functional module in the network topology determination device is implemented by software of the network device 2000. In other words, the functional modules included in the network topology determination device are generated after the processor 2001 of the network device 2000 reads the program code 2010 stored in the memory 2003.

[0137] in, Figure 5 Each step of the method for determining the network topology shown is completed by an integrated logic circuit of hardware or software instructions in the processor of the network device 2000. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.

[0138] See also Fig.13 , Fig.13 FIG. 2 shows a schematic diagram of the structure of a network device 2100 provided by another exemplary embodiment of the present application. Fig.13 The network device 2100 shown is used to perform the above Figure 5 All or part of the operations involved in the method for determining the network topology shown. The network device 2100 is, for example, a switch, a router, etc. The network device 2100 can be implemented by a general bus architecture.

[0139] like Fig.13 As shown, the network device 2100 includes: a main control board 2110 and an interface board 2130 .

[0140] The main control board is also called a main processing unit (MPU) or a route processor card. The main control board 2110 is used to control and manage various components in the network device 2100, including routing calculation, device management, device maintenance, and protocol processing functions. The main control board 2110 includes: a central processing unit 2111 and a memory 2112.

[0141] The interface board 2130 is also called a line processing unit (LPU), a line card (linecard) or a service board. The interface board 2130 is used to provide various service interfaces and realize the forwarding of data packets. The service interface includes but is not limited to an Ethernet interface, a POS (Packet over SONET / SDH) interface, etc., and the Ethernet interface is, for example, a Flexible Ethernet Service Interface (Flexible Ethernet Clients, FlexE Clients). The interface board 2130 includes: a central processing unit 2131, a network processor 2132, a forwarding table entry memory 2134 and a physical interface card (physical interface card, PIC) 2133.

[0142] The central processor 2131 on the interface board 2130 is used to control and manage the interface board 2130 and communicate with the central processor 2111 on the main control board 2110 .

[0143] The network processor 2132 is used to implement the forwarding processing of the message. The network processor 2132 can be in the form of a forwarding chip. The forwarding chip can be a network processor (NP). In some embodiments, the forwarding chip can be implemented by an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA). Specifically, the network processor 2132 is used to forward the received message based on the forwarding table stored in the forwarding table entry memory 2134. If the destination address of the message is the address of the network device 2100, the message is sent to the CPU (such as the central processor 2131) for processing; if the destination address of the message is not the address of the network device 2100, the next hop and the output interface corresponding to the destination address are found from the forwarding table according to the destination address, and the message is forwarded to the output interface corresponding to the destination address. Among them, the processing of the uplink message may include: processing of the message input interface, forwarding table search; the processing of the downlink message may include: forwarding table search, etc. In some embodiments, the central processor can also perform the function of the forwarding chip, such as implementing software forwarding based on a general-purpose CPU, so that the forwarding chip is not required in the interface board.

[0144] The physical interface card 2133 is used to implement the physical layer docking function, whereby the original traffic enters the interface board 2130, and the processed message is sent out from the physical interface card 2133. The physical interface card 2133, also called a daughter card, can be installed on the interface board 2130, and is responsible for converting the photoelectric signal into a message and forwarding the message to the network processor 2132 for processing after checking the legitimacy of the message. In some embodiments, the central processor 2131 can also perform the functions of the network processor 2132, such as implementing software forwarding based on a general-purpose CPU, so that the network processor 2132 is not required in the physical interface card 2133.

[0145] Optionally, the network device 2100 includes multiple interface boards, for example, the network device 2100 further includes an interface board 2140, and the interface board 2140 includes: a central processor 2141, a network processor 2142, a forwarding table entry memory 2144, and a physical interface card 2143. The functions and implementation methods of the components in the interface board 2140 are the same or similar to those of the interface board 2130, and are not described in detail here.

[0146] Optionally, the network device 2100 further includes a switching fabric board 2120. The switching fabric board 2120 may also be referred to as a switch fabric unit (SFU). When the network device 2100 has multiple interface boards, the switching fabric board 2120 is used to complete data exchange between the interface boards. For example, the interface board 2130 and the interface board 2140 may communicate via the switching fabric board 2120.

[0147] The main control board 2110 is coupled to the interface board. For example, the main control board 2110, the interface board 2130, the interface board 2140, and the switching network board 2120 are connected to the system backplane through the system bus to achieve intercommunication. In a possible implementation, an inter-process communication (IPC) channel is established between the main control board 2110 and the interface board 2130 and the interface board 2140, and the main control board 2110 and the interface board 2130 and the interface board 2140 communicate through the IPC channel.

[0148] Logically, the network device 2100 includes a control plane and a forwarding plane. The control plane includes a main control board 2110 and a central processing unit 2111. The forwarding plane includes various components for performing forwarding, such as a forwarding table entry memory 2134, a physical interface card 2133, and a network processor 2132. The control plane performs functions such as a router, generating a forwarding table, processing signaling and protocol messages, and configuring and maintaining the status of the network device. The control plane sends the generated forwarding table to the forwarding plane. On the forwarding plane, the network processor 2132 forwards the message received by the physical interface card 2133 based on the forwarding table sent by the control plane. The forwarding table sent by the control plane can be stored in the forwarding table entry memory 2134. In some embodiments, the control plane and the forwarding plane can be completely separated and not on the same network device.

[0149] It is worth noting that there may be one or more main control boards, and when there are multiple boards, they may include a primary main control board and a backup main control board. There may be one or more interface boards. The stronger the data processing capability of the network device, the more interface boards are provided. There may also be one or more physical interface cards on the interface board. There may be no switching network board, or there may be one or more switching network boards. When there are multiple switching network boards, they can jointly realize load sharing and redundant backup. In a centralized forwarding architecture, network devices may not need switching network boards, and the interface board is responsible for processing the service data of the entire system. In a distributed forwarding architecture, network devices may have at least one switching network board, and data exchange between multiple interface boards is realized through the switching network board, providing large-capacity data exchange and processing capabilities. Therefore, the data access and processing capabilities of network devices with distributed architectures are greater than those of network devices with centralized architectures. Optionally, the network device may have only one board, that is, no switching board, and the functions of the interface board and the main control board are integrated on the board. In this case, the central processor on the interface board and the central processor on the main control board can be combined into one central processor on the board to perform the functions of the two. This type of network device has low data exchange and processing capabilities (for example, low-end switches or routers and other network devices). The specific architecture to be adopted depends on the specific networking deployment scenario, and no limitation is made here.

[0150] In a specific embodiment, the network device 2100 corresponds to the above Fig.11 In some embodiments, Figure 7 The transceiver module 1101 in the network topology determination device shown is equivalent to the physical interface card 2133 in the network device 2100 , and the determination module 1102 is equivalent to the central processor 2111 or the network processor 2132 in the network device 2100 .

[0151] Fig.14 It is a structural diagram of a server provided in an embodiment of the present application. The server 1400 may have relatively large differences due to different configurations or performances, and may include one or more processors 1401 and one or more memories 1402, wherein at least one computer program is stored in the one or more memories 1402, and the at least one computer program is loaded and executed by the one or more processors 1401, so that the server implements the network topology determination method provided in the above-mentioned various method embodiments. Of course, the server 1400 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1400 may also include other components for implementing device functions, which will not be described in detail here.

[0152] The embodiment of the present application also provides a network topology determination system, which includes a controller and multiple nodes. For example, the controller is Fig.12 The network device 2000 or Fig.14 In the server 1400 shown, any of the multiple nodes is Fig.12 The network device 2000 or Fig.13 The network device 2100 shown in FIG. 2100. The method for determining the network topology executed by the controller and any of the multiple nodes can be referred to in the above Figure 5 The relevant description of the illustrated embodiment will not be repeated here.

[0153] It should be understood that the processor may be a CPU, or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, 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 advanced reduced instruction set machine (ARM) architecture.

[0154] Further, in an optional embodiment, the memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. The memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.

[0155] The memory may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memory. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM) and direct memory bus random access memory (DR RAM).

[0156] An embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction is stored. The instruction is loaded and executed by a processor so that a computer implements any of the above methods for determining a network topology.

[0157] The embodiments of the present application also provide a computer program (product), which, when executed by a computer, can enable a processor or a computer to execute the corresponding steps and / or processes in the above method embodiments.

[0158] An embodiment of the present application also provides a chip, including a processor, for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes any of the above methods for determining a network topology.

[0159] An embodiment of the present application also provides another chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute any of the above methods for determining the network topology.

[0160] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part 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 the computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (solid state disk)), etc.

[0161] Those of ordinary skill in the art will appreciate that, in conjunction with the various method steps and modules described in the embodiments disclosed herein, they can be implemented in software, hardware, firmware, or any combination thereof. In order to clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0162] A person 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 instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0163] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. As an example, the method of the embodiment of the present application can be described in the context of a machine executable instruction, and the machine executable instruction is such as included in the program module executed in the device on the real or virtual processor of the target. Generally speaking, a program module includes a routine, a program, a library, an object, a class, a component, a data structure, etc., which performs a specific task or realizes a specific abstract data structure. In various embodiments, the function of the program module can be merged or divided between the described program modules. The machine executable instruction for the program module can be executed in a local or distributed device. In a distributed device, the program module can be located in both a local and a remote storage medium.

[0164] The computer program code for realizing the method for the embodiment of the present application can be written in one or more programming languages. These computer program codes can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by a computer or other programmable data processing device, causes the function / operation specified in the flow chart and / or block diagram to be implemented. The program code can be executed completely on a computer, partially on a computer, as an independent software package, partially on a computer and partially on a remote computer or completely on a remote computer or server.

[0165] In the context of the embodiments of the present application, computer program codes or related data may be carried by any appropriate carrier to enable a device, apparatus or processor to perform the various processes and operations described above. Examples of carriers include signals, computer readable media, and the like.

[0166] Examples of signals may include electrical, optical, radio, acoustic or other forms of propagated signals, such as carrier waves, infrared signals, etc.

[0167] A machine-readable medium may be any tangible medium that contains or stores a program for or related to an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. More detailed examples of machine-readable storage media include an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0168] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0169] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, or it can be an electrical, mechanical or other form of connection.

[0170] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0171] In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0172] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0173] In the present application, the terms "first", "second", etc. are used to distinguish between identical or similar items having substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there a limitation on quantity and execution order. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of various examples, a first image may be referred to as a second image, and similarly, a second image may be referred to as a first image. Both the first image and the second image may be images, and in some cases, may be separate and different images.

[0174] It should also be understood that in the various embodiments of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0175] The term "at least one" in this application means one or more, and the term "multiple" in this application means two or more, for example, multiple second messages means two or more second messages. The terms "system" and "network" are often used interchangeably herein.

[0176] It should be understood that the terms used in the description of the various examples herein are only for describing specific examples and are not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0177] It should also be understood that the term "and / or" used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. The term "and / or" is a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.

[0178] It should also be understood that the term “comprise” (also known as “includes,” “including,” “comprises” and / or “comprising”) when used in this specification specifies the presence of stated features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0179] It should also be understood that the terms "if" and "if" may be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting." Similarly, the phrases "if it is determined that ..." or "if [a stated condition or event] is detected" may be interpreted to mean "upon determining that ..." or "in response to determining that ..." or "upon detecting [a stated condition or event]" or "in response to detecting [a stated condition or event]," depending on the context.

[0180] It should be understood that determining B based on A does not mean determining B only based on A. B can also be determined based on A and / or other information.

[0181] It should also be understood that the references to "one embodiment", "an embodiment", or "a possible implementation" throughout the specification mean that specific features, structures, or characteristics related to the embodiment or implementation are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment", or "a possible implementation" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0182] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for determining a network topology, characterized in that: The method comprises: Sending a first detection instruction to a plurality of nodes respectively, where the first detection instruction is used by the plurality of nodes to return first topology reference information, where any first topology reference information includes a round-trip time for transmitting a message between a first node and at least one second node, where the first node is any node among the plurality of nodes that receives the first detection instruction, and the second node is a node among the plurality of nodes other than the first node; Receiving first topology reference information respectively sent by the multiple nodes; A plurality of network topologies are determined based on the first topology reference information respectively sent by the plurality of nodes, the plurality of network topologies including a network topology with each of the plurality of nodes as a root node.

2. The method according to claim 1, characterized in that The multiple network topologies include a first network topology with the first node as a root node; and the determining the multiple network topologies based on the first topology reference information respectively sent by the multiple nodes includes: Determine, based on the first topology reference information respectively sent by the multiple nodes, multiple pairs of parent nodes and child nodes that meet a parent-child relationship condition, wherein the parent-child relationship condition includes that a difference between a first round-trip time and a second round-trip time is less than a first threshold, the first round-trip time is the round-trip time for transmitting a message between the root node and the child node, the second round-trip time is the sum of a third round-trip time and a fourth round-trip time, the third round-trip time is the round-trip time for transmitting a message between the root node and the parent node, and the fourth round-trip time is the round-trip time for transmitting a message between the parent node and the child node; The first network topology is determined according to the root node, the multiple pairs of parent nodes and child nodes, and all nodes in the first network topology except the root node and the child nodes are child nodes of the root node.

3. The method according to claim 2, characterized in that Any first topology reference information also includes the clock deviation between the first node and the at least one second node respectively, and the parent-child relationship condition also includes that the difference between the first clock deviation and the second clock deviation is less than a second threshold, the first clock deviation is the clock deviation between the root node and the child node, the second clock deviation is the sum of the third clock deviation and the fourth clock deviation, the third clock deviation is the clock deviation between the root node and the parent node, and the fourth clock deviation is the clock deviation between the parent node and the child node.

4. The method according to any one of claims 1 to 3, characterized in that: After determining a plurality of network topologies based on the first topology reference information respectively sent by the plurality of nodes, the method further includes: In a case where the multiple network topologies include at least two nodes to be detected whose parent-child relationship is to be determined, a second detection instruction is sent to the at least two nodes to be detected respectively, the second detection instruction is used for the at least two nodes to be detected to return second topology reference information, any second topology reference information includes a round-trip time for transmitting a message between the first node to be detected and at least one second node to be detected, the first node to be detected is any node to be detected among the at least two nodes to be detected that receives the second detection instruction, and the second node to be detected is a node to be detected among the at least two nodes to be detected except the first node to be detected; Receiving second topology reference information respectively sent by the at least two nodes to be detected; The multiple network topologies are updated based on the second topology reference information respectively sent by the at least two nodes to be detected to obtain an updated network topology.

5. The method according to claim 4, characterized in that Before sending the second detection instruction to the at least two nodes to be detected respectively, the method further includes: Determining multiple pairs of parent nodes and child nodes having parent-child relationships in the multiple network topologies; In a case where it is determined that a loop exists between any pair of nodes and the first node based on the topological relationship of the multiple network topologies and the routing rule, determining that there is no parent-child relationship between the any pair of nodes, the routing rule including that any two of the multiple nodes are connected by a routing path; The nodes among the multiple nodes except the any pair of nodes and the multiple pairs of parent nodes and child nodes are used as nodes to be detected for which parent-child relationships are to be determined in the multiple network topologies.

6. The method according to any one of claims 1 to 5, characterized in that: The multiple network topologies indicate the existence of a first loop, the first loop including a third node, a fourth node and a fifth node among the multiple nodes, in the network topology with the third node as the root node, there is no parent-child relationship or grandparent-grandchild relationship between the fourth node and the fifth node, in the network topology with the fourth node as the root node, there is no parent-child relationship or grandparent-grandchild relationship between the third node and the fifth node, and in the network topology with the fifth node as the root node, there is no parent-child relationship or grandparent-grandchild relationship between the third node and the fourth node.

7. A method for determining a network topology, characterized in that: The method is applied to a first node, where the first node is any node among a plurality of nodes, and the method includes: receiving a first detection instruction sent by the controller; Acquire first topology reference information based on the first detection instruction, where the first topology reference information includes round-trip time for transmitting messages between the first node and at least one second node, where the second node is a node among the multiple nodes other than the first node; The first topology reference information is sent to the controller, where the first topology reference information is used by the controller to determine multiple network topologies based on the first topology reference information respectively sent by the multiple nodes, the multiple network topologies including a network topology with each of the multiple nodes as a root node.

8. The method according to claim 7, characterized in that The first topology reference information further includes clock deviations between the first node and the at least one second node.

9. The method according to claim 7 or 8, characterized in that: The acquiring first topology reference information based on the first detection instruction includes: Sending a detection message to the at least one second node respectively based on the first detection instruction, and acquiring a sending time corresponding to at least one detection message respectively; Receive a response message corresponding to the detection message returned by the at least one node, and obtain a reception time corresponding to at least one response message, wherein any response message includes a sending time of the any response message and a reception time of the detection message corresponding to the any response message; According to the sending time and receiving time respectively corresponding to the at least one detection message, and the sending time and receiving time respectively corresponding to the at least one response message, the round-trip time of the message transmitted between the first node and the at least one second node is obtained.

10. The method according to claim 9, characterized in that The sending a detection message to the at least one second node based on the first detection instruction respectively includes: Sending a detection message to the at least one second node respectively through the User Datagram Protocol UDP based on the first detection instruction; The receiving a response message corresponding to the detection message respectively returned by the at least one node includes: Receive a response message corresponding to the detection message returned by the at least one node through the UDP.

11. A device for determining a network topology, characterized in that: The device comprises: A transceiver module, used to perform the receiving and / or sending related operations performed by the communication device in the method described in any one of claims 1 to 6, or used to perform the receiving and / or sending related operations performed by the communication device in the method described in any one of claims 7 to 10; A processing module, used to perform other operations other than the reception and / or transmission related operations performed by the communication device in the method described in any one of claims 1-6, or used to perform other operations other than the reception and / or transmission related operations performed by the communication device in the method described in any one of claims 7-10.

12. A network device, characterized in that: The network device includes: a processor, the processor is coupled to a memory, the memory stores at least one program instruction or code, and the at least one program instruction or code is loaded and executed by the processor so that the network device implements the method for determining the network topology described in any one of claims 1-6, or so that the network device implements the method for determining the network topology described in any one of claims 7-10.

13. A system for determining network topology, characterized in that: The network topology determination system includes a controller and a plurality of nodes; The controller is used to execute the method for determining the network topology described in any one of claims 1-6, and any one of the multiple nodes is used to execute the method for determining the network topology described in any one of claims 7-10.

14. A computer-readable storage medium, characterized in that: The computer storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor so that the computer implements the method for determining the network topology as described in any one of claims 1-6, or so that the computer implements the method for determining the network topology as described in any one of claims 7-10.

15. A computer program product, characterized in that The computer program product includes: a computer program code, which is loaded and executed by a computer so that the computer implements the method for determining the network topology described in any one of claims 1-6, or so that the computer implements the method for determining the network topology described in any one of claims 7-10.