Connection relationship identification method, device, switch, storage medium and program product

By identifying whether the external network device is a switch and determining its connection relationship, the problem of coarse granularity of the switch connection relationship identification in traditional methods is solved, and the accuracy and accuracy of the recognition are improved.

CN115865834BActive Publication Date: 2025-03-04DAWNING INT INFORMATION IND CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211454383.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-21
Publication Date
2025-03-04
Estimated Expiration
2042-11-21

AI Technical Summary

Technical Problem

Traditional methods have a coarse granularity when identifying the connection relationship between switches, resulting in inaccurate identification.

Method used

By obtaining the initial neighbor information of the local switch device, it is identified whether the external network device is a switch device, and determines whether the connection relationship is a stacking relationship based on the basic information of the switch device and the basic information of the local switch device.

Benefits of technology

It improves the accuracy and accuracy of the identification of connection relationships between switches, and can accurately judge the stacking relationship between switches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115865834B_ABST
    Figure CN115865834B_ABST
Patent Text Reader

Abstract

The present application relates to a connection relationship identification method, device, switch, storage medium and program product. The method includes: obtaining initial neighbor information of a local switch device; wherein the initial neighbor information includes basic information of an external network device connected to the local switch device; identifying a switch device from an external network device based on the basic information of the external network device; obtaining basic information of the switch device from the basic information of the external network device, and determining whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches based on the basic information of the switch device and the basic information of the local switch device. Through the method proposed in the embodiment of the present application, the type of connection relationship between switches can be accurately determined, solving the problem of coarse granularity of connection relationship identification between switches in traditional technology, and improving the accuracy and precision of connection relationship identification between switches.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a connection relationship identification method, device, switch, storage medium and program product. Background Art

[0002] With the development of computer and network technology, there are more and more network devices. Among them, switches are important network devices, which enable servers and other devices to form Ethernet through switches and provide network services. Generally, switches and servers are set up in data centers, and data centers usually have tens of thousands of network devices. Therefore, how to manage tens of thousands of network devices in data centers has become an important task.

[0003] Traditionally, network topology is usually established by identifying network devices connected to switches, thereby achieving efficient management of network devices in data centers based on network topology. However, traditional methods are relatively rough in identifying the connection relationship between switches, resulting in inaccurate connection relationships between switches. Summary of the invention

[0004] Based on this, it is necessary to provide a connection relationship identification method, device, switch, computer-readable storage medium and computer program product that can improve the accuracy of identifying the connection relationship between the switch and the connected network device in order to solve the above technical problems.

[0005] In a first aspect, the present application provides a connection relationship identification method. The method comprises:

[0006] Acquire initial neighbor information of the local switch device; the initial neighbor information includes basic information of the external network device connected to the local switch device;

[0007] According to the basic information of the external network device, the switch device is identified from the external network devices;

[0008] The basic information of the switch device is obtained from the basic information of the external network device, and according to the basic information of the switch device and the basic information of the local switch device, it is determined whether the connection relationship between the switch device and the local switch device is a stacking relationship between the switches.

[0009] In this implementation, the initial neighbor information of the local switch device is obtained; wherein the initial neighbor information includes the basic information of the external network device connected to the local switch device; then, the switch device is identified from the external network device according to the basic information of the external network device; and the basic information of the switch device is obtained from the basic information of the external network device, and whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches is determined according to the basic information of the switch device and the basic information of the local switch device. That is, in the embodiment of the present application, it is possible to identify whether the external network device connected to the local switch device is a switch device based on the neighbor information of the local switch device. And in the case where it is determined that the external network device is a switch device, it is determined whether the switch device connected to the local switch device is in a stacking relationship with the local switch device according to the basic information of the switch device and the basic information of the local switch device. That is, through the method proposed in the embodiment of the present application, the type of connection relationship between switches can be accurately determined, the problem of coarse granularity of connection relationship identification between switches in the traditional technology is solved, and the accuracy and precision of connection relationship identification between switches is improved.

[0010] In one embodiment, identifying a switch device from the external network device according to basic information of the external network device includes:

[0011] Based on a preset network management protocol, sending a first collection instruction to a management information base;

[0012] Acquire device-related information of the external network device from the management information base based on the first acquisition instruction; the device-related information includes at least one of device type, device model, device manufacturer, and device description;

[0013] According to the device-related information of the external network device, it is determined whether the external network device is a switch device.

[0014] In this implementation, when the local network device identifies whether the external network device connected to it is a switch device, it can send a first collection instruction to the management information base based on a preset network management protocol; and obtain device-related information of the external network device from the management information base based on the first collection instruction; then, based on the device-related information of the external network device, determine whether the external network device is a switch device; wherein the device-related information includes at least one of the device type, device model, device manufacturer, and device description; that is, in this embodiment, through the preset network management protocol, the device-related information of the external network device is obtained from the management information base, and the switch device in the external network device is identified based on the device-related information, which can improve the recognition accuracy of the switch device.

[0015] In one embodiment, determining whether the switch device and the local switch device are in a stacking relationship according to the basic information of the switch device and the basic information of the local switch device includes:

[0016] Get basic information about local switch devices;

[0017] Determine whether the basic information of the switch device is consistent with the basic information of the local switch device;

[0018] When it is determined that the basic information of the switch device is consistent with the basic information of the local switch device, it is determined that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

[0019] In this implementation, when the local switch device determines the connection relationship between itself and other switch devices, it first obtains its own basic information, and then determines whether the basic information of the switch device is consistent with its own basic information; and when it is determined that the basic information of the switch device is consistent with its own basic information, it determines that the connection relationship between the switch device and itself is a stacking relationship between switches; the method in this implementation can improve the recognition granularity of the switch connection relationship and improve the recognition accuracy of the switch connection relationship.

[0020] In one embodiment, the method further comprises:

[0021] When the basic information of the switch device is inconsistent with the basic information of the local switch device, it is determined that the connection relationship between the switch device and the local switch device is a cascade relationship between switches.

[0022] By adopting the method proposed in this embodiment, it is also possible to identify the external connection between ordinary switches and switches, and determine the cascade relationship between switches.

[0023] In one embodiment, obtaining initial neighbor information of a local switch device includes:

[0024] Based on the link layer discovery protocol, sending a second collection instruction to the management information base;

[0025] Based on the second collection instruction, basic information of the external network device connected to the local switch device is obtained from the management information base.

[0026] In this implementation, when the local switch device obtains the neighbor information of the local switch device, it can send a second collection instruction to the management information base based on the link layer discovery protocol; and obtain the basic information of the external network device connected to the local switch device from the management information base based on the second collection instruction; that is, in the embodiment of the present application, the neighbor information of the local switch device is obtained from the MIB library based on the LLDP protocol, which can improve the efficiency of obtaining the neighbor information.

[0027] In one embodiment, the basic information includes a device identifier; obtaining basic information of a switch device from basic information of an external network device, and determining whether the switch device and the local switch device are in a stacking relationship according to the basic information of the switch device and basic information of a local switch device, including:

[0028] Obtain the device ID of the switch device from the device ID of the external network device;

[0029] Get the device ID of the local switch device;

[0030] Determine whether the device ID of the switch device is consistent with the device ID of the local switch device;

[0031] When it is determined that the device identification of the switch device is consistent with the device identification of the local switch device, it is determined that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

[0032] In this implementation, when the local switch device identifies the switch device in the external network device, it can obtain the device identification of the switch device from the device identification of the external network device; and obtain the device identification of the local switch device; then, determine whether the device identification of the switch device is consistent with the device identification of the local switch device; when it is determined that the device identification of the switch device is consistent with the device identification of the local switch device, determine that the connection relationship between the switch device and the local switch device is a stacking relationship between switches; that is, in this embodiment, when the local switch device identifies the external network device as a switch device, if it is further determined that the device identification of the switch device is consistent with the device identification of the local switch device, then determine that the switch device and the local switch device are in a stacking relationship, that is, the two switches are stacked switches; through this method, it is possible to identify the internal connection relationship between the stacked switches, thereby improving the accuracy of identifying the connection relationship between the switches.

[0033] In one embodiment, the method further comprises:

[0034] In the case that the external network device is not a switch device, the connection relationship between the external network device and the local switch device is determined to be a cascade relationship between the external network device and the switch.

[0035] By adopting the method proposed in this embodiment, it is also possible to identify the external connection between other network devices and the switch, and determine the cascade relationship between the external network device and the switch.

[0036] In a second aspect, the present application also provides a connection relationship identification device. The device includes:

[0037] An acquisition module is used to acquire initial neighbor information of a local switch device; the initial neighbor information includes basic information of an external network device connected to the local switch device;

[0038] An identification module, used to identify a switch device from an external network device according to basic information of the external network device;

[0039] The determination module is used to obtain basic information of the switch device from basic information of the external network device, and determine whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches according to the basic information of the switch device and the basic information of the local switch device.

[0040] In a third aspect, the present application further provides a switch, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the connection relationship identification method in the first aspect when executing the computer program.

[0041] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the connection relationship identification method in the first aspect are implemented.

[0042] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the connection relationship identification method in the first aspect are implemented.

[0043] The above connection relationship identification method, device, switch, storage medium and computer program product obtain the initial neighbor information of the local switch device; wherein the initial neighbor information includes the basic information of the external network device connected to the local switch device; then, according to the basic information of the external network device, identify the switch device from the external network device; and obtain the basic information of the switch device from the basic information of the external network device, and determine whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches according to the basic information of the switch device and the basic information of the local switch device. That is, in the embodiment of the present application, it is possible to identify whether the external network device connected to the local switch device is a switch device based on the neighbor information of the local switch device. And in the case where it is determined that the external network device is a switch device, it is determined whether the switch device connected to the local switch device is in a stacking relationship with the local switch device according to the basic information of the switch device and the basic information of the local switch device. That is, through the method proposed in the embodiment of the present application, the type of connection relationship between switches can be accurately determined, the problem of coarse granularity of connection relationship identification between switches in the traditional technology is solved, and the accuracy and precision of connection relationship identification between switches is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 The diagram is a schematic diagram of the port changes of switches before and after stacking;

[0045] Figure 2 A diagram of an application environment of a connection relationship identification method in an embodiment;

[0046] Figure 3 A schematic diagram of a flow chart of a connection relationship identification method in one embodiment;

[0047] Figure 4 is a flow chart of a connection relationship identification method in another embodiment;

[0048] Figure 5 is a flow chart of a connection relationship identification method in another embodiment;

[0049] Figure 6 is a flow chart of a connection relationship identification method in another embodiment;

[0050] Figure 7 is a flow chart of a connection relationship identification method in another embodiment;

[0051] Figure 8 It is a flowchart of a connection relationship identification method in a specific embodiment;

[0052] Fig. 9is a structural block diagram of a connection relationship identification device in one embodiment;

[0053] Fig.10 FIG. 4 is a diagram showing the internal structure of a switch in an embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] With the development of network technology, a local area network technology has emerged that uses switches to connect various computers to form Ethernet. However, as the performance and ports of switches increase, the cost of switches also increases. For this reason, stacked switches have emerged. Stacked switches are connected by network cables to two switches with lower performance. The corresponding configuration is performed at the software level of the switches to achieve the purpose of expanding switch ports and increasing switch bandwidth. Stacked switches have the same characteristics as single switches and only expose one management IP address to the outside world, that is, they appear as one switch to the outside world.

[0056] refer to Figure 1 As shown in FIG. 1 , before switch A and switch B are stacked, switch A and switch B are two independent switches, each corresponding to four ports; after switch A and switch B are stacked, the logical ports of the stacked switches can reach 10, which significantly expands the ports of the switches.

[0057] Usually, in a data center, there are tens of thousands of network devices, and the number of ports involved may even reach hundreds of thousands. How to manage the connection relationship between these ports has become a difficult task. Usually, network administrators use the Link Layer Discovery Protocol (LLDP protocol) to identify the connection relationship between switches. However, without providing relevant network management information in advance, the existing technical means can only identify the connection relationship between switches through the LLDP protocol, and cannot determine whether this connection is an internal connection of the stacked switch or a regular external connection.

[0058] Based on this, the present application proposes a connection relationship identification method, which can identify the connection relationship between conventional switches with the help of the Simple Network Management Protocol (SNMP protocol) and the LLDP protocol, and can also determine whether this connection is a connection inside a stacked switch; in addition, through the method in the present application, the connection between the switch and other network devices can also be identified.

[0059] The following is an introduction to the technical solutions involved in the embodiments of the present application in combination with the scenarios in which the embodiments of the present application are applied.

[0060] The connection relationship identification method provided in the embodiment of the present application can be applied to Figure 2 In the application environment shown in the figure, the Ethernet includes a switch 202 and an external network device 204. The external network device 204 forms an Ethernet by connecting the switch 202. The external network device 204 may include a server, a switch, a router, a hub, a computer terminal, etc. The switches may be connected in a cascaded manner or in a stacked manner. The switches connected in a stacked manner form a stacked switch, which is used as a switch in the Ethernet, that is, each switch in the stacked switch corresponds to the same IP address.

[0061] In one embodiment, Figure 3 As shown, a connection relationship identification method is provided, which is applied to Figure 2 The following steps are used as an example to illustrate the switch in Figure 1:

[0062] Step 301: Acquire initial neighbor information of a local switch device.

[0063] The initial neighbor information includes basic information of the external network device connected to the local switch device. Optionally, the basic information of the external network device may include the device identifier, device identifier type, port identifier, and port identifier type of the external network device.

[0064] Optionally, the local switch device can obtain basic information of each external network device connected to the local switch device based on the LLDP protocol; in one implementation, the local switch device can send a basic information acquisition instruction to the external network device based on the LLDP protocol, and receive the basic information of the external network device returned by the external network device in response to the basic information acquisition instruction; in another implementation, the local switch device can also obtain the basic information of each external network device from the management information base (Management Information Base, MIB library for short) of the local switch device based on the LLDP protocol.

[0065] Step 302: Identify a switch device from the external network devices according to the basic information of the external network devices.

[0066] Among them, the external network devices connected to the local switch device may include switches, servers, routers, hubs, repeaters, bridges, gateways, network cards, adapters, wireless access points, firewalls, computers, etc. It should be noted that only some external network devices that may be connected to the switch device are listed here, and it is not intended to limit all network devices connected to the switch device.

