WO2013159486A1 - Ptp时钟源切换的方法、主从时钟设备及系统 - Google Patents

Ptp时钟源切换的方法、主从时钟设备及系统 Download PDF

Info

Publication number
WO2013159486A1
WO2013159486A1 PCT/CN2012/081891 CN2012081891W WO2013159486A1 WO 2013159486 A1 WO2013159486 A1 WO 2013159486A1 CN 2012081891 W CN2012081891 W CN 2012081891W WO 2013159486 A1 WO2013159486 A1 WO 2013159486A1
Authority
WO
WIPO (PCT)
Prior art keywords
bfd
clock device
packet
time interval
interval parameter
Prior art date
Application number
PCT/CN2012/081891
Other languages
English (en)
French (fr)
Inventor
康达祥
饶飞
徐俊
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2013159486A1 publication Critical patent/WO2013159486A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0641Change of the master or reference, e.g. take-over or failure of the master

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a method for switching a clock source, a master-slave clock device, and a system.
  • Synchronization can be divided into frequency synchronization and time synchronization.
  • Different communication systems have different synchronization requirements: For example, the common synchronous digital hierarchy (SDH, Synchronous Digital Hierarchy) is a frequency synchronization system with different requirements. The frequency between the network elements should be synchronized to ensure the normal transmission of the SDH service.
  • SDH Synchronous Digital Hierarchy
  • TD-SCDMA Time Division-Synchronous Code Division Multiple Access
  • Precision Clock Synchronization Protocol Standard for Network Measurement and Control Systems also known as IEEE1588
  • IEEE1588 protocol has higher clock precision
  • NTP can only provide millisecond precision
  • IEEE1588 can achieve time synchronization with sub-secondary accuracy.
  • the master clock device sends a synchronization packet to the slave clock device at time t1, and carries the tl timestamp in the synchronization message;
  • the clock device receives the synchronization message at time t2, generates a t2 timestamp locally, and extracts a tl timestamp from the synchronization message.
  • the slave device sends a delay request message at time t3, and generates a t3 timestamp locally;
  • T4-t3 Delaysm-Offset Equation 2;
  • Offset [(t2-tl)-(t4-t3)-(Delayms-Delaysm)] / 2 Equation 4;
  • Delayms Delaysm, that is, the transmission link delay between the master clock device and the slave clock device is symmetric
  • Offset [(t2-tl) - (t4-t3) ] / 2... Equation 5;
  • the clock device can calculate the time offset Offset between itself and the main clock device according to the four time stamps tl, t2, t3, t4, and adjust its own time to synchronize with the master clock device time.
  • the slave clock Before the time synchronization is implemented, the slave clock first selects the clock source to establish a master-slave relationship.
  • the clock device first initiates an Announce negotiation to the master clock device by using an Announce-request message, and the master clock device determines whether to give
  • the slave clock device authorizes, if authorized, the master clock device starts to send the Announce message to the slave clock device, and the slave clock device can obtain the Announce message interval and the Announce message authorization period authorized by the master clock device from the Announce-grant message. (Announce Duration Interval ).
  • the slave clock device can determine whether the master clock device exists according to whether it can receive the Announce message. If the Announce message is not received for three consecutive times, the master clock device is considered to be faulty. After the slave clock device finds the best master clock device, The clock device switches the clock source.
  • the master clock device in the prior art only sends the Announce message to the slave clock device according to a preset time interval (such as 1S).
  • the slave clock device only detects the Announce message every 1S.
  • the detection capability of the Announce packets of each slave clock device is different.
  • For the slave clock device with strong detection capability such as The message is detected every 0.1 seconds.
  • the Announce message is detected according to the scheme 1S in the prior art, which reduces the detection sensitivity of the slave clock device. Summary of the invention
  • the embodiment of the invention provides a method for switching a PTP clock source, which can improve the detection sensitivity of the slave clock device.
  • Embodiments of the present invention also provide corresponding master-slave clock devices and systems.
  • a precision clock protocol PTP clock source switching method includes:
  • the first bidirectional forwarding detection BFD negotiation packet is sent to the primary clock device, where the first BFD negotiation packet carries the information that the slave clock device expects the master clock device to send a BFD probe packet. a time interval parameter;
  • the primary clock device And receiving, by the primary clock device, the first BFD negotiation authorization packet, where the first BFD negotiation authorization packet carries the time interval parameter of the primary clock device periodically sending the BFD detection packet, and the first BFD negotiation authorization packet
  • the time interval parameter is greater than or equal to the first time interval parameter
  • the BFD detection packet sent by the master clock device is periodically detected according to the time interval parameter carried in the first BFD negotiation authorization packet
  • a method for switching a PTP clock source includes:
  • the first BFD negotiation packet carries a first time interval parameter that the slave clock device expects the master clock device to send a BFD probe packet;
  • the first time interval parameter carried in the first BFD negotiation packet is used to determine a time interval parameter for the primary clock device to periodically send a BFD detection packet, where the time interval parameter is greater than or equal to the first time interval parameter;
  • the first BFD negotiation authorization message carries a time interval parameter of the BFD detection packet periodically sent by the master clock device, so that the slave clock device can follow the The time interval parameter carried in the first BFD negotiation authorization packet periodically detects the BFD detection packet sent by the master clock device;
  • the BFD detection packet is periodically sent to the slave clock device according to the time interval parameter carried in the first BFD negotiation authorization packet, and the BFD probe packet is stopped when the fault occurs.
  • the slave clock device cannot detect the BFD probe packet, and switches the PTP clock source.
  • a slave clock device including:
  • a first sending unit configured to: when the PTP clock source is selected, send a first bidirectional forwarding detection BFD negotiation packet to the primary clock device, where the first BFD negotiation packet carries the slave clock device expects to be The first time interval parameter of the BFD probe packet sent by the master clock device;
  • a first receiving unit configured to receive a first BFD negotiation authorization message sent by the primary clock device, where the first BFD negotiation authorization message carries a time interval parameter that the primary clock device periodically sends a BFD detection packet, where The time interval parameter carried in the first BFD negotiation authorization packet is greater than or equal to the first time interval parameter;
  • a first detecting unit configured to: after the first receiving unit receives the first BFD negotiation authorization message, periodically send the primary clock device according to the time interval parameter carried in the first BFD negotiation authorization message BFD detection packet;
  • the clock source switching unit is configured to switch the PTP clock source when the first detecting unit fails to detect the BFD detection packet for the first time.
  • a master clock device including:
  • a second receiving unit configured to receive a first BFD negotiation packet sent by the clock device, where the first BFD negotiation packet carries a first time interval parameter that the slave clock device desires to send a BFD probe packet;
  • a negotiating unit configured to determine, according to the first time interval parameter carried in the first BFD negotiation packet, a time interval parameter for the primary clock device to periodically send a BFD detection packet, where the time interval parameter is greater than or Equal to the first time interval parameter;
  • a second sending unit configured to send a first BFD negotiation authorization message to the slave clock device, where the first BFD negotiation authorization message carries a time interval parameter that the primary clock device periodically sends a BFD detection packet, so that The slave clock device periodically detects the BFD probe packet sent by the master clock device according to the time interval parameter carried in the first BFD negotiation authorization packet, and performs the first BFD negotiation authorization report according to the first BFD negotiation packet.
  • the time interval parameter carried in the text periodically sends a BFD detection packet to the slave clock device. When the fault occurs, the BFD detection packet is stopped, so that the slave clock device cannot detect the BFD probe packet. For example, switch the PTP clock source.
  • a time synchronization system including a slave clock device and a master clock device
  • the slave clock device is the slave clock device described in the above technical solution
  • the master clock device is the slave clock device described in the above technical solution.
  • the first bidirectional forwarding is sent to the primary clock device. Detecting a BFD negotiation packet, where the first BFD negotiation packet carries a first time interval parameter that the slave clock device expects the master clock device to send a BFD probe packet; and receives a first BFD negotiation authorization sent by the master clock device.
  • the first BFD negotiation authorization packet carries the time interval parameter of the BFD detection packet periodically sent by the primary clock device, and the time interval parameter carried in the first BFD negotiation authorization packet is greater than or equal to the first
  • the time interval parameter is: periodically detecting the BFD detection packet sent by the primary clock device according to the time interval parameter carried in the first BFD negotiation authorization packet; and detecting the BFD detection packet when the first value is consecutively detected In this case, switch the PTP clock source.
  • the method for switching the PTP clock source provided by the embodiment of the present invention is a method for switching the PTP clock source provided by the embodiment of the present invention, in which the master clock device in the prior art considers the receiving capability of all the slave clock devices to be large.
  • the first time interval parameter of the BFD detection packet to be sent is sent to the master clock device according to the receiving capability of the master clock device, so that the master clock device considers the receiving capability of the slave clock device and the sending capability of the slave clock device to be greater than or equal to the first
  • the time interval parameter sends a BFD probe packet to the slave clock device, which improves the detection sensitivity of the slave clock device.
  • FIG. 1 is a schematic diagram of another embodiment of a method for switching a clock source according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of another embodiment of a method for switching a clock source according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of an embodiment of a slave clock device in an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of another embodiment of a slave clock device according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of another embodiment of a slave clock device in an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of an embodiment of a master clock device in an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of another embodiment of a master clock device in an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of an embodiment of a system according to an embodiment of the present invention.
  • an embodiment of a method for switching a clock source includes:
  • the slave clock device selects the PTP clock source, sends the first bidirectional forwarding to the master clock device.
  • the BFD negotiation packet is detected, and the first BFD negotiation packet carries a first time interval parameter that the slave clock device expects the master clock device to send a BFD probe packet.
  • the process of keeping the master-slave clock device time synchronized is actually, in the network, for the slave clock device, the master clock device is not unique.
  • the slave clock device selects the master clock device with the best clock source according to the best master clock (BMC)
  • the slave clock device sends a BFD negotiation packet to the master clock device.
  • the master clock device determines the slave clock device.
  • the BFD negotiation authorization packet is sent to the slave clock device.
  • the BFD negotiation authorization packet carries the time interval parameter of the BFD detection packet periodically sent by the master clock device.
  • the time interval parameter for the primary clock device to send BFD probe packets periodically is the same as the first time interval parameter.
  • the primary clock device may carry the foregoing in the BFD negotiation authorization packet when the transmission capability of the primary clock device can reach the first time interval parameter of the BFD detection packet that is expected by the clock device.
  • the first time interval parameter is used to satisfy the detection expectation of the slave clock device.
  • a transmission time interval parameter is determined according to the transmission capability of the slave clock device. The determined time interval parameter is carried in the text.
  • the master clock device after transmitting the BFD negotiation authorization message, the master clock device periodically sends BFD detection packets and synchronization messages according to the time interval that all the slave clock devices can receive in the network.
  • the BFD probe packet sent by the clock device confirms that the master clock device has not failed.
  • the slave clock device fails to detect the BFD probe packet for three consecutive times, the master clock device is switched. In order to get an accurate clock.
  • the ability of each slave clock device to receive BFD probe packets is different. If the master clock device considers the receiver capability of all slave clock devices, the interval for sending BFD probe packets is set to be long. 1S, the receiving capacity of the clock device may be 0.1S, so that the slave clock device can only A packet can be detected every IS.
  • the first BFD negotiation packet is sent from the clock device to the master clock device, where the first BFD negotiation packet carries the first time interval in which the slave clock device is expected to send the BFD probe packet.
  • the parameter when the receiving capability of the slave clock device is 0.1S, carries the time interval information of the 0.1S in the first BFD negotiation packet.
  • the S-time interval periodically sends BFD probe packets to the slave clock device.
  • the slave clock device detects the slave device. If the master clock device cannot send BFD probe packets every 0.1 seconds, the BFD session can be sent once every 0.15S. If the packet is detected, the time interval parameter is carried in the BFD negotiation authorization packet, so that the slave device detects the BFD probe packet.
  • the slave device periodically detects the BFD probe packet sent by the master clock device according to the time interval parameter carried in the first BFD negotiation authorization packet.
  • the master clock device After receiving the first BFD negotiation authorization packet sent by the master clock device, the master clock device sends a BFD probe packet to the master clock device to periodically send the BFD probe packet to the time interval parameter carried in the first BFD negotiation authorization packet.
  • the BFD probe packet sent by the master clock device is periodically detected according to the time interval parameter carried in the first BFD negotiation authorization packet to confirm that the master clock device is in a normal working state.
  • the PTP clock source is switched.
  • the slave clock device can consider that the master clock device is faulty. After selecting the clock source, switch the PTP clock source.
  • the switching of the PTP clock source when the BFD detection packet is not detected for the first time includes: when the BFD detection packet is not detected by the first consecutive number of times, according to the optimal source selection rule B', selects the master clock device with the best clock source other than the master clock device to switch, and releases the master clock device resource.
  • the first value is 3.
  • the master clock device with the best clock source is selected according to the BMC algorithm for switching.
  • the BFD detection packet is detected every 1S, and the detection is not performed for 3 consecutive times.
  • the clock device detects the packet every 0.1s, and when the packet is not detected for three consecutive times, the source switching can be performed only by 0.3S, thereby improving the detection sensitivity of the slave clock device. The quality of the clock synchronization is improved.
  • the slave clock device can release the resources of the original master clock device.
  • the PTP clock source is switched, and the method includes: when the BFD detection packet is not detected for the first time, detecting the network traffic; When the network traffic is less than the preset threshold, the second time interval parameter is sent to the primary clock device, and the second time interval parameter is greater than the first The time interval parameter carried in the BFD negotiation authorization packet, so that the master clock device sends the BFD probe packet with the second time interval parameter; if the second BFD negotiation authorization packet sent by the master clock device is received, The BFD detection packet sent by the primary clock device is periodically detected according to the second time interval parameter carried in the second BFD negotiation authorization packet; if the second BFD negotiation authorization packet is not received, the packet is optimal. Selecting a source rule, selecting a master clock device having an optimal clock source other than the master clock device to perform handover, and releasing the master clock device resource.
  • the solution provided by the embodiment of the present invention is not to perform the primary clock device switching immediately when the BFD detection packet is not detected for three consecutive times in the prior art, but to detect the network traffic, which may be caused by network congestion and slow data transmission.
  • the slave clock device sends a second BFD negotiation packet to the master clock device, where the second BFD negotiation packet carries a second time interval parameter, where the second The time interval parameter is greater than the time interval parameter carried in the first BFD negotiation authorization packet, so that the primary clock device sends the BFD detection packet with the second time interval parameter; for example, if the first BFD negotiation authorization report If the time interval parameter is 0.15S, the second time interval parameter can be increased to 0.3S.
  • the master clock device has no obstacles. If the data transmission caused by the congestion is slow, the periodic analysis of the second time interval parameter carried in the second BFD negotiation authorization packet is performed. The BFD detection packet sent by the master clock device. If the master clock device does not receive the authorization notification from the clock device, indicating that the master clock device may be faulty, select the master clock device in addition to the optimal source selection rule. The master clock device of the best clock source switches.
  • the method includes: detecting network traffic when the BFD detection packet is not detected for the first time; and detecting the BFD detection packet when the detected network traffic is greater than or equal to the preset threshold; When the BFD detection packet is not detected by the value, the master clock device having the best clock source except the master clock device is selected to perform the switching according to the optimal source selection rule, and the master clock device resource is released.
  • the second value is greater than the first value.
  • the technical solution provided by the embodiment of the present invention when detecting that the network traffic is normal, indicates that the network is not congested, and the network may be intermittently interrupted, causing the BFD detection packet to be lost.
  • the number of detections may be increased, for example, the original detection is 3 times. If the BFD detection packet is not detected for 6 times, then the master clock device with the best clock source other than the master clock device is selected for switching according to the optimal source selection rule.
  • the solution provided by the embodiment of the present invention can release the resources of the original clock source after the clock source is switched from the clock device.
  • the first bidirectional forwarding detection BFD negotiation packet is sent to the primary clock device, where the first BFD negotiation packet carries the slave clock device and the master clock device is expected to send
  • the first time interval parameter of the BFD detection packet is received by the primary clock device, and the first BFD negotiation authorization packet carries the interval at which the primary clock device periodically sends the BFD detection packet.
  • the parameter, the time interval parameter carried in the first BFD negotiation authorization packet is greater than or equal to the first time interval parameter, and the primary clock device is periodically detected according to the time interval parameter carried in the first BFD negotiation authorization packet.
  • the BFD detection packet is sent. When the BFD detection packet is not detected for the first time, the PTP clock source is switched.
  • the master clock device considers the receiving capability of all the slave clock devices, and sets the time interval for transmitting the BFD probe packets.
  • the method for detecting the packet provided by the embodiment of the present invention can be obtained from the clock device.
  • the first time interval parameter of the BSR detection packet is sent to the master clock device according to the receiving capability of the master clock device, so that the master clock device considers the receiving capability of the slave clock device and the sending capability of the slave clock device to be greater than or equal to the first time.
  • the interval parameter sends a BFD probe packet to the slave clock device. This improves the detection sensitivity of the slave clock device and improves the quality of the clock synchronization.
  • the method further includes: sending a BFD packet to the master clock device, so that the master clock device periodically detects the BFD packet, and the continuous preset number of times cannot be detected.
  • the master clock device is caused to release the slave clock device resource.
  • an embodiment of a method for switching a clock source includes: 201.
  • a master clock device receives a first BFD negotiation packet sent by a clock device, where the first BFD negotiation packet carries a message.
  • the master clock device periodically transmits the BFD detection packet and the synchronization message according to the time interval that all the slave clock devices can receive, and the solution provided by the embodiment of the present invention is
  • the clock device receives the first BFD negotiation packet sent from the clock device, and learns, from the first BFD negotiation packet, that the receiving capability of the slave clock device is a first time interval parameter, such as 0.1S.
  • the master clock device After receiving the first BFD negotiation packet, the master clock device negotiates the time interval parameter for sending the BFD probe packet to the slave device according to the first time interval parameter carried in the first BFD negotiation packet, and the sending capability of the master clock device can be
  • the master clock device meets the expectation of the slave clock device, and the first time interval parameter is carried in the BFD negotiation authorization packet to satisfy the slave clock.
  • the device's detection expects that when the transmission capability of the primary clock device does not meet the expectations of the secondary clock device, the time interval parameter of the BFD detection packet that is greater than the first time interval parameter is determined according to its own transmission capability.
  • the authorized packet carries the determined time interval parameter.
  • the master clock device receives the first BFD negotiation packet sent by the clock device, and the first BFD negotiation packet carries the first time interval parameter that the slave clock device is expected to send the BFD probe packet.
  • the master clock device evaluates its own sending capability, if the receiving capability of the slave device can be reached, the first BFD negotiation authorization packet is sent to the slave clock device, where the first BFD is
  • the time interval parameter for periodically transmitting the BFD probe packet carried in the negotiation authorization packet may be the same as the first time interval parameter.
  • the time interval parameter of the periodic BFD detection packet carried in the first BFD negotiation authorization packet is greater than the first time interval parameter, so that the slave clock device performs the time interval parameter carried in the first BFD negotiation authorization packet. Periodically detects BFD probe packets sent by the master clock device.
  • the BFD detection packet is periodically sent to the slave clock device according to the time interval parameter carried in the first BFD negotiation authorization packet, and the BFD detection packet is stopped when the fault occurs. And causing the slave clock device to detect the BFD probe packet and switch the PTP clock source.
  • the primary clock device establishes a master-slave relationship with the slave clock device.
  • the master clock device sends a BFD probe packet to enable the slave clock device to detect the BFD probe packet.
  • the master clock device works normally. If the device fails, the BFD probe packet cannot be sent. Therefore, if the BFD probe packet is not detected by the clock device, the PTP clock source is switched.
  • the master clock device considers the receiving capability of all the slave clock devices, and sets the time interval for transmitting the BFD probe packets.
  • the method for detecting the packet provided by the embodiment of the present invention may be a slave device.
  • the first time interval parameter of the desired BFD detection packet is sent to the primary clock device according to its own receiving capability.
  • the first time interval parameter is 0.1S
  • the time interval information of the 0.1S is carried in the first BFD negotiation report.
  • the BFD probe packet is periodically sent to the slave clock device at the interval of 0.1S, and the slave clock device is probed once.
  • the capability of the device is not able to send a BFD probe packet every 0.1S.
  • the BFD probe packet can be sent in the BFD negotiation authorization packet. This prevents the primary clock device from transmitting BFD detection packets in a long period of time, and improves the detection sensitivity of the clock device, thereby improving the quality of clock synchronization.
  • the method further includes: receiving a second BFD negotiation packet sent by the slave clock device, where the second BFD negotiation packet carries a second time interval parameter After the second BFD negotiation authorization message is sent to the slave clock device, the BFD detection packet is periodically sent according to the second time interval parameter, so that the slave clock device learns the master The clock device is in normal working condition.
  • the second time interval parameter is sent to the primary clock device, and the second time interval parameter is in the normal working condition.
  • the status of the second time interval parameter is greater than the time interval parameter of the BFD detection packet, so that the time interval parameter of the BFD detection packet is changed to the second time interval parameter, and the time interval parameter is sent to the slave clock device.
  • the second BFD negotiation authorization packet carries the second time interval parameter in the second BFD negotiation authorization message, and then sends the BFD detection message to the slave clock device according to the second time interval parameter, so that the slave clock The device learns that the master clock device is in a normal working state.
  • the method further includes: detecting a BFD packet sent from the clock device; if the number of consecutive presets is not detected, the BFD packet is not detected, and then stopping the The clock device sends the BFD probe packet and releases the slave clock device resource.
  • the master clock device In the prior art, once the master clock device authorizes the slave clock device, it will continuously send BFD probe packets to the slave clock device, and immediately switch the clock source from the clock device, and the master clock device page will continue to transmit. The resource of the master clock device is wasted.
  • the master clock device detects the BFD packet sent by the clock device. If the BFD packet is not detected within the preset time, If the slave clock device has switched the clock source, the BFD probe packet is sent to the slave clock device. Thereby saving resources of the master clock device.
  • another embodiment of a method for switching a clock source includes: 301: A slave device sends a first BFD negotiation packet to a master clock device, where the first BFD negotiation packet carries the device. The first time interval parameter that the slave clock device expects to send a BFD probe packet.
  • the first clock forwarding device sends the first BFD negotiation packet to the master clock device, and the first BFD negotiation packet carries the slave clock device to send the BFD.
  • the first time interval parameter of the probe packet is the first time interval parameter of the probe packet.
  • the master clock device sends a first BFD negotiation authorization packet to the slave clock device.
  • the master clock device sends a clock source to the slave clock device that sends the first BFD negotiation packet, and then sends a first BFD negotiation authorization packet to the slave clock device, where the first BFD negotiation authorization packet carries the master clock device.
  • the time interval parameter of the BFD detection packet is periodically sent, and the time interval parameter carried in the first BFD negotiation authorization packet is greater than or equal to the first time interval parameter.
  • the master clock device periodically sends a BFD probe packet to the slave clock device according to the time interval parameter carried in the first BFD negotiation authorization packet.
  • the clock device periodically detects the BFD probe packet sent by the master clock device according to the time interval parameter carried in the first BFD negotiation authorization packet.
  • the time synchronization request is initiated from the clock device to the master clock device.
  • a time synchronization request can occur, and the time synchronization request is initiated only after the slave clock device establishes a master-slave relationship with the master clock device.
  • the slave clock device periodically sends BFD packets to the master clock device.
  • the master clock device having the best clock source other than the master clock device is selected for switching. And releasing the primary clock device resource.
  • the master clock device After receiving the second BFD negotiation packet, the master clock device sends a second BFD negotiation authorization packet to the slave clock device.
  • the master clock device periodically sends a BFD probe packet according to the second time interval parameter.
  • the master clock device detects the BFD packet sent by the clock device, and if the BFD packet is not detected within the preset time, the BFD packet is sent to the slave clock device, and the device is released. Describe the clock device resources.
  • the slave clock device may send the first time interval parameter of the BFD probe packet to the master clock device according to the receiving capability of the master clock device, so that the master clock device sends the BFD probe packet with the parameter equal to or greater than the first time interval.
  • the text is given to the slave clock device, which improves the detection sensitivity of the slave clock device, thereby improving the quality of the clock synchronization.
  • an embodiment of a slave clock device provided by an embodiment of the present invention includes:
  • the first sending unit 401 is configured to: when the PTP clock source is selected, send a first bidirectional forwarding detection BFD negotiation packet to the primary clock device, where the first BFD negotiation packet carries the slave clock device to expect the master clock The first time interval parameter for the device to send BFD probe packets.
  • the first receiving unit 402 is configured to receive a first BFD negotiation authorization packet sent by the primary clock device, where the first BFD negotiation authorization packet carries a time interval parameter of the primary clock device periodically sending the BFD detection packet.
  • the time interval parameter carried in the first BFD negotiation authorization packet is greater than or equal to the first time interval parameter;
  • the first detecting unit 403 is configured to periodically detect the master clock according to the time interval parameter carried in the first BFD negotiation authorization packet after the first receiving unit 402 receives the first BFD negotiation authorization message. BFD probe packet sent by the device;
  • the clock source switching unit 404 is configured to switch the PTP clock source when the first detecting unit 403 fails to detect the BFD detection packet for the first time.
  • the first sending unit 401 sends a first bidirectional forwarding detection BFD negotiation packet to the primary clock device, where the first BFD negotiation packet carries the desired information of the slave clock device.
  • the first time interval parameter is sent by the master clock device to send the BFD probe packet.
  • the first receiving unit 402 receives the first BFD negotiation authorization packet sent by the master clock device, where the first BFD negotiation authorization packet carries the master clock device.
  • the time interval parameter of the BFD detection packet is periodically sent, and the time interval parameter carried in the first BFD negotiation authorization packet is greater than or equal to the first time interval parameter.
  • the first detecting unit 403 receives the first time receiving unit 402.
  • the BFD detection packet sent by the primary clock device is periodically detected according to the time interval parameter carried in the first BFD negotiation authorization packet; the clock source switching unit 404 continuously detects the first value by the first detecting unit 403.
  • the PTP clock source is switched.
  • the slave clock device provided by the embodiment of the present invention can improve the sensitivity of the probe message, thereby improving the quality of the clock synchronization.
  • another embodiment of the slave clock device provided by the embodiment of the present invention further includes:
  • the clock source switching unit 404 is specifically configured to: when the first detecting unit 403 fails to detect the BFD detection packet for the first time, according to an optimal source selection rule, select the main clock device.
  • the master clock device with the best clock source switches and releases the master clock device resources.
  • another embodiment of the slave clock device provided by the embodiment of the present invention further includes:
  • the first detecting unit 405 is configured to detect network traffic when the first detecting unit 403 fails to detect the BFD detection for the first time.
  • the first sending unit 401 is further configured to: when the network traffic that is detected by the first detecting unit 405 is less than a preset threshold, send a second BFD negotiation packet to the primary clock device, where the second BFD negotiation is performed.
  • the packet carries the second time interval parameter, and the second time interval parameter is greater than the time interval parameter carried in the first BFD negotiation authorization packet, so that the primary clock device sends the BFD detection by using the second time interval parameter.
  • the first detecting unit 403 is further configured to: when the first receiving unit 402 receives the second BFD negotiation authorization message sent by the primary clock device, according to the second BFD negotiation authorization message
  • the second time interval parameter periodically detects the BFD detection packet sent by the primary clock device.
  • the clock source switching unit 404 is specifically configured to select the master clock according to an optimal source selection rule when the first receiving unit 402 does not receive the second BFD negotiation authorization packet sent by the master clock device.
  • the master clock device with the best clock source outside the device switches and releases the master clock device resources.
  • another embodiment of the slave clock device provided by the embodiment of the present invention further includes:
  • the second detecting unit 406 is configured to detect network traffic when the first detecting unit 403 fails to detect the BFD detection for the first time.
  • the first detecting unit 403 is further configured to continue to detect the BFD detection packet when the network traffic detected by the second detecting unit 406 is greater than or equal to a preset threshold.
  • the clock source switching unit 404 is specifically configured to: when the first detecting unit 403 fails to detect the BFD detection packet by the second value, select the source clock device according to the optimal source selection rule.
  • the master clock device having the best clock source performs switching, and releases the master clock device resource, and the second value is greater than the first value.
  • the slave clock device provided by the embodiment of the present invention further includes:
  • the first sending unit 401 is further configured to send a BFD packet to the master clock device, so that the master clock device periodically detects the BFD packet, and when the number of consecutive presets fails to detect the BFD packet, The master clock device releases the slave clock device resources.
  • the slave clock device provided by the multiple embodiments of the present invention can improve the sensitivity of the probe message, thereby improving the quality of the clock synchronization.
  • an embodiment of a master clock device provided by an embodiment of the present invention includes:
  • the second receiving unit 501 is configured to receive a first BFD negotiation packet sent by the clock device, where the first BFD negotiation packet carries a first time interval parameter that the slave clock device desires to send a BFD probe packet.
  • the negotiating unit 502 is configured to determine, according to the first time interval parameter carried in the first BFD negotiation packet that is received by the second receiving unit 501, a time interval parameter for the primary clock device to periodically send the BFD detection packet. After the time interval parameter is greater than or equal to the time interval parameter of the first time interval parameter, the first BFD negotiation authorization message is sent to the slave clock device, and the first BFD negotiation authorization message carries the The time interval parameter that the master clock device periodically sends the BFD probe packet, so that the slave clock device periodically detects the BFD probe sent by the master clock device according to the time interval parameter carried in the first BFD negotiation authorization packet.
  • the time interval parameter carried in the first BFD negotiation authorization packet is sent to the slave clock device periodically to send a BFD probe packet.
  • the BFD probe packet is stopped, and the slave clock device is detected.
  • the BTP detection packet is not received, and the PTP clock source is switched.
  • the second receiving unit 501 receives the first BFD negotiation packet sent by the clock device, where the first BFD negotiation packet carries the first time interval in which the slave clock device is expected to send the BFD probe packet.
  • the parameterizing unit 502 determines, according to the first time interval parameter carried in the first BFD negotiation packet that is received by the second receiving unit 501, the time interval parameter of the primary clock device to periodically send the BFD detection packet, After the time interval parameter is greater than or equal to the time interval parameter of the first time frame, the first BFD negotiation authorization message is sent to the slave clock device, and the first BFD negotiation authorization message carries the master clock.
  • the time interval parameter of the BFD detection packet is periodically sent by the device, so that the slave clock device periodically detects the BFD detection packet sent by the master clock device according to the time interval parameter carried in the first BFD negotiation authorization packet. And in normal operation, periodically, according to the time interval parameter carried in the first BFD negotiation authorization packet, to the slave clock device.
  • BFD sending probe packets when a failure occurs, the probe stops sending the BFD packet from the clock detection apparatus can not detect the BFD packet switching PTP clock source.
  • the master clock device provided by the embodiment of the present invention sends a BFD detection packet to the slave clock device according to the first time interval parameter, which can improve the sensitivity of the probe packet, thereby improving the quality of the clock synchronization.
  • another embodiment of the slave clock device provided by the embodiment of the present invention further includes:
  • the second receiving unit 501 is further configured to receive a second BFD negotiation packet sent by the slave clock device, where the second BFD negotiation packet carries a second time interval parameter, where the second time interval parameter is
  • the negotiating unit 502 is further configured to determine, according to the second time interval parameter carried in the second BFD negotiation packet, that the time interval parameter of the primary clock device to periodically send the BFD detection packet is the second time interval parameter. ;
  • the second sending unit 503 is further configured to: after the determining, by the negotiating unit 502, the time interval parameter for periodically transmitting the BFD detection packet, send the second BFD negotiation authorization message to the slave clock device, and press The BFD probe packet is periodically sent according to the second time interval parameter.
  • another embodiment of the master clock device provided by the embodiment of the present invention further includes:
  • the second detecting unit 504 is configured to detect a BFD packet sent from the clock device.
  • the resource release unit 505 is configured to stop the BFD detection message from being sent to the slave clock device, and release the slave, when the second detection unit 504 is preset for a preset number of times, and the BFD packet is not detected. Clock device resources.
  • the slave clock device provided by the embodiment of the present invention can detect whether the slave clock device exists, and when the clock device does not exist, stop sending the BFD probe packet to the slave clock device, thereby saving resources of the master clock device.
  • a time synchronization system includes a slave clock device 40 and a master clock device 50;
  • the slave clock device 40 is configured to: when the PTP clock source is selected, send a first bidirectional forwarding detection BFD negotiation packet to the primary clock device, where the first BFD negotiation packet carries the slave clock device to expect the master The first time interval parameter of the clock device that sends the BFD probe packet, and the first BFD negotiation authorization packet sent by the master clock device, where the first BFD negotiation authorization packet carries the BFD probe packet periodically.
  • the time interval parameter, the time interval parameter carried in the first BFD negotiation authorization message is greater than or equal to the first time interval parameter; according to the time interval parameter carried in the first BFD negotiation authorization message, periodic
  • the BFD probe packet sent by the master clock device is detected. When the BFD probe packet is not detected for the first time, the PTP clock source is switched.
  • the master clock device 50 is configured to receive a first BFD negotiation packet sent by the clock device, where the first BFD negotiation packet carries a message that the slave clock device expects the master clock device to send a BFD probe packet. a time interval parameter, wherein the time interval parameter of the primary clock device periodically transmitting the BFD detection packet is determined according to the first time interval parameter carried in the first BFD negotiation packet, where the time interval parameter is greater than or Equivalent to the first time interval parameter; sending a first BFD negotiation authorization message to the slave clock device, where the first BFD negotiation authorization message carries a time interval parameter for the primary clock device to periodically send BFD detection packets The slave clock device periodically detects the BFD probe sent by the master clock device according to the time interval parameter carried in the first BFD negotiation authorization packet.
  • the BFD detection packet is periodically sent to the slave clock device according to the time interval parameter carried in the first BFD negotiation authorization packet, and the BFD detection is stopped when a failure occurs.
  • the packet is sent to the slave clock device to detect the BFD probe packet, and the PTP clock source is switched.
  • the program may be stored in a computer readable storage medium, and the storage medium may include: ROM, RAM, disk or CD, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种PTP时钟源切换的方法,在选择PTP时钟源时,向主时钟设备发送第一双向转发检测BFD协商报文,所述第一BFD协商报文中携带所述从时钟设备期望所述主时钟设备发送BFD探测报文的第一时间间隔参数;接收主时钟设备发送的第一BFD协商授权报文,按照所述第一BFD协商授权报文中携带的时间间隔参数,周期性的探测主时钟设备发送的BFD探测报文;当连续第一数值次探测不到所述BFD探测报文时,切换PTP时钟源。可以提高从时钟设备的探测灵敏度。

Description

PTP时钟源切换的方法、 主从时钟设备及系统
本申请要求于 2012 年 4 月 26 日提交中国专利局、 申请号为 201210126335.9、发明名称为 "ΡΤΡ时钟源切换的方法、主从时钟设备及系统" 的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及通信技术领域, 具体涉及一种 ΡΤΡ 时钟源切换的方法、 主从 时钟设备及系统。
背景技术
通信设备为了协同工作需要进行同步, 同步可分为频率同步和时间同步, 不同的通信系统有不同的同步需求: 如常见的同步数字体系 ( SDH , Synchronous Digital Hierarchy )是一个频率同步系统, 要求不同网元之间的频 率要同步起来, 以保证 SDH 业务的正常传送; 而时分同步码分多址 ( TD-SCDMA, Time Division-Synchronous Code Division Multiple Access )是 一个时间同步系统,要求相邻基站之间的时间要同步起来, 以保证空口正常工 作。
《网络测量和控制系统的精密时钟同步协议标准》, 也就是 IEEE1588, 全 称为 " IEEE Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems" ,相比早期的网终时钟十办议( NTP, Network Time Protocol ), IEEE1588协议具有更高的时钟精度, NTP只能提供 毫秒级精度, 而 IEEE1588可以实现亚敫秒级精度的时间同步。
IEEE1588实现从时钟设备和主时钟设备时间同步的过程如下:
1、 主时钟设备在 tl时刻发送同步报文给从时钟设备, 并将 tl时间戳携 带在同步4艮文中;
2、从时钟设备在 t2时刻接收到同步报文, 在本地产生 t2时间戳, 并从同 步报文中提取 tl时间戳;
3、 从时钟设备在 t3时刻发送延迟请求报文, 并在本地产生 t3时间戳;
4、 主时钟设备在 t4时刻接收到延迟请求报文, 并在本地产生 t4时间戳, 然后将 t4时间戳携带在延迟响应报文中, 回传给从时钟设备; 5、 从时钟设备接收到延迟响应报文, 从报文中提取 t4时间戳。
4叚设主时钟设备到从时钟设备的发送路径延时是 Delayms,从时钟设备到 主时钟设备的发送路径延时是 Delaysm,从时钟设备和主时钟设备之间的时间 偏差为 Offset。 显然, 这 3个变量都是未知数, 那么:
t2-tl=Delayms+Offset 等式 1 ;
t4-t3=Delaysm-Offset 等式 2;
(t2-tl)-(t4-t3)=(Delayms+Offset)- (Delaysm - Offset) 等式 3;
Offset=[(t2-tl)-(t4-t3)-(Delayms-Delaysm)] / 2 等式 4;
显然, 如果 Delayms = Delaysm, 即主时钟设备和从时钟设备之间的收 发链路延时对称, 那么:
Offset = [(t2-tl) - (t4-t3) ] / 2......等式 5;
这样从时钟设备就可以根据 tl , t2, t3 , t4 四个时间戳计算出自己和主时 钟设备之间的时间偏差 Offset,调整自身的时间以达到和主时钟设备时间同步。
在实现时间同步前, 从时钟要先选择时钟源, 建立主从关系, 现有技术中 从时钟设备通过请求通知 (Announce-request ) 消息首先向主时钟设备发起 Announce协商, 主时钟设备决定是否给从时钟设备授权, 如果授权, 则主时 钟设备开始向从时钟设备发送 Announce报文, 从时钟设备可以从授权通知 (Announce-grant)消息中获得主时钟设备授权的 Announce 消息间隔和 Announce消息授权周期(Announce Duration Interval )。 从时钟设备才艮据是否 能收到 Announce 报文判断主时钟设备是否存在, 如果连续三次收不到 Announce 消息, 则认为主时钟设备出现故障, 从时钟设备寻找到最佳主时钟 设备后, 从时钟设备切换时钟源。
在对现有技术的研究和实践过程中, 本发明的发明人发现,现有技术中的 主时钟设备只按照预置的时间间隔(如 1S )周期的发送 Announce 4艮文给从时 钟设备, 从时钟设备只是每隔 1S探测一次 Announce报文, 网络中会有 4艮多 从时钟设备, 每个从时钟设备的 Announce报文的探测能力不同, 针对于探测 能力强的从时钟设备(如可以每 0.1 秒探测一次报文), 按照现有技术中的方 案 1S探测一次 Announce报文, 降低了从时钟设备的探测灵敏度。 发明内容
本发明实施例提供一种 PTP时钟源切换的方法, 可以提高从时钟设备的探 测灵敏度。 本发明实施例还提供了相应的主从时钟设备及系统。
一种精密时钟协议 PTP时钟源切换的方法, 包括:
在选择 PTP时钟源时, 向主时钟设备发送第一双向转发检测 BFD协商报 文, 所述第一 BFD协商报文中携带所述从时钟设备期望所述主时钟设备发送 BFD探测报文的第一时间间隔参数;
接收主时钟设备发送的第一 BFD协商授权报文,所述第一 BFD协商授权报 文携带所述主时钟设备周期性发送 BFD探测报文的时间间隔参数, 所述第一 BFD协商授权报文携带的时间间隔参数大于或等于所述第一时间间隔参数; 按照所述第一 BFD协商授权报文中携带的时间间隔参数,周期性的探测主 时钟设备发送的 BFD探测报文;
一种 PTP时钟源切换的方法, 包括:
接收从时钟设备发送的第一 BFD协商报文,所述第一 BFD协商报文中携带 所述从时钟设备期望所述主时钟设备发送 BFD探测报文的第一时间间隔参数; 至少根据所述第一 BFD协商报文中携带的第一时间间隔参数,确定所述主 时钟设备周期性发送 BFD探测报文的时间间隔参数,其中所述时间间隔参数大 于或等于所述第一时间间隔参数;
向所述从时钟设备发送第一 BFD协商授权报文,所述第一 BFD协商授权报 文携带所述主时钟设备周期性发送 BFD探测报文的时间间隔参数,使所述从时 钟设备按照所述第一 BFD协商授权报文中携带的时间间隔参数,周期性的探测 主时钟设备发送的 BFD探测报文;
正常工作时, 按照所述第一 BFD协商授权报文中携带的时间间隔参数, 向 所述从时钟设备周期性的发送 BFD探测报文, 发生故障时, 停止发送所述 BFD 探测报文, 使所述从时钟设备探测不到所述 BFD探测报文, 切换 PTP时钟源。
一种从时钟设备, 包括:
第一发送单元, 用于在选择 PTP时钟源时, 向主时钟设备发送第一双向转 发检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备期望所述 主时钟设备发送 BFD探测报文的第一时间间隔参数;
第一接收单元, 用于接收主时钟设备发送的第一 BFD协商授权报文, 所述 第一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间 间隔参数,所述第一 BFD协商授权报文携带的时间间隔参数大于或等于所述第 一时间间隔参数;
第一探测单元, 用于在第一接收单元接收到所述第一 BFD协商授权报文 后, 按照所述第一 BFD协商授权报文中携带的时间间隔参数, 周期性的探测主 时钟设备发送的 BFD探测报文;
时钟源切换单元,用于当所述第一探测单元连续第一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源。
一种主时钟设备, 包括:
第二接收单元, 用于接收从时钟设备发送的第一 BFD协商报文, 所述第一 BFD协商报文中携带所述从时钟设备期望发送 BFD探测报文的第一时间间隔 参数;
协商单元,用于至少根据所述第一 BFD协商报文中携带的第一时间间隔参 数, 确定所述主时钟设备周期性发送 BFD探测报文的时间间隔参数, 其中所述 时间间隔参数大于或等于所述第一时间间隔参数;
第二发送单元, 用于向所述从时钟设备发送第一 BFD协商授权报文, 所述 第一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间 间隔参数,使所述从时钟设备按照所述第一 BFD协商授权报文中携带的时间间 隔参数, 周期性的探测主时钟设备发送的 BFD探测报文, 并且正常工作时, 按 照所述第一 BFD协商授权报文中携带的时间间隔参数,向所述从时钟设备周期 性的发送 BFD探测报文, 发生故障时, 停止发送所述 BFD探测报文, 使所述从 时钟设备探测不到所述 BFD探测报文, 切换 PTP时钟源。
一种时间同步系统, 包括从时钟设备和主时钟设备;
所述从时钟设备为上述技术方案所述的从时钟设备;
所述主时钟设备为上述技术方案所述的从时钟设备。
本发明实施例采用在选择 PTP时钟源时, 向主时钟设备发送第一双向转发 检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备期望所述主 时钟设备发送 BFD探测报文的第一时间间隔参数;接收主时钟设备发送的第一 BFD协商授权报文,所述第一 BFD协商授权报文携带所述主时钟设备周期性发 送 BFD探测报文的时间间隔参数,所述第一 BFD协商授权报文携带的时间间隔 参数大于或等于所述第一时间间隔参数;按照所述第一 BFD协商授权报文中携 带的时间间隔参数, 周期性的探测主时钟设备发送的 BFD探测报文; 当连续第 一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源。 与现有技术中主时 钟设备为考虑所有从时钟设备的接收能力,将发送 BFD探测报文的时间间隔设 置的很大相比, 本发明实施例提供的 PTP时钟源切换的方法, 从时钟设备可以 根据自身的接收能力,向主时钟设备发送期望发送 BFD探测报文的第一时间间 隔参数,使主时钟设备考量所述从时钟设备的接收能力和自身的发送能力, 以 大于或等于第一时间间隔参数发送 BFD探测报文给从时钟设备,这样可以提高 从时钟设备的探测灵敏度。
附图说明
图 1是本发明实施例提供的时钟源切换的方法的一实施例示意图; 图 2是本发明实施例提供的时钟源切换的方法的另一实施例示意图; 图 3是本发明实施例中应用场景的实施例示意图;
图 4是本发明实施例中从时钟设备的一实施例示意图;
图 5是本发明实施例中从时钟设备的另一实施例示意图;
图 6是本发明实施例中从时钟设备的另一实施例示意图;
图 7是本发明实施例中主时钟设备的一实施例示意图;
图 8是本发明实施例中主时钟设备的另一实施例示意图;
图 9是本发明实施例提供的系统的一实施例示意图。
具体实施方式
本发明实施例提供一种 PTP时钟源切换的方法, 可以提高从时钟设备的探 测灵敏度。 本发明实施例还提供相应的设备及系统。 以下分別进行详细说明。 参阅图 1 , 本发明实施例提供的时钟源切换的方法的一实施例包括:
101、 从时钟设备在选择 PTP时钟源时, 向主时钟设备发送第一双向转发 检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备期望所述主 时钟设备发送 BFD探测报文的第一时间间隔参数。
为实现从时钟设备和主时钟设备的时间同步,如背景技术中的保持主从时 钟设备时间同步的过程, 实际上, 在网络中, 对于从时钟设备而言, 主时钟设 备并不是唯一的,从时钟设备按照最佳主时钟算法( BMC, Best Master Clock ) 选择出具有最佳时钟源的主时钟设备后,从时钟设备向主时钟设备发送 BFD协 商报文, 主时钟设备决定给从时钟设备提供主时钟后, 会向从时钟设备发送 BFD协商授权报文。
102、 从时钟设备接收主时钟设备发送的第一 BFD协商授权报文, 所述第 一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间间 隔参数,所述第一 BFD协商授权报文携带的时间间隔参数大于或等于所述第一 时间间隔参数。
BFD协商授权报文中会携带所述主时钟设备周期性发送 BFD探测报文的 时间间隔参数,该主时钟设备周期性发送 BFD探测报文的时间间隔参数可以与 第一时间间隔参数相同,也可以小于所述第一时间间隔参数, 当主时钟设备的 发送能力可以达到从时钟设备期望的探测 BFD探测报文的第一时间间隔参数 时, 主时钟设备可以在 BFD协商授权报文中携带所述第一时间间隔参数, 来满 足从时钟设备的探测期望,当主时钟设备的发送能力达不到从时钟设备的期望 时, 则根据自身的发送能力, 确定一个发送时间间隔参数, 在 BFD协商授权报 文中携带该确定的时间间隔参数。 现有技术中, 主时钟设备一旦发送 BFD协商 授权报文后,会按照网络中所有从时钟设备都能接收到的时间间隔周期性的发 送 BFD探测报文和同步消息,从时钟设备通过探测主时钟设备发送的 BFD探测 报文, 确认主时钟设备没有发生故障, 在正常的工作状态, 现有技术中, 当从 时钟设备连续 3次探测不到 BFD探测报文时, 就会切换主时钟设备, 以便能获 取准确的时钟。
实际上,每个从时钟设备接收 BFD探测报文的能力是不同的, 如果主时钟 设备考虑到所有从时钟设备的接收能力,就会将发送 BFD探测报文的时间间隔 设置的很长, 如 1S, 可能从时钟设备的接收能力为 0.1S, 这样从时钟设备只能 每隔 IS才能探测一次报文。本发明实施例提供的技术方案,从时钟设备向主时 钟设备发送第一 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备 期望发送 BFD探测报文的第一时间间隔参数, 当从时钟设备的接收能力为 0.1S 时, 就将 0.1S的时间间隔信息携带在第一 BFD协商报文中, 主时钟设备的能力 如果可以达到从时钟设备的要求, 就会按照 0.1S的时间间隔周期性的发送 BFD 探测报文给从时钟设备, 从时钟设备 0.1S探测一次, 如果主时钟设备的能力不 能达到每 0.1S发送一次 BFD探测报文, 可以每 0.15S发送一次 BFD探测报文, 那 么就将该时间间隔参数携带在 BFD协商授权报文中, 使从时钟设备 0.15S探测 一次 BFD探测报文。
103、从时钟设备按照所述第一 BFD协商授权报文中携带的时间间隔参数, 周期性的探测主时钟设备发送的 BFD探测报文。
从时钟设备接收到主时钟设备发送的第一 BFD协商授权报文后,获知了主 时钟设备会以所述第一 BFD协商授权报文中携带的时间间隔参数周期性的发 送 BFD探测报文给自身,按照第一 BFD协商授权报文中携带的时间间隔参数周 期性的探测主时钟设备发送的 BFD探测报文,以确认所述主时钟设备在正常的 工作状态。
104、 从时钟设备连续第一数值次探测不到所述所述 BFD探测报文时, 切 换 PTP时钟源。
如果从时钟设备连续第一数值次探测不到主时钟设备发送来的 BFD探测 报文, 从时钟设备可以认为主时钟设备发生故障, 选择好时钟源后, 切换 PTP 时钟源。
所述当连续第一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源, 具体包括: 当连续第一数值次探测不到所述 BFD探测报文时, 按照最佳选源规 贝' J ,选择所述主时钟设备之外的具有最佳时钟源的主时钟设备进行切换, 并释 放所述主时钟设备资源。
现有技术中, 第一数值为 3, 当连续 3次探测不到 BFD探测报文时, 就会按 照 BMC算法, 选择具有最佳时钟源的主时钟设备进行切换。 现有技术中每隔 1S探测一次 BFD探测报文, 连续 3次探测不到, 也就需要 3S再进行切换, 本发 明实施例提供的方法, 从时钟设备每隔 0.1s探测一次报文, 当连续 3次探测不 到报文时, 只需 0.3S就可以进行选源切换, 从而提高了从时钟设备的探测灵敏 度, 提高了时钟同步的质量, 切换时钟源后, 从时钟设备可以释放原来主时钟 设备的资源。
当连续第一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源, 具体 包括: 当连续第一数值次探测不到所述 BFD探测报文时, 检测网络流量; 当检 测到的网络流量小于预置阈值时, 向所述主时钟设备发送第二 BFD协商报文, 所述第二 BFD协商报文中携带第二时间间隔参数,所述第二时间间隔参数大于 所述第一 BFD协商授权报文携带的时间间隔参数,使所述主时钟设备以第二时 间间隔参数发送所述 BFD探测报文;若接收到所述主时钟设备发送的第二 BFD 协商授权报文,则按照所述第二 BFD协商授权报文中携带的第二时间间隔参数 周期性的探测主时钟设备发送的 BFD探测报文;若未接收到所述第二 BFD协商 授权报文, 则按照最佳选源规则,选择所述主时钟设备之外的具有最佳时钟源 的主时钟设备进行切换, 并释放所述主时钟设备资源。
本发明实施例提供的方案, 并不是像现有技术中的连续 3次探测不到 BFD 探测报文时, 立即进行主时钟设备切换, 而是检测网络流量, 可能是网络拥堵 导致数据传递变慢, 当检测到的网络流量小于预置阈值时,从时钟设备向所述 主时钟设备发送第二 BFD协商报文,所述第二 BFD协商报文中携带第二时间间 隔参数,所述第二时间间隔参数大于所述第一 BFD协商授权报文携带的时间间 隔参数,使所述主时钟设备以第二时间间隔参数发送所述 BFD探测报文; 举例 来说, 如果第一 BFD协商授权报文携带的时间间隔参数 0.15S, 可以将第二时 间间隔参数增大为 0.3S, 若接收到所述主时钟设备发送的第二 BFD协商授权报 文, 说明主时钟设备没有发生障碍, 只是网络拥堵导致的数据传递变慢, 则按 照所述第二 BFD协商授权报文中携带的第二时间间隔参数周期性的探测主时 钟设备发送的 BFD探测报文; 若从时钟设备接收不到主时钟设备的授权通知, 说明主时钟设备可能发生障碍, 则按照最佳选源规则,选择所述主时钟设备之 外的具有最佳时钟源的主时钟设备进行切换。
所述当连续第一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源, 具体包括: 当连续第一数值次探测不到所述 BFD探测报文时, 检测网络流量; 当检测到的网络流量大于或等于预置阈值时, 继续探测所述 BFD探测报文; 当 第二数值次探测不到所述 BFD探测报文时, 按照最佳选源规则, 选择所述主时 钟设备之外的具有最佳时钟源的主时钟设备进行切换,并释放所述主时钟设备 资源, 所述第二数值大于第一数值。
本发明实施例提供的技术方案, 当检测到网络流量正常时,说明网络没有 拥堵, 可能是网络瞬时间断, 导致 BFD探测报文丟失, 这种情况, 可以增加探 测次数, 如原来探测 3次, 现在探测 6次, 如果 6次还探测不到 BFD探测报文, 那么再按照最佳选源规则,选择所述主时钟设备之外的具有最佳时钟源的主时 钟设备进行切换。
本发明实施例提供的方案, 当从时钟设备切换时钟源后,都可以释放原时 钟源的资源。
本发明实施例中, 在选择 PTP时钟源时, 向主时钟设备发送第一双向转发 检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备期望所述主 时钟设备发送 BFD探测报文的第一时间间隔参数;接收主时钟设备发送的第一 BFD协商授权报文,所述第一 BFD协商授权报文携带所述主时钟设备周期性发 送 BFD探测报文的时间间隔参数,所述第一 BFD协商授权报文携带的时间间隔 参数大于等于所述第一时间间隔参数;按照所述第一 BFD协商授权报文中携带 的时间间隔参数, 周期性的探测主时钟设备发送的 BFD探测报文; 当连续第一 数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源。 与现有技术中主时钟 设备为考虑所有从时钟设备的接收能力,将发送 BFD探测报文的时间间隔设置 的很大相比, 本发明实施例提供的报文探测的方法,从时钟设备可以根据自身 的接收能力, 向主时钟设备发送期望发送 BFD探测报文的第一时间间隔参数, 使主时钟设备考量所述从时钟设备的接收能力和自身的发送能力,以大于或等 于第一时间间隔参数发送 BFD探测报文给从时钟设备,这样可以提高从时钟设 备的探测灵敏度, 从而提高了时钟同步的质量。
可选地, 在上述实施例的基础上, 还可以包括: 向主时钟设备发送 BFD才艮 文, 使主时钟设备周期性的探测所述 BFD报文, 当连续预置次数探测不到所述 BFD报文时, 使所述主时钟设备释放所述从时钟设备资源。
参阅图 2, 本发明实施例提供的时钟源切换的方法的一实施例包括: 201、主时钟设备接收从时钟设备发送的第一 BFD协商报文,所述第一 BFD 协商报文中携带所述从时钟设备期望发送 BFD探测报文的第一时间间隔参数。
现有技术中, 主时钟设备考虑到网络中所有从时钟设备,按照所有从时钟 设备都能接收到的时间间隔周期性的发送 BFD探测报文和同步消息,本发明实 施例提供的方案, 主时钟设备接收到从时钟设备发送的第一 BFD协商报文, 从 所述第一 BFD协商报文中获知从时钟设备的接收能力为第一时间间隔参数,如 0.1S。
202、 至少根据所述第一 BFD协商报文中携带的第一时间间隔参数, 确定 所述主时钟设备周期性发送 BFD探测报文的时间间隔参数,其中所述时间间隔 参数大于或等于所述第一时间间隔参数。
主时钟设备接收到第一 BFD协商报文后,根据第一 BFD协商报文中携带的 第一时间间隔参数协商给该从设备发送 BFD探测报文的时间间隔参数,当主时 钟设备的发送能力可以达到从时钟设备期望的探测 BFD探测报文的第一时间 间隔参数时, 主时钟设备会满足从时钟设备的期望, 在 BFD协商授权报文中携 带所述第一时间间隔参数, 来满足从时钟设备的探测期望, 当主时钟设备的发 送能力达不到从时钟设备的期望时, 则根据自身的发送能力,确定一个大于第 一时间间隔参数的发送 BFD探测报文的时间间隔参数,在 BFD协商授权报文中 携带该确定的时间间隔参数。
203、 向所述从时钟设备发送第一 BFD协商授权报文, 所述第一 BFD协商 授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间间隔参数,使所 述从时钟设备按照所述第一 BFD协商授权报文中携带的时间间隔参数,周期性 的探测主时钟设备发送的 BFD探测报文。
本发明实施例中, 主时钟设备接收从时钟设备发送的第一 BFD协商报文, 所述第一 BFD协商报文中携带所述从时钟设备期望发送 BFD探测报文的第一 时间间隔参数; 主时钟设备评估自身的发送能力后,如果可以达到所述从设备 的接收能力, 给所述从时钟设备发送第一 BFD协商授权报文, 在所述第一 BFD 协商授权报文中携带的周期性发送 BFD探测报文的时间间隔参数可以与第一 时间间隔参数相同,如果主时钟设备的发送能力达不到所述从时钟设备的接收 能力,那么在所述第一 BFD协商授权报文中携带的周期性发送 BFD探测报文的 时间间隔参数大于第一时间间隔参数,使所述从时钟设备按照所述第一 BFD协 商授权报文中携带的时间间隔参数,周期性的探测主时钟设备发送的 BFD探测 报文。
204、 正常工作时, 按照所述第一 BFD协商授权报文中携带的时间间隔参 数, 向所述从时钟设备周期性的发送 BFD探测报文, 发生故障时, 停止发送所 述 BFD探测报文, 使所述从时钟设备探测不到所述 BFD探测报文, 切换 PTP时 钟源。
主时钟设备与从时钟设备 BFD协商后, 建立主从关系, 主时钟设备通过发 送 BFD探测报文, 使从时钟设备通过探测所述 BFD探测报文, 获知主时钟设备 工作状态正常, 如果主时钟设备发生故障, 那么就无法再发送所述 BFD探测报 文, 这样, 从时钟设备探测不到所述 BFD探测报文, 会切换 PTP时钟源。
与现有技术中主时钟设备为考虑所有从时钟设备的接收能力,将发送 BFD 探测报文的时间间隔设置的很大相比, 本发明实施例提供的报文探测的方法, 从时钟设备可以根据自身的接收能力,向主时钟设备发送期望发送 BFD探测报 文的第一时间间隔参数, 当第一时间间隔参数为 0.1S时, 就将 0.1S的时间间隔 信息携带在第一 BFD协商报文中,主时钟设备的能力如果可以达到从时钟设备 的要求, 就会按照 0.1S的时间间隔周期性的发送 BFD探测报文给从时钟设备, 从时钟设备 0.1S探测一次, 如果主时钟设备的能力不能达到每 0.1S发送一次 BFD探测报文, 可以根据自身的能力, 如每 0.15S发送一次 BFD探测报文, 那 么就将该时间间隔参数 0.15S携带在 BFD协商授权报文中。 这样可以避免主时 钟设备考虑到所有的从时钟设备, 以较长的周期发送 BFD探测报文, 提高从时 钟设备的探测灵敏度, 从而提高了时钟同步的质量。
可选地, 在上述图 2对应的实施例的基础上, 还包括: 接收所述从时钟设 备发送的第二 BFD协商报文, 所述第二 BFD协商报文中携带第二时间间隔参 间间隔参数; 给所述从时钟设备发送第二 BFD协商授权报文后,按照所述第二 时间间隔参数周期性的发送所述 BFD探测报文,以使所述从时钟设备获知所述 主时钟设备在正常的工作状态。
当从时钟设备检测到网络拥堵时, 会向主时钟设备发送第二 BFD协商报 文, 所述第二 BFD协商报文中携带第二时间间隔参数, 所述第二时间间隔参数 果处于正常工作状态,会判断出第二时间间隔参数大于自身的发送 BFD探测报 文的时间间隔参数,从而可以将发送 BFD探测报文的时间间隔参数修改为第二 时间间隔参数, 则会向从时钟设备发送第二 BFD协商授权报文, 并在所述第二 BFD协商授权报文中携带第二时间间隔参数,然后按照第二时间间隔参数发送 BFD探测报文给从时钟设备,以使所述从时钟设备获知所述主时钟设备在正常 的工作状态。
可选地, 在上述图 2对应的实施例的基础上, 还包括: 探测从时钟设备发 送的 BFD报文; 若连续预置次数, 探测不到所述 BFD报文, 则停止向所述从时 钟设备发送所述 BFD探测报文, 并释放所述从时钟设备资源。
现有技术中, 主时钟设备一旦给从时钟设备授权后, 就会不停的发送 BFD 探测报文给从时钟设备, 即时从时钟设备切换了时钟源, 主时钟设备页还会继 续发送, 这样浪费了主时钟设备的资源, 本发明实施例提供的报文探测方法, 主时钟设备会探测从时钟设备发送的 BFD报文, 当在预置时间内, 探测不到所 述 BFD报文, 则说明从时钟设备已经切换时钟源, 则停止向所述从时钟设备发 送所述 BFD探测报文。 从而节省了主时钟设备的资源。
为了便于理解, 下面以一个具体应用场景为例,详细的描述本发明实施例 提供的报文探测的方法:
参阅图 3, 本发明实施例提供的时钟源切换的方法的另一实施例包括: 301、 从时钟设备发送第一 BFD协商报文给主时钟设备, 所述第一 BFD协 商报文中携带所述从时钟设备期望发送 BFD探测报文的第一时间间隔参数。
从时钟设备在选择时钟源时,先要向主时钟设备发送第一 BFD协商报文给 主时钟设备,并在所述第一 BFD协商报文中携带所述从时钟设备期望发送 BFD 探测报文的第一时间间隔参数。
302、 主时钟设备向从时钟设备发送第一 BFD协商授权报文。
主时钟设备决定给发送第一 BFD协商报文的从时钟设备提供时钟源后,发 向从时钟设备发送第一 BFD协商授权报文,所述第一 BFD协商授权报文携带所 述主时钟设备周期性发送 BFD探测报文的时间间隔参数,所述第一 BFD协商授 权报文携带的时间间隔参数大于或等于所述第一时间间隔参数。
303、 主时钟设备按照所述第一 BFD协商授权报文携带的时间间隔参数, 周期性的向从时钟设备发送 BFD探测报文。
从时钟设备按照所述第一 BFD协商授权报文携带的时间间隔参数周期性 的探测主时钟设备发送的 BFD探测报文。
304a, 从时钟设备向主时钟设备发起时间同步请求。
从时钟设备与主时钟设备建立主从关系后, 就可以发生时间同步请求了, 响, 只是要在从时钟设备与主时钟设备建立主从关系后才能发起时间同步请 求,关于时间同步的过程,可以参阅背景技术进行理解,在此不再做详细赘述。
304b、 从时钟设备向主时钟设备周期性的发送 BFD报文。
305、 当连续第一数值次探测不到所述 BFD探测报文时, 按照最佳选源规 贝' J ,选择所述主时钟设备之外的具有最佳时钟源的主时钟设备进行切换, 并释 放所述主时钟设备资源。
306、 当连续第一数值次探测不到所述 BFD探测报文时, 检测网络流量。
307、 当检测到的网络流量小于预置阈值时, 向所述主时钟设备发送第二 BFD协商报文, 所述第二 BFD协商报文中携带第二时间间隔参数, 所述第二时 间间隔参数大于所述第一 BFD协商授权报文携带的时间间隔参数,使所述主时 钟设备以第二时间间隔参数发送所述 BFD探测报文。
308、主时钟设备接收到第二 BFD协商报文后,向从时钟设备发送第二 BFD 协商授权报文。
309、 主时钟设备按照第二时间间隔参数周期性的发送 BFD探测报文。
310、 当检测到的网络流量大于等于预置阈值时, 继续探测所述 BFD探测 报文。
311、 主时钟设备探测从时钟设备发送的 BFD报文, 若在预置时间内, 探 测不到所述 BFD报文, 则停止向所述从时钟设备发送所述 BFD探测报文, 并释 放所述从时钟设备资源。
本应用场景实施例,从时钟设备可以根据自身的接收能力, 向主时钟设备 发送期望发送 BFD探测报文的第一时间间隔参数,使主时钟设备以大于等于第 一时间间隔参数发送 BFD探测报文给从时钟设备,这样可以提高从时钟设备的 探测灵敏度, 从而提高了时钟同步的质量。
参阅图 4, 本发明实施例提供的从时钟设备的一实施例包括:
第一发送单元 401 , 用于在选择 PTP时钟源时, 向主时钟设备发送第一双 向转发检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备期望 所述主时钟设备发送 BFD探测报文的第一时间间隔参数;
第一接收单元 402, 用于接收主时钟设备发送的第一 BFD协商授权报文, 所述第一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的 时间间隔参数,所述第一 BFD协商授权报文携带的时间间隔参数大于或等于所 述第一时间间隔参数;
第一探测单元 403,用于在第一接收单元 402接收到所述第一 BFD协商授权 报文后,按照所述第一 BFD协商授权报文中携带的时间间隔参数, 周期性的探 测主时钟设备发送的 BFD探测报文;
时钟源切换单元 404,用于当所述第一探测单元 403连续第一数值次探测不 到所述 BFD探测报文时, 切换 PTP时钟源。
本发明实施例中, 第一发送单元 401在选择 PTP时钟源时, 向主时钟设备 发送第一双向转发检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时 钟设备期望所述主时钟设备发送 BFD探测报文的第一时间间隔参数;第一接收 单元 402接收主时钟设备发送的第一 BFD协商授权报文, 所述第一 BFD协商授 权报文携带所述主时钟设备周期性发送 BFD探测报文的时间间隔参数,所述第 一 BFD协商授权报文携带的时间间隔参数大于或等于所述第一时间间隔参数; 第一探测单元 403在第一接收单元 402接收到所述第一 BFD协商授权报文后,按 照所述第一 BFD协商授权报文中携带的时间间隔参数,周期性的探测主时钟设 备发送的 BFD探测报文;时钟源切换单元 404当所述第一探测单元 403连续第一 数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源。 与现有技术相比, 本 发明实施例提供的从时钟设备, 可以提高探测报文的灵敏度,从而提高时钟同 步的质量。
在上述图 4对应的实施例的基础上, 本发明实施例提供的从时钟设备的另 一实施例还包括:
所述时钟源切换单元 404,具体用于当所述第一探测单元 403连续第一数值 次探测不到所述 BFD探测报文时, 按照最佳选源规则, 选择所述主时钟设备之 外的具有最佳时钟源的主时钟设备进行切换, 并释放所述主时钟设备资源。
在上述图 4对应的实施例的基础上, 参阅图 5, 本发明实施例提供的从时钟 设备的另一实施例还包括:
第一检测单元 405,用于当所述第一探测单元 403连续第一数值次探测不到 所述 BFD探测 4艮文时, 检测网络流量;
所述第一发送单元 401 ,还用于当所述第一检测单元 405检测到的网络流量 小于预置阈值时, 向所述主时钟设备发送第二 BFD协商报文, 所述第二 BFD协 商报文中携带第二时间间隔参数,所述第二时间间隔参数大于所述第一 BFD协 商授权报文携带的时间间隔参数,使所述主时钟设备以第二时间间隔参数发送 所述 BFD探测报文;
所述第一探测单元 403,还用于当所述第一接收单元 402接收到所述主时钟 设备发送的第二 BFD协商授权报文时,按照所述第二 BFD协商授权报文中携带 的第二时间间隔参数周期性的探测主时钟设备发送的 BFD探测报文;
所述时钟源切换单元 404,具体用于当所述第一接收单元 402未接收到所述 主时钟设备发送的第二 BFD协商授权报文时,按照最佳选源规则, 选择所述主 时钟设备之外的具有最佳时钟源的主时钟设备进行切换,并释放所述主时钟设 备资源。
在上述图 4对应的实施例的基础上, 参阅图 6, 本发明实施例提供的从时钟 设备的另一实施例还包括: 第二检测单元 406,用于当所述第一探测单元 403连续第一数值次探测不到 所述 BFD探测 4艮文时, 检测网络流量;
所述第一探测单元 403,还用于当所述第二检测单元 406检测到的网络流量 大于或等于预置阈值时, 继续探测所述 BFD探测报文;
所述时钟源切换单元 404,具体用于当所述第一探测单元 403第二数值次探 测不到所述 BFD探测报文时, 按照最佳选源规则, 选择所述主时钟设备之外的 具有最佳时钟源的主时钟设备进行切换, 并释放所述主时钟设备资源, 所述第 二数值大于第一数值。
在上述实施例的基石出上,本发明实施例提供的从时钟设备的另一实施例还 包括:
所述第一发送单元 401 , 还用于发送 BFD报文给主时钟设备, 使主时钟设 备周期性的探测所述 BFD报文, 当连续预置次数探测不到所述 BFD报文时, 使 所述主时钟设备释放所述从时钟设备资源。
本发明多个实施例提供的从时钟设备, 可以提高探测报文的灵敏度,从而 提高时钟同步的质量。
参阅图 7, 本发明实施例提供的主时钟设备的一实施例包括:
第二接收单元 501 , 用于接收从时钟设备发送的第一 BFD协商报文, 所述 第一 BFD协商报文中携带所述从时钟设备期望发送 BFD探测报文的第一时间 间隔参数;
协商单元 502,用于至少根据所述第二接收单元 501接收到的第一 BFD协商 报文中携带的第一时间间隔参数,确定所述主时钟设备周期性发送 BFD探测报 文的时间间隔参数, 其中所述时间间隔参数大于或等于所述第一时间间隔参 数; 的时间间隔参数后, 向所述从时钟设备发送第一 BFD协商授权报文, 所述第一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间间隔 参数,使所述从时钟设备按照所述第一 BFD协商授权报文中携带的时间间隔参 数, 周期性的探测主时钟设备发送的 BFD探测报文, 并且正常工作时, 按照所 述第一 BFD协商授权报文中携带的时间间隔参数,向所述从时钟设备周期性的 发送 BFD探测报文, 发生故障时, 停止发送所述 BFD探测报文, 使所述从时钟 设备探测不到所述 BFD探测报文, 切换 PTP时钟源。
本发明实施例中, 第二接收单元 501接收从时钟设备发送的第一 BFD协商 报文,所述第一 BFD协商报文中携带所述从时钟设备期望发送 BFD探测报文的 第一时间间隔参数;协商单元 502至少根据所述第二接收单元 501接收到的第一 BFD协商报文中携带的第一时间间隔参数, 确定所述主时钟设备周期性发送 BFD探测报文的时间间隔参数,其中所述时间间隔参数大于或等于所述第一时 文的时间间隔参数后, 向所述从时钟设备发送第一 BFD协商授权报文, 所述第 一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间间 隔参数,使所述从时钟设备按照所述第一 BFD协商授权报文中携带的时间间隔 参数, 周期性的探测主时钟设备发送的 BFD探测报文, 并且正常工作时, 按照 所述第一 BFD协商授权报文中携带的时间间隔参数,向所述从时钟设备周期性 的发送 BFD探测报文, 发生故障时, 停止发送所述 BFD探测报文, 使所述从时 钟设备探测不到所述 BFD探测报文, 切换 PTP时钟源。 与现有技术相比, 本发 明实施例提供的主时钟设备,按照第一时间间隔参数发送 BFD探测报文给从时 钟设备, 可以提高探测报文的灵敏度, 从而提高时钟同步的质量。
在上述图 7对应的实施例的基础上, 本发明实施例提供的从时钟设备的另 一实施例还包括:
所述第二接收单元 501 , 还用于接收所述从时钟设备发送的第二 BFD协商 报文, 所述第二 BFD协商报文中携带第二时间间隔参数, 所述第二时间间隔参 所述协商单元 502, 还用于至少根据所述第二 BFD协商报文中携带的第二 时间间隔参数,确定所述主时钟设备周期性发送 BFD探测报文的时间间隔参数 为第二时间间隔参数;
所述第二发送单元 503 ,还用于在所述协商单元 502确定周期性发送 BFD探 测报文的时间间隔参数后, 向所述从时钟设备发送第二 BFD协商授权报文, 按 照所述第二时间间隔参数周期性的发送所述 BFD探测报文。
在上述图 7的实施例的基石出上, 参阅图 8, 本发明实施例提供的主时钟设备 的另一实施例还包括:
第二探测单元 504, 用于探测从时钟设备发送的 BFD报文;
资源释放单元 505, 用于在所述第二探测单元 504连续预置次数,探测不到 所述 BFD报文时, 停止向所述从时钟设备发送所述 BFD探测报文, 并释放所述 从时钟设备资源。
本发明实施例提供的从时钟设备, 可以探测从时钟设备是否存在, 当从时 钟设备不存在时, 停止向从时钟设备发送 BFD探测报文, 从而节省了主时钟设 备的资源。
参阅图 9, 本发明实施例提供的时间同步系统, 包括从时钟设备 40和主时 钟设备 50;
所述从时钟设备 40 , 用于在选择 PTP时钟源时, 向主时钟设备发送第一双 向转发检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备期望 所述主时钟设备发送 BFD探测报文的第一时间间隔参数;接收主时钟设备发送 的第一 BFD协商授权报文,所述第一 BFD协商授权报文携带所述主时钟设备周 期性发送 BFD探测报文的时间间隔参数,所述第一 BFD协商授权报文携带的时 间间隔参数大于或等于所述第一时间间隔参数;按照所述第一 BFD协商授权报 文中携带的时间间隔参数, 周期性的探测主时钟设备发送的 BFD探测报文; 当 连续第一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源。
所述主时钟设备 50, 用于接收从时钟设备发送的第一 BFD协商报文, 所述 第一 BFD协商报文中携带所述从时钟设备期望所述主时钟设备发送 BFD探测 报文的第一时间间隔参数;至少根据所述第一 BFD协商报文中携带的第一时间 间隔参数, 确定所述主时钟设备周期性发送 BFD探测报文的时间间隔参数, 其 中所述时间间隔参数大于或等于所述第一时间间隔参数;向所述从时钟设备发 送第一 BFD协商授权报文,所述第一 BFD协商授权报文携带所述主时钟设备周 期性发送 BFD探测报文的时间间隔参数,使所述从时钟设备按照所述第一 BFD 协商授权报文中携带的时间间隔参数,周期性的探测主时钟设备发送的 BFD探 测报文;正常工作时,按照所述第一 BFD协商授权报文中携带的时间间隔参数, 向所述从时钟设备周期性的发送 BFD探测报文, 发生故障时, 停止发送所述 BFD探测报文, 使所述从时钟设备探测不到所述 BFD探测报文, 切换 PTP时钟 源。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读 存储介质中, 存储介质可以包括: ROM、 RAM, 磁盘或光盘等。
以上对本发明实施例所提供的 PTP时钟源切换的方法、 设备以及系统进 述, 以上实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同时, 对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围 上均会有改变之处, 综上所述, 本说明书内容不应理解为对本发明的限制

Claims

权 利 要 求
1、 一种精密时钟协议 PTP时钟源切换的方法, 其特征在于, 包括: 在选择 PTP时钟源时, 向主时钟设备发送第一双向转发检测 BFD协商报 文, 所述第一 BFD协商报文中携带所述从时钟设备期望所述主时钟设备发送 BFD探测报文的第一时间间隔参数;
接收主时钟设备发送的第一 BFD协商授权报文,所述第一 BFD协商授权报 文携带所述主时钟设备周期性发送 BFD探测报文的时间间隔参数, 所述第一 BFD协商授权报文携带的时间间隔参数大于或等于所述第一时间间隔参数; 按照所述第一 BFD协商授权报文中携带的时间间隔参数,周期性的探测主 时钟设备发送的 BFD探测报文;
当连续第一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源。
2、根据权利要求 1所述的方法, 其特征在于, 所述当连续第一数值次探测 不到所述 BFD探测报文时, 切换 PTP时钟源, 具体包括:
当连续第一数值次探测不到所述 BFD探测报文时, 按照最佳选源规则, 选 择所述主时钟设备之外的具有最佳时钟源的主时钟设备进行切换,并释放所述 主时钟设备资源。
3、根据权利要求 1所述的方法, 其特征在于, 所述当连续第一数值次探测 不到所述 BFD探测报文时, 切换 PTP时钟源, 具体包括:
当连续第一数值次探测不到所述 BFD探测报文时, 检测网络流量; 当检测到的网络流量小于预置阈值时,向所述主时钟设备发送第二 BFD协 商报文, 所述第二 BFD协商报文中携带第二时间间隔参数, 所述第二时间间隔 参数大于所述第一 BFD协商授权报文携带的时间间隔参数,使所述主时钟设备 以第二时间间隔参数发送所述 BFD探测报文;
若接收到所述主时钟设备发送的第二 BFD协商授权报文,则按照所述第二 BFD协商授权报文中携带的第二时间间隔参数周期性的探测主时钟设备发送 的 BFD探测报文;
若未接收到所述第二 BFD协商授权报文, 则按照最佳选源规则, 选择所述 主时钟设备之外的具有最佳时钟源的主时钟设备进行切换,并释放所述主时钟 设备资源。
4、根据权利要求 1所述的方法, 其特征在于, 所述当连续第一数值次探测 不到所述 BFD探测报文时, 切换 PTP时钟源, 具体包括:
当连续第一数值次探测不到所述 BFD探测报文时, 检测网络流量; 当检测到的网络流量大于或等于预置阈值时, 继续探测所述 BFD探测报 文;
当第二数值次探测不到所述 BFD探测报文时, 按照最佳选源规则, 选择所 述主时钟设备之外的具有最佳时钟源的主时钟设备进行切换,并释放所述主时 钟设备资源, 所述第二数值大于第一数值。
5、 根据权利要求 1~4任意一项所述的方法, 其特征在于, 还包括: 向主时钟设备发送 BFD报文, 使主时钟设备周期性的探测所述 BFD报文, 当连续预置次数探测不到所述 BFD报文时,使所述主时钟设备释放所述从时钟 设备资源。
6、 一种 PTP时钟源切换的方法, 其特征在于, 包括:
接收从时钟设备发送的第一 BFD协商报文,所述第一 BFD协商报文中携带 所述从时钟设备期望所述主时钟设备发送 BFD探测报文的第一时间间隔参数; 至少根据所述第一 BFD协商报文中携带的第一时间间隔参数,确定所述主 时钟设备周期性发送 BFD探测报文的时间间隔参数,其中所述时间间隔参数大 于或等于所述第一时间间隔参数;
向所述从时钟设备发送第一 BFD协商授权报文 ,所述第一 BFD协商授权报 文携带所述主时钟设备周期性发送 BFD探测报文的时间间隔参数,使所述从时 钟设备按照所述第一 BFD协商授权报文中携带的时间间隔参数,周期性的探测 主时钟设备发送的 BFD探测报文;
正常工作时, 按照所述第一 BFD协商授权报文中携带的时间间隔参数, 向 所述从时钟设备周期性的发送 BFD探测报文, 发生故障时, 停止发送所述 BFD 探测报文, 使所述从时钟设备探测不到所述 BFD探测报文, 切换 PTP时钟源。
7、 根据权利要求 6所述的方法, 其特征在于, 所述按照所述第一 BFD协商 授权报文中携带的时间间隔参数,向所述从时钟设备周期性的发送 BFD探测报 文后, 还包括:
接收所述从时钟设备发送的第二 BFD协商报文,所述第二 BFD协商报文中 携带第二时间间隔参数,所述第二时间间隔参数大于所述主时钟设备周期性发 送 BFD探测报文的时间间隔参数;
至少根据所述第二 BFD协商报文中携带的第二时间间隔参数,确定所述主 时钟设备周期性发送 BFD探测报文的时间间隔参数为第二时间间隔参数; 向所述从时钟设备发送携带有所述第二时间间隔参数的第二 BFD协商授 权报文后, 按照所述第二时间间隔参数周期性的发送所述 BFD探测报文。
8、 根据权利要求 6或 7所述的方法, 其特征在于, 还包括:
探测从时钟设备发送的 BFD报文;
若连续预置次数,探测不到所述 BFD报文, 则停止向所述从时钟设备发送 所述 BFD探测报文, 并释放所述从时钟设备资源。
9、 一种从时钟设备, 其特征在于, 包括:
第一发送单元, 用于在选择 PTP时钟源时, 向主时钟设备发送第一双向转 发检测 BFD协商报文,所述第一 BFD协商报文中携带所述从时钟设备期望所述 主时钟设备发送 BFD探测报文的第一时间间隔参数;
第一接收单元, 用于接收主时钟设备发送的第一 BFD协商授权报文, 所述 第一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间 间隔参数,所述第一 BFD协商授权报文携带的时间间隔参数大于或等于所述第 一时间间隔参数;
第一探测单元, 用于在第一接收单元接收到所述第一 BFD协商授权报文 后, 按照所述第一 BFD协商授权报文中携带的时间间隔参数, 周期性的探测主 时钟设备发送的 BFD探测报文;
时钟源切换单元,用于当所述第一探测单元连续第一数值次探测不到所述 BFD探测报文时, 切换 PTP时钟源。
10、 根据权利要求 9所述的从时钟设备, 其特征在于,
所述时钟源切换单元,具体用于当所述第一探测单元连续第一数值次探测 不到所述 BFD探测报文时, 按照最佳选源规则, 选择所述主时钟设备之外的具 有最佳时钟源的主时钟设备进行切换, 并释放所述主时钟设备资源。
11、 根据权利要求 9所述的从时钟设备, 其特征在于, 还包括:
第一检测单元, 用于当所述第一探测单元连续第一数值次探测不到所述 BFD探测报文时, 检测网络流量;
所述第一发送单元,还用于当所述第一检测单元检测到的网络流量小于预 置阈值时, 向所述主时钟设备发送第二 BFD协商报文, 所述第二 BFD协商报文 中携带第二时间间隔参数,所述第二时间间隔参数大于所述第一 BFD协商授权 报文携带的时间间隔参数, 使所述主时钟设备以第二时间间隔参数发送所述 BFD探测报文;
所述第一探测单元,还用于当所述第一接收单元接收到所述主时钟设备发 送的第二 BFD协商授权报文时,按照所述第二 BFD协商授权报文中携带的第二 时间间隔参数周期性的探测主时钟设备发送的 BFD探测报文;
所述时钟源切换单元,具体用于当所述第一接收单元未接收到所述主时钟 设备发送的第二 BFD协商授权报文时, 按照最佳选源规则, 选择所述主时钟设 备之外的具有最佳时钟源的主时钟设备进行切换, 并释放所述主时钟设备资 源。
12、 根据权利要求 9所述的从时钟设备, 其特征在于, 还包括:
第二检测单元, 用于当所述第一探测单元连续第一数值次探测不到所述 BFD探测报文时, 检测网络流量;
所述第一探测单元,还用于当所述第二检测单元检测到的网络流量大于或 等于预置阈值时, 继续探测所述 BFD探测报文;
所述时钟源切换单元,具体用于当所述第一探测单元第二数值次探测不到 所述 BFD探测报文时,按照最佳选源规则, 选择所述主时钟设备之外的具有最 佳时钟源的主时钟设备进行切换, 并释放所述主时钟设备资源, 所述第二数值 大于第一数值。
13、 根据权利要求 9~12任意一项所述的从时钟设备, 其特征在于, 所述第一发送单元, 还用于发送 BFD报文给主时钟设备,使主时钟设备周 期性的探测所述 BFD报文, 当连续预置次数探测不到所述 BFD报文时, 使所述 主时钟设备释放所述从时钟设备资源。
14、 一种主时钟设备, 其特征在于, 包括:
第二接收单元, 用于接收从时钟设备发送的第一 BFD协商报文, 所述第一 BFD协商报文中携带所述从时钟设备期望发送 BFD探测报文的第一时间间隔 参数;
协商单元,用于至少根据所述第一 BFD协商报文中携带的第一时间间隔参 数, 确定所述主时钟设备周期性发送 BFD探测报文的时间间隔参数, 其中所述 时间间隔参数大于或等于所述第一时间间隔参数;
第二发送单元, 用于向所述从时钟设备发送第一 BFD协商授权报文, 所述 第一 BFD协商授权报文携带所述主时钟设备周期性发送 BFD探测报文的时间 间隔参数,使所述从时钟设备按照所述第一 BFD协商授权报文中携带的时间间 隔参数, 周期性的探测主时钟设备发送的 BFD探测报文, 并且正常工作时, 按 照所述第一 BFD协商授权报文中携带的时间间隔参数,向所述从时钟设备周期 性的发送 BFD探测报文, 发生故障时, 停止发送所述 BFD探测报文, 使所述从 时钟设备探测不到所述 BFD探测报文, 切换 PTP时钟源。
15、 根据权利要求 14所述的主时钟设备, 其特征在于,
所述第二接收单元, 还用于接收所述从时钟设备发送的第二 BFD协商报 文, 所述第二 BFD协商报文中携带第二时间间隔参数, 所述第二时间间隔参数 所述协商单元,还用于至少根据所述第二 BFD协商报文中携带的第二时间 间隔参数,确定所述主时钟设备周期性发送 BFD探测报文的时间间隔参数为第 二时间间隔参数;
所述第二发送单元,还用于向所述从时钟设备发送携带有第二时间间隔参 数的第二 BFD协商授权报文后,按照所述第二时间间隔参数周期性的发送所述 BFD探测报文。
16、 根据权利要求 14或 15所述的主时钟设备, 其特征在于, 还包括: 第二探测单元, 用于探测从时钟设备发送的 BFD报文;
资源释放单元, 用于在所述第二探测单元连续预置次数, 探测不到所述 BFD报文时, 停止向所述从时钟设备发送所述 BFD探测报文, 并释放所述从时 钟设备资源。
17、 一种时间同步系统, 其特征在于, 包括从时钟设备和主时钟设备; 所述从时钟设备为上述权利要求 9~13任意一项所述的从时钟设备; 所述主时钟设备为上述权利要求 14~16任意一项所述的从时钟设备。
PCT/CN2012/081891 2012-04-26 2012-09-25 Ptp时钟源切换的方法、主从时钟设备及系统 WO2013159486A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210126335.9 2012-04-26
CN201210126335.9A CN102664726B (zh) 2012-04-26 2012-04-26 Ptp时钟源切换的方法、主从时钟设备及系统

