Topology automatic generation method, device, computing device and storage medium

By pre-generating the node attribute information in the topology file, the network topology is automatically generated, which solves the problem of low efficiency of the traditional method and achieves fast and efficient topology drawing and edge generation.

CN114138246BActive Publication Date: 2024-09-24HARBIN ANTIY TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111490370.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-08
Publication Date
2024-09-24
Estimated Expiration
2041-12-08

AI Technical Summary

Technical Problem

The traditional network topology drawing method is inefficient and requires manual addition of nodes, editing node attributes and structural layout, which is inefficient.

Method used

By pre-generating topology files, including node attribute information, reading and generating node lists, determining connection relationships and location information, the network topology is automatically generated and the manual drawing process is avoided.

Benefits of technology

It improves topology drawing efficiency, reduces node attribute configuration and edge generation time, and enhances the speed and hierarchy of network topology generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114138246B
    Figure CN114138246B
Patent Text Reader

Abstract

The present invention provides a method, device, computing equipment and storage medium for automatic topology generation, wherein the method comprises: obtaining a pre-generated topology file and reading network topology data in the topology file; the network topology data at least includes node attribute information of each node; generating a node list according to the node attribute information of each node included in the network topology data; determining the connection relationship and position information of each node according to the network topology data and the node list, and generating a corresponding network topology according to the connection relationship and position information of each node. In this solution, there is no need to manually draw the network topology and then configure the node attribute information for the nodes in the network topology one by one. Instead, the node attribute information is quickly written into the topology file in advance, and the network topology can be automatically generated using the topology file, thereby improving the efficiency of topology drawing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a method, apparatus, computing device and storage medium for automatic topology generation. Background Art

[0002] Traditional network topology needs to be drawn manually, which includes adding nodes, editing node properties, adding connection relationships and structural layout, etc. It can be seen that the existing topology drawing method is inefficient. Summary of the invention

[0003] In view of the problem of low efficiency in manually drawing topology, embodiments of the present invention provide a method, apparatus, computing device and storage medium for automatically generating topology, which can improve the efficiency of topology drawing.

[0004] In a first aspect, an embodiment of the present invention provides a method for automatically generating a topology, including:

[0005] Obtaining a pre-generated topology file, and reading network topology data in the topology file; the network topology data at least includes node attribute information of each node;

[0006] Generate a node list according to the node attribute information of each node included in the network topology data;

[0007] According to the network topology data and the node list, the connection relationship and location information of each node are determined, and the corresponding network topology is generated according to the connection relationship and location information of each node.

[0008] Preferably, generating a node list according to the node attribute information of each node included in the network topology data includes:

[0009] Determining whether the network topology data includes a connection relationship between nodes;

[0010] If included, then the level of each node is calculated according to the connection relationship between the nodes, and the nodes are arranged in the order of their levels to obtain a node list;

[0011] If not included, the nodes are arranged according to the set attributes to obtain a node list.

[0012] Preferably, the step of calculating the level to which each node belongs according to the connection relationship between the nodes includes:

[0013] Determine the leaf nodes in each node according to the connection relationship between the nodes, and assign an initial level to the leaf nodes;

[0014] Determine the nodes among all nodes that are directly connected to the nodes that were assigned a level last time and have not been assigned a level, assign the level to the nodes determined this time according to the set level interval, and continue to execute this step until all nodes are assigned a level.

[0015] Preferably, the step of calculating the level to which each node belongs according to the connection relationship between the nodes includes:

[0016] Determine the leaf nodes in each node according to the connection relationship between the nodes, and assign an initial level to the leaf nodes;

[0017] The leaf nodes determined this time are stripped off, and the leaf nodes existing in the remaining nodes are determined again, and the levels to which the leaf nodes determined this time belong are assigned according to the set level interval, and this step is continued until there are no leaf nodes in the remaining nodes;

[0018] If there are still remaining nodes, the remaining nodes are assigned levels according to the levels to which the stripped leaf nodes belong.

[0019] Preferably, after generating the node list, the method further comprises: displaying the node list;

[0020] Determining the connection relationship and location information of each node according to the network topology data and the node list includes:

[0021] Based on the displayed node list, determine and display the node selected by the user in the node list;