[0067] Optionally, after determining each external network device connected to the local switch device, it is possible to further identify which external network devices are switch devices from the determined external network devices; optionally, the local switch device can identify the switch device from the external network devices based on the basic information of the external network device and the attribute characteristics of the switch device; that is, it is possible to determine whether the external network device meets the attribute characteristics of the switch device based on the basic information of the external network device. If it is determined that the external network device meets the attribute characteristics of the switch device, it can be determined that the external network device is a switch device. For example: it is possible to determine whether the external network device is a switch device based on the device identification type of the external network device; or, it is also possible to add tag information used to characterize that the external network device is a switch device, such as a tag character or a tag string, to the device identification of the external network device, and then it is possible to identify whether the device identification of the external network device contains the tag information to determine whether the external network device is a switch device. Of course, other identification methods can also be included, which are not listed one by one in this embodiment.

[0068] Step 303: Obtain basic information of the switch device from basic information of the external network device, and determine whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches according to the basic information of the switch device and the basic information of the local switch device.

[0069] Among them, the basic information of the external network device includes the basic information of all external network devices connected to the local switch device. The basic information can be stored in units of network devices, such as: basic information of network device A, basic information of network device B, etc.; of course, the basic information can also be stored in units of information categories, such as: a list of network devices corresponding to device identifiers, a list of network devices corresponding to port identifiers, etc. In addition, the stacking relationship in this embodiment represents that the two switches are stacked switches formed by stacking connections. For stacking switches, not only do you need to physically connect multiple switches through stacking cables, but you also need to configure the multiple switches to look like one switch to the outside through software configuration. When performing software configuration, you can configure the basic information of the multiple switches, such as setting the basic information of the multiple switches to be consistent.

[0070] Optionally, when the external network device connected to the local switch device is identified as a switch device, it can be further determined that the connection relationship between the external network device (switch device) and the local switch device is a stacking relationship between switches, that is, the switches are connected through internal connections (stacked connections) between stacked switches. Alternatively, it is determined that the connection relationship between the external network device (switch device) and the local switch device is a cascade relationship between switches, that is, the switches are connected through external connections (conventional connections) between cascaded switches. Exemplarily, in this embodiment, the connection relationship between the two can be determined by the basic information of the external switch device and the basic information of the local switch device.

[0071] In one implementation, when an external network device connected to a local switch device is identified as a switch device, basic information of the switch device can be first obtained from basic information of the external network device, and then the basic information of the switch device can be compared with the basic information of the local switch device to determine whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

[0072] It should be noted that, from the content description in the above step 301, it can be seen that the basic information of the external network device may include at least one different type of information. Therefore, when determining the connection relationship between the two by comparing the basic information of the two, the connection relationship between the two can be determined by comparing one preset information in the basic information of the two, or by comparing multiple preset information in the basic information of the two. The embodiment of the present application does not make specific limitations on this.

[0073] In addition, when comparing the basic information of the two, it is possible to compare whether the corresponding types of information in the basic information of the two are consistent to determine the connection relationship between the two; for example: when it is determined that the corresponding types of information of the two are consistent, it can be determined that the connection relationship between the two is a stacking relationship between switches, that is, a stacked switch is formed between the two; when it is determined that the corresponding types of information of the two are inconsistent, it can be determined that the connection relationship between the two is a cascade relationship between ordinary switches.

[0074] It should also be noted that when comparing multiple pieces of information, it can be determined that the two are in a stacking relationship when multiple pieces of information are consistent, or it can be determined that the two are in a stacking relationship when one or more pieces of information are consistent; the specific judgment rules can be determined based on the software configuration between the stacked switches in the actual application scenario, and the embodiments of the present application do not make specific limitations on this.

[0075] Optionally, when it is identified that the external network device connected to the local switch device is not a switch device, it can be determined that the connection relationship between the external network device and the local switch device is a cascade relationship between the external network device and the switch; that is, a cascade relationship between the switch and other network devices.

[0076] In the above connection relationship identification method, the initial neighbor information of the local switch device is obtained; wherein the initial neighbor information includes the basic information of the external network device connected to the local switch device; then, the switch device is identified from the external network device according to the basic information of the external network device; and the basic information of the switch device is obtained from the basic information of the external network device, and whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches is determined according to the basic information of the switch device and the basic information of the local switch device. That is, in the embodiment of the present application, it is possible to identify whether the external network device connected to the local switch device is a switch device based on the neighbor information of the local switch device. And in the case where it is determined that the external network device is a switch device, it is determined whether the switch device connected to the local switch device is in a stacking relationship with the local switch device according to the basic information of the switch device and the basic information of the local switch device. That is, through the method proposed in the embodiment of the present application, the type of connection relationship between switches can be accurately determined, the problem of coarse granularity of connection relationship identification between switches in the traditional technology is solved, and the accuracy and precision of connection relationship identification between switches is improved.

