Skip to content

Commit 8473517

Browse files
Revert "[config reload]: On dual ToR systems, cache ARP and FDB table… (sonic-net#2460)
…s (sonic-net#1465)" - This reverts commit 10de91d. - Also removes '--disable-arp-cache' option from config reload tests that was added in sonic-net#2325 Signed-off-by: Lawrence Lee <[email protected]>
1 parent 4a3d49d commit 8473517

File tree

2 files changed

+6
-46
lines changed

2 files changed

+6
-46
lines changed

config/main.py

+1-41
Original file line numberDiff line numberDiff line change
@@ -1082,38 +1082,6 @@ def update_sonic_environment():
10821082
display_cmd=True
10831083
)
10841084

1085-
def cache_arp_entries():
1086-
success = True
1087-
cache_dir = '/host/config-reload'
1088-
click.echo('Caching ARP table to {}'.format(cache_dir))
1089-
1090-
if not os.path.exists(cache_dir):
1091-
os.mkdir(cache_dir)
1092-
1093-
arp_cache_cmd = '/usr/local/bin/fast-reboot-dump.py -t {}'.format(cache_dir)
1094-
cache_proc = subprocess.Popen(arp_cache_cmd, shell=True, text=True, stdout=subprocess.PIPE)
1095-
_, cache_err = cache_proc.communicate()
1096-
if cache_err:
1097-
click.echo("Could not cache ARP and FDB info prior to reloading")
1098-
success = False
1099-
1100-
if not cache_err:
1101-
fdb_cache_file = os.path.join(cache_dir, 'fdb.json')
1102-
arp_cache_file = os.path.join(cache_dir, 'arp.json')
1103-
fdb_filter_cmd = '/usr/local/bin/filter_fdb_entries -f {} -a {} -c /etc/sonic/configdb.json'.format(fdb_cache_file, arp_cache_file)
1104-
filter_proc = subprocess.Popen(fdb_filter_cmd, shell=True, text=True, stdout=subprocess.PIPE)
1105-
_, filter_err = filter_proc.communicate()
1106-
if filter_err:
1107-
click.echo("Could not filter FDB entries prior to reloading")
1108-
success = False
1109-
1110-
# If we are able to successfully cache ARP table info, signal SWSS to restore from our cache
1111-
# by creating /host/config-reload/needs-restore
1112-
if success:
1113-
restore_flag_file = os.path.join(cache_dir, 'needs-restore')
1114-
open(restore_flag_file, 'w').close()
1115-
return success
1116-
11171085
def remove_router_interface_ip_address(config_db, interface_name, ipaddress_to_remove):
11181086
table_name = get_interface_table_name(interface_name)
11191087
keys = config_db.get_keys(table_name)
@@ -1520,12 +1488,11 @@ def list_checkpoints(ctx, verbose):
15201488
@click.option('-y', '--yes', is_flag=True)
15211489
@click.option('-l', '--load-sysinfo', is_flag=True, help='load system default information (mac, portmap etc) first.')
15221490
@click.option('-n', '--no_service_restart', default=False, is_flag=True, help='Do not restart docker services')
1523-
@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)')
15241491
@click.option('-f', '--force', default=False, is_flag=True, help='Force config reload without system checks')
15251492
@click.option('-t', '--file_format', default='config_db',type=click.Choice(['config_yang', 'config_db']),show_default=True,help='specify the file format')
15261493
@click.argument('filename', required=False)
15271494
@clicommon.pass_db
1528-
def reload(db, filename, yes, load_sysinfo, no_service_restart, disable_arp_cache, force, file_format):
1495+
def reload(db, filename, yes, load_sysinfo, no_service_restart, force, file_format):
15291496
"""Clear current configuration and import a previous saved config DB dump file.
15301497
<filename> : Names of configuration file(s) to load, separated by comma with no spaces in between
15311498
"""
@@ -1569,13 +1536,6 @@ def reload(db, filename, yes, load_sysinfo, no_service_restart, disable_arp_cach
15691536
click.echo("Input {} config file(s) separated by comma for multiple files ".format(num_cfg_file))
15701537
return
15711538

1572-
# For dual ToR devices, cache ARP and FDB info
1573-
localhost_metadata = db.cfgdb.get_table('DEVICE_METADATA')['localhost']
1574-
cache_arp_table = not disable_arp_cache and 'subtype' in localhost_metadata and localhost_metadata['subtype'].lower() == 'dualtor'
1575-
1576-
if cache_arp_table:
1577-
cache_arp_entries()
1578-
15791539
#Stop services before config push
15801540
if not no_service_restart:
15811541
log.log_info("'reload' stopping services...")

tests/config_test.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def test_config_reload(self, get_cmd_module, setup_single_broadcom_asic):
224224
obj = {'config_db': db.cfgdb}
225225

226226
# simulate 'config reload' to provoke load_sys_info option
227-
result = runner.invoke(config.config.commands["reload"], ["-l", "-n", "-y", "--disable_arp_cache"], obj=obj)
227+
result = runner.invoke(config.config.commands["reload"], ["-l", "-n", "-y"], obj=obj)
228228

229229
print(result.exit_code)
230230
print(result.output)
@@ -498,7 +498,7 @@ def test_reload_config(self, get_cmd_module, setup_single_broadcom_asic):
498498

499499
result = runner.invoke(
500500
config.config.commands["reload"],
501-
[self.dummy_cfg_file, '-y', '-f', "--disable_arp_cache"])
501+
[self.dummy_cfg_file, '-y', '-f'])
502502

503503
print(result.exit_code)
504504
print(result.output)
@@ -515,7 +515,7 @@ def test_config_reload_disabled_service(self, get_cmd_module, setup_single_broad
515515
(config, show) = get_cmd_module
516516

517517
runner = CliRunner()
518-
result = runner.invoke(config.config.commands["reload"], [self.dummy_cfg_file, "-y", "--disable_arp_cache"])
518+
result = runner.invoke(config.config.commands["reload"], [self.dummy_cfg_file, "-y"])
519519

520520
print(result.exit_code)
521521
print(result.output)
@@ -540,7 +540,7 @@ def test_reload_config_masic(self, get_cmd_module, setup_multi_broadcom_masic):
540540
self.dummy_cfg_file)
541541
result = runner.invoke(
542542
config.config.commands["reload"],
543-
[cfg_files, '-y', '-f', "--disable_arp_cache"])
543+
[cfg_files, '-y', '-f'])
544544

545545
print(result.exit_code)
546546
print(result.output)
@@ -559,7 +559,7 @@ def test_reload_yang_config(self, get_cmd_module,
559559
runner = CliRunner()
560560

561561
result = runner.invoke(config.config.commands["reload"],
562-
[self.dummy_cfg_file, "--disable_arp_cache", '-y', '-f', '-t', 'config_yang'])
562+
[self.dummy_cfg_file, '-y', '-f', '-t', 'config_yang'])
563563

564564
print(result.exit_code)
565565
print(result.output)

0 commit comments

Comments
 (0)