Link quality detection method and apparatus, computer device, and readable storage medium

By receiving link layer discovery protocol messages and comprehensively considering the number of oscillations, transmitted optical power, and received optical power, combined with the status of the link factor identifier field, the problem of low link quality detection accuracy is solved, and more accurate link quality detection and stable transmission of service traffic are achieved.

CN120263693BActive Publication Date: 2026-05-22CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2025-05-26
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

In existing technologies, link quality detection relies on only a single dimension of information, resulting in low detection accuracy.

Method used

By receiving link layer discovery protocol messages, and comprehensively considering the port's oscillation count, transmitted optical power, and received optical power within the current unit of time, combined with the status of the link factor identifier field, the link quality is determined.

Benefits of technology

It improves the accuracy of link quality detection, enables timely detection of changes in link quality, and avoids packet loss in business traffic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120263693B_ABST
    Figure CN120263693B_ABST
Patent Text Reader

Abstract

The application relates to a link quality detection method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: receiving a link layer discovery protocol packet sent by an interconnection device of a current device through a port of the interconnection device; determining a link factor corresponding to a link between the current device and the port according to the number of oscillations, the sending optical power and the receiving optical power of the port in a current unit time; the link factor is used to represent the link quality of the link; extracting the value of a link factor identification field in the link layer discovery protocol packet, determining the state of the link factor identification field according to the value of the link factor identification field; the state of the link factor identification field is used to represent the state of the port; and determining the link quality of the link according to the link factor and the state of the link factor identification field. The method can improve the accuracy of link quality detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data communication technology, and in particular to a link quality detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology

[0002] In the network architecture, there are multiple links between devices, and packets are forwarded through these links.

[0003] In traditional technologies, link quality is typically determined using information from a single dimension. However, considering only a single dimension when testing link quality can easily lead to low accuracy in link quality detection. Summary of the Invention

[0004] Therefore, it is necessary to provide a link quality detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the accuracy of link quality detection in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a link quality detection method, including:

[0006] Receive link layer discovery protocol messages sent by the interconnected devices of the current device through the ports of the interconnected devices;

[0007] Based on the number of oscillations, transmitted optical power, and received optical power of the port within the current unit of time, a link factor corresponding to the link between the current device and the port is determined; the link factor is used to represent the link quality.

[0008] Extract the value of the link factor identifier field from the link layer discovery protocol message, and determine the state of the link factor identifier field based on the value of the link factor identifier field; the state of the link factor identifier field is used to indicate the state of the port.

[0009] The link quality is determined based on the status of the link factor and the link factor identifier field.

[0010] In one embodiment, determining the link factor corresponding to the link between the current device and the port based on the number of oscillations, transmitted optical power, and received optical power of the port in the current unit time includes:

[0011] When the number of oscillations is 0, the sum of the transmitted optical power and the received optical power, rounded up, is used as the link factor;

[0012] If the number of oscillations is not zero, the ratio between the number of oscillations and the rounded-up value is used as the link factor.

[0013] In one embodiment, determining the state of the link factor identifier field based on its value includes:

[0014] The correspondence between the values ​​and the states is queried to obtain the states corresponding to the values ​​of the link factor identifier field;

[0015] The state corresponding to the value of the link factor identifier field is taken as the state of the link factor identifier field.

[0016] In one embodiment, determining the link quality based on the link factor and the state of the link factor identifier field includes:

[0017] If the link factor is not within a preset range, it is determined that the link quality does not meet the quality requirements.

[0018] If the link factor is within the preset range, determine whether the status of the link factor identifier field is a forwarding status;

[0019] If the status of the link factor identifier field is forwarding, it is determined that the link quality meets the quality requirements.

[0020] In one embodiment, after determining whether the status of the link factor identifier field is a forwarding status, the method further includes:

[0021] If the state of the link factor identifier field is not in the forwarding state, wait for the state of the link factor identifier field to be restored to the forwarding state;

[0022] If the state of the link factor identifier field is restored to the forwarding state, it is determined that the link quality meets the quality requirements.

[0023] If the state of the link factor identifier field does not return to the forwarding state, it is determined that the link quality does not meet the quality requirements.

[0024] In one embodiment, the process of waiting for the link factor identifier field to return to the forwarding state includes:

[0025] If the state of the link factor identifier field is blocked, and the link factor of the next unit time of the current unit time is within the preset range, the state of the link factor identifier field will be adjusted to a delayed state.

[0026] If the state of the link factor identifier field is in a delayed state, and the link factor of the next unit time of the current unit time is within the preset range, the state of the link factor identifier field will be adjusted to a recovery state.

[0027] If the state of the link factor identifier field is delayed, and the link factor of the next unit time of the current unit time is not within the preset range, the state of the link factor identifier field is adjusted to blocked.

[0028] If the link factor identifier field is in a recovery state and the link factor in the next unit of time is within the preset range, the state of the link factor identifier field will be adjusted to a forwarding state.

[0029] If the link factor identifier field is in a recovery state and the link factor in the next unit of time is not within the preset range, the state of the link factor identifier field will be adjusted to a delay state.

[0030] Secondly, this application also provides a link quality detection device, comprising:

[0031] The message receiving module is used to receive link layer discovery protocol messages sent by the interconnecting devices of the current device through the ports of the interconnecting devices;

[0032] The factor determination module is used to determine the link factor corresponding to the link between the current device and the port based on the number of oscillations, the transmitted optical power, and the received optical power of the port in the current unit time; the link factor is used to represent the link quality of the link.