[0077] Figure 4 FIG. 1 is a flow chart of a connection relationship identification method in another embodiment. This embodiment relates to an optional implementation process in which a local switch device identifies a switch device from an external network device based on basic information of the external network device. Based on the above embodiment, Figure 4 As shown, the above step 302 includes:

[0078] Step 401: Send a first collection instruction to a management information base based on a preset network management protocol.

[0079] The preset network management protocol may be the above-mentioned simple network management protocol, namely, the SNMP protocol. The management information base may be a MIB base in a local switch device.

[0080] Optionally, the local switch device may generate a first acquisition instruction based on a preset network management protocol and according to basic information of the external network device, and send the first acquisition instruction to the management information base; the first acquisition instruction is used to obtain device-related information of the external network device from the management information base. Optionally, the first acquisition instruction may include an identifier of at least one external network device, that is, the local switch device may obtain device-related information of one external network device at a time from the management information base, or may obtain device-related information of multiple external network devices at a time; optionally, the identifier of the external network device may include at least one of a device identifier of the external network device, an IP address of the external network device, etc.

[0081] Step 402: Acquire device-related information of the external network device from a management information base based on the first collection instruction.

[0082] The device-related information may include at least one of device type, device model, device manufacturer, and device description.

[0083] Optionally, the first acquisition instruction may also include an information identifier corresponding to the device-related information, and different types of information may correspond to different information identifiers. Then, the first acquisition instruction may also include one or more information identifiers corresponding to different types of information; that is, if you want to obtain device-related information of an external network device from the management information base, you can generate a first acquisition instruction for obtaining the information of the external network device based on the information identifier corresponding to the device-related information.

[0084] Step 403: determine whether the external network device is a switch device according to the device-related information of the external network device.

[0085] Generally speaking, when a manufacturer produces a network device, it can use device-related information to indicate the type of the network device. For example, a marking character or marking string representing the type of the network device can be added to the device model. Alternatively, for some manufacturers that only produce one type of network device, the type of the network device can be determined directly through the device manufacturer. Alternatively, the type of the network device can be determined by identifying the device description information.

[0086] Optionally, when device-related information of an external network device is obtained, it is possible to determine whether the external network device is a switch device based on the device-related information and a preset device identification rule corresponding to the device-related information; illustratively, it is possible to directly determine whether the external network device is a switch device based on the device type of the external network device, or it is possible to determine whether the device model contains preset characters based on the device model of the external network device to determine whether the external network device is a switch device, etc.

[0087] In this embodiment, when the local network device identifies whether the external network device connected to it is a switch device, it can send a first collection instruction to the management information base based on a preset network management protocol; and obtain device-related information of the external network device from the management information base based on the first collection instruction; then, based on the device-related information of the external network device, determine whether the external network device is a switch device; wherein the device-related information includes at least one of the device type, device model, device manufacturer, and device description; that is, in this embodiment, through the preset network management protocol, the device-related information of the external network device is obtained from the management information base, and the switch device in the external network device is identified based on the device-related information, which can improve the recognition accuracy of the switch device.

[0088] Figure 5 FIG. 1 is a flow chart of a connection relationship identification method in another embodiment. This embodiment relates to an optional implementation process in which a local switch device determines whether a switch device and a local switch device are in a stacking relationship between switches based on basic information of the switch device and basic information of the local switch device. Based on the above embodiment, Figure 5 As shown, the above step 303 includes:

[0089] Step 501: Obtain basic information of a local switch device.

[0090] Optionally, the local switch device can obtain basic information of the local switch device from the MIB library of the local switch device based on the link layer discovery protocol, i.e., the LLDP protocol. The basic information of the local switch device may include a local device identifier, a local device identifier type, a local port identifier, a local port identifier type, etc.

[0091] Step 502: determine whether the basic information of the switch device is consistent with the basic information of the local switch device.

[0092] Optionally, it is possible to determine whether each piece of information in the basic information of the switch device is consistent with the corresponding information in the local switch device; for example, it is possible to determine whether the device identifier in the basic information of the switch device is consistent with the local device identifier of the local switch device; or, it is also possible to determine whether the device identifier type of the switch device is consistent with the local device identifier type of the local switch device, etc.

[0093] Step 503: When it is determined that the basic information of the switch device is consistent with the basic information of the local switch device, determine that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

[0094] Optionally, when it is determined that the basic information of the switch device is consistent with at least one item of basic information of the local switch device, the connection relationship between the switch device and the local switch device is determined to be a stacking relationship between switches; or when it is determined that the basic information of the switch device is consistent with each item of basic information of the local switch device, the connection relationship between the switch device and the local switch device is determined to be a stacking relationship between switches.

[0095] Optionally, when the basic information of the switch device is inconsistent with the basic information of the local switch device, the connection relationship between the switch device and the local switch device can be determined to be a cascade relationship between switches; that is, the connection between the switch device and the local switch device is a connection between ordinary switches. Optionally, if at least one piece of information in the two is consistent, the two are determined to be in a stacking relationship, then, on the contrary, if each piece of information in the two is different, the two are determined to be a cascade relationship between switches; if each piece of information in the two is the same, the two are determined to be a stacking relationship, then, on the contrary, if at least one piece of information in the two is different, the two are determined to be a cascade relationship between switches.

[0096] In this embodiment, when the local switch device determines the connection relationship between itself and other switch devices, it first obtains its own basic information, and then determines whether the basic information of the switch device is consistent with its own basic information; and when it is determined that the basic information of the switch device is consistent with its own basic information, it determines that the connection relationship between the switch device and itself is a stacking relationship between switches; the method in this embodiment can improve the recognition granularity of the switch connection relationship and improve the recognition accuracy of the switch connection relationship.

[0097] Figure 6FIG. 1 is a flow chart of a connection relationship identification method in another embodiment. This embodiment relates to an optional implementation process of a local switch device obtaining initial neighbor information of the local switch device based on the LLDP protocol. Based on the above embodiment, Figure 6 As shown, the above step 301 includes:

[0098] Step 601: Send a second collection instruction to a management information base based on a link layer discovery protocol.

[0099] Optionally, the second collection instruction may include information such as the version number of the SNMP protocol, the community name of the SNMP protocol, the port number of the SNMP protocol, the IP address of the local switch device, and the identifier of the information to be queried, wherein the information to be queried may include the device identifier of the external network device, the device identifier type of the external network device, the port identifier of the external network device, and the port identifier type of the external network device. It should be noted that a second collection instruction may carry at least one identifier of the information to be queried.

[0100] Exemplarily, the second collection instruction can be in the form of: snmpwalk-v 2c-c public IP address.1.3.6.1.2.1.2.2.1.1; wherein 2c is the version number of the SNMP protocol, public is the group name of the SNMP protocol, the IP address is the IP address of the local switch device, no specific example is given here, and .1.3.6.1.2.1.2.2.1.1 is the identifier of the information to be queried; different information may correspond to different information, for example, Table 1 lists the information identifiers of some information, and the information identifier may be the information number OID.

[0101] Table 1

[0102]

[0103]

[0104] Among them, the local device in Table 1 is the local switch device, and the remote device in Table 1 is the external network device connected to the local switch device, and the remote device can be a switch, a server, a network card, a router, etc. It should be noted that some of the information listed in Table 1 and the OID identifiers corresponding to each piece of information are only used for example description and are not used for specific limitation. Of course, by adopting the form of the second acquisition instruction, not only the information listed in the above Table 1 can be obtained, but also other types of information can be obtained, such as: the IP address of the remote device, etc. In addition, for the OID of each basic information of the local switch device listed in Table 1, it is explained that when obtaining the basic information of the local switch device, the second acquisition instruction as described above can also be used, as long as the identifier OID of the external network device in the second acquisition instruction is modified to the OID corresponding to the basic information of the local device.

[0105] Step 602: Acquire basic information of external network devices connected to the local switch device from a management information base based on the second acquisition instruction.

[0106] Optionally, in a case where a second collection instruction carries an identifier corresponding to an information, the local switch device may send multiple second collection instructions to the management information base to obtain basic information of the external network device connected to the local switch device.

[0107] Exemplarily, when the second acquisition instruction carries an identifier corresponding to an information, such as a remote device identifier, the local switch device can obtain the identifiers of multiple or all external network devices connected to the local switch device from the management information base, and obtain an identifier list corresponding to the external network devices; similarly, for other information of the external network device, a list corresponding to the information can also be obtained, which will not be described one by one here. It should be noted that when the OID corresponding to the information of the local switch device is carried, the information corresponding to the local switch device is obtained.

[0108] Based on the above Table 1, the acquired initial neighbor information of the local switch device may be as shown in Table 2.

[0109] Table 2

[0110]

[0111]

[0112] In this embodiment, when the local switch device obtains the neighbor information of the local switch device, it can send a second collection instruction to the management information base based on the link layer discovery protocol; and obtain the basic information of the external network device connected to the local switch device from the management information base based on the second collection instruction; that is, in the embodiment of the present application, the neighbor information of the local switch device is obtained from the MIB library based on the LLDP protocol, which can improve the efficiency of obtaining the neighbor information.

[0113] In one embodiment, the basic information of each external network device acquired by the local switch device may include a device identifier of the external network device. Figure 7 As shown, in the above step 303, the local switch device obtains the basic information of the switch device from the basic information of the external network device, and determines whether the switch device and the local switch device are in a stacking relationship according to the basic information of the switch device and the basic information of the local switch device, which may include:

[0114] Step 701: Acquire the device identification of the switch device from the device identification of the external network device.

[0115] The device identification of the external network device includes device identifications of multiple external network devices.

[0116] Optionally, after identifying the switch device in the external network device, the local device may obtain the device identification of the switch device from the device identification of the external network device.

