Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6561: Add vrf aware for show ntp #4003

Merged
merged 1 commit into from
Aug 22, 2024
Merged

Conversation

sever-sever
Copy link
Member

@sever-sever sever-sever commented Aug 22, 2024

Change Summary

Add vrf aware for show ntp

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

Proposed changes

How to test

set interfaces ethernet eth0 address '192.168.122.14/24'
set interfaces ethernet eth0 vrf 'MGMT'
set service ntp allow-client address '127.0.0.0/8'
set service ntp allow-client address '169.254.0.0/16'
set service ntp allow-client address '10.0.0.0/8'
set service ntp allow-client address '172.16.0.0/12'
set service ntp allow-client address '192.168.0.0/16'
set service ntp allow-client address '::1/128'
set service ntp allow-client address 'fe80::/10'
set service ntp allow-client address 'fc00::/7'
set service ntp server time1.vyos.net
set service ntp server time2.vyos.net
set service ntp server time3.vyos.net
set service ntp vrf 'MGMT'
set service ssh vrf 'MGMT'
set service ssh vrf 'default'
set vrf bind-to-all
set vrf name MGMT protocols static route 0.0.0.0/0 next-hop 192.168.122.1
set vrf name MGMT table '123'

Before the fix:

$ show ntp
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/ntp.py", line 159, in <module>
    res = vyos.opmode.run(sys.modules[__name__])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/opmode.py", line 263, in run
    res = func(**args)
          ^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/ntp.py", line 155, in show_sourcestats
    return cmd(command)
           ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/utils/process.py", line 155, in cmd
    raise OSError(code, feedback)
PermissionError: [Errno 1] failed to run command: chronyc sourcestats -v
returned: 506 Cannot talk to daemon
exit code: 1

After the fix:

vyos@r14:~$ show ntp 
.- Number of sample points in measurement set.
                            /    .- Number of residual runs with same sign.
                           |    /    .- Length of measurement set (time).
                           |   |    /      .- Est. clock freq error (ppm).
                           |   |   |      /           .- Est. error in freq.
                           |   |   |     |           /         .- Est. offset.
                           |   |   |     |          |          |   On the -.
                           |   |   |     |          |          |   samples. \
                           |   |   |     |          |          |             |
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
ec2-34-206-168-146.compu>  31  15   70m     +0.225      0.056  +1275us   112us
ec2-18-193-41-138.eu-cen>  31  13   70m     -0.305      0.070   -942us   119us
ec2-122-248-201-177.ap-s>   6   3   52m     -2.587      0.901   +332us   252us
vyos@r14:~$ 
vyos@r14:~$ 

vyos@r14:~$ show ntp activity 
200 OK
3 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address
vyos@r14:~$ 
vyos@r14:~$ 
vyos@r14:~$ show ntp sources 
.-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^+ ec2-34-206-168-146.compu>     3  10   377   310  +1101us[+1101us] +/-  130ms
^* ec2-18-193-41-138.eu-cen>     3  10   377   323   -814us[ -880us] +/-   86ms
^- ec2-122-248-201-177.ap-s>     2   8   337   822  +1095us[+1032us] +/-  174ms
vyos@r14:~$ 
vyos@r14:~$ 

vyos@r14:~$ show ntp system 
Reference ID    : 12C1298A (ec2-18-193-41-138.eu-central-1.compute.amazonaws.com)
Stratum         : 4
Ref time (UTC)  : Thu Aug 22 13:10:15 2024
System time     : 0.000009878 seconds fast of NTP time
Last offset     : -0.000066325 seconds
RMS offset      : 0.000187446 seconds
Frequency       : 19.087 ppm slow
Residual freq   : -0.001 ppm
Skew            : 0.053 ppm
Root delay      : 0.045273069 seconds
Root dispersion : 0.052451510 seconds
Update interval : 516.6 seconds
Leap status     : Normal
vyos@r14:~$ 
vyos@r14:~$ 

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@sever-sever sever-sever requested a review from a team as a code owner August 22, 2024 13:16
Copy link

github-actions bot commented Aug 22, 2024

👍
No issues in PR Title / Commit Title

Copy link

✅ No issues found in unused-imports check.. Please refer the workflow run

@sever-sever sever-sever enabled auto-merge (rebase) August 22, 2024 13:37
@c-po
Copy link
Member

c-po commented Aug 22, 2024

@Mergifyio backport sagitta circinus

Copy link
Contributor

mergify bot commented Aug 22, 2024

backport sagitta circinus

✅ Backports have been created

@sever-sever sever-sever merged commit 5f780eb into vyos:current Aug 22, 2024
14 of 15 checks passed
c-po added a commit that referenced this pull request Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants