Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, a device and a medium for realizing anti-jitter of an optical fiber channel, so as to improve the above problems.
The embodiment of the invention provides an anti-jitter realization method for an optical fiber channel, which comprises the following steps:
monitoring the state of a target interface;
when the current state of the target interface is a DOWN state and an UP interrupt signal is received, entering an interface jitter waiting state;
in the interface jitter waiting state, carrying out timing polling on the state of the target interface;
and when the interface states of continuous multiple polling are all UP states, controlling the target interface to enter the UP state.
Preferably, the UP/DOWN interrupts of the target interface are masked in the interface jitter waiting state.
Preferably, the continuous times are three times continuously, and are recorded by an UP/DOWN interrupt counter.
Preferably, the interface jitter waiting state comprises three sub-states of a jitter waiting initial state, a first UP state and a second UP state; then, in the interface jitter waiting state, performing timed polling on the state of the target interface, and when the interface states of consecutive multiple polling are all UP states, controlling the target interface to enter the UP state, specifically:
when the target interface is in a DOWN state and receives an UP interrupt signal, entering a jitter waiting initial state;
in the initial state of jitter waiting, when the state of the target interface is UP and the UP/DOWN interrupt counter is not changed by polling, the UP state is entered for the first time;
in the first UP state, when the state of the target interface is polled to be the DOWN state or the state of the target interface is the UP state and the UP/DOWN interrupt counter is changed, returning to the jitter waiting initial state; when the state of the target interface is in an UP state and the UP/DOWN interrupt counter is not changed in the polling process, entering a second UP state;
in the second UP state, when the state of the target interface is polled to be the DOWN state or the state of the target interface is the UP state and the UP/DOWN interrupt counter is changed, returning to the jitter waiting initial state; and when the state of the target interface is in an UP state and the UP/DOWN interrupt counter is not changed by polling, controlling the target interface to enter the UP state.
Preferably, the UP/DOWN interrupt counter is cleared after reading the UP/DOWN interrupt counter of the interface once.
Preferably, the polling mechanism of the interface state adopts continuous traversal polling, the continuous traversal polling is the traversal of starting the interface state after the system is started, and the interface state and the UP/DOWN interrupt counter are acquired at regular time to form the interface state input.
Preferably, the polling mechanism of the interface state adopts on-demand polling, the on-demand polling starts the polling of the interface state only when the interface enters a jitter waiting state, and terminates the polling when the interface exits the jitter waiting state.
The embodiment of the invention also provides a device for realizing the anti-shaking of the optical fiber channel, which comprises:
the monitoring unit is used for monitoring the state of the target interface;
a jitter waiting unit, configured to enter an interface jitter waiting state when the current state of the target interface is a DOWN state and an UP interrupt signal is received;
the polling unit is used for polling the state of the target interface at regular time in the interface jitter waiting state;
and the UP entering unit is used for controlling the target interface to enter the UP state when the interface states of continuous and multiple polling are all the UP states.
The embodiment of the invention also provides an optical fiber path anti-jitter implementation device, which comprises a memory and a processor, wherein a computer program is stored in the memory, and the computer program can be executed by the processor so as to implement the optical fiber path anti-jitter implementation method.
The embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, where the computer program can be executed by a processor of a device where the computer-readable storage medium is located, so as to implement the above method for implementing anti-jitter of an optical fiber channel.
In summary, the embodiment of the present invention introduces the interface jitter waiting status, and performs the timed polling on the status of the target interface in the interface jitter waiting status, so as long as the predetermined adjustment is satisfied, it is determined that the interface enters the UP state. Because the UP/DOWN interruption of the interface is shielded in the interface jitter waiting state, and only the UP/DOWN interruption times of the interface is recorded, when the actual interface jitter occurs, the problem that the service of the equipment is unavailable due to frequent reporting of the UP/DOWN interruption of the interface can be avoided, the stability of the equipment can be effectively improved, and the network oscillation can be reduced.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The invention is described in further detail below with reference to the following detailed description and accompanying drawings:
referring to fig. 1, a first embodiment of the present invention provides a method for implementing anti-jitter of an optical fiber channel, which is implemented by an apparatus for implementing anti-jitter of an optical fiber channel (hereinafter referred to as an implementation apparatus), and in particular, is implemented by one or more processors in the implementation apparatus to at least implement the following steps:
s101, monitoring the state of a target interface.
In this embodiment, the interface in an optical communication system has two states, i.e., a DOWN state (off state) and an UP state (on state). The UP state indicates that the interface is in an on state and can normally realize data transceiving, and the DOWN state indicates that the interface is in an off state and cannot normally realize data transceiving.
S102, when the current state of the target interface is a DOWN state and an UP interrupt signal is received, the interface enters into a jitter waiting state.
S103, in the interface jitter waiting state, carrying out timing polling on the state of the target interface.
And S104, when the interface states of continuous multiple polling are all UP states, controlling the target interface to enter the UP state.
In this embodiment, the implementation device implements management of the state of the target interface by constructing an interface jitter state machine. The interface jitter state machine comprises three states of an interface DOWN state, an interface jitter waiting state and an interface UP state, and can receive 2 input events, namely a DOWN interrupt signal and an UP interrupt signal. The working principle of the interface jitter state machine is shown in fig. 2:
entering an interface jitter waiting state after judging that the target interface is in a DOWN state and receiving an UP interrupt signal; after entering into the jitter waiting state, the UP/DOWN interrupt of the interface is shielded, the interface state is received and the interface state is polled at regular time, and the interface states which are only polled continuously for many times are all the UP states, so that the UP state of the interface can be entered. When the interface is in a jitter waiting state, the UP/DOWN interruption of the target interface is shielded, the interruption information is not reported, and the UP/DOWN interruption times of the interface are recorded only by a UP/DOWN interruption counter.
In this embodiment, the number of polling times may be set according to actual needs, for example, the number may be set to 3,4,5, and the present invention is not particularly limited. In order to facilitate the understanding of the present invention, the application of the present invention will be described below by taking three times as an example.
Specifically, the interface jitter waiting state includes three sub-states, namely a jitter waiting initial state, a first UP state, and a second UP state, and as shown in fig. 3, the states are switched as follows:
when the target interface is in a DOWN state and receives an UP interrupt signal, entering a jitter waiting initial state;
in the initial state of jitter waiting, when the state of the polling target interface is the UP state and the UP/DOWN interrupt counter is not changed, the first UP state is entered.
In the first UP state, when the state of the target interface is polled to be the DOWN state or the state of the target interface is the UP state and the UP/DOWN interrupt counter is changed, returning to the jitter waiting initial state; when the state of the target interface is in an UP state and the UP/DOWN interrupt counter is not changed, the state is in an UP state for the second time.
In the second UP state, when the state of the target interface is polled to be the DOWN state or the state of the target interface is the UP state and the UP/DOWN interrupt counter is changed, returning to the jitter waiting initial state; and when the state of the target interface is in an UP state and the UP/DOWN interrupt counter is not changed in the polling process, controlling the target interface to enter the UP state.
It should be noted that, in the above scheme, after reading the UP/DOWN interrupt counter of the interface once, the counter needs to be cleared, for example, the counter may be set to a read clear mode to implement the function.
It should be noted that, in the above solution, the polling mechanism of the interface status may have two implementation solutions — continuously traverse polling and start polling as needed. The continuous traversal polling is the traversal of starting the interface state after the system is started, acquiring the interface state and the UP/DOWN interrupt counter at regular time, forming the interface state input and announcing the interface state input to the interface jitter state machine. Continuous traversal is simple to implement, but relatively costly in terms of system resources. The polling is started as required, the interface enters a jitter waiting initial state and then starts the interface state round sequence, and the interface jitter state is stopped when the interface exits.
It should be noted that, considering the reliability of the actual network device, the DOWN interrupt needs to be immediately responded, and a corresponding protection mechanism is triggered. After the UP interrupt, after waiting for the state machine confirmation through the interface jitter, it can be confirmed that the interface is UP indeed. The period of interface state polling may be set to 1s by default, that is, within 3s after receiving the UP interrupt of the interface, the interface state is continuously maintained in the UP state, and there is no change of the UP/DOWN interrupt, it may be considered that the interface is formally UP, and the interface may be used to carry actual traffic. Of course, it is understood that the polling period can be set according to actual needs, and the invention is not limited in particular.
In summary, the embodiment of the present invention introduces the interface jitter waiting status, and performs the timed polling on the status of the target interface in the interface jitter waiting status, so as long as the predetermined adjustment is satisfied, it is determined that the interface enters the UP state. Because the UP/DOWN interruption of the interface is shielded in the interface jitter waiting state, and only the UP/DOWN interruption times of the interface is recorded, when the actual interface jitter occurs, the problem that the service of the equipment is unavailable due to frequent reporting of the UP/DOWN interruption of the interface can be avoided, the stability of the equipment can be effectively improved, and the network oscillation can be reduced.
Referring to fig. 4, a second embodiment of the present invention further provides an anti-jitter implementation apparatus for an optical fiber path, which includes:
a monitoring unit 210, configured to monitor a state of a target interface;
a jitter waiting unit 220, configured to enter an interface jitter waiting state when the current state of the target interface is a DOWN state and an UP interrupt signal is received;
a polling unit 230, configured to perform timing polling on the status of the target interface in the interface jitter waiting status;
the UP entering unit 240 is configured to control the target interface to enter an UP state when the interface states of consecutive multiple polls are all UP states.
The third embodiment of the present invention further provides an optical fiber channel anti-jitter implementation apparatus, which includes a memory and a processor, where the memory stores a computer program, and the computer program can be executed by the processor to implement the optical fiber channel anti-jitter implementation method as described above.
The fourth embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, where the computer program can be executed by a processor of a device where the computer-readable storage medium is located, so as to implement the method for implementing anti-jitter of an optical fiber path as described above.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part thereof which substantially contributes to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.