[0033] The status determination module is used to extract the value of the link factor identifier field in the link layer discovery protocol message, and determine the status of the link factor identifier field based on the value of the link factor identifier field; the status of the link factor identifier field is used to indicate the status of the port.

[0034] The quality determination module is used to determine the link quality of the link based on the status of the link factor and the link factor identifier field.

[0035] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0036] Receive link layer discovery protocol messages sent by the interconnected devices of the current device through the ports of the interconnected devices;

[0037] Based on the number of oscillations, transmitted optical power, and received optical power of the port within the current unit of time, a link factor corresponding to the link between the current device and the port is determined; the link factor is used to represent the link quality.

[0038] Extract the value of the link factor identifier field from the link layer discovery protocol message, and determine the state of the link factor identifier field based on the value of the link factor identifier field; the state of the link factor identifier field is used to indicate the state of the port.

[0039] The link quality is determined based on the status of the link factor and the link factor identifier field.

[0040] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0041] Receive link layer discovery protocol messages sent by the interconnected devices of the current device through the ports of the interconnected devices;

[0042] Based on the number of oscillations, transmitted optical power, and received optical power of the port within the current unit of time, a link factor corresponding to the link between the current device and the port is determined; the link factor is used to represent the link quality.

[0043] Extract the value of the link factor identifier field from the link layer discovery protocol message, and determine the state of the link factor identifier field based on the value of the link factor identifier field; the state of the link factor identifier field is used to indicate the state of the port.

[0044] The link quality is determined based on the status of the link factor and the link factor identifier field.

[0045] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0046] Receive link layer discovery protocol messages sent by the interconnected devices of the current device through the ports of the interconnected devices;

[0047] Based on the number of oscillations, transmitted optical power, and received optical power of the port within the current unit of time, a link factor corresponding to the link between the current device and the port is determined; the link factor is used to represent the link quality.

[0048] Extract the value of the link factor identifier field from the link layer discovery protocol message, and determine the state of the link factor identifier field based on the value of the link factor identifier field; the state of the link factor identifier field is used to indicate the state of the port.

[0049] The link quality is determined based on the status of the link factor and the link factor identifier field.

[0050] The aforementioned link quality detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product receive a Link Layer Discovery Protocol (LDP) message sent by an interconnecting device through its port. Based on the port's oscillation count, transmitted optical power, and received optical power within the current unit of time, the link factor corresponding to the link between the current device and the port is determined. The link factor represents the link quality. The value of the link factor identifier field in the LDP message is extracted, and its state is determined based on this value. The state of the link factor identifier field represents the port's state. The link quality is determined based on the link factor and the state of the link factor identifier field. Thus, during link quality detection, the method comprehensively considers the interconnecting device's port oscillation count, transmitted optical power, and received optical power within the current unit of time, as well as the value of the link factor identifier field in the LDP message sent by the interconnecting device through its port. By using the link factor corresponding to the link between the current device and the interconnecting device's port and the state of the link factor identifier field, the method determines the link quality between the current device and the interconnecting device's port. This facilitates comprehensive link quality detection and improves the accuracy of link quality detection. Attached Figure Description

[0051] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0052] Figure 1 This is a diagram illustrating the application environment of a link quality detection method in one embodiment.

[0053] Figure 2 This is a flowchart illustrating a link quality detection method in one embodiment;

[0054] Figure 3 This is a schematic diagram illustrating the interaction of LLDP messages on different types of devices in one embodiment.

[0055] Figure 4 This is a schematic diagram of an LLDP Option TLV message field in one embodiment;

[0056] Figure 5 This is a flowchart illustrating the link quality detection method in another embodiment;

[0057] Figure 6 This is a flowchart illustrating a link quality detection method based on LLDP in one embodiment;

[0058] Figure 7 This is a schematic diagram illustrating the state transition of the link factor identifier field (Lq ID) in one embodiment;

[0059] Figure 8 This is a structural block diagram of a link quality detection device in one embodiment;

[0060] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0062] Currently, DCN (Data Center Network) networks employ a full-mesh optical interconnect architecture. From Leaf nodes to Spine nodes, traffic is forwarded using ECMP (Equal-Cost Multi-Path) based on five-tuples. From physical machines to Leaf nodes, packets are forwarded using MLAG (Multichassis Link Aggregation Group) or a de-stacking network architecture. The advantage of this forwarding model is that it enables device-level fault backup during packet forwarding and fully utilizes bandwidth. However, its disadvantage is that if one link experiences repeated oscillations or reception / lighting problems, the device cannot detect it in time, leading to packet loss and impacting customer business and user experience. Therefore, this application proposes a link quality detection method to promptly detect link quality and improve the accuracy of link quality detection.

[0063] The link quality detection method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the current device 101 communicates with the interconnecting device 102 via a network. Specifically, refer to... Figure 1The current device 101 receives a Link Layer Discovery Protocol (LDP) message sent by its interconnected device 102 through the port of the interconnected device 102. Based on the port's oscillation count, transmitted optical power, and received optical power within the current unit of time, the current device 101 determines the link factor corresponding to the link between itself and the port. The link factor represents the link quality. Next, the value of the link factor identifier field in the LDP message is extracted, and its state is determined based on this value. The state of the link factor identifier field represents the port's state. Finally, the link quality is determined based on the link factor and the state of the link factor identifier field. Here, the current device 101 can refer to a physical machine or a network device, and the interconnected device 102 refers to a device interconnected with the current device 101, specifically a physical machine or a network device. A physical machine can refer to a computer device with complete hardware components (such as CPU, memory, hard disk, motherboard, power supply, etc.); a network device can refer to a switch, router, load balancer, wireless access point, etc.

[0064] It should be noted that both the current device 101 and the interconnected device 102 are devices in a network architecture (such as a DCN network), and any device in the network architecture can execute the link quality detection method of this application.

[0065] In one exemplary embodiment, such as Figure 2 As shown, a link quality detection method is provided, which is applied to... Figure 1 Taking the current device as an example, the explanation includes the following steps S201 to S204. Wherein:

[0066] Step S201: Receive the Link Layer Discovery Protocol (LDP) message sent by the interconnected device of the current device through the port of the interconnected device.

[0067] In this context, a link exists between the ports of the current device and its interconnecting devices. The interconnecting device can send Link Layer Discovery Protocol (LLP) messages to the current device through this port. Conversely, the current device can also send LLP messages to its interconnecting devices through its own ports. For example, see reference... Figure 3 All physical machines and network devices in the DCN network have LLDP (Link Layer Discovery Protocol) enabled, meaning that physical machines and network devices, or network devices with different roles, can send LLDP messages to each other.

[0068] Among them, reference Figure 3The current device can refer to a physical machine, and the interconnection device can refer to a network device connected to the physical machine; of course, the current device can refer to a network device, and the interconnection device can refer to other network devices or physical machines connected to the network device.

[0069] Among them, the Link Layer Discovery Protocol (LLDP) message refers to the LLDP message, or the Link Detection Query message. The purpose of the LLDP message is to automatically exchange device link layer information to achieve network topology discovery, device interconnection status monitoring, and support automated network management and troubleshooting.

[0070] For example, the interconnecting device of the current device sends a Link Layer Discovery Protocol (LLP) message to the current device through the port of the interconnecting device. The current device receives the LLP message and analyzes and processes it.

[0071] Step S202: Determine the link factor corresponding to the link between the current device and the port based on the number of oscillations, transmitted optical power, and received optical power of the port in the current unit time; the link factor is used to represent the link quality.

[0072] The current unit of time can be 20 seconds, 30 seconds, etc., and can be set according to the actual situation.

[0073] The number of times a port oscillates within the current unit of time can refer to the number of times the port jitters within the current unit of time.

[0074] Transmit optical power refers to the power of the port when transmitting optical signals. Received optical power refers to the power of the optical signals received by the port.

[0075] The link factor (Lq) represents the link quality between the current device and the interconnecting devices. It is determined by considering three dimensions: the number of oscillations per unit time, the transmitted optical power, and the received optical power. For example, a larger link factor indicates poorer link quality, while a smaller link factor indicates better link quality.

[0076] For example, after receiving a link layer discovery protocol message, the current device obtains the number of oscillations, transmitted optical power, and received optical power of the port within the current unit of time. For instance, it obtains these parameters from the port information of the interconnecting device. Next, the current device determines whether the number of oscillations of the port within the current unit of time is 0. If so, it calculates the link factor corresponding to the link between the current device and the port based on the port's transmitted and received optical power. For example, it obtains the link factor corresponding to the port's transmitted and received optical power as the link factor between the current device and the port. If not, it calculates the link factor corresponding to the link between the current device and the port based on the same parameters.

[0077] Step S203: Extract the value of the link factor identifier field in the link layer discovery protocol message, and determine the status of the link factor identifier field based on the value of the link factor identifier field; the status of the link factor identifier field is used to indicate the status of the port.

[0078] The Link Layer Discovery Protocol (LLDP) message includes an LLDPDU (Link Layer Discovery Protocol Data Unit). A new optional TLV (Type-Length-Value) field has been added to the LLDPDU. This field is used to define the Link Factor Identifier (LqID) field. See [link to documentation] for details. Figure 4 The link factor identifier field is 2 bits long and has four possible values: 00, 01, 10, and 11. 00 represents block, 01 represents delay, 10 represents recover, and 11 represents forward.

[0079] The link factor identifier field has four states: block, delay, recover, and forward.

[0080] The link factor identifier field is mainly used to determine the status of the ports of interconnected devices. For example, if the status of the link factor identifier field is "blocked", it means that the port of the interconnected device is in a blocked state. If the status of the link factor identifier field is "forwarding", it means that the port of the interconnected device is in a forwarding state.

[0081] For example, the current device identifies the LLDPDU from the link layer discovery protocol message, identifies the link factor identifier field corresponding to the link factor identifier field symbol from the LLDPDU, extracts the value of the link factor identifier field from the LLDPDU, and finally queries the correspondence between the value and the status based on the value of the link factor identifier field to obtain the status of the link factor identifier field.

[0082] Step S204: Determine the link quality based on the status of the link factor and the link factor identifier field.

[0083] The link quality refers to the final link quality, such as good link quality (data packets can be forwarded) or poor link quality (data packets cannot be forwarded). It is determined by combining the status of the link factor and the link factor identifier field.

[0084] It should be noted that the link factor can only determine the initial quality of the link between the current device and the ports of the interconnecting devices. The status of the ports of the interconnecting devices also needs to be determined by the status of the link factor identifier field in order to finally determine the link quality.

[0085] For example, the current device first determines whether the link factor is within a preset range, such as (0, 3). If not, it confirms that the link quality is poor and the data packet cannot be forwarded. If yes, it further determines whether the status of the link factor identifier field is in the forwarding state. If yes, it confirms that the link quality is good and the data packet can be forwarded. If not, it waits for the status of the link factor identifier field to return to the forwarding state. If yes, it confirms that the link quality is good and the data packet can be forwarded. If not, it confirms that the link quality is poor and the data packet cannot be forwarded.

[0086] In the aforementioned link quality detection method, the following steps are taken: The current device receives a Link Layer Discovery Protocol (LDP) message sent by an interconnecting device through its port. Based on the port's oscillation count, transmitted optical power, and received optical power within the current unit of time, the link factor corresponding to the link between the current device and the port is determined. The link factor represents the link quality. The value of the link factor identifier field in the LDP message is extracted, and its state is determined based on this value. The state of the link factor identifier field represents the port's state. Finally, the link quality is determined based on the link factor and the state of the link factor identifier field. This comprehensive approach to link quality detection, considering the interconnecting device's port oscillation count, transmitted optical power, and received optical power within the current unit of time, as well as the value of the link factor identifier field in the LDP message sent by the interconnecting device through its port, and using the link factor and the state of the link factor identifier field between the current device and the interconnecting device's ports, facilitates a comprehensive detection of link quality, thereby improving the accuracy of link quality detection. Meanwhile, based on the link layer discovery protocol messages, automatic link quality detection is achieved, thereby autonomously selecting forwarding links according to the link quality, avoiding repeated packet loss of service traffic due to poor link quality.

[0087] In an exemplary embodiment, step S202 above, which determines the link factor corresponding to the link between the current device and the port based on the number of oscillations, the transmitted optical power, and the received optical power of the port in the current unit time, specifically includes the following: when the number of oscillations is 0, the up-rounded value of the sum of the transmitted optical power and the received optical power is used as the link factor; when the number of oscillations is not 0, the ratio between the number of oscillations and the up-rounded value is used as the link factor.

[0088] The round-up value refers to the sum of the transmitted optical power and the received optical power rounded up. For example, if the sum of the transmitted optical power and the received optical power is 3.6, then the round-up value is 4.

[0089] For example, the current device determines whether the number of oscillations is 0. If the number of oscillations is 0, it calculates the floor value of the sum of the transmitted optical power and the received optical power, and uses this floor value as the link factor, i.e., link factor = floor value of the sum of the transmitted optical power and the received optical power = int(transmitted optical power + received optical power), where int represents floor value. If the number of oscillations is not 0, it calculates the ratio between the number of oscillations and the floor value, and uses this ratio as the link factor, i.e., link factor = (number of oscillations) / (floor value of the sum of the transmitted optical power and the received optical power) = number of oscillations / int(transmitted optical power + received optical power).

[0090] For example, when the number of oscillations is 0, the link factor can be calculated using the following formula:

[0091] Lq = int(rxpower + txpower);

[0092] Where Lq represents the link factor, rxpower represents the received optical power, txpower represents the transmitted optical power, and int(rxpower+txpower) represents the integer value of (rxpower+txpower).

[0093] When the number of oscillations is not zero, the link factor is calculated using the following formula:

[0094] Lq=jc / int(rxpower+txpower);

[0095] Here, jc represents the number of oscillations.

[0096] In this embodiment, different calculation methods are used to calculate the link factor based on whether the number of oscillations is 0. This helps to make the calculated link factor more accurate, thereby improving the accuracy of link factor determination.

[0097] In an exemplary embodiment, step S203 above, determining the state of the link factor identifier field based on the value of the link factor identifier field, specifically includes the following: querying the correspondence between the value and the state to obtain the state corresponding to the value of the link factor identifier field; and taking the state corresponding to the value of the link factor identifier field as the state of the link factor identifier field.

[0098] There is a one-to-one correspondence between the values ​​and the states. For example, 00 represents block, 01 represents delay, 10 represents recover, and 11 represents forward.

[0099] For example, the current device queries the correspondence between the value and the state based on the value of the link factor identifier field, obtains the state corresponding to the value of the link factor identifier field, and uses the state corresponding to the value of the link factor identifier field as the state of the link factor identifier field.

[0100] In this embodiment, by querying the correspondence between the value and the status, the status of the link factor identifier field can be quickly determined, thereby improving the efficiency of determining the status of the link factor identifier field.

[0101] In an exemplary embodiment, step S204 above, which determines the link quality based on the status of the link factor and the link factor identifier field, specifically includes the following: if the link factor is not within a preset range, determine that the link quality does not meet the quality requirements; if the link factor is within a preset range, determine whether the status of the link factor identifier field is a forwarding state; if the status of the link factor identifier field is a forwarding state, determine that the link quality meets the quality requirements.

[0102] The preset range is (0, 3), but can be set according to actual conditions. A link factor within the preset range means that the link factor belongs to (0, 3); a link factor outside the preset range means that the link factor belongs to [3, +∞).

[0103] In this context, "link quality not meeting quality requirements" means that the link quality is poor (data packets cannot be forwarded); "link quality meeting quality requirements" means that the link quality is good (data packets can be forwarded).

[0104] For example, the current device determines whether the link factor is within a preset range. If the link factor is not within the preset range, that is, the link factor belongs to [3, +∞), then it is determined that the link quality does not meet the quality requirements, that is, the link quality is poor (data packets cannot be forwarded). If the link factor is within the preset range, that is, the link factor belongs to (0, 3), then it continues to determine whether the status of the link factor identifier field is forwarding. If the status of the link factor identifier field is forwarding, then it is determined that the link quality meets the quality requirements, that is, the link quality is good (data packets can be forwarded).

[0105] In this embodiment, when determining the link quality, the status of the link factor and the link factor identifier field are considered comprehensively, which helps to accurately determine the link quality and thus improves the link quality detection accuracy.

[0106] In an exemplary embodiment, after determining whether the state of the link factor identifier field is in a forwarding state, the following steps are also included: if the state of the link factor identifier field is not in a forwarding state, wait for whether the state of the link factor identifier field is restored to a forwarding state; if the state of the link factor identifier field is restored to a forwarding state, determine that the link quality meets the quality requirements; if the state of the link factor identifier field is not restored to a forwarding state, determine that the link quality does not meet the quality requirements.

[0107] Specifically, restoring the link factor identifier field to the forwarding state means updating the link factor identifier field to the forwarding state. (Reference) Figure 7For example, if the link factor identifier field is in a blocked state, and the link factors for the next three consecutive time units after the current time unit are all within a preset range, then the link factor identifier field will return to a forwarding state. Similarly, if the link factor identifier field is in a delayed state, and the link factors for the next two consecutive time units after the current time unit are both within a preset range, then the link factor identifier field will return to a forwarding state. Finally, if the link factor identifier field is in a recovered state, and the link factor for the next time unit after the current time unit is within a preset range, then the link factor identifier field will return to a forwarding state.

[0108] The statement that the status of the link factor identifier field does not revert to the forwarding state means that the status of the link factor identifier field has not been updated to the forwarding state.

[0109] For example, if the state of the link factor identifier field is not in the forwarding state, the current device waits to see if the state of the link factor identifier field is restored to the forwarding state. If the state of the link factor identifier field is restored to the forwarding state, it is determined that the link quality corresponding to the port between the current device and the interconnected device meets the quality requirements, that is, the link quality of the link is good (data packets can be forwarded); if the state of the link factor identifier field is not restored to the forwarding state, it is determined that the link quality corresponding to the port between the current device and the interconnected device does not meet the quality requirements, that is, the link quality of the link is poor (data packets cannot be forwarded).

[0110] In this embodiment, if the status of the link factor identifier field is not in the forwarding state, we continue to wait for the status of the link factor identifier field to return to the forwarding state. This helps to determine in a timely manner whether the link quality meets the quality requirements, thereby improving the timeliness of link quality detection.

[0111] In an exemplary embodiment, waiting for the link factor identifier field to return to the forwarding state specifically includes the following: if the link factor identifier field is in a blocked state and the link factor in the next unit of time is within a preset range, adjust the link factor identifier field to a delayed state; if the link factor identifier field is in a delayed state and the link factor in the next unit of time is within a preset range, adjust the link factor identifier field to a recovery state; if the link factor identifier field is in a delayed state and the link factor in the next unit of time is not within a preset range, adjust the link factor identifier field to a blocked state; if the link factor identifier field is in a recovery state and the link factor in the next unit of time is within a preset range, adjust the link factor identifier field to a forwarding state; if the link factor identifier field is in a recovery state and the link factor in the next unit of time is not within a preset range, adjust the link factor identifier field to a delayed state.

[0112] The next unit of time after the current unit of time refers to the first unit of time after the current unit of time, such as the next 30 seconds.

[0113] For example, refer to Figure 7 If the link factor identifier field is in a blocked state at the current time, the device obtains the link factor for the next time unit and determines whether it falls within a preset range. If so, the status of the link factor identifier field for the next time unit is adjusted to a delayed state. If the link factor identifier field is in a delayed state at the current time, the device obtains the link factor for the next time unit and determines whether it falls within a preset range. If so, the status of the link factor identifier field for the next time unit is adjusted to a recovery state; otherwise, it falls back to a blocked state. If the link factor identifier field is in a recovery state at the current time, the device obtains the link factor for the next time unit and determines whether it falls within a preset range. If so, the status of the link factor identifier field for the next time unit is adjusted to a forwarding state; otherwise, it falls back to a delayed state.

[0114] In addition, refer to Figure 7If the link factor identifier field is in the forwarding state and the link factors for the next three consecutive time units after the current time unit are not within the preset range (i.e., all belong to [3, +∞), the current device will adjust the link factor identifier field to the blocking state.

[0115] In this embodiment, based on the state of the link factor identifier field in the current unit time and whether the link factor in the next unit time is within a preset range, the state of the link factor identifier field in the next unit time can be accurately determined. This allows for accurate determination of whether the state of the link factor identifier field has returned to the forwarding state, which is beneficial for timely perception of link quality.

[0116] In one exemplary embodiment, such as Figure 5 As shown, another link quality detection method is provided. Taking the application of this method to the current device as an example, the method includes the following steps S501 to S511. Wherein:

[0117] Step S501: Receive the Link Layer Discovery Protocol (LDP) message sent by the interconnected device of the current device through the port of the interconnected device.

[0118] Step S502: Obtain the number of oscillations, transmitted optical power, and received optical power of the port in the current unit of time.

[0119] Step S503: When the number of oscillations is 0, the rounded-up value of the sum of the transmitted optical power and the received optical power is used as the link factor corresponding to the link between the current device and the port; when the number of oscillations is not 0, the ratio between the number of oscillations and the rounded-up value is used as the link factor corresponding to the link between the current device and the port.

[0120] Step S504: Extract the value of the link factor identifier field in the link layer discovery protocol message.

[0121] Step S505: Query the correspondence between the value and the state to obtain the state corresponding to the value of the link factor identifier field; take the state corresponding to the value of the link factor identifier field as the state of the link factor identifier field.

[0122] Step S506: If the link factor is not within the preset range, determine that the link quality does not meet the quality requirements.

[0123] Step S507: If the link factor is within a preset range, determine whether the status of the link factor identifier field is a forwarding status.

[0124] Step S508: If the status of the link factor identifier field is forwarding, determine that the link quality meets the quality requirements.

[0125] Step S509: If the status of the link factor identifier field is not in the forwarding state, wait for the status of the link factor identifier field to be restored to the forwarding state.

[0126] Step S510: If the status of the link factor identifier field is restored to the forwarding status, determine that the link quality meets the quality requirements.

[0127] Step S511: If the status of the link factor identifier field does not return to the forwarding status, it is determined that the link quality does not meet the quality requirements.

[0128] In the above-mentioned link quality detection method, when performing link quality detection, the number of oscillations, transmitted optical power, and received optical power of the interconnecting device's port within the current unit time are comprehensively considered, as well as the value of the link factor identifier field in the link layer discovery protocol message sent by the interconnecting device through its port. By using the link factor corresponding to the link between the current device and the interconnecting device's port and the status of the link factor identifier field, the link quality corresponding to the link between the current device and the interconnecting device's port is determined. This facilitates comprehensive link quality detection and thus improves the accuracy of link quality detection.

[0129] To more clearly illustrate the link quality detection method provided in this application, a specific embodiment is used below to describe the method. In an exemplary embodiment, such as Figure 6 As shown, based on the full-mesh optical interconnect architecture in the DCN network, this application proposes a link quality detection method based on LLDP. This method defines a link factor identifier field (Lq ID) through the Option TLV field of the LLDPDU to determine the link quality between devices. The link factor (Lq) is derived based on a combination algorithm of port oscillation count and transmit / receive optical power (i.e., transmit optical power and receive optical power). This allows for the autonomous selection of forwarding links based on link quality, solving the problem of repeated packet loss in service traffic caused by poor link quality. This method requires all physical machines and network devices in the DCN network to enable LLDP. Specifically, it includes the following:

[0130] refer to Figure 4 The newly added Option TLV field is explicitly defined as follows:

[0131] Link Factor Identifier (Lq Id): The link factor serves as the basis for judging the link quality at the device end. Its status includes block, forward, delay, and recover. This field is 2 bits long, where 00 represents block, 01 represents delay, 10 represents recover, and 11 represents forward.

[0132] The specific implementation plan is as follows:

[0133] 1) Define the received optical power as rxpower and the transmitted optical power as txpower, respectively, and the port vibration count as jc. When jc is not equal to 0, the link factor Lq = jc / int(rxpower + txpower), where int(rxpower + txpower) represents the floor value of rxpower + txpower. Within a unit of time (related to the default LLDP interaction period, which is configurable), a larger link factor Lq indicates poorer link quality; a smaller link factor Lq indicates better link quality.

[0134] 2) Based on step 1), the default threshold value is set (which can be configured according to actual conditions). Based on experience, when the link quality is good, the rounded-up value of rxpower + txpower is in the range [1, 2]. Furthermore, if the number of port vibrations jc is greater than or equal to 3 within a unit of time (30s) (i.e., more than one vibration within 10s), the link quality is considered poor. Therefore, the default threshold value for the link factor Lq is set to (0, 3). When the link factor Lq is greater than or equal to 3, the link quality is considered unstable.

[0135] 3) When the number of port vibrations jc is 0, the link factor Lq no longer uses the algorithm in step 1). The link factor Lq is determined only by the value of rxpower + txpower rounded up, i.e., link factor Lq = int(rxpower + txpower). When rxpower + txpower is in the value range [1, 2], it proves that the link quality is good, otherwise it is poor.

[0136] 4) Based on step 3), according to empirical values, when the link quality is good, the range of rxpower + txpower rounded up is [1, 2]. Therefore, the default threshold value of the link factor Lq is set to (0, 3). In this case, when the link factor Lq is greater than or equal to 3, the link quality is considered unstable.

[0137] 5) When physical machines and network devices or network devices with different roles exchange LLDP messages, the physical machine determines the forwarding status of the port based on the link factor in the LLDP message. When the link factor Lq is in the range of (0, 3), and the link factor identifier field Lq ID is in the forward state, it indicates that the port is in a normal forwarding state and supports message forwarding. When forwarding messages, the corresponding link can be selected. When the link factor Lq is in the range of [3, +∞), and the link factor identifier field Lq ID is in the block state, it indicates that the port is in a blocked state and does not support message forwarding. That is, the corresponding link does not support message forwarding.

[0138] 6) When the link factor identifier field Lq ID is in the block state, LLDP messages can still interact normally. If the value of the link factor Lq is in the range of (0, 3) twice in a unit of time, the state of the link factor identifier field Lq ID is set to recover (block-delay-recover state machine transition). In this state, it still does not participate in message forwarding, but LLDP messages can be delivered normally.

[0139] 7) When the link factor identifier field Lq ID is in the recover state, if the value of the link factor Lq is detected to be in the range of (0, 3) again within a unit of time, the state of the link factor identifier field Lq ID is set to forward.

[0140] 8) When the link factor identifier field Lq ID is in the recover state, if the value of the link factor Lq is detected to be in the range [3, +∞) again within a unit time, the state of the link factor identifier field Lq ID is set to delay. In this state, it still does not participate in packet forwarding, but LLDP packets can be delivered normally.

[0141] 9) When the link factor identifier field Lq ID is in the delay state, if the value of the link factor Lq is detected to be in the range [3, +∞) again within a unit time, the state of the link factor identifier field Lq ID is set to block. In this state, it still does not participate in packet forwarding, but LLDP packets can be delivered normally.

[0142] 10) When the link factor identifier field Lq ID is in the delay state, if the value of the link factor Lq is detected to be in the range of (0, 3) again within a unit of time, the state of the link factor identifier field Lq ID is set to recover. In this state, it still does not participate in packet forwarding, but LLDP packets can be delivered normally.

[0143] For example, see reference. Figure 6 The device sends a link layer discovery protocol message (i.e., a link detection query message). Next, it checks if the port vibration count jc is 0. If so, the link factor Lq is the floor value of rxpower + txpower; otherwise, the link factor Lq = jc / int(rxpower + txpower), where int(rxpower + txpower) represents the floor value of rxpower + txpower. Then, it checks if the value of the link factor Lq is (0, 3). If not, it indicates poor link quality, and data packets cannot be forwarded. If so, it further checks if the status of the link factor identifier field Lq ID is forward. If so, it indicates good link quality, and data packets can be forwarded. If not, it waits to see if the status of the link factor identifier field Lq ID can be restored to forward. If so, it indicates good link quality, and data packets can be forwarded; otherwise, it indicates poor link quality, and data packets cannot be forwarded.

[0144] The above-described LLDP-based link quality detection method can achieve the following technical effects:

[0145] (1) This method is applicable to any networking scenario that supports the LLDP protocol. As for the method itself, it does not distinguish between device roles, types and physical network architecture, which makes the method highly available.

[0146] (2) This method does not require a centralized controller. Each device is responsible for detecting the links related to itself. The detection of a single device does not affect other devices. The fault domain is small, which makes this method highly reliable.

[0147] (3) The link factor used to determine the link quality in this method is derived by a combination algorithm of port transmit and receive power and oscillation count. The algorithm uses different determination factors as the basis for determining the link quality based on whether the oscillation count is 0.

[0148] (4) The extended link factor identifier field (Lq ID) of this method has four state machines: block, forward, delay, and recover. The state machines can flow between each other according to the link factor (Lq) range, the current state machine state, and the number of LLDP deliveries per unit time, forming a closed loop of state machines.

[0149] (5) This method is based on LLDP link quality detection. LLDP is a standard RFC (Request for Comments) protocol. This method is just a simple modification and innovation of Option TLV. While realizing the link detection function, it will not lose performance.

[0150] (6) There is currently no implementation of modifying LLDP messages to achieve automatic link quality detection; this method proposes a new implementation of automatic link quality detection by modifying and innovating Option TLV.

[0151] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0152] Based on the same inventive concept, this application also provides a link quality detection device for implementing the link quality detection method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more link quality detection device embodiments provided below can be found in the limitations of the link quality detection method described above, and will not be repeated here.

[0153] In one exemplary embodiment, such as Figure 8 As shown, a link quality detection device is provided, including: a message receiving module 810, a factor determination module 820, a state determination module 830, and a quality determination module 840, wherein:

[0154] The message receiving module 810 is used to receive link layer discovery protocol messages sent by the interconnected devices of the current device through the ports of the interconnected devices.

[0155] The factor determination module 820 is used to determine the link factor corresponding to the link between the current device and the port based on the number of oscillations, transmitted optical power and received optical power of the port in the current unit time; the link factor is used to represent the link quality.

[0156] The status determination module 830 is used to extract the value of the link factor identifier field in the link layer discovery protocol message, and determine the status of the link factor identifier field based on the value of the link factor identifier field; the status of the link factor identifier field is used to indicate the status of the port.

[0157] The quality determination module 840 is used to determine the link quality based on the status of the link factor and the link factor identifier field.

[0158] In an exemplary embodiment, the factor determination module 820 is further configured to, when the number of oscillations is 0, use the rounded-up value of the sum of the transmitted optical power and the received optical power as the link factor; and when the number of oscillations is not 0, use the ratio between the number of oscillations and the rounded-up value as the link factor.

[0159] In an exemplary embodiment, the state determination module 830 is further configured to query the correspondence between the value and the state to obtain the state corresponding to the value of the link factor identifier field; and to use the state corresponding to the value of the link factor identifier field as the state of the link factor identifier field.

[0160] In an exemplary embodiment, the quality determination module 840 is further configured to determine that the link quality does not meet the quality requirements when the link factor is not within a preset range; determine whether the status of the link factor identifier field is a forwarding status when the link factor is within the preset range; and determine that the link quality meets the quality requirements when the status of the link factor identifier field is a forwarding status.

[0161] In an exemplary embodiment, the quality determination module 840 is further configured to: wait for the state of the link factor identifier field to return to the forwarding state if the state of the link factor identifier field is not in the forwarding state; determine that the link quality meets the quality requirements if the state of the link factor identifier field returns to the forwarding state; and determine that the link quality does not meet the quality requirements if the state of the link factor identifier field does not return to the forwarding state.

[0162] In an exemplary embodiment, the quality determination module 840 is further configured to: adjust the state of the link factor identifier field to a delayed state when the state of the link factor identifier field is a blocked state and the link factor in the next unit time of the current unit time is within a preset range; adjust the state of the link factor identifier field to a recovery state when the state of the link factor identifier field is a delayed state and the link factor in the next unit time of the current unit time is within a preset range; adjust the state of the link factor identifier field to a blocked state when the state of the link factor identifier field is a delayed state and the link factor in the next unit time of the current unit time is not within a preset range; adjust the state of the link factor identifier field to a forwarding state when the state of the link factor identifier field is a recovery state and the link factor in the next unit time of the current unit time is within a preset range; and adjust the state of the link factor identifier field to a delayed state when the state of the link factor identifier field is a recovery state and the link factor in the next unit time of the current unit time is not within a preset range.

[0163] Each module in the aforementioned link quality detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0164] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a link quality detection method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0165] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0166] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0167] In one exemplary embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above-described method embodiments.

[0168] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0169] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0170] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0171] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0172] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A link quality detection method, characterized in that, The method includes: Receive link layer discovery protocol messages sent by the interconnected devices of the current device through the ports of the interconnected devices; Based on whether the number of oscillations of the port in the current unit of time is 0, the transmitted optical power, and the received optical power, the link factor corresponding to the link between the current device and the port is determined; the link factor is used to represent the link quality of the link. Extract the value of the link factor identifier field from the link layer discovery protocol message, and determine the state of the link factor identifier field based on the value of the link factor identifier field; the state of the link factor identifier field is used to represent the state of the port; the state of the link factor identifier field includes blocking state, delayed state, recovery state, and forwarding state; If the link factor is not within a preset range, the link quality is determined to be unsatisfactory. If the link factor is within the preset range, the status of the link factor identifier field is determined to be forwarding. If the status of the link factor identifier field is forwarding, the link quality is determined to be satisfactory.

2. The method according to claim 1, characterized in that, The step of determining the link factor corresponding to the link between the current device and the port based on whether the number of oscillations of the port in the current unit time is 0, the transmitted optical power, and the received optical power includes: When the number of oscillations is 0, the sum of the transmitted optical power and the received optical power, rounded up, is used as the link factor; If the number of oscillations is not zero, the ratio between the number of oscillations and the rounded-up value is used as the link factor.

3. The method according to claim 1, characterized in that, Determining the state of the link factor identifier field based on its value includes: The correspondence between the values ​​and the states is queried to obtain the states corresponding to the values ​​of the link factor identifier field; The state corresponding to the value of the link factor identifier field is taken as the state of the link factor identifier field.

4. The method according to claim 1, characterized in that, After determining whether the status of the link factor identifier field is a forwarding status, the process also includes: If the state of the link factor identifier field is not in the forwarding state, wait for the state of the link factor identifier field to be restored to the forwarding state; If the state of the link factor identifier field is restored to the forwarding state, it is determined that the link quality meets the quality requirements. If the state of the link factor identifier field does not return to the forwarding state, it is determined that the link quality does not meet the quality requirements.

5. The method according to claim 4, characterized in that, The process of waiting for the link factor identifier field to return to the forwarding state includes: If the state of the link factor identifier field is blocked, and the link factor of the next unit time of the current unit time is within the preset range, the state of the link factor identifier field will be adjusted to a delayed state. If the state of the link factor identifier field is in a delayed state, and the link factor of the next unit time of the current unit time is within the preset range, the state of the link factor identifier field will be adjusted to a recovery state. If the state of the link factor identifier field is delayed, and the link factor of the next unit time of the current unit time is not within the preset range, the state of the link factor identifier field is adjusted to blocked. If the link factor identifier field is in a recovery state and the link factor in the next unit of time is within the preset range, the state of the link factor identifier field will be adjusted to a forwarding state. If the link factor identifier field is in a recovery state and the link factor in the next unit of time is not within the preset range, the state of the link factor identifier field will be adjusted to a delay state.

6. A link quality detection device, characterized in that, The device includes: The message receiving module is used to receive link layer discovery protocol messages sent by the interconnecting devices of the current device through the ports of the interconnecting devices; The factor determination module is used to determine the link factor corresponding to the link between the current device and the port based on whether the number of oscillations of the port in the current unit time is 0, the transmitted optical power, and the received optical power; the link factor is used to represent the link quality of the link. The state determination module is used to extract the value of the link factor identifier field in the link layer discovery protocol message, and determine the state of the link factor identifier field based on the value of the link factor identifier field; the state of the link factor identifier field is used to represent the state of the port; the state of the link factor identifier field includes blocking state, delayed state, recovery state, and forwarding state; The quality determination module is used to determine that the link quality does not meet the quality requirements when the link factor is not within a preset range; to determine whether the status of the link factor identifier field is in a forwarding state when the link factor is within the preset range; and to determine that the link quality meets the quality requirements when the status of the link factor identifier field is in a forwarding state.

7. The apparatus according to claim 6, characterized in that, The state determination module is further configured to query the correspondence between the value and the state to obtain the state corresponding to the value of the link factor identifier field; and to use the state corresponding to the value of the link factor identifier field as the state of the link factor identifier field.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, 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 5.

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

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