Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a timeout detection method and a timeout detection system for bidirectional forwarding detection messages, which are used for performing timeout detection on BFD messages, recording and outputting timeout alarm information, realizing rapid protection switching and providing reliable data information for network maintenance.
The invention provides a timeout detection method for bidirectional forwarding detection messages, which comprises the following steps:
establishing a Bidirectional Forwarding Detection (BFD) information table, wherein each item of the BFD information table is used for storing a BFD session item and timing information issued by a Central Processing Unit (CPU);
receiving and analyzing a BFD message, and clearing timing information of an entry corresponding to the BFD message; and the number of the first and second groups,
periodically polling a BFD information table, updating the timing information of the polled items until the timing information reaches an overtime threshold, generating overtime alarm information, caching the overtime alarm information, assembling the cached overtime alarm information into a first alarm message, and then sending the first alarm message to the outside.
On the basis of the above technical solution, the timeout warning information includes the information of the entry and a timeout code pattern.
On the basis of the above technical solution, the assembling the cached overtime alarm information into a first alarm message and then sending the first alarm message to the outside includes:
and assembling the overtime alarm information with the preset amount cached into the first alarm message and then sending the first alarm message to the outside, wherein the first alarm message carries a timestamp.
On the basis of the above technical solution, the assembling the cached overtime warning information into the first warning message and then sending the first warning message to the outside further includes:
and assembling the overtime alarm information cached for a preset time into the first alarm message and then sending the first alarm message to the outside.
On the basis of the above technical solution, after receiving the BFD packet and clearing the timing information of the entry corresponding to the BFD packet, the method further includes:
when the timing information of the entry corresponding to the received BFD message reaches the timeout threshold, generating timeout clearing information and caching the timeout clearing information, wherein the timeout clearing information comprises the information of the entry and a clearing code pattern;
and assembling the cached overtime alarm information and the overtime clearing information into a second alarm message and then sending the second alarm message to the outside, wherein the second alarm message carries a timestamp.
The invention also provides a timeout detection system for bidirectional forwarding detection messages, which is arranged in a processor, wherein the processor is connected with the CPU through a bus, and the system comprises:
the analysis unit is used for receiving and analyzing the BFD message;
the detection unit is used for creating a BFD information table, and each item of the BFD information table is used for storing a BFD session item and timing information issued by the CPU; clearing the timing information of the entry corresponding to the BFD message according to the analysis result of the analysis unit; starting a timer, periodically polling the BFD information table, updating the timing information of the polled items until the timing information reaches an overtime threshold, generating overtime alarm information and caching;
the collecting unit is used for assembling the cached overtime alarm information into a first alarm message;
and the output unit is used for sending the first alarm message outwards.
On the basis of the above technical solution, the timeout warning information includes the information of the entry and a timeout code pattern.
On the basis of the above technical solution, the collecting unit is configured to assemble the timeout warning information whose cache reaches a preset number into the first warning packet, where the first warning packet carries a timestamp acquired from the timer.
On the basis of the above technical scheme, the collecting unit is further configured to assemble the timeout warning information cached for a preset duration into the first warning packet.
On the basis of the above technical solution, the detection unit is further configured to generate timeout purge information and cache the timeout purge information when the timing information of the entry corresponding to the received BFD packet reaches the timeout threshold and is cleared, where the timeout purge information includes information of the entry and a purge pattern;
the collecting unit is further configured to assemble the cached timeout alarm information and the timeout clearing information into a second alarm packet, where the second alarm packet carries a timestamp acquired from the timer;
the output unit is further configured to send a second warning message to the outside.
Compared with the prior art, the overtime detection method for the bidirectional forwarding detection message in the embodiment of the invention comprises the following steps: establishing a Bidirectional Forwarding Detection (BFD) information table, wherein each item of the BFD information table is used for storing a BFD session item and timing information issued by a Central Processing Unit (CPU); receiving and analyzing a BFD message, and clearing timing information of an entry corresponding to the BFD message; and periodically polling the BFD information table, updating the timing information of the polled items until the timing information reaches an overtime threshold, generating overtime alarm information, caching the overtime alarm information, assembling the cached overtime alarm information into a first alarm message, and then sending the first alarm message to the outside. The embodiment of the invention can detect the timeout of the BFD message, record and output the timeout alarm information, realize the fast protection switching and provide reliable data information for network maintenance.
Detailed Description
The invention is described in further detail below with reference to the figures and the embodiments.
Referring to fig. 1, an embodiment of the present invention provides a timeout detection method for a bidirectional forwarding detection packet, which is applied to a network device including a CPU and a processor, where the processor is connected to the CPU through a bus, and the timeout detection method for the bidirectional forwarding detection packet includes:
s110 creates a BFD information table, each item of the BFD information table is used for storing a BFD session item and timing information issued by a central processing unit CPU.
And S120, receiving and analyzing the BFD message.
S130, the timing information of the entry corresponding to the BFD message is cleared.
S140 periodically polls the BFD information table, updates the timing information of the polled items until the timing information reaches an overtime threshold, generates overtime alarm information and caches the overtime alarm information, assembles the cached overtime alarm information into a first alarm message and then sends the first alarm message to the outside.
Wherein steps S130 and S140 are performed in parallel.
Specifically, the network device includes a CPU and a processor, where the processor is a Field Programmable Gate Array (FPGA) or an Application Specific Integrated Circuit (ASIC). The network device is used as a local terminal device, the CPU establishes BFD sessions between the local terminal device and an opposite terminal device, the number of the BFD sessions is usually multiple, and each established BFD session corresponds to one BFD session table item.
Each item of the BFD information table is used for storing a BFD session item and timing information issued by a central processing unit CPU.
Specifically, the BFD information table is stored in a Random Access Memory (RAM) of the FPGA.
And for any entry of the BFD information table, clearing the timing information of the entry when receiving the BFD message corresponding to the entry. And meanwhile, polling the entry, and when the timing information of the entry is smaller than the timeout threshold, adding a polling period to the current timing information as the updated timing information.
The determination method of the polling period comprises the following steps: the polling period is the minimum timeout threshold/coefficient of all entries of the BFD information table, for example, the coefficient may be 10-100.
And the overtime threshold of each item is determined according to the actual working time parameter of successful negotiation between the local terminal equipment and the opposite terminal equipment when the BFD session is established. The sending time interval of the BFD message may be 1ms, 3.3ms, 10ms, 50ms, or 1s, etc. For example, when the sending time interval of the BFD message is 10ms, the timeout threshold is determined according to the sending time interval of the BFD message, for example, the timeout threshold may be 3 to 5 times of the sending time interval of the BFD message.
When polling an entry in the BFD information table, and when the timing information of the entry is less than the timeout threshold, adding 1ms to the current timing information as updated timing information.
Specifically, for a BFD packet whose timeout threshold is 10ms, the timing information of the entry is cleared each time the BFD packet is received. Meanwhile, at each polling, if the timing information of the entry has not reached the timeout threshold, the timing information of the entry is increased by 1 polling cycle. And if the timing information of the item reaches the timeout threshold, generating timeout alarm information and caching.
Generating overtime alarm information to indicate that the channel where the BFD session is located has a fault, assembling the cached overtime alarm information into a first alarm message, and then sending the first alarm message to a protection switching unit for protection switching operation. And the overtime alarm information in the cache is assembled into a first alarm message and then is sent to a management unit for analysis, so that reliable data information is provided for network maintenance.
The embodiment of the invention adopts the processor to receive and transmit the BFD message and carry out overtime detection, can obviously increase the number of items of the BFD information table, lightens the running load of a CPU, shortens the overtime detection time of the BFD message, simultaneously can record the real-time state of overtime alarm in a large scale and accurately by the accurate timing of the processor, realizes rapid protection switching and provides reliable data information for network maintenance.
In an alternative embodiment, the timeout alarm information includes information of the entry and a timeout pattern.
Specifically, the information of the entry may be information of a BFD session entry. The overtime code pattern can effectively reduce the storage space occupied by the alarm information in the cache and reduce the transmission quantity of the first alarm message.
In an optional implementation manner, in step S140, the timeout warning messages buffered to the preset amount are assembled into a first warning message, and then the first warning message is sent to the outside, where the first warning message carries a timestamp.
Specifically, the timeout alarm information may be cached in a First-in First-out (FIFO) memory. The preset number is determined according to actual needs, for example, the preset number may be 1/3 or 1/2 of the FIFO.
Further, the overtime alarm information of which the cache time reaches the preset time length is assembled into a first alarm message and then sent to the outside.
Specifically, the preset duration is determined according to the polling period, for example, the preset duration is equal to the polling period.
The timeout detection method for the bidirectional forwarding detection message according to another embodiment of the present invention includes:
s210 creates a BFD information table, where each entry of the BFD information table is used to store a BFD session entry and timing information sent by the CPU.
And S220, receiving and analyzing the BFD message.
S230 clears the timing information of the entry corresponding to the BFD packet.
S240, periodically polling the BFD information table, updating the timing information of the polled items until the timing information reaches the overtime threshold, generating overtime alarm information and caching.
And S250, when the timing information of the entry corresponding to the received BFD message reaches an overtime threshold and is cleared, generating overtime clearing information and storing the overtime clearing information into a cache, wherein the overtime clearing information comprises the information of the entry and a clearing code pattern.
S260, the cached overtime alarm information and the overtime clearing information are assembled into a second alarm message and then sent outwards.
Steps S230 to S260 are performed in parallel.
The timeout clearing information is used for clearing the protection switching mechanism and recovering the network.
The overtime code pattern can effectively reduce the storage space occupied by the overtime alarm information in the cache, and the clearing code pattern can effectively reduce the storage space occupied by the overtime clearing information in the cache and reduce the transmission quantity of the second alarm message.
In an optional implementation manner, when the timeout warning information and the timeout removing information in the cache reach the preset number, the timeout warning information and the timeout removing information are assembled into a second warning message and then sent to the outside, where the second warning message carries a timestamp.
Specifically, the preset number may be 1/3 or 1/2 of the total capacity of the FIFO.
Further, when the overtime alarm information and the overtime clearing information in the cache reach the preset time length, the overtime alarm information and the overtime clearing information are assembled into a second alarm message and then sent outwards.
Referring to fig. 2, an embodiment of the present invention provides an timeout detection system for bidirectional forwarding detection of a packet, which is disposed in a processor, and the processor is connected to a CPU through a bus, and is used to implement the timeout detection method for bidirectional forwarding detection of a packet according to the foregoing embodiment.
And the analysis unit is used for receiving and analyzing the BFD message.
The detection unit is used for creating a BFD information table, and each item of the BFD information table is used for storing a BFD session item and timing information issued by the CPU; clearing the timing information of the entry corresponding to the BFD message according to the analysis result of the analysis unit; and starting a timer, periodically polling the BFD information table, updating the timing information of the polled items until the timing information reaches an overtime threshold, generating overtime alarm information and caching.
The collecting unit is used for assembling the cached overtime alarm information into a first alarm message.
The output unit is used for sending the first alarm message outwards.
Specifically, the detection unit starts a timer and periodically polls the BFD information table according to a sampling pulse generated by the timer.
In an alternative embodiment, the timeout alarm information includes information of the entry and a timeout pattern.
In an optional implementation manner, the collecting unit is configured to assemble the timeout alarm information whose cache reaches the preset number into a first alarm packet, where the first alarm packet carries a timestamp acquired from the timer.
Further, the collecting unit is further configured to assemble the overtime alarm information that is cached for the preset duration into a first alarm packet.
In an optional implementation manner, the detection unit is further configured to generate timeout purge information and cache the timeout purge information when timing information of an entry corresponding to the received BFD packet reaches a timeout threshold and is cleared, where the timeout purge information includes information of the entry and a purge pattern.
The collecting unit is further configured to assemble the buffered timeout alarm information and the timeout removal information into a second alarm packet, where the second alarm packet carries a timestamp acquired from the timer.
The output unit is also used for sending a second alarm message outwards.
In an example, the processor is an FPGA, a low-speed read-write access bus may be between the CPU and the FPGA, and the CPU issues the negotiated actual working time parameter, the BFD message, and the encapsulation format of the alarm message to the FPGA. The alarm message comprises a first alarm message and a second alarm message.
An Ethernet message channel is arranged between the FPGA and the exchange chip to receive and transmit BFD messages and alarm messages. The BFD message is sent to a line through the exchange chip, sent to opposite-end equipment of the BFD session and received from the opposite-end equipment. And sending the alarm message to a protection switching unit in the switching chip.
Referring to the timeout detection system in the FPGA shown in fig. 3, the timeout detection system includes a timer, a RAM, a FIFO, and an assembly output logic in a collection unit.
The BFD information table is stored in the RAM, the FIFO is used for storing overtime alarm information and overtime clearing information, and the timer is used for generating a sampling pulse and a time stamp of the alarm message.
In an embodiment, the detection unit is configured to clear timing information of an entry corresponding to the BFD packet according to an analysis result of the analysis unit on the BFD packet; and polling the BFD information table, updating the timing information of the polled items until the timing information reaches the overtime threshold, generating overtime alarm information and storing the overtime alarm information in FIFO.
And the assembly output logic is used for assembling the overtime alarm information of which the cache reaches the preset number into a first alarm message, or assembling the overtime alarm information of which the cache reaches the preset duration into the first alarm message. The first alarm packet carries a timestamp acquired from the timer.
In another embodiment, the detection unit is configured to clear the timing information of the entry corresponding to the BFD packet according to the analysis result of the analysis unit on the BFD packet; and when the timing information of the entry corresponding to the BFD message reaches an overtime threshold and is cleared, generating overtime clearing information and storing the overtime clearing information into the FIFO. And polling the BFD information table, updating the timing information of the polled items until the timing information reaches the overtime threshold, generating overtime alarm information and storing the overtime alarm information in FIFO.
And the assembly output logic is used for assembling the overtime alarm information and the overtime clearing information of which the cache reaches the preset number into a second alarm message, or assembling the overtime alarm information group of which the cache reaches the preset duration and the overtime clearing information into the second alarm message. The second alarm packet carries a timestamp acquired from the timer.
The present invention is not limited to the above-described embodiments, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements are also considered to be within the scope of the present invention. Those not described in detail in this specification are within the skill of the art.