Method and apparatus for establishing network topology, and electronic device and computer storage medium

WO2026166244A1PCT designated stage Publication Date: 2026-08-13SHENZHEN INOVANCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-08-13

Smart Images

  • Figure CN2025147948_13082026_PF_FP_ABST
    Figure CN2025147948_13082026_PF_FP_ABST
Patent Text Reader

Abstract

The embodiments of the present application belong to the technical field of communications. Disclosed are a method and apparatus for establishing a network topology, and an electronic device and a computer storage medium. The method for establishing a network topology is applied to a non-terminal node device in a network topology, and comprises: acquiring reference address information, and on the basis of the reference address information, performing address propagation in a network topology by means of neighbor information exchange; receiving a branch vector obtained by at least one terminal node device in the network topology by means of address collection; and on the basis of the branch vector, constructing a topology vector tree, wherein the topology vector tree is used for establishing the network topology. By means of the embodiments of the present application, problems caused by large-scale data transmission during a network topology discovery process are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Methods, apparatus, electronic devices and computer storage media for establishing network topology

[0001] Related applications

[0002] This application claims priority to Chinese patent application No. 202510141449.8, filed on February 8, 2025, the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of communication technology, and in particular to methods, apparatus, electronic devices, and computer storage media for establishing network topologies. Background Technology

[0004] Currently, in communication networks based on controller and device models, the controller needs to determine the location of the device in order to plan communication characteristic parameters in order to better establish communication.

[0005] Typically, network topology discovery requires the controller to pre-configure or scan devices and connection boundaries in the network to obtain network size and connectivity information. However, this approach results in a large amount of data occupying bandwidth in the network, and at the same time, large-scale data transmission may cause network storms or data loss due to devices receiving too much information.

[0006] Application content

[0007] The main objective of this application is to provide a method, apparatus, electronic device, and computer storage medium for establishing network topology, thereby avoiding problems caused by large-scale data transmission during network topology discovery.

[0008] To achieve the above objectives, embodiments of this application provide a method for establishing a network topology. The method is applied to non-terminal node devices within the network topology and includes:

[0009] Obtain reference address information, and based on the reference address information, transmit addresses in the network topology through neighbor information exchange;

[0010] Receive a branch vector obtained by address collection from a node device at at least one end of the network topology;

[0011] A topology vector tree is constructed based on the branch vectors, and the topology vector tree is used to establish the network topology.

[0012] In one embodiment, the network topology includes at least one linear topology;

[0013] The linear topology includes a single node device, or multiple node devices linearly connected through a first port and a second port;

[0014] A node device in the linear topology is connected to a second port or branch port of the non-terminal node device.

[0015] In one embodiment, at the connection point of the linear topologies of adjacent levels, a branch port of a node device in the first linear topology is connected to a first port or a second port of a node device in the second linear topology.

[0016] In one embodiment, the step of transmitting addresses in the network topology via neighbor information exchange based on the reference address information includes:

[0017] Generate data packets based on the reference address information;

[0018] The data packet is sent to the neighboring node device in the network topology through the second port and / or branch port of the non-terminal node device, so that each of the neighboring node devices can transmit the data packet in the network topology through neighbor information exchange, and topology address information is assigned to all node devices in the network topology respectively; wherein, the neighboring node device is connected to the non-terminal node device through the first port or the second port, and the topology address information is used to identify the unique position of each node device in the network topology.

[0019] In one embodiment, the topology address information includes location information, which is used to indicate the order of the node device in the linear topology it is in.

[0020] In one embodiment, the topology address information further includes port information, which is used to indicate the branch port of the second node device in a second linear topology connected to the first linear topology where the first node device is located.

[0021] In one embodiment, both the first linear topology and the second linear topology include the terminal node device, and the device connected to the terminal node device through the first port belongs to the same linear topology or an adjacent linear topology as the terminal node device.

[0022] In one embodiment, the second port of the terminal node device is not connected to other node devices or the non-terminal node devices.

[0023] In one embodiment, the device connected to the terminal node device via the second port does not belong to the same linear topology as the terminal node device.

[0024] In one embodiment, the step of receiving a branch vector obtained by address collection from a node device at at least one end of the network topology includes:

[0025] Receive a branch vector obtained by a node device at at least one end of the network topology by collecting n+1 level branch location addresses, n+1 level branch port information, n level branch device count, and n-1 level branch connection information.

[0026] In one embodiment, the non-terminal node device has an identifier that refers to the topology vector tree.

[0027] In one embodiment, the non-terminal node device updates the topology vector tree based on a preset period.

[0028] Furthermore, to achieve the above objectives, embodiments of this application also provide a method for establishing a network topology, wherein the method for establishing a network topology is applied to end node devices in the network topology, including:

[0029] The non-terminal node devices in the network topology receive the assigned topology address information via address transmission;

[0030] Branch vectors are obtained by collecting addresses based on the topology address information, and the branch vectors are sent to the non-terminal node devices so that the non-terminal node devices can construct a topology vector tree based on the branch vectors. The topology vector tree is used to establish the network topology.

[0031] Furthermore, to achieve the above objectives, embodiments of this application also provide an apparatus for establishing a network topology, wherein the apparatus for establishing a network topology is applied to non-terminal node devices in the network topology, comprising:

[0032] The sending module is used to obtain reference address information and, based on the reference address information, transmit addresses in the network topology through neighbor information exchange.

[0033] A receiving module, the receiving module being configured to receive a branch vector obtained by address collection from a node device at at least one end of the network topology;

[0034] A processing module is configured to construct a topology vector tree based on the branch vectors, and the topology vector tree is used to establish the network topology.

[0035] Furthermore, to achieve the above objectives, embodiments of this application also provide an apparatus for establishing a network topology, wherein the apparatus for establishing a network topology is applied to end node devices in the network topology, comprising:

[0036] A receiving module, which is used to receive topology address information assigned by non-terminal node devices in the network topology via address transmission;

[0037] The sending module is used to collect addresses based on the topology address information to obtain branch vectors, and send the branch vectors to the non-terminal node devices so that the non-terminal node devices can construct a topology vector tree based on the branch vectors, and the topology vector tree is used to establish the network topology.

[0038] In addition, to achieve the above objectives, this application also provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the method for establishing a network topology as described above.

[0039] In addition, to achieve the above objectives, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for establishing a network topology as described above.

