@@ -1928,22 +1928,15 @@ def bgp(verbose):
1928
1928
@click .option ('--verbose' , is_flag = True , help = "Enable verbose output" )
1929
1929
def ntp (ctx , verbose ):
1930
1930
"""Show NTP information"""
1931
- from pkg_resources import parse_version
1932
- ntpstat_cmd = ["ntpstat" ]
1933
- ntpcmd = ["ntpq" , "-p" , "-n" ]
1931
+ chronyc_tracking_cmd = ["chronyc" , "tracking" ]
1932
+ chronyc_sources_cmd = ["chronyc" , "sources" ]
1934
1933
if is_mgmt_vrf_enabled (ctx ) is True :
1935
- #ManagementVRF is enabled. Call ntpq using "ip vrf exec" or cgexec based on linux version
1936
- os_info = os .uname ()
1937
- release = os_info [2 ].split ('-' )
1938
- if parse_version (release [0 ]) > parse_version ("4.9.0" ):
1939
- ntpstat_cmd = ['sudo' , 'ip' , 'vrf' , 'exec' , 'mgmt' , 'ntpstat' ]
1940
- ntpcmd = ['sudo' , 'ip' , 'vrf' , 'exec' , 'mgmt' , 'ntpq' , '-p' , '-n' ]
1941
- else :
1942
- ntpstat_cmd = ['sudo' , 'cgexec' , '-g' , 'l3mdev:mgmt' , 'ntpstat' ]
1943
- ntpcmd = ['sudo' , 'cgexec' , '-g' , 'l3mdev:mgmt' , 'ntpq' , '-p' , '-n' ]
1934
+ #ManagementVRF is enabled. Call chronyc using "ip vrf exec" based on linux version
1935
+ chronyc_tracking_cmd = ["sudo" , "ip" , "vrf" , "exec" , "mgmt" ] + chronyc_tracking_cmd
1936
+ chronyc_sources_cmd = ["sudo" , "ip" , "vrf" , "exec" , "mgmt" ] + chronyc_sources_cmd
1944
1937
1945
- run_command (ntpstat_cmd , display_cmd = verbose )
1946
- run_command (ntpcmd , display_cmd = verbose )
1938
+ run_command (chronyc_tracking_cmd , display_cmd = verbose )
1939
+ run_command (chronyc_sources_cmd , display_cmd = verbose )
1947
1940
1948
1941
#
1949
1942
# 'uptime' command ("show uptime")
0 commit comments