Network topology construction method and computing device

The I/O device identifier on the terminal device is obtained through the switch and the network topology is generated, which solves the problem of time-consuming and error-prone confirmation of the device connection relationship by manually confirming the device, and improves the efficiency and accuracy of network topology construction.

CN114465904BActive Publication Date: 2024-12-06SIEMENS (CHINA) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011130827.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-21
Publication Date
2024-12-06
Estimated Expiration
2040-10-21

AI Technical Summary

Technical Problem

In the existing network topology construction methods, it takes a long time to confirm the connection relationship of the equipment, resulting in inefficiency, especially in large-area and multi-device scenarios.

Method used

The I/O device identification on the terminal device is obtained through the switch, and a network topology is generated based on the connection relationship between the switch, the terminal device and the switch, reducing manual participation and errors.

Benefits of technology

Improves the efficiency of network topology construction, reduces manual errors, and ensures the accuracy of the construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114465904B_ABST
    Figure CN114465904B_ABST
Patent Text Reader

Abstract

The present invention provides a network topology construction method and a computing device, including: determining a target network for network topology construction, wherein the target network includes switches, terminal devices, and I / O devices. Since switches need to communicate through a network, and I / O devices generally do not have a networking function, switches and terminal devices and switches are connected through network cables, and terminal devices and I / O devices are connected through an I / O bus. Obtaining the identifier of an I / O device in the target network stored on a terminal device through a switch; for each terminal device in the target network, determining that the I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device; and generating the network topology of the target network based on a second connection relationship between the switch and the terminal device in the target network, a third connection relationship between the switches, and the first connection relationship. This solution can improve the efficiency of constructing a network topology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a network topology construction method and a computing device. Background Art

[0002] With the development of technology, the functions that devices can achieve are becoming more and more diverse. Since devices with different functions have different functions, the locations where devices with different functions are placed are usually different.

[0003] At present, in the network topology construction method, the connection relationship between different devices is usually determined manually on site one by one. For example, in a certain area, there are multiple switches and terminal devices that communicate with other devices through the network, and multiple I / O devices that communicate with other devices through the input / output (I / O) bus. Terminal devices include servers, firewalls, environmental monitoring devices, and network monitoring devices, and I / O devices include printers, microphones, speakers, and lighting equipment. Different switches, terminal devices, and I / O devices are usually set in different locations. Therefore, it is necessary to manually confirm the other devices to which each device is connected through cables.

[0004] However, when the area to be managed is large and the number of devices is large, it takes a lot of time to manually determine the connection relationship between devices to build a network topology, thereby reducing the efficiency of building the network topology. Summary of the invention

[0005] In view of this, the network topology construction method and computing device provided by the present invention can improve the efficiency of constructing the network topology.

[0006] In a first aspect, an embodiment of the present invention provides a network topology construction method, including:

[0007] Determine a target network for which network topology construction is to be performed, wherein the target network includes at least two switches, at least one terminal device, and at least one input / output I / O device, wherein the switches are connected to each other and the terminal device is connected to the switches via network cables, and the terminal device is connected to the I / O device via an I / O bus;

[0008] Acquire, through the switch, an identifier of an I / O device in the target network stored on the terminal device;

[0009] For each terminal device in the target network, determining that an I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device;

[0010] A network topology of the target network is generated according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship.

[0011] In a second aspect, an embodiment of the present invention further provides a computing device, including:

[0012] A network determination module, used to determine a target network for which network topology construction is to be performed, wherein the target network includes at least two switches, at least one terminal device and at least one input / output I / O device, wherein the switches are connected to each other and the terminal device is connected to the switches via network cables, and the terminal device is connected to the I / O device via an I / O bus;

[0013] an identification acquisition module, configured to acquire, through the switch, an identification of the I / O device in the target network determined by the network determination module and stored on the terminal device;

[0014] a relationship determination module, configured to determine, for each terminal device in the target network, that an I / O device indicated by the identifier stored on the terminal device acquired by the identifier acquisition module has a first connection relationship with the terminal device;

[0015] A topology processing module is used to generate a network topology of the target network according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship determined by the relationship determination module.

[0016] In a third aspect, an embodiment of the present invention further provides a network topology construction device, comprising: at least one memory and at least one processor;

[0017] The at least one memory is used to store a machine-readable program;

[0018] The at least one processor is used to call the machine-readable program to execute the method provided by the first aspect above.