[0040] This application proposes a method, apparatus, electronic device, and computer storage medium for establishing a network topology. In this method, non-terminal node devices first obtain reference address information. Then, based on the reference address information, address transmission occurs within the network topology via neighbor information exchange. This automatically assigns topology address information to each device in the network topology, eliminating the need for a controller to individually configure the address of each device, thus saving significant time and improving address configuration efficiency. After automatic address allocation, the non-terminal node devices can receive branch vectors collected from at least one terminal node device in the network topology. This effectively scans the entire network topology and collects the topology address information of each device, avoiding the need for a controller to individually collect address information for each device and preventing problems caused by large-scale data transmission during network topology discovery. Finally, the non-terminal node devices can construct a topology vector tree for establishing the network topology based on the branch vectors. The topology vector tree contains the structural information of the network topology where the non-terminal node devices are located. When an external device needs to obtain information about this network topology, the non-terminal node device can transmit this information to the external device through the topology vector tree. Attached Figure Description

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

[0042] Figure 1 is a flowchart illustrating a method for establishing a network topology according to an embodiment of this application;

[0043] Figure 2 is a schematic diagram of a network topology structure involved in a method for establishing a network topology according to an embodiment of this application;

[0044] Figure 3 is a schematic diagram of the structure of topology address information involved in a method for establishing network topology according to an embodiment of this application;

[0045] Figure 4 is a schematic diagram of another network topology involved in a method for establishing a network topology according to an embodiment of this application;

[0046] Figure 5 is a schematic diagram of another network topology involved in a method for establishing a network topology according to an embodiment of this application;

[0047] Figure 6 is a schematic diagram of the structure of loop detection of the terminal node device in a method for establishing a network topology provided in an embodiment of this application;

[0048] Figure 7 is a schematic diagram of the branch vector structure involved in a method for establishing a network topology according to an embodiment of this application;

[0049] Figure 8 is a schematic diagram of the address collection process involved in a method for establishing a network topology according to an embodiment of this application;

[0050] Figure 9 is a schematic diagram of a device for establishing a network topology according to an embodiment of this application;

[0051] Figure 10 is a flowchart illustrating a method for establishing a network topology according to another embodiment of this application;

[0052] Figure 11 is a schematic diagram of a device for establishing a network topology according to another embodiment of this application;

[0053] Figure 12 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0054] Currently, real-time industrial Ethernet communication based on Ethernet is widely used. In communication networks based on controller and device models, the controller needs to determine the location of the device in order to plan communication characteristic parameters in order to better establish communication.

[0055] Typically, network topology discovery requires the controller to pre-configure or scan devices and connection boundaries in the network to obtain network size and connectivity information (e.g., topology). Obtaining information for each device requires significant work to individually configure each device's address and to access each device to retrieve the device connectivity relationships within the network.

[0056] In related technologies, the methods for obtaining device information are mostly through pre-configuring device information, with the controller searching for each device individually, or by the controller broadcasting data with special tags. After receiving such directed frames, the target device group replies to inform the controller that the device is in the network. Subsequently, Ethernet technology is used to search for and configure the devices one by one, and standard open protocols such as LLDP (Link Layer Discovery Protocol) and SNMP (Simple Network Management Protocol) are used to obtain the device topology information in the network.

[0057] In various Ethernet-based communication protocols (including the standard Ethernet protocol), the online devices are identified either by the controller searching for each device individually or by checking responses to multicast messages; or by the devices actively informing the controller, which requires the devices to periodically report their online status when no connection is established with the controller. Both of these methods (controller actively searching, devices actively reporting information) have the following drawbacks: the more devices in the network, the more data occupies the network bandwidth, and large-scale data transmission at the same time may cause network storms or information loss due to devices receiving too much information.

[0058] Network topology discovery is a crucial step in real-time networking, but currently, there is no standard-defined protocol to address the aforementioned issues. Network management protocols in related technologies must provide basic protocol processing agents, which slows down the discovery cycle and makes information processing laborious. For example, SNMP scanning requires additional supporting frameworks, and SNMP communication demands large amounts of data and complex operations to obtain the current topology.

[0059] Furthermore, when a problem occurs with a single device or network segment in an Ethernet industrial automation system, after replacing the new device, the controller needs to explore and configure each device in the new device or network segment one by one. This makes it take a lot of time to restore normal operation after replacing the device in the network.

[0060] Based on this, embodiments of this application provide a method, apparatus, electronic device, and computer storage medium for establishing a network topology. In this method, non-terminal node devices first obtain reference address information, and then, based on the reference address information, address transmission is performed in the network topology through neighbor information exchange. This enables automatic allocation of topology address information for each device in the network topology, eliminating the need for a significant amount of time to configure the address of each device individually through a controller, thus saving considerable time and improving address configuration efficiency. After automatic address allocation, non-terminal node devices can receive branch vectors obtained by at least one terminal node device in the network topology through address collection. This is equivalent to scanning the entire network topology and collecting the topology address information of each device in the network topology, without the need for a controller to collect the address information of each device individually, avoiding problems caused by large-scale data transmission during network topology discovery. Finally, non-terminal node devices can construct a topology vector tree for establishing the network topology based on the branch vectors. The topology vector tree contains the structural information of the network topology in which the non-terminal node devices are located. When an external device needs to obtain information about the network topology, the non-terminal node device can transmit the network topology information to the external device through the topology vector tree.

[0061] The method, apparatus, electronic device, and computer storage medium for establishing network topology provided in this application are specifically described through the following embodiments. First, the method for establishing network topology in the embodiments of this application is described.

[0062] Referring to Figure 1, which is a flowchart illustrating a method for establishing a network topology according to an embodiment of this application, this method is applied to non-terminal node devices in the network topology. As shown in Figure 1, the method for establishing a network topology provided in this embodiment includes steps S10 to S30:

[0063] Step S10: Obtain reference address information, and pass addresses in the network topology through neighbor information exchange based on the reference address information;

[0064] In this embodiment, the network topology is an Ethernet topology structure composed of multiple node devices. The non-terminal node devices that act as the execution subjects are the node devices connected to external devices in the network topology. The external devices can be controllers or non-control communication nodes. When the external device is a controller, the reference address information can be the address information transmitted by the controller to the non-terminal node devices. When the external device is a non-control communication node, the reference address information can be the address information generated by the non-terminal node devices themselves when they detect the access of the external devices.

