Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Currently, this list of dependencies is as follows:
- libyang-cpp_1.0.73_amd64.deb
- python3-yang_1.0.73_amd64.deb
- redis_dump_load-1.1-py3-none-any.whl
- swsssdk-2.0.1-py3-none-any.whl
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swsssdk

Add "python-swsscommon_1.0.0_amd64.deb" into the list? #Closed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

- sonic_py_common-1.0-py3-none-any.whl
- sonic_config_engine-1.0-py3-none-any.whl
- sonic_yang_mgmt-1.0-py3-none-any.whl
Expand Down
2 changes: 1 addition & 1 deletion config/config_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import sonic_yang
from jsondiff import diff
from swsssdk import port_util
from sonic_py_common import port_util
from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector
from utilities_common.general import load_module_from_source

Expand Down
2 changes: 1 addition & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6539,7 +6539,7 @@ def rate():
@click.argument('rates_type', type=click.Choice(['all', 'port', 'rif', 'flowcnt-trap']), default='all')
def smoothing_interval(interval, rates_type):
"""Set rates smoothing interval """
counters_db = swsssdk.SonicV2Connector()
counters_db = SonicV2Connector()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following API missing in sonic-swss-common:

int64_t SonicV2Connector_Native::set(const std::string& db_name, const std::string& _hash, const std::string& key, const int val, bool blocking=false);

So this PR need wait for swss-common add the missing API first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create another PR to add the set method:

sonic-net/sonic-swss-common#648

counters_db.connect('COUNTERS_DB')

alpha = 2.0/(interval + 1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/fdbshow
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ try: # pragma: no cover
except KeyError: # pragma: no cover
pass

from swsssdk import port_util
from sonic_py_common import port_util
from swsscommon.swsscommon import SonicV2Connector
from tabulate import tabulate

Expand Down
2 changes: 1 addition & 1 deletion scripts/nbrshow
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import subprocess
import re

from natsort import natsorted
from swsssdk import port_util
from sonic_py_common import port_util
from swsscommon.swsscommon import SonicV2Connector
from tabulate import tabulate

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
'sonic-platform-common',
'sonic-py-common',
'sonic-yang-mgmt',
'swsssdk>=2.0.1',
'tabulate==0.8.2',
'toposort==1.6',
'www-authenticate==0.9.2',
Expand Down
27 changes: 27 additions & 0 deletions tests/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1486,3 +1486,30 @@ def teardown_class(cls):
from .mock_tables import mock_single_asic
importlib.reload(mock_single_asic)
dbconnector.load_namespace_config()

class TestConfigRate(object):
@classmethod
def setup_class(cls):
os.environ['UTILITIES_UNIT_TESTING'] = "1"
print("SETUP")

import config.main
importlib.reload(config.main)

def test_config_rate(self, get_cmd_module, setup_single_broadcom_asic):
with mock.patch("utilities_common.cli.run_command", mock.MagicMock(side_effect=mock_run_command_side_effect)) as mock_run_command:
(config, show) = get_cmd_module

runner = CliRunner()
result = runner.invoke(config.config.commands["rate"], ["smoothing-interval", "500"])

print(result.exit_code)
print(result.output)
traceback.print_tb(result.exc_info[2])

assert result.exit_code == 0

@classmethod
def teardown_class(cls):
print("TEARDOWN")
os.environ['UTILITIES_UNIT_TESTING'] = "0"
2 changes: 1 addition & 1 deletion tests/db_migrator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from deepdiff import DeepDiff

from swsssdk import SonicV2Connector
from swsscommon.swsscommon import SonicV2Connector
from sonic_py_common import device_info

from .mock_tables import dbconnector
Expand Down
2 changes: 1 addition & 1 deletion tests/null_route_helper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import imp

from click.testing import CliRunner
from swsssdk import ConfigDBConnector
from swsscommon.swsscommon import ConfigDBConnector

null_route_helper = imp.load_source('null_route_helper', os.path.join(os.path.dirname(__file__), '..', 'scripts','null_route_helper'))
null_route_helper.ConfigDBConnector = ConfigDBConnector
Expand Down
1 change: 0 additions & 1 deletion tests/show_snmp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import click
from click.testing import CliRunner
import pytest
import swsssdk
import traceback

test_path = os.path.dirname(os.path.abspath(__file__))
Expand Down
1 change: 0 additions & 1 deletion tests/tpid_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import click
from click.testing import CliRunner
import pytest
import swsssdk
import traceback

test_path = os.path.dirname(os.path.abspath(__file__))
Expand Down