[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.

[0020] According to the technical solutions provided in the first to fourth aspects above, by determining the target network to be constructed for network topology, the switches located in the target network, the terminal devices that interact with other devices through network cables, and the I / O devices that interact with other devices through I / O buses can be determined. Since the terminal devices are connected to the I / O devices, and the switches are directly or indirectly connected to the terminal devices, the identifiers of the I / O devices connected to the terminal devices can be obtained through the switches, and then the first connection relationship between the terminal devices and the I / O devices in the target network can be determined based on the obtained identifiers. Based on the second connection relationship between the switches and the terminal devices in the target network and the third connection relationship between the switches, the network topology of the target network can be generated. There is no need to manually judge the connection relationship between the devices on site. Therefore, it not only reduces the degree of manual participation in the process of network topology construction, but also avoids the situation where errors in manual identification of the physical connection relationship between the devices lead to errors in constructing the network topology, and can improve the efficiency of constructing the network topology.

[0021] In a first possible implementation, in combination with any of the above aspects, when obtaining the identifier of the I / O device in the target network, it can be obtained through a switch in the target network. Specifically, the identifier of the I / O device can be obtained in the following manner:

[0022] Monitoring at least one switch in the target network to determine a data transmission path when each monitored switch communicates with a device outside the target network;

[0023] Determine as a main switch a switch node in each data transmission path that is connected to a device outside the target network;

[0024] The identification of the I / O device in the target network stored on the terminal device is obtained through the main switch.

[0025] In an embodiment of the present invention, by monitoring one or more switches in the target network, the data transmission path when the monitored switch communicates with the device in the target network can be determined, and the data transmission path when the monitored switch communicates with the device outside the target network can also be determined. The determined data transmission path for communicating with the device in the target network may include one or more switch nodes, and if this switch node does not communicate with the device outside the target network, then this switch node usually communicates with some devices in the target network, so that the identification of the I / O device connected to each terminal device in the target network cannot be more comprehensively obtained through this switch node. Therefore, it is necessary to determine the main switch that can communicate with the device outside the target network through the switch node included in the data transmission path when communicating with the device outside the target network. The main switch communicates directly or indirectly with the terminal device or switch in the target network, so the identification of the I / O device on the terminal device can be obtained through the main switch.

[0026] In a second possible implementation, combined with the first possible implementation, monitoring of a switch in a target network may be implemented by a computing device. Specifically, monitoring of the switch may be performed in the following manner:

[0027] A computing device connected to each switch included in the access layer of the target network monitors at least one switch in the target network;

[0028] The step of determining that a switch node in each data transmission path connected to a device outside the target network is a main switch includes:

[0029] The computing device determines that a switch node in each data transmission path connected to a device outside the target network is a main switch;

[0030] The acquiring, by the main switch, the identifier of the I / O device in the target network stored on the terminal device includes:

[0031] The computing device obtains, through the main switch, an identification of the I / O device in the target network stored on the terminal device.

[0032] In an embodiment of the present invention, switches in the target network can be divided into an access layer, an aggregation layer, and a core layer. The switches in the access layer are used to connect terminal devices, the switches in the aggregation layer are used to connect switches in the access layer, and can also connect terminal devices. The switches in the core layer are used to connect switches in the aggregation layer, and can also connect terminal devices. In general, the number of switches in the access layer is greater than the number of switches in the aggregation layer, and the number of switches in the aggregation layer is greater than the number of switches in the core layer. By connecting a computing device to a switch in the access layer of the target network, the computing device can monitor the switch device to which it is connected, and then determine the data transmission path of the monitored switch, thereby determining the main switch that can communicate with devices outside the target network, and finally obtain the identification of the I / O device in the target network through the main switch.

[0033] In a third possible implementation, in combination with the first aspect, when determining the network topology to be constructed, it can be implemented by a computing device. Specifically, the target network can be determined in the following manner:

[0034] A computing device connected to each switch included in the access layer of the target network determines the target network for which network topology construction is to be performed;

[0035] The step of obtaining, by the switch, an identifier of the I / O device in the target network stored on the terminal device includes:

[0036] The computing device obtains, through the switch, an identifier of the I / O device in the target network stored on the terminal device;

[0037] The step of determining, for each terminal device in the target network, that the I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device includes:

[0038] The computing device determines, for each terminal device in the target network, that the I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device;

[0039] The generating a network topology of the target network according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship includes:

[0040] The computing device generates a network topology of the target network according to a second connection relationship between switches and terminal devices in the target network, a third connection relationship between switches, and the first connection relationship.

[0041] In a fourth possible implementation, in combination with the first aspect, before constructing the network topology of the target network, a first connection relationship between the terminal device and the I / O device in the target network, a second connection relationship between the switch and the terminal device, and a third connection relationship between the switches may be determined. Specifically, the second connection relationship and the third connection relationship may be determined in the following manner:

[0042] For each port of the switch in the target network, execute:

[0043] If the MAC address table obtained from the port includes only one MAC address of a first terminal device in the target network, and the MAC address table obtained from ports other than the port is different from the MAC address table obtained from the port, it is determined that the port is connected to the first terminal device;

[0044] If the MAC address table obtained from the port includes at least two MAC addresses of a second terminal device in the target network, it is determined that the port is connected to the second terminal device;

[0045] Determine a second connection relationship between the switch in the target network and the terminal device according to the connection relationship between the terminal device in the target network and the port of the switch and the ports included in each switch in the target network;

[0046] Determine whether each port on each switch in the target network has a MAC address;

[0047] If each port on each switch in the target network has a MAC address, determining the third connection relationship in the target network according to the MAC address of the port of the switch included in the MAC address table of each of the first ports in the target network;

[0048] If at least one port of each switch in the target network does not have a MAC address, the third connection relationship in the target network is determined according to the MAC address of the terminal device included in the MAC address table of each of the first ports in the target network.

[0049] In an embodiment of the present invention, when determining the second connection relationship, if a MAC address table includes only one MAC address of a first terminal device, and there is no other MAC address table that is exactly the same as the MAC address included in the MAC address table, then it can be uniquely determined that the switch port to which the MAC address table belongs is connected to the first terminal device. If a MAC address table includes at least two MAC addresses of a second terminal device, then it can also be determined that the switch port to which the MAC address table belongs is connected to the second terminal device. For a PLC, communication module or host computer that supports PROFIENT, usually one port corresponds to multiple MAC addresses, one of which is used to bind to an IP address (this MAC address will appear in the MAC address table of other switches), and the other MAC addresses are used for LLDP / PN-PTCP / MRP and other communications. Therefore, when the MAC address table of the switch port includes multiple MAC addresses corresponding to the same terminal device, the connection relationship between the terminal device and the switch port can be determined.

[0050] In this embodiment, when determining the third connection relationship, there are two situations for the switch, one is that each port of the switch itself does not have a MAC address (if the switch provides a management port, the management port has a MAC address), and the other is that each port of the switch is assigned a MAC address. When the switch in the target network is the first type of switch mentioned above, the third connection relationship can be determined according to the MAC address of the terminal device included in the MAC address table of each first port. When the switch in the target network is the second type of switch mentioned above, the third connection relationship can be determined according to the MAC address of the switch port included in the MAC address table of each first port. Of course, the third connection relationship can also be determined according to the MAC address of the terminal device included in the MAC address table of each first port. If each port of each switch has a MAC address, the MAC address of the switch port included in the MAC address table of the first port can more directly reflect the connection relationship between the switches, so that the third connection relationship can be quickly determined to ensure the rate of building the network topology. If not all ports of each switch have a MAC address, the connection relationship between the switches can be derived based on the MAC address of the terminal device included in the MAC address table of the first port. This method is universal and can be used to determine the third connection relationship even when each port of each switch has a MAC address.

[0051] In a fifth possible implementation, in combination with the fourth possible implementation, when determining the third connection relationship according to the MAC address of the switch port included in the MAC address table of each first port, the MAC address of each port of the redundancy manager in the target network may be first deleted from the MAC address table of each first port to eliminate interference from the redundancy manager, and then the second connection relationship may be determined according to the MAC address of the switch port included in the MAC address table of each first port. Specifically, the third connection relationship may be determined in the following manner:

[0052] For any switch in the target network, if the MAC addresses of at least two ports on the switch are located in the MAC address table of the same port of another switch in the target network, the switch is determined to be a redundancy manager in the target network, and the MAC addresses of all ports on the switch are deleted from the MAC address tables of the first ports;

[0053] For each of the first ports in the target network, if the MAC address table of the first port includes a MAC address of a second port in the target network, determining that the first port is connected to the second port, wherein the first port and the second port are located on different switches in the target network;

[0054] The third connection relationship in the target network is determined according to the connection relationship between each of the first port and the second port in the target network and the switches to which the first port and the second port belong.

[0055] In the embodiment of the present invention, the MAC addresses of at least two ports on the switch serving as the redundant manager appear in the MAC address table of the same port of another switch. Based on this feature, the switch serving as the redundant manager can be screened out from each switch. After deleting the MAC addresses of each port on the redundant manager from the MAC address table of each first port, the MAC addresses of the connected ports on the two switches appear in each other's MAC address table. Based on this feature, the third connection relationship can be determined based on the MAC addresses of the switch ports included in the MAC address table of each first port. Since the MAC addresses of the switch ports included in each MAC address table can more intuitively reflect the connection relationship between switches, the connection relationship between switches in the target network can be quickly determined based on the MAC addresses of the switch ports, thereby improving the efficiency of building the network topology.

[0056] In a sixth possible implementation, in combination with the fourth possible implementation, when determining the third connection relationship according to the MAC address of the terminal device included in the MAC address table of each first port, the third connection relationship can be determined according to the number of MAC addresses of the terminal device included in the MAC address table of each first port and the number of MAC addresses of the same terminal device included in the MAC address tables of different first ports. Specifically, the third connection relationship can be determined in the following manner:

[0057] For each of the first ports in the target network, execute:

[0058] Filtering a third port from the other first ports in the target network except the first port, wherein the MAC address table of the third port and the MAC address table of the first port include at least one identical MAC address;

[0059] Acquire a first MAC address set corresponding to the first port, wherein the elements in the first MAC address set are MAC addresses of terminal devices included in the MAC address table of the first port;

[0060] For each of the third ports, obtain a second MAC address set corresponding to the third port, wherein the elements in the second MAC address set are MAC addresses of terminal devices included in the MAC address table of the third port;

[0061] Determine a connection relationship between the first port and the third port according to an inclusion relationship between the first MAC address set and each of the second MAC address sets, and an inclusion relationship between a subset of the first MAC address set and each of the second MAC address sets;

[0062] The third connection relationship in the target network is determined according to the connection relationship between each of the first ports and the third ports in the target network and the switches to which the first ports and the third ports belong.

[0063] In the embodiment of the present invention, the MAC address of the terminal device connected to the lower switch appears in the MAC address table of the port of the upper switch, so the set of MAC addresses included in the MAC address table of the port of the lower switch is a subset of the set of MAC addresses included in the MAC address table of the port of the upper switch. According to this feature, the third connection relationship can be derived according to the MAC address of the terminal device included in the MAC address table of each first port. Since various types of switches can obtain the MAC address table including the terminal device, the third connection relationship determination method can be applied to various types of networks, so it has strong applicability.

[0064] In a seventh possible implementation, in combination with any of the above aspects, the first possible implementation, the second possible implementation, the third possible implementation, the fourth possible implementation, the fifth possible implementation, or the sixth possible implementation, it can be determined whether the terminal device is connected to an I / O device based on the network protocol followed by the terminal device. If it is determined that the terminal device is connected to an I / O device, the identifier of the I / O device connected thereto can be obtained. Specifically, the identifier of the I / O device can be obtained in the following manner:

[0065] For each terminal device in the target network, execute:

[0066] Acquire at least one network protocol followed by the terminal device through a switch connected to the terminal device in the target network;

[0067] If the at least one network protocol followed by the terminal device includes a preset management protocol, it is determined that the terminal device is connected to an I / O device, and an identification of the I / O device connected to the terminal device is obtained, wherein the management protocol is a network protocol followed by the terminal device when interacting with the connected I / O device.

[0068] In an embodiment of the present invention, in order to determine whether the terminal device is connected to an I / O device, it is possible to first determine which network protocol the terminal device complies with. If the network protocol followed by the terminal device includes the network protocol followed by the terminal device when interacting with the I / O device, it indicates that the terminal device is a device with management functions, and an I / O device is also connected to the lower end of the terminal device. Therefore, an identifier for identifying the I / O device to which the terminal device is connected can be obtained from the terminal device. Since the terminal device stores a lot of information, it will take a lot of time to search one by one from the large amount of information stored in the terminal device to see whether the identifier of the connected I / O device is stored. However, by identifying whether the terminal device is connected to an I / O device based on the protocol followed by the terminal device, it can simplify the operation of searching the terminal device to see whether the device stores an identifier, thereby improving the efficiency of obtaining the identifier stored on the terminal device. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 is a flow chart of a network topology construction method provided by an embodiment of the present invention;

[0070] Figure 2 is a schematic diagram of a network topology including a switch and a terminal device provided by an embodiment of the present invention;

[0071] Figure 3 is a schematic diagram of an initialized network topology provided by an embodiment of the present invention;

[0072] Figure 4 It is a schematic diagram of a network topology after determining the connection relationship between some switches and terminal devices provided by an embodiment of the present invention;

[0073] Figure 5 It is a schematic diagram of a network topology after determining the connection relationship between some switches and terminal devices provided by an embodiment of the present invention;

[0074] Figure 6 It is a schematic diagram of a network topology for determining a connection relationship between some switches provided by an embodiment of the present invention;

[0075] Figure 7 is a schematic diagram of a network topology provided by an embodiment of the present invention;

[0076] Figure 8 is a schematic diagram of an initialized network topology provided by an embodiment of the present invention;

[0077] Fig. 9 It is a schematic diagram of a network topology after determining the connection relationship between some switches and terminal devices provided by an embodiment of the present invention;

[0078] Fig.10 is a schematic diagram of an equivalent network topology provided by an embodiment of the present invention;

[0079] Fig.11 is a schematic diagram of a network topology provided by an embodiment of the present invention;

[0080] Fig.12 is a schematic diagram of an initialized network topology provided by an embodiment of the present invention;

[0081] Fig.13 It is a schematic diagram of a network topology after determining the connection relationship between a switch and a terminal device, provided by an embodiment of the present invention;

[0082] Fig.14 is a schematic diagram of a network topology including I / O devices provided by one embodiment of the present invention;

[0083] Fig.15 It is a schematic diagram of a computing device connected to a switch in a target network provided by an embodiment of the present invention;

[0084] Fig.16 is a schematic diagram of a computing device provided by one embodiment of the present invention;

[0085] Fig.17 is a schematic diagram of another computing device provided by one embodiment of the present invention;

[0086] Fig.18 is a schematic diagram of another computing device provided by an embodiment of the present invention;

[0087] Fig.19 is a schematic diagram of another computing device provided by an embodiment of the present invention;

[0088] Fig. 20 is a schematic diagram of another computing device provided by an embodiment of the present invention;

[0089] Fig.21 is a schematic diagram of another computing device provided by an embodiment of the present invention;

[0090] Fig. 22 is a schematic diagram of another computing device provided by an embodiment of the present invention.

[0091] List of reference numerals:

[0092] 101: Determine the target network for network topology construction

[0093] 102: Determine the identity of the I / O device in the target network

[0094] 103: Determine a first connection relationship between the terminal device and the I / O device

[0095] 104: Generate network topology based on the connection relationship between switches, the connection relationship between switches and terminal devices, and the connection relationship between I / O devices and terminal devices

[0096] 21: Network determination module 22: Identification acquisition module 23: Relationship determination module

[0097] 24: Topology processing module 25: Memory 26: Processor

[0098] 221: monitoring unit 222: acquisition unit 223: protocol determination unit

[0099] 224: second processing subunit 231: second relationship determination unit 232: third relationship determination unit

[0100] 2321: address deletion subunit 2322: first processing subunit 2323: first integration subunit

[0101] 2324: port screening subunit 2325: first set building subunit 2326: second set building subunit

[0102] 2327: Second relationship determination subunit 2328: Second integration subunit DETAILED DESCRIPTION

[0103] As mentioned above, when constructing the network topology, it is necessary to manually determine the physical connection relationship between different devices one by one on site. For example, the connection relationship between switches and the connection relationship between switches and terminal devices is manually identified, and then the network topology is constructed based on the identified connection relationship. However, the connection between devices is relatively complex, and it is easy to make mistakes during the manual identification process, which affects the accuracy of the network topology construction. In addition, when the number of devices to be identified is large and the locations of different devices are relatively far apart, it will take a lot of time to manually identify the connection relationship between devices, thereby reducing the efficiency of building the network topology.

[0104] In the embodiment of the present invention, since the MAC address table of the switch port includes the MAC address of the terminal device and the MAC address of the switch, the MAC address included in the MAC address table can not only reflect the connection relationship between the switches, but also reflect the connection relationship between the switch and the terminal device. Moreover, the connection relationship between the terminal device and the I / O device can also be reflected from the identification of the I / O device stored in the terminal device. Therefore, the stored MAC address table can be obtained from the switch, and the identification of the I / O device can be obtained from the terminal device, and then the connection relationship between the switches and the connection relationship between the terminal device and the switch can be determined according to the MAC address in the obtained MAC address table, and the connection relationship between the terminal device and the I / O device can be determined according to the identification of the I / O device, and finally the network topology of the switch, the terminal device and the I / O device in the target network can be constructed according to the determined connection relationship. Since the connection relationship between the devices in the target network does not need to be determined manually on site, it can not only reduce manual participation, but also shorten the time for determining the connection relationship between the devices, and improve the efficiency of constructing the network topology.

[0105] The ventilation system provided by the embodiment of the present invention is described in detail below with reference to the accompanying drawings.

[0106] like Figure 1 As shown, an embodiment of the present invention provides a network topology construction method, including:

[0107] Step 101: determining a target network for which network topology construction is to be performed, wherein the target network includes at least two switches, at least one terminal device, and at least one input / output I / O device, wherein the switches are connected to each other and the terminal device is connected to the switches via network cables, and the terminal device is connected to the I / O device via an I / O bus;

[0108] Step 102: Obtaining, through the switch, an identifier of an I / O device in the target network stored on the terminal device;

[0109] Step 103: for each terminal device in the target network, determining that the I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device;

[0110] Step 104: Generate a network topology of the target network according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship.

[0111] In an embodiment of the present invention, by determining the target network for which the network topology is to be constructed, the switch located in the target network, the terminal device that interacts with other devices through the network cable, and the I / O device that interacts with other devices through the I / O bus can be determined. Since the terminal device is connected to the I / O device, and the switch is directly or indirectly connected to the terminal device, the identifier of the I / O device to which the terminal device is connected can be obtained through the switch, and then the first connection relationship between the terminal device and the I / O device in the target network is determined based on the obtained identifier. Based on the second connection relationship between the switch and the terminal device in the target network and the third connection relationship between the switches, the network topology of the target network can be generated. It can be seen from the above that the connection relationship between the devices does not need to be manually confirmed on site. Therefore, it not only reduces the degree of manual participation in the process of network topology construction, but also avoids the situation where the manual identification of the physical connection relationship between the devices leads to errors in the construction of the network topology, and the efficiency of building the network topology can be improved.

[0112] In the embodiment of the present invention, the target network can be an independent network or composed of multiple networks. For example, switch a, terminal device b and I / O device c are located in the same local area network x, and switch d and terminal device e are located in local area network z. However, switch a and switch d exchange data, so the target network can be composed of local area network x and local area network z.

[0113] In the embodiment of the present invention, the terminal device may be a direct digital control (DDC) controller, a workstation, an IP gateway, a desktop computer, a laptop computer, a PLC, a communication module or a host computer, etc., which have network communication functions. The I / O device may be a printer, a mouse, a keyboard, an air conditioner, a humidifier, etc., which need to transmit data through the bus.

[0114] In an embodiment of the present invention, when obtaining the MAC address of the port of the switch in the target network, any switch in the target network can be monitored through the Simple Network Management Protocol (SNMP), the Address Resolution Protocol (ARP), and the Link Layer Discovery Protocol (LLDP), etc., to determine the data transmission path when the switch and other switches perform data transmission, and then determine one or more master switches that can perform data transmission with all switches in the target network from the target network, and determine each switch existing in the target network by monitoring the master switch. Then obtain the MAC address table of each port of the switch. For example, configuration information that complies with the Management Information Base (MIB) framework can be obtained through SNMP, and then the MAC address table of each port of the switch can be extracted from the obtained configuration information.

[0115] In the real-time example of the present invention, when obtaining the identification of the I / O device stored on the terminal device through the switch, the protocol followed by each terminal device can be determined first through the building control protocol BACnet / IP and the gateway protocol KNX / IP protocol, and then it can be determined whether the terminal device is connected to the I / O device. If the terminal device is connected to the I / O device, the identification of the connected I / O device will be stored, and the identification of the I / O device in the target network can be gradually obtained.

[0116] Optionally, in Figure 1 Based on the network topology construction method shown, when obtaining the identifier of the I / O device stored on the terminal device, it can be obtained in the following two ways:

[0117] Method 1: By monitoring any one or more switches in the target network, the data transmission path between the monitored switch and other devices can be determined, and the main switch that can interact with devices outside the target network can be determined from the target network through the data transmission path, and then the identification of the I / O device in the target network is obtained through the main switch.

[0118] Method 2: Since the I / O device is connected to the terminal device, it is possible to determine whether the terminal device is connected to the I / O device by judging the protocol followed by the terminal device. If so, the identifier of the I / O device connected to the terminal device is obtained from the terminal device.

[0119] Optionally, in Figure 1 On the basis of the network topology construction method shown, when determining the second connection relationship used to characterize the connection relationship between the terminal device and the switch in the target network according to the MAC address of the terminal device included in each MAC address table, the connection relationship between each terminal device and the switch in the target network can be determined based on the following three rules:

[0120] (1) When a port of a switch is directly connected to a terminal device (not a switch), there should be only one MAC address in the MAC address set corresponding to the port in the MAC address table of the switch.

[0121] (2) For devices that support PROFIENT (such as PLC, communication module, host computer, etc.), usually one port corresponds to multiple MAC addresses, one for binding with IP address (this MAC address will appear in the MAC address table of other switches), and the others for LLDP / PN-PTCP / MRP communications. Through SNMP, accessing ifPhysAddress.1 can obtain the MAC address bound to IP, and accessing ifPhysAddress.2 / 3... etc. can obtain the corresponding MAC addresses.

[0122] Therefore, the terminal device connected to the switch port can be determined based on whether the MAC address table of the switch port contains multiple MAC addresses corresponding to the same terminal device.

[0123] (3) By determining whether the MAC address table of the switch port contains both the MAC address of a terminal device and the MAC address of the port of another switch, it can be determined that the terminal device is not directly connected to the port of the first switch.

[0124] Optionally, according to whether the ports of each switch in the target network have a MAC address, two different methods can be used to determine the third connection relationship used to characterize the connection relationship between the switches. When the ports of each switch in the target network have a MAC address, the third connection relationship can be determined according to the MAC addresses of the switch ports included in the obtained MAC address tables, and when some or all of the ports of the switches in the target network do not have a MAC address, the third connection relationship can be determined according to the MAC addresses of the terminal devices included in the obtained MAC address tables.

[0125] The following describes in detail a method for determining the second connection relationship based on the MAC addresses of the terminal devices included in each MAC address table through Example 1, and describes in detail a method for determining the second connection relationship based on the MAC addresses of the switch ports included in each MAC address table through Example 2.

[0126] Embodiment 1:

[0127] 1. Initialization

[0128] Initialize MAC address set list list_of_mac_set=[];

[0129] Initialize the list of (direct) connections between terminal devices and switches switch_to_endpoint = [];

[0130] Initialize the ports connected between switches switch_to_switch = [];

[0131] Initial network topology, including all n switches S i and all terminal devices, and there is no connection between the switch and the terminal devices.

[0132] 2. Preprocess the input data and sort out the MAC address table list_of_mac_set of each port of each switch. The MAC address table list_of_mac_set is shown in Table 1 below.

[0133] Table 1

[0134]

[0135] 3. Based on the data in list_of_mac_set, identify the connection between the switch and the terminal device (not the connection between switches), and save the connection to the switch_to_endpoint list.

[0136] 1) When a port of a switch is directly connected to an IT device (not a switch), there should be only one address in the MAC address set corresponding to the corresponding port in the MAC address table of the switch.

[0137] 2) For devices that support PROFIENT (including PLC, communication module or host computer), usually one port corresponds to multiple MAC addresses, one is used to bind with IP address (this MAC address will appear in the MAC address table of other switches), and the other is used for LLDP / PN-PTCP / MRP communication. Through SNMP, access ifPhysAddress.1 to obtain the address bound to IP, and ifPhysAddress.2 / 3... etc. correspond to other MAC addresses.

[0138] Therefore, the terminal device connected to the switch port can be determined based on whether the MAC address table of the switch port contains multiple MAC addresses corresponding to the same device.

[0139] 3) By determining whether the MAC address table of the switch port contains both the MAC address of a terminal device (such as S623) and the MAC address of the port of another switch, it can be determined that the terminal device is not directly connected to the port of the first switch;

[0140] Connect the identified terminal devices to the corresponding switches in the network topology, and connect the set of terminal devices directly connected to the switches to S i ={D j , D k , ...} are added to the list switch_to_endpoint.

[0141] If a terminal device appears in the MAC address tables of multiple switch ports, and the port MAC address table only contains the MAC address of this terminal device (such as S i P j ={D k}), it is temporarily impossible to determine which switch the device is connected to. In this case, the MAC address tables of all such switch ports are combined into a (equivalent) set {S i P j ={D k}, ...}, added to the end of the list switch_to_endpoint.

[0142] 4. Extract the MAC address set of the interfaces in each switch that are not connected to the terminal device from Table 1 and mark it as S i P j , where S i is the switch number, and P j is the port number of the switch. i P j ={D k , D l , ...} are added to the list switch_to_switch.

[0143] There are two situations in existing switches. One is that the switch ports themselves do not have MAC addresses (if the switch provides a management interface, the management interface has a MAC address); the other switch assigns a MAC address to each network interface. Through SNMP, the MAC address of each port can be obtained by accessing the switch's OIDifPhysAddress (1.3.6.1.2.1.2.2.1.6).1. Therefore, this algorithm needs to filter out these addresses when constructing switch_to_switch.

[0144] 5. Derive the connection relationship between switches based on the equivalence relationship.

[0145] 1) Remove (and delete) the first S from switch_to_endpoint x

[0146] 2) Such as Sx For the shape of S x ={...} switch device set, then:

[0147] 2.1) Search for S in switch_to_switch x (Set of included devices)

[0148] 2.2) If there is only one S in switch_to_switch y P z (the set of devices included) and S x The same, that is, S y P z =S x , then delete S from the switch_to_switch table y P z ={D i,...}, and detect the switch S in the current network topology x With S y Is the connection between them confirmed?

[0149] If not, jump to step 4);

[0150] If the relationship has been derived, jump to step 6);

[0151] 2.3) If switch_to_switch matches more than two elements, that is, there are multiple S y P z satisfy (Multiple Equivalence Relation), then

[0152] Check the current network topology. If S x With multiple If there is no network connection between them, the (multiple) equivalence relation can be directly deleted and the process goes to step 6);

[0153] Otherwise, it means that the switch S cannot be confirmed at present. x With multiple Therefore, delete each from switch_to_switch And generate an equivalence class set And add it to the end of switch_to_endpoint, jump to step 6);

[0154] 2.4) If in S x If no result is obtained by performing full set matching, further subset matching is required;

[0155] For Sx Subset of Search for switch_to_switch in descending order of set size;

[0156] If there is a unique S in switch_to_switch y P z (the set of devices included) is the same as S′, that is, S y P z = S′, then jump to 2.2) and perform similar processing;

[0157] If switch_to_switch matches more than two elements, jump to step 2.3) and perform similar processing;

[0158] 2.5) If there is no S in switch_to_switch x (and its subsets), then S x Put it back at the end of switch_to_endpoint and jump to step 6).

[0159] 3) Such as S x For the form {S y P z ={D i} / S i , S u P v ={D j} / S i , ...}, then:

[0160] 3.1) Start with the first equivalence relation in the equivalence class set and try them one by one:

[0161] 3.2) Check the current equivalence relation. If this relation has been satisfied in the current network topology, skip this relation and return to 3.1) to select the next equivalence relation.

[0162] 3.3) For the current equivalence relation S y P z ={D i} / S i , try to connect the target device or switch D i / S i Connect to switch S y P z port;

[0163] 3.4) Check whether the current assumption is reasonable according to list_of_mac_set, including:

[0164] S y Pz Is the port already occupied by another connection and therefore cannot be used to connect to D i / S i ;

[0165] S y Do you have (or already have) other switches connected to S u 's interface, so that this equivalence class can be formed;

[0166] 3.5) If the assumption is not reasonable, jump to step 3.1) and try the next assumption;

[0167] 3.6) If the current assumptions are reasonable, then:

[0168] Save the scene of equivalence class selection (including current network topology, switch_to_endpoint, switch_to_switch, current equivalence class set, and current selection);

[0169] Delete the hypothetical relations that have been processed (including skipping and selecting) from the equivalence class set;

[0170] For the remaining equivalence class set: if it is empty, jump directly to step 4); if there is only one relation left in the equivalence class set, add the relation to switch_to_switch, otherwise put the modified equivalence class set back to the end of switch_to_endpoint. Then jump to step 4);

[0171] 3.7) If all equivalence relations in the equivalence class set cannot be established, put this equivalence relation back to the end of switch_to_endpoint and continue to derive it after obtaining more information through further deduction. Jump to step 6).

[0172] 4) In the network topology, switch S x Connect to switch S y P z port. And according to S in list_of_mac_set x The MAC address set corresponding to each port of the switch is used to determine S y P z Connect in S x The port of the device (may not be able to determine);

[0173] 5) Update the set of devices connected to the switch.

[0174] S x The collection of connected devices is merged into S y If switch_to_endpoint already exists Sy , update this S y (=Original S y +S x ); if switch_to_endpoint does not have S y , then the combined S y Add to the end of switch_to_endpoint;

[0175] Also, S y The collection of connected devices is merged into S x If switch_to_endpoint already exists S x , update this S x (=Original S x +S y ); if switch_to_endpoint does not have S x , then the combined S x Add to the end of switch_to_endpoint;

[0176] 6) If all switches in the current network topology have been connected to form a complete graph, the algorithm ends; otherwise, return to step 1) to continue processing.