[0065] In this embodiment, the process of automatically assigning addresses to each node device in the network topology, triggered by a non-terminal node device, is called "Rollout". In this process, the non-terminal node device uses the reference address information as its own address information in the network topology and transmits its own address information to at least one neighbor device connected to the non-terminal node device through neighbor information exchange. This allows the neighbor device to accumulate fields based on the address information of the non-terminal node device, thereby automatically assigning address information to the neighbor device. The period interval of the neighbor information exchange can be flexibly configured according to actual needs and can carry invalid or valid topology information fields. This embodiment does not impose any restrictions on this.

[0066] As an example, assuming the reference address information of a non-terminal node device is n, its neighboring devices, upon learning this information, will configure their own address information as n+1. Similarly, another neighboring device connected to this neighboring device will configure its own address information as n+2, and so on. That is, the non-terminal node device merely serves as the starting point for address transmission. Each neighboring device that has transmitted address information via a non-terminal node device will continue the address transmission process to other connected neighboring devices until all nodes in the network topology have completed address allocation.

[0067] As an example, in this embodiment, after the address information sent by the sending end is received by the receiving end, the receiving end can send its own modified new topology address information back to the sending end, which is the neighbor, to confirm that the address setting was successful.

[0068] Step S20: Receive the branch vector obtained by address collection from at least one end node device in the network topology;

[0069] In this embodiment, the terminal node device can be a node device with only one neighbor device in the network topology. That is, after it completes its own address information configuration based on the address information from the forward neighbor device, the terminal node device cannot receive the address information returned from another neighbor device if no other node devices are added to the network topology. However, the terminal node device can periodically send the topology address information it manages backward. In this way, when a new node device connects to the terminal node device to access the network topology, the connection link between the two can be configured quickly, and the address information of the new node device in the network topology can also be automatically configured in a timely manner, saving a lot of time that would otherwise be spent configuring the new device separately. At the same time, the new node device will replace its original forward terminal node device as the new terminal node device in the network topology.

[0070] In this embodiment, after the end node device completes the address configuration, the process triggered by the end node device to describe and collect the connection information between the nodes in the network topology with a small amount of information to the non-end node devices is called "address collection (Rollin)". This process is equivalent to collecting the connection information between the nodes in the network topology step by step along the automatically assigned address path until it returns to the non-end node devices. Obviously, this process does not require the participation of the controller, which overcomes the shortcomings of the traditional technical means of the controller accessing and collecting information device by device, which is too cumbersome, time-consuming and has too much data information occupying a large amount of transmission bandwidth. It significantly improves the information collection efficiency and reduces bandwidth pressure.

[0071] In this embodiment, the address collection process can also be implemented through neighbor information exchange. That is, the terminal node device generates a return data packet based on its own information and connection information with other node devices, and transmits the return data packet back to the neighbor device connected to the terminal node device along the address transmission path through neighbor information exchange. This allows the neighbor device to also add its own information and connection information with other node devices to the return data packet, and continue to transmit the return data packet back along the address transmission path until the return data packet reaches the non-terminal node device that triggered the address transmission. At this point, the return data packet is equivalent to carrying a branch vector of the linear topology where the terminal node device is located. This branch vector contains the connection information between all node devices in the linear topology with the non-terminal node device and the terminal node device as the beginning and end. If there are n terminal node devices in the network topology, the non-terminal node devices can receive n branch vectors through the address collection process.

[0072] Step S30: Construct a topology vector tree based on the branch vectors. The topology vector tree is used to establish the network topology.

[0073] In this embodiment, taking the non-terminal node device receiving multiple branch vectors as an example, since each branch vector contains the connection relationship between the non-terminal node device and its neighboring devices, the non-terminal node device itself can be used as the root node device of the topology vector tree. Based on each branch vector, multiple branches are extended from the root node device to form different branches of the topology vector tree, thus completing the construction of the topology vector tree.

[0074] As an example, in this embodiment, the topology vector tree can be regarded as a series of strings composed of all branch vectors in the network topology. The topology vector tree can include at least one topology vector subtree, which can be regarded as a set of strings composed of at least one branch vector in the network topology. The branch vector can be implemented by a combination of two bytes of numbers and characters. A branch vector is used to mark a linear topology branch in the network topology.

[0075] In some feasible embodiments, the network topology described above includes at least one linear topology; the linear topology includes a node device, or multiple node devices linearly connected through a first port and a second port; a node device in a linear topology is connected to the second port or branch port of a non-terminal node device.

[0076] In this embodiment, the linear topology contains at least one node device. The first port can be regarded as the primary port or the receiving port, and the second port can be regarded as the secondary port or the transmitting port. That is, each node device that makes up the network topology is equipped with at least two types of ports: receiving port and transmitting port. The node devices can establish a linear connection relationship through the receiving port and the transmitting port to form a linear topology. In the linear topology composed of multiple node devices that are linearly connected through the first port and the second port, the first port of the first node device and the second port of the last node device are not connected to avoid the linear topology becoming a ring topology.

[0077] In this embodiment, the node device can also be equipped with a branch port. In this way, in addition to forming a linear topology through the main port and the secondary port, different node devices can also establish connections through the branch port to form a tree network topology or a star network topology.

[0078] It should be noted that in this embodiment, the first port of the non-terminal node device is the port connected to the external device of the network topology. Therefore, when other node devices in the network topology are connected to the non-terminal node device, they are generally connected to the second port or branch port of the non-terminal node device.

[0079] As an example, this embodiment provides a schematic diagram of a network topology as shown in Figure 2 to aid in understanding the definition of linear topologies and ports. In Figure 2, the network topology includes seven linear topologies: 101, 102, 103, 104, 105, 106, and 107. Linear topology 101 includes node devices 1, 2, 3, and 4; linear topology 102 includes node devices 5 and 6; linear topology 103 includes node devices 7 and 8; linear topology 104 includes node devices 9, 10, and 11; linear topology 105 includes node devices 12 and 13; linear topology 106 includes node devices 14 and 15; and linear topology 107 includes node device 16. It can be seen that the node devices belonging to the same linear topology are connected through primary and secondary ports. For example, port a is the primary port of node device 8, port b is the secondary port of node device 7, and port c is the branch port of node device 2 or node device 3.

[0080] It is understood that although only a network topology containing 7 linear topologies is shown in Figure 2, the method for establishing network topologies provided in this embodiment can also be applied to network topologies containing only 1 linear topology, network topologies containing 2 linear topologies, or network topologies containing other numbers of linear topologies. Figure 2 does not represent a limitation on the specific number of linear topologies in a network topology.

[0081] In some feasible embodiments, at the connection of linear topologies of adjacent levels, the branch port of a node device in the first linear topology is connected to the first port or the second port of a node device in the second linear topology.

[0082] It should be noted that in this embodiment, a network topology may include multiple levels of linear topologies. Taking the first linear topology as a higher-level linear topology and the second linear topology as a lower-level linear topology as an example, the node devices in the higher-level linear topology can be connected to the node devices in the lower-level linear topology through branch ports. A node device can have multiple branch ports. Different linear topologies formed by node devices extended from the branch ports of different node devices in the same linear topology belong to the same level. The hierarchical order of different levels of linear topologies can be defined according to the priority order of information transmission, but it does not mean that there is a difference in quality between node devices at different levels.

[0083] As an example, referring to Figure 2, linear topology 101 and linear topology 102 are connected through node device 2 and node device 5, with one branch port of node device 2 connected to the first or second port of node device 5; linear topology 101 and linear topology 103 are connected through node device 3 and node device 7, with one branch port of node device 3 connected to the first or second port of node device 7; linear topology 101 and linear topology 104 are connected through node device 2 and node device 9, with another branch port of node device 2 connected to the first or second port of node device 9; linear topology 104 and linear topology 105 are connected through node device 10 and node device 12, with one branch port of node device 10 connected to the first or second port of node device 12; linear topology 104 and linear topology 106 are connected through node device 10 and node device 7. The node device 10 is connected to the first or second port of the node device 14. The linear topology 101 and the linear topology 107 are connected through the node device 4 and the node device 16. The branch port of the node device 4 is connected to the first or second port of the node device 16. In Figure 2, the linear topology 101 belongs to the first level. The linear topologies 102, 103, 104 and 107 are all linear topologies extended from the branch ports of the node devices in the linear topology 101 and belong to the second level. The linear topologies 105 and 106 are both linear topologies extended from the branch ports of the node devices in the linear topology 104 and belong to the third level. In addition, the first level can also be regarded as the highest level, the second level as the next level after the first level, and the third level as the next level after the second level. This embodiment does not limit this.

[0084] In some feasible embodiments, the step S10 above, which involves address transfer based on reference address information through neighbor information exchange in the network topology, may specifically include:

[0085] Step S11: Generate a data packet based on the reference address information;

[0086] Step S12: The data packet is sent to the neighboring node device in the network topology through the second port and / or branch port of the non-terminal node device, so that each neighboring node device can transmit the data packet in the network topology through neighbor information exchange, and topology address information is assigned to all node devices in the network topology respectively; wherein, the neighboring node device connects to the non-terminal node device through the first port or the second port, and the topology address information is used to identify the unique position of each node device in the network topology.

[0087] In this embodiment, non-terminal node devices use reference address information as their own address information in the network topology. They package this reference address information with other invalid or valid topology information fields to form a data packet, and then transmit the data packet to at least one neighboring device connected to the non-terminal node device through neighbor information exchange. This allows the neighboring devices to accumulate fields based on the address information of the non-terminal node device, thereby automatically allocating topology address information to the neighboring devices based on the data packet. During this process, the neighboring devices also add their own configured address information to the data packet and continue to transmit the data packet to their neighboring devices until all node devices in the network topology have completed the automatic allocation of topology address information. The periodic interval of neighbor information exchange between the node devices in the network topology can be flexibly configured according to actual needs, and this embodiment does not impose any restrictions on this.

[0088] As an example, in this embodiment, the topology address information can be described as a combination of numbers, letters, or both, thereby forming a unique descriptor for each node device in the network topology.

[0089] In some feasible embodiments, the above topology address information may include location information, which is used to indicate the order of the node device in the linear topology it is in.

[0090] In this embodiment, taking the case where the network topology consists of only one linear topology without other branches as an example, since the first port of a non-terminal node device is connected to an external device of the network topology, when address transmission starts from the non-terminal node device, the non-terminal node device can be regarded as the first node device of the linear topology, and its position information is set to 0. The position information of the first node device connected to the non-terminal node device is accumulated based on the position information of the non-terminal node device, i.e., set to 1. The position information of the second node device connected to the first node device is accumulated based on the position information of the first node device, i.e., set to 2, and so on. Since there is only one linear topology, and the connection method of the linear topology is to establish a linear connection through the first port and the second port, it is not necessary to identify the ports. The accurate position of each node device in the network topology can be clearly understood by the position information alone. If there is more than one linear topology in the network topology, and different linear topologies are also connected, the topology address information containing only position information cannot clearly represent the position of the node device in the network topology.

[0091] In some feasible embodiments, the aforementioned topology address information may further include port information, which is used to indicate the branch port of the second node device in the second linear topology connected to the first linear topology where the first node device is located.

[0092] In this embodiment, in order to clearly describe the exact location of node devices in different levels of linear topologies in the network topology, the topology address information, in addition to the location information mentioned in the above embodiment, also needs to include port information. At the same time, since the connection between different linear topologies is generally established through the branch port of one node device and the first port or second port of another node device, the port information can be used to indicate the branch port to clearly reflect the relative positional relationship of node devices in different linear topologies.

[0093] As an example, referring to Figure 3, Figure 3 provides a schematic diagram of the structure of topology address information. As shown in Figure 3, the topology address information carried in the above data packet includes location information 110 and port information 120. For a network topology that only contains a single linear topology, the topology address information only needs to include the location information field, because a single linear topology does not have an upper or lower level, so there is no need for port information to describe such connection relationships. For multi-level connections, port information is needed to describe the connection relationships between each linear topology. Taking a linear topology that includes a first level, a second level, and a third level from top to bottom as an example, the port information carried by each node device in the second level indicates a branch port of a node device in the first level. Similarly, the port information carried by each node device in the third level indicates a branch port of a node device in the second level.

[0094] As an example, this embodiment also provides a schematic diagram of another network topology as shown in Figure 4 to help understand the above embodiments. In Figure 4, the network topology includes node devices Dev1 to Dev9. Since Dev1 is connected to the external device CTL of the network topology (this reference numeral is equivalent to the abbreviation of Controller, indicating controller), Dev1 can be regarded as a non-end node device of the network topology. Dev1 can start the automatic address allocation process through the reference address information passed by the controller. When not configured, the location information and port information (branch port) of all node devices in the network topology are 0 by default, and the default value of the hierarchy is 1.

[0095] When the address transfer process spreads from Dev1 to other locations, it can be allocated according to the path for forming a linear topology set by the node device. In Figure 4, Dev1 can form a linear topology with the node devices Dev7 and Dev4 above and below it, and it can also form a linear topology with the node devices Dev2 and Dev3 to its right. This embodiment will take the formation of a linear topology of Dev1, Dev2 and Dev3 as an example for illustration.

[0096] The non-terminal node device Dev1, as the first device to pass the address, sets its own topology address information to 1. Subsequently, it passes the topology address information to the subsequent neighbor devices in the linear topology through neighbor information exchange. Each node device (Dev2 to Dev9) adds the address field of the topology address information received from the forward neighbor and forwards the new topology address information to the next neighbor device through its own secondary port. In addition, the node device Dev1 with a branch port in layer 1 will also add the branch port connected to other node devices as port information to the topology address information, and add a layer to the topology address information. This layer can be identified by an additional field and forwarded by the branch port connected to other linear topologies to the node devices Dev4 and Dev7 in layer 2.

[0097] After receiving the topology address information from the sender, the receiving node device can also send its modified new topology address information back to its neighboring device, which is the sender, to inform the sending node device that the topology address information of the receiving end has been successfully set. As shown in Figure 4, CTL sends (optional) to Dev1, and Dev1 sends 1 back to CTL; Dev1 sends 1 to Dev2, and Dev2 sends 2 back to Dev1; Dev2 sends 2 to Dev3, and Dev3 sends 3 back to Dev2; Dev1 sends 1(1),0 to Dev4. Dev4 sends 1(1),1 back to Dev1; Dev4 sends 1(1),1 to Dev5, Dev5 sends 1(1),2 back to Dev4; Dev5 sends 1(1),2 to Dev6, Dev6 sends 1(1),3 back to Dev5; Dev1 sends 1(2),0 to Dev7, Dev7 sends 1(2),1 back to Dev1; Dev7 sends 1(2),1 to Dev8, Dev8 sends 1(2),2 back to Dev7; Dev8 sends 1(1),2 to Dev9, Dev9 sends 1(2),3 back to Dev8.

[0098] In this embodiment, for the node devices Dev3, Dev6 and Dev9 located at the end of each linear topology, they will periodically send the topology address information they manage to the secondary port. This will enable the disconnected connection link to be quickly and automatically restored when a new node device is connected to the secondary port, so that the newly connected node device can generate its own unique address in the network based on the topology address information provided by the forward device, thereby achieving the effect of fast network topology access and identification of new node devices.

[0099] Based on the above embodiments, it can be seen that during address transmission, the data packet contains the following information: the order information of the node device in the current linear topology (e.g., the second "1" in "1(2),1" indicates the first device in the linear topology); and the port information at the connection between the current next-level linear topology and the previous-level linear topology (e.g., "1(2)" in "1(2),1" indicates the second branch port of the node device Dev1 with position information 1). After understanding the above information, the position of a certain node device in the network topology can be accurately described.

[0100] Furthermore, as an example, referring to Figure 5, Figure 5 provides a schematic diagram of another network topology, which shows a case where another unknown device (Dev5) is inserted into a known network topology (161 and 162). In this case, the address passing process mentioned in the above embodiments will not spread through unknown devices or unknown network segments. That is, the address passing processes of 161 and 162 do not interfere with each other, and no connection will be established between them because Dev5 is connected to Dev1 and Dev6 respectively.

[0101] In some feasible embodiments, each of the above linear topologies includes an end node device, and the device connected to the end node device through a first port belongs to the same linear topology or an adjacent linear topology.

[0102] Understandably, since the end node devices are the starting point for the address collection process, it is necessary to first determine which node devices belong to the end node devices. As an example, in a linear topology with multiple node devices, the node device at the end of the linear topology is connected to its forward neighbor device only through its first port, so this node device is the end node device of the linear topology; in a linear topology containing only one node device, this node device is connected to a branch port of a node device in an adjacent linear topology through its first port, and this node device is the only node device in its linear topology, and can also be regarded as the end node device in its linear topology.

[0103] As an example, referring to Figure 2, when node device 1 is considered a non-terminal node device, then node devices 4, 6, 8, 11, 13, and 15 belong to the terminal node devices in linear topologies 101, 102, 103, 104, 105, and 106, respectively. Node device 16 is the only node device in linear topology 107 and is also the terminal node device in linear topology 107.

[0104] In some feasible embodiments, the second port of the aforementioned terminal node device is not connected to other node devices or non-terminal node devices.

[0105] In this embodiment, the second port of the terminal node device will not establish a connection with other devices. That is, the simplest way to determine the terminal node device is to detect whether its second port is connected to other devices. Each terminal node device in Figure 2 can be determined by observing whether its second port is connected to other devices. In this case, node device 4 is connected to node device 16 through a branch port, that is, the second port of node device 4 is also not connected to other devices, which meets the judgment criteria.

[0106] In some feasible embodiments, the device connected to the terminal node device via the second port does not belong to the same linear topology as the terminal node device.

[0107] In this embodiment, even if the second port of the terminal node device establishes a connection with other devices, as long as the node device connected to the second port of the terminal node device is not in the same linear topology as the terminal node device, it will not affect the identification of the terminal node device. When the terminal node device establishes a connection with other devices through the second port, loop detection is required. If the node device connected to the terminal node device through the second port is in the same linear topology as the terminal node device, it will obviously cause the linear topology to become a ring topology, which will affect the address collection process.

[0108] As can be seen from the above embodiments, the exchange of neighbor information during the address transmission process enables the node device in the linear topology of the third branch to obtain the connection position with the node device in the linear topology of the first branch. After obtaining the topology address information, the node device also has the ability to determine whether the linear topology is connected to form a loop, and thus discover whether there is redundant connection in the network topology.

[0109] As an example, referring to Figure 6, suppose node device a and node device b in the linear topology 170 at level n are connected to node device c and node device d at level n+1 (171 to 173), respectively. Then, the loop can be checked as follows:

[0110] When node devices c and d are connected via primary and secondary ports, first check whether the topology address information of each node device (a / b) in the linear topology 170 of the nth level in the path contains the same path as its own (c / d). If so, it means that node device c is connected from node device a, that is, the topology address information of node device c contains the topology address information of node device a. Therefore, it can be inferred that node device c is connected to node device a at the nth level. Similarly, it can be inferred that node device d is connected to node b. Since the topology address information of nodes a and b in Figure 6 comes from a node device at the (n-1)th level, and the topology address information of nodes c and d both come from node device a at the nth level, it can be seen that when the topology address information of node device b connected to node device d is the same as the topology address information of node device d itself at a level less than n, it is determined that nodes a and b connected to nodes c and d are in the same linear topology. Therefore, it can be seen that nodes a, b, c, and d form a loop.

[0111] When node devices c and d are connected via a branch port, the information describing layer n in the topology address information of nodes c and d is different. This is because the topology address information of nodes c and d comes from different node devices. Specifically, the topology address information of node c carries the topology address information of node a in layer n, and the topology address information of node d carries the address information of node b in layer n. Therefore, nodes c and d only need to determine whether nodes a and b are connected to the same linear topology to determine if a loop has formed. Similarly, the topology address information of layers less than n is obtained from the topology address information of nodes c and d and compared. If they are the same, it means that a loop has been formed in layer n. Otherwise, the same mechanism can be used to continue searching for loop branches in the upper layers (n-1, n-2, etc.).

[0112] In some feasible embodiments, step S20 above may specifically include:

[0113] Step S21: Receive the branch vector obtained by at least one end node device in the network topology by collecting the n+1 level branch location address, n+1 level branch port information, n level branch device number, and n-1 level branch connection information.

[0114] In this embodiment, taking a network topology with multiple linear topologies as an example, the linear topologies at different levels can be divided into n+1 level branches, n level branches, and n-1 level branches. Among them, the n level branch can be regarded as the current linear topology, the n+1 level branch can be regarded as the linear topology at the next level above the n level branch, and the n-1 level branch can be regarded as the linear topology at the next level below the n level branch. Referring to Figure 7, the branch vector obtained by the end node device through the address collection process can include the n+1 level branch location address (141), the n+1 level branch port information (142), the number of n level branch devices (143), and the n-1 level branch connection information (144). Each linear topology branch in the network topology can be identified by a branch vector (e.g., 151, 152, 153), and the entire network topology can be described using a complete branch vector tree (150).

[0115] It should be noted that the n+1 level branch location address (141) and n+1 level branch port information (142) do not exist for network topologies with only one linear topology, because they do not establish connections with other branches, so there is no need to identify the upper level in this type of network topology.

[0116] In this embodiment, the address collection process includes collecting various structural and connection information in the network topology, as shown in Table 1 below. During the collection process, strings or tags can be used to identify the n+1 level branch location address, n+1 level branch port information, n level branch device number, and n-1 level branch connection information.

[0117] Table 1

[0118] In this embodiment, the address collection process of automatic topology scanning can be understood in conjunction with Figure 8. When a node device in the network topology finds that no information is being received on the secondary port, or the received information shows that the connected downstream device cannot be added to the current linear connection, it indicates that the node device is the end node device in the network topology, and the address collection process is triggered from the end node device.

[0119] As can be seen from the foregoing embodiments, each node device is assigned topology address information during the address transmission process, and therefore knows its own order information in the current linear topology. Thus, it can know how many node devices are in the current linear topology. At this time, if the current linear topology where the end node device is located has no next-level connection, then each end node device adds the number of branch devices (y) of its own linear topology to the n-1 level branch connection information (s) and merges them into the branch vector (ys) of the current linear topology, which is then sent forward to the neighboring devices through the main port (e.g., in layer 2(2)). Devices 1(2),3, 3 in layer 1, and 1(1),3 in layer 2(1) send 3s to their neighbors 1(2),2, 2, and 1(1),2 respectively, until the node receiving the branch vector is connected to other devices in the next lower level as a branch device (i.e., device 1 is connected to devices 2, 1(1),1 and 1(2),1 respectively). At this time, it is necessary to merge the connection vectors (3s, 3s, 3s) from all branches. Based on the field descriptions in Table 1 above, the following vector conversion steps can be obtained:

[0120] For layer 1, there are n-1 level branch connections in its linear topology, so the n-1 level branch connection information in the branch vector collected by layer 1 needs to be modified to t (that is, the 3s transmitted by device 2 is modified to 3t, as shown in the first row of Table 2 below); for the first n-1 level branch layer 2 (1) of layer 1 in layer 2, the n-1 level branch information of the connected layer 1 also needs to be added with the n+1 level branch port information. That is, when 3s in layer 2 (1) is forwarded to device 1, since its n+1 level branch location address is 1, the n+1 level branch port information is the connected port 1, and the n+1 level branch device has subsequent ports connecting other n-1 level branches, so the branch information of layer 2 (1) The information collection is 1f,3s, as shown in the second row of Table 2 below; following the same rule, since the second n-1 level branch of layer 1 in layer 2, layer 2 (2) is the n-1 level branch of the last connection of the current device 1, the branch information obtained after adding the n+1 level branch location address and n+1 level branch port information is 1e,3s, as shown in the third row of Table 2 below. At this time, device 1 adds all subsequent n-1 level branches to the topology vector of the n-level branch in order (e.g., from smallest to largest), and the topology vector tree of the current network topology (3t)-(1f,3s)-(1e,3s) can be obtained, as shown in the fourth row of Table 2 below. Thus, the construction of the topology vector tree is completed.

[0121] Table 2

[0122] At this point, the information of the topology vector tree can be stored in device 1, which is a non-terminal node device. The topology vector tree can be provided to the devices that need it, and device 1 itself can also use the topology vector tree to build the network topology.

[0123] In some feasible embodiments, the aforementioned non-terminal node devices update the topology vector tree based on a preset period.

[0124] In this embodiment, since the address collection process is implemented through neighbor information exchange, it is necessary to periodically transmit and update the current state of the network topology, and update the information of all topology vector trees to the non-terminal node devices for establishing the network topology. It is understood that the preset period can be flexibly configured according to actual needs, and this embodiment does not impose any restrictions on it.

[0125] In some feasible embodiments, the aforementioned non-terminal node devices have identifiers that refer to the topology vector tree.

[0126] In this embodiment, it should be noted that when there are unknown devices in the entire network topology, according to the address passing principle, the complete address passing behavior will start from the node device connected to the unknown device in each known network segment; at this time, the address collection operation is also carried out in each individual network segment, triggered by the terminal node device to collect branch vectors, and forwarded to the non-terminal node devices in each network segment to complete the construction of the topology vector tree; at this time, the identifiers of the non-terminal node devices in each network segment can be used to collect each network segment.

