diff --git a/acl_loader/main.py b/acl_loader/main.py index c56d368298..ef8a516fc6 100644 --- a/acl_loader/main.py +++ b/acl_loader/main.py @@ -10,7 +10,8 @@ import pyangbind.lib.pybindJSON as pybindJSON from natsort import natsorted from sonic_py_common import device_info -from swsssdk import ConfigDBConnector, SonicV2Connector, SonicDBConfig +from swsssdk import ConfigDBConnector, SonicDBConfig +from swsscommon.swsscommon import SonicV2Connector def info(msg): diff --git a/config/config_mgmt.py b/config/config_mgmt.py index 5e35f299ae..6bca25a909 100644 --- a/config/config_mgmt.py +++ b/config/config_mgmt.py @@ -14,7 +14,8 @@ # SONiC specific imports import sonic_yang - from swsssdk import ConfigDBConnector, SonicV2Connector, port_util + from swsssdk import ConfigDBConnector, port_util + from swsscommon.swsscommon import SonicV2Connector # Using load_source to 'import /usr/local/bin/sonic-cfggen as sonic_cfggen' # since /usr/local/bin/sonic-cfggen does not have .py extension. diff --git a/config/main.py b/config/main.py index d708f95240..eb2b65e7dd 100755 --- a/config/main.py +++ b/config/main.py @@ -16,7 +16,8 @@ from portconfig import get_child_ports from sonic_py_common import device_info, multi_asic from sonic_py_common.interface import get_interface_table_name, get_port_table_name -from swsssdk import ConfigDBConnector, SonicV2Connector, SonicDBConfig +from swsssdk import ConfigDBConnector, SonicDBConfig +from swsscommon.swsscommon import SonicV2Connector from utilities_common.db import Db from utilities_common.intf_filter import parse_interface_in_filter import utilities_common.cli as clicommon diff --git a/config/nat.py b/config/nat.py index e6c31c0b67..e6a67f33d2 100644 --- a/config/nat.py +++ b/config/nat.py @@ -3,7 +3,7 @@ import click import ipaddress from swsssdk import ConfigDBConnector -from swsssdk import SonicV2Connector +from swsscommon.swsscommon import SonicV2Connector def is_valid_ipv4_address(address): """Check if the given ipv4 address is valid""" diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index 7ac65bb041..b7016c7b44 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -5,7 +5,8 @@ import traceback from sonic_py_common import device_info, logger -from swsssdk import ConfigDBConnector, SonicDBConfig, SonicV2Connector +from swsssdk import ConfigDBConnector, SonicDBConfig +from swsscommon.swsscommon import SonicV2Connector SYSLOG_IDENTIFIER = 'db_migrator' diff --git a/scripts/fanshow b/scripts/fanshow index f0df01c75c..e375e79d6c 100755 --- a/scripts/fanshow +++ b/scripts/fanshow @@ -7,7 +7,6 @@ from __future__ import print_function import os import sys from tabulate import tabulate -from swsssdk import SonicV2Connector from natsort import natsorted # mock the redis for unit test purposes # @@ -21,6 +20,7 @@ try: except KeyError: pass +from swsscommon.swsscommon import SonicV2Connector header = ['Drawer', 'LED', 'FAN', 'Speed', 'Direction', 'Presence', 'Status', 'Timestamp'] diff --git a/scripts/fdbclear b/scripts/fdbclear index 4b723cca55..522d78d13c 100644 --- a/scripts/fdbclear +++ b/scripts/fdbclear @@ -15,7 +15,7 @@ import argparse import json import sys -from swsssdk import SonicV2Connector +from swsscommon.swsscommon import SonicV2Connector class FdbClear(object): diff --git a/scripts/fdbshow b/scripts/fdbshow index e519414583..14aea41544 100755 --- a/scripts/fdbshow +++ b/scripts/fdbshow @@ -30,7 +30,8 @@ import json import sys from natsort import natsorted -from swsssdk import SonicV2Connector, port_util +from swsssdk import port_util +from swsscommon.swsscommon import SonicV2Connector from tabulate import tabulate class FdbShow(object): diff --git a/scripts/natclear b/scripts/natclear index c18ec7ba58..b2a516a0f5 100644 --- a/scripts/natclear +++ b/scripts/natclear @@ -13,7 +13,7 @@ import argparse import json import sys -from swsssdk import SonicV2Connector +from swsscommon.swsscommon import SonicV2Connector class NatClear(object): diff --git a/scripts/natshow b/scripts/natshow index e7d5c55610..6016d1a17b 100644 --- a/scripts/natshow +++ b/scripts/natshow @@ -61,7 +61,7 @@ import json import sys import re -from swsssdk import SonicV2Connector +from swsscommon.swsscommon import SonicV2Connector from tabulate import tabulate class NatShow(object): diff --git a/scripts/nbrshow b/scripts/nbrshow index 1c9eb51554..73c5c67e07 100644 --- a/scripts/nbrshow +++ b/scripts/nbrshow @@ -32,7 +32,8 @@ import subprocess import re from natsort import natsorted -from swsssdk import SonicV2Connector, port_util +from swsssdk import port_util +from swsscommon.swsscommon import SonicV2Connector from tabulate import tabulate """ diff --git a/scripts/neighbor_advertiser b/scripts/neighbor_advertiser index 1e6799e184..b61edd3a74 100644 --- a/scripts/neighbor_advertiser +++ b/scripts/neighbor_advertiser @@ -17,7 +17,8 @@ import traceback import warnings from sonic_py_common import logger -from swsssdk import ConfigDBConnector, SonicV2Connector +from swsssdk import ConfigDBConnector +from swsscommon.swsscommon import SonicV2Connector from netaddr import IPAddress, IPNetwork diff --git a/scripts/psushow b/scripts/psushow index d74aee3a88..20b2aa1e5f 100755 --- a/scripts/psushow +++ b/scripts/psushow @@ -3,7 +3,6 @@ import argparse import sys import os -from swsssdk import SonicV2Connector from tabulate import tabulate # mock the redis for unit test purposes # @@ -17,6 +16,8 @@ try: except KeyError: pass +from swsscommon.swsscommon import SonicV2Connector + def psu_status_show(index): db = SonicV2Connector(host="127.0.0.1") db.connect(db.STATE_DB) diff --git a/scripts/tempershow b/scripts/tempershow index 23f6da2565..19b797b4c3 100644 --- a/scripts/tempershow +++ b/scripts/tempershow @@ -5,7 +5,7 @@ from __future__ import print_function from tabulate import tabulate -from swsssdk import SonicV2Connector +from swsscommon.swsscommon import SonicV2Connector from natsort import natsorted diff --git a/show/fgnhg.py b/show/fgnhg.py index 7311a9c38b..0117e684ec 100644 --- a/show/fgnhg.py +++ b/show/fgnhg.py @@ -4,7 +4,7 @@ import click import utilities_common.cli as clicommon from swsssdk import ConfigDBConnector -from swsssdk import SonicV2Connector +from swsscommon.swsscommon import SonicV2Connector from tabulate import tabulate diff --git a/show/main.py b/show/main.py index ed3939427d..956113367f 100755 --- a/show/main.py +++ b/show/main.py @@ -21,7 +21,8 @@ import fgnhg from sonic_py_common import device_info, multi_asic -from swsssdk import ConfigDBConnector, SonicV2Connector +from swsssdk import ConfigDBConnector +from swsscommon.swsscommon import SonicV2Connector from tabulate import tabulate from utilities_common.db import Db import utilities_common.multi_asic as multi_asic_util diff --git a/sonic_installer/main.py b/sonic_installer/main.py index 2dae429264..98909f4a42 100644 --- a/sonic_installer/main.py +++ b/sonic_installer/main.py @@ -14,7 +14,7 @@ import click from sonic_py_common import logger -from swsssdk import SonicV2Connector +from swsscommon.swsscommon import SonicV2Connector from .bootloader import get_bootloader from .common import run_command, run_command_or_raise diff --git a/tests/mock_tables/dbconnector.py b/tests/mock_tables/dbconnector.py index d71f9b7c73..a509027796 100644 --- a/tests/mock_tables/dbconnector.py +++ b/tests/mock_tables/dbconnector.py @@ -4,10 +4,11 @@ import mock import mockredis -import swsssdk.interface +import redis +import swsssdk from sonic_py_common import multi_asic from swsssdk import SonicDBConfig, SonicV2Connector -from swsssdk.interface import redis +from swsscommon import swsscommon topo = None @@ -137,3 +138,4 @@ def keys(self, pattern='*'): mockredis.MockRedis.config_set = config_set redis.StrictRedis = SwssSyncClient SonicV2Connector.connect = connect_SonicV2Connector +swsscommon.SonicV2Connector = SonicV2Connector