[0177] If the switches are not connected to form a complete graph when switch_to_endpoint is empty, the most recent equivalence class set selection is taken out, the selection made at that time is abandoned, and the next equivalence relation is tried. If a graph still cannot be constructed, it will fall back to the earlier selection of an equivalence class set until a complete graph is constructed, or all possibilities of all equivalence class sets have been tried and a complete graph cannot be obtained, at which point the algorithm ends.

[0178] It should be noted that in the network topology construction method provided in the above-mentioned embodiment 1, when the access switch is connected to at least two terminal devices, the algorithm can accurately and completely construct a network topology that is consistent with the actual network connection situation (Example 1); but when the access switch is only connected to one (or even no) terminal device, the algorithm can still derive a complete network topology (Example 2), but this network topology may not be consistent with the actual network connection situation, but is an equivalent network topology.

[0179] Embodiment 2:

[0180] 1. Initialization

[0181] Initialize MAC address set list list_of_mac_set=[];

[0182] Initial network topology, including all n switches S i and all terminal devices, and there is no connection between the switch and the terminal devices;

[0183] 2. Pre-process the input data (the MAC address table of each switch port collected through SNMP, and the MAC address of the port itself) to sort out the MAC address table list_of_mac_set of each switch (each port).

[0184] 3. According to the MAC address table of each port of each switch, determine the connection status between the switch and the terminal device:

[0185] 1) Whether the MAC address table of the switch port contains multiple MAC addresses corresponding to the same device can determine the terminal device connected to the switch port.

[0186] 2) By determining whether the MAC address table of the switch port contains both the MAC address of a terminal device and the MAC address of the port of another switch, it can be determined that the terminal device is not directly connected to the port of the first switch;

[0187] 4. Clear all MAC addresses except the switch port MAC addresses from list_of_mac_set, including:

[0188] 1) MAC address of the terminal device;

[0189] 2) The MAC address of the switch management interface;

[0190] 3) and other irrelevant MAC addresses.

[0191] Then get the list_of_mac_set related only to the connections between switches.

[0192] 5. Derive the connection relationship between switches based on the addresses in the switch port MAC address table.

[0193] In industrial control networks, in order to achieve high network reliability, it is often supported to use multiple switches to form a ring network. Although the network is not logically a ring during normal operation (there is a link in the ring that is not used for actual communication), when a point in the network is interrupted, the backup link will be enabled to restore the connection between the switches. To construct and maintain such a ring network, a switch in the ring network needs to be configured as a management node (redundancy manager), and the MAC address of its port will be broadcast to the MAC address table of different ports of all switches in the ring network. Based on this feature, this MAC address can be easily excluded.

[0194] Therefore, according to the list_of_mac_set produced after cleaning in step 4, the following analysis is performed on the switches one by one:

[0195] 1) Analyze the MAC address table corresponding to each port of the current switch. If it is found that different ports have MAC addresses of (different) ports of the same switch, it can be determined that this switch is a redundant manager and the MAC address of its port can be excluded;

[0196] 2) For each port whose MAC address table on the current switch port is not empty (it only contains one MAC address at this time), it can be directly deduced that the current interface of the current switch is connected to the port (of another switch) corresponding to this MAC address.

[0197] The above process is repeated repeatedly until all ports of all switches in list_of_mac_set are processed. At this point, all switches are connected to form a complete graph.

[0198] The network construction method provided by the above-mentioned embodiment 1 and embodiment 2 is further described in detail below with reference to specific examples. Among them, the third embodiment, the fourth embodiment and the fifth embodiment correspond to the first embodiment, and the second connection relationship is determined according to the MAC address of the terminal device in each MAC address table during the network topology construction process, and the sixth embodiment corresponds to the second embodiment, and the second connection relationship is determined according to the MAC address of the switch port in each MAC address table during the network topology construction process.

[0199] Embodiment three:

[0200] In this example, it is assumed that the monitored network topology is as follows Figure 2 As shown, the circle represents a switch and the square represents a terminal device.

[0201] Through (SNMP) detection, the MAC address table of each switch is obtained in advance, and the derivation process of its network topology is as follows:

[0202] 1. Initialize list_of_access_switch = [], switch_to_endpoint = [], switch_to_switch = [], and initialize the network topology as Figure 3 shown.

[0203] 2. After sorting the switch port MAC address table data obtained by SNMP detection, list_of_mac_set can be obtained as shown in Table 2 below.

[0204] Table 2

[0205]

[0206]

[0207] 3. Identify terminal device D i , i = 1...11, and connect it to the corresponding switch in the network topology, as follows Figure 4 shown.

[0208] Construct a list of MAC addresses of access switches switch_to_endpoint = [S1 = {D1, D2}, S2 = {D3, D4}, S3 = {D5, D6}, S4 = {D7, D8}, S5 = {D9, D 10},S6={D 13 , D 14},S8={D 12}, {S2P3={D 11},S7P2={D 11}}]

[0209] 4. Construct the MAC address set list Switch_to_switch between switches as follows:

[0210] switch_to_switch=[S1P3={D 11 , D 12 , D 13 , D 14}, S3P3 = {D 11 , D 13 , D 14},S4P3={D 12 , D 13 , D 14},S5P3={D 11 , D 12}, S6P3={D1, D2, D5, D6, D7, D8, D 11 , D 12}, S7P1={D1, D2}, S7P3={D3, D4}, S7P4={D5, D6}, S7P5={D 12 , D 13 , D 14}, S8P2={D7, D8}, S8P3={D9, D 10},S8P4={D 11 , D 13 , D 14},S9P1={D 13 , D 14}, S9P2={D1, D2, D5, D6, D7, D8, D 11 , D 12},S 10 P1={D1,D2,D5,D6,D 11},S 10 P2={D7,D8,D9,D 10 , D 12},S 10 P3={D 13 , D 14}]

[0211] 5. Derive the connection relationship between switches based on the equivalence relationship.

[0212] (1) Take out S1 = {D1, D2} from switch_to_endpoint, first search for an element equivalent to {D1, D2} in switch_to_switch, and find the only one S7P1 = {D1, D2}, then:

[0213] In the network topology, switch S1 is connected to the P1 port of switch S7. At the same time, according to the port of S1 (according to list_of_mac_set), the P1 port of S7 can only be connected to the P3 port of S1.

[0214] Delete S7P1={D1, D2} from switch_to_switch table;

[0215] Since the switch_to_endpoint table does not originally contain S7, S7={D1, D2} is added to the end of the switch_to_endpoint table;

[0216] (2) Take out S2 = {D3, D4}, S3 = {D5, D6}, S4 = {D7, D8}, S5 = {D9, D 10}, and similar processing is performed (the difference is that there is already S7 in switch_to_endpoint, and the new device is added to the existing S7 set). The network topology obtained is as follows Figure 5 shown.

[0217] (3) Take out S6 from switch_to_endpoint = {D 13 , D 14}, search for the equivalent of {D 13 , D 14}, matching the previous two elements: S9P1 = {D13 , D 14},S 10 P3={D 13 , D 14}. At this point, it is impossible to determine whether switch S6 is connected to switch S9 or to switch S 10 Therefore, we can only create an equivalent set {S9P1=S6,S 10 P3=S6} and add it to the end of the switch_to_endpoint table.

[0218] at this time,

[0219] switch_to_endpoint=[S8={D 12 , D7, D8, D9, D 10}, {S2P3={D 11},S7P2={D 11}}, S7={D1, D2, D3, D4, D5, D6}, {S9P1=S6, S 10 P3 = S6}];

[0220] switch_to_switch=[S1P3={D 11 , D 12 , D 13 , D 14}, S3P3 = {D 11 , D 13 , D 14},S4P3={D 12 , D 13 , D 14},S5P3={D 11 , D 12}, S6P3={D1, D2, D5, D6, D7, D8, D 11 , D 12},S7P5={D 12 , D 13 , D 14},S8P4={D 11 , D 13 , D 14}, S9P2={D1, D2, D5, D6, D7, D8, D 11 , D 12},S 10 P1={D1,D2,D5,D6,D 11},S 10 P2={D7,D8,D9,D 10 , D 12},S9P1={D 13, D 14},S 10 P3={D 13 , D 14}].

[0221] (4) Take out S8 from switch_to_endpoint = {D 12 , D7, D8, D9, D 10}, search for the corresponding equivalent element in switch_to_switch, and match the only S 10 P2={D7,D8,D9,D 10 , D 12}.

[0222] In the network topology, connect switch S8 to switch S 10 P2 port;

[0223] Delete S from the switch_to_switch table 10 P2={D7,D8,D9,D 10 , D 12};

[0224] Since the switch_to_endpoint table does not originally contain S7, S 10 ={D7, D8, D9, D 10 , D 12} to the end of the switch_to_endpoint table.

[0225] (5) Take out the equivalent set {S2P3 = {D 11},S7P2={D 11}}, and infer in turn:

[0226] Assume first that D 11 Connected to the P3 port of switch S2. Since it can be inferred from the previous point of view that this port has been used to connect to switch S7, this assumption is not feasible;

[0227] Assume that D 11 Connected to the P2 port of switch S7. Since it has been inferred that the P3 port of switch S2 is connected to the P3 port of switch S7, it can be naturally concluded that S2P3 = {D 11}, so the assumption holds.

[0228] Based on the above derivation,

[0229] In the network topology, device D 11 Connect to the P2 port of switch S7;

[0230] D 11 Add to S7 of the switch_to_endpoint table;

[0231] (6) Take out S7 from switch_to_endpoint = {D1, D2, D3, D4, D5, D6, D 11}, search for the corresponding equivalent element in switch_to_switch, and no element is matched.

[0232] Furthermore, searching for switch_to_switch with subsets of S7 (in descending order of set size) can match the only S 10 P1={D1,D2,D5,D6,D 11};

[0233] In the network topology, connect switch S7 to switch S 10 P1 port;

[0234] Delete S from the switch_to_switch table 10 P1={D1,D2,D5,D6,D 11};

[0235] {D1, D2, D5, D6, D 11} Added to the switch_to_endpoint table S 10 In the collection;

[0236] The network topology at this time is as follows Figure 6 shown.

[0237] (7) Extract the equivalence relation {S9P1=S6, S 10 P3=S6}, and infer in turn:

[0238] Assume first that S6 is connected to switch S 10 If the S9 is connected to the P3 port of the S 10 Only then can the equivalence relation {S9P1=S6,S 10 P3=S6}. But according to list_of_mac_set, S 10 There are three network interfaces in total, one is connected to S7, one is connected to S8, and the remaining network interface cannot be directly connected to S6 and S9 at the same time, so this assumption does not hold;

[0239] Assume that S6 is connected to the P1 port of switch S9. There is no evidence to suggest that this assumption is inconsistent.

[0240] Based on the above derivation,

[0241] In the network topology, connect device D6 to the P1 port of switch S9;

[0242] S9={D 13 , D 14} to the end of the switch_to_endpoint table.

[0243] (8) Take S from switch_to_endpoint 10 = {D1, D2, D5, D6, D 11 , D7, D8, D9, D 10 , D 12}, search for the corresponding equivalent element in switch_to_switch, and no element is matched.

[0244] Further, using S 10 The subsets of {D1, D2, D5, D6, D7, D8, D 11 , D 12} can match the above two elements, S6P3 = {D1, D2, D5, D6, D7, D8, D 11 , D 12} and S9P2 = {D1, D2, D5, D6, D7, D8, D 11 , D 12}.

[0245] After analysis, it is found that the two sets reflect the connection relationship between S9 and S6 that has been analyzed in step 7. Therefore, S6P3 = {D1, D2, D5, D6, D7, D8, D 11 , D 12} and S9P2 = {D1, D2, D5, D6, D7, D8, D 11 , D 12}.

