diff --git a/config/main.py b/config/main.py index b5d7d0a210..14ad672259 100644 --- a/config/main.py +++ b/config/main.py @@ -7083,10 +7083,10 @@ def add_ntp_server(ctx, ntp_ip_address, association_type, iburst, version): ctx.fail("Invalid ConfigDB. Error: {}".format(e)) click.echo("NTP server {} added to configuration".format(ntp_ip_address)) try: - click.echo("Restarting ntp-config service...") - clicommon.run_command(['systemctl', 'restart', 'ntp-config'], display_cmd=False) + click.echo("Restarting chrony service...") + clicommon.run_command(['systemctl', 'restart', 'chrony'], display_cmd=False) except SystemExit as e: - ctx.fail("Restart service ntp-config failed with error {}".format(e)) + ctx.fail("Restart service chrony failed with error {}".format(e)) @ntp.command('del') @click.argument('ntp_ip_address', metavar='', required=True) @@ -7107,10 +7107,10 @@ def del_ntp_server(ctx, ntp_ip_address): else: ctx.fail("NTP server {} is not configured.".format(ntp_ip_address)) try: - click.echo("Restarting ntp-config service...") - clicommon.run_command(['systemctl', 'restart', 'ntp-config'], display_cmd=False) + click.echo("Restarting chrony service...") + clicommon.run_command(['systemctl', 'restart', 'chrony'], display_cmd=False) except SystemExit as e: - ctx.fail("Restart service ntp-config failed with error {}".format(e)) + ctx.fail("Restart service chrony failed with error {}".format(e)) # # 'sflow' group ('config sflow ...') diff --git a/show/main.py b/show/main.py index b7e75b24cf..c06398f459 100755 --- a/show/main.py +++ b/show/main.py @@ -1928,22 +1928,15 @@ def bgp(verbose): @click.option('--verbose', is_flag=True, help="Enable verbose output") def ntp(ctx, verbose): """Show NTP information""" - from pkg_resources import parse_version - ntpstat_cmd = ["ntpstat"] - ntpcmd = ["ntpq", "-p", "-n"] + chronyc_tracking_cmd = ["chronyc", "tracking"] + chronyc_sources_cmd = ["chronyc", "sources"] if is_mgmt_vrf_enabled(ctx) is True: - #ManagementVRF is enabled. Call ntpq using "ip vrf exec" or cgexec based on linux version - os_info = os.uname() - release = os_info[2].split('-') - if parse_version(release[0]) > parse_version("4.9.0"): - ntpstat_cmd = ['sudo', 'ip', 'vrf', 'exec', 'mgmt', 'ntpstat'] - ntpcmd = ['sudo', 'ip', 'vrf', 'exec', 'mgmt', 'ntpq', '-p', '-n'] - else: - ntpstat_cmd = ['sudo', 'cgexec', '-g', 'l3mdev:mgmt', 'ntpstat'] - ntpcmd = ['sudo', 'cgexec', '-g', 'l3mdev:mgmt', 'ntpq', '-p', '-n'] + #ManagementVRF is enabled. Call chronyc using "ip vrf exec" based on linux version + chronyc_tracking_cmd = ["sudo", "ip", "vrf", "exec", "mgmt"] + chronyc_tracking_cmd + chronyc_sources_cmd = ["sudo", "ip", "vrf", "exec", "mgmt"] + chronyc_sources_cmd - run_command(ntpstat_cmd, display_cmd=verbose) - run_command(ntpcmd, display_cmd=verbose) + run_command(chronyc_tracking_cmd, display_cmd=verbose) + run_command(chronyc_sources_cmd, display_cmd=verbose) # # 'uptime' command ("show uptime") diff --git a/tests/conftest.py b/tests/conftest.py index 3874668a67..41c9901e86 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -27,7 +27,6 @@ sys.path.insert(0, modules_path) generated_services_list = [ - 'ntp-config.service', 'warmboot-finalizer.service', 'watchdog-control.service', 'rsyslog-config.service',