Switch port state recovery method, device, equipment, medium and program product
Patent Information
- Application Number
- CN202611439751.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-10-20
AI Technical Summary
[0004]本发明提供一种交换机端口状态恢复方法、装置、设备、介质及程序产品,以解决现有交换机端口Errdisable恢复机制采用固定周期策略、无法区分偶发故障与持续抖动端口、导致抖动端口反复震荡并持续消耗转发资源及CPU处理能力的技术问题
[0010]上述交换机端口状态恢复方法、装置、设备、介质及程序产品所提供的一个方案中,通过对交换机端口进入Errdisable状态的历史事件进行采集,得到滑动时间窗口内的抖动行为画像,并据此对端口抖动行为进行分析得到响应级别。当响应级别为第一级别时以固定基准间隔恢复,对偶发故障端口不引入额外延迟;当响应级别为第二级别时对基准恢复间隔进行指数退避计算,动态拉长恢复定时器,从而打断抖动端口的恢复—再触发震荡循环;当响应级别为第三级别时停止恢复定时器并置入隔离锁定标志,彻底阻断恶性抖动端口对系统资源的持续消耗。由此,本发明在不影响偶发故障端口正常恢复的前提下,有效抑制了持续抖动端口引发的震荡,降低了系统转发资源及CPU的持续消耗。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of switch technology, and in particular to a method, apparatus, device, medium, and program product for restoring the status of switch ports. Background Technology
[0002] In network devices such as Ethernet switches, when a port experiences anomalies such as protocol violations, link jitter, or CRC error exceeding the threshold, the control plane typically places the port in an Errdisable state to prevent the fault from spreading to the entire network. Existing technologies generally have mechanisms to place ports in an Errdisable state based on the cause of the anomaly, configure whether to enable automatic recovery timers, and perform periodic recovery of ports using a globally unified fixed recovery interval.
[0003] However, in scenarios with continuously jittering ports, the aforementioned fixed-period recovery mechanism uses the same fixed recovery interval regardless of whether the port experiences intermittent failures or continuous malicious jittering. This causes the jittering port to repeatedly trigger the Errdisable state after recovery, resulting in periodic oscillations. The control plane continuously processes link events, leading to long-term idle consumption of forwarding resources and CPU, and there is a lack of an effective mechanism to isolate the final state. Summary of the Invention
[0004] This invention provides a method, apparatus, device, medium, and program product for restoring the status of a switch port, in order to solve the technical problem that the existing switch port Errdisable recovery mechanism adopts a fixed period strategy, cannot distinguish between occasional faults and continuously jittering ports, and causes jittering ports to oscillate repeatedly and continuously consume forwarding resources and CPU processing capabilities.
[0005] In a first aspect, embodiments of this application provide a method for restoring the state of a switch port, including: Historical events of switch ports entering Errdisable state are collected to obtain a jitter behavior profile within a sliding time window. The jitter behavior profile includes the number of triggers, the trigger interval, and the state transition sequence. The jitter behavior of the switch port is analyzed based on the number of triggers, the trigger interval, and the state transition sequence to obtain the response level, which includes a first level, a second level, and a third level. When the response level is the first level, the recovery timer of the switch port is scheduled with a baseline recovery interval to obtain a first recovery interval, and the Errdisable state of the switch port is cleared according to the first recovery interval. When the response level is the second level, the baseline recovery interval is calculated exponentially based on the state transition sequence to obtain the second recovery interval, and the Errdisable state of the switch port is cleared based on the second recovery interval. When the response level is level 3, the recovery timer of the switch port is stopped, and the switch port is set with an isolation lockout flag.
[0006] Secondly, embodiments of this application provide a switch port state recovery device, comprising: The profile acquisition module is used to collect historical events of switch ports entering the Errdisable state to obtain a jitter behavior profile within a sliding time window. The jitter behavior profile includes the number of triggers, the trigger interval, and the state transition sequence. The level decision module is used to analyze the jitter behavior of the switch port based on the number of triggers, the trigger interval, and the state transition sequence to obtain the response level, which includes a first level, a second level, and a third level. The timed recovery module is used to schedule the recovery timer of the switch port with a reference recovery interval when the response level is the first level, to obtain a first recovery interval, and to clear the Errdisable state of the switch port according to the first recovery interval. The backoff recovery module is used to perform exponential backoff calculation on the baseline recovery interval according to the state transition sequence when the response level is the second level, to obtain the second recovery interval, and to clear the Errdisable state of the switch port according to the second recovery interval; The isolation lockout module is used to stop the recovery timer of the switch port and set the isolation lockout flag on the switch port when the response level is level 3.
[0007] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described switch port state recovery method.
[0008] Fourthly, embodiments of this application provide a readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described switch port state recovery method.
[0009] Fifthly, embodiments of this application provide a computer program product, which includes a computer program that, when executed by a processor, enables the implementation of the steps of the above-described switch port state recovery method.
[0010] In one solution provided by the aforementioned switch port state recovery method, apparatus, device, medium, and program products, historical events of switch ports entering the Errdisable state are collected to obtain a jitter behavior profile within a sliding time window. Based on this profile, the port jitter behavior is analyzed to determine the response level. When the response level is Level 1, recovery is performed at a fixed baseline interval, without introducing additional delay for intermittently faulty ports. When the response level is Level 2, the baseline recovery interval is calculated exponentially, dynamically lengthening the recovery timer to interrupt the recovery-re-triggering oscillation cycle of the jittered port. When the response level is Level 3, the recovery timer is stopped and an isolation lock flag is set, completely blocking the continuous consumption of system resources by maliciously jittered ports. Thus, this invention effectively suppresses the oscillation caused by continuously jittered ports without affecting the normal recovery of intermittently faulty ports, reducing the continuous consumption of system forwarding resources and CPU. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of a switch port status recovery system according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating a switch port status recovery method according to an embodiment of the present invention; Figure 3 yes Figure 2 A schematic diagram of the implementation process of step S10; Figure 4 yes Figure 2 A schematic diagram of the implementation process of step S20; Figure 5 yes Figure 2 A schematic diagram of the implementation process of step S30; Figure 6 This is a schematic diagram of a switch port status recovery device according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. It should also be understood that, as used in this specification and the appended claims, the term "and / or" refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0015] Furthermore, in the description of this invention and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0016] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0017] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0018] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0019] To address the problems mentioned above in the background art, this application provides a method, apparatus, device, medium, and program product for restoring the state of a switch port. The switch port state restoration method provided by this invention can be applied to applications such as... Figure 1 The switch port status recovery system shown includes a switch and a server.
[0020] In one embodiment, such as Figure 2 As shown, a method for restoring the state of a switch port is provided, which is applied to... Figure 1 Taking the switch port status recovery system as an example, the following steps are included: S10: Collect historical events of switch ports entering Errdisable state to obtain a jitter behavior profile within a sliding time window. The jitter behavior profile includes the number of triggers, the trigger interval, and the state transition sequence. S20: Analyze the jitter behavior of the switch port based on the number of triggers, the trigger interval, and the state transition sequence to obtain the response level, which includes a first level, a second level, and a third level; S30: When the response level is the first level, the recovery timer of the switch port is scheduled with a reference recovery interval to obtain a first recovery interval, and the Errdisable state of the switch port is cleared according to the first recovery interval; S40: When the response level is the second level, perform exponential backoff calculation on the baseline recovery interval according to the state transition sequence to obtain the second recovery interval, and clear the Errdisable state of the switch port according to the second recovery interval; S50: When the response level is level 3, stop the recovery timer of the switch port and set the isolation lock flag for the switch port.
[0021] In this embodiment, during operation, a switch port may enter an Errdisable state due to various abnormal reasons such as protocol violations, link jitter, CRC error exceeding the threshold, and port security violations. The control plane forcibly sets the port to Admin Down to prevent the fault from spreading. For each port, a sliding time window of length W is maintained. The window extends backward based on the current time, and historical events outside the window are pruned and cleared during each data collection.
[0022] When collecting historical events of a switch port entering the Errdisable state, each time an Errdisable entry event occurs, the current time is appended to the port's timestamp set as an entry timestamp. Simultaneously, older records exceeding the window's range are cleared, resulting in a valid timestamp set within the window. Based on this, the number of records in the valid timestamp set is counted to obtain the trigger count N within the window. The difference between adjacent entry timestamps is calculated sequentially to obtain the adjacent trigger intervals, and three statistics—the most recent trigger interval, the minimum trigger interval, and the average trigger interval—are maintained, collectively constituting the trigger interval statistic. Simultaneously, the event symbol E of the current entry event is appended to the state transition sequence in chronological order. The state transition sequence records the complete time sequence of various events such as Errdisable entry, automatic recovery, and isolation throughout the port's history. The trigger count N, the trigger interval statistic, and the state transition sequence together constitute the port's jitter behavior profile. It should be noted that the timestamp set has an upper limit. When the number of records in the set reaches the preset limit, the oldest timestamp record is discarded, and the current entry time is appended to the end of the set to prevent memory usage from increasing indefinitely with the number of triggers.
[0023] When analyzing the jitter behavior of switch ports based on the number of triggers, trigger intervals, and state transition sequences, a comprehensive analysis is performed on the number of triggers N, trigger interval statistics, and state transition sequences in the jitter behavior profile to output the response level. Specifically, the number of triggers N within a window is first compared with preset first, second, and third thresholds in sequence: if N is lower than the first threshold, it is initially determined to be at level one; if N reaches the second threshold, it is initially determined to be at level two; if N reaches the third threshold in multiple consecutive sliding time windows, it is initially determined to be at level three. Based on this, the trigger interval statistics are further density-judged. If the most recent trigger interval, minimum trigger interval, or average trigger interval is lower than the preset interval threshold, the trigger frequency is determined to be too high, and the initial level is revised upwards. Then, the event patterns in the state transition sequence are identified. If there is a continuous pattern of entry event symbol E, recovery event symbol R, and re-entry event symbol E in the sequence, i.e., E→R→E, it indicates that the port re-entered Errdisable within the observation window after the previous recovery, and is determined to be a recovery followed by failure, and the level is further revised upwards. Finally, the response level is output based on the rule that the third level takes precedence over the second level, and the second level takes precedence over the first level.
[0024] When the response level is Level 1, it indicates that the port has a low trigger count within the current sliding time window, belonging to an intermittent fault. Using a preset baseline recovery interval I0 as the current recovery interval, a recovery timer for the port is started. After the timer expires, the port's Errdisable state is cleared, the port is set to Admin Up, and a recovery event symbol R is appended to the state transition sequence. The recovery time tR is recorded, and an observation window is opened to monitor whether the port re-enters Errdisable within a subsequent period. In this embodiment, the typical value of the baseline recovery interval I0 is 300 seconds, which can be adjusted through configuration options and is not specifically limited.
[0025] When the response level is Level 2, it indicates that the port's trigger frequency within the current sliding time window has exceeded the second threshold, or that there is a recovery-failure pattern in the state transition sequence. The number of event symbols that fail after recovery is counted from the state transition sequence to obtain the consecutive recovery failure count F and the backoff generation k. Then, the product of the baseline recovery interval I0 and the square power of the backoff generation k is used as the candidate backoff interval. When the initial value of the backoff generation k is zero, the candidate backoff interval is no less than twice the baseline recovery interval to ensure a significant difference between the Level 2 and Level 1 recovery intervals. Based on this, the candidate backoff interval is compared with the preset backoff upper limit Imax, and the smaller value is taken to obtain the second recovery interval Icur. A recovery timer is started with Icur. After the timer expires, the port's Errdisable state is cleared and set to Admin Up. A recovery event symbol R is appended to the state transition sequence, and the recovery time tR is recorded. An observation window is then opened. If the port within the observation window re-enters Errdisable, the consecutive recovery failure count F and the backoff algebra k are each incremented by one. The backoff candidate interval will be further lengthened during the next round of exponential backoff calculation, thereby gradually suppressing the port's recovery-re-triggered oscillation. In this embodiment, the typical value of the backoff upper limit Imax is 3600 seconds, and no specific limitation is made thereto.
[0026] When the response level is Level 3, it indicates that the port's trigger frequency has consistently exceeded the third threshold within multiple consecutive sliding time windows, or that the consecutive recovery failure count F continues to increase even after the backoff interval has reached the backoff limit Imax. The currently running recovery timer for this port is cancelled, and any subsequent automatic recovery timer startup requests are rejected. An isolation lock flag is placed on the port, and an isolation event symbol Q is appended to the state transition sequence. An alarm is reported to the network management system, prompting maintenance personnel to intervene. It should be noted that if the port triggers the Errdisable event again while it is in an isolation lock state, only the isolation lock flag is refreshed; the alarm reporting process is not restarted repeatedly to avoid a large number of repeated alarms impacting maintenance. The port's isolation lock state can only be lifted by the administrator after confirming the root cause of the fault has been eliminated, through a manual unblocking operation and successful health verification. After unblocking, the trigger count, trigger interval statistics, consecutive recovery failure count, and backoff generation in the jitter behavior profile are reset, and a normal state event symbol N is appended to the state transition sequence.
[0027] In one embodiment, such as Figure 3 As shown, step S10 specifically includes the following steps: S11: When the switch port enters the Errdisable state, the historical timestamp set within the sliding time window is pruned based on the current time, historical entry events falling outside the window length are deleted, and the oldest record is eliminated when the number of records in the historical timestamp set reaches the preset upper limit. The current entry time is appended to the historical timestamp set to obtain the updated historical timestamp set and the number of triggers. S12: Calculate the difference between adjacent entry timestamps in the updated historical timestamp set, and statistically analyze the most recent trigger interval, the minimum trigger interval, and the average trigger interval to obtain the trigger interval statistics. S13: Symbolically record the event that is currently entering the Errdisable state, and arrange the event symbols and historical entry event symbols in chronological order to obtain a state transition sequence.
[0028] In this embodiment, each switch port independently maintains a historical timestamp set to record the time when an Errdisable entry event occurs within the sliding time window. When an Errdisable entry event occurs, the historical timestamp set is first pruned based on the current time. Each existing timestamp record in the set is checked, and records whose timestamp differs from the current time by more than the window length W are considered out-of-window events and deleted, while valid records within the window are retained. After pruning, it is determined whether the number of records in the current historical timestamp set has reached a preset upper limit. If the upper limit has been reached, the earliest record in the set is discarded, and the current entry time is appended to the end of the set; if the upper limit has not been reached, the current entry time is directly appended to the end of the set. After appending, the total number of valid records in the set is counted to obtain the number of triggers N within the current sliding time window and the updated historical timestamp set. It should be noted that the preset upper limit is introduced to prevent the timestamp set from expanding infinitely in extreme high-frequency jitter scenarios; a typical value can be set to 16 records, but no specific limitation is made.
[0029] Based on the above explanation, after obtaining the updated historical timestamp set, the difference between any two adjacent timestamp records in the set is calculated sequentially to obtain the trigger interval between each adjacent incoming event. On this basis, the most recent trigger interval, the minimum trigger interval, and the arithmetic mean of all trigger intervals are extracted from all trigger intervals and used as the most recent trigger interval, the minimum trigger interval, and the average trigger interval, respectively. These three together constitute the trigger interval statistics. Specifically, the most recent trigger interval reflects the current jitter rhythm of the port, the minimum trigger interval characterizes the most frequent triggering frequency in the port's history, and the average trigger interval reflects the overall trigger density within the window. These three statistics describe the port's oscillation characteristics from different dimensions and are used for subsequent jitter behavior analysis.
[0030] Furthermore, the event that triggers the Errdisable state is symbolized and recorded as the entry event symbol E. Based on this, event symbol E is appended chronologically to the end of the port's existing historical event symbol sequence. This historical event symbol sequence records various events that have occurred on the port in the past, including entry event symbol E, recovery event symbol R, isolation event symbol Q, and normal state event symbol N. Arranged chronologically, this yields a state transition sequence containing the current entry event. For example, if a port experiences a normal recovery and then re-enters Errdisable, its state transition sequence can be represented as N→E→R→E, completely recording the port's event trajectory from normal state to initial entry, recovery, and re-entry, for subsequent identification and analysis of event patterns within the sequence.
[0031] In one embodiment, after obtaining the state transition sequence, the method further includes: The difference between the most recent successful recovery time of the switch port and the current time of entering the Errdisable state is calculated. When the difference is not greater than the preset observation window duration, the switch port is determined to have failed after recovery, and a closed-loop failure flag is obtained. The consecutive recovery failure count and backoff generation are updated by incrementing the closed-loop failure flag, and the event symbols of subsequent failures after recovery are appended to the state transition sequence in chronological order to obtain the updated consecutive recovery failure count, backoff generation, and state transition sequence.
[0032] In this embodiment, each time a port completes an automatic recovery, the time of this recovery is recorded as the most recent successful recovery time tR. After obtaining the state transition sequence, the time difference between the current time t of entering the Errdisable state and the most recent successful recovery time tR is calculated to obtain the time interval between the two. This time interval is compared with the preset observation window duration Tobs. If the time interval is not greater than Tobs, it means that the port re-entered Errdisable within the observation window after the previous recovery was completed, and it is determined to be a recovery followed by failure, resulting in a loop closure failure flag. If the time interval is greater than Tobs, it means that the interval between this entry into Errdisable and the previous recovery is relatively long, and it does not belong to the case of recovery followed by failure, so no loop closure failure flag is generated. In this embodiment, the typical value of the observation window duration Tobs is 90 seconds, and there is no specific limitation on this value.
[0033] After receiving the closed-loop failure flag, the continuously recovering failure count F currently maintained for that port is incremented by one, resulting in an updated continuously recovering failure count F. Simultaneously, the backoff algebra k is incremented by one, resulting in an updated backoff algebra k. Specifically, the continuously recovering failure count F records the cumulative number of times the port recovers and then fails again within the current jitter period, while the backoff algebra k directly determines the extent to which the recovery interval is lengthened in subsequent exponential backoff calculations; the larger the k value, the longer the backoff candidate interval. Then, the event symbols of recovering and then failing again are appended to the end of the state transition sequence in chronological order, resulting in an updated state transition sequence. For example, if a port re-enters Errdisable within 90 seconds of recovery, its state transition sequence is updated from N→E→R→E, F changes from 0 to 1, and k changes from 0 to 1. Subsequent exponential backoff calculations will use k=1 as input, doubling the recovery interval compared to the baseline value, thereby suppressing the port's continuous oscillation.
[0034] In one embodiment, such as Figure 4 As shown, step S20 specifically includes the following steps: S21: The number of triggers is compared with the preset first threshold, second threshold and third threshold respectively. When the number of triggers is lower than the first threshold, a first-level decision result is obtained. When the number of triggers reaches the second threshold, a second-level decision result is obtained. When the number of triggers reaches the third threshold within multiple consecutive sliding time windows, a third-level decision result is obtained. S22: Perform density judgment on the most recent trigger interval, minimum trigger interval and average trigger interval in the trigger interval statistics, and obtain the trigger interval density judgment result when the trigger interval statistics are lower than the preset interval threshold. S23: Identify the continuous pattern of entry event symbol, recovery event symbol, and re-entry event symbol in the state transition sequence to obtain the closed-loop failure judgment result; S24: Based on the first-level decision result, the second-level decision result, the third-level decision result, the trigger interval density decision result, and the closed-loop failure decision result, a comprehensive decision is made according to the rule that the third level takes precedence over the second level and the second level takes precedence over the first level, to obtain the response level.
[0035] In this embodiment, when comparing the number of triggers to a threshold, the number of triggers N, counted within the current sliding time window, is compared sequentially with a preset first threshold, a second threshold, and a third threshold. If N is lower than the first threshold, a first-level judgment result is obtained, indicating that the current port trigger frequency is low and is an intermittent fault. If N reaches the second threshold, a second-level judgment result is obtained, indicating that the current port has experienced relatively frequent jitter. If N reaches the third threshold in multiple consecutive sliding time windows, a third-level judgment result is obtained, indicating that the port has been in a high-frequency jitter state for a long time. In this embodiment, the typical values for the first, second, and third thresholds are 2, 3, and 6 times, respectively, and the typical window length W of the sliding time window is 1800 seconds, without specific limitations. It should be noted that the trigger condition for the third-level judgment result requires the number of triggers to reach the third threshold in multiple consecutive sliding time windows, rather than only in a single window. This is to avoid misjudging short-term sudden jitter as continuous malicious jitter.
[0036] Based on the above explanation, after comparing the trigger count threshold, the most recent trigger interval, minimum trigger interval, and average trigger interval in the trigger interval statistics are further compared with preset interval thresholds. If any of the three statistics is lower than the preset interval threshold, the current port's trigger frequency is determined to be too high, resulting in a trigger interval density judgment result. Specifically, a too-small most recent trigger interval indicates that the port is still in a high-frequency jitter state; a too-small minimum trigger interval indicates that the port has historically experienced extremely dense triggering; and a too-small average trigger interval indicates that the overall triggering rhythm within the window is too fast. The trigger interval density judgment result complements the trigger count judgment result, enabling the identification of abnormal scenarios where the trigger count does not exceed the threshold but the trigger interval is extremely short.
[0037] Based on this, the event symbol patterns in the state transition sequence are scanned to identify whether there is a continuous sequence of entry event symbol E, recovery event symbol R, and re-entry event symbol E, i.e., the E→R→E pattern. If this pattern is identified, it indicates that the port has re-entered Errdisable within the observation window after completing one automatic recovery, resulting in a loop closure failure judgment. For example, if the state transition sequence of a port is N→E→R→E→R→E, and there are two E→R→E patterns, it indicates that the port has failed twice after recovery, and the failure strength corresponding to the loop closure failure judgment is correspondingly higher.
[0038] Then, the above four types of judgment results are combined, and the final response level is output according to the rule that the third level takes precedence over the second level, and the second level takes precedence over the first level. Specifically, if the trigger count judgment result is the third level, or the trigger interval density judgment result and the loop closure failure judgment result both point to continuous high-frequency jitter, then the third level is output; if the trigger count judgment result is the second level, or either the trigger interval density judgment result or the loop closure failure judgment result is true, then the second level is output; if none of the above conditions are met, then the first level is output.
[0039] In one embodiment, such as Figure 5 As shown, step S40 specifically includes the following steps: S41: When the response level is the second level, the event symbols that fail again after recovery in the state transition sequence are counted to obtain the consecutive recovery failure count and the backoff generation; S42: Calculate the product of the baseline recovery interval and the quadratic value corresponding to the backoff algebra. When the initial value of the backoff algebra is zero, the product result is not less than twice the baseline recovery interval, and a candidate backoff interval is obtained. S43: Compare the candidate backoff interval with the preset backoff limit and take the smaller value to obtain the second recovery interval, and clear the Errdisable state of the switch port according to the second recovery interval.
[0040] In this embodiment, when the response level is level two, the event symbols of recovery followed by failure in the state transition sequence are statistically analyzed. Specifically, the state transition sequence is traversed, all E→R→E patterns are identified, and the number of consecutive recovery followed by failure events at the end of the sequence is counted to obtain the consecutive recovery failure count F. At the same time, the current value of F is used as the backoff algebra k, which directly determines the lengthening of the recovery interval in this round of exponential backoff calculation.
[0041] After obtaining the retreat algebra k, the product of the baseline recovery interval I0 and the corresponding power of k is used as the candidate retreat interval. It should be noted that when the initial value of the retreat algebra k is zero, the power of k is 1, and the product result is the same as the baseline recovery interval, failing to reflect the vibration suppression difference between the second level and the first level. Therefore, it is stipulated that when the initial value of k is zero, the candidate retreat interval should not be less than twice the baseline recovery interval; that is, twice the baseline recovery interval is used as the starting value for the second level. For example, if the baseline recovery interval I0 is 300 seconds, the candidate retreat interval is 600 seconds when k=0, 600 seconds when k=1, 1200 seconds when k=2, and 2400 seconds when k=3, doubling sequentially as the retreat algebra increases.
[0042] Based on this, the backoff candidate interval is compared with the preset backoff upper limit Imax, and the smaller value between the two is taken as the second recovery interval Icur. The recovery timer for this port is started with Icur. After the timer expires, the port's Errdisable state is cleared and the port is set to Admin Up. In this embodiment, the typical value of the backoff upper limit Imax is 3600 seconds. When the backoff candidate interval exceeds 3600 seconds, Icur is fixed at 3600 seconds and will not be extended further; no specific limitation is made on this.
[0043] In one embodiment, after obtaining the second recovery interval, the method further includes: The second recovery interval is compared with the backoff limit, and it is determined whether the consecutive recovery failure count continues to increase after the backoff limit is reached, so as to obtain the backoff failure determination result. Based on the backoff failure determination result, the response level is upgraded to the third level, and the recovery timer of the switch port is stopped according to the third level, and an isolation lock flag is set on the switch port.
[0044] In this embodiment, after obtaining the second recovery interval Icur, Icur is compared with the preset backoff upper limit Imax to determine whether the current backoff calculation has reached the upper limit. If Icur equals Imax, it means that the backoff candidate interval has exceeded the backoff upper limit, and the current recovery interval has reached its maximum. Based on this, the continuous recovery failure count F is further judged. If, when Icur has reached Imax, the port enters Errdisable again within the observation window after completing this round of recovery, causing the continuous recovery failure count F to continue to increase, it is determined that the backoff has reached its maximum and continued to fail, resulting in a backoff maximum failure judgment result. Specifically, after each timer expires and recovery is performed, if the port enters Errdisable again within the observation window, F is incremented by one. If Icur is already Imax and the increment of F has not stopped, the backoff maximum failure judgment result is triggered. For example, if a port enters Errdisable again within 90 seconds after the timer expires and recovery is performed when the backoff interval has been extended to 3600 seconds, F changes from 3 to 4. At this time, Icur can no longer be extended, and it is determined that the backoff maximum failure has been achieved.
[0045] After receiving the backoff failure result, the current response level is upgraded from level two to level three. This involves canceling any currently running recovery timers on the port, rejecting any subsequent requests to start automatic recovery timers, setting an isolation lock flag on the port, appending an isolation event symbol Q to the state transition sequence, and reporting an alarm to the network management system.
[0046] In one embodiment, after setting the isolation lockout flag on the switch port, the method further includes: The switch port is checked to see if an isolation lockout flag exists, and the lockout status detection result is obtained. The isolation lock flag is refreshed based on the lock status detection result to obtain the updated isolation lock flag, and the alarm report triggered this time is suppressed.
[0047] In this embodiment, even after the port has an isolation lock flag, it may still trigger the Errdisable entry event again due to continuous abnormalities in the link physical layer. Each time it triggers, the system first checks whether the port already has an isolation lock flag, obtaining the lock status detection result. If the isolation lock flag is detected as already existing, it indicates that the port is currently in an isolation lock state. The isolation lock flag is then refreshed, maintaining its validity and updating its most recent trigger time to obtain an updated isolation lock flag. Simultaneously, alarm reporting for this trigger is suppressed, preventing repeated alarms from being sent to the network management system. If the isolation lock flag is detected as not existing, the jitter behavior profile collection and response level determination are performed according to the normal procedure. It should be noted that the purpose of alarm suppression is to prevent the port from continuously triggering and sending a large number of duplicate alarms to the network management system in a short period during the isolation period, affecting the effective identification and processing of alarm information by maintenance personnel. Repeated triggering events during the isolation period are only recorded by refreshing the isolation lock flag; the port's isolation status remains unchanged, and the port remains Admin Down until the administrator initiates a manual unblocking operation.
[0048] In one embodiment, after obtaining the updated isolation lock flag, the method further includes: Check whether the switch port is currently in a management-off state, and confirm that the switch port is currently in a Down state due to Errdisable, and obtain the health verification result; The isolation lock flag is cleared based on the health verification result, and the number of triggers, trigger interval statistics, consecutive recovery failure count and backoff generation are reset. At the same time, normal state event symbols are added to the state transition sequence to obtain the reset jitter behavior profile.
[0049] In this embodiment, after confirming that the root cause of the port failure has been eliminated, the administrator initiates a manual unblocking operation on the device. Before unblocking, a health verification of the port's current status is performed. Specifically, the health verification includes two checks: First, checking whether the port is in a managed shutdown state, i.e., whether the port has been actively shut down by the administrator. If the port is currently in a managed shutdown state, it means that the port's Down state was not caused by Errdisable, and the unblocking conditions are not met, so the health verification fails. Second, confirming that the port is currently in a Down state caused by Errdisable. If the port has recovered to the Up state for other reasons, the unblocking conditions are also not met. After both checks pass, a health verification result is obtained, allowing the subsequent unblocking operation to proceed.
[0050] After obtaining the health verification result, the isolation lock flag of the port is cleared, releasing the port from isolation. Then, the statistics in the jitter behavior profile are reset sequentially: the trigger count N is cleared to zero, the historical timestamp set is cleared, and the trigger interval statistics (recent trigger interval, minimum trigger interval, and average trigger interval) are set to zero. The consecutive recovery failure count F and backoff generation k are also reset to zero. Based on this, a normal state event symbol N is appended to the end of the state transition sequence, resulting in the reset jitter behavior profile. After completing the above operations, the Errdisable state of the port is cleared, and the port is set to Admin Up, resuming normal forwarding. It should be noted that resetting the jitter behavior profile ensures that the port re-participates in subsequent jitter behavior collection and analysis with a completely new initial state after unblocking, avoiding interference from historical profile data in the response level determination of the port after unblocking.
[0051] In one embodiment, after clearing the Errdisable state of the switch port, the method further includes: The recovery time after the switch port is cleared from the Errdisable state is recorded, and the recovery event symbols are appended to the state transition sequence in chronological order to obtain a state transition sequence containing recovery event symbols; An observation window is opened based on the state transition sequence containing the recovery event symbol. The switch port within the observation window is monitored to see if it re-enters the Errdisable state. The observation window monitoring result is then used as input for the closed-loop failure determination.
[0052] In this embodiment, whenever a port completes an Errdisable state clearing and sets it to Admin Up, the execution time of this clearing operation is recorded as the most recent successful recovery time tR. The recovery event symbol R is then appended to the end of the port's state transition sequence in chronological order, resulting in a state transition sequence containing the current recovery event symbol. For example, if a port completes its first recovery after going through N→E, the state transition sequence is updated to N→E→R, and tR is recorded as the execution time of this recovery.
[0053] After recording the recovery time and updating the state transition sequence, an observation window is opened starting from tR, with a duration of the preset observation window duration Tobs. During the observation window, the port is continuously monitored for whether it re-enters the Errdisable state. If the port is detected to re-enter the Errdisable state within the observation window duration Tobs, the observation window monitoring result is "recovery followed by failure"; if the port does not re-enter the Errdisable state when the observation window duration Tobs expires, the observation window monitoring result is "recovery stabilized". The observation window monitoring result serves as the input for closed-loop failure determination. When the monitoring result is "recovery followed by failure", it triggers an update of the consecutive recovery failure count F and the backoff algebra k, and appends the event symbol of "recovery followed by failure" to the state transition sequence for subsequent jitter behavior analysis and response level determination. It should be noted that the typical value of the observation window duration Tobs is 90 seconds, which is less than the baseline recovery interval I0, ensuring that the observation window can complete monitoring before the next recovery timer expires in the first-level fixed-period recovery scenario. No specific limitation is made on this value.
[0054] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0055] In one embodiment, a switch port state recovery device is provided, which corresponds one-to-one with the switch port state recovery method described in the above embodiments. For example... Figure 6 As shown, the switch port status recovery device includes: The profile acquisition module 601 is used to collect historical events of switch ports entering the Errdisable state to obtain a jitter behavior profile within a sliding time window. The jitter behavior profile includes the number of triggers, the trigger interval, and the state transition sequence. The level decision module 602 is used to analyze the jitter behavior of the switch port based on the number of triggers, the trigger interval and the state transition sequence to obtain the response level, which includes a first level, a second level and a third level. The timed recovery module 603 is used to schedule the recovery timer of the switch port with a reference recovery interval when the response level is the first level, to obtain a first recovery interval, and to clear the Errdisable state of the switch port according to the first recovery interval. The backoff recovery module 604 is used to perform exponential backoff calculation on the baseline recovery interval according to the state transition sequence when the response level is the second level, to obtain the second recovery interval, and to clear the Errdisable state of the switch port according to the second recovery interval; The isolation lockout module 605 is used to stop the recovery timer of the switch port and set the isolation lockout flag on the switch port when the response level is level 3.
[0056] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0057] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0058] This application also provides a computer device, such as... Figure 7 As shown, the computer device includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor. When the processor executes the computer program, it implements the steps in any of the above method embodiments, or when the processor executes the computer program, it implements the functions of each module / unit in the above device embodiments.
[0059] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device.
[0060] Those skilled in the art will understand that Figure 7 The computer device described is merely an example and does not constitute a limitation on the computer device. It may include more or fewer components than shown, or combine certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.
[0061] The aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), or field-programmable gate arrays (FPGAs). Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0062] The memory can be an internal storage unit of the computer device, such as a hard drive or RAM. The memory can also be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory can include both internal and external storage units of the computer device.
[0063] This application also provides a readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0064] This application provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.
[0065] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0066] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0067] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0068] In the embodiments provided in this application, it should be understood that the disclosed apparatus / devices and methods can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0069] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0070] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for restoring the state of a switch port, characterized in that, The switch port status recovery method includes: Historical events of switch ports entering Errdisable state are collected to obtain a jitter behavior profile within a sliding time window. The jitter behavior profile includes the number of triggers, the trigger interval, and the state transition sequence. The jitter behavior of the switch port is analyzed based on the number of triggers, the trigger interval, and the state transition sequence to obtain the response level, which includes a first level, a second level, and a third level. When the response level is the first level, the recovery timer of the switch port is scheduled with a baseline recovery interval to obtain a first recovery interval, and the Errdisable state of the switch port is cleared according to the first recovery interval. When the response level is the second level, the baseline recovery interval is calculated exponentially based on the state transition sequence to obtain the second recovery interval, and the Errdisable state of the switch port is cleared based on the second recovery interval. When the response level is level 3, the recovery timer of the switch port is stopped, and the switch port is set with an isolation lockout flag.
2. The switch port status recovery method according to claim 1, characterized in that, Historical events of switch ports entering Errdisable state are collected to obtain a jitter behavior profile within a sliding time window, including: When the switch port enters the Errdisable state, the historical timestamp set within the sliding time window is pruned based on the current time, historical entry events that fall outside the window length are deleted, and the oldest record is eliminated when the number of records in the historical timestamp set reaches the preset upper limit. The current entry time is then appended to the historical timestamp set to obtain the updated historical timestamp set and the number of triggers. The difference between adjacent entry timestamps in the updated historical timestamp set is calculated, and the most recent trigger interval, minimum trigger interval, and average trigger interval are statistically analyzed to obtain the trigger interval statistics. The events that currently enter the Errdisable state are symbolically recorded, and the event symbols are arranged in chronological order with the historical event symbols to obtain a state transition sequence.
3. The switch port status recovery method according to claim 2, characterized in that, After obtaining the state transition sequence, the following is also included: The difference between the most recent successful recovery time of the switch port and the current time of entering the Errdisable state is calculated. When the difference is not greater than the preset observation window duration, the switch port is determined to have failed after recovery, and a closed-loop failure flag is obtained. The consecutive recovery failure count and backoff generation are updated by incrementing the closed-loop failure flag, and the event symbols of subsequent failures after recovery are appended to the state transition sequence in chronological order to obtain the updated consecutive recovery failure count, backoff generation, and state transition sequence.
4. The switch port status recovery method according to claim 1, characterized in that, The jitter behavior of the switch port is analyzed based on the number of triggers, the trigger interval, and the state transition sequence to obtain the response level, including: The number of triggers is compared with a preset first threshold, a second threshold, and a third threshold. When the number of triggers is lower than the first threshold, a first-level decision result is obtained. When the number of triggers reaches the second threshold, a second-level decision result is obtained. When the number of triggers reaches the third threshold within multiple consecutive sliding time windows, a third-level decision result is obtained. The density of the most recent trigger interval, minimum trigger interval, and average trigger interval in the trigger interval statistics is determined, and the trigger interval density judgment result is obtained when the trigger interval statistics are lower than the preset interval threshold. The continuous pattern of entering event symbols, recovering event symbols, and re-entering event symbols in the state transition sequence is identified to obtain the closed-loop failure judgment result; The response level is obtained by comprehensively judging the results of the first-level judgment, the second-level judgment, the third-level judgment, the trigger interval density judgment, and the closed-loop failure judgment according to the rule that the third level takes precedence over the second level and the second level takes precedence over the first level.
5. The switch port status recovery method according to claim 4, characterized in that, When the response level is the second level, an exponential backoff calculation is performed on the baseline recovery interval based on the state transition sequence to obtain the second recovery interval, including: When the response level is the second level, the event symbols that fail again after recovery in the state transition sequence are counted to obtain the consecutive recovery failure count and the backoff generation; The product of the baseline recovery interval and the quadratic value corresponding to the backoff algebra is calculated. When the initial value of the backoff algebra is zero, the product result is not less than twice the baseline recovery interval, thus obtaining the backoff candidate interval. The second recovery interval is obtained by comparing the candidate backoff interval with the preset backoff upper limit and taking the smaller value.
6. The switch port status recovery method according to claim 5, characterized in that, After obtaining the second recovery interval, the following is also included: The second recovery interval is compared with the backoff limit, and it is determined whether the consecutive recovery failure count continues to increase after the backoff limit is reached, so as to obtain the backoff failure determination result. Based on the backoff failure determination result, the response level is upgraded to the third level, and the recovery timer of the switch port is stopped according to the third level, and an isolation lock flag is set on the switch port.
7. The switch port status recovery method according to claim 6, characterized in that, After setting the isolation lockout flag on the switch port, the following is also included: The switch port is checked to see if an isolation lockout flag exists, and the lockout status detection result is obtained. The isolation lock flag is refreshed based on the lock status detection result to obtain the updated isolation lock flag, and the alarm report triggered this time is suppressed.
8. The switch port status recovery method according to claim 7, characterized in that, After receiving the updated isolation lockout flag, it also includes: Check whether the switch port is currently in a management-off state, and confirm that the switch port is currently in a Down state due to Errdisable, and obtain the health verification result; The isolation lock flag is cleared based on the health verification result, and the number of triggers, trigger interval statistics, consecutive recovery failure count and backoff generation are reset. At the same time, normal state event symbols are added to the state transition sequence to obtain the reset jitter behavior profile.
9. The switch port status recovery method according to claim 1, characterized in that, After clearing the Errdisable state of the switch port, the process also includes: The recovery time after the switch port is cleared from the Errdisable state is recorded, and the recovery event symbols are appended to the state transition sequence in chronological order to obtain a state transition sequence containing recovery event symbols; An observation window is opened based on the state transition sequence containing the recovery event symbol. The switch port within the observation window is monitored to see if it re-enters the Errdisable state. The observation window monitoring result is then used as input for the closed-loop failure determination.
10. A switch port status recovery device, characterized in that, include: The profile acquisition module is used to collect historical events of switch ports entering the Errdisable state to obtain a jitter behavior profile within a sliding time window. The jitter behavior profile includes the number of triggers, the trigger interval, and the state transition sequence. The level decision module is used to analyze the jitter behavior of the switch port based on the number of triggers, the trigger interval, and the state transition sequence to obtain the response level, which includes a first level, a second level, and a third level. The timed recovery module is used to schedule the recovery timer of the switch port with a reference recovery interval when the response level is the first level, to obtain a first recovery interval, and to clear the Errdisable state of the switch port according to the first recovery interval. The backoff recovery module is used to perform exponential backoff calculation on the baseline recovery interval according to the state transition sequence when the response level is the second level, to obtain the second recovery interval, and to clear the Errdisable state of the switch port according to the second recovery interval; The isolation lockout module is used to stop the recovery timer of the switch port and set the isolation lockout flag on the switch port when the response level is level 3.
11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the switch port state recovery method as described in any one of claims 1 to 9.
12. A readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the switch port state recovery method as described in any one of claims 1 to 9.
13. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, causes to implement the steps of the switch port state recovery method as described in any one of claims 1 to 9.