[0022] If the network topology data includes connection relationships between nodes, determining whether there are connection relationships between the displayed nodes, and if so, displaying each connection relationship at the same time;

[0023] If the network topology data does not include a connection relationship between nodes, receiving a connection relationship input by a user for the displayed nodes;

[0024] Receive location information input by the user for the displayed node.

[0025] Preferably, before determining and displaying the node selected by the user in the node list, the method further includes:

[0026] In response to the node filtering instruction, nodes satisfying the filtering condition are displayed in the node list.

[0027] Preferably, determining the location information of each node includes:

[0028] According to the connection relationship of each node, the structural layout of the network topology is calculated to obtain the location information of each node.

[0029] In a second aspect, an embodiment of the present invention further provides a topology automatic generation device, including:

[0030] A data acquisition unit, used to acquire a pre-generated topology file and read network topology data in the topology file; the network topology data at least includes node attribute information of each node;

[0031] A node list generating unit, configured to generate a node list according to the node attribute information of each node included in the network topology data;

[0032] The network topology generating unit is used to determine the connection relationship and location information of each node according to the network topology data and the node list, and generate the corresponding network topology according to the connection relationship and location information of each node.

[0033] In a third aspect, an embodiment of the present invention further provides a computing device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.

[0034] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method described in any embodiment of this specification.

[0035] The embodiment of the present invention provides a method, device, computing device and storage medium for automatic topology generation. By pre-generating a topology file for the node attribute information of each node, when it is necessary to generate a network topology, the network topology data in the topology file can be directly read to generate a node list according to the network topology data. The connection relationship and location information can be determined based on the node list. When the connection relationship and location information are determined, the network topology can be automatically generated. It can be seen that this solution does not need to manually draw the network topology and then configure the node attribute information for the nodes in the network topology one by one. Instead, the node attribute information is quickly written into the topology file in advance, and the network topology can be automatically generated using the topology file, thereby improving the efficiency of topology drawing. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 This is a flow chart of a method for automatically generating topology provided by an embodiment of the present invention;

[0038] Figure 2 is a hardware architecture diagram of a computing device provided by an embodiment of the present invention;

[0039] Figure 3 This is a structural diagram of a topology automatic generation device provided by an embodiment of the present invention;

[0040] Figure 4 This is a structural diagram of another topology automatic generation device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0042] As mentioned above, traditional topology drawing is done manually, and the process includes adding nodes, editing node attributes, adding connection relationships and structural layout, etc. It can be seen that manual drawing is inefficient. If the topology can be automatically generated, the drawing efficiency can be greatly improved. If the relevant information in the topology (such as node attributes, connection relationships, structural layout, etc.) can be edited into a file in advance, when the topology needs to be drawn, the relevant information can be directly read from the file to automatically generate the network topology.

[0043] The specific implementation of the above concept is described below.

[0044] Please refer to Figure 1 , an embodiment of the present invention provides a method for automatically generating a topology, the method comprising:

[0045] Step 100: Obtain a pre-generated topology file and read network topology data in the topology file; the network topology data at least includes node attribute information of each node.

[0046] Step 102: Generate a node list according to the node attribute information of each node included in the network topology data.

[0047] Step 104, determining the connection relationship and location information of each node according to the network topology data and the node list, and generating a corresponding network topology according to the connection relationship and location information of each node.

[0048] In the embodiment of the present invention, by pre-generating a topology file for the node attribute information of each node, when it is necessary to generate a network topology, the network topology data in the topology file can be directly read to generate a node list according to the network topology data, and the connection relationship and position information can be determined based on the node list. When the connection relationship and position information are determined, the network topology can be automatically generated. It can be seen that this solution does not need to manually draw the network topology and then configure the node attribute information for the nodes in the network topology one by one. Instead, the node attribute information is quickly written into the topology file in advance, and the network topology can be automatically generated using the topology file, thereby improving the efficiency of topology drawing.

[0049] Described below Figure 1 How the various steps are performed.

[0050] First, with respect to step 100 , a pre-generated topology file is obtained, and network topology data in the topology file is read; the network topology data at least includes node attribute information of each node.

[0051] In order to be able to read the network topology data in the topology file, the topology file needs to meet the set format, and the network topology data in the topology file needs to be encoded according to the defined fields. In one embodiment of the present invention, the format of the topology file is json format, and the fields may include nodes field and lines field. Among them, the nodes field is used to represent the node attribute information, such as key represents the unique identifier of the node, value represents the node type, etc.; the lines field is used to represent the connection relationship between nodes, each item is an array, representing a connection relationship, and the array includes two items, which are the unique identifiers of the nodes connected at both ends of the edge. The encoding content of the network topology data is exemplified as follows:

[0052]

[0053]

[0054] It should be noted that the network topology data at least includes node attribute information of each node, and optionally, may also include connection relationships between nodes.

[0055] When the node attribute information and connection relationship of each node in the network topology under real circumstances are known, it can be quickly edited in the topology file to obtain a topology file containing the node attribute information and connection relationship of each node. It can be seen that this solution can be edited directly in the topology file according to the set fields, while manually drawing the network topology requires first drawing the network topology, and then turning on the configuration function for each node in the network topology one by one to configure the node attribute information. Compared with the manual method, the configuration speed of the node attribute information is greatly improved. In addition, if the connection relationship of each node is directly generated in the topology file, when the network topology is automatically generated later, the connection edges can be automatically generated directly according to the connection relationship between the nodes. Compared with the method of manually drawing the network topology and adding the connection edges one by one, the speed of edge generation is greatly improved.

[0056] Then, for step 102, a node list is generated according to the node attribute information of each node included in the network topology data.

[0057] Since the network topology contains the connection relationship between nodes, in order to better analyze the relationship between each node in the network topology, it is necessary to display the network topology on the topology display platform. Therefore, after obtaining the topology file, the topology file can be imported into the topology display platform, and then the parsing module in the topology display platform can be used to read the network topology data in the topology file and parse it.

[0058] In order to more intuitively reflect the nodes included in the network topology, they can be displayed in the form of a node list. Therefore, after the node list is generated, it is also necessary to display the node list.

[0059] In one embodiment of the present invention, in step 102, the node list may be generated through the following steps S1-S3:

[0060] S1. Determine whether the network topology data includes the connection relationship between the nodes. If yes, execute S2; if no, execute S3.

[0061] Whether the connection relationship between nodes is included can be determined according to whether the lines field is included in the network topology data.

[0062] S2. According to the connection relationship between the nodes, the level of each node is calculated, and the nodes are arranged in order of their levels to obtain a node list.

[0063] If the network topology data includes the connection relationship between nodes, then the level of each node can be calculated in at least two ways:

[0064] Method 1: Ignore the ring network structure and assign the level directly based on the connection relationship.

[0065] Method 2: Considering the ring network structure, the nodes outside the ring network structure and the nodes inside the ring network structure are assigned respective levels.

[0066] The above two methods are described below respectively.

[0067] In method 1, since the ring network structure is not considered, the level can be assigned directly according to the connection relationship. Specifically, S21, based on the connection relationship between the nodes, the leaf nodes in each node are determined, and the initial level is assigned to the leaf nodes; S22, the nodes in each node that are directly connected to the nodes that were assigned a level last time and have not been assigned a level are determined, and the levels of the nodes determined this time are assigned according to the set level interval, and step S22 is continued until all nodes are assigned a level.

[0068] The set level interval may be +1. For example, if the initial level of a leaf node is 0, then the nodes directly connected to the leaf node and not assigned a level are assigned a level of 1, and so on.

[0069] In method 1, the level to which each node belongs can be quickly calculated.

[0070] In the second method, since the ring network structure is taken into consideration, it is necessary to assign the levels to the nodes outside the ring network structure and the nodes inside the ring network structure respectively.

[0071] When assigning levels to nodes outside the ring network structure, specifically, S23, determine the leaf nodes in each node based on the connection relationship between the nodes, and assign the initial level to the leaf nodes; S24, peel off the leaf nodes determined this time, and determine the leaf nodes existing in the remaining nodes again, assign the levels to the leaf nodes determined this time according to the set level interval, and continue this step until there are no leaf nodes in the remaining nodes; similarly, the set level interval can be +1.

[0072] When assigning levels to nodes within the ring network structure, if there are still remaining nodes after S24, the remaining nodes are assigned levels according to the levels of the stripped leaf nodes. Specifically, the remaining nodes after S24 are the ring network structure, and the nodes in the ring network structure that are directly connected to the stripped leaf nodes are all determined as root nodes, and the maximum level in the root nodes is determined as the level of all root nodes, and the nodes in the ring network structure are divided into several layers, and on the basis of the root nodes, according to the layers to which the non-root nodes belong, the non-root nodes in the ring network structure are assigned corresponding levels layer by layer according to the set level intervals.

[0073] In the second method, each node level in the network topology can be made closer to the actual situation, and the layering effect is more ideal.

[0074] Regardless of the above method 1 or method 2, after calculating the level to which each node belongs, each node can be arranged in order of level height to obtain a node list. Preferably, if the leaf node belongs to the lowest level, each node will be arranged in order from high to low levels, otherwise, each node will be arranged in order from low to high levels.

[0075] In this embodiment, by arranging each node in the node list according to the level to which it belongs, the hierarchical relationship between the nodes can be known. When the position of the nodes needs to be adjusted, the position of the nodes can be adjusted in a small area layer by layer according to the level to which they belong. The positions of the nodes belonging to the same level can be adjusted together so that the nodes of the same level can be deployed in the same area, making the layout of the network topology more hierarchical and facilitating the analysis of the relationships between the nodes in the network topology.

[0076] S3. Arrange each node according to the set attributes to obtain a node list.

[0077] Since the network topology data does not include the connection relationship between nodes, the nodes can be arranged according to the set attributes, which can be: the order of node identification, the device type corresponding to the node, the network segment of the node IP address, the business department to which the node belongs, etc.

[0078] In this embodiment, by arranging the nodes in the node list according to the set attributes, the user can increase the edges between nodes based on the nodes with the same attributes, and can deploy the positions of the nodes with the same attributes, so that the user can start with grouping different attribute values ​​of the set attributes and configure the edges and positions of the nodes within a small area.

[0079] Finally, for step 104, the connection relationship and location information of each node are determined according to the network topology data and the node list, and the corresponding network topology is generated according to the connection relationship and location information of each node.

[0080] When determining the connection relationship and location information of each node, this step may specifically include: based on the displayed node list, determining and displaying the node selected by the user in the node list; if the network topology data includes the connection relationship between each node, determining whether there is a connection relationship between the displayed nodes, and if so, displaying each connection relationship at the same time; if the network topology data does not include the connection relationship between each node, receiving the connection relationship input by the user for the displayed node; receiving the location information input by the user for the displayed node.

[0081] If you need to adjust the position of each node to obtain the position information, you can select a node from the node list based on the displayed node list, and then add the selected node to the editing interface of the topology display platform. If it is determined based on the network topology data that the selected node has a connection relationship, the connection relationship between the displayed nodes also needs to be displayed. If the network topology data does not include the connection relationship between the nodes, the user needs to enter the connection relationship for the displayed nodes, that is, add edges to the nodes in the editing interface.

[0082] The positional relationship of each node is adjusted in the editing interface, so that the position information input for each node can be obtained.

[0083] It should be noted that when selecting nodes in the node list, you can select them individually or in batches. If you cancel the selection operation in the node list, you can delete the node from the editing interface.

[0084] Furthermore, when the selected nodes are displayed in the editing interface, each selected node may be displayed at a set interval.

[0085] Furthermore, based on the node list, a node in the editing interface can be determined as a parent node, and the child node adding mode can be turned on, with the subsequently selected node as the child node. When displayed in the editing interface, the connection edge between the child node and the corresponding parent node is automatically generated.

[0086] In one embodiment of the present invention, each node displayed in the node list may also be displayed as required, specifically, it may include: in response to a node filtering instruction, displaying nodes that meet the filtering condition in the node list.

[0087] For example, the node screening instruction may be to search for nodes based on the input field as a screening condition, so as to display the nodes satisfying the field in the node list, and may support both forward and reverse order display.

[0088] Furthermore, the node filtering instruction can also be used to filter nodes of types such as hosts, servers, file servers, mail servers, terminal servers, routers, switches, firewalls, notebooks, network clouds, mobile devices, etc., so as to display the nodes that meet the filtering conditions in the node list, so that the node list is displayed according to actual needs.

[0089] Furthermore, each node can be displayed in the node category with field information such as asset name, asset number, asset type, responsible person, IP, MAC, CPU, memory, hard disk, graphics card, network card, gateway, DNS, operating system, application software, etc.