[0246] (9) Take out S9 from switch_to_endpoint = {D 13 , D 14}, search for the equivalent of {D 13 , D 14}, (again) matching the previous two elements: S9P1 = {D 13 , D 14},S 10 P3={D13 , D 14}. Among them, S9P1={D 13 , D 14} is the current S9={D 13 , D 14}, and thus skipped.

[0247] In the network topology, connect switch S9 to switch S 10 The P3 port of the switch_to_switch table deletes S9P1={D 13 , D 14},S 10 P3={D 13 , D 14};

[0248] At this point, switch_to_endpoint is empty, all switches are connected to each other (forming an arbitrarily reachable graph), and the algorithm terminates. It can be seen that the algorithm accurately deduces the original network topology.

[0249] Embodiment 4:

[0250] In this example, it is assumed that the monitored network topology is as follows Figure 7 As shown, the circle represents a switch and the square represents a terminal device.

[0251] Because the MAC address table of the switch is related to whether there is communication between devices, the following assumptions are made in this example:

[0252] D1~D4 only communicate with D10;

[0253] D5~D7 only communicate with D11;

[0254] D8, D9, D10, and D11 communicate with each other.

[0255] Assuming that the MAC address table of each switch is obtained through (SNMP) detection, the derivation process of its network topology is as follows:

[0256] 1. Initialize list_of_mac_set = [], switch_to_endpoint = [], switch_to_switch = [], and initialize the network topology as Figure 8 shown.

[0257] 2. After sorting the switch port MAC address table data obtained by SNMP detection, list_of_mac_set can be obtained as shown in Table 3 below.

[0258] Table 3

[0259]

[0260]

[0261] 3. Identify terminal device D i , i = 1...11, and connect it to the corresponding switch in the network topology Topology, such as Fig. 9 shown.