[0127] As an example, the identifier of a non-terminal node device may include at least a MAC address (Media Access Control Address), an IP address (Internet Protocol Address), a topology address, and a chassis ID (Identity document). Other information used to identify or recognize the identity of a non-terminal node device may also be used as the identifier, and this embodiment does not limit this.

[0128] This embodiment provides a method for establishing a network topology. First, non-terminal node devices obtain reference address information. Then, based on this reference address information, address transmission occurs within the network topology via neighbor information exchange. This automatically assigns topology address information to each device in the network topology, eliminating the need for individual address configuration by the controller, thus saving significant time and improving address configuration efficiency. After automatic address allocation, non-terminal node devices can receive branch vectors collected from at least one terminal node device in the network topology. This effectively scans the entire network topology and collects the topology address information of each device, avoiding the need for the controller to collect address information individually and preventing problems caused by large-scale data transmission during network topology discovery. Finally, non-terminal node devices can construct a topology vector tree based on the branch vectors to establish the network topology. The topology vector tree contains the structural information of the network topology where the non-terminal node devices are located. When an external device needs to obtain this network topology information, the non-terminal node device can transmit this information to the external device through the topology vector tree.

[0129] Furthermore, this application embodiment also provides an apparatus for establishing a network topology. Referring to FIG9, FIG9 is a structural schematic diagram of an apparatus for establishing a network topology provided in this application embodiment. As shown in FIG9, in this embodiment, the apparatus for establishing a network topology is applied to non-terminal node devices in the network topology, including a sending module 10, a receiving module 20 and a processing module 30.

[0130] The sending module 10 is used to obtain reference address information and, based on the reference address information, to transmit addresses in the network topology through neighbor information exchange.

[0131] The receiving module 20 is used to receive the branch vector obtained by the node device at at least one end of the network topology through address collection;

[0132] Processing module 30 is used to construct a topology vector tree based on the branch vectors, and the topology vector tree is used to establish the network topology.

[0133] In some feasible embodiments, the network topology includes at least one linear topology;

[0134] A linear topology includes a single node device, or multiple node devices linearly connected via a first port and a second port.

[0135] In a linear topology, a node device is connected to the second port or branch port of a non-terminal node device.

[0136] In some feasible embodiments, at the connection of linear topologies of adjacent levels, the branch port of a node device in the first linear topology is connected to the first port or the second port of a node device in the second linear topology.

[0137] In some feasible embodiments, the sending module 10 is further configured to generate data packets based on reference address information; send the data packets to neighboring node devices in the network topology through the second port and / or branch port of the non-terminal node device, so that each neighboring node device can transmit data packets in the network topology through neighbor information exchange, and assign topology address information to all node devices in the network topology respectively; wherein, the neighboring node device connects to the non-terminal node device through the first port or the second port, and the topology address information is used to identify the unique position of each node device in the network topology.

[0138] In some feasible embodiments, the topology address information includes location information, which is used to indicate the order of the node device in the linear topology it is in.

[0139] In some feasible embodiments, the topology address information also includes port information, which is used to indicate the branch port of the second node device in a second linear topology connected to the first linear topology where the first node device is located.

[0140] In some feasible embodiments, both the first linear topology and the second linear topology include an end node device, and the device connected to the end node device through the first port belongs to the same linear topology or an adjacent linear topology.

[0141] In some feasible embodiments, the second port of the end node device is not connected to other node devices or non-end node devices.

[0142] In some feasible embodiments, the device connected to the end node device via the second port does not belong to the same linear topology as the end node device.

[0143] In some feasible embodiments, the receiving module 20 is further configured to receive a branch vector obtained by a node device at least one end of the network topology by collecting n+1 level branch location addresses, n+1 level branch port information, n level branch device counts, and n-1 level branch connection information.

[0144] In some feasible embodiments, non-terminal node devices have identifiers that refer to the topology vector tree.

[0145] In some feasible embodiments, non-terminal node devices update the topology vector tree based on a preset period.

[0146] The apparatus for establishing a network topology provided in this embodiment belongs to the same technical concept as the method for establishing a network topology provided in the above embodiments. Technical details not described in detail in this embodiment can be found in any of the above embodiments. Furthermore, this embodiment has the same beneficial effects as the method for establishing a network topology applied to non-end node devices.

[0147] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0148] Furthermore, this application embodiment also provides a method for establishing a network topology. Referring to FIG10, FIG10 is a flowchart illustrating a method for establishing a network topology provided by this application embodiment. This method for establishing a network topology is applied to the end node devices in the network topology. As shown in FIG10, the method for establishing a network topology provided in this embodiment includes steps S100 and S200:

[0149] Step S100: Receive topology address information assigned by non-terminal node devices in the network topology via address transmission;

[0150] Step S200: Based on the topology address information, the branch vector is obtained by address collection. The branch vector is then sent to the non-terminal node devices so that the non-terminal node devices can construct a topology vector tree based on the branch vector. The topology vector tree is used to establish the network topology.

[0151] It is understood that the method for establishing a network topology provided in this embodiment is implemented by the terminal node device as the execution subject. Its triggering premise is the address passing process triggered by the non-terminal node device in the previous embodiment. That is, the method for establishing a network topology by the terminal node device in the network topology provided in this embodiment and the method for establishing a network topology by the non-terminal node device in the network topology provided in the above embodiments belong to the same technical concept. Technical details not described in detail in this embodiment can be referred to any of the above embodiments. Furthermore, this embodiment has the same beneficial effects as the method for establishing a network topology by the non-terminal node device in the network topology provided in the above embodiments.

[0152] In addition, this application embodiment also provides an apparatus for establishing a network topology. Referring to FIG11, FIG11 is a structural schematic diagram of an apparatus for establishing a network topology provided in this application embodiment. As shown in FIG11, in this embodiment, the apparatus for establishing a network topology is applied to the end node device in the network topology, including a receiving module 40 and a sending module 50.

[0153] The receiving module 40 is used to receive topology address information assigned by non-terminal node devices in the network topology via address transmission;

[0154] The sending module 50 is used to collect addresses based on topology address information to obtain branch vectors, and send the branch vectors to non-terminal node devices so that the non-terminal node devices can construct a topology vector tree based on the branch vectors. The topology vector tree is used to establish the network topology.

[0155] The apparatus for establishing a network topology provided in this embodiment and the method for establishing a network topology applied to the end node devices in the network topology provided in the above embodiments belong to the same technical concept. Technical details not described in detail in this embodiment can be found in any of the above embodiments. Furthermore, this embodiment has the same beneficial effects as the method for establishing a network topology applied to the end node devices in the network topology.