[0090] The development of the above functions of the node list can facilitate users to configure the edges or positions of nodes that meet their needs, making the automatic generation process of the network topology more flexible and improving the user experience.

[0091] In the editing interface, the location information of each node can be obtained by laying out each node in the interface, and the network topology can be generated based on the connection relationship and location information of each node.

[0092] In one embodiment of the present invention, in order to ensure that the generated network topology is more hierarchical and can better reflect the relationship between each node, the structural layout of the network topology can also be automatically calculated according to the connection relationship between each node to obtain the location information of each node.

[0093] When the network topology data does not include the connection relationship of each node, the connection relationship of each node is determined according to the connection edges entered by the user on the editing interface, and then the location information of each node is calculated using the connection relationship of each node; if the network topology data includes the connection relationship of each node, the location information of each node can be directly calculated using the connection relationship.

[0094] When calculating the position information of each node, we first need to determine the level to which each node belongs. Then, based on the level, the nodes of the same level are arranged in a matrix on the same two-dimensional plane to obtain the two-dimensional coordinate position of each node. Finally, different heights are configured for nodes of different levels. For example, node height = node level * h, where h is a fixed height. This allows us to obtain the three-dimensional coordinate position of each node.

[0095] It should be noted that the method for determining the level to which each node belongs can be determined based on the method 1 or the method 2 in the above step 102, and this step will not be repeated.

[0096] After determining the connection relationship and three-dimensional coordinate position of each node, the connection relationship and the three-dimensional coordinate position can be updated together to the topology file, so that when the topology file is used to generate the network topology later, the network topology can be directly generated according to the node attribute information, connection relationship and three-dimensional coordinate position in the topology file, without repeated configuration and calculation, which can not only reduce the waste of resources but also improve the generation speed of the network topology.

[0097] like Figure 2 , Figure 3 As shown, an embodiment of the present invention provides a topology automatic generation device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, Figure 2 As shown, it is a hardware architecture diagram of a computing device where a topology automatic generation device provided by an embodiment of the present invention is located, except Figure 2In addition to the processor, memory, network interface, and non-volatile memory shown in the figure, the computing device in which the device is located in the embodiment may also generally include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 3 As shown, as a device in a logical sense, the CPU of the computing device in which it is located reads the corresponding computer program in the non-volatile memory into the memory and runs it. This embodiment provides a topology automatic generation device, including:

[0098] The data acquisition unit 301 is used to acquire a pre-generated topology file and read the network topology data in the topology file; the network topology data at least includes node attribute information of each node;

[0099] A node list generating unit 302, configured to generate a node list according to the node attribute information of each node included in the network topology data;

[0100] The network topology generating unit 303 is used to determine the connection relationship and location information of each node according to the network topology data and the node list, and generate a corresponding network topology according to the connection relationship and location information of each node.

[0101] In one embodiment of the present invention, the node list generating unit 302 is specifically used to determine whether the network topology data includes the connection relationship between each node; if included, the level of each node is calculated according to the connection relationship between each node, and each node is arranged in order of the level to which each node belongs to obtain a node list; if not included, each node is arranged according to the set attributes to obtain a node list.

[0102] In one embodiment of the present invention, when the node list generation unit 302 calculates the level of each node according to the connection relationship between the nodes, it is specifically used to determine the leaf nodes in each node according to the connection relationship between the nodes, and assign an initial level to the leaf nodes; determine the nodes in each node that are directly connected to the nodes that were assigned a level last time and have not been assigned a level, assign a level to the nodes determined this time according to the set level interval, and continue to execute this step until all nodes are assigned a level.

[0103] In one embodiment of the present invention, when the node list generation unit 302 calculates the level to which each node belongs based on the connection relationship between the nodes, it is specifically used to determine the leaf nodes in each node based on the connection relationship between the nodes, and assign initial levels to the leaf nodes; the leaf nodes determined this time are stripped off, and the leaf nodes existing in the remaining nodes are determined again, and the levels determined this time are assigned according to the set level interval, and this step is continued until there are no leaf nodes in the remaining nodes; if there are still remaining nodes, the levels are assigned to the remaining nodes according to the levels to which the stripped leaf nodes belong.

[0104] In one embodiment of the present invention, please refer to Figure 4 , the topology automatic generation device may further include: a display unit 304, used to display the node list;