[0262] Construct a list of MAC address sets of the intervening switches switch_to_endpoint = [S2 = {D2, D3}, S4 = {D5, D6}, S6 = {D8, D9}, {S7P1 = {D1}, S1P1 = {D1}}, {S1P2 = {D 10},S2P3={D 10}, S3P2 = {D 10},S7P2={D 10},S 10 P1={D 10}}, {S3P1={D4}, S7P4={D4}}, {S5P1={D7}, S8P3={D7}}, {S4P3={D 11},S5P2={D 11},S8P1={D 11},S 10 P2={D 11}]

[0263] For other devices, such as D1, D4, etc., since they appear on the ports of multiple switches at the same time, it is temporarily impossible to determine the switch to which they are directly connected.

[0264] 4. Construct the MAC address set list Switch_to_switch between switches as follows:

[0265] switch_to_switch=[S6P3={D 10 , D 11}, S7P3={D2, D3}, S8P2={D5, D6}, S8P4={D8, D9, D 10}, S9P1={D8, D9}, S9P2={D 10 , D 11},S 10 P3 = {D8, D9}].

[0266] 5. Derive the connection relationship between switches based on the equivalence relationship.

[0267] (1) Take out S2 = {D2, D3} from switch_to_endpoint, first search for an element equivalent to {D1, D2} in switch_to_switch, and find the only one S7P3 = {D2, D3}, then:

[0268] In the network topology, switch S2 is connected to the P3 port of switch S7. At the same time, according to the port of S2 (according to list_of_mac_set), the P3 port of S7 can only be connected to the P3 port of S2;

[0269] Delete S7P1={D1, D2} from switch_to_switch table;

[0270] Since the switch_to_endpoint table does not originally contain S7, S7={D2, D3} is added to the end of the switch_to_endpoint table;

[0271] (2) Take out S4 = {D5, D6} from switch_to_endpoint, first search for an element equivalent to {D5, D6} in switch_to_switch, and find the only one S8P2 = {D5, D6}, then:

[0272] In the network topology, switch S4 is connected to the P2 port of switch S8. At the same time, according to the port of S4 (according to list_of_mac_set), the P2 port of S8 can only be connected to the P3 port of S4.

[0273] Delete S8P2={D5, D6} from switch_to_switch table;

[0274] Since the switch_to_endpoint table does not originally contain S8, S8={D5, D6} is added to the end of the switch_to_endpoint table;

[0275] (3) Take S6 = {D8, D9} from switch_to_endpoint, search for an element equivalent to {D8, D9} in switch_to_switch, and match the two elements: S9P1 = {D8, D9}, S 10 P3 = {D8, D9}. At this point, it is impossible to determine whether switch S6 is connected to switch S9 or to switch S 10 Therefore, we can only create an equivalent set {S9P1=S6,S 10P3=S6} and add it to the end of the switch_to_endpoint table, and delete S9P1={D8,D9}, S 10 P3 = {D8, D9}.

[0276] (4) Take out the equivalence class set {S7P1 = {D1}, S1P1 = {D1}} from switch_to_endpoint and make inferences in sequence:

[0277] First, assume that D1 is connected to the P1 port of switch S7. According to list_of_mac_set, this assumption is valid. Therefore, the existing selection scene is saved.

[0278] Based on the above derivation,

[0279] Save the remaining S1P1={D1} in the equivalence class set to switch_to_switch;

[0280] In the network topology, connect device D1 to the P1 port of switch S7;

[0281] Add D1 to S7 of the switch_to_endpoint table;

[0282] (5) Take out the equivalence class set {S1P2 = {D 10},S2P3={D 10}, S3P2 = {D 10},S7P2={D 10},S 10 P1={D 10}}, and infer in turn:

[0283] Assume first that D 10 Connected to the P2 port of switch S1, according to list_of_mac_set, this assumption is currently valid.

[0284] Then, save the existing selection scene.

[0285] Based on the above derivation,

[0286] The remaining {S2P3={D 10}, S3P2 = {D 10},S7P2={D 10},S 10 P1={D 10}}Save to the end of the switch_to_endpoint table

[0287] In the network topology, device D 10 Connect to the P2 port of switch S1;

[0288] Since the switch_to_endpoint table does not originally contain S1, S1 = {D 10}Add to the end of the switch_to_endpoint table;

[0289] (6) Extract the equivalence relation {S3P1 = {D4}, S7P4 = {D4}} from switch_to_endpoint, and infer the following in turn:

[0290] First, assume that D4 is connected to the P1 port of switch S3. According to list_of_mac_set, this assumption is valid. Therefore, the existing selection scene is saved.

[0291] Based on the above derivation,

[0292] Save the remaining S7P4={D4} in the equivalence class set to switch_to_switch;

[0293] In the network topology, connect device D4 to the P1 port of switch S3;

[0294] Since the switch_to_endpoint table does not originally contain S3, S3={D4} is added to the end of the switch_to_endpoint table;

[0295] (7) Extract the equivalence relation {S5P1 = {D7}, S8P3 = {D7}} from switch_to_endpoint and infer the following in turn:

[0296] First assume that D7 is connected to the P1 port of switch S5. According to list_of_mac_set, this assumption is valid. Therefore, the existing selection scene is saved.

[0297] Based on the above derivation,

[0298] Save the remaining S8P3={D7} in the equivalence class set to switch_to_switch;

[0299] In the network topology, connect device D7 to the P1 port of switch S5;

[0300] Since the switch_to_endpoint table does not originally contain S5, S5={D7} is added to the end of the switch_to_endpoint table;

[0301] (8) Extract the equivalence relation {S4P3 = {D 11},S5P2={D 11},S8P1={D 11},S 10 P2={D 11}}, and infer in turn:

[0302] Assume first that D 11 Connected to the P3 port of switch S4. According to list_of_mac_set, the P3 port of switch S4 is already connected to S8, so this assumption is not true.

[0303] Assume that D 11 Connected to the P2 port of switch S5. According to list_of_mac_set, S5 has only two related ports. P1 is already connected to D7. If P2 is connected to (another terminal device) D 11 If the switch is connected, there is no network interface connected to other switches to form the current set of equivalence classes. Therefore, this assumption is not true either.

[0304] Assume that D 11 Connected to the P1 port of switch S8, according to list_of_mac_set, this assumption is true, so the existing selection scene is saved.

[0305] Based on the above derivation,

[0306] The remaining {S4P3={D 11},S5P2={D 11},S 10 P2={D 11}}Save to the end of the switch_to_endpoint table

[0307] In the network topology, device D 11 Connect to the P1 port of switch S8;

[0308] S8={D 11}Merge into the S1 set in the switch_to_endpoint table;

[0309] (9) Take S7 = {D2, D3, D1} from switch_to_endpoint, and first search for an element equivalent to {D2, D3, D1} in switch_to_switch, but no element is found;

[0310] Therefore, we start to construct subsets of {D2, D3, D1} in descending order, and search for the corresponding subsets in switch_to_switch. Finally, we find the only S1P1 = {D1} based on {D1}, then:

[0311] In the network topology, switch S7 is connected to the P1 port of switch S1. At the same time, according to the port of S7 (according to list_of_mac_set), the P1 port of S1 can only be connected to the P2 port of S7;

[0312] Since S1={D 10}, we can naturally expand S7 = {D2, D3, D1, D 10}, save it to the end of switch_to_endpoint;

[0313] Delete S1P1={D1} from switch_to_switch table;

[0314] Merge D1 into S1 in the switch_to_endpoint table.

[0315] (10) Take out S8 from switch_to_endpoint = {D5, D6, D 11}, first search for the equivalent of {D5, D6, D 11} and its subsets, no elements are found, so S8 = {D5, D6, D 11} put back at the end of switch_to_endpoint;

[0316] (11) Extract the equivalence relation {S9P1=S6, S 10 P3=S6}, and infer in turn:

[0317] First, assume that S6 is connected to the P1 port of switch S9. According to list_of_mac_set, this assumption is true. Therefore, the existing selection scene is saved.

[0318] Based on the above derivation,

[0319] The remaining S in the equivalence class set 10 P3 = {D8, D9} is saved in the switch_to_switch table;

[0320] In the network topology, device S6 is connected to the P1 port of switch S9;

[0321] Add S9={D8, D9} to the end of the switch_to_endpoint table;

[0322] (12) Extract the equivalence relation {S2P3 = {D 10}, S3P2 = {D 10},S7P2={D 10},S 10 P1={D 10}}, and infer in turn:

[0323] Since it has been inferred that D 10 Connected to switch S1, according to the existing network topology, S1 is connected to S7, S7 is connected to S2, so S2P3 = {D 10} has been satisfied and can be skipped;

[0324] For S3P2 = {D 10}

[0325] First assume that it is directly connected to S1. According to list_of_mac_set, this assumption is not true.

[0326] Assuming that it is connected to S7, the assumption is valid under the existing information. And according to list_of_mac_set, it can be deduced that S3 is connected to the P4 port of S7.

[0327] Based on the above derivation,

[0328] The remaining S in the equivalence class set 10 P1={D 10}Save to switch_to_switch table; delete S7P4={D4} from switch_to_switch,

[0329] In the network topology, connect device S3 to port P4 of switch S7;

[0330] S3={D4,D 10} and S3 = {D4} are added to the tail of the switch_to_endpoint table;

[0331] (13) Take out S1 from switch_to_endpoint = {D 10 , D1}, first search in switch_to_switch for the equivalent of {D 10 , D1} and its subsets, no elements are found, so S1={D 10 , D1} is put back to the end of switch_to_endpoint;

[0332] (14) Extract the equivalence relation {S4P3 = {D 11},S5P2={D 11},S 10 P2={D 11}}, and infer in turn:

[0333] Since it has been inferred that D 11 Connected to switch S8, according to the existing network topology, S4 is connected to S8, so S4P3 = {D 11} has been satisfied and can be skipped;

[0334] For S5P2 = {D 11},

[0335] First assume that it is directly connected to S8. According to list_of_mac_set, this assumption is valid. And according to list_of_mac_set, it can be deduced that S5 is connected to the P3 port of S8.

[0336] Based on the above derivation,

[0337] The remaining S in the equivalence class set 10 P2={D 11}Save to switch_to_switch table;

[0338] In the network topology, device S5 is connected to port P3 of switch S8;

[0339] S5={D7,D 11} and S8 = {D7} are added to the switch_to_endpoint table;

[0340] (15) Extract the equivalence relation {S4P3 = {D 11},S5P2={D 11},S 10 P2={D 11}}, and infer in turn:

[0341] Since it has been inferred that D 11 Connected to switch S8, according to the existing network topology, S4 is connected to S8, so S4P3 = {D 11} has been satisfied and can be skipped;

[0342] According to the existing network topology, S5 is connected to S8, so S5P2 = {D 11} has been satisfied and can be skipped;

[0343] For S10 P2={D 11}

[0344] First assume that it is directly connected to S8. According to list_of_mac_set, this assumption is valid. And according to list_of_mac_set, S 10 Connect to the P4 port of S8.

[0345] Based on the above derivation,

[0346] In the network topology, the device S 10 P2 is connected to the P4 port of switch S8;

[0347] S 10 ={D5, D6, D 11 , D7} is added to the switch_to_endpoint table;

[0348] (16) Take out S7 from switch_to_endpoint = {D2, D3, D1, D4, D 10}, first search in switch_to_switch for the equivalent of {D2, D3, D1, D4, D 10} element, not found;

[0349] Therefore, we start by constructing {D2, D3, D1, D4, D 10}, and search for the corresponding subset in switch_to_switch. Finally, according to {D 11} Find the only S 10 P2={D 11},but:

[0350] In the network topology, connect switch S7 to switch S 10 The P1 port, and the port of S7 (according to list_of_mac_set), S 10 The P1 port of the S7 can only be connected to the P4 port of the S7;

[0351] So we can expand S 10 = {D2, D3, D1, D4, D 10} to switch_to_endpoint;

[0352] Delete S from the switch_to_switch table 10 P2={D 11};

[0353] Merge D1 into S1 in the switch_to_endpoint table;

[0354] (17) Take out S8 from switch_to_endpoint = {D5, D6, D 11 , D7}, first search in switch_to_switch for the equivalent of {D5, D6, D 11 ,D7}, the element was not found;

[0355] Therefore, starting from the order of the set from large to small, construct = {D5, D6, D 11 , D7}, and search for the corresponding subset in switch_to_switch. Finally, according to {D 11} Find the only one S8P3={D7}, then:

[0356] In the network topology, switch S8 is connected to S 10 , so it can be skipped.

[0357] (18) Take out S9 = {D8, D9} from switch_to_endpoint, first search for an element equivalent to {D8, D9} in switch_to_switch, and match the unique S 10 P3={D8,D9}, then:

[0358] In the network topology, connect switch S9 to switch S 10 The P3 port,

[0359] At the same time, according to the port of S9 (according to list_of_mac_set), S 190 The P1 port can only be connected to the S 10 P3 port;

[0360] So we can expand S 10 ={D8, D9} to switch_to_endpoint;

[0361] Delete S from the switch_to_switch table 10 P3 = {D8, D9};

[0362] At this point, all switches are connected to form a whole, and the algorithm ends. The network topology obtained is as follows Fig.10 shown.

[0363] This topology is equivalent to the original topology, the only difference is that D1 and D 10 The switches connected are different. This difference can easily be adjusted manually to get the exact original topology.

[0364] Embodiment five:

[0365] This example uses a network consisting of multiple switches, which is common in OT networks. Its network topology is as follows: Fig.11 As shown, the circle represents a switch and the square represents a terminal device.

[0366] 1. Initialize list_of_mac_set = [], switch_to_endpoint = [], switch_to_switch = [], and initialize the network topology as Fig.12 shown.

[0367] 2. After sorting the switch port MAC address table data obtained by SNMP detection, list_of_mac_set can be obtained as shown in Table 4 below, and it is mapped to the symbol of the corresponding device (obtained through SNMP).

[0368] In this example, each switch port and the switch management port have their own MAC address, which also appears in the MAC address table of each switch port. A MAC address of the form "XX-XX-XX-XX-XX-XX SmPn" represents the MAC address of port n on switch m.

[0369] Table 4

[0370]

[0371]

[0372]

[0373] Although this algorithm does not use the port MAC address of the switch to deduce the connection relationship between switches, but more generally uses the terminal devices in the switch MAC address table for analysis, these switch port information are helpful in determining whether the terminal device is directly connected to a switch. For example, although S623 appears on a port of each switch, only the S6P3 port has the MAC address of S623, and other ports where S623 appears have other port MAC addresses, so it can be inferred that S623 is directly connected to the S6P3 port.

[0374] Here, list_of_mac_set obtained after clearing the MAC address of the switch (itself) is shown in Table 5 below.

[0375] Table 5

[0376]

[0377]

[0378] 3. Identify terminal device D i , i = 1...11, and connect it to the corresponding switch in the network topology Topology, such as Fig.13 shown.

[0379] Construct a list of MAC addresses of access switches:

[0380] switch_to_endpoint=[S1={CP443(1), CP443(2)}, S2={CP1543}, S3={CP343(1)}, S4={HP, CP343(2)}, S5={1214}, S6={S623}].

[0381] 4. Construct the MAC address set list switch_to_switch between switches as follows:

[0382] switch_to_switch=[S1P1={S623}, S1P2={1214,HP}, S2P1={S623}, S2P2={CP443(1), CP443(2), 1214,HP}, S3P1={S623}, S3P2={CP15 43,CP443(1),CP443(2),1214,HP}, S4P1={S623}, S5P1={S623}, S5P2={HP}, S6P2={CP1543,CP343(1), CP443(1), CP443(2), 1214,HP}.

[0383] 5. Derive the connection relationship between switches based on the equivalence relationship.

[0384] (1) Take out S1 = {CP443 (1), CP443 (2)} from switch_to_endpoint, first search for an element equivalent to {CP443 (1), CP443 (2)} and its subset in switch_to_switch, but no element is found, so S1 = {CP443 (1), CP443 (2)} is put back to the end of switch_to_endpoint;

[0385] (2) Take out S2 = {CP1543} from switch_to_endpoint, first search for an element equivalent to {CP1543} in switch_to_switch, but do not find it, so put S2 = {CP1543} back to the end of switch_to_endpoint;

[0386] (3) Take out S3 = {CP343 (1)} from switch_to_endpoint, first search for an element equivalent to {CP343 (1)} in switch_to_switch, but do not find it, so put S3 = {CP343 (1)} back to the end of switch_to_endpoint;

[0387] at this time,

[0388] switch_to_endpoint=[S4={HP, CP343(2)}, S5={1214}, S6={S623}, S1={CP443(1), CP443(2)}, S2={CP1543}, S3={CP343(1)}]

[0389] switch_to_switch=[S1P1={S623}, S1P2={1214,HP}, S2P1={S623}, S2P2={CP443(1), CP443(2), 1214,HP}, S3P1={S623}, S3P2={CP15 43,CP443(1),CP443(2),1214,HP}, S4P1={S623}, S5P1={S623}, S5P2={HP}, S6P2={CP1543,CP343(1), CP443(1), CP443(2), 1214,HP}

[0390] (4) Take out S4={HP, CP343(2)} from switch_to_endpoint, and first search for an element equivalent to {HP, CP343(2)} in switch_to_switch, but none is found.

[0391] Therefore, we start by constructing subsets of {HP, CP343 (2)} in descending order, and search for the corresponding subsets in switch_to_switch. Finally, we find the only S5P2 = {HP} based on {HP}, then:

[0392] In the network topology, switch S4 is connected to the P2 port of switch S5;

[0393] Therefore, S5 = {1214, HP, CP343 (2)} can be extended to switch_to_endpoint;

[0394] Delete S5P2={HP} from switch_to_switch table;

[0395] at this time,

[0396] switch_to_endpoint=[S5={1214, HP, CP343(2)}, S6={S623}, S1={CP443(1), CP443(2)}, S2={CP1543}, S3={CP343(1)}]

[0397] switch_to_switch=[S1P1={S623}, S1P2={1214,HP}, S2P1={S623}, S2P2={CP443(1), CP443(2), 1214,HP}, S3P1={S623}, S3P2= {CP1543,CP443(1),CP443(2),1214,HP},S4P1={S623},S5P1={S623},S6P2={CP1543,CP343(1),CP443(1),CP443(2),1214,HP}]

[0398] (5) Take out S5={1214,HP,CP343(2)} from switch_to_endpoint, and first search for an element equivalent to {1214,HP,CP343(2)} in switch_to_switch, but none is found.

[0399] Therefore, we start by constructing subsets of {1214, HP, CP343 (2)} in descending order, and search for the corresponding subset in switch_to_switch. Finally, we find the only S1P2 = {1214, HP} based on {1214, HP}, then:

[0400] In the network topology, switch S5 is connected to the P2 port of switch S1;

[0401] Therefore, S5 = {CP443 (1), CP443 (2), 1214, HP, CP343 (2)} can be extended to switch_to_endpoint;

[0402] Delete S1P2={1214,HP} from switch_to_switch table;

[0403] According to the operation described in step 5.5 of the algorithm, S1 should be expanded and S5 should be deleted. The execution is as follows:

[0404] switch_to_endpoint=[S6={S623}, S1={CP443(1), CP443(2), 1214, HP, CP343(2}, S2={CP1543}, S3={CP343(1)}];

[0405] switch_to_switch=[S1P1={S623}, S2P1={S623}, S2P2={CP443(1), CP443(2), 1214, HP}, S3P1={S623}, S3P2={CP1543, CP443(1), CP443(2), 1214, HP}, S4P1={S623}, S5P1={S623}, S6P2={CP1543, CP343(1), CP443(1), CP443(2), 1214, HP}];

[0406] (6) Take out S6={S623} from switch_to_endpoint, first search for an element equivalent to {S623} in switch_to_switch, and match multiple elements: S1P1={S623}, S2P1={S623}, S3P1={S623}, S4P1={S623}, S5P1={S623}.

[0407] At this time, the connection relationship between switches cannot be determined based on S623. Therefore, we can only create an equivalent set {S1P1 = {S623}, S2P1 = {S623}, S3P1 = {S623}, S4P1 = {S623}, S5P1 = {S623}} and add it to the end of the switch_to_endpoint table, and delete S1P1 = {S623}, S2P1 = {S623}, S3P1 = {S623}, S4P1 = {S623}, S5P1 = {S623} from switch_to_switch.

[0408] According to the steps described in Algorithm 5.2.3, the equivalent {S1P1=S6, S2P1=S6, S3P1=S6, S4P1=S6, S5P1=S6} is generated. At this time,

[0409] switch_to_endpoint=[S1={CP443(1), CP443(2), 1214, HP, CP343(2}, S2={CP1543}, S3={CP343(1)}, {S1P1=S6, S2P1=S6,, S3P1=S6, S4P1=S6, S5P1=S6}];

[0410] switch_to_switch=[S2P2={CP443(1),CP443(2),1214,HP}, S3P2={CP1543,CP443( 1), CP443(2),1214,HP}, S6P2={CP1543,CP343(1),CP443(1),CP443(2),1214,HP}];

[0411] (7) Take out S1 = {CP443(1), CP443(2), 1214, HP, CP343(2)} from switch_to_endpoint, and first search for an element equivalent to {CP443(1), CP443(2), 1214, HP, CP343(2)} in switch_to_switch, but none is found.

[0412] Therefore, we start by constructing a subset of {CP443(1), CP443(2), 1214, HP, CP343(2)} in descending order, and search for the corresponding subset in switch_to_switch. Finally, we find the unique S2P2 = {CP443(1), CP443(2), 1214, HP} based on {CP443(1), CP443(2), 1214, HP}, then:

[0413] In the network topology, switch S1 is connected to the P2 port of switch S2;

[0414] Therefore, S2 = {CP443 (1), CP443 (2), 1214, HP, CP343 (2)} can be extended to switch_to_endpoint;

[0415] Delete S2P2 = {CP443(1), CP443(2), 1214, HP} from switch_to_switch table;

[0416] at this time,

[0417] switch_to_endpoint=[S2={CP1543,CP443(1),CP443(2),1214,HP,CP343(2)}, S3={CP343(1)}, {S1P1=S6, S2P1=S6,, S3P1=S6, S4P1=S6, S5P1=S6}];

[0418] switch_to_switch=[S3P2={CP1543,CP443(1),CP443(2),1214,HP}, S6P2={CP1543,CP343(1),CP443(1),CP443(2),1214,HP}];

[0419] (8) Take out S2 = {CP1543, CP443(1), CP443(2), 1214, HP, CP343(2)} from switch_to_endpoint, and first search for an element equivalent to {CP1543, CP443(1), CP443(2), 1214, HP, CP343(2)} in switch_to_switch, but none is found.

[0420] Therefore, we start by constructing a subset of {CP1543, CP443(1), CP443(2), 1214, HP, CP343(2)} in descending order, and search for the corresponding subset in switch_to_switch. Finally, we find the unique S3P2 = {CP1543, CP443(1), CP443(2), 1214, HP} based on {CP1543, CP443(1), CP443(2), 1214, HP}, then:

[0421] In the network topology, switch S2 is connected to the P2 port of switch S3;

[0422] Therefore, S3 = {CP1543, CP443 (1), CP443 (2), 1214, HP} can be extended to switch_to_endpoint;

[0423] Delete S2P2 = {CP443(1), CP443(2), 1214, HP} from switch_to_switch table;

[0424] at this time,

[0425] switch_to_endpoint=[S3={CP1543,CP443(1),CP443(2),1214,HP,CP343(2),CP343(1)},{S1P1=S6,S2P1=S6,,S3P1=S6,S4P1=S6,S5P1=S6}];

[0426] switch_to_switch=[S6P2={CP1543,CP343(1),CP443(1),CP443(2),1214,HP}];

[0427] (9) Take out S3 = {CP1543, CP443 (1), CP443 (2), 1214, HP, CP343 (1)} from switch_to_endpoint, first search for the element equivalent to {CP1543, CP443 (1), CP443 (2), 1214, HP, CP343 (1)} in switch_to_switch, and match the unique S6P2 = {CP1543, CP343 (1), CP443 (1), CP443 (2), 1214, HP}, then:

[0428] In the network topology, switch S3 is connected to the P2 port of switch S6;

[0429] Therefore, S6 = {CP1543, CP343 (1), CP443 (1), CP443 (2), 1214, HP} can be extended to switch_to_endpoint;

[0430] Delete S6P2={CP1543,CP343(1),CP443(1),CP443(2),1214,HP} from the switch_to_switch table.

[0431] At this point, all switches are connected to form a complete graph, and the algorithm ends. The network topology obtained by the algorithm is completely consistent with the actual network topology.

[0432] Embodiment six:

[0433] The network used in this embodiment is the same as the network used in the fifth embodiment, and its network topology is as follows: Fig.11 As shown, the circle represents a switch and the square represents a terminal device.

[0434] 1. First, initialize the network topology as shown in Figure 12.

[0435] 2. After sorting out the switch port MAC address table data obtained by SNMP detection, list_of_mac_set can be obtained as shown in Table 4 in Example 5, and mapped to the symbol of the corresponding device (obtained through SNMP).

[0436] 3. Determine the connection status of the terminal device.

[0437] Similar to the fifth embodiment, the following rules are adopted:

[0438] 1) Whether the MAC address table of the switch port contains multiple MAC addresses corresponding to the same device, the terminal device connected to the switch port can be determined;

[0439] 2) By determining whether the MAC address table of the switch port contains both the MAC address of a terminal device (such as S623) and the MAC address of the port of another switch, it can be determined that the terminal device is not directly connected to the port of the first switch;

[0440] From this we can deduce that Fig.13 The network topology shown.

[0441] 4. Clear all MAC addresses except the switch port MAC addresses from list_of_mac_set, including:

[0442] 1) MAC address of the terminal device;

[0443] 2) The MAC address of the switch management interface;

[0444] 3) and other irrelevant MAC addresses.

[0445] Then, the list_of_mac_set shown in Table 6 below is obtained.

[0446] Table 6

[0447]

[0448]

[0449] 5. Derive the connection relationship between switches based on the MAC addresses in the switch port MAC address table.

[0450] According to the above list_of_mac_set, the connection relationship between switches can be deduced as follows:

[0451] 1) First analyze the port MAC address of switch S1 and find that both port P1 and port P2 contain switch S4. This situation will not occur under normal circumstances. Therefore, it is determined that S4 is the management node (redundancy manager) of the ring network and its port MAC address can be excluded.

[0452] Based on the remaining MAC addresses, it can be directly inferred that:

[0453] Port P1 of switch S1 is connected to port P2 of switch S2;

[0454] Port P2 of switch S1 is connected to port P1 of switch S5;

[0455] 2) For the port MAC address table of switch S2, similarly exclude the MAC address of port S4, and directly infer from the remaining MAC addresses:

[0456] Port P1 of switch S2 is connected to port P2 of switch S3;

[0457] Port P2 of switch S2 is connected to port P1 of switch S1;

[0458] 3) For the port MAC address table of switch S3, similarly exclude the MAC address of port S4, and directly infer from the remaining MAC addresses:

[0459] Port P1 of switch S3 is connected to port P2 of switch S6;

[0460] Port P2 of switch S3 is connected to port P1 of switch S2;

[0461] 4) For the port MAC address table of switch S4, which is a management switch, the following can be directly inferred based on the MAC addresses on its ports:

[0462] Port P1 of switch S4 is connected to port P2 of switch S5;

[0463] 5) For the port MAC address table of switch S5, similarly exclude the MAC address of port S4, and directly infer from the remaining MAC addresses:

[0464] Port P1 of switch S5 is connected to port P2 of switch S1;

[0465] In addition, according to step 4), it can be seen that port P2 of switch S5 is connected to port P1 of switch S4.

[0466] 6) For the port MAC address table of switch S6, similarly exclude the MAC address of port S4, and directly infer from the remaining MAC addresses:

[0467] Port P2 of switch S6 is connected to port P1 of switch S3;

[0468] At this point, all switches are connected to form a complete graph, and the algorithm ends. The network topology obtained by the algorithm is completely consistent with the actual network topology.

[0469] In addition, when obtaining the MAC address table of each port on each switch in the target network, the MAC address table of each port on each switch in the target network can be obtained from a switch located at the aggregation layer and / or core layer of the target network.

[0470] The switches in the network can be divided into access layer, aggregation layer and core layer. The switches in the access layer are used to connect terminal devices, the switches in the aggregation layer are used to connect the switches in the access layer and can also connect terminal devices. The switches in the core layer are used to connect the switches in the aggregation layer and can also connect terminal devices. Usually, the number of switches in the access layer is greater than the number of switches in the aggregation layer, and the number of switches in the aggregation layer is greater than the number of switches in the core layer.

[0471] When obtaining the MAC address table of a port from a switch located at the access layer of the network, such as Fig.13 As shown, a probe needs to be set on each of the switches S1-S6, and then the MAC address table of each port of the switch located at the access layer is obtained by using the set probe.

[0472] When obtaining the MAC address table of a port from a switch located at the aggregation layer of the network, such as Figure 7 As shown, it is necessary to set a probe on each switch among switches S7-S9, and then use the set probe to obtain the MAC address table of each port of the switch located at the aggregation layer and the access layer.

[0473] When obtaining the MAC address table of a port from a switch located at the core layer of the network, such as Figure 7 As shown, it is only necessary to set a probe on the switch S10, and then use the set probe to obtain the MAC address table of each port of each switch located in the core layer, the aggregation layer and the access layer.

[0474] From the above comparative analysis, it can be seen that the MAC address table of the port obtained by the switch located in the aggregation layer and / or core layer intersects with the MAC address table of the port obtained by the switch at the access layer. It is only necessary to set up probes on a small number of switches to obtain the MAC address of each port of each switch in the target network, making it more convenient to obtain the MAC address table, and at the same time, it can also reduce the cost of the process of obtaining the MAC address table.

[0475] Embodiment seven:

[0476] In this embodiment, based on Figure 2 , including the network topology of I / O devices such as Fig.14 As shown,

[0477] 1. Obtain the address information of the I / O device through BACnet / IP, KNX / IP or other third-party protocols, and then obtain list_io_to_endpoint as shown in Table 3 below:

[0478]

[0479]

[0480] 2. Due to the logo T 1.0.1 It represents the I / O device T1.0, marked with T 2.0.1 It represents the I / O device T2.1, marked as T 2.0.2 It represents the I / O device T2.2, marked with T 3.0.1 The device marked is I / O device T3.0, marked T 4.0.1 It represents the I / O device T4.0. 1.0.1 It is obtained from the terminal device D1, so the I / O device T1.0 can be connected to D1, marked as T 2.0.1 , T 2.0.2 , T 3.0.1 and T 4.0.1 Connection principle and marking T 1.0.1 The connection method is similar to D1. From this, the original network topology is derived.

[0481] based on Fig.14 The network topology construction method shown in Fig.15 As shown, this embodiment shows a schematic diagram of connecting a computing device to a main switch in a target network; wherein, Fig.15 C represents the computing device, S10 represents the main switch, S7, S8 and S9 represent the switches of the aggregation layer in the target network, and S1-S6 represent the switches of the access layer in the target network.

[0482] If the computing device is connected to a switch at the access layer in the target network, the computing device C is connected to switches S1-S6.

[0483] like Fig.16 As shown, one embodiment of the present invention provides a computing device, including:

[0484] A network determination module 21, used to determine a target network for which network topology construction is to be performed, wherein the target network includes at least two switches, at least one terminal device and at least one input / output I / O device, wherein the switches are connected to each other and the terminal device is connected to the switches via network cables, and the terminal device is connected to the I / O device via an I / O bus;

[0485] an identification acquisition module 22, configured to acquire, through the switch, an identification of an I / O device in the target network stored on the terminal device determined by the network determination module 21;

[0486] a relationship determination module 23, configured to determine, for each terminal device in the target network, whether the I / O device indicated by the identifier stored on the terminal device acquired by the identifier acquisition module 22 has a first connection relationship with the terminal device;

[0487] A topology processing module 24 is used to generate a network topology of the target network according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship determined by the relationship determination module 23.

[0488] Optionally, in Fig.16 The computing device shown is based on Fig.17 As shown, the identification acquisition module 22 includes:

[0489] A monitoring unit 221, configured to monitor at least one switch in the target network to determine a data transmission path when each monitored switch communicates with a device outside the target network;

[0490] An acquisition unit 222 is used to determine that the switch node connected to the device outside the target network in each data transmission path determined by the monitoring unit 221 is a main switch; and obtain the identifier of the I / O device in the target network stored on the terminal device through the main switch.

[0491] Optionally, the computing device is connected to a main switch in the target network.

[0492] Optionally, the computing device is connected to each switch included in the access layer in the target network.

[0493] Optionally, in Fig.16 The computing device shown is based on Fig.18 As shown, the relationship determination module 23 also includes:

