diff --git a/scripts/dropconfig b/scripts/dropconfig index 79f4b2f906..2f1cd98454 100755 --- a/scripts/dropconfig +++ b/scripts/dropconfig @@ -326,7 +326,8 @@ class DropConfigWrapper(object): def __init__(self, namespace): self.namespace = namespace if namespace is not None and namespace not in multi_asic.get_namespace_list(): - print('Encountered error, namespace not recognized: {}. Valid namespaces {}'.format(namespace, get_namespace_list())) + print('Encountered error, namespace not recognized: {}. Valid namespaces {}'.format(namespace, + multi_asic.get_namespace_list())) sys.exit(1) # Initialize the multi-asic namespace diff --git a/tests/config_test.py b/tests/config_test.py index 863ae485b4..41304f92f3 100644 --- a/tests/config_test.py +++ b/tests/config_test.py @@ -3182,6 +3182,7 @@ def test_remove_reasons(self, mock_run_command): def teardown(self): print("TEARDOWN") + class TestConfigDropcountersMasic(object): def setup(self): print("SETUP") @@ -3206,22 +3207,29 @@ def test_install_multi_asic(self, mock_run_command): namespace = 'asic0' runner = CliRunner() - result = runner.invoke(config.config.commands['dropcounters'].commands['install'], [counter_name, counter_type, reasons, '-d', desc, '-g', group, '-a', alias, '-n', namespace]) + result = runner.invoke(config.config.commands['dropcounters'].commands['install'], + [counter_name, counter_type, reasons, '-d', desc, '-g', group, '-a', + alias, '-n', namespace]) print(result.exit_code) print(result.output) assert result.exit_code == 0 - mock_run_command.assert_called_once_with(['dropconfig', '-c', 'install', '-n', str(counter_name), '-t', str(counter_type), '-r', str(reasons), '-a', str(alias), '-g', str(group), '-d', str(desc), '-ns', str(namespace)], display_cmd=False) + mock_run_command.assert_called_once_with(['dropconfig', '-c', 'install', '-n', str(counter_name), + '-t', str(counter_type), '-r', str(reasons), '-a', str(alias), + '-g', str(group), '-d', str(desc), + '-ns', str(namespace)], display_cmd=False) @patch('utilities_common.cli.run_command') def test_delete_multi_asic(self, mock_run_command): counter_name = 'DEBUG_2' namespace = 'asic0' runner = CliRunner() - result = runner.invoke(config.config.commands['dropcounters'].commands['delete'], [counter_name, '-v', '-n', namespace]) + result = runner.invoke(config.config.commands['dropcounters'].commands['delete'], + [counter_name, '-v', '-n', namespace]) print(result.exit_code) print(result.output) assert result.exit_code == 0 - mock_run_command.assert_called_once_with(['dropconfig', '-c', 'uninstall', '-n', str(counter_name), '-ns', namespace], display_cmd=True) + mock_run_command.assert_called_once_with(['dropconfig', '-c', 'uninstall', '-n', + str(counter_name), '-ns', namespace], display_cmd=True) @patch('utilities_common.cli.run_command') def test_add_reasons_multi_asic(self, mock_run_command): @@ -3229,11 +3237,14 @@ def test_add_reasons_multi_asic(self, mock_run_command): reasons = '[EXCEEDS_L2_MTU,DECAP_ERROR]' namespace = 'asic0' runner = CliRunner() - result = runner.invoke(config.config.commands['dropcounters'].commands['add-reasons'], [counter_name, reasons, '-v', '-n', namespace]) + result = runner.invoke(config.config.commands['dropcounters'].commands['add-reasons'], + [counter_name, reasons, '-v', '-n', namespace]) print(result.exit_code) print(result.output) assert result.exit_code == 0 - mock_run_command.assert_called_once_with(['dropconfig', '-c', 'add', '-n', str(counter_name), '-r', str(reasons), '-ns', namespace], display_cmd=True) + mock_run_command.assert_called_once_with(['dropconfig', '-c', 'add', '-n', + str(counter_name), '-r', str(reasons), '-ns', namespace], + display_cmd=True) @patch('utilities_common.cli.run_command') def test_remove_reasons_multi_asic(self, mock_run_command): @@ -3241,11 +3252,13 @@ def test_remove_reasons_multi_asic(self, mock_run_command): reasons = '[EXCEEDS_L2_MTU,DECAP_ERROR]' namespace = 'asic0' runner = CliRunner() - result = runner.invoke(config.config.commands['dropcounters'].commands['remove-reasons'], [counter_name, reasons, '-v', '-n', namespace]) + result = runner.invoke(config.config.commands['dropcounters'].commands['remove-reasons'], + [counter_name, reasons, '-v', '-n', namespace]) print(result.exit_code) print(result.output) assert result.exit_code == 0 - mock_run_command.assert_called_once_with(['dropconfig', '-c', 'remove', '-n', str(counter_name), '-r', str(reasons), '-ns', namespace], display_cmd=True) + mock_run_command.assert_called_once_with(['dropconfig', '-c', 'remove', '-n', str(counter_name), + '-r', str(reasons), '-ns', namespace], display_cmd=True) @classmethod def teardown_class(cls): diff --git a/tests/drops_group_test.py b/tests/drops_group_test.py index b590b184a9..64c30abf98 100644 --- a/tests/drops_group_test.py +++ b/tests/drops_group_test.py @@ -201,7 +201,8 @@ def test_show_configuration(self): def test_show_configuration_with_group(self): runner = CliRunner() - result = runner.invoke(show.cli.commands["dropcounters"].commands["configuration"], ["-g", "PACKET_DROPS", '-n', 'asic0']) + result = runner.invoke(show.cli.commands["dropcounters"].commands["configuration"], + ["-g", "PACKET_DROPS", '-n', 'asic0']) print(result.output) assert result.output == "For namespace: asic0\n" + expected_counter_configuration_with_group diff --git a/tests/multi_asic_dropstat_test.py b/tests/multi_asic_dropstat_test.py index 8b9dd72826..840f58b358 100644 --- a/tests/multi_asic_dropstat_test.py +++ b/tests/multi_asic_dropstat_test.py @@ -16,9 +16,9 @@ Ethernet-BP0 U 0 1000 0 0 800 100 Ethernet-BP4 U 0 1000 0 0 800 100 - DEVICE DEBUG_1 ----------------- --------- -sonic_drops_test 1000 + DEVICE SWITCH_DROPS +---------------- -------------- +sonic_drops_test 1000 """ dropstat_masic_result_asic1 = """\ @@ -40,9 +40,9 @@ Ethernet-BP0 U 0 0 0 0 0 0 Ethernet-BP4 U 0 0 0 0 0 0 - DEVICE DEBUG_1 ----------------- --------- -sonic_drops_test 0 + DEVICE SWITCH_DROPS +---------------- -------------- +sonic_drops_test 0 IFACE STATE RX_ERR RX_DROPS TX_ERR TX_DROPS DEBUG_0 DEBUG_2 -------------- ------- -------- ---------- -------- ---------- --------- --------- Ethernet-BP256 U 0 0 0 0 0 0