[0105] When the node list generating unit 302 determines the connection relationship and location information of each node according to the network topology data and the node list, it is specifically used to determine and trigger the display unit 304 to display the node selected by the user in the node list based on the displayed node list; and when it is determined that the network topology data includes the connection relationship between each node, it is determined whether there is a connection relationship between the displayed nodes, and if so, each connection relationship is displayed at the same time; when it is determined that the network topology data does not include the connection relationship between each node, the connection relationship input by the user for the displayed node is received; and the location information input by the user for the displayed node is received.

[0106] In one embodiment of the present invention, the display unit 304 is further configured to display nodes satisfying the filtering condition in the node list in response to the node filtering instruction.

[0107] In one embodiment of the present invention, when determining the location information of each node, the network topology generation unit 303 is specifically used to calculate the structural layout of the network topology according to the connection relationship of each node to obtain the location information of each node.

[0108] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on a topology automatic generation device. In other embodiments of the present invention, a topology automatic generation device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0109] The information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.

[0110] An embodiment of the present invention further provides a computing device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, a method for automatically generating a topology in any embodiment of the present invention is implemented.

[0111] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes a method for automatically generating a topology in any embodiment of the present invention.

[0112] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can read and execute the program code stored in the storage medium.

[0113] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0114] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0115] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0116] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0117] Each embodiment of the present invention has at least the following beneficial effects:

[0118] 1. In one embodiment of the present invention, a topology file is generated in advance for the node attribute information of each node. When the network topology needs to be generated, the network topology data in the topology file can be directly read to generate a node list according to the network topology data. The connection relationship and position information can be determined based on the node list. When the connection relationship and position information are determined, the network topology can be automatically generated. It can be seen that this solution does not need to manually draw the network topology and then configure the node attribute information for the nodes in the network topology one by one. Instead, the node attribute information is quickly written into the topology file in advance, and the network topology can be automatically generated using the topology file, thereby improving the efficiency of topology drawing.

[0119] 2. In one embodiment of the present invention, the topology file can be edited directly according to the set fields. When manually drawing the network topology, the network topology needs to be drawn first, and then the configuration function is enabled for each node in the network topology one by one to configure the node attribute information. Compared with the manual method, the configuration speed of the node attribute information is greatly improved. In addition, if the connection relationship of each node is directly generated in the topology file, when the network topology is automatically generated later, the connection edge can be automatically generated directly according to the connection relationship between the nodes. Compared with the method of manually drawing the network topology and adding the connection edge one by one, the speed of edge generation is greatly improved.

[0120] 3. In one embodiment of the present invention, when the ring network structure is not considered, the level can be directly assigned according to the connection relationship, and the calculation speed is faster; when the ring network structure is considered, the nodes outside the ring network structure and the nodes inside the ring network structure are respectively assigned levels, which can make the levels of each node in the network topology closer to the actual situation and the layering effect more ideal.

[0121] 4. In one embodiment of the present invention, the development of a node list screening function can facilitate users to configure edges or positions of nodes that meet their needs, making the automatic generation process of network topology more flexible and improving user experience.

[0122] 5. In one embodiment of the present invention, after the connection relationship and three-dimensional coordinate position of each node are determined, the connection relationship and the three-dimensional coordinate position can be updated together to the topology file, so that when the topology file is used to generate the network topology later, the network topology can be directly generated according to the node attribute information, connection relationship and three-dimensional coordinate position in the topology file, without repeated configuration and calculation, which can not only reduce the waste of resources but also improve the generation speed of the network topology.

[0123] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical factors in the process, method, article or device including the elements.

