CN107707468B - Link state maintenance method and device - Google Patents

Link state maintenance method and device Download PDF

Info

Publication number
CN107707468B
CN107707468B CN201710852858.4A CN201710852858A CN107707468B CN 107707468 B CN107707468 B CN 107707468B CN 201710852858 A CN201710852858 A CN 201710852858A CN 107707468 B CN107707468 B CN 107707468B
Authority
CN
China
Prior art keywords
port
optical
mode
photoelectric composite
link state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710852858.4A
Other languages
Chinese (zh)
Other versions
CN107707468A (en
Inventor
张建国
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou H3C Technologies Co Ltd filed Critical Hangzhou H3C Technologies Co Ltd
Priority to CN201710852858.4A priority Critical patent/CN107707468B/en
Publication of CN107707468A publication Critical patent/CN107707468A/en
Application granted granted Critical
Publication of CN107707468B publication Critical patent/CN107707468B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/28Routing or path finding of packets in data switching networks using route fault recovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L25/00Baseband systems
    • H04L25/02Details ; arrangements for supplying electrical power along data transmission lines
    • H04L25/0264Arrangements for coupling to transmission lines
    • H04L25/0272Arrangements for coupling to multiple lines, e.g. for differential transmission
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/22Alternate routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/70Routing based on monitoring results

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Power Engineering (AREA)
  • Optical Communication System (AREA)

Abstract

The application relates to the technical field of computer communication, in particular to a link state maintenance method and device, which are used for automatically switching the working modes of combo ports and are more convenient to maintain communication links. The link state maintenance method comprises the following steps: detecting whether an optical port of the photoelectric composite port receives an optical signal or not according to a preset time interval; if the optical port is detected to receive an optical signal, acquiring a current corresponding link state of the photoelectric composite port; and when the current corresponding link state of the photoelectric composite port is disconnected, switching the working mode of the photoelectric composite port.

Description

Link state maintenance method and device
Technical Field
The present application relates to the field of computer communications technologies, and in particular, to a link state maintenance method and apparatus.
Background
An optical-electrical composite port (combo) is a communication port for being installed on electronic devices such as computers, switches, routers, etc., and generally consists of a pair of an optical port and an electrical port that share the same forwarding port. The combo port has two modes of operation: an optical port mode and an electrical port mode; when the optical port mode is set, the optical port is used for data communication; when the mobile terminal is in the electric port mode, the electric port is used for communication; and the combo port can only be in one of the optical port mode and the electrical port mode at the same time.
When the combo port is used, a user is required to manually set a specific working mode of the combo port, namely, the user manually inputs a configuration instruction to the equipment; the device is internally provided with a driver corresponding to the combo port, and the driver configures the working mode of the combo port according to the configuration instruction input by the user, so that the combo port can work in one working mode.
However, since the mode of manually inputting the configuration command is adopted in the method for setting the combo port working mode, once the working mode of the combo port needs to be changed, namely the communication link of the device needs to be changed, a manual method is also needed, and the communication link of the device is very inconvenient to maintain.
Disclosure of Invention
The embodiment of the application provides a link state maintenance method and device, which can automatically switch the working mode of a combo port according to the actual situation, and the communication link maintenance is more convenient.
In a first aspect, a method for maintaining a link state is provided, including:
detecting whether an optical port of the photoelectric composite port receives an optical signal or not according to a preset time interval;
if the optical port is detected to receive an optical signal, acquiring a current corresponding link state of the photoelectric composite port;
and when the current corresponding link state of the photoelectric composite port is in a disconnection state, switching the working mode of the photoelectric composite port.
In a second aspect, a link state maintenance device is provided, which includes:
the detection module is used for detecting whether the optical port of the photoelectric composite port receives an optical signal or not according to a preset time interval;
a link state obtaining module, configured to obtain a current corresponding link state of the optical-electrical composite port when detecting that the optical port receives an optical signal;
the first switching module is used for switching the working mode of the photoelectric composite port when the current corresponding link state of the photoelectric composite port is a disconnection state.
In a third aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when being executed by a processor, performs the steps of the method according to the first aspect.
In the method and the device for maintaining the link state provided in the embodiment of the present application, whether an optical port in the optical electrical composite port receives an optical signal is detected according to a preset time interval, and if it is detected that the optical port receives the optical signal and the current link state corresponding to the optical electrical composite port is detected to be disconnected, the working mode of the optical electrical composite port is automatically switched, that is, the switching is performed between the optical port mode and the electrical port mode. In the process, whether the photoelectric composite port is switched or not is judged according to whether the optical port receives an optical signal or not and the link state of the port currently used by the photoelectric composite port, once the link state is disconnected, the working mode of the photoelectric composite port is switched, and the other port is tried to be used for communication, so that the automatic maintenance of the communication link is realized. Moreover, due to the fact that manual port switching operation on the equipment is not needed, the equipment can be specifically installed according to actual needs, and the problem that inconvenience is caused due to manual port setting on the equipment in the later period is not needed to be considered. On the other hand, in the application, since whether the optical signal is received or not is detected at preset time intervals, the problem of the equipment communication link can be timely found, and the hysteresis of manual operation is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required in the description of the embodiments of the present application or the prior art will be briefly introduced below. It should be apparent that the drawings in the following description are only some of the embodiments described in the present application, and that other drawings may be derived from those drawings by those skilled in the art.
Fig. 1 is a schematic diagram of a device hardware architecture of a combo port according to an embodiment of the present application;
fig. 2 is a flowchart of a link state maintenance method according to an embodiment of the present application;
fig. 3 is a flowchart of a link state maintenance method according to another embodiment of the present application;
fig. 4 is a flowchart of a link state maintenance method according to another embodiment of the present application;
fig. 5 is a schematic diagram illustrating an input of a link state maintenance task in a link state maintenance method according to an embodiment of the present application;
fig. 6 is a flowchart of a specific example of a link state maintenance method according to an embodiment of the present application;
fig. 7 is a flowchart of another specific example of a link state maintenance method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a link state maintenance apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a link state maintenance device according to another embodiment of the present application.
Detailed Description
Referring to fig. 1, an embodiment of the present application provides a device hardware architecture of a combo port. The electrical port and the optical port are connected to a same Physical Layer (PHY) chip and connected to a same Media Access Control (MAC) chip, and the electrical port is connected to the PHY chip through a converter (transducer). Of the combo ports, only one of the electrical port and the optical port can be in use at the same time. In order to maintain the communication link state, when the combo port changes from a connected (link up) state to a disconnected (link down) state, another port needs to be enabled for communication when the other port can be used.
When the link state is maintained, whether the optical port of the photoelectric composite port receives an optical signal is detected once at preset time intervals, and if the optical port receives the optical signal, the link state corresponding to the photoelectric composite port at present is obtained; and switching the working mode of the photoelectric composite port once the current corresponding link state of the photoelectric composite port is disconnected. Therefore, when the link state of the photoelectric composite port is a connection state, the working mode of the photoelectric composite port cannot be switched no matter the current link adopts the optical port or the electric port; once the current link has a problem, the working mode of the photoelectric composite port is switched, and the smoothness of the link is automatically maintained, so that the problem that the working mode of the combo port needs to be manually changed in the prior art, and the communication link is inconvenient to maintain can be solved.
The link state maintenance according to the present application refers to a link maintenance process after receiving an optical signal, and if no optical signal is received, it means that it is not necessary to switch from the electrical port mode to the optical port mode. Because the optical signal detection is easy to realize and simple and convenient to implement, unnecessary mode switching is avoided by judging whether the optical signal is received in advance, equipment resources can be saved, and the link maintenance efficiency is improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
The combo port related to the application has two working modes: an optical port mode of operation and an electrical port mode of operation. In the optical port working mode, the device uses the optical port to communicate; in the electrical port mode of operation, the device communicates using the electrical port.
When the device communicates by using the combo port, the optical port and the electric port are not always connected with corresponding optical fibers or cables; when the optical port is not connected with the optical fiber and the electric port is not connected with the cable, the combo port is in a linkdown state, and if the optical port is inserted into the optical fiber firstly and can communicate, the combo port communicates by using the optical port; the combo port communicates using the electrical port if the electrical port is plugged into the cable first and communication is enabled. If the combo port communicates using either of the optical port and the electrical port, it will not be used even if the other port is able to communicate. When the optical port and the electric port can normally communicate, once the combo port changes the state from the link up state to the link down state due to line disconnection and the like, the combo port is switched to the other port for communication. When the equipment is powered on, if the optical port and the electric port can normally communicate, the combo port preferentially uses the optical port to communicate.
In the embodiment of the present application, as shown in fig. 2, a flowchart of a link state maintenance method provided in an embodiment of the present application is provided, and in the embodiment of the present application, a main body responsible for executing the method may be a device that installs a combo port and communicates with the outside through the combo port. The method comprises the following steps:
s201: and detecting whether the optical port of the photoelectric composite port receives the optical signal or not according to a preset time interval.
In a specific implementation, the optical port generally uses a Small Form Pluggable (SFP) optical module and an optical fiber for communication. The optical module is used for realizing conversion between optical signals and electric signals and conforms to a common Multi-Source Agreement (MSA). After the optical port is inserted into the optical module, the equipment can set the speed and the duplex of the optical port according to MSA protocol information; and after the optical fiber is accessed to the optical port, the optical port performs negotiation communication with the opposite-end optical port through the optical fiber based on the set speed and duplex, and if the negotiation is passed, the optical port links up. In this process, to enable the optical port to link up, it is necessary that the optical port is inserted into the optical module and an optical signal is received at the optical port.
Specifically, when optical port communication is performed, two General Purpose Input/Output (GPIO) are generally used, that is, GPIO _ PIN _ SFPX _ MD and GPIO _ PIN _ SFPX _ LOS. The GPIO _ PIN _ SFPX _ MD is an in-place GPIO of the optical module and is used for identifying whether the optical module is inserted into the optical port or not; GPIO _ PIN _ SFPX _ LOS is an optical signal GPIO used to identify whether an optical signal is received by an optical port. By reading GPIO _ PIN _ SFPX _ MD and GPIO _ PIN _ SFPX _ LOS, it can be specifically known whether the optical port receives the optical signal, as specifically shown in fig. 5.
S202: and if the optical port is detected to receive the optical signal, acquiring the current corresponding link state of the photoelectric composite port.
In a specific implementation, when the current corresponding link state of the combo port is connected, the working mode of the current combo port is not switched, and only when the current corresponding link state is disconnected, the working mode of the combo port is switched from the current state to another working mode. Therefore, the link state currently corresponding to the combo port is to be acquired, and whether the link state currently corresponding to the optical combo port is connected or not is checked.
Specifically, when a combo port communicates using an optical port and an electrical port, a parameter for identifying whether the link state of the port is normal can be obtained from the specific port: PortLinkStatus. The PortLinkStatus is transmitted to the MAC chip; by reading the PortLinkStatus parameter in the MCA chip, the current corresponding link state of the combo port can be obtained. When PortLinkStatus is linkup, the current corresponding link state of the combo port is a connection state; and when the PortLinkStatus is linkDown, the current corresponding link state of the combo port is in a disconnection state.
The device can read the PortLinkStatus parameter of the combo port, and judge the current corresponding link state of the combo port according to the specific content of the PortLinkStatus, as shown in fig. 5.
S203: and when the current corresponding link state of the photoelectric composite port is disconnected, switching the working mode of the photoelectric composite port.
In a specific implementation, if the current link state corresponding to the combo port is disconnected, there may be the following two cases:
i: the current working mode of the port is an electric port mode, but the link of the electric port has problems. Since it has been detected that the optical port receives the optical signal, the optical fiber is connected to the default optical port, and therefore, the operation mode of the combo port is switched from the electrical port mode to the optical port mode, and communication using the optical port is attempted.
II: the working mode of the current port is an optical port mode, but the link of the optical port has problems. At this time, even if it is detected that the optical port receives the optical signal, whether the communication link of the optical port is capable of performing normal communication depends not only on whether the optical fiber is inserted into the optical port, but also on other factors (which are described above and are not described here again), so that the operation mode of the combo port is switched from the optical port mode to the electrical port mode, and communication using the electrical port is attempted.
In the link state maintenance method provided in the embodiment of the present application, whether an optical port in the optical electrical composite port receives an optical signal is detected according to a preset time interval, and if it is detected that the optical port receives the optical signal and it is detected that a link state currently corresponding to the optical electrical composite port is disconnected, a working mode of the optical electrical composite port is automatically switched, that is, switching is performed between an optical port mode and an electrical port mode. In the process, whether the photoelectric composite port is switched or not is judged according to whether the optical port receives an optical signal or not and the link state of the port currently used by the photoelectric composite port, once the link state is disconnected, the working mode of the photoelectric composite port is switched, and the other port is tried to be used for communication, so that the automatic maintenance of the communication link is realized. Moreover, due to the fact that manual port switching operation on the equipment is not needed, the equipment can be specifically installed according to actual needs, and the problem that inconvenience is caused due to manual port setting on the equipment in the later period is not needed to be considered. On the other hand, in the application, since whether the optical signal is received or not is detected at preset time intervals, the problem of the equipment communication link can be timely found, and the hysteresis of manual operation is avoided.
It should be noted that, in the link state maintenance method provided in this embodiment of the application, if the optical port can receive the optical signal all the time and the link state corresponding to the optical-electrical composite port is disconnected all the time, the working mode of the optical-electrical composite port is continuously switched between the optical port mode and the electrical port mode until the link state of the optical-electrical composite port in a certain working mode is connected.
In order to avoid that the system resources are always occupied due to the above possible situations, in the link state maintenance method provided in the embodiment of the present application, a counter may be set, where the counter is configured to count the number of times of switching the working mode of the optical electrical composite port, and the count of the counter is incremented by 1 every time the working mode of the optical electrical composite port is switched; once the link state linkup of the photoelectric composite port is detected, resetting the counter to zero; after the counter counts to the preset times, no matter which working mode the photoelectric composite port is in at the moment, the working mode of the photoelectric composite port can be temporarily stopped to be switched, the current working mode is kept, and the link state maintenance method provided by the application is restarted until the preset time.
Referring to fig. 3, in the link state maintenance method provided in the embodiment of the present application, on the basis of the above embodiment, the method further includes:
s301: and if the optical port is detected not to receive the optical signal, acquiring the current working mode of the photoelectric composite port.
S302: and if the obtained working mode of the photoelectric composite port is an optical port mode, switching the working mode of the photoelectric composite port into an electric port mode.
S303: and if the obtained working mode of the photoelectric composite port is an electric port mode, keeping the current working mode of the photoelectric composite port.
In a specific implementation, when it is detected that the optical port does not receive the optical signal, it is considered that the optical fiber on the optical port is unplugged, or the optical module is not plugged into the optical port all the time. Therefore, if the working mode of the current optical-electrical composite port is the optical port mode, since the optical port cannot communicate any more, the working mode of the optical-electrical composite port is switched to the electrical port mode, and an attempt is made to establish a communication link in the electrical port mode. If the current working mode of the optical-electrical composite port is the electrical port mode, and the optical port is not inserted with the optical fiber, even if the working mode of the optical-electrical composite port is switched to the optical port mode, the optical port cannot be used for communication, so that in order to avoid resource waste, the optical-electrical composite port is kept in the current working mode, namely, the electrical port mode.
The embodiment of the present application further provides another link state maintenance method, and on the basis of the several embodiments, after obtaining the current corresponding link state of the optical electrical composite port, the method further includes:
and when the current corresponding link state of the photoelectric composite port is a connection state, maintaining the current working mode of the photoelectric composite port.
In a specific implementation, because at the same time, the optical-electrical composite port can only be in one working mode, and in this working mode, only the corresponding port can be used for communication, when the current corresponding link state of the optical-electrical composite port is a connection state, there may be two cases:
i: the photoelectric composite port is in an optical port mode, and the photoelectric composite port communicates by using an optical link corresponding to the optical port; II: the electro-optical-electro-composite port is in an electrical port mode, and the electro-optical-electro-composite port communicates using an electrical link corresponding to the electrical port. At this time, whether the optical port receives the optical signal or not, the optical-electrical composite port maintains the current working mode until the corresponding link state of the optical-electrical composite port in the current working mode is disconnected and the optical port is detected to receive the optical signal, so that the working mode of the optical-electrical composite port is switched.
In addition, in order to ensure that the optical port is preferentially used for communication when both the optical port and the electrical port can communicate, when the device is powered on and started, the working mode of the optical-electrical composite port is set to be the optical port mode.
In this mode, the optoelectrical composite port will first attempt to communicate using the optical port; if the opto-electronic composite port fails to link up in the optical port mode, the opto-electronic composite port is switched from the optical port mode to the electrical port mode.
Referring to fig. 4, in order to ensure that the device can quickly establish a communication link when being powered on, after the working mode of the optical electrical composite port is set to the optical port mode, before detecting whether the optical port of the optical electrical composite port receives an optical signal according to a preset time interval, the method further includes:
s401: and acquiring the link state of the photoelectric composite port in the optical port mode.
S402: and if the link state of the photoelectric composite port in the optical port mode is a disconnection state, switching the working mode of the photoelectric composite port into an electric port mode.
In specific implementation, when the device is powered on and started, after the working mode of the optical-electrical composite port is set to the optical port mode, the link state of the optical-electrical composite port in the optical port mode is obtained. If the link state of the photoelectric composite port is in a disconnection state, the working mode of the photoelectric composite port is switched to an electric port mode instead of passively waiting for a preset time interval, so that the starting speed of the photoelectric composite port is increased when the device is powered on and started.
It should be noted that the preset time interval is greater than the time of the corresponding port linking up after the photoelectric composite port is set to the operating mode.
Referring to fig. 6, an embodiment of the present application further provides a specific example of a link state maintenance method, including:
s601: when the equipment is powered on and started, the working mode of the combo port is initialized and set to be the optical port mode.
The following link maintenance steps are executed at preset time intervals:
s602: detecting whether the optical port receives an optical signal, if not, skipping to S603; if so, then jump to S606.
S603: detecting whether the working mode of the combo port is an optical port mode, and if so, jumping to S604; if not, then jump to S605.
S604: the operation mode of the combo port is switched to the electrical port mode, and the process jumps to S605.
S605: and ending the current link maintenance task.
S606: judging whether the current corresponding link state of the combo port is disconnected; if not, jumping to S607; if not, then jump to S608.
S607: the current operation mode is maintained and the process jumps to S605.
S608: detecting whether the working mode of the combo port is an electric port mode or not; if yes, jumping to S609; if not, then jump to S610.
S609: the operation mode of the combo port is switched to the optical port mode, and the process skips S605.
S610: the operation mode of the combo port is switched to the electrical port mode, and the process jumps to S605.
For a specific implementation method and implementation procedure of this example, reference may be made to the description of the foregoing embodiments, which are not described herein again.
Referring to fig. 7, an embodiment of the present application further provides another specific example of a link state maintenance method, where the specific example includes:
s601: when the device is powered on and started, the working mode of the combo port is initialized to be the optical port mode, and the operation jumps to the step S611.
S611: and acquiring a link state of the photoelectric composite port in the optical port mode, and jumping to S612.
S612: and when the link state of the photoelectric composite port is in a disconnection state, switching the working mode of the photoelectric composite port into an electric port mode.
The following link maintenance steps are executed at preset time intervals:
s604: detecting whether the optical port receives an optical signal, if not, skipping to S604; if so, it jumps to S605.
S603: detecting whether the working mode of the combo port is an optical port mode, and if so, jumping to S604; if not, then jump to S605.
S604: the operation mode of the combo port is switched to the electrical port mode, and the process jumps to S605.
S605: and ending the current link maintenance task.
S606: judging whether the current corresponding link state of the combo port is disconnected; if not, jumping to S607; if not, then jump to S608.
S607: the current operation mode is maintained and the process jumps to S605.
S608: detecting whether the working mode of the combo port is an electric port mode or not; if yes, jumping to S609; if not, then jump to S610.
S609: the operation mode of the combo port is switched to the optical port mode, and the process skips S605.
S610: the operation mode of the combo port is switched to the electrical port mode, and the process jumps to S605.
For a specific implementation method and implementation procedure of this example, reference may be made to the description of the foregoing embodiments, which are not described herein again.
Based on the same inventive concept, the embodiment of the present invention further provides a link state maintenance device corresponding to the link state maintenance method, and as the principle of solving the problem of the device in the embodiment of the present invention is similar to the link state maintenance method in the embodiment of the present invention, the implementation of the device may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 8, a link state maintenance device provided in the embodiment of the present application specifically includes:
the detection module is used for detecting whether the optical port of the photoelectric composite port receives an optical signal or not according to a preset time interval;
the first link state acquisition module is used for acquiring the current corresponding link state of the photoelectric composite port when detecting that the optical port receives an optical signal;
and the first switching module is used for switching the working mode of the photoelectric composite port when the current corresponding link state of the photoelectric composite port is disconnected.
Further, referring to fig. 9, the link maintenance apparatus provided in the embodiment of the present application further includes:
a working mode obtaining module, configured to obtain a current working mode of the optical-electrical composite port when it is detected that the optical port does not receive the optical signal;
the second switching module is used for switching the working mode of the photoelectric composite port into an electric port mode when the obtained working mode of the photoelectric composite port is the optical port mode; and when the obtained working mode of the photoelectric composite port is an electric port mode, keeping the current working mode of the photoelectric composite port.
As shown in fig. 9, further, the method further includes: and the third switching module is used for keeping the current working mode of the photoelectric composite port when the current corresponding link state of the photoelectric composite port is a connection state.
As shown in fig. 9, further, the method further includes:
the initialization module is used for setting the working mode of the photoelectric composite port to be an optical port mode when the equipment is powered on and started before detecting whether the optical port of the photoelectric composite port receives an optical signal according to a preset time interval.
As shown in fig. 9, further, the method further includes:
a second link state obtaining module, configured to, after setting a working mode of the optical-electrical composite port to an optical port mode, obtain a link state of the optical-electrical composite port in the optical port mode before detecting whether an optical signal is received by an optical port of the optical-electrical composite port according to a preset time interval;
and the fourth switching module is used for switching the working mode of the photoelectric composite port into the electric port mode when the link state of the photoelectric composite port in the optical port mode is the disconnection state.
In the link state maintenance device provided in the embodiment of the present application, whether an optical port in the optical electrical composite port receives an optical signal is detected according to a preset time interval, and if it is detected that the optical port receives the optical signal, and it is detected that a link state currently corresponding to the optical electrical composite port is disconnected, a working mode of the optical electrical composite port is automatically switched, that is, switching is performed between an optical port mode and an electrical port mode. In the process, whether the photoelectric composite port is switched or not is judged according to whether the optical port receives an optical signal or not and the link state of the port currently used by the photoelectric composite port, once the link state is disconnected, the working mode of the photoelectric composite port is switched, and the other port is tried to be used for communication, so that the automatic maintenance of the communication link is realized. Moreover, due to the fact that manual port switching operation on the equipment is not needed, the equipment can be specifically installed according to actual needs, and the problem that inconvenience is caused due to manual port setting on the equipment in the later period is not needed to be considered. On the other hand, in the application, since whether the optical signal is received or not is detected at preset time intervals, the problem of the equipment communication link can be timely found, and the hysteresis of manual operation is avoided.
Corresponding to the link state maintenance method in fig. 2, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program performs the steps of the link state maintenance method.
Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and the like, and when a computer program on the storage medium is run, the link state maintenance method can be executed, so that the problem that in the prior art, the working mode of a combo port needs to be manually changed, and the communication link is inconvenient to maintain can be solved, and further, the automatic maintenance of the communication link can be achieved, so that the equipment can be specifically installed according to actual needs, the problem that inconvenience is caused by manual port setting of the equipment in the later period is not considered, and the detection of whether an optical signal is received or not can be performed at preset time intervals, so that the problem that the communication link of the equipment appears can be timely found, and the hysteresis of manual operation is avoided.
The link state maintenance method and the computer program product of the apparatus provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The functions, if implemented in the form of software functional units 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 may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, 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 U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (6)

1. A method for link state maintenance, the method comprising:
detecting whether an optical port of the photoelectric composite port receives an optical signal or not according to a preset time interval;
if the optical port is detected to receive an optical signal, acquiring a current corresponding link state of the photoelectric composite port;
when the current corresponding link state of the photoelectric composite port is a disconnection state, switching the working mode of the photoelectric composite port;
before detecting whether the optical port of the photoelectric composite port receives the optical signal according to the preset time interval, the method further comprises the following steps:
when the equipment is powered on and started, setting the working mode of the photoelectric composite port to be an optical port mode;
after the working mode of the photoelectric composite port is set to the optical port mode, before whether the optical port of the photoelectric composite port receives the optical signal is detected according to a preset time interval, the method further comprises the following steps:
acquiring a link state of the photoelectric composite port in the optical port mode;
and if the link state of the photoelectric composite port in the optical port mode is a disconnection state, switching the working mode of the photoelectric composite port into an electric port mode.
2. The method of claim 1, further comprising:
if the optical port is detected not to receive the optical signal, acquiring the current working mode of the photoelectric composite port;
if the obtained working mode of the photoelectric composite port is an optical port mode, switching the working mode of the photoelectric composite port into an electric port mode;
and if the obtained working mode of the photoelectric composite port is an electric port mode, keeping the current working mode of the photoelectric composite port.
3. The method according to claim 1 or 2, wherein after acquiring the current corresponding link state of the optical electrical composite port, the method further comprises:
and when the current corresponding link state of the photoelectric composite port is a connection state, maintaining the current working mode of the photoelectric composite port.
4. A link state maintenance apparatus, comprising:
the detection module is used for detecting whether the optical port of the photoelectric composite port receives an optical signal or not according to a preset time interval;
the first link state acquisition module is used for acquiring the current corresponding link state of the photoelectric composite port when detecting that the optical port receives an optical signal;
the first switching module is used for switching the working mode of the photoelectric composite port when the current corresponding link state of the photoelectric composite port is a disconnected state;
the device comprises an initialization module, a detection module and a control module, wherein the initialization module is used for setting the working mode of an optical-electrical composite port to an optical port mode when the device is powered on and started before detecting whether the optical port of the optical-electrical composite port receives an optical signal according to a preset time interval;
further comprising:
the second link state acquisition module is further configured to, after the working mode of the optical-electrical composite port is set to the optical port mode, acquire a link state of the optical-electrical composite port in the optical port mode before detecting whether the optical port of the optical-electrical composite port receives an optical signal according to a preset time interval;
and the third switching module is used for switching the working mode of the photoelectric composite port into an electric port mode when the link state of the photoelectric composite port in the optical port mode is a disconnection state.
5. The apparatus of claim 4, further comprising:
a working mode obtaining module, configured to obtain a current working mode of the optical-electrical composite port when it is detected that the optical port does not receive the optical signal;
the second switching module is used for switching the working mode of the photoelectric composite port into an electric port mode when the obtained working mode of the photoelectric composite port is the optical port mode; and when the obtained working mode of the photoelectric composite port is an electric port mode, keeping the current working mode of the photoelectric composite port.
6. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of the preceding claims 1 to 3.
CN201710852858.4A 2017-09-19 2017-09-19 Link state maintenance method and device Active CN107707468B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710852858.4A CN107707468B (en) 2017-09-19 2017-09-19 Link state maintenance method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710852858.4A CN107707468B (en) 2017-09-19 2017-09-19 Link state maintenance method and device

Publications (2)

Publication Number Publication Date
CN107707468A CN107707468A (en) 2018-02-16
CN107707468B true CN107707468B (en) 2021-05-07

Family

ID=61173003

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710852858.4A Active CN107707468B (en) 2017-09-19 2017-09-19 Link state maintenance method and device

Country Status (1)

Country Link
CN (1) CN107707468B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1547292A (en) * 2003-12-11 2004-11-17 中国科学院物理研究所 Ultrashort pulse laser time self-adapting synchronization method and apparatus therefor
CN101610116A (en) * 2009-07-17 2009-12-23 深圳市巨联光电技术有限公司 Optical port self-adaptive ethernet optical fiber transceiver and adaptive approach thereof
CN202094921U (en) * 2011-03-29 2011-12-28 中航光电科技股份有限公司 Double-path automatic full-redundant transparent optical transmission system
CN102355401A (en) * 2011-07-29 2012-02-15 华为技术有限公司 Method and device for sending message, method and device for detecting outage and optical module
CN103138834A (en) * 2011-11-29 2013-06-05 鸿富锦精密工业(深圳)有限公司 Optical fiber transmission system
CN104796306A (en) * 2015-03-26 2015-07-22 杭州华三通信技术有限公司 Port mode negotiation method and device
CN104935382A (en) * 2015-05-29 2015-09-23 中航光电科技股份有限公司 Full-automatic redundant optical transmission system
CN105323008A (en) * 2014-07-04 2016-02-10 中兴通讯股份有限公司 Optical transceiver module and working parameter configuration method and device thereof
CN106483414A (en) * 2016-12-12 2017-03-08 广州市诚臻电子科技有限公司 A kind of CAN signal photoelectric conversion device and CAN signal Phototube Coupling system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10454851B2 (en) * 2015-04-16 2019-10-22 Cisco Technology, Inc. Optimized link failure convergence for resilient ethernet protocol networks
CN106101032B (en) * 2016-08-11 2020-02-04 迈普通信技术股份有限公司 Method and device for COMBO interface self-adaptive Ethernet interface

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1547292A (en) * 2003-12-11 2004-11-17 中国科学院物理研究所 Ultrashort pulse laser time self-adapting synchronization method and apparatus therefor
CN101610116A (en) * 2009-07-17 2009-12-23 深圳市巨联光电技术有限公司 Optical port self-adaptive ethernet optical fiber transceiver and adaptive approach thereof
CN202094921U (en) * 2011-03-29 2011-12-28 中航光电科技股份有限公司 Double-path automatic full-redundant transparent optical transmission system
CN102355401A (en) * 2011-07-29 2012-02-15 华为技术有限公司 Method and device for sending message, method and device for detecting outage and optical module
CN103138834A (en) * 2011-11-29 2013-06-05 鸿富锦精密工业(深圳)有限公司 Optical fiber transmission system
CN105323008A (en) * 2014-07-04 2016-02-10 中兴通讯股份有限公司 Optical transceiver module and working parameter configuration method and device thereof
CN104796306A (en) * 2015-03-26 2015-07-22 杭州华三通信技术有限公司 Port mode negotiation method and device
CN104935382A (en) * 2015-05-29 2015-09-23 中航光电科技股份有限公司 Full-automatic redundant optical transmission system
CN106483414A (en) * 2016-12-12 2017-03-08 广州市诚臻电子科技有限公司 A kind of CAN signal photoelectric conversion device and CAN signal Phototube Coupling system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
智能光通道切换装置在电网继电保护中的应用;向新宇,陈海,王剑,付璇,杨帆,王湛;《浙江电力》;20151031;全文 *

Also Published As

Publication number Publication date
CN107707468A (en) 2018-02-16

Similar Documents

Publication Publication Date Title
CN104639468A (en) Optical port adaptive Ethernet switch and adaptive method thereof
EP2981004A1 (en) Interconnection system and apparatus, and data transmission method
CN103812695A (en) Software debugging method and device for SFP (small form pluggable) ONU (optical network unit)
US11585993B2 (en) Integrated passive optical tap and optical signal termination
US10659297B2 (en) Negotiation mode processing method and intelligent network device
CN110972058B (en) Method and device for determining position of wireless communication device
US20130012184A1 (en) Method, system and device for initializing internet device
CN106445182B (en) Key mouse screen safety switching and isolating method suitable for dual-computer environment
EP2972919B1 (en) Devices and methods for enabling usb communication over extension media
CN103986524A (en) Single-fiber bi-directional optical module, communication device and connection error detection method
CN107707468B (en) Link state maintenance method and device
CN104683130A (en) Method for configuring stacking port and equipment
CN117336639B (en) Signal transmission method and device, storage medium and electronic device
CN111541958A (en) Optical interface rate self-adaption method, equipment, device and readable storage medium
CN103840879A (en) Optical fiber office direction recognition method, device and system
JP5824119B1 (en) Optical line terminator
CN108476245B (en) Method for establishing port connection and port chip
EP3048858A1 (en) Wireless customer premise equipment and accessing method therefor
CN112583479B (en) Communication method, device and medium of optical fiber communication equipment and optical fiber communication equipment
CN103825650A (en) System and method for monitoring optical fibers
CN109698981A (en) Configuration method, equipment and the storage medium of passive optical network
JP5661199B2 (en) Communication failure detection device
JP5906293B2 (en) Optical line terminator
KR20210045200A (en) Computer program for driving DDS data conversion and transmission device
CN116527486B (en) Device independent function self-adaptive management method, device and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant