Equipment connectivity detection method, device, equipment and medium
By quickly determining the connectivity between devices based on topology and multi-layer message packaging in the SDN network, the problem of long-term and poor detection in the prior art is solved, and rapid fault location and network availability are achieved.
Patent Information
- Application Number
- CN202410111713.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-26
- Publication Date
- 2025-07-29
AI Technical Summary
In the prior art, device connectivity detection takes a long time and the detection effect is poor, so it is impossible to quickly determine the connectivity status between network devices in the SDN network.
The transmission path is determined by the topology based on SDN, and the packet is detected by multi-layer message encapsulation. The detection device receives and returns messages to determine path connectivity, and uses IP-IN-IP protocol encapsulation and TTL mechanism to ensure that the detection packet is transmitted according to the preset path.
Quickly detect the connectivity of the SDN network path, shorten the time for fault detection, ensure that the detection packets are forwarded according to the expected path, and improve network availability.
Smart Images

Figure CN120389964A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a method, apparatus, device, and medium for detecting device connectivity. Background Art
[0002] With the continuous popularization of public cloud data centers, the services of local data centers are gradually migrating to cloud data centers. To ensure the continuous service of services in a Software Defined Network (SDN), when a network device fails and network layer reachability cannot be achieved between network devices, a method for detecting the connectivity between network devices is required so that operation and maintenance personnel or software can quickly know the location of the failure, facilitating the fastest repair of the network. Summary of the Invention
[0003] Embodiments of this application provide a method, apparatus, device, and medium for detecting device connectivity, which can solve the problems in related technologies that the detection of connectivity takes a long time and the detection effect is not good.
[0004] In a first aspect, embodiments of this application provide a method for detecting device connectivity. An SDN includes multiple network devices, and a detection device accesses the SDN by directly connecting to a first network device. The method is applied to the detection device and includes:
[0005] Based on the topology of the SDN, determine a first transmission path to be detected, where the first transmission path includes a forward path sent from the detection device to a second network device and a loopback path returned from the second network device to the detection device, and the second network device is one of the multiple network devices;
[0006] According to the transmission order of detection packets on the first transmission path, based on the address information of each device on the first transmission path, perform multi-layer packet encapsulation on the initial detection packet to obtain a target detection packet, where each layer of encapsulation is used to: indicate the location information of the next-hop device to any network device that receives the detection packet;
[0007] Send the target detection packet corresponding to the first transmission path to the first network device;
[0008] If the initial detection packet returned by the first network device is received within a preset time period, determine that the connectivity state of the first transmission path is connected.
[0009] In the above method, the probe message records the address information of each network device node along the transmission path in the form of multi-layer encapsulation. After the probe device sends the probe message to the network device, after each network device decapsulates the outermost layer of the received message, it determines the next-hop device from the decapsulated probe message and forwards the probe message to it. This process is repeated until the message is forwarded back to the probe device. The probe device determines the path connectivity based on whether the forwarded message is received within a preset time. In this way, the connectivity of the entire SDN network path can be quickly detected, the fault discovery time is effectively shortened, and it is ensured that the probe message is forwarded along the expected path.
[0010] In a possible implementation manner, the network devices included in the above-mentioned forward path and the return path are the same, and the connection relationships between the network devices are the same.
[0011] In a possible implementation manner, based on the SDN topology structure, determining the first transmission path to be detected includes:
[0012] Based on the SDN topology structure, determining multiple candidate transmission paths including the second device;
[0013] From the multiple candidate transmission paths, screening out the candidate transmission paths whose included network devices meet the preset conditions as the first transmission path.
[0014] In the above method, by screening multiple candidate transmission paths including the second device, a candidate transmission path whose included network devices meet the preset conditions is obtained for configuring the second network device, and the first transmission path to be detected can be accurately determined from multiple transmission paths.
[0015] In a possible implementation manner, according to the transmission order of the probe message on the first transmission path, based on the address information of each device on the first transmission path, performing multi-layer message encapsulation on the initial probe message to obtain the target probe message, including:
[0016] Sort the devices on the first transmission path according to the transmission order of the probe message on the first transmission path;
[0017] Based on the sorting result of each network device, determine the device corresponding to each layer of encapsulation;
[0018] Perform multi-layer message encapsulation on the initial probe message based on the following process to obtain the target probe message: For each layer of encapsulation, encapsulate the current probe message based on the address information of the target device corresponding to each layer of encapsulation to obtain the probe message corresponding to each layer of encapsulation.
[0019] Based on the sorting results of the devices on the first transmission path, the device corresponding to each layer of encapsulation is determined, and then the address information of the target device corresponding to each layer of encapsulation is determined. Based on this address information, the current detection message is encapsulated. In this way, a target detection message can be obtained, and it is ensured that the position information of the next-hop device can be indicated to the network device receiving the detection message for each layer of encapsulation in the target detection message;
[0020] In a possible implementation manner, the above method further includes:
[0021] Obtain the connectivity status of the first transmission paths respectively corresponding to multiple network devices;
[0022] Based on the connectivity status of each first transmission path, determine the connectivity status between each network device in the SDN.
[0023] After respectively determining the connectivity of the first transmission paths respectively corresponding to multiple network devices, the above method can further analyze the connectivity between adjacent network devices based on the connectivity of multiple first transmission paths.
[0024] In a possible implementation manner, based on the connectivity status of each first transmission path, determining the connectivity status between each network device in the SDN includes:
[0025] For each first transmission path, split the first transmission path into a path set including multiple sub-paths, where a sub-path is a transmission path between two adjacent devices;
[0026] Compare each first path set with each second path set in the path sets corresponding to each first transmission path to determine the connectivity status between each network device in the SDN, where the connectivity status corresponding to the first path set is the path set corresponding to the connected first transmission path, and the connectivity status corresponding to the second path set is the path set corresponding to the unconnected first transmission path.
[0027] In the above method, the transmission path is split into multiple sub-paths and forms a path set. The connectivity status of each transmission path is the connectivity status of its corresponding path set. By comparing each path set, the connectivity status corresponding to each sub-path can be further determined. Since a sub-path is a transmission path between two adjacent devices, determining the connectivity status corresponding to each sub-path is equivalent to determining the connectivity status between each network device. Therefore, this method can quickly and efficiently determine the connectivity status between each network device.
[0028] In a possible implementation manner, the target detection message further includes a TTL corresponding to each layer of encapsulation, where the initial value of the TTL corresponding to each layer of encapsulation is 2.
[0029] In the above method, since the initial value of TTL corresponding to each layer of encapsulation is 2, the transit of the probe packet can be restricted to only one hop. When the probe packet is not transmitted according to the preset transmission path, that is, when the next-hop device is not the network device corresponding to the transmission path, since the TTL will be reduced to 0, the probe packet will be discarded. Therefore, it is ensured that the probe packets received by the probe device are all transmitted according to the preset transmission path.
[0030] In a possible implementation manner, sending a target probe packet corresponding to a first transmission path to a first network device includes:
[0031] Sending a preset number of target probe packets to the first network device;
[0032] After receiving the forwarded initial probe packet from the first network device within a preset duration, the above method further includes:
[0033] Determining the target number of the initial probe packets received within the preset duration, and determining the network quality of the first transmission path based on the target number and the preset number.
[0034] In the above method, by setting a packet loss mechanism, that is, for each target probe packet, a preset number of such target probe packets are sent at one time, and the probe device determines the network forwarding quality of the corresponding transmission path according to the number of received data packets. Through this design, the health status of all network devices can be indirectly reflected, and further the network quality between each network device can be detected.
[0035] In a possible implementation manner, the target probe packet is a packet encapsulated based on the IP-IN-IP protocol.
[0036] In a possible implementation manner, before sending target probe packets corresponding to multiple transmission paths to the first network device respectively, it further includes: for each transmission path, configuring an IPIP tunnel corresponding to each transmission path.
[0037] In the above method, by setting an IPIP tunnel for each transmission path, it is convenient for the subsequent transmission of the target probe packet.
[0038] In a second aspect, an embodiment of the present application provides a device connectivity detection device. In an SDN, there are multiple network devices, and a probe device accesses the SDN by directly connecting to a first network device. The probe device applied to the SDN includes:
[0039] A path determination module, configured to determine a first transmission path to be detected based on the topology structure of the SDN, where the first transmission path includes a forward path from the probe device to a second network device and a return path from the second network device back to the probe device, and the second network device is one of the multiple network devices;
[0040] An encapsulation module is configured to perform multi-layer message encapsulation on an initial detection message based on the address information of each device on a first transmission path in accordance with the transmission order of the detection message on the first transmission path, so as to obtain a target detection message, wherein each layer of encapsulation is used for: indicating the location information of the next-hop device to any network device that receives the detection message;
[0041] A first sending module is configured to send the target detection message corresponding to the first transmission path to a first network device;
[0042] A first determination module is configured to determine that the connectivity state with the first transmission path is connected if the initial detection message returned by the first network device is received within a preset duration.
[0043] In a third aspect, an embodiment of the present application provides a method for detecting device connectivity. There are multiple network devices in the SDN, and the detection device accesses the SDN by directly connecting to a first network device. The method is applied to any one of the multiple network devices and includes:
[0044] Receiving a detection message sent by another device directly connected to any network device, where the detection message is a target detection message or a message obtained by performing at least one-layer decapsulation on the target detection message. The target detection message is obtained by the detection device performing multi-layer message encapsulation on the initial detection message in accordance with the transmission order of the detection message on the first transmission path based on the address information of each device on the first transmission path. The first transmission path includes a forward path from the detection device to a second network device and a loop path from the second network device back to the detection device. The second network device is one of the multiple network devices. Each layer of encapsulation is used for: indicating the location information of the next-hop device to any network device that receives the detection message;
[0045] Decapsulating the outermost layer of encapsulation of the detection message and obtaining the address information of the next-hop device from the decapsulated detection message;
[0046] Sending the decapsulated detection message to the next-hop device.
[0047] In a possible implementation manner, the target detection message further includes a TTL corresponding to each layer of encapsulation, and the initial value of the TTL corresponding to each layer of encapsulation is 2;
[0048] Before decapsulating the outermost layer of encapsulation of the detection message, the above method further includes:
[0049] After subtracting 1 from the TTL value corresponding to the outermost layer of encapsulation, determining that the TTL value obtained after subtraction is not 0.
[0050] In a possible implementation manner, if the TTL value obtained after subtraction is 0, then discard the detection message.
[0051] In the above method, since the initial value of the TTL corresponding to each layer of encapsulation is 2, the relay of the detection message can be limited to only one hop. When the detection message is not transmitted along the preset transmission path, that is, when the next-hop device is not the network device corresponding to the transmission path, since the TTL will be reduced to 0, the detection message will be discarded. Therefore, it is ensured that the detection messages received by the detection device are all transmitted along the preset transmission path.
[0052] In a possible implementation, the target detection message is a message encapsulated based on the IP-IN-IP protocol.
[0053] Fourthly, an embodiment of the present application provides a device connectivity detection device. There are multiple network devices in the SDN. The detection device accesses the SDN by directly connecting to the first network device and is applied to any one of the multiple network devices, including:
[0054] A receiving module, configured to receive a detection message sent by another device directly connected to any network device, where the detection message is a target detection message or a message obtained by performing at least one layer of decapsulation on the target detection message. The target detection message is: the detection device encapsulates the initial detection message in multiple layers of messages according to the transmission order of the detection message on the first transmission path and based on the address information of each device on the first transmission path. The first transmission path includes a forward path from the detection device to the second network device and a return path from the second network device to the detection device. The second network device is one of the multiple network devices. Each layer of encapsulation is used to: indicate the location information of the next-hop device to any network device that receives the detection message;
[0055] A decapsulation module, configured to decapsulate the outermost layer of encapsulation of the detection message and obtain the address information of the next-hop device from the decapsulated detection message;
[0056] A second sending module, configured to send the decapsulated detection message to the next-hop device.
[0057] Fifthly, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the device connectivity detection method of the present application is implemented.
[0058] Sixthly, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps in the device connectivity detection method of the present application are implemented.
[0059] In a seventh aspect, an embodiment of the present application provides a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the memory access device executes the steps in the device connectivity detection method described above in the present application.
[0060] Other features and advantages of the present application will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present application. The objectives and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written specification, claims, and drawings. Description of the Drawings
[0061] The drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The illustrative embodiments and descriptions thereof of the present application are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0062] Figure 1 It is a schematic diagram of an application scenario of the device connectivity detection method provided by an embodiment of the present application;
[0063] Figure 2 It is a schematic flowchart of a device connectivity detection method provided by an embodiment of the present application;
[0064] Figure 3 It is a schematic diagram of an SDN topology provided by an embodiment of the present application;
[0065] Figure 4 It is a schematic flowchart of a device connectivity detection method applied to a detection device provided by an embodiment of the present application;
[0066] Figure 5 It is a schematic structural diagram of a device connectivity detection device applied to a detection device provided by an embodiment of the present application;
[0067] Figure 6 It is a schematic flowchart of a device connectivity detection method applied to a network device provided by an embodiment of the present application;
[0068] Figure 7 It is a schematic structural diagram of a device connectivity detection device applied to a network device provided by an embodiment of the present application;
[0069] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed Embodiments
[0070] To solve the problems of long time consumption and poor detection effect in detecting connectivity in related technologies, an embodiment of the present application provides a method, device, equipment and medium for detecting device connectivity.
[0071] The following further describes the present application in detail with reference to the accompanying drawings of the specification.
[0072] The application scenarios described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those of ordinary skill in the art know that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems. Among them, in the description of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.
[0073] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present invention. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.
[0074] For ease of understanding, the terms used in the embodiments of the present application are first explained as follows:
[0075] (1) SDN: It is an independent network architecture formulated by the ONF (Open Networking Foundation) organization to solve problems such as slow (protocol) development, lack of "consistent" policy control, poor scalability, and strong vendor dependence caused by the complexity of existing networks. There are mainly two components in the SDN system: the SDN controller and network devices.
[0076] (2) IP-in-IP Protocol: Also known as the IPIP protocol, it is a protocol used to encapsulate and transmit IP data packets in an Internet Protocol (IP) network. It is a tunneling protocol that allows an IP data packet to be encapsulated and transmitted as the payload of another IP data packet. In the IPIP protocol, the original IP data packet is encapsulated in a new IP data packet as the data part of the new IP data packet. At this time, the original IP data packet becomes the payload of the new IP data packet. The new IP data packet is transmitted using the external network, while the original IP data packet is transmitted within the internal network.
[0077] (3) IPIP Tunnel: A technology that uses the IPIP protocol to create tunnels in an IP network. It allows an IP data packet to be encapsulated in another IP data packet and transmitted over a public network. This tunneling technology is commonly used to build Virtual Private Networks (VPNs) or for communication between different physical networks. In an IPIP tunnel, the original IP data packet is encapsulated as the payload in a new IP data packet. The source and destination fields of the new IP data packet specify the entry and exit endpoints of the tunnel. When the new IP data packet is transmitted over the public network, it passes through routers and network devices and finally reaches the exit endpoint of the tunnel. At the exit endpoint, the new IP data packet is decapsulated, and the original IP data packet is extracted and delivered to the destination host for processing.
[0078] With the continuous popularization of public cloud data centers, the services of local data centers are gradually migrating to cloud data centers. To ensure the continuous service of the services in the SDN, when a network device fails and network layer reachability cannot be achieved between network devices, a method for detecting the connectivity between network devices is required so that operation and maintenance personnel or software can quickly know the location of the failure, facilitating the fastest repair of the network.
[0079] Currently, the connectivity between network devices is mainly detected through the following two methods.
[0080] One is to determine the connectivity between devices based on LLDP, which specifically includes the following steps:
[0081] LLDP Frame Sending: Network devices periodically send LLDP frames, encapsulating the LLDP Data Unit (DU) containing their own identification and information in an Ethernet frame and broadcasting it through all ports enabled with LLDP.
[0082] LLDP frame reception: An adjacent device listens for Ethernet frames on the network, receives an LLDP frame, and parses the TLV (Type-Length-Value) field in it according to the LLDP protocol.
[0083] Neighbor relationship establishment: The device parses the TLV field in the received LLDP frame, identifies the neighbor devices directly connected to itself, extracts the identity and port information of the neighbor devices, and stores them in the device's LLDP database to establish a neighbor relationship.
[0084] The SDN controller obtains neighbor messages through the SNMP protocol, and obtains the connectivity result between devices by comparing the previous and current versions and timeout times.
[0085] Although this method has a wide radiation range, it relies on SNMP for message collection, which takes a long time for collection, and can only be used to detect the connectivity of the link layer and cannot be applied to the network layer.
[0086] The second is to determine the connectivity between devices based on the ping command, which specifically includes the following steps:
[0087] According to the network management system's diagnosis information sent to the network device, the network device constructs a ping command, that is, an Internet Control Message Protocol (ICMP) message, and sends it to the destination IP while waiting to receive the ping result;
[0088] If it times out or the network is unreachable, set the ping diagnosis message result to "not connected", encapsulate the ping response message, the message content includes the message ID and the ping result, and return it to the network management. The network management determines the ping diagnosis result according to the message ID and displays that it cannot be connected to the specified network node;
[0089] If an ICMP response is received, set the ping diagnosis message result to "connected", encapsulate the ping response message, the message content includes the message ID and the ping result, and return it to the network management. The network management determines the ping diagnosis result according to the message ID and displays that it can be connected to the specified network node.
[0090] Although this method takes a short time for each time, its radiation range is small. Each time it can only determine the connectivity between two network devices. As the number of network devices increases, the detection time increases accordingly. And this method can only determine whether two devices are reachable at the network layer, but cannot judge whether the messages between two network devices are forwarded according to the intended path.
[0091] In view of the above problems, an embodiment of the present application provides a method, device, equipment and medium for detecting device connectivity. The method mainly includes: the detecting device constructs a detection message corresponding to the first transmission path based on the SDN topology, and the detection message is relayed by the devices to be detected on the first transmission path and then returned to the detecting device. After receiving the detection message, the detecting device determines the connectivity of the first transmission path. Further, the connectivity of multiple transmission paths is determined by the above method, and the connectivity between network devices is analyzed. This method provides a connectivity detection method that is fast, real-time and has a wide radiation range in complex networking scenarios, ensuring the detection of network-side reachability and whether the detection message is forwarded along the expected optimal path, effectively shortening the discovery time of suspected faults and ensuring the availability of the network.
[0092] It should be noted that the above connectivity detection method in the embodiment of the present application is applied to SDN, which includes multiple network devices. The detecting device accesses SDN by directly connecting to the first network device. The device connectivity in the present application refers to the connectivity between network devices in SDN.
[0093] Figure 1 FIG. is a schematic diagram of an application scenario of the device connectivity detection method provided by an embodiment of the present application. As Figure 1 shown, taking the traditional SDN topology as an example, this topology includes a detecting device and multiple network devices, that is, Figure 1 the access layer switches leaf 1 to 4, the aggregation layer switches spine 1 to 2, and the core layer switch border in, where border is the gateway exit. In some embodiments, the above detecting device may be a server with corresponding functions or an SDN controller.
[0094] When detecting the connectivity between network devices in SDN, the detecting device sets at least one first transmission path for each network device (i.e., the second network device). This transmission path includes: the forward path sent from the detecting device to the second network device and the return path returned from the second network device to the detecting device. The second network device is one of the multiple network devices.
[0095] For each first transmission path, the detecting device encapsulates the initial detection message in multiple layers based on the address information of each device on the first transmission path according to the transmission order of the detection message on the first transmission path, obtains the target detection message, and sends the target detection message to the first network device leaf 4 directly connected to the detecting device. It should be noted that the first network device can be selected based on requirements, that is, it can be determined based on requirements which network device the detecting device is connected to so that the detecting device accesses the network.
[0096] After leaf 4 unpacks the outermost encapsulation of the target detection message, it determines the address information of the next-hop device spine 2 from the unpacked detection message, and sends the unpacked detection message to the next-hop device spine 2. Spine 2 repeats the above process until the detection message is transmitted back to the detection device;
[0097] If the detection device receives the returned initial detection message from leaf 4 within the preset time period, it determines that the connectivity status of the transmission path corresponding to the initial detection message is connected;
[0098] Further, when the transmission of the detection message is completed for all the first transmission paths corresponding to all network devices, based on the connectivity status of each first transmission path, the connectivity status between each network device in the SDN is determined.
[0099] Based on the above application scenario, the exemplary embodiments of the present application will be described in more detail below. It should be noted that the above application scenario is only shown for the convenience of understanding the spirit and principle of the present application, and the embodiments of the present application are not limited by this. On the contrary, the embodiments of the present application can be applied to any applicable scenario. Figures 2 to 8 As shown in the figure, it is a schematic flowchart of the implementation process of the device connectivity detection method provided by the embodiment of the present application. This method is applied to the SDN. In the SDN, there are multiple network devices. The detection device accesses the SDN through a direct connection with the first network device. The first network device is any network device directly connected to the detection device among the multiple network devices; the first network device can be selected based on requirements, that is, based on requirements, it can be determined which network device the detection device is connected to so that the detection device accesses the network.
[0100] As Figure 2 shown, the steps shown are only for the determination process of the connectivity status of one first transmission path. When there are multiple first transmission paths, the corresponding connectivity status can be detected according to the same steps.
[0101] It should be noted that Figure 2 In some embodiments, the above device connectivity detection method may specifically include the following steps:
[0102] In some embodiments, the above device connectivity detection method may specifically include the following steps:
[0103] Step S21: The detection device determines the first transmission path to be detected based on the topology of the SDN;
[0104] Among them, the first transmission path includes: the forward path sent from the detection device to the second network device and the return path returned from the second network device to the detection device. The above second network device is one of the multiple network devices.
[0105] In some embodiments, the network devices included in the above-mentioned forward path and return path are the same, and the connection relationships between the network devices are the same, that is, the forward path and the return path are the same path with different directions.
[0106] In some embodiments, after receiving an indication to detect the connectivity of network devices, the detection device constructs a first transmission path corresponding to a second network device and a target detection message corresponding to the first transmission path based on the SDN network topology.
[0107] In a possible implementation manner, when constructing the first transmission path, first, based on the SDN topology, determine multiple candidate transmission paths including the second device; then, from the multiple candidate transmission paths, screen out the candidate transmission paths whose included network devices meet the preset conditions as the first transmission path. It should be noted that the above-mentioned preset conditions can be set based on requirements. For example, the preset condition is set to the minimum number of network devices included in the transmission path.
[0108] When the above preset condition is set to the minimum number of network devices included, and the first transmission path is constructed for each network device in the SDN in this way, it can be ensured that during the subsequent connectivity detection, each two adjacent network devices can complete the detection without duplicate detection, that is, it ensures non-redundant detection and non-missing detection of the subsequent connectivity detection.
[0109] In specific implementation, the detection device can collect and analyze the network topology through the LLDP and SNMP protocols and determine the logical roles of other network devices except the first network device (i.e., the network device directly connected to the detection device), and construct the first transmission path according to the topology.
[0110] In some embodiments, the determination rule of the logical roles of the above-mentioned network devices can be set based on requirements. For example, it can be determined based on the devices separated between other network devices and the first network device (i.e., the network device directly connected to the detection device) in each network device.
[0111] Take Figure 1 as an example, spine 1 and spine 2 are directly connected to leaf 4 respectively, and leaf 1 to 3 and border are connected to leaf 4 through spine 1 or spine 2 respectively, that is, separated by one network device. When determining the logical roles of each network device, spine 1 to 2 are of one type (hereinafter referred to as the first type), and leaf 1 to 3 and border are of one type (hereinafter referred to as the second type).
[0112] In some embodiments, when constructing the first transmission path, the detection device may determine the corresponding first transmission path based on the network topology and the logical roles of each device, and determine the corresponding target detection message based on the first transmission path.
[0113] Take Figure 1 as an example. The logical roles of each network device include two categories. Correspondingly, the determined first transmission paths can be divided into the following two categories:
[0114] I. Detection of the first type of network device.
[0115] Since the first type of network device is only separated from the detection device by one network device (i.e., the first network device), for each first type of network device, the corresponding first transmission path that can be determined is: taking the leaf accessed by the detection device (this leaf is the first network device, i.e., Figure 1 leaf 4 in it) as the first hop, from leaf 4 to each spine (the first type of network device) as the second hop, and then back to the detection device. For example, detection device → leaf 4 → spine 2 → leaf 4 → detection device.
[0116] II. Detection of the second type of network device.
[0117] Since the second type of network device is only separated from the detection device by two network devices (i.e., the first network device and a spine directly connected to the first network device), the first transmission path corresponding to the second type of network device can be: taking the leaf accessed by the detection device (this leaf is the first network device, i.e., Figure 1 leaf 4 in it) as the first hop, from leaf 4 to a certain spine (here a certain spine refers to the spine directly connected to the second type of network device) as the second hop, from the spine to the second type of device as the third hop, and then back to the detection device. For example, detection device - leaf 4 - spine 2 - leaf 3 - spine2 - leaf 4 - detection device.
[0118] Based on the transmission path constructed in the above manner, it can be achieved that there is no redundant detection. For example, if the transmission path from leaf 4 to spine2 to border has been detected, there is no need to construct other transmission paths from spine 2 to border; there is no missing detection. By constructing the corresponding transmission path for each network device, the network architecture between all network devices can be detected, covering all network devices.
[0119] Step S22: The detection device encapsulates the initial detection message in multiple layers based on the address information of each device on the first transmission path according to the transmission order of the detection message on the first transmission path, and obtains the target detection message;
[0120] Wherein, each layer of encapsulation is used to indicate the location information of the next-hop device to any network device that receives the probe packet.
[0121] In some embodiments, the above-mentioned target probe packet is a packet encapsulated based on the IP-IN-IP protocol. When encapsulating the packet, the number of layers of encapsulation is determined based on the number of network devices in its corresponding first transmission path. In a specific implementation, when constructing the target probe packet corresponding to the first transmission path, first, based on the transmission order of the packets in the first transmission path, sort the address information of each device (including network devices and the probe device itself) on the transmission path. Then, according to the sorting result, perform multi-layer packet encapsulation on the initial probe packet corresponding to the first transmission path in sequence. Each time, based on the address information of the current corresponding device, encapsulate the probe packet obtained after the previous encapsulation.
[0122] In a specific implementation, the process of constructing the target probe packet is as follows: Sort each device on the first transmission path according to the transmission order of the probe packet on the first transmission path; Determine the device corresponding to each layer of encapsulation based on the sorting result of each network device; Perform multi-layer packet encapsulation on the initial probe packet to obtain the target probe packet based on the following process: For each layer of encapsulation, encapsulate the current probe packet (i.e., the probe packet corresponding to the previous layer of encapsulation) based on the address information of the device corresponding to this encapsulation to obtain the probe packet corresponding to the current layer.
[0123] It should be noted that when constructing the target probe packet, for the first transmission path, since the first transmission path includes: the forward path from the probe device to the second network device and the return path from the second network device back to the probe device, therefore, based on the transmission order of the packets in the above-mentioned transmission path, after sorting the address information of each device on the transmission path, the sorting result should be: centered on the above-mentioned second network device, with the probe device as the starting point and the ending point. That is, the sorting result is composed of two sub-segments spliced together. The first sub-segment is from the probe device as the starting point to the second network device as the ending point, and the second sub-segment is from the second network device as the starting point to the probe device as the ending point. Only in this way can it be ensured that after the subsequent transmission probe packet is encapsulated based on this sorting order and the address information of the device corresponding to the sorting order, the transmission process of the target probe packet is from the probe device to the second network device and then from the second network device back to the probe device. In some embodiments, it can be considered that the sorting result of each device is equivalent to any of the above-mentioned transmission paths. When the network devices included in the forward path and the return path are the same and the connection relationships between the network devices are the same, the sorting corresponding to the first sub-segment and the second field is completely opposite.
[0124] Specifically, if the second network device is not the same as the first network device, based on the transmission order of the target detection packets on the first transmission path, the sorting result of the devices on the first transmission path should be: detection device → first network device →... (network devices other than the second network device and the first network device in the possible first transmission path) → second network device →... (network devices other than the second network device and the first network device in the possible first transmission path) → first network device → detection device. If the second network device is the same as the first network device, the sorting result of the above devices should be: detection device → first network device → detection device.
[0125] The following combines Figure 1 , taking the first transmission path as detection device → leaf 4 → spine 2 → leaf 4 → detection device as an example, to elaborate on the above packet encapsulation process. Assume that the address information of the detection device is 10.104.7.91, the address information of leaf 4 is 172.28.200.17, and the address information of spine 2 is 172.28.200.23.
[0126] At this time, when constructing the target detection packet, since the first transmission path is: detection device → leaf 4 → spine 2 → leaf 4 → detection device, the transmission order of the target detection packet in this first transmission path is: detection device → leaf 4 → spine 2 → leaf 4 → detection device. Based on this, the sorting result of the devices can be obtained as: detection device → leaf 4 → spine 2 → leaf 4 → detection device. Since the subsequent transmission of the target packet is to perform decapsulation on the target detection packet in the order from the outer layer to the inner layer, but the encapsulation of the initial detection packet is from the inner layer to the outer layer. Therefore, to ensure that the subsequent target detection packet is transmitted according to the above transmission path, its corresponding decapsulation result should be: the outermost layer (the fourth layer) is detection device → leaf 4, the first decapsulation (the third layer) is leaf 4 → spine 2, the second decapsulation (the second layer) is spine 2 → leaf 4, and the last decapsulation (the first layer) is leaf 4 → detection device. Therefore, its corresponding encapsulation order is: the first layer, the second layer, the third layer to the fourth layer.
[0127] Specifically, the process of performing multi-layer message encapsulation based on the address information corresponding to the sorting result is as follows: First, perform the first-layer encapsulation on the initial probe message. The source address corresponding to the first-layer encapsulation is 172.28.200.17 (leaf 4), and the destination address is 10.104.7.91 (probe device); then, perform the second-layer encapsulation on the initial probe message. The source address corresponding to the second-layer encapsulation is 10.104.7.91 (probe device), and the destination address is 172.28.200.17 (leaf 4); then, perform the third-layer encapsulation on the initial probe message. The source address corresponding to the third-layer encapsulation layer is 10.104.7.91 (probe device), and the destination address is 172.28.200.23 (spine 2); finally, perform the fourth-layer encapsulation on the initial probe message. The source address corresponding to the fourth-layer encapsulation is 10.104.7.91 (probe device), and the destination address is 172.28.200.17 (leaf 4). For the message encapsulated in this way, during the subsequent transmission process, first, the probe device determines that the next-hop device is leaf 4 corresponding to 172.28.200.17 based on the destination address corresponding to the fourth-layer encapsulation, and transmits the message to leaf 4. Then, leaf4 performs decapsulation on the message to obtain the third-layer encapsulation, and determines that the next-hop device is spine 2 corresponding to 172.28.200.23 based on the destination address corresponding to the three-layer encapsulation, and transmits the message to spine 2. Then, spine2 performs decapsulation on the message again to obtain the second-layer encapsulation, and determines that the next-hop device is leaf 4 corresponding to 172.28.200.17 based on the destination address corresponding to the second-layer encapsulation, and transmits the message to leaf 4. Finally, leaf4 performs decapsulation on the message to obtain the first-layer encapsulation, and determines that the next-hop device is the probe device corresponding to 10.104.7.91 based on the destination address of the first-layer encapsulation, and transmits the message back to the probe device. The target probe message constructed in this way can quickly detect the connectivity of the entire network path.
[0128] It should be noted that in the above examples of the present application, only the address information of leaf 4 is used as the source address of the first-layer encapsulation, and the address information of the probe device is used as the source address of the second to fourth-layer encapsulations for illustration. However, in the embodiments of the present application, it is not limited to the above method, and the definition method of the source address can be set based on requirements.
[0129] In a possible implementation manner, each layer of encapsulation corresponds to a source address, which may be the address information of its corresponding device, and the destination address may be the address information of its next-hop device; in a possible implementation manner, it is possible to set that some layers of encapsulation share a source address, and another part of the layers of encapsulation share another source address; in still another possible implementation manner, for each layer of encapsulation, its corresponding source address may not be set, and only its corresponding destination address is set (using the address information of the next-hop device as the destination address).
[0130] Step S23: The detection device sends a target detection message corresponding to the first transmission path to the first network device;
[0131] In some embodiments, before the detection device sends the target detection message to the first network device, it is also necessary to configure an IPIP tunnel corresponding to the first transmission path of the target detection message to facilitate the subsequent transmission of the target detection message.
[0132] Step S24: The first network device receives the target detection message. After decapsulating the outermost layer of encapsulation of the target detection message, it determines the address information of the next-hop device from the decapsulated detection message;
[0133] In some embodiments, after the target device receives the target detection message, it decapsulates the outermost IP header of the target detection message through the tunnel to obtain the sub-outermost IP header (the IP header of the decapsulated detection message). The sub-outermost IP header includes the source address and destination address corresponding to this sub-outermost layer (if the source address is not set for each layer of encapsulation and only the destination address is set, here it only includes the destination address corresponding to this sub-outermost layer), and uses the destination address therein as the address information of the next-hop device to determine the next-hop device.
[0134] Step S25: The first network device sends the decapsulated detection message to the next-hop device;
[0135] In some embodiments, each network device including the next-hop device repeats the operations of the above steps S23 - S24 after receiving the detection message until the detection message is transmitted back to the detection device or cannot continue to be transmitted due to a discontinuous path.
[0136] Step S26: If the detection device receives the initial detection message returned by the first network device within the preset time period, it determines that the connectivity status of the first transmission path is connected.
[0137] In some embodiments, the detection server determines whether the connection status of the corresponding first transmission path is connected or not based on whether an initial detection message is received within a preset duration (e.g., 1 second). For example, if the detection message of leaf4→spine2→border is not received, it is considered that the first transmission path is not connected; if the detection message of leaf4→spine2 is received, it is considered that the first transmission path is connected.
[0138] It should be noted that the value of the above preset duration is not limited in the embodiments of the present application and can be set according to requirements.
[0139] In some embodiments, for multiple network devices in the SDN, after respectively determining the connection status of the corresponding first transmission path based on the above method, the detection device can further determine the connection status between each network device in the SDN based on the connection status of each first transmission path.
[0140] In some embodiments, determining the connection status between each network device in the SDN based on the connection status of each transmission path specifically includes: for each first transmission path, splitting the first transmission path into a path set including multiple sub-paths, where the sub-path is the transmission path between two adjacent devices; comparing each first path set corresponding to each first transmission path with each second path set corresponding to each first transmission path to determine the connection status between each network device in the SDN, where the first path set corresponds to the path set of the first transmission path with a connected connection status, and the second path set corresponds to the path set of the first transmission path with a non-connected connection status. Specifically, determine the connection status of the sub-paths that are in the second path set and not in the first path set as non-connected, and the connection status of other sub-paths as connected. Since the sub-path is the transmission path between two adjacent devices, determining the connection status of each sub-path is to determine the connection status between each network device.
[0141] In specific implementation, each transmission path is split and refined into point-to-point (between two adjacent devices) sub-paths to form a path set, and based on the connection status of the transmission path, the path set is divided into two categories, namely the first path set with a connected connection status and the second path set with a non-connected connection status.
[0142] As in the above example, split the first transmission path "detection device → leaf 4 → spine 2 → leaf 4 → detection device" to obtain the corresponding path set. The sub-paths in this path set include: detection device → leaf 4, leaf 4 → spine 2. Another example, split the first transmission path "detection device → leaf 4 → spine 2 → leaf 3 → spine 2 → leaf 4 → detection device" to obtain the corresponding path set. The sub-paths in this path set include: detection device → leaf 4, leaf 4 → spine 2, spine 2 → leaf 3. Since the connectivity status of the first transmission path "detection device → leaf 4 → spine 2 → leaf 4 → detection device" is connected, it is the first path set. The connectivity status of the first transmission path "detection device → leaf 4 → spine 2 → leaf 3 → spine 2 → leaf 4 → detection device" is not connected, so it is the second path set. By comparing the sub-paths in the first path set (i.e., "detection device → leaf 4 → spine 2 → leaf 4 → detection device") with the second path set (i.e., "detection device → leaf 4 → spine 2 → leaf 3 → spine 2 → leaf 4 → detection device"), it can be concluded that the sub-path "spine 2 → leaf 3" is in the second path set and not in the first path set, that is, the non-connected sub-path of the sub-path "spine 2 → leaf 3". The other sub-paths "detection device → leaf 4" and "leaf 4 → spine 2" are connected sub-paths.
[0143] After obtaining the connectivity status between each network device in the SDN, store the connectivity status between each network device in a relational database. In some embodiments, the connectivity status between each network device stored in the relational database can be displayed through the corresponding interface for easy backtracking to view all detection results.
[0144] The following is combined with Figure 1 , assuming that it is necessary to detect the network layer connectivity between leaf 4 → spine 2 → border, the specific implementation process is as follows:
[0145] First, configure an IPIP tunnel between leaf 4, spine 2, and border;
[0146] Then, connect the detection device to leaf 4, construct an IPIP detection message (i.e., the target detection message) corresponding to the first transmission path, and send it to leaf 4;
[0147] After Leaf 4 receives the IPIP probe packet, it de-encapsulates the outermost IP header through the tunnel. Since the secondary outer IP header points to the associated IP of spine 2, the de-encapsulated probe packet is forwarded to spine 2;
[0148] After spine 2 receives the probe packet, it performs the same operation, forwards the probe packet after re-de-encapsulation to border. Border performs the same operation, forwards the probe packet to spine 2, and then forwards it back to the probe device through spine 2 and leaf 4;
[0149] Finally, the probe device determines whether the transmission path is connected based on whether it receives the probe packet within a preset time period.
[0150] Through the above method, the probe packet records the address information of each network device node along the transmission path in the form of multi-layer encapsulation. After the probe device sends the probe packet to the network device, each network device de-encapsulates the outermost layer of the received packet, determines the next-hop device from the de-encapsulated probe packet and forwards the probe packet to it, repeats this process until it is forwarded back to the probe device. The probe device determines the path connectivity based on whether it receives the forwarded packet within a preset time period. In this way, the connectivity of the entire SDN network path can be quickly detected, the fault discovery time is effectively shortened, and it is ensured that the probe packet is forwarded along the expected path.
[0151] In the related art, as Figure 3 shown, assuming there is a connection relationship between spine 1 and spine 2, taking the probe packet of the first transmission path as leaf 4→spine 2→border as an example. When the packet reaches spine 2, if the connection line between spine 2 and border is disconnected or the line is busy at this time, the probe packet may reach border along the path of spine 2→spine1→border through dynamic route learning and return to the probe device. Therefore, if the probe packet is not restricted, the detection result of this detection method may not be accurate.
[0152] To solve the above problems and further improve the accuracy of connectivity detection, in the embodiments of the present application, the target probe packet also includes a TTL (Time To Live) corresponding to each layer of encapsulation, where the initial value of the TTL corresponding to each layer of encapsulation is 2. When any network device receives the probe packet, before de-encapsulating the outermost layer of the probe packet, it first subtracts 1 from the TTL value corresponding to the outermost layer of encapsulation, and determines whether the obtained TTL value after subtraction is 0. If the value is 0, the probe packet is discarded and no subsequent operations are performed; if it is not 0, the operation of de-encapsulating the outermost layer of the probe packet is performed.
[0153] In some embodiments, by setting the TTL in the IP header (i.e., each layer of encapsulation) of each packet to 2, the transit of the probe packet can be restricted to only one hop. For example, in the above example, when the probe packet passes through spine 1, since the TTL value is reduced to 0, the probe packet is discarded by spine 1. Therefore, the probe packet can only be transmitted along the preset first transmission path in order to possibly return to the detection device.
[0154] In the embodiments of the present application, in order to further detect the network quality between network devices, a packet loss mechanism is set up, that is, for each target probe packet, a plurality of data packets are sent at one time (i.e., a preset number of the target probe packets are sent). The detection device determines the network forwarding quality of the corresponding first transmission path according to the number of received data packets. Through this design, the health status of all network devices can be indirectly reflected.
[0155] In specific implementation, when the detection device sends a target probe packet corresponding to the first transmission path to the first network device, for the first transmission path, a preset number of target probe packets are sent to the first network device; after receiving the initial probe packet returned by the first network device within the preset time duration, for the same initial probe packet, the target number of the initial probe packets received within the preset time duration is determined, and based on the target number and the preset number, the network quality of the first transmission path is determined.
[0156] It should be noted that in the embodiments of the present application, the value of the preset number of the above target probe packets is not limited and is set based on requirements in specific implementation. At the same time, whether the preset numbers corresponding to different target probe packets are the same is also not limited, and they can be set to be the same or different based on requirements.
[0157] By adopting the above TTL design and packet loss design, the embodiments of the present application can real-time master whether the forwarding path of the probe packet proceeds as expected, and determine the network quality based on whether there is a packet loss situation.
[0158] The embodiments of the present application also provide a device connectivity detection method. The SDN includes multiple network devices, and the detection device accesses the SDN by directly connecting to the first network device. Applied to the detection device, as Figure 4 shown, the method specifically includes the following steps:
[0159] Step S41, based on the topology of the SDN, determine the first transmission path to be detected;
[0160] Among them, the first transmission path includes the forward path from the detection device to the second network device and the return path from the second network device to the detection device. The second network device is one of the multiple network devices;
[0161] Step S42: Based on the address information of each device on the first transmission path and in accordance with the transmission order of the detection message on the first transmission path, perform multi-layer message encapsulation on the initial detection message to obtain a target detection message;
[0162] Wherein, each layer of encapsulation is used to indicate the location information of the next-hop device to any network device that receives the detection message;
[0163] Step S43: Send the target detection message corresponding to the first transmission path to the first network device;
[0164] So that after the target device decapsulates the outermost layer of encapsulation of each received target detection message, it determines the address information of the next-hop device from the decapsulated detection message and sends the decapsulated detection message to the next-hop device;
[0165] Step S44: If the initial detection message returned by the first network device is received within a preset duration, determine that the connectivity state of the first transmission path is connected.
[0166] The specific implementation process of the above detection device for device connectivity detection has been described in detail in Steps S21 - S26 and will not be elaborated here.
[0167] As Figure 5 shown, it is a schematic structural diagram of the device connectivity detection device provided by an embodiment of the present application. The SDN includes multiple network devices. The detection device accesses the SDN by directly connecting to the first network device and is applied to the detection device. The above device includes:
[0168] A path determination module 51, configured to determine a first transmission path to be detected based on the topology structure of the SDN;
[0169] Wherein, the first transmission path includes a forward path from the detection device to the second network device and a return path from the second network device back to the detection device. The second network device is one of the multiple network devices;
[0170] An encapsulation module 52, which performs multi-layer message encapsulation on the initial detection message based on the address information of each device on the first transmission path and in accordance with the transmission order of the detection message on the first transmission path to obtain a target detection message;
[0171] Wherein, each layer of encapsulation is used to indicate the location information of the next-hop device to any network device that receives the detection message;
[0172] A first sending module 53, configured to send the target detection message corresponding to the first transmission path to the first network device;
[0173] The first determination module 54 is configured to determine that the connection status of the first transmission path is connected if an initial detection message returned by the first network device is received within a preset duration.
[0174] Optionally, the network devices included in the forward path and the return path are the same, and the connection relationships between the network devices are the same.
[0175] Optionally, the path determination module 51 is specifically configured to:
[0176] Determine multiple candidate transmission paths including the second device based on the SDN topology;
[0177] Filter out candidate transmission paths that include network devices meeting preset conditions from the multiple candidate transmission paths as the first transmission path.
[0178] Optionally, the path determination module 51 is specifically configured to:
[0179] Sort the devices on the first transmission path according to the transmission order of the detection message on the first transmission path;
[0180] Determine the device corresponding to each layer of encapsulation based on the sorting result of each network device;
[0181] Perform multi-layer message encapsulation on the initial detection message to obtain a target detection message based on the following process: for each layer of encapsulation, encapsulate the current detection message based on the address information of the target device corresponding to each layer of encapsulation to obtain the detection message corresponding to each layer of encapsulation.
[0182] Optionally, the above device further includes a second determination module, configured to:
[0183] Obtain the connection status of the first transmission path corresponding to each of multiple network devices;
[0184] Determine the connection status between each network device in the SDN based on the connection status of each first transmission path.
[0185] Optionally, the second determination module is specifically configured to:
[0186] For each first transmission path, split the first transmission path into a path set including multiple sub-paths, where the sub-path is a transmission path between two adjacent devices;
[0187] Compare each first path set with each second path set in the path sets corresponding to each first transmission path to determine the connection status between each network device in the SDN, where the first path set corresponds to the path set of the first transmission path with a connected connection status, and the second path set corresponds to the path set of the first transmission path with a non-connected connection status.
[0188] Optionally, the target detection message further includes a time to live (TTL) corresponding to each layer of encapsulation, where the initial value of the TTL corresponding to each layer of encapsulation is 2.
[0189] Optionally, the first sending module 53 is specifically configured to:
[0190] Send a preset number of target detection messages to the first network device;
[0191] After the first determination module 54 receives the returned initial detection message from the first network device within a preset duration, it is further configured to:
[0192] Determine the target number of the initial detection messages received within the preset duration, and determine the network quality of the transmission path corresponding to the initial detection message based on the target number and the preset number.
[0193] Optionally, the target detection message is a message encapsulated based on the IP-IN-IP protocol.
[0194] Optionally, the first sending module 53 is further configured to:
[0195] Before sending the target detection message corresponding to the first transmission path to the first network device, configure an IPIP tunnel corresponding to each transmission path for the first transmission path.
[0196] An embodiment of the present application further provides a method for detecting device connectivity. The SDN includes multiple network devices, and the detection device accesses the SDN by directly connecting to the first network device. The method is applied to any one of the multiple network devices. As Figure 6 shown, the method specifically includes the following steps:
[0197] Step S61: Receive a detection message sent by another device directly connected to any network device;
[0198] Wherein, the detection message is a target detection message or obtained by performing at least one layer of de-encapsulation on the target detection message. The target detection message is obtained by the detection device performing multi-layer message encapsulation on the initial detection message according to the transmission order of the detection message on the first transmission path and based on the address information of each device on the first transmission path. The first transmission path includes a forward path from the detection device to the second network device and a return path from the second network device to the detection device. The second network device is one of the multiple network devices. Each layer of encapsulation is used to indicate the location information of the next-hop device to any network device that receives the detection message;
[0199] Step S62: De-encapsulate the outermost layer of encapsulation of the detection message, and obtain the address information of the next-hop device from the de-encapsulated detection message;
[0200] Step S63: Send the decapsulated probe message to the next-hop device.
[0201] The specific implementation process of the above network device performing device connectivity detection has been elaborated in detail in steps S21 - S26, and will not be repeated here.
[0202] As Figure 7 shown, it is a schematic structural diagram of the device connectivity detection device provided by an embodiment of the present application. The SDN includes multiple network devices. The detection device accesses the SDN by directly connecting to the first network device and is applied to any one of the multiple network devices. The device includes:
[0203] A receiving module 71, configured to receive a probe message sent by another device directly connected to any network device, where the probe message is a target probe message or a message obtained by performing at least one layer of decapsulation on the target probe message. The target probe message is obtained by the detection device performing multi-layer message encapsulation on the initial probe message according to the transmission order of the probe message on the first transmission path and based on the address information of each device on the first transmission path. The first transmission path includes a forward path from the detection device to the second network device and a return path from the second network device back to the detection device. The second network device is one of the multiple network devices. Each layer of encapsulation is used to: indicate the location information of the next-hop device to any network device that receives the probe message;
[0204] A decapsulation module 72, configured to perform decapsulation on the outermost layer of encapsulation of the probe message and obtain the address information of the next-hop device from the decapsulated probe message;
[0205] A second sending module 73, configured to send the decapsulated probe message to the next-hop device.
[0206] Optionally, the target probe message further includes a TTL corresponding to each layer of encapsulation, and the initial value of the TTL corresponding to each layer of encapsulation is 2;
[0207] Before the above decapsulation module 72 performs decapsulation on the outermost layer of encapsulation of the probe message, it is further configured to:
[0208] Subtract 1 from the TTL value corresponding to the outermost layer of encapsulation and determine that the TTL value obtained after subtraction is not 0.
[0209] Optionally, the above decapsulation module 72 is further configured to:
[0210] If the TTL value obtained after subtraction is 0, discard the probe message.
[0211] Optionally, the target probe message is a message encapsulated based on the IP-IN-IP protocol.
[0212] Based on the same inventive concept, an embodiment of the present application further provides an electronic device 800. Refer to Figure 8 As shown, the electronic device 800 is used to implement the device connectivity detection method described in the above method embodiment. The electronic device 800 in this embodiment may include: a memory 801, a processor 802, and a computer program stored in the above memory and executable on the above processor. When the above processor executes the above computer program, the steps in the above various device connectivity detection method embodiments are implemented.
[0213] In the embodiments of the present application, the specific connection medium between the above memory 801 and the processor 802 is not limited. In the embodiments of the present application Figure 8 it is shown that the memory 801 and the processor 802 are connected by a bus 803. The bus 803 is represented by a thick line in Figure 8 The connection manners between other components are only for illustrative purposes and are not to be taken as limiting. The above bus 803 may be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 8 only one thick line is used to represent it in
[0214] The memory 801 may be a volatile memory, such as a random-access memory (RAM); the memory 801 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD), or the memory 801 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 801 may be a combination of the above memories.
[0215] The processor 802 is used to implement the device connectivity detection method of various exemplary embodiments of the present application.
[0216] An embodiment of the present application further provides a computer-readable storage medium, storing computer-executable instructions required to be executed by the above processor, which includes a program required to be executed by the above processor.
[0217] In some possible implementations, various aspects of the device connectivity detection method provided in this application can also be implemented in the form of a program product, which includes program code. When the above program product runs on an electronic device, the above program code is used to cause the above electronic device to execute the steps in the device connectivity detection method according to various exemplary embodiments of this application described above in this specification.
[0218] Those skilled in the art should understand that the embodiments of this application can be provided as a method, a device, or a computer program product. Therefore, this application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0219] This application is described with reference to the flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to the embodiments of this application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or a combination of multiple flows and / or blocks
[0220] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one or more of the flows Figure 1 or a combination of multiple flows and / or blocks
[0221] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or a combination of multiple flows and / or blocks
[0222] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present application.
[0223] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. A method for detecting device connectivity, characterized in that, The software-defined network SDN includes multiple network devices. The detection device accesses the SDN through direct connection to the first network device. The method applied to the detection device includes: Based on the topological structure of the SDN, determine a first transmission path to be detected. The first transmission path includes a forward path from the detection device to a second network device and a loop path from the second network device back to the detection device. The second network device is one of the multiple network devices. According to the transmission order of the detection message on the first transmission path, based on the address information of each device on the first transmission path, perform multi-layer message encapsulation on the initial detection message to obtain a target detection message. Each layer of encapsulation is used to: indicate the location information of the next-hop device to any network device that receives the detection message. Send the target detection message corresponding to the first transmission path to the first network device. If the initial detection message returned by the first network device is received within a preset time period, determine that the connectivity status of the first transmission path is connected.
2. The method according to claim 1, wherein The network devices included in the forward path and the loop path are the same, and the connection relationships between the network devices are the same.
3. The method according to claim 1, wherein The step of determining the first transmission path to be detected based on the topological structure of the SDN includes: Based on the topological structure of the SDN, determine multiple candidate transmission paths including the second device. From the multiple candidate transmission paths, filter out the candidate transmission paths whose included network devices meet the preset conditions as the first transmission path.
4. The method according to claim 1, characterized in that Performing multi-layer message encapsulation on the initial detection message according to the transmission order of the detection message on the first transmission path and based on the address information of each device on the first transmission path to obtain a target detection message, includes: Sort the devices on the first transmission path according to the transmission order of the detection message on the first transmission path. Based on the sorting results of each network device, determine the device corresponding to each layer of encapsulation. Perform multi-layer message encapsulation on the initial detection message through the following process to obtain the target detection message: For each layer of encapsulation, encapsulate the current detection message based on the address information of the target device corresponding to each layer of encapsulation to obtain the detection message corresponding to each layer of encapsulation.
5. The method according to claim 1, characterized in that, The method further includes: Obtain the connectivity status of the first transmission path corresponding to each of the multiple network devices. Based on the connectivity status of each first transmission path, determine the connectivity status between each network device in the SDN.
6. The method according to claim 5, wherein The step of determining the connectivity status between each network device in the SDN based on the connectivity status of each first transmission path includes: For each first transmission path, split the first transmission path into a path set including multiple sub-paths, where the sub-path is a transmission path between two adjacent devices. In the path sets corresponding to each first transmission path, compare each first path set with each second path set to determine the connectivity status between each network device in the SDN. Among them, the path set corresponding to the first path set with a connected connectivity status is the path set corresponding to the first transmission path that is connected, and the path set corresponding to the second path set with a non-connected connectivity status is the path set corresponding to the first transmission path that is not connected.
7. The method according to claim 1, wherein The target probe packet further includes a Time-To-Live (TTL) corresponding to each layer of encapsulation, where the initial value of the TTL corresponding to each layer of encapsulation is 2.
8. The method according to claim 1, wherein Sending the target probe packet corresponding to the first transmission path to the first network device includes: Sending a preset number of target probe packets to the first network device; After receiving the returned initial probe packet from the first network device within a preset duration, the method further includes: Determine the target number of the initial probe packets received within the preset duration, and based on the target number and the preset number, determine the network quality of the first transmission path.
9. The method according to claim 1, characterized in that, The target probe packet is a packet encapsulated based on the IP-IN-IP protocol.
10. The method according to claim 9, characterized in that Before sending the target probe packet corresponding to the first transmission path to the first network device, it further includes: For the first transmission path, configure the IPIP tunnel corresponding to the first transmission path.
11. A method for detecting device connectivity, characterized in that, The SDN includes multiple network devices. The detection device accesses the SDN by directly connecting to the first network device. Applied to any one of the multiple network devices, it includes: Receiving a probe packet sent by another device directly connected to the any one network device, where the probe packet is a target probe packet or obtained by performing at least one layer of decapsulation on the target probe packet. The target probe packet is obtained by the detection device performing multi-layer packet encapsulation on the initial probe packet according to the transmission order of the probe packet on the first transmission path and based on the address information of each device on the first transmission path. The first transmission path includes a forward path from the detection device to the second network device and a return path from the second network device back to the detection device. The second network device is one of the multiple network devices. Each layer of encapsulation is used to indicate the location information of the next-hop device to any network device that receives the probe packet; Decapsulate the outermost layer of encapsulation of the probe packet, and obtain the address information of the next-hop device from the decapsulated probe packet; Send the decapsulated probe packet to the next-hop device.
12. The method according to claim 11, wherein The target probe packet further includes a TTL corresponding to each layer of encapsulation, where the initial value of the TTL corresponding to each layer of encapsulation is 2; Before decapsulating the outermost layer of encapsulation of the probe packet, the method further includes: Decrease the TTL value corresponding to the outermost layer of encapsulation by 1, and determine that the decreased TTL value is not 0.
13. The method according to claim 12, wherein If the decreased TTL value is 0, discard the probe packet.
14. The method according to claim 11, wherein The target probe packet is a packet encapsulated based on the IP-IN-IP protocol.
15. A device connectivity detection device, characterized in that, The SDN includes multiple network devices. The detection device accesses the SDN by directly connecting to the first network device. Applied to the detection device, it includes: A path determination module, configured to determine a first transmission path to be detected based on the topological structure of the SDN, where the first transmission path includes a forward path sent from the detection device to a second network device and a loopback path returned from the second network device to the detection device, and the second network device is one of the multiple network devices; An encapsulation module, configured to perform multi-layer message encapsulation on an initial detection message based on the address information of each device on the first transmission path according to the transmission order of the detection message on the first transmission path, to obtain a target detection message, where each layer of encapsulation is used to: indicate the location information of the next-hop device to any network device that receives the detection message; A first sending module, configured to send the target detection message corresponding to the first transmission path to the first network device; A first determination module, configured to determine that the connectivity status with the first transmission path is connected if an initial detection message returned by the first network device is received within a preset duration.
16. A device connectivity detection device, characterized in that, The SDN includes multiple network devices, and the detection device accesses the SDN by directly connecting to a first network device. It is applied to any one of the multiple network devices and includes: A receiving module, configured to receive a detection message sent by another device directly connected to the any network device, where the detection message is a target detection message or a message obtained by performing at least one layer of decapsulation on the target detection message. The target detection message is obtained by the detection device performing multi-layer message encapsulation on the initial detection message based on the address information of each device on the first transmission path according to the transmission order of the detection message on the first transmission path. The first transmission path includes a forward path sent from the detection device to a second network device and a loopback path returned from the second network device to the detection device, and the second network device is one of the multiple network devices. Each layer of encapsulation is used to: indicate the location information of the next-hop device to any network device that receives the detection message; A decapsulation module, configured to perform decapsulation on the outermost layer of encapsulation of the detection message and obtain the address information of the next-hop device from the decapsulated detection message; A second sending module, configured to send the decapsulated detection message to the next-hop device.
17. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 14.
18. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, it implements the steps of the method according to any one of claims 1 to 14.