Skip to content

Commit 8b01d3e

Browse files
authored
Remove the warning message appear when there are no ports on CONFIG DB (#2050)
#### What I did Remove the warning of "Configuration database contains no ports" when ports table is empty. Because when having a system with zero ports, this message appear per each access to ports tables on CONFIG DB For example: Run any cli command. For example "show boot" or "show int st" Observed behavior root@r-sn4800-simx:/home/admin# show boot Configuration database contains no ports Configuration database contains no ports Configuration database contains no ports #### How I did it Remove the warning and remove the unit test verify this warning #### How to verify it Remove all the ports and verify there is no such warning in case of running "show interface status" CLi command #### Previous command output (if the output of a command-line utility has changed) Configuration database contains no ports Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC ----------- ------- ------- ----- ----- ------- ------ ------ ------- ------ ---------- #### New command output (if the output of a command-line utility has changed) Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC ----------- ------- ------- ----- ----- ------- ------ ------ ------- ------ ----------
1 parent ed6e66e commit 8b01d3e

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

tests/interfaces_test.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def test_show_interfaces_portchannel_in_alias_mode(self):
293293
traceback.print_tb(result.exc_info[2])
294294
assert result.exit_code == 0
295295
assert result.output == show_interfaces_portchannel_in_alias_mode_output
296-
296+
297297
@mock.patch('sonic_py_common.multi_asic.get_port_table', mock.MagicMock(return_value={}))
298298
def test_supervisor_show_interfaces_alias_etp1_with_waring(self):
299299
runner = CliRunner()
@@ -303,8 +303,7 @@ def test_supervisor_show_interfaces_alias_etp1_with_waring(self):
303303
print(result.exit_code)
304304
print(result.output)
305305
assert result.exit_code != 0
306-
assert "Configuration database contains no ports" in result.output
307-
306+
308307
@mock.patch('sonic_py_common.multi_asic.get_port_table', mock.MagicMock(return_value={}))
309308
@mock.patch('sonic_py_common.device_info.is_supervisor', mock.MagicMock(return_value=True))
310309
def test_supervisor_show_interfaces_alias_etp1_without_waring(self):
@@ -315,8 +314,7 @@ def test_supervisor_show_interfaces_alias_etp1_without_waring(self):
315314
print(result.exit_code)
316315
print(result.output)
317316
assert result.exit_code != 0
318-
assert "Configuration database contains no ports" not in result.output
319-
317+
320318
@classmethod
321319
def teardown_class(cls):
322320
print("TEARDOWN")

utilities_common/cli.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import netaddr
1111

1212
from natsort import natsorted
13-
from sonic_py_common import multi_asic, device_info
13+
from sonic_py_common import multi_asic
1414
from utilities_common.db import Db
1515
from utilities_common.general import load_db_config
1616

@@ -131,8 +131,6 @@ def __init__(self, db=None):
131131

132132

133133
if not self.port_dict:
134-
if not device_info.is_supervisor():
135-
click.echo(message="Configuration database contains no ports")
136134
self.port_dict = {}
137135

138136
for port_name in self.port_dict:

0 commit comments

Comments
 (0)