Network topological graph generation method and device and terminal equipment
Through automated methods, we determine the topology model, acquire the equipment model, generate hierarchical layouts and connect the equipment model, solving the problem of the large-scale industrial network topology structure that consumes a lot of manpower and time costs, and realizes rapid generation and flexible network topology diagrams.
Patent Information
- Application Number
- CN202311745860.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-19
- Publication Date
- 2025-06-27
AI Technical Summary
Mapping large-scale industrial network topology requires a lot of labor and time costs.
By determining the topology model, obtaining the target device model, generating a hierarchical layout, and connecting the device model according to the connection rules, automatically generating a network topology diagram.
It realizes rapid generation of network topology graphs, reduces labor and time costs, and improves the flexibility of generating graphs.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of industrial network management, and particularly relates to a method, device, and terminal device for generating a network topology diagram. Background Art
[0002] With the rapid development of informatization and digitalization, the number of network devices and information traffic in industrial network systems are increasing, and the network is becoming more and more complex, making it gradually more difficult for operation and maintenance personnel to maintain network security.
[0003] Currently, in order to maintain network security, operation and maintenance personnel usually need to manually create large-scale network topologies for network attack and defense drills to maintain the security of industrial network systems.
[0004] However, when the scale of the network topology of an industrial network system is large, drawing the network topology will consume a large amount of manpower and time costs. Summary of the Invention
[0005] Embodiments of this application provide a method, device, terminal device, and storage medium for generating a network topology diagram, which can solve the problem that drawing a network topology will consume a large amount of manpower and time costs.
[0006] In a first aspect, embodiments of this application provide a method for generating a network topology diagram, the method including: Determine a topology model corresponding to the network topology diagram to be generated; According to the topology information of the topology model, obtain multiple target device models from a preset knowledge base; the topology information includes the topology level of the topology model and the total number of each target device model; the knowledge base includes multiple network device models, the topology level of each network device model, and the connection rules between network device models; Based on the topology level and the total number of each target device model, generate a hierarchical layout of all target device models; Connect all target device models according to the connection rules and the hierarchical layout to generate a network topology diagram.
[0007] In a second aspect, embodiments of this application provide a device for generating a network topology diagram, the device including: A first determination module, configured to determine a topology model corresponding to the network topology diagram to be generated; An acquisition module, configured to obtain multiple target device models from a preset knowledge base according to the topology information of the topology model; the topology information includes the topology level of the topology model and the total number of each target device model; the knowledge base includes multiple network device models, the topology level of each network device model, and the connection rules between network device models; The first generation module is used to generate a hierarchical layout of all target device models based on the topological level and the total number of each type of target device model. The second generation module is used to connect all target device models according to the connection rules and the hierarchical layout to generate a network topology diagram.
[0008] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method according to the first aspect above is implemented.
[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to the first aspect above is implemented.
[0010] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device is enabled to execute the method according to the first aspect above.
[0011] The beneficial effects of the embodiments of the present application compared with the prior art are as follows: The terminal device can select target device models corresponding to the topological level and quantity from a preset knowledge base according to the topological level in the topological model corresponding to the network topology diagram and the total number of each type of target device model in the generated network topology diagram this time. Then, based on the topological level and the total number of each type of target device model, each type of target device model can be respectively arranged in each corresponding topological level to generate a hierarchical layout of all target device models. Finally, based on the connection rules between network device models and the hierarchical layout, each target device model is connected to automatically generate a network topology diagram. Furthermore, by using the above method, the rapid generation of the network topology diagram can be realized according to the topological model, and the generated network topology diagram can be obtained according to requirements, improving the flexibility of the generated network topology diagram. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0013] Figure 1 is a flowchart of the implementation of a network topology diagram generation method provided by an embodiment of the present application; Figure 2 is a schematic diagram of an application scenario of a hierarchical layout provided by an embodiment of the present application; Figure 3It is a schematic diagram of an implementation manner for generating a network topology diagram in a network topology diagram generation method provided by an embodiment of the present application; Figure 4 It is a schematic diagram of an application scenario of a network topology diagram provided by another embodiment of the present application; Figure 5 It is a flowchart of an implementation of a network topology diagram generation method provided by another embodiment of the present application; Figure 6 It is a schematic diagram of an application scenario of a network topology diagram provided by yet another embodiment of the present application; Figure 7 It is a schematic diagram of the structure of a network topology diagram generation device provided by an embodiment of the present application; Figure 8 It is a schematic diagram of the structure of a terminal device provided by an embodiment of the present application. Embodiment
[0014] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are presented to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.
[0015] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0016] In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0017] With the rapid development of informatization digitization, the number of network devices and information traffic are increasing, and the network is becoming more and more complex, making it gradually more difficult for operation and maintenance personnel to maintain network security.
[0018] Currently, in order to maintain the security of industrial network systems, operation and maintenance personnel usually need to manually create large-scale network topologies for network attack and defense drills to maintain network security. Among them, the network topology can be used to describe the physical layout of various network devices interconnected by transmission media. For example, in what way to connect each network device (such as computer devices) in the network.
[0019] Exemplarily, in the field of industrial control, for industrial network devices with high complexity and large scale, it may be necessary to render thousands or tens of thousands of nodes to represent the network devices, and manually draw the connections between each node to generate the network topology of the industrial network system.
[0020] However, the above method of manually drawing the network topology requires a large amount of human and time costs.
[0021] Based on this, in order to reduce the human and time costs, the embodiments of the present application provide a method for generating a network topology diagram, which can be applied to terminal devices such as tablet computers, notebook computers, Ultra-Mobile Personal Computers (UMPCs), and netbooks. The embodiments of the present application do not impose any restrictions on the specific types of terminal devices.
[0022] Please refer to Figure 1 , Figure 1 which shows an implementation flowchart of a method for generating a network topology diagram provided by the embodiments of the present application. The method includes the following steps: S101. Determine the topology model corresponding to the network topology diagram to be generated.
[0023] In one embodiment, multiple topology models may be pre-stored in the terminal device or the server. Among them, each topology model corresponds to an identifier respectively. At this time, the terminal device can determine the topology model consistent with the identifier from the internal memory of the terminal device or the server according to the identifier input by the operation and maintenance personnel. Among them, the identifier can be used to represent the industry field corresponding to the topology model.
[0024] In another embodiment, the terminal device can also determine the topology model corresponding to the network topology diagram to be generated from multiple topology models according to the operation instruction of the operation and maintenance personnel. In this embodiment, the method for determining the topology model is not limited.
[0025] It should be noted that when the operation and maintenance personnel pre-construct the topology model, the topology information of the topology model can be defined. For example, define the topology level, expansion attributes, and topology scale of the topology model.
[0026] Among them, in the field of industrial control, the topological levels include but are not limited to the device layer, the control layer, the process layer, the Manufacturing Execution System (MES) layer, the enterprise management layer, and the corresponding network device modules or security devices for each layer. The extended attributes include but are not limited to the communication methods of network devices, the requirements of industry fields (such as industries, power, oil, steel, and transportation), and application scenarios (such as product testing, technical verification, and attack and defense drills). There is no limitation on this. The topological scale can be divided into scales such as the number of network devices being in the hundreds, thousands, and tens of thousands.
[0027] S102. According to the topological information of the topological model, obtain multiple target device models from a preset knowledge base; the topological information includes the topological levels of the topological model and the total quantity of each target device model; the knowledge base includes multiple network device models, the topological levels of each network device model, and the connection rules between network device models.
[0028] In one embodiment, the above knowledge base may be pre-stored with general network device models for each industry field, special network device models for each industry field, and device information of each network device model. Among them, the device information includes but is not limited to the hierarchical level to which the network device model belongs, and the connection relationship between network device models at each level.
[0029] In one embodiment, since the topological information includes topological levels, the terminal device can obtain each matching target device model from the knowledge base according to the topological levels.
[0030] It should be noted that when there are network device models corresponding to multiple industry fields or multiple communication methods in the knowledge base, it is also necessary to determine the target device model based on the identifier, communication method, and level of the topological model. There is no limitation on this.
[0031] In one embodiment, the above total quantity is the quantity required for each target device model when generating a network topology diagram. Among them, this total quantity can also be adjusted according to the actual situation.
[0032] It should be particularly noted that one network device model can correspond to multiple topological levels at the same time. Exemplarily, for a computer device model, it can be used in multiple levels such as the device layer, the control layer, and the process layer. Therefore, the relationship between the network device model and the topological level is one-to-one or one-to-many.
[0033] S103. Based on the topological levels and the total quantity of each target device model, generate a hierarchical layout of all target device models.
[0034] In one embodiment, after obtaining each target device model, the target device models corresponding to each topology level can be distributed in various topology levels in the topology model according to the topology level and the level to which the target device model belongs.
[0035] However, when the level to which the target device model belongs corresponds to multiple topology levels, if the target device models are randomly distributed in the corresponding topology levels, the number of target device models included in a certain topology level may be small. Furthermore, the finally generated network topology diagram does not conform to the actual situation.
[0036] Based on this, for any target device model, the terminal device can first determine the number of levels in which the target device model needs to be distributed in the topology level. Then, calculate the first average value of the total number and the number of levels, and evenly distribute the target device models in the corresponding topology levels according to the first average value to generate a hierarchical layout.
[0037] It can be understood that determining the number of target device models in the corresponding topology level based on the above method can balance the number of corresponding target device models in each topology level.
[0038] It should be noted that when the total number cannot be evenly distributed completely, the ratio and remainder of the total number and the number of levels can be calculated. Then, determine the ratio as the first average value and evenly distribute the target device models. In addition, randomly distribute the target device models corresponding to the remainder in the topology levels that need to be distributed.
[0039] In a specific embodiment, the types of target device models include various models such as switching device models, three-layer network device models, and industry device models. Among them, the topology levels in the topology model can include an intermediate layer and at least two non-intermediate layers. And, the intermediate layer is used to distribute three-layer network device models, and each non-intermediate layer is used to distribute switching device models and industry device models. In this way, a hierarchical layout of all target device models is generated.
[0040] In one embodiment, the above three-layer network device models include, but are not limited to, models corresponding to firewalls or routers. The above switching device model can be a model corresponding to a telephone switch or a routing switch, and this is not limited. The above industry device models include, but are not limited to, models corresponding to computer devices, hosts, or servers, and this is not limited.
[0041] Specifically, referring to Figure 2 , Figure 2 is a schematic diagram of an application scenario of a hierarchical layout provided by an embodiment of the present application. Among them, the topology level includes two intermediate layers and three non-intermediate layers. Among them, the three non-intermediate layers are the process layer, the control layer, and the device layer respectively. Figure 2Among them, two three-layer network device models are distributed in the middle layer 1, and one three-layer network model is distributed in the middle layer 2. One or two switching device models and multiple industry device models are distributed in each non-middle layer.
[0042] Based on Figure 2 It can be known that the switching device model, the three-layer network device model, and the industry device model can all be distributed in multiple topological levels. At this time, for the switching device model, its total number is 5, and the number of topological levels to be distributed is 3. Based on this, the ratio of the total number 5 to the number of levels 3 is 1, and the remainder is 2. Therefore, at least one switching device model can be distributed in each topological level, and the remaining two switching device models are randomly assigned.
[0043] Among them, the distribution methods of the three-layer network device model and the industry device model are similar to that of the switching device model, and will not be described herein.
[0044] S104. Connect all target device models according to the connection rules and hierarchical layout to generate a network topology diagram.
[0045] In one embodiment, after each target device model is distributed in the corresponding topological level, the target device models in each topological level need to be connected to simulate the communication between the target device models. Therefore, for different types of target device models in different topological levels, their connection rules are usually related to the communication methods of the target device models.
[0046] Exemplarily, the switching device model can be used to converge the communication information of each industry device model in the same topological level. And, the switching device model can also communicate and interact with the three-layer network device model. Also, the three-layer network device model can forward the information output by the switching device model across network segments to the switching device models in other topological levels. Then, it is sent by the switching device models in other topological levels to other industry device models in the same topological level. Thus, the industry device models in different topological levels can achieve communication.
[0047] However, in another embodiment, if the number of switching device models distributed in any non-middle layer is multiple, or if the number of three-layer network device models distributed in the middle layer is multiple, the connections between the industry device models, the switching device models, and the three-layer network device models will become chaotic.
[0048] Based on this, in order to reduce the wire crossings in the network topology diagram, the terminal device can connect all target device models through steps S301 - S303 as shown in Figure 3 as follows: S301. For any non-middle layer, if there are multiple numbers of switching device models, calculate the second average value of the first number of industry device models and the second number of switching device models in the non-middle layer, and connect the industry device models and the switching device models evenly according to the second average value.
[0049] In one embodiment, connecting the industry device models and the switching device models evenly according to the second average value can be considered as evenly distributing the numbers of all industry device models in the non-middle layer, and each switching device model is respectively connected to the industry device models with the second average value. Furthermore, the problem of continuous chaos and imbalance of each switching device model in each topological hierarchy can be reduced.
[0050] It should be added that when the first number cannot be evenly distributed completely, the ratio and remainder of the first number and the second number can be calculated. Then, the ratio is determined as the second average value, and the industry device models and the switching device models are connected for even distribution. And, the industry device models corresponding to the remainder are randomly connected to any switching device model.
[0051] Specifically, referring to Figure 4 , Figure 4 is a schematic diagram of an application scenario of a network topology diagram provided by another embodiment of the present application. From Figure 4 it can be seen that each switching device model in the control layer is connected to 3 industry network device models; in the process layer and the device layer, the ratio of the first number to the second number is 2, and the remainder is 1. Therefore, one of the switching device models is connected to 3 industry device models, and the other switching device model is connected to 2 industry device models. That is, in the process layer, the control layer, and the device layer, the numbers of industry device models connected to each switching device model are almost balanced.
[0052] In another embodiment, in order to further optimize the problem of chaotic wiring of each switching device model, for any non-middle layer, all industry device models connected to the same switching device model can also be distributed on one side of the switching device model. For example, referring to Figure 4 , from Figure 4 it can be seen that the position of the switching device model is in the central area of the non-middle layer, and all industry device models connected to the same switching device model are distributed on the same side of the switching device model. Furthermore, in the same topological hierarchy, there will be no problem of wire crossing for the industry device models connected to different switching device models. For example, referring to Figure 4 , the wires corresponding to all industry device models connected to switching device model A will not cross the wires corresponding to all industry device models connected to switching device model B.
[0053] S302. Control each non-middle-layer switching device model to be connected to the three-layer network device model of the adjacent middle layer.
[0054] In one embodiment, the above-described three-layer network device model can forward the information output by the switching device model across network segments to the switching device models of other topological levels. Therefore, for the three-layer network device model of the middle layer, it can be connected to each adjacent non-middle-layer switching device model.
[0055] However, it should be noted that there may be multiple three-layer network device models distributed in the middle layer (for example, including device models such as firewalls or routers at the same time) to perform protection inspection and transmission on the communication information output by the switching device model. At this time, for multiple three-layer network device models, the terminal device can first connect the multiple three-layer network device models in series and determine the starting three-layer network device model and the ending three-layer network device model in the series-connected three-layer network device models. Then, control the starting three-layer network device model and the ending three-layer network device model to be respectively connected to an adjacent non-middle-layer switching device model.
[0056] It can be understood that connecting the three-layer network device models in series can enable the communication information output by the switching device model to perform security verification of the communication information on the basis of being able to achieve cross-network segment transmission. Based on this, after the series connection, only the starting three-layer network device model and the ending three-layer network device model need to be respectively connected to an adjacent non-middle-layer switching device model.
[0057] Specifically, referring to Figure 4 , there are two three-layer network device models in the middle layer 1, and the two three-layer network device models can be connected in series. Then, connect one of the three-layer network device models to each switching device model in the process layer, and the other three-layer network device model to the switching device model in the control layer.
[0058] S303. Determine all the connected target device models in the hierarchical layout as the network topology diagram.
[0059] In one embodiment, after connecting each target device model according to the above S301 and S302 steps, the network topology diagram can be obtained.
[0060] In this embodiment, the terminal device can select target device models corresponding to the topological level and quantity from a preset knowledge base according to the topological level in the topological model corresponding to the network topology diagram and the total quantity of each target device model in the network topology diagram generated this time. Then, based on the topological level and the total quantity of each target device model, each target device model can be arranged in each corresponding topological level respectively to generate a hierarchical layout of all target device models. Finally, based on the connection rules between network device models and the hierarchical layout, each target device model is connected to automatically generate a network topology diagram. Furthermore, by using the above method, a network topology diagram can be quickly generated according to the topological model, and the generated network topology diagram can be obtained according to requirements, improving the flexibility of the generated network topology diagram.
[0061] In another embodiment, since the distribution positions of the target device models in each topological level may be randomly distributed, when the display screen displays the positions of each target device model in the network topology diagram, it is rather chaotic. For example, in one topological level, a large number of target device models are concentrated in one area, while a small number of target device models are in another area. Therefore, it will result in a poor display effect of the network topology diagram finally displayed on the display screen.
[0062] Based on this, in order to optimize the problem of chaotic position display of each switching device model and improve the display effect of the network topology diagram on the display screen. The terminal device can also process the display positions of each target device model according to S501 - S504 as shown below: Figure 5 Details are as follows: S501. Display all target device models in the network topology diagram on the display screen.
[0063] In one embodiment, the above display screen can be the display screen of the terminal device or a display screen having a data connection with the terminal device, which is not limited herein. During the display process, the terminal device can randomly display each target device model, or display the network topology diagram in proportion according to the relative position relationship of each target device model in the network topology diagram, which is not limited herein.
[0064] However, the distribution positions of each target device model in the network topology diagram are rather chaotic in itself. Therefore, whether the network topology diagram is displayed in proportion or randomly distributed, the display effect is rather chaotic.
[0065] S502. Determine the display coordinates of all target device models on the display screen respectively.
[0066] In one embodiment, the resolution of the terminal device with a display screen can be used to represent the number of pixels accommodated by the display screen in the horizontal and vertical directions. Therefore, the terminal device can establish a two-dimensional coordinate system of n*m in advance according to the resolution of the display screen. Furthermore, the display coordinates of all target device models on the display screen can be determined respectively.
[0067] Among them, the origin of the two-dimensional coordinate system can be the center position of the display screen, or the corner positions, or the position where any target device model is distributed, and there is no limitation on this.
[0068] S503. Determine the target display coordinates corresponding to all target device models according to the display coordinates and the resolution of the display screen; the resolution is used to represent the number of pixels accommodated by the display screen in the horizontal and vertical directions.
[0069] In one embodiment, the resolution has been explained above and will not be described again.
[0070] In a specific embodiment, the terminal device can first determine the maximum value of the abscissa and the maximum value of the ordinate from all the display coordinates. Then, for any target device model, the terminal device can determine the target axis display coordinates of the target device model according to the number of target axis pixels corresponding to the resolution, the maximum value of the target axis coordinates, and the target axis coordinates corresponding to the target device model. Finally, the target axis display coordinates are determined as the target display coordinates.
[0071] In one embodiment, the terminal device can first determine all the horizontal axis coordinates and vertical axis coordinates from all the display coordinates, and then determine the maximum value of the abscissa and the maximum value of the ordinate.
[0072] Among them, the target axis is at least one of the horizontal axis and the vertical axis. Therefore, it can be understood that when the target axis is the horizontal axis, the above-mentioned number of target axis pixels is the number of horizontal axis pixels, the maximum value of the target axis coordinates is the maximum value of the horizontal axis coordinates, the target axis coordinates corresponding to the target device model are the horizontal axis coordinates, and the target axis display coordinates are the horizontal axis display coordinates.
[0073] Similarly, when the target axis is the vertical axis, the above-mentioned number of target axis pixels is the number of vertical axis pixels, the maximum value of the target axis coordinates is the maximum value of the vertical axis coordinates, the target axis coordinates corresponding to the target device model are the vertical axis coordinates, and the target axis display coordinates are the vertical axis display coordinates.
[0074] Based on this, when the target axis display coordinates are determined as the target display coordinates, it can be considered that the above-mentioned horizontal axis display coordinates and vertical axis display coordinates are determined as the target display coordinates.
[0075] As an example, in order to make each target device model in the generated network topology diagram located at the center of the display screen as much as possible, the origin of the above two-dimensional coordinate system can be the position of the target device model in the upper left corner of the display screen. At this time, the display coordinates of each target device model are relative positions relative to the target device model in the upper left corner. Then, the terminal device can input the number of target axis pixels, the maximum value of the target axis coordinates, and the target axis coordinates corresponding to the target device model into a preset coordinate calculation formula to obtain the target axis display coordinates; the coordinate calculation formula is:
[0076] wherein, represents the target axis display coordinate of the i-th target device model, represents the number of target axis pixels, represents the target axis coordinate of the i-th target device model, represents the maximum value of the target axis coordinates.
[0077] It should be noted that since represents the number of target axis pixels, represents the maximum value of the target axis coordinates. Therefore, when adding the value obtained by to the target axis coordinates represented by it can make the finally obtained target axis display coordinates have a sense of hierarchy when the target device models are displayed on the display screen on the basis of being close to the center position of the display, and improve the display effect of the network topology diagram.
[0078] S504. Display the corresponding target device model on the display screen according to each target display coordinate respectively.
[0079] In one embodiment, after obtaining the target display coordinates, each target device model can be displayed on the display screen according to the target display coordinates. Among them, for each target device model after coordinate adjustment, the terminal device can use a vector drawing software (for example, canvas) to complete the connection drawing between each target device model and generate a visual network topology diagram.
[0080] Specifically, referring to Figure 6 , Figure 6 is a schematic diagram of an application scenario of a network topology diagram provided by another embodiment of the present application. Based on Figure 6 it can be seen that on the basis that each finally generated target device model is close to the center position of the display, each target device model can also have a sense of hierarchy when being displayed on the display screen, and improve the display effect of the network topology diagram.
[0081] It should be added that for the three-layer network device model in the middle layer, if the number of three-layer network device models is multiple (for example, 2), and they need to be connected to different switching device models in the non-middle layer respectively, then during the actual display process, the terminal device can first Figure 4 adjust the two horizontally arranged three-layer network device models in Figure 4 to be vertically arranged. In this way, in Figure 6 Figure 6 , when connecting to different switching device models in the non-middle layer, the upper three-layer network device model U1 can be connected to the switching device model in the process layer, and the lower three-layer network device model U2 can be connected to the switching device model in the control layer. In this way, the wiring effect between the three-layer network device model and the switching device model is initially optimized. Finally, based on the above steps S501 - S504, the display coordinates of each target device model are determined. Then, on the display screen, the respective target device models as shown in Figure 6 Figure 6 are displayed.
[0082] It should be added that Figure 6 the wiring in each target device model in Figure 6 only represents the communication method in the target device model, rather than characterizing the spatial distance between the target device models. Determining the target display coordinates based on the above steps S501 - S504 is only an example in this embodiment, and in this embodiment, the method for generating the target display coordinates is not limited.
[0083] In another embodiment, after the terminal device displays the target device models corresponding to the network topology diagram on the display screen, it can also adjust and optimize the generated network topology diagram according to the operation instructions of the operation and maintenance personnel for the topology editing engine to obtain the final network topology diagram.
[0084] Among them, the adjustment and optimization include but are not limited to adjusting the number, type, communication method of the target device models in each topology layer, and the device models of the target device models between different topology layers, and this is not limited.
[0085] It should be noted that quickly generating and displaying the network topology diagram can facilitate the application scenarios in various industries. For example, the above application scenarios include but are not limited to industrial network security analysis scenarios, industrial network simulation and testing scenarios, training and education scenarios, and research and development scenarios, and this is not limited.
[0086] Exemplarily, for the industrial network security analysis scenario, the basic network devices, factory automation systems, and energy systems in the industrial network can be analyzed for security to help the operation and maintenance personnel understand the composition, connection, and key network devices of the industrial network, so as to identify potential security vulnerabilities and threats.
[0087] For industrial network simulation and testing scenarios, the industrial network can be network-simulated and tested to verify new network technologies, evaluate network performance, and conduct offensive and defensive drills.
[0088] For training and education scenarios, a visual network topology diagram can be intuitively displayed, providing an auxiliary tool for network training and education to help trainers and learners better understand and learn the composition and operating principles of industrial networks.
[0089] For research and development scenarios, it can assist researchers and developers in conducting in-depth research on network security to develop new solutions for maintaining network security.
[0090] Please refer to Figure 7 , Figure 7 which is a structural block diagram of a network topology diagram generation device provided in an embodiment of this application. In this embodiment, each module included in the network topology diagram generation device is used to execute Figures 1 to 4 the corresponding steps in the corresponding embodiment. Specifically, please refer to Figures 1 to 4 and Figures 1 to 4 the relevant descriptions in the corresponding embodiments. For ease of description, only parts related to this embodiment are shown. Refer to Figure 7 , the network topology diagram generation device 700 may include: a first determination module 710, an acquisition module 720, a first generation module 730, and a second generation module 740, where: The first determination module 710 is configured to determine a topology model corresponding to the network topology diagram to be generated.
[0091] The acquisition module 720 is configured to obtain multiple target device models from a preset knowledge base according to the topology information of the topology model; the topology information includes the topology level of the topology model and the total number of each target device model; the knowledge base includes multiple network device models, the topology level of each network device model, and the connection rules between network device models.
[0092] The first generation module 730 is configured to generate a hierarchical layout of all target device models based on the topology level and the total number of each target device model.
[0093] The second generation module 740 is configured to connect all target device models according to the connection rules and the hierarchical layout to generate a network topology diagram.
[0094] In one embodiment, the first generation module 730 is further configured to for any one of the target device models, determine the number of levels in the topology level where the target device model needs to be distributed; calculate the first average value of the total number and the number of levels; and evenly distribute the target device model in the corresponding topology level according to the first average value to generate a hierarchical layout.
[0095] In one embodiment, the types of target device models include switching device models, three-layer network device models, and industry device models; the topological levels include an intermediate layer and at least two non-intermediate layers. The intermediate layer is used to distribute three-layer network device models; each non-intermediate layer is used to distribute switching device models and industry device models.
[0096] In one embodiment, the second generation module 740 is further configured to: For any non-intermediate layer, if there are multiple switching device models, calculate the second average value of the first number of industry device models and the second number of switching device models in the non-intermediate layer, and connect the industry device models and the switching device models evenly according to the second average value; control the switching device models of each non-intermediate layer to be connected to the three-layer network device models of the adjacent intermediate layer; determine all the connected target device models in the hierarchical layout as the network topology diagram.
[0097] In one embodiment, the second generation module 740 is further configured to: For any intermediate layer, if there are multiple three-layer network device models distributed in the intermediate layer, connect the multiple three-layer network device models in series; determine the starting three-layer network device model and the ending three-layer network device model in the serially connected three-layer network device models; control the starting three-layer network device model and the ending three-layer network device model to be respectively connected to the switching device models of an adjacent non-intermediate layer.
[0098] In one embodiment, the network topology diagram generation device 700 further includes: A first display module, configured to display all target device models in the network topology diagram on a display screen.
[0099] A second determination module, configured to respectively determine the display coordinates of all target device models on the display screen.
[0100] A third determination module, configured to determine the target display coordinates corresponding to all target device models according to the display coordinates and the resolution of the display screen; the resolution is used to represent the number of pixels accommodated by the display screen in the horizontal and vertical directions.
[0101] A second display module, configured to respectively display the corresponding target device models on the display screen according to each target display coordinate.
[0102] In one embodiment, the third determination module is further configured to: From all the displayed coordinates, determine the maximum value of the abscissa and the maximum value of the ordinate; for any target device model, determine the target-axis display coordinates of the target device model according to the number of target-axis pixels corresponding to the resolution, the maximum value of the target-axis coordinates, and the target-axis coordinates corresponding to the target device model; the target axis is at least one of the horizontal axis and the vertical axis; determine the target-axis display coordinates as the target display coordinates.
[0103] In one embodiment, the third determination module is further configured to: Input the number of target-axis pixels, the maximum value of the target-axis coordinates, and the target-axis coordinates corresponding to the target device model into a preset coordinate calculation formula to obtain the target-axis display coordinates; the coordinate calculation formula is:
[0104] Wherein, represents the target-axis display coordinates of the i-th target device model, represents the number of target-axis pixels, represents the target-axis coordinates of the i-th target device model, represents the maximum value of the target-axis coordinates.
[0105] It should be understood that Figure 7 in the structural block diagram of the network topology graph generation device shown, each module is used to execute Figures 1 to 4 the respective steps in the corresponding embodiments, and for Figures 1 to 4 the respective steps in the corresponding embodiments have been explained in detail in the above embodiments. For details, please refer to Figures 1 to 4 and Figures 1 to 4 the relevant descriptions in the corresponding embodiments, which will not be elaborated here.
[0106] Figure 8 is the structural block diagram of a terminal device provided by an embodiment of the present application. As Figure 8 shown, the terminal device 800 in this embodiment includes: a processor 810, a memory 820, and a computer program 830 stored in the memory 820 and executable on the processor 810, such as a program for the network topology graph generation method. When the processor 810 executes the computer program 830, it implements the steps in each embodiment of the above-mentioned network topology graph generation method, such as Figure 1 S101 to S104 shown. Alternatively, when the processor 810 executes the computer program 830, it implements the functions of each module in the corresponding embodiment above. For example, Figure 7 the functions of each module shown, for details, please refer to Figure 7 the relevant descriptions in the corresponding embodiment. Figure 7
[0107] Exemplarily, the computer program 830 may be divided into one or more modules. One or more modules are stored in the memory 820 and executed by the processor 810 to implement the network topology map generation method provided by the embodiments of the present application. One or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 830 in the terminal device 800. For example, the computer program 830 may implement the network topology map generation method provided by the embodiments of the present application.
[0108] The terminal device 800 may include, but is not limited to, a processor 810 and a memory 820. Those skilled in the art can understand that Figure 8 merely examples of the terminal device 800 do not constitute a limitation on the terminal device 800, and it may include more or fewer components than shown in the figure, or combine some components, or different components. For example, the terminal device may further include an input / output device model, a network access device model, a bus, etc.
[0109] The so-called processor 810 may be a central processing unit, or may also be other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0110] The memory 820 may be an internal storage unit of the terminal device 800, such as the hard disk or memory of the terminal device 800. The memory 820 may also be an external storage device model of the terminal device 800, such as a plug-in hard disk, a smart memory card, a flash memory card, etc. equipped on the terminal device 800. Further, the memory 820 may also include both the internal storage unit of the terminal device 800 and the external storage device model.
[0111] The embodiments of the present application provide a computer-readable storage medium storing a computer program, and the computer program is executed by the processor to perform the network topology map generation method in each of the above embodiments.
[0112] The embodiments of the present application provide a computer program product, which when running on a terminal device causes the terminal device to perform the network topology map generation method in each of the above embodiments.
[0113] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for generating a network topology diagram, characterized in that, The method includes: Determining a topology model corresponding to the network topology graph to be generated; Obtaining multiple target device models from a preset knowledge base according to the topology information of the topology model; the topology information includes the topology level of the topology model and the total number of each target device model; the knowledge base includes multiple network device models, the topology level of each network device model, and the connection rules between the network device models; Generating a hierarchical layout of all the target device models based on the topology level and the total number of each target device model; Connecting all the target device models according to the connection rules and the hierarchical layout to generate a network topology graph.
2. The method according to claim 1, wherein The generating a hierarchical layout of all the target device models based on the topology level and the total number of each target device model includes: For any one of the target device models, determining the number of levels in the topology level where the target device model needs to be distributed; Calculating a first average value of the total number and the number of levels; Evenly distributing the target device models in the corresponding topology levels according to the first average value to generate a hierarchical layout.
3. The method according to claim 1, wherein The types of the target device models include a switching device model, a three-layer network device model, and an industry device model; the topology level includes an intermediate layer and at least two non-intermediate layers, and the intermediate layer is used to distribute the three-layer network device models; each non-intermediate layer is used to distribute the switching device models and the industry device models.
4. The method according to claim 3, characterized in that, The connecting all the target device models according to the connection rules and the hierarchical layout to generate a network topology graph includes: For any one of the non-intermediate layers, if there are multiple switching device models, calculating a second average value of a first number of the industry device models and a second number of the switching device models in the non-intermediate layer, and evenly connecting the industry device models and the switching device models according to the second average value; Controlling the switching device models in each non-intermediate layer to be connected to the three-layer network device models in the adjacent intermediate layer; Determining all the connected target device models in the hierarchical layout as the network topology graph.
5. The method according to claim 4, characterized in that The controlling the switching device models in each non-intermediate layer to be connected to the three-layer network device models in the adjacent intermediate layer includes: For any one of the intermediate layers, if there are multiple three-layer network device models distributed in the intermediate layer, connecting the multiple three-layer network device models in series; Determining a starting three-layer network device model and an ending three-layer network device model among the serially connected three-layer network device models; Controlling the starting three-layer network device model and the ending three-layer network device model to be respectively connected to a switching device model in an adjacent non-intermediate layer.
6. The method according to any one of claims 1-5, characterized in that After connecting all the target device models according to the connection rules and the hierarchical layout to generate a network topology graph, it further includes: Displaying all the target device models in the network topology graph on a display screen; Respectively determining the display coordinates of all the target device models on the display screen; Determine the target display coordinates corresponding to all the target device models according to the display coordinates and the resolution of the display screen; the resolution is used to represent the number of pixels accommodated by the display screen in the horizontal and vertical directions; Display the corresponding target device models on the display screen respectively according to each of the target display coordinates.
7. The method according to claim 6, wherein The determining, according to the display coordinates and the resolution of the display screen, the target display coordinates corresponding to all the target device models includes: Determine the maximum value of the abscissa and the maximum value of the ordinate from all the display coordinates; For any one of the target device models, determine the target axis display coordinates of the target device model according to the number of target axis pixels corresponding to the resolution, the maximum value of the target axis coordinates, and the target axis coordinates corresponding to the target device model; the target axis is at least one of the horizontal axis and the vertical axis; Determine the target axis display coordinates as the target display coordinates.
8. The method according to claim 7, wherein The determining, according to the number of target axis pixels corresponding to the resolution, the maximum value of the target axis coordinates, and the target axis coordinates corresponding to the target device model, the target axis display coordinates of the target device model includes: Input the number of target axis pixels, the maximum value of the target axis coordinates, and the target axis coordinates corresponding to the target device model into a preset coordinate calculation formula to obtain the target axis display coordinates; the coordinate calculation formula is:
9. Among them, represents the target axis display coordinate of the i-th target device model, represents the number of target axis pixels, represents the target axis coordinate of the i-th target device model, represents the maximum value of the target axis coordinate.
10. A network topology diagram generation device, characterized in that, The device includes: A first determination module, configured to determine a topology model corresponding to a network topology diagram to be generated; An acquisition module, configured to acquire a plurality of target device models from a preset knowledge base according to the topology information of the topology model; the topology information includes the topology level of the topology model and the total number of each target device model; the knowledge base includes a plurality of network device models, the topology level of each network device model, and the connection rules between the network device models; A first generation module, configured to generate a hierarchical layout of all the target device models based on the topology level and the total number of each target device model; A second generation module, configured to connect all the target device models according to the connection rules and the hierarchical layout to generate a network topology diagram.
11. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Node coordinate adaptive method and system for hierarchical upward convergence of network logic topology, and electronic equipment
CN120729733A