From b44e153d6d9da942b2654102b9b28dcd843bbd59 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Tue, 20 Dec 2022 16:22:04 -0800 Subject: [PATCH] [202012]Revert "[config reload]: On dual ToR systems, cache ARP and FDB tables (#1465)" (#2490) - This reverts commit 10de91d8c581cd0ed0e5ae79edeb05dfdda4f755. - Also removes '--disable-arp-cache' option from config reload tests that was added in #2325 Signed-off-by: Lawrence Lee --- config/main.py | 43 +--------------------------------------- tests/pgdropstat_test.py | 2 +- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/config/main.py b/config/main.py index 1dd077c463..754ca46ae4 100644 --- a/config/main.py +++ b/config/main.py @@ -926,39 +926,6 @@ def update_sonic_environment(): display_cmd=True ) -def cache_arp_entries(): - success = True - cache_dir = '/host/config-reload' - click.echo('Caching ARP table to {}'.format(cache_dir)) - - if not os.path.exists(cache_dir): - os.mkdir(cache_dir) - - arp_cache_cmd = '/usr/local/bin/fast-reboot-dump.py -t {}'.format(cache_dir) - cache_proc = subprocess.Popen(arp_cache_cmd, shell=True, text=True, stdout=subprocess.PIPE) - _, cache_err = cache_proc.communicate() - if cache_err: - click.echo("Could not cache ARP and FDB info prior to reloading") - success = False - - if not cache_err: - fdb_cache_file = os.path.join(cache_dir, 'fdb.json') - arp_cache_file = os.path.join(cache_dir, 'arp.json') - fdb_filter_cmd = '/usr/local/bin/filter_fdb_entries -f {} -a {} -c /etc/sonic/config_db.json'.format(fdb_cache_file, arp_cache_file) - filter_proc = subprocess.Popen(fdb_filter_cmd, shell=True, text=True, stdout=subprocess.PIPE) - _, filter_err = filter_proc.communicate() - if filter_err: - click.echo("Could not filter FDB entries prior to reloading") - success = False - - # If we are able to successfully cache ARP table info, signal SWSS to restore from our cache - # by creating /host/config-reload/needs-restore - if success: - restore_flag_file = os.path.join(cache_dir, 'needs-restore') - open(restore_flag_file, 'w').close() - return success - - def validate_ipv4_address(ctx, param, ip_addr): """Helper function to validate ipv4 address """ @@ -1169,10 +1136,9 @@ def load(filename, yes): @click.option('-y', '--yes', is_flag=True) @click.option('-l', '--load-sysinfo', is_flag=True, help='load system default information (mac, portmap etc) first.') @click.option('-n', '--no_service_restart', default=False, is_flag=True, help='Do not restart docker services') -@click.option('-d', '--disable_arp_cache', default=False, is_flag=True, help='Do not cache ARP table before reloading (applies to dual ToR systems only)') @click.argument('filename', required=False) @clicommon.pass_db -def reload(db, filename, yes, load_sysinfo, no_service_restart, disable_arp_cache): +def reload(db, filename, yes, load_sysinfo, no_service_restart): """Clear current configuration and import a previous saved config DB dump file. : Names of configuration file(s) to load, separated by comma with no spaces in between """ @@ -1216,13 +1182,6 @@ def reload(db, filename, yes, load_sysinfo, no_service_restart, disable_arp_cach else: cfg_hwsku = cfg_hwsku.strip() - # For dual ToR devices, cache ARP and FDB info - localhost_metadata = db.cfgdb.get_table('DEVICE_METADATA')['localhost'] - cache_arp_table = not disable_arp_cache and 'subtype' in localhost_metadata and localhost_metadata['subtype'].lower() == 'dualtor' - - if cache_arp_table: - cache_arp_entries() - #Stop services before config push if not no_service_restart: log.log_info("'reload' stopping services...") diff --git a/tests/pgdropstat_test.py b/tests/pgdropstat_test.py index a764c66235..2d50231147 100644 --- a/tests/pgdropstat_test.py +++ b/tests/pgdropstat_test.py @@ -93,7 +93,7 @@ def test_show_pg_drop_config_reload(self): self.test_show_pg_drop_clear() # simulate 'config reload' to provoke counters recalculation (remove backup from /tmp folder) - result = runner.invoke(config.config.commands["reload"], [ "--no_service_restart", "--disable_arp_cache", "-y"]) + result = runner.invoke(config.config.commands["reload"], [ "--no_service_restart", "-y"]) print(result.exit_code) print(result.output)