Skip to content

Commit

Permalink
Remove unused parts
Browse files Browse the repository at this point in the history
  • Loading branch information
xincunli-sonic committed Jun 5, 2024
1 parent 3569037 commit fbbc34e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,6 @@ def replace(ctx, target_file_path, format, dry_run, ignore_non_yang_tables, igno
click.secho("Failed to replace config", fg="red", underline=True, err=True)
ctx.fail(ex)


@config.command()
@click.argument('checkpoint-name', type=str, required=True)
@click.option('-d', '--dry-run', is_flag=True, default=False, help='test out the command without affecting config state')
Expand Down
7 changes: 2 additions & 5 deletions generic_config_updater/change_applier.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

print_to_console = False


def set_verbose(verbose=False):
global print_to_console, logger

Expand All @@ -39,6 +40,7 @@ def get_config_db(scope=multi_asic.DEFAULT_NAMESPACE):
config_db.connect()
return config_db


def set_config(config_db, tbl, key, data):
config_db.set_entry(tbl, key, data)

Expand All @@ -61,11 +63,9 @@ class DryRunChangeApplier:
def __init__(self, config_wrapper):
self.config_wrapper = config_wrapper


def apply(self, change):
self.config_wrapper.apply_change_to_config_db(change)


def remove_backend_tables_from_config(self, data):
return data

Expand All @@ -86,7 +86,6 @@ def __init__(self, scope=multi_asic.DEFAULT_NAMESPACE):
with open(UPDATER_CONF_FILE, "r") as s:
ChangeApplier.updater_conf = json.load(s)


def _invoke_cmd(self, cmd, old_cfg, upd_cfg, keys):
# cmd is in the format as <package/module name>.<method name>
#
Expand All @@ -98,7 +97,6 @@ def _invoke_cmd(self, cmd, old_cfg, upd_cfg, keys):

return method_to_call(old_cfg, upd_cfg, keys)


def _services_validate(self, old_cfg, upd_cfg, keys):
lst_svcs = set()
lst_cmds = set()
Expand All @@ -124,7 +122,6 @@ def _services_validate(self, old_cfg, upd_cfg, keys):
log_debug("service invoked: {}".format(cmd))
return 0


def _upd_data(self, tbl, run_tbl, upd_tbl, upd_keys):
for key in set(run_tbl.keys()).union(set(upd_tbl.keys())):
run_data = run_tbl.get(key, None)
Expand Down
2 changes: 1 addition & 1 deletion generic_config_updater/generic_updater.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import subprocess
import jsonpointer
import os
import subprocess

from enum import Enum
from .gu_common import HOST_NAMESPACE, GenericConfigUpdaterError, EmptyTableError, ConfigWrapper, \
Expand Down
4 changes: 0 additions & 4 deletions tests/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,6 @@ def test_replace__help__gets_help_msg(self):
self.assertEqual(expected_exit_code, result.exit_code)
self.assertTrue(expected_output in result.output)

@patch('config.main.SonicYangCfgDbGenerator.validate_config_db_json', mock.Mock(return_value=True))
def test_replace__only_required_params__default_values_used_for_optional_params(self):
# Arrange
expected_exit_code = 0
Expand All @@ -1440,7 +1439,6 @@ def test_replace__only_required_params__default_values_used_for_optional_params(
mock_generic_updater.replace.assert_called_once()
mock_generic_updater.replace.assert_has_calls([expected_call_with_default_values])

@patch('config.main.SonicYangCfgDbGenerator.validate_config_db_json', mock.Mock(return_value=True))
def test_replace__all_optional_params_non_default__non_default_values_used(self):
# Arrange
expected_exit_code = 0
Expand Down Expand Up @@ -1470,7 +1468,6 @@ def test_replace__all_optional_params_non_default__non_default_values_used(self)
mock_generic_updater.replace.assert_called_once()
mock_generic_updater.replace.assert_has_calls([expected_call_with_non_default_values])

@patch('config.main.SonicYangCfgDbGenerator.validate_config_db_json', mock.Mock(return_value=True))
def test_replace__exception_thrown__error_displayed_error_code_returned(self):
# Arrange
unexpected_exit_code = 0
Expand All @@ -1489,7 +1486,6 @@ def test_replace__exception_thrown__error_displayed_error_code_returned(self):
self.assertNotEqual(unexpected_exit_code, result.exit_code)
self.assertTrue(any_error_message in result.output)

@patch('config.main.SonicYangCfgDbGenerator.validate_config_db_json', mock.Mock(return_value=True))
def test_replace__optional_parameters_passed_correctly(self):
self.validate_replace_optional_parameter(
["--format", ConfigFormat.SONICYANG.name],
Expand Down

0 comments on commit fbbc34e

Please sign in to comment.