Clock source selection method, apparatus, and system, and storage medium
After a first network device traces a clock of a second network device, when the first network device cannot trace the clock of the second network device, the first network device modifies a parameter value corresponding to a synchronization source selection parameter of the first network device to a first parameter value, where the first parameter value is superior to a parameter value corresponding to a synchronization source selection parameter of the second network device.
1 . A method, comprising:
performing, by a first network device, a trace of a clock of a second network device based on a second parameter value being inferior to a third parameter value according to a comparison operation configured in the first network device, wherein the second parameter value corresponds to a synchronization source selection parameter of the first network device and the third parameter value corresponds to a synchronization source selection parameter of the second network device; and
after the first network device performs the trace of the clock of the second network device, in response to the first network device not being able to perform another trace of the clock of the second network device, modifying, by the first network device, the second parameter value corresponding to the synchronization source selection parameter of the first network device to a first parameter value, wherein the first parameter value is superior to the third parameter value corresponding to the synchronization source selection parameter of the second network device according to the comparison operation configured in the first network device.
2 . The method according to claim 1 , wherein the synchronization source selection parameter of the first network device comprises a local priority (localPriority) parameter of the first network device, and the first parameter value comprises a first priority parameter value; and
wherein modifying, by the first network device, the second parameter value corresponding to the synchronization source selection parameter of the first network device to the first parameter value comprises:
modifying, by the first network device, a second priority parameter value corresponding to the localPriority parameter of the first network device to the first priority parameter value.
3 . The method according to claim 2 , wherein the second priority parameter value is inferior to a priority parameter value corresponding to a localPriority parameter of a first port according to the comparison operation configured in the first network device, and the first port is a port of the first network device that is configured for communicating with the second network device.
4 . The method according to claim 2 , wherein the first priority parameter value is superior to the priority parameter value corresponding to the localPriority parameter of a first port according to the comparison operation configured in the first network device, and the first port is a port of the first network device that is configured for communicating with the second network device.
5 . The method according to claim 2 , wherein the second priority parameter value is equal to a priority parameter value corresponding to a localPriority parameter of the second network device.
6 . The method according to claim 2 , further comprising:
after modifying, by the first network device, the second parameter value corresponding to the synchronization source selection parameter of the first network device to the first parameter value, selecting, by the first network device, a synchronization tracing source based on the first priority parameter value.
7 . The method according to claim 6 , wherein selecting, by the first network device, the synchronization tracing source based on the first priority parameter value comprises:
when receiving a packet from the second network device through a first port, comparing, by the first network device, the first priority parameter value with a priority parameter value corresponding to the localPriority parameter of the first port, wherein the first port is on the first network device and is configured for communicating with the second network device; and
when determining by comparison that the first priority parameter value is superior to the priority parameter value corresponding to the localPriority parameter of the first port, selecting, by the first network device, the first network device as the synchronization tracing source.
8 . The method according to claim 1 , wherein the synchronization source selection parameter of the first network device comprises a clock quality parameter of the first network device, and the first parameter value comprises a first clock quality parameter value; and
wherein modifying, by the first network device, the second parameter value corresponding to the synchronization source selection parameter of the first network device to the first parameter value comprises:
modifying, by the first network device, a clock quality parameter value corresponding to the clock quality parameter of the first network device to the first clock quality parameter value.
9 . The method according to claim 8 , wherein the clock quality parameter of the first network device comprises one or more of a clock class, clock accuracy, or an offset scaled log variance of the first network device.
10 . The method according to claim 8 , further comprising:
selecting, by the first network device, a synchronization tracing source based on the first clock quality parameter value.
11 . An apparatus, comprising:
at least one processor; and
a non-transitory computer readable storage medium storing instructions that are executable by the at least one processor, the instructions including instructions for:
performing a trace of a clock of a second network device based on a second parameter value being inferior to a third parameter value according to a comparison operation configured in the apparatus, wherein the second parameter value corresponds to a synchronization source selection parameter of a first network device and the third parameter value corresponds to a synchronization source selection parameter of the second network device; and
after performing the trace of the clock of the second network device, in response to the apparatus not being able to perform another trace of the clock of the second network device, modifying the second parameter value corresponding to a synchronization source selection parameter of the apparatus to a first parameter value, wherein the first parameter value is superior to the third parameter value corresponding to the synchronization source selection parameter of the second network device according to the comparison operation configured in the apparatus.
12 . The apparatus according to claim 11 , wherein the synchronization source selection parameter of the apparatus comprises a local priority (localPriority) parameter of the apparatus, and the first parameter value comprises a first priority parameter value; and
wherein the instructions include instructions for modifying a second priority parameter value corresponding to the localPriority parameter of the apparatus to the first priority parameter value.
13 . The apparatus according to claim 12 , wherein the second priority parameter value is inferior to a priority parameter value corresponding to a localPriority parameter of a first port according to the comparison operation configured in the apparatus, and the first port is a port of the apparatus that is configured for communicating with the second network device.
14 . The apparatus according to claim 12 , wherein the first priority parameter value is superior to a priority parameter value corresponding to a localPriority parameter of a first port according to the comparison operation configured in the apparatus, and the first port is a port of the apparatus that is configured for communicating with the second network device.
15 . The apparatus according to claim 12 , wherein the second priority parameter value is equal to a priority parameter value corresponding to a localPriority parameter of the second network device.
16 . The apparatus according to claim 12 , wherein the instructions further include instructions for:
after modifying the second parameter value corresponding to the synchronization source selection parameter of the apparatus to the first parameter value, selecting a synchronization tracing source based on the first priority parameter value.
17 . The apparatus according to claim 16 , wherein the instructions further include instructions for:
when receiving a packet from the second network device through a first port, comparing the first priority parameter value with a priority parameter value corresponding to a localPriority parameter of the first port, wherein the first port is a port of the apparatus that is configured for communicating with the second network device; and
when determining by comparison that the first priority parameter value is superior to the priority parameter value corresponding to the localPriority parameter of the first port, selecting the apparatus as the synchronization tracing source.
18 . The apparatus according to claim 11 , wherein the synchronization source selection parameter of the apparatus comprises a clock quality parameter of the apparatus, and the first parameter value comprises a first clock quality parameter value; and
wherein the instructions further include instructions for modifying a clock quality parameter value corresponding to the clock quality parameter of the apparatus to the first clock quality parameter value.
19 . The apparatus according to claim 18 , wherein the clock quality parameter of the apparatus comprises one or more of a clock class, clock accuracy, or an offset scaled log variance of the apparatus.
20 . The apparatus according to claim 18 , wherein the instructions further include instructions for:
selecting a synchronization tracing source based on the first clock quality parameter value.