[0494] A second relationship determination unit 231 is used to perform, for each port of the switch in the target network: if the MAC address table obtained from the port only includes one MAC address of a first terminal device in the target network, and the MAC address table obtained from ports other than the port is different from the MAC address table obtained from the port, then determine that the port is connected to the first terminal device; if the MAC address table obtained from the port includes at least two MAC addresses of a second terminal device in the target network, then determine that the port is connected to the second terminal device; determine the second connection relationship between the switch in the target network and the terminal device according to the connection relationship between the terminal device in the target network and the port of the switch and the ports included in each switch in the target network;

[0495] A third relationship determination unit 232 is used to determine whether each port on each switch in the target network has a MAC address; if each port on each switch in the target network has a MAC address, the third connection relationship in the target network is determined according to the MAC address of the port of the switch included in the MAC address table of each of the first ports in the target network; if at least one port of each switch in the target network does not have a MAC address, the third connection relationship in the target network is determined according to the MAC address of the terminal device included in the MAC address table of each of the first ports in the target network.

[0496] Optionally, in Fig.18 The computing device shown is based on Fig.19 As shown, the third relationship determining unit 232 includes:

[0497] an address deleting subunit 2321, configured to, for any switch in the target network, determine that the switch is a redundancy manager in the target network if the MAC addresses of at least two ports on the switch are in the MAC address table of the same port of another switch in the target network, and delete the MAC addresses of all ports on the switch from the MAC address tables of the first ports;

[0498] a first processing subunit 2322, configured to, for each of the first ports in the target network, determine that the first port is connected to a second port in the target network if the MAC address table of the first port includes a MAC address of a second port in the target network, wherein the first port and the second port are located on different switches in the target network;

[0499] A first integration subunit 2323 is used to determine the third connection relationship in the target network according to the connection relationship between each of the first port and the second port in the target network determined by the first processing subunit 2322 and the switches to which the first port and the second port belong.

[0500] Optionally, in Fig.18 The computing device shown is based on Fig. 20 As shown, the third relationship determining unit 232 includes:

[0501] a port screening subunit 2324, configured to screen, for each of the first ports in the target network, a third port from other first ports in the target network except the first port, wherein the MAC address table of the third port includes at least one identical MAC address as the MAC address table of the first port;

[0502] a first set construction subunit 2325, configured to obtain, for each of the first ports in the target network, a first MAC address set corresponding to the first port, wherein the elements in the first MAC address set are MAC addresses of terminal devices included in the MAC address table of the first port;

[0503] a second set building subunit 2326, configured to obtain, for each of the third ports screened by the port screening subunit 2324, a second MAC address set corresponding to the third port, wherein the elements in the second MAC address set are MAC addresses of terminal devices included in the MAC address table of the third port;

[0504] a second relationship determination subunit 2327, configured to determine a connection relationship between the first port and the third port according to an inclusion relationship between the first MAC address set obtained by the first set construction subunit 2325 and each of the second MAC address sets obtained by the second set construction subunit 2326, and an inclusion relationship between a subset of the first MAC address set obtained by the first set construction subunit 2325 and each of the second MAC address sets obtained by the second set construction subunit 2326;

[0505] A second integration subunit 2328 is used to determine the third connection relationship in the target network according to the connection relationship between each of the first port and the third port in the target network determined by the second relationship determination subunit 2327 and the switches to which the first port and the third port belong.

[0506] Optionally, in Fig.16The computing device shown is based on Fig.21 As shown, the identification acquisition module 22 includes:

[0507] a protocol determination unit 223, configured to obtain at least one network protocol followed by the terminal device through a switch connected to the terminal device in the target network;

[0508] A second processing sub-unit 224 is used to determine that the terminal device is connected to an I / O device and obtain the identification of the I / O device connected to the terminal device if the protocol determination unit 223 determines that the at least one network protocol followed by the terminal device includes a preset management protocol, wherein the management protocol is the network protocol followed by the terminal device when interacting with the connected I / O device.

[0509] like Fig. 22 As shown, an embodiment of the present invention further provides a computing device, including: at least one memory 25 and at least one processor 26;

[0510] The at least one memory 25 is configured to store executable instructions;

[0511] The at least one processor 26 is coupled to the at least one memory 25, and when executing the executable instructions, is configured to implement the network topology construction method as described herein.

[0512] The present invention also provides a computer-readable medium storing instructions for causing a machine to execute the network topology construction method as described herein. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code for implementing the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

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

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

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

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

[0517] It should be noted that not all steps and modules in the above-mentioned processes and system structure diagrams are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0518] In the above embodiments, the hardware unit can be realized by mechanical means or electrical means. For example, a hardware unit can include permanent dedicated circuits or logic (such as special processors, FPGA or ASIC) to complete the corresponding operation. The hardware unit can also include programmable logic or circuits (such as general-purpose processors or other programmable processors), which can be temporarily set by software to complete the corresponding operation. Concrete implementation (mechanical means or dedicated permanent circuits or temporarily set circuits) can be determined based on cost and time considerations.

[0519] The present invention is shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the code review methods in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.

Claims

1. Network topology construction method, It is characterized in that include: Determine a target network for which network topology construction is to be performed, wherein the target network includes at least two switches, at least one terminal device, and at least one input / output I / O device, wherein the switches are connected to each other and the terminal device is connected to the switches via network cables, and the terminal device is connected to the I / O device via an I / O bus; Acquire, through the switch, an identifier of an I / O device in the target network stored on the terminal device; For each terminal device in the target network, determining that an I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device; A network topology of the target network is generated according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship.

2. The method according to claim 1, It is characterized in that The step of obtaining, by the switch, an identifier of the I / O device in the target network stored on the terminal device includes: Monitoring at least one switch in the target network to determine a data transmission path when each monitored switch communicates with a device outside the target network; Determine as a main switch a switch node in each data transmission path that is connected to a device outside the target network; The identification of the I / O device in the target network stored on the terminal device is obtained through the main switch.

3. The method according to claim 2, It is characterized in that The monitoring of at least one switch in the target network includes: A computing device connected to each switch included in the access layer of the target network monitors at least one switch in the target network; The step of determining that a switch node in each data transmission path connected to a device outside the target network is a main switch includes: The computing device determines that a switch node in each data transmission path connected to a device outside the target network is a main switch; The acquiring, by the main switch, the identifier of the I / O device in the target network stored on the terminal device includes: The computing device obtains, through the main switch, an identification of the I / O device in the target network stored on the terminal device.

4. The method according to claim 1, It is characterized in that The step of determining a target network for which network topology construction is to be performed includes: A computing device connected to each switch included in the access layer of the target network determines the target network for which network topology construction is to be performed; The step of obtaining, by the switch, an identifier of the I / O device in the target network stored on the terminal device includes: The computing device obtains, through the switch, an identifier of the I / O device in the target network stored on the terminal device; The step of determining, for each terminal device in the target network, that the I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device includes: The computing device determines, for each terminal device in the target network, that the I / O device indicated by the identifier stored on the terminal device has a first connection relationship with the terminal device; The generating a network topology of the target network according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship includes: The computing device generates a network topology of the target network according to a second connection relationship between switches and terminal devices in the target network, a third connection relationship between switches, and the first connection relationship.

5. The method according to claim 1, It is characterized in that Before generating the network topology of the target network according to the second connection relationship between the switch and the terminal device in the target network, the third connection relationship between the switches, and the first connection relationship, the method further includes: For each port of the switch in the target network, execute: If the MAC address table obtained from the port includes only one MAC address of a first terminal device in the target network, and the MAC address table obtained from ports other than the port is different from the MAC address table obtained from the port, it is determined that the port is connected to the first terminal device; If the MAC address table obtained from the port includes at least two MAC addresses of a second terminal device in the target network, it is determined that the port is connected to the second terminal device; Determine a second connection relationship between the switch in the target network and the terminal device according to the connection relationship between the terminal device in the target network and the port of the switch and the ports included in each switch in the target network; Determine whether each port on each switch in the target network has a MAC address; If each port on each switch in the target network has a MAC address, determining the third connection relationship in the target network according to the MAC address of the port of the switch included in the MAC address table of each first port in the target network; If at least one port of each switch in the target network does not have a MAC address, the third connection relationship in the target network is determined according to the MAC address of the terminal device included in the MAC address table of each of the first ports in the target network.

6. The method according to claim 5, It is characterized in that The determining the third connection relationship in the target network according to the MAC address of the port of the switch included in the MAC address table of each of the first ports in the target network comprises: For any switch in the target network, if the MAC addresses of at least two ports on the switch are located in the MAC address table of the same port of another switch in the target network, the switch is determined to be a redundancy manager in the target network, and the MAC addresses of all ports on the switch are deleted from the MAC address tables of the first ports; For each of the first ports in the target network, if the MAC address table of the first port includes a MAC address of a second port in the target network, determining that the first port is connected to the second port, wherein the first port and the second port are located on different switches in the target network; The third connection relationship in the target network is determined according to the connection relationship between each of the first port and the second port in the target network and the switches to which the first port and the second port belong.

7. The method according to claim 5, It is characterized in that The determining the third connection relationship in the target network according to the MAC address of the terminal device included in the MAC address table of each of the first ports in the target network includes: For each of the first ports in the target network, execute: Filtering a third port from the other first ports in the target network except the first port, wherein the MAC address table of the third port and the MAC address table of the first port include at least one identical MAC address; Acquire a first MAC address set corresponding to the first port, wherein the elements in the first MAC address set are MAC addresses of terminal devices included in the MAC address table of the first port; For each of the third ports, obtain a second MAC address set corresponding to the third port, wherein the elements in the second MAC address set are MAC addresses of terminal devices included in the MAC address table of the third port; Determine a connection relationship between the first port and the third port according to an inclusion relationship between the first MAC address set and each of the second MAC address sets, and an inclusion relationship between a subset of the first MAC address set and each of the second MAC address sets; The third connection relationship in the target network is determined according to the connection relationship between each of the first ports and the third ports in the target network and the switches to which the first ports and the third ports belong.

8. The method according to any one of claims 1 to 7, It is characterized in that The step of obtaining, by the switch, an identifier of the I / O device in the target network stored on the terminal device includes: For each terminal device in the target network, execute: Acquire at least one network protocol followed by the terminal device through a switch connected to the terminal device in the target network; If the at least one network protocol followed by the terminal device includes a preset management protocol, it is determined that the terminal device is connected to an I / O device, and an identification of the I / O device connected to the terminal device is obtained, wherein the management protocol is a network protocol followed by the terminal device when interacting with the connected I / O device.

9. Computing equipment, It is characterized in that include: A network determination module (21) is used to determine a target network for which network topology construction is to be performed, wherein the target network includes at least two switches, at least one terminal device and at least one input / output I / O device, wherein the switches are connected to each other and the terminal device is connected to the switches via a network cable, and the terminal device is connected to the I / O device via an I / O bus; an identification acquisition module (22) for acquiring, through the switch, an identification of an I / O device in the target network stored on the terminal device determined by the network determination module (21); a relationship determination module (23) for determining, for each terminal device in the target network, whether the I / O device indicated by the identifier stored on the terminal device acquired by the identifier acquisition module (22) has a first connection relationship with the terminal device; A topology processing module (24) is used to generate a network topology of the target network based on a second connection relationship between switches and terminal devices in the target network, a third connection relationship between switches, and the first connection relationship determined by the relationship determination module (23).

10. Computing equipment, It is characterized in that include: at least one memory (25) and at least one processor (26); The at least one memory (25) is used to store a machine-readable program; The at least one processor (26) is configured to call the machine-readable program to execute the method according to any one of claims 1 to 8.

11. Computer readable media, It is characterized in that The computer readable medium stores computer instructions, which, when executed by a processor, cause the processor to perform any one of the methods of claims 1 to 8.

Citation Information

Patent Citations

  • Network topology structure recognition method and system

    CN107294797A

  • Method and device for identification in a computer network

    DE102017209428A1

  • Method, system, and program for discovering devices communicating through a switch

    US20030076788A1