[0156] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0157] Furthermore, this application embodiment also provides an electronic device, wherein the above-described method for establishing a network topology using non-terminal node devices and / or terminal node devices in a network topology can be executed by a corresponding network topology establishment device, which can be implemented by software and / or hardware and integrated into the electronic device.

[0158] As an example, the electronic device can be a PC (personal computer), mobile phone, laptop, tablet computer, or other terminal device that can be set up in the network topology to establish Ethernet connections with other node devices.

[0159] Referring to Figure 12, which is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk storage device. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0160] Those skilled in the art will understand that the structure shown in FIG12 does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. As shown in FIG12, the memory 1005, as a storage medium, may include an operating system, a data storage module, a network communication module, a user interface module, and computer programs.

[0161] In the electronic device shown in Figure 12, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in this embodiment can be set in the electronic device. The electronic device calls the computer program stored in the memory 1005 through the processor 1001 and executes the method for establishing a network topology for non-end node devices or end node devices in the network topology provided in any of the above embodiments.

[0162] The electronic device proposed in this embodiment and the method for establishing a network topology using a non-terminal node device or a terminal node device in a network topology proposed in the above embodiments belong to the same technical concept. Technical details not described in detail in this embodiment can be found in any of the above embodiments, and this embodiment has the same beneficial effects as the method for establishing a network topology.

[0163] Furthermore, embodiments of this application also provide a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, storing a computer program that, when executed by a processor, implements the method for establishing a network topology provided in any of the above embodiments.

[0164] In addition, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method for establishing a network topology provided in any of the above embodiments.

[0165] The computer program product provided in this application and the method for establishing network topology proposed in the above embodiments belong to the same technical concept. Compared with related technologies, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the method for establishing network topology provided in the above embodiments, and will not be elaborated here.

[0166] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0167] In the foregoing description, specific details such as particular system architectures and techniques have been set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that the embodiments of this application can also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted to avoid unnecessary detail from obscuring the description of the embodiments of this application.

[0168] It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0169] It should also be understood that references to "one embodiment" or "some embodiments" in the specification of embodiments of this application mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0170] The above describes some implementation methods of the embodiments of this application. However, the embodiments of this application are not limited to the above implementation methods. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the embodiments of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of the embodiments of this application.

Claims

1. A method of establishing a network topology, wherein, The method for establishing a network topology is applied to non-terminal node devices in the network topology, including: Obtain reference address information, and based on the reference address information, transmit addresses in the network topology through neighbor information exchange; Receive a branch vector obtained by address collection from a node device at at least one end of the network topology; A topology vector tree is constructed based on the branch vectors, and the topology vector tree is used to establish the network topology.

2. The method of establishing a network topology of claim 1, wherein, The network topology includes at least one linear topology; The linear topology includes a single node device, or multiple node devices linearly connected through a first port and a second port; A node device in the linear topology is connected to a second port or branch port of the non-terminal node device.

3. The method for establishing a network topology as described in claim 2, wherein, At the connection point of the linear topologies in adjacent levels, the branch port of the node device in the first linear topology is connected to the first port or the second port of the node device in the second linear topology.

4. The method for establishing a network topology as described in claim 3, wherein, The step of transmitting addresses in the network topology based on the reference address information via neighbor information exchange includes: Generate data packets based on the reference address information; The data packet is sent to the neighboring node device in the network topology through the second port and / or branch port of the non-terminal node device, so that each of the neighboring node devices can transmit the data packet in the network topology through neighbor information exchange, and topology address information is assigned to all node devices in the network topology respectively; wherein, the neighboring node device is connected to the non-terminal node device through the first port or the second port, and the topology address information is used to identify the unique position of each node device in the network topology.

5. The method for establishing a network topology as described in claim 4, wherein, The topology address information includes location information, which is used to indicate the order of the node device in the linear topology it is in.

6. The method for establishing a network topology as described in claim 5, wherein, The topology address information also includes port information, which is used to indicate the branch port of the second node device in the second linear topology connected to the first linear topology where the first node device is located.

7. The method for establishing a network topology as described in claim 6, wherein, Both the first linear topology and the second linear topology include the terminal node device, and the device connected to the terminal node device through the first port belongs to the same linear topology or an adjacent linear topology as the terminal node device.

8. The method for establishing a network topology as described in claim 7, wherein, The step of receiving the branch vector obtained by address collection from at least one end node device in the network topology includes: Receive a branch vector obtained by a node device at at least one end of the network topology by collecting n+1 level branch location addresses, n+1 level branch port information, n level branch device count, and n-1 level branch connection information.

9. The method for establishing a network topology as described in any one of claims 1 to 8, wherein, The non-terminal node device has an identifier that refers to the topology vector tree.

10. A method for establishing a network topology, wherein, The method for establishing a network topology is applied to the end node devices in the network topology, including: The non-terminal node devices in the network topology receive the assigned topology address information via address transmission; Branch vectors are obtained by collecting addresses based on the topology address information, and the branch vectors are sent to the non-terminal node devices so that the non-terminal node devices can construct a topology vector tree based on the branch vectors. The topology vector tree is used to establish the network topology.

11. An apparatus for establishing a network topology, wherein, The apparatus for establishing a network topology is applied to non-terminal node devices in the network topology, including: The sending module is used to obtain reference address information and, based on the reference address information, transmit addresses in the network topology through neighbor information exchange. A receiving module, the receiving module being configured to receive a branch vector obtained by address collection from a node device at at least one end of the network topology; A processing module is configured to construct a topology vector tree based on the branch vectors, and the topology vector tree is used to establish the network topology.

12. An apparatus for establishing a network topology, wherein, The apparatus for establishing a network topology is applied to the end node devices in the network topology, including: A receiving module, which is used to receive topology address information assigned by non-terminal node devices in the network topology via address transmission; The sending module is used to collect addresses based on the topology address information to obtain branch vectors, and send the branch vectors to the non-terminal node devices so that the non-terminal node devices can construct a topology vector tree based on the branch vectors, and the topology vector tree is used to establish the network topology.

13. An electronic device, wherein, The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method for establishing a network topology as described in any one of claims 1 to 9, or the method for establishing a network topology as described in claim 10.

14. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method for establishing a network topology as described in any one of claims 1 to 9, or the method for establishing a network topology as described in claim 10.