[0124] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for automatically generating a topology, characterized in that: include: Obtain a pre-generated topology file and read the network topology data in the topology file; The network topology data at least includes node attribute information of each node; Determine whether the network topology data includes the connection relationship between the nodes; if included, calculate the level of each node according to the connection relationship between the nodes, and arrange the nodes in the order of the level to which they belong to obtain a node list; if not included, arrange the nodes according to the set attributes to obtain a node list; Determine the connection relationship and location information of each node according to the network topology data and the node list, and generate a corresponding network topology according to the connection relationship and location information of each node; The step of calculating the level of each node according to the connection relationship between the nodes includes: Determine the leaf nodes in each node according to the connection relationship between the nodes, and assign an initial level to the leaf nodes; Determine the nodes among all nodes that are directly connected to the nodes that were assigned a level last time and have not been assigned a level, assign the level to the nodes determined this time according to the set level interval, and continue to perform this step until all nodes are assigned a level; or, The step of calculating the level of each node according to the connection relationship between the nodes includes: Determine the leaf nodes in each node according to the connection relationship between the nodes, and assign an initial level to the leaf nodes; The leaf nodes determined this time are stripped off, and the leaf nodes existing in the remaining nodes are determined again, and the levels to which the leaf nodes determined this time belong are assigned according to the set level interval, and this step is continued until there are no leaf nodes in the remaining nodes; If there are still remaining nodes, the remaining nodes are assigned levels according to the levels to which the stripped leaf nodes belong.

2. The method according to claim 1, characterized in that After generating the node list, the method further includes: displaying the node list; Determining the connection relationship and location information of each node according to the network topology data and the node list includes: Based on the displayed node list, determine and display the node selected by the user in the node list; If the network topology data includes connection relationships between nodes, determining whether there are connection relationships between the displayed nodes, and if so, displaying each connection relationship at the same time; If the network topology data does not include a connection relationship between nodes, receiving a connection relationship input by a user for the displayed nodes; Receive location information input by the user for the displayed node.

3. The method according to claim 2, characterized in that Before determining and displaying the node selected by the user in the node list, the method further includes: In response to the node filtering instruction, nodes satisfying the filtering condition are displayed in the node list.

4. The method according to any one of claims 1 to 3, characterized in that: Determine the location information of each node, including: According to the connection relationship of each node, the structural layout of the network topology is calculated to obtain the location information of each node.

5. A topology automatic generation device, characterized in that: include: A data acquisition unit, used to acquire a pre-generated topology file and read the network topology data in the topology file; The network topology data at least includes node attribute information of each node; A node list generating unit is used to determine whether the network topology data includes the connection relationship between the nodes; if it does, the level of each node is calculated according to the connection relationship between the nodes, and the nodes are arranged in the order of the level to which each node belongs to obtain a node list; if it does not include, the nodes are arranged according to the set attributes to obtain a node list; A network topology generating unit, configured to determine the connection relationship and location information of each node according to the network topology data and the node list, and generate a corresponding network topology according to the connection relationship and location information of each node; When calculating the level of each node according to the connection relationship between each node, the node list generation unit is specifically used to: determine the leaf nodes in each node according to the connection relationship between each node, and assign the initial level to the leaf nodes; determine the nodes in each node that are directly connected to the nodes that were assigned a level last time and have not been assigned a level, assign the level to the nodes determined this time according to the set level interval, and continue to perform this step until all nodes are assigned a level; or, When the node list generation unit calculates the level to which each node belongs based on the connection relationship between the nodes, it is specifically used to: determine the leaf nodes in each node based on the connection relationship between the nodes, and assign initial levels to the leaf nodes; strip off the leaf nodes determined this time, and again determine the leaf nodes existing in the remaining nodes, and assign levels to the leaf nodes determined this time according to the set level interval, and continue this step until there are no leaf nodes in the remaining nodes; if there are still remaining nodes, assign levels to the remaining nodes according to the levels to which the stripped leaf nodes belong.

6. The device according to claim 5, characterized in that The device also includes: A display unit, used to display the node list; When the node list generating unit determines the connection relationship and location information of each node according to the network topology data and the node list, it is specifically used to: determine and trigger the display unit to display the node selected by the user in the node list based on the displayed node list; and when it is determined that the network topology data includes the connection relationship between each node, determine whether there is a connection relationship between the displayed nodes, and if so, display each connection relationship at the same time; when it is determined that the network topology data does not include the connection relationship between each node, receive the connection relationship input by the user for the displayed node; and receive the location information input by the user for the displayed node.

7. The device according to claim 6, characterized in that The display unit is further configured to display nodes satisfying the screening condition in the node list in response to the node screening instruction.

8. The device according to any one of claims 5 to 7, characterized in that: When determining the location information of each node, the network topology generation unit is specifically used to: calculate the structural layout of the network topology according to the connection relationship of each node to obtain the location information of each node.

9. A computing device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 4.