[0117] Step 702: Obtain the device identification of the local switch device.

[0118] Optionally, when obtaining the device identification of the local switch device, the above Figure 5 The method for obtaining the basic information of the external network device in the embodiment is to obtain it from the MIB library based on the LLDP protocol, which will not be described in detail here.

[0119] Step 703: determine whether the device identification of the switch device is consistent with the device identification of the local switch device.

[0120] Step 704: when it is determined that the device identification of the switch device is consistent with the device identification of the local switch device, determine that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

[0121] In this embodiment, when the local switch device identifies the switch device in the external network device, it can obtain the device identification of the switch device from the device identification of the external network device; and obtain the device identification of the local switch device; then, determine whether the device identification of the switch device is consistent with the device identification of the local switch device; when it is determined that the device identification of the switch device is consistent with the device identification of the local switch device, determine that the connection relationship between the switch device and the local switch device is a stacking relationship between switches; that is, in this embodiment, when the local switch device identifies the external network device as a switch device, if it is further determined that the device identification of the switch device is consistent with the device identification of the local switch device, then determine that the switch device and the local switch device are in a stacking relationship, that is, the two switches are stacked switches; through this method, it is possible to identify the internal connection relationship between the stacked switches, thereby improving the accuracy of identifying the connection relationship between the switches.

[0122] In one embodiment, Figure 8 As shown, a specific embodiment of a connection relationship identification method is provided, which is applied to a local switch device, including:

[0123] Step 801: Obtain neighbor information of a local switch device based on the LLDP protocol.

[0124] Step 802: Identify whether the external network device connected to the local switch device is a switch device according to the neighbor information.

[0125] Step 803: When it is determined that the external network device is a switch device, it is determined whether the device identification of the switch device is consistent with the device identification of the local switch device.

[0126] Step 804: If they are consistent, it is determined that the connection relationship between the switch device and the local switch device is a stacking relationship.

[0127] Step 805: If they are inconsistent, determine that the connection relationship between the switch device and the local switch device is a cascade relationship between switches.

[0128] Step 806: When it is determined that the external network device is not a switch device, determine that the connection relationship between the external network device and the local switch device is a cascade relationship between the external network device and the switch.

[0129] In this embodiment, by combining the LLDP protocol and the SNMP protocol to identify the connection relationship of the switch, it is possible to identify the regular connection between the switch and other network devices, the regular connection between switches, and the stacking connection between switches. The method of the present application can greatly reduce the workload of operation and maintenance personnel, and the identified connection relationship can also be further used to generate network topology diagrams, etc.

[0130] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0131] Based on the same inventive concept, the embodiment of the present application also provides a connection relationship identification device for implementing the connection relationship identification method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more connection relationship identification device embodiments provided below can refer to the limitations of the connection relationship identification method above, and will not be repeated here.

[0132] In one embodiment, Fig. 9 As shown, a connection relationship identification device is provided, including: an acquisition module 901, an identification module 902 and a determination module 903, wherein:

[0133] The acquisition module 901 is used to acquire the initial neighbor information of the local switch device; the initial neighbor information includes basic information of the external network device connected to the local switch device;

[0134] An identification module 902, configured to identify a switch device from the external network devices according to basic information of the external network devices;

[0135] The determination module 903 is used to obtain basic information of the switch device from the basic information of the external network device, and determine whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches according to the basic information of the switch device and the basic information of the local switch device.

[0136] In one embodiment, the identification module 902 includes a first sending unit, a first acquisition unit and a first judgment unit; wherein the first sending unit is used to send a first acquisition instruction to a management information base based on a preset network management protocol; the first acquisition unit is used to acquire device-related information of an external network device from the management information base based on the first acquisition instruction; the device-related information includes at least one of device type, device model, device manufacturer, and device description; the first judgment unit is used to determine whether the external network device is a switch device based on the device-related information of the external network device.

[0137] In one embodiment, the above-mentioned determination module 903 includes a second acquisition unit, a second judgment unit and a determination unit; wherein the second acquisition unit is used to acquire basic information of the local switch device; the second judgment unit is used to determine whether the basic information of the switch device is consistent with the basic information of the local switch device; the determination unit is used to determine that the connection relationship between the switch device and the local switch device is a stacking relationship between switches when it is determined that the basic information of the switch device is consistent with the basic information of the local switch device.

[0138] In one embodiment, the determination unit is further configured to determine that the connection relationship between the switch device and the local switch device is a cascade relationship between switches when the basic information of the switch device is inconsistent with the basic information of the local switch device.

[0139] In one embodiment, the acquisition module 901 includes a second sending unit and a third acquisition unit; wherein the second sending unit is used to send a second acquisition instruction to the management information base based on the link layer discovery protocol; the third acquisition unit is used to obtain basic information of the external network device connected to the local switch device from the management information base based on the second acquisition instruction.

[0140] In one of the embodiments, the basic information includes a device identifier; the above-mentioned determination module 903 is specifically used to obtain the device identifier of the switch device from the device identifier of the external network device; obtain the device identifier of the local switch device; determine whether the device identifier of the switch device is consistent with the device identifier of the local switch device; when it is determined that the device identifier of the switch device is consistent with the device identifier of the local switch device, determine that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

[0141] In one embodiment, the determination module 903 is further configured to determine, when the external network device is not a switch device, that the connection relationship between the external network device and the local switch device is a cascade relationship between the external network device and the switch.

[0142] Each module in the above connection relationship identification device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the switch in hardware form, or can be stored in the memory in the switch in software form, so that the processor can call and execute the operations corresponding to each module.

[0143] In one embodiment, a switch is provided, whose internal structure diagram can be as follows: Fig.10 As shown. The switch includes a processor, a memory and a network interface connected through a system bus. The processor of the switch is used to provide computing and control capabilities. The memory of the switch includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the switch is used to store MIB library data. The network interface of the switch is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a connection relationship identification method is implemented.

[0144] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the switch to which the solution of the present application is applied. The specific switch may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0145] In one embodiment, a switch is provided, including a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of the connection relationship identification method in each of the above embodiments are implemented.

[0146] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the connection relationship identification method in each of the above embodiments are implemented.

[0147] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the connection relationship identification method in each of the above embodiments.

[0148] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0149] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0150] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A connection relationship identification method, characterized in that: The method comprises: Acquire initial neighbor information of a local switch device; the initial neighbor information includes basic information of an external network device connected to the local switch device; According to the basic information of the external network device, identifying a switch device from the external network device; Acquire basic information of the switch device from basic information of the external network device, and determine whether the connection relationship between the switch device and the local switch device is a stacking relationship between switches according to the basic information of the switch device and the basic information of the local switch device; The step of identifying a switch device from the external network device according to the basic information of the external network device includes: Identify a switch device from the external network device according to the basic information of the external network device and the attribute characteristics of the switch device; The determining, according to the basic information of the switch device and the basic information of the local switch device, whether the switch device and the local switch device are in a stacking relationship between switches includes: Obtaining basic information of the local switch device; Determine whether the basic information of the switch device is consistent with the basic information of the local switch device; If they are consistent, it is determined that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

2. The method according to claim 1, characterized in that The step of identifying a switch device from the external network device according to the basic information of the external network device includes: Based on a preset network management protocol, sending a first collection instruction to a management information base; Acquire device-related information of the external network device from the management information base based on the first acquisition instruction; the device-related information includes at least one of device type, device model, device manufacturer, and device description; It is determined whether the external network device is a switch device according to the device related information of the external network device.

3. The method according to claim 1, characterized in that The method further comprises: If the basic information of the switch device is inconsistent with the basic information of the local switch device, it is determined that the connection relationship between the switch device and the local switch device is a cascade relationship between switches.

4. The method according to claim 1, characterized in that The obtaining of initial neighbor information of the local switch device includes: Based on the link layer discovery protocol, sending a second collection instruction to the management information base; Based on the second collection instruction, basic information of the external network device connected to the local switch device is obtained from the management information base.

5. The method according to claim 1, characterized in that The obtaining of initial neighbor information of the local switch device includes: Based on the link layer discovery protocol, a basic information acquisition instruction is sent to an external network device connected to the local switch device; The basic information of the external network device returned by the external network device in response to the basic information acquisition instruction is received.

6. The method according to claim 1 or 2, characterized in that: The basic information includes a device identifier; the basic information of the switch device is obtained from the basic information of the external network device, and the basic information of the switch device and the basic information of the local switch device are used to determine whether the switch device and the local switch device are in a stacking relationship, including: Acquire the device identification of the switch device from the device identification of the external network device; Obtaining a device identification of the local switch device; Determine whether the device identification of the switch device is consistent with the device identification of the local switch device; If they are consistent, it is determined that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

7. A connection relationship identification device, characterized in that: The device comprises: An acquisition module, used to acquire initial neighbor information of a local switch device; the initial neighbor information includes basic information of an external network device connected to the local switch device; An identification module, used to identify a switch device from the external network device according to the basic information of the external network device; a determination module, configured to obtain basic information of the switch device from basic information of the external network device, and determine whether a connection relationship between the switch device and the local switch device is a stacking relationship between switches according to the basic information of the switch device and the basic information of the local switch device; The identification module is specifically used to identify the switch device from the external network device according to the basic information of the external network device and the attribute characteristics of the switch device; The determination module is specifically used to obtain basic information of the local switch device; determine whether the basic information of the switch device is consistent with the basic information of the local switch device; if consistent, determine that the connection relationship between the switch device and the local switch device is a stacking relationship between switches.

8. A switch, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Dynamic detection system and method of process layer network topology of smart substation

    CN108429637A