Visual network topology generation method of electric power communication system
By using multi-process methods to obtain equipment information and build a topological network in the power communication system, the equipment positioning problem in the power communication system is solved, and rapid and accurate equipment information search and operation and maintenance efficiency are improved.
Patent Information
- Application Number
- CN202411385766.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-27
AI Technical Summary
During the maintenance and emergency repair of the bearer network of the power communication system, it is difficult for the existing technology to quickly and accurately find equipment information and locate equipment, resulting in poor operation and maintenance timeliness.
The multi-process method is used to obtain the device information and superior-level logical relationships of all devices in the power communication system through SSH connection, and data cleaning and topological network building, and visual display to quickly lock the target device.
It improves the timeliness of operation and maintenance, saves emergency repair time, simplifies the equipment positioning process, and reduces workload.
Smart Images

Figure CN119211033A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method for generating a visualized network topology of an electric power communication system. Background Art
[0002] During the inspection and emergency repair of the bearer network of the power communication system, operators need to go to the site to deal with equipment failures. In the process of handling the failures, they need to accurately and quickly determine the connection relationship between the equipment and accurately locate the equipment, so as to achieve rapid handling of the failures.
[0003] However, currently, when determining the connection relationship between devices, the usual method is to check the label and ledger, then find the peer device, and then use the console line to connect the device to query the device information. This is not only time-consuming, but also difficult to systematically find network problems. In addition, when field operators need to quickly know which switch a certain IP address is on, it is difficult to accurately locate it only through the ledger, and they often need to log in to the switch one by one to query, which also wastes a lot of repair time.
[0004] Therefore, when the bearer network of the power communication system is inspected and repaired, the existing solutions are difficult to quickly and accurately find equipment information and locate equipment, which leads to poor timeliness of operation and maintenance. Summary of the invention
[0005] In view of this, in order to address the above shortcomings, it is necessary to propose a visual network topology generation method for the power communication system, which can quickly and accurately find device information and locate equipment, thereby improving the timeliness of operation and maintenance.
[0006] In a first aspect, the present invention provides a method for generating a visualized network topology of a power communication system, comprising: Step 10: Log in to any bearer network edge device in the power communication system and obtain device information of the bearer network edge device; Step 20: Using the bearer network edge device as the source device, assigning a process to each neighbor device of the source device in a multi-process manner, and obtaining address information and device information of each neighbor device through an SSH connection; Step 30: Taking each neighbor device as the current source device, the address information and device information of the neighbor devices of each current source device are obtained in the manner of step 20; this step is executed repeatedly until the device information and the upper and lower logical relationships of all devices in the power communication system are collected; Step 40: Clean the device information of each device to obtain a device information string; Step 50: for each device, determine the peer device information of the peer device of the physical port of the device using the device information of the device; Step 60: constructing a topology network of the power communication system according to the upper-lower level logical relationship, the device information string and the peer device information; Step 70: Visually display the topology network.
[0007] Preferably, in step 10, the device information includes but is not limited to: a routing table, an interface address table, a MAC address table, a VLAN table, an Address Resolution Protocol ARP table, and a data configuration table.
[0008] Preferably, the step 20 comprises: Step S21: Sending a command to the source device to check the IP address of its neighbor device; wherein the neighbor device is a device that has a direct connection relationship with the source device; Step S22: Maintain a neighbor IP address pool as a global variable, and check whether the IP address of the corresponding neighbor device is in the neighbor IP address pool before initiating an SSH connection each time; and, when the IP address of the neighbor device is not in the neighbor IP address pool, allocate a process for the neighbor device and put the IP address of the neighbor device into the neighbor IP address pool; Step S23: using a multi-process approach to allocate a process to each neighbor device's IP address, and sending an SSH connection request to each neighbor device's IP address of the source device through each process; Step S24: After connecting and logging in, each process obtains the IP address information and device information of the corresponding neighbor device by separating multiple threads.
[0009] Preferably, the step 40 comprises: Step S41: extract key data from the device information to obtain key device information; wherein the key device information includes but is not limited to: physical interface information of the device, IP address of the physical interface, VLAN information of the physical interface, and service information carried by the port; Step S42: Based on the number of the physical interface, a device information string under each number is formed according to a preset format; wherein, For a layer 3 interface, the preset format includes: physical interface number-bearing service-IP address or virtual port IP address-MAC address; For a layer 2 interface, the preset format includes: physical interface number-bearing service-VLAN number to be allowed-MAC address.
[0010] Preferably, the step 50 comprises: Step S51: obtaining the local interface address of the current device through the interface address table in the device information, and calculating the peer interface address based on the local interface address; Step S52: Match the calculated peer interface address with the interface address of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, execute step S53; Step S53: Obtain the MAC address, IP address, physical port and learned MAC address under the layer 3 interface of the current device through the ARP table or MAC address table in the device information; Step S54: Match the learned MAC address with the MAC address of the port of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, execute step S55; Step S55: Obtain the physical port, MAC address, port VLAN and learned MAC address under the Layer 2 interface of the current device through the data configuration table and MAC address table in the device information; Step S56: Match the port VLAN and the learned MAC address with the port VLAN and MAC address of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, an exception is thrown; Step S57: Based on the established connection relationship, obtain the peer device information of each peer device.
[0011] Preferably, the step 60 includes: Step S61: setting a global variable; Step S62: According to the upper-lower level logical relationship, each time a new process starts, 1 is added to the global variable to obtain a device serial number group corresponding to each process; wherein each device serial number group is composed of two serial numbers, and the two serial numbers respectively correspond to the serial numbers of the two devices that the process communicates with; Step S63: Draw the topological network of the power communication system according to each device serial number group.
[0012] Preferably, after step 63, the method further comprises: Step S64: Bind the serial number of each device with the device information string and the peer device information to obtain a device data set of each device; wherein the format of the device data set includes: serial number-physical port-port MAC address-IP address-bearing service-port type-VLAN-peer device IP address; Step S65: Write the device data of each device into the database through its own process.
[0013] Preferably, the step 70 includes: Visually display the topology network through three-layer drill-down logic; Among them, the first layer is the topological network diagram of the bearer network, the second layer is the physical interface diagram of the equipment, and the third layer is the bearer information under the physical interface. The upper layer information can be used as a database index for the lower layer information to obtain the next layer of information.
[0014] In a second aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute any of the methods described in the first aspect.
[0015] In a third aspect, the present invention provides a computing device, including a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, any method described in the first aspect is implemented.
[0016] It can be seen from the above technical scheme that in the visual network topology generation method of the power communication system provided by the embodiment of the present invention, first log in to any one of the edge devices of the bearer network in the power communication system, and obtain the device information of the edge device of the bearer network, then use the edge device of the bearer network as the source device, use a multi-process method to assign a process to each neighbor device of the source device, and obtain the address information and device information of each neighbor device through the SSH connection method, so that the neighbor device is used as the source device again, and then the device information and the upper and lower logical relationship of all devices in the power communication system are collected; further, the device information is cleaned to obtain the device information string, and the device information of the opposite device of the physical port of the device can be determined by using the device information of the device, so that the topological network of the power communication system can be constructed according to the determined upper and lower logical relationship, device information string and opposite device information, and visualized. It can be seen that this scheme accesses the bearer network through any node device, and by flooding the adjacent node devices from the node device, the entire network structure and device information of the power communication system can be obtained, and the topological network of the power communication system can be generated by analyzing and processing the data, and then visualized. In this way, the operation and maintenance personnel can quickly lock the target device by searching or searching in the topology network, and determine the detailed information such as the port, service, and peer device of the target device, thereby improving the timeliness of operation and maintenance, saving a lot of repair time for the operation and maintenance personnel, and simplifying the tedious steps in the process of locating the device and reducing the workload. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 The technical architecture diagram of the system developed based on the present invention.
[0018] Figure 2 A flowchart of a method for generating a visualized network topology of a power communication system provided in an embodiment of the present invention.
[0019] Figure 3A schematic diagram of data collection provided by an embodiment of the present invention.
[0020] Figure 4 A logical diagram of inter-process data provided by an embodiment of the present invention.
[0021] Figure 5 An example diagram of topology construction provided in an embodiment of the present invention.
[0022] Figure 6 A diagram for storing data in a database provided by an embodiment of the present invention.
[0023] Figure 7 A visual hierarchical structure diagram provided by an embodiment of the present invention.
[0024] Figure 8 A user usage logic diagram provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. 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 creative work.
[0026] like Figure 1 As shown in the figure, the system developed based on this solution can be mainly divided into four layers. The first layer is the user interface, which consists of a visualization display module and an interactive module, and is responsible for completing the interaction between the user and the system and data changes. The second layer is the data processing layer, which consists of a data analysis module and a topology construction module, and is responsible for implementing data support to support the visualization interface. The third layer is the data collection layer, which consists of a multi-process data collection module, and is responsible for interacting with the target device and collecting data from the entire network. The fourth layer is the database, which consists of MySQL and Redis databases, of which MySQL is mainly used for persistent storage of data, and Redis is mainly used for caching of the web interface to improve page response time.
[0027] Specifically, Figure 2 As shown, the present invention provides a method for generating a visualized network topology of a power communication system, which may include the following steps: Step 10: Log in to any bearer network edge device in the power communication system and obtain device information of the bearer network edge device; Step 20: Using the edge device of the bearer network as the source device, a process is allocated to each neighbor device of the source device in a multi-process manner, and the address information and device information of each neighbor device are obtained through an SSH connection; Step 30: Taking each neighbor device as the current source device, the address information and device information of the neighbor devices of each current source device are obtained in the manner of step 20; this step is executed repeatedly until the device information and the upper and lower logical relationships of all devices in the power communication system are collected; Step 40: Clean the device information of each device to obtain a device information string; Step 50: for each device, determine the peer device information of the peer device of the physical port of the device using the device information of the device; Step 60: construct a topology network of the power communication system according to the upper-lower level logical relationship, the device information string and the peer device information; Step 70: Visualize the topology network.
[0028] In this embodiment, by accessing the bearer network through any node device, and flooding the adjacent node devices from the node device, the entire network structure and device information of the power communication system can be obtained, and the topological network of the power communication system can be generated by analyzing and processing the data, and then visualized. In this way, the operation and maintenance personnel can quickly lock the target device by searching or searching from the topological network, and determine the detailed information such as the port, service, and peer device of the target device, thereby improving the timeliness of operation and maintenance, saving a lot of repair time for the operation and maintenance personnel, and simplifying the cumbersome steps in the process of locating the equipment, reducing the workload.
[0029] For step 10, log in to any bearer network edge device in the power communication system and obtain device information of the bearer network edge device; In this step, when logging into the edge device of the bearer network in the power system, you can log in by plugging in the wire on site, or you can log in remotely. For example, you can consider using python pandas to read the device login ledger, and use the python netmiko library to implement remote login to the edge device of the bearer network. For example, the edge device of the bearer network can be a three-layer switch or router. Furthermore, you can obtain the device information such as the routing table, interface address table, MAC address table, VLAN table, address resolution protocol ARP table, and data configuration table of the device through command interaction.
[0030] For step 20, the edge device of the bearer network is used as the source device, a process is allocated to each neighbor device of the source device in a multi-process manner, and the address information and device information of each neighbor device are obtained through an SSH connection; and, in step 30, each neighbor device is used as the current source device, and the address information and device information of the neighbor device of each current source device are obtained in the manner of step 20; this step is executed repeatedly until the device information and the upper and lower logical relationships of all devices in the power communication system are collected; In this embodiment, step 20 can be specifically implemented by the following steps: Step S21: Sending a command to the source device to check the IP address of its neighbor device; wherein the neighbor device is a device that has a direct connection relationship with the source device; Step S22: Maintain a neighbor IP address pool as a global variable, and check whether the IP address of the corresponding neighbor device is in the neighbor IP address pool before initiating an SSH connection each time; and, when the IP address of the neighbor device is not in the neighbor IP address pool, allocate a process for the neighbor device and put the IP address of the neighbor device into the neighbor IP address pool; Step S23: using a multi-process approach to allocate a process to each neighbor device's IP address, and sending an SSH connection request to each neighbor device's IP address of the source device through each process; Step S24: After connecting and logging in, each process obtains the IP address information and device information of the corresponding neighbor device by separating multiple threads.
[0031] In this step, after obtaining the device information of the connected bearer network edge device (for example, device A), a command is issued to the device to check the IP address of its directly connected neighbor, such as obtaining the IP address of its peer through the Ospf protocol or ISIS protocol, etc. The neighbor is a device directly connected to device A, that is, the obtained neighbor IP address is the IP address of the device directly connected to it. Further, a neighbor IP pool is maintained as a global variable, and each time an SSH connection is initiated, it is checked whether the IP address of the neighbor device to be communicated is in the neighbor IP address pool. If the neighbor IP address pool does not have the IP address of the neighbor device, a process is allocated to the neighbor device, and the IP address of the neighbor device is placed in the neighbor IP address pool, so as to achieve the effect of deduplication and avoid loops. Among them, SSH connection is a network protocol used for remote login to a server or device in an encrypted manner. Further, a process is allocated to each IP address of a directly connected device in a multi-process manner, and each process sends an SSH connection request to the IP address. After logging in, multiple threads are separated from the process to obtain, process and transmit the information of each device. At the same time, the IP address information of the device's neighbors is obtained, and the device information of its neighbors is obtained again through multiple processes until the task of collecting all device information is completed in a cycle. At this time, the device information of the entire network can be obtained. The specific data collection diagram is as follows Figure 3 shown.
[0032] Of course, it should be pointed out that after accessing the edge device of the bearer network and before the network topology, the password table of each device should be pre-configured or imported. The password table contains the login account and password for logging in to the corresponding device. Based on the login account and password of each device, the address information and device information of each neighboring device can be obtained through SSH connection.
[0033] For step 40, data cleaning is performed on the device information of each device to obtain a device information string; In this step, it is specifically implemented through the following steps: Step S41: extract key data from the device information to obtain key device information; wherein the key device information includes but is not limited to: physical interface information of the device, IP address of the physical interface, VLAN information of the physical interface, and service information carried by the port; Step S42: Based on the number of the physical interface, a device information string under each number is formed according to a preset format; wherein, For a Layer 3 interface, the preset format includes: physical interface number-bearing service-IP address or virtual port IP address-MAC address; For a Layer 2 interface, the preset format includes: physical interface number-bearing service-VLAN number to be allowed-MAC address.
[0034] In this embodiment, because the data is obtained by multiple processes, the device information obtained by the process can be analyzed and cleaned independently in each process, and the problem of multiple device data being mixed together will not occur. The ultimate goal of data cleaning is to obtain the supporting data in the multi-dimensional topology visualization display, that is, the physical interface information corresponding to the device, the IP address (layer 3 port) or VLAN information (layer 2 port) in the physical interface, and the service information carried by the port. Therefore, in this step, key data extraction is considered for device information such as routing tables, interface address tables, MAC address tables, VLAN tables, address resolution protocol ARP tables, and data configuration tables. Afterwards, a device information string under the physical interface number is formed based on the number. For example, for a layer 3 interface, the device information string formed can be: physical interface number-carrying service-IP address or virtual port IP address-MAC address; for a layer 2 interface, the device information string formed can be: physical interface number-carrying service-released VLAN number-MAC address.
[0035] For step 50, for each device, use the device information of the device to determine the peer device information of the peer device of the physical port of the device; In actual needs, you also need to know the information of the opposite-end device connected to the physical port of the current device. When determining the information of the opposite-end device, you can do so in the following ways: Step S51: obtaining the local interface address of the current device through the interface address table in the device information, and calculating the peer interface address based on the local interface address; Step S52: Match the calculated peer interface address with the interface address of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, execute step S53; Step S53: Obtain the MAC address, IP address, physical port and learned MAC address under the Layer 3 interface of the current device through the ARP table or MAC address table in the device information; Step S54: Match the learned MAC address with the MAC address of the port of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, execute step S55; Step S55: Obtain the physical port, MAC address, port VLAN and learned MAC address under the Layer 2 interface of the current device through the data configuration table and MAC address table in the device information; Step S56: Match the port VLAN and the learned MAC address with the port VLAN and MAC address of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, an exception is thrown; Step S57: Based on the established connection relationship, obtain the peer device information of each peer device.
[0036] In this embodiment, after the device information is cleaned, since the interface address with a mask of 30 bits is generally configured between devices, the interface IP address with a mask of 30 bits is cleaned out first. There are only two addresses in the 30-bit address segment, namely the local address and the remote address. Therefore, the remote interface address can be calculated based on the local interface address. For example, the local interface address is 192.168.0.1 / 30. Since there are only three types of addresses, 0.0, 0.1, 0.2, and 0.3, and 0.0 and 0.3 are the network segment address and the broadcast address respectively, the local interface address is 0.1, and the remote interface address is 0.2, that is, the remote interface address is 192.168.0.2 / 30. Further, the calculated remote interface address is matched with the interface address of the remote device through inter-process communication, that is, it is determined which device and which port the calculated remote address belongs to. If the port of the remote device is successfully matched, the connection relationship between the two can be established, and the port connection between the devices can be opened. The logical diagram of data between processes can be seen in Figure 4 .
[0037] Furthermore, if the above process does not obtain a matching port, a further judgment is made for the case where the port address is not 30 bits. Specifically, the IP address + MAC address method can be used to open the port association between devices. In order to obtain the connection information of the opposite port, the IP address + MAC address method can be used to lock the connection method of the ports between devices. Specifically, first, by querying the ARP table or MAC address table of the device, the corresponding relationship between the MAC address, IP address, physical port and learned MAC address of all ports of this device can be obtained. Then, the learned MAC address is matched with the MAC address of the port of the opposite device through inter-process communication. If the match is successful, a connection relationship between the two is established. For example, it can be obtained from Table 1 and Table 2 that GE0 / 0 / 1 of device A is connected to the GE0 / 0 / 1 port of device B.
[0038] Table 1 IP-MAC address association table of device A
[0039] Table 2 IP-MAC address association table of device B
[0040] Furthermore, if the above process still fails to match, the situation that the Layer 2 switch does not have an IP address is further judged. Specifically, the VLAN+MAC method is used to determine the connection between devices. The relationship between the physical port, the physical port MAC address, the port VLAN and the learned MAC address can be established through the data configuration table and the MAC address table, and the port association of the two devices is established in this way. That is, through inter-process communication, the port VLAN and the learned MAC address are matched with the port VLAN and MAC address of the opposite device, and the connection relationship between the two can be established if the match is successful. For example, both ports of device B in Table 3 have VLAN99 enabled, but port GE0 / 0 / 2 has not learned the address in device A, so it can be determined that device A is connected to port 1 of device B. If the match is still not successful, it means that there is an exception, that is, an exception is thrown.
[0041] Table 3 MAC-VLAN association table of devices A and B
[0042] For step 60, a topological network of the power communication system is constructed according to the upper-lower level logical relationship, the device information string and the peer device information; This step can be specifically implemented through the following steps: Step S61: setting a global variable; Step S62: According to the upper-lower level logical relationship, each time a new process starts, 1 is added to the global variable to obtain a device serial number group corresponding to each process; wherein each device serial number group is composed of two serial numbers, and the two serial numbers correspond to the serial numbers of the two devices that the process communicates with; Step S63: Draw the topological network of the power communication system according to each device serial number group.
[0043] Step S64: Bind the serial number of each device with the device information string and the peer device information to obtain a device data set of each device; wherein the format of the device data set includes: serial number-physical port-port MAC address-IP address-bearing service-port type-VLAN-peer device IP address; Step S65: Write the device data of each device into the database through its own process.
[0044] In this embodiment, the connection relationship between various devices can be sorted out through multi-process data collection itself. By setting a global variable, every time a new process starts, that is, when data is collected for a directly connected device, 1 will be added to the global total, and a logical relationship between the upper and lower levels will be established with the device. Figure 5As shown, the generated logic example is (1,2)(1,3)(2,4)(2,5)(3,6)(3,7). Through the above formula, the topology map can be drawn by programming. Further, after the first layer topology map is generated, the serial number is bound to the acquired and determined data in a corresponding relationship, that is, device A: serial number-physical port-port MAC address-IP address-bearing service-port type-VLAN-opposite device IP address. After obtaining the corresponding relationship, each process writes the data into the database, such as Figure 6 shown.
[0045] For step 70, the topology network is visualized.
[0046] In this step, consider visualizing the topology network through three-layer drill-down logic, such as Figure 7 As shown, the first layer is the topological network diagram of the bearer network, the second layer is the physical interface diagram of the device, and the third layer is the bearer information diagram under the physical interface, which may include VLAN, IP address, bearer service, etc. The upper layer information can be used as a database of the lower layer information to obtain the next layer information.
[0047] From the perspective of technical architecture, the user interface display of this step can be realized through the topology visualization module and the interaction module. The topology visualization module will use the visualization library to render the data obtained from the backend into a topology map with nodes and connections between nodes. The visualization library can be G6.js and React framework, and the nodes are switches, routers, etc. The interaction module supports functions such as topology drill-down, canvas zoom, IP address query, and device information modification for data interaction with the backend. Each time you drill down a layer, use the information of this layer as a database index, obtain the information of the next layer, and render the page through the front-end visualization technology. When the peer information of the last layer is obtained, the device information of the peer device is calculated through data analysis, indexed in the database, and then the web interface is redirected and the visualization interface is re-rendered to achieve the purpose of obtaining the peer device view.
[0048] From the above, it can be seen that in the visual network topology generation method of the electric power communication system provided by the present invention, the bearer network is accessed from a certain terminal node in the network, and the device information of the node is obtained by flooding the adjacent nodes from the node, so as to obtain the entire network structure and device information. After data cleaning and analysis of the acquired information, the key data required to generate a visual topology network is obtained, and finally a multi-dimensional visual display of the network topology and device information is formed by using visualization means. In this way, the operation and maintenance personnel can quickly lock the target device by clicking the mouse or searching for the IP address in the topology map. After double-clicking to drill down, the physical port information of the target device can be seen. After double-clicking to drill down again, the detailed information of the target port and the services carried can be seen. Click on the opposite device information again, and the detailed information of the opposite device can be viewed through calculation-matching redirection, thereby forming a closed loop of the network service system. For user usage logic, please refer to Figure 8 shown.
[0049] The present specification also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute a method in any one of the embodiments in the specification.
[0050] The present specification also provides a computing device, including a memory and a processor, wherein executable codes are stored in the memory, and when the processor executes the executable codes, a method in any embodiment of the present specification is implemented.
[0051] Since the device embodiments provided by the present invention are based on the same inventive concept as the method embodiments of this specification, the specific contents can be found in the description of the method embodiments of this specification and will not be repeated here.
[0052] The modules or units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. The above disclosure is only the preferred embodiment of the present invention, and of course it cannot be used to limit the scope of the rights of the present invention. Those skilled in the art can understand that all or part of the processes of the above embodiment are implemented, and the equivalent changes made according to the claims of the present invention still fall within the scope of the invention.
Claims
1. A method for generating a visual network topology of a power communication system, characterized in that: include: Step 10: Log in to any bearer network edge device in the power communication system and obtain device information of the bearer network edge device; Step 20: Using the bearer network edge device as the source device, assigning a process to each neighbor device of the source device in a multi-process manner, and obtaining address information and device information of each neighbor device through an SSH connection; Step 30: Taking each neighbor device as the current source device, the address information and device information of the neighbor devices of each current source device are obtained in the manner of step 20; this step is executed repeatedly until the device information and the upper and lower logical relationships of all devices in the power communication system are collected; Step 40: Clean the device information of each device to obtain a device information string; Step 50: for each device, determine the peer device information of the peer device of the physical port of the device using the device information of the device; Step 60: constructing a topology network of the power communication system according to the upper-lower level logical relationship, the device information string and the peer device information; Step 70: Visually display the topology network.
2. The method for generating a visualized network topology of a power communication system according to claim 1, characterized in that: In step 10, the device information includes but is not limited to: a routing table, an interface address table, a MAC address table, a VLAN table, an address resolution protocol ARP table, and a data configuration table.
3. The method for generating a visualized network topology of a power communication system according to claim 1, characterized in that: The step 20 comprises: Step S21: Sending a command to the source device to check the IP address of its neighbor device; wherein the neighbor device is a device that has a direct connection relationship with the source device; Step S22: Maintain a neighbor IP address pool as a global variable, and check whether the IP address of the corresponding neighbor device is in the neighbor IP address pool before initiating an SSH connection each time; and, when the IP address of the neighbor device is not in the neighbor IP address pool, allocate a process for the neighbor device and put the IP address of the neighbor device into the neighbor IP address pool; Step S23: using a multi-process approach to allocate a process to each neighbor device's IP address, and sending an SSH connection request to each neighbor device's IP address of the source device through each process; Step S24: After connecting and logging in, each process obtains the IP address information and device information of the corresponding neighbor device by separating multiple threads.
4. The method for generating a visualized network topology of a power communication system according to claim 1, characterized in that: The step 40 comprises: Step S41: extract key data from the device information to obtain key device information; wherein the key device information includes but is not limited to: physical interface information of the device, IP address of the physical interface, VLAN information of the physical interface, and service information carried by the port; Step S42: Based on the number of the physical interface, a device information string under each number is formed according to a preset format; wherein, For a layer 3 interface, the preset format includes: physical interface number-bearing service-IP address or virtual port IP address-MAC address; For a layer 2 interface, the preset format includes: physical interface number-bearing service-VLAN number to be allowed-MAC address.
5. The method for generating a visualized network topology of a power communication system according to claim 1, characterized in that: The step 50 comprises: Step S51: obtaining the local interface address of the current device through the interface address table in the device information, and calculating the peer interface address based on the local interface address; Step S52: Match the calculated peer interface address with the interface address of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, execute step S53; Step S53: Obtain the MAC address, IP address, physical port and learned MAC address under the layer 3 interface of the current device through the ARP table or MAC address table in the device information; Step S54: Match the learned MAC address with the MAC address of the port of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, execute step S55; Step S55: Obtain the physical port, MAC address, port VLAN and learned MAC address under the Layer 2 interface of the current device through the data configuration table and MAC address table in the device information; Step S56: Match the port VLAN and the learned MAC address with the port VLAN and MAC address of the peer device through inter-process communication; if the port of the peer device is successfully matched, a connection relationship between the two is established; otherwise, an exception is thrown; Step S57: Based on the established connection relationship, obtain the peer device information of each peer device.
6. The method for generating a visualized network topology of a power communication system according to claim 1, characterized in that: The step 60 comprises: Step S61: setting a global variable; Step S62: According to the upper-lower level logical relationship, each time a new process starts, 1 is added to the global variable to obtain a device serial number group corresponding to each process; wherein each device serial number group is composed of two serial numbers, and the two serial numbers respectively correspond to the serial numbers of the two devices that the process communicates with; Step S63: Draw the topological network of the power communication system according to each device serial number group.
7. The method for generating a visualized network topology of a power communication system according to claim 6, characterized in that: After step 63, the method further includes: Step S64: Bind the serial number of each device with the device information string and the peer device information to obtain a device data set of each device; wherein the format of the device data set includes: serial number-physical port-port MAC address-IP address-bearing service-port type-VLAN-peer device IP address; Step S65: Write the device data of each device into the database through its own process.
8. The method for generating a visualized network topology of a power communication system according to claim 1, characterized in that: The step 70 comprises: Visually display the topology network through three-layer drill-down logic; Among them, the first layer is the topological network diagram of the bearer network, the second layer is the physical interface diagram of the equipment, and the third layer is the bearer information under the physical interface. The upper layer information can be used as a database index for the lower layer information to obtain the next layer of information.
9. 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 8.
10. A computing device comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 8 is implemented.