Publications (1)

Publication Number Publication Date
WO2013159486A1 true WO2013159486A1 (zh) 2013-10-31

Family

ID=46774147

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/081891 WO2013159486A1 (zh) 2012-04-26 2012-09-25 Ptp时钟源切换的方法、主从时钟设备及系统

Country Status (2)

Country Link
CN (1) CN102664726B (zh)
WO (1) WO2013159486A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104602264A (zh) * 2015-01-05 2015-05-06 华为技术有限公司 一种促进控制点发现设备的方法、装置及系统
US9912693B1 (en) 2015-04-06 2018-03-06 Sprint Communications Company L.P. Identification of malicious precise time protocol (PTP) nodes

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102664726B (zh) * 2012-04-26 2015-08-05 华为技术有限公司 Ptp时钟源切换的方法、主从时钟设备及系统
CN105024798A (zh) * 2014-04-28 2015-11-04 中兴通讯股份有限公司 一种时间同步的方法及装置
CN103957258B (zh) * 2014-04-30 2018-06-15 中国工商银行股份有限公司 一种跨区数据通信方法及系统
CN106549822B (zh) * 2015-09-16 2019-12-06 中国移动通信集团公司 测试时间同步报文的响应时间的方法、装置及测试设备
CN107612772B (zh) * 2017-09-07 2020-12-04 银清科技有限公司 支付系统的节点状态探测方法及装置
CN112073264B (zh) * 2020-08-31 2022-09-02 新华三信息安全技术有限公司 一种协议探测方法、装置和网络设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101237452A (zh) * 2008-02-20 2008-08-06 杭州华三通信技术有限公司 双向转发检测报文的发送方法、系统和设备
CN101394264A (zh) * 2007-09-21 2009-03-25 华为技术有限公司 周期性报文传递的监控方法及装置
US20110261917A1 (en) * 2010-04-21 2011-10-27 Lsi Corporation Time Synchronization Using Packet-Layer and Physical-Layer Protocols
CN102347814A (zh) * 2011-10-11 2012-02-08 上海电力学院 基于主时钟频率差值的从时钟调整方法
CN102664726A (zh) * 2012-04-26 2012-09-12 华为技术有限公司 Ptp时钟源切换的方法、主从时钟设备及系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101795216B (zh) * 2010-01-25 2013-09-11 中兴通讯股份有限公司 多跳双向转发检测中复位看门狗的方法及设备
CN101800676A (zh) * 2010-02-20 2010-08-11 中兴通讯股份有限公司 链路检测方法、装置和系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101394264A (zh) * 2007-09-21 2009-03-25 华为技术有限公司 周期性报文传递的监控方法及装置
CN101237452A (zh) * 2008-02-20 2008-08-06 杭州华三通信技术有限公司 双向转发检测报文的发送方法、系统和设备
US20110261917A1 (en) * 2010-04-21 2011-10-27 Lsi Corporation Time Synchronization Using Packet-Layer and Physical-Layer Protocols
CN102347814A (zh) * 2011-10-11 2012-02-08 上海电力学院 基于主时钟频率差值的从时钟调整方法
CN102664726A (zh) * 2012-04-26 2012-09-12 华为技术有限公司 Ptp时钟源切换的方法、主从时钟设备及系统

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104602264A (zh) * 2015-01-05 2015-05-06 华为技术有限公司 一种促进控制点发现设备的方法、装置及系统
CN104602264B (zh) * 2015-01-05 2018-01-16 华为技术有限公司 一种促进控制点发现设备的方法、装置及系统
US9912693B1 (en) 2015-04-06 2018-03-06 Sprint Communications Company L.P. Identification of malicious precise time protocol (PTP) nodes

Also Published As

Publication number Publication date
CN102664726B (zh) 2015-08-05
CN102664726A (zh) 2012-09-12

Similar Documents

Publication Publication Date Title
WO2013159486A1 (zh) Ptp时钟源切换的方法、主从时钟设备及系统
US11838106B2 (en) Synchronization method and apparatus
JP6299994B2 (ja) 二重接続における無線リンク障害ハンドリング
JP5124860B2 (ja) ゲートウェイ装置、基地局装置、通信ネットワークおよび同期方法
EP2688240B1 (en) Method, system and device for switching and selecting clock source device
US20110158120A1 (en) Node device
US9955447B2 (en) Clock synchronization method, mobile network system, network controller and network switch
US9288002B2 (en) Method for monitoring and managing data networks
TW201208419A (en) Implicit DRX cycle length adjustment control in LTE_ACTIVE mode
WO2011076062A1 (zh) 一种分层网络中基站的同步处理方法及基站
CN106899370A (zh) 一种时钟链路切换方法、装置及基站
US10355800B2 (en) Multi-path time synchronization
EP2816749A1 (en) Clock synchronization method and device
WO2015165192A1 (zh) 一种时间同步的方法及装置
US20210400610A1 (en) Time synchronization in integrated 5g wireless and time-sensitive networking systems
WO2011134371A1 (zh) 一种同步时钟的方法和时钟同步装置
CN106549724A (zh) 一种时间同步报文的处理方法及装置
WO2017028043A1 (zh) 一种通信网络中的同步方法和设备
US8804770B2 (en) Communications system and related method for reducing continuity check message (CCM) bursts in connectivity fault management (CFM) maintenance association (MA)
EP1991013A1 (en) Method and device for broadcast synchronization in a network
WO2013000235A1 (zh) 一种终端切换的方法及装置
Murakami et al. A master redundancy technique in IEEE 1588 synchronization with a link congestion estimation
EP3276898B1 (en) Resource switching method and apparatus
KR20100048124A (ko) 근거리 통신망에서의 시간 동기화 방법
JP5656306B1 (ja) 同期確立方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12875388

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12875388

Country of ref document: EP

Kind code of ref document: A1