From a377c1a8aa6dc2443683e75eef9d0c28383a94c0 Mon Sep 17 00:00:00 2001 From: Dong Zhang <41927498+dzhangalibaba@users.noreply.github.com> Date: Mon, 7 Oct 2019 16:36:23 -0700 Subject: [PATCH] remove SonicV2Connector which is not used any more (#53) --- src/swsssdk/__init__.py | 2 +- src/swsssdk/config/database.json | 12 ------------ src/swsssdk/dbconnector.py | 19 ------------------- src/swsssdk/interface.py | 4 ++-- test/test_moduleLoad.py | 2 -- 5 files changed, 3 insertions(+), 36 deletions(-) diff --git a/src/swsssdk/__init__.py b/src/swsssdk/__init__.py index b0f8ec0111ab..1989c93937cc 100644 --- a/src/swsssdk/__init__.py +++ b/src/swsssdk/__init__.py @@ -32,7 +32,7 @@ def _load_connector_map(): _load_connector_map() try: - from .dbconnector import SonicV1Connector, SonicV2Connector + from .dbconnector import SonicV2Connector from .configdb import ConfigDBConnector except (KeyError, ValueError): msg = "Failed to database connector objects -- incorrect database config schema." diff --git a/src/swsssdk/config/database.json b/src/swsssdk/config/database.json index 1051192ff172..640012f15945 100644 --- a/src/swsssdk/config/database.json +++ b/src/swsssdk/config/database.json @@ -1,16 +1,4 @@ { - "SonicV1Connector": { - "db_map": { - "IF_COUNTER_DB": { - "db": 0, - "separator": ":" - }, - "LLDP_COUNTER_DB": { - "db": 1, - "separator": ":" - } - } - }, "SonicV2Connector": { "db_map": { "APPL_DB": { diff --git a/src/swsssdk/dbconnector.py b/src/swsssdk/dbconnector.py index 9fb8e8852cf4..ec830028e97c 100644 --- a/src/swsssdk/dbconnector.py +++ b/src/swsssdk/dbconnector.py @@ -7,20 +7,6 @@ # FIXME: Convert to metaclasses when Py2 support is removed. Metaclasses have unique interfaces to Python2/Python3. - -class SonicV1Connector(DBInterface): - def __init__(self, **kwargs): - super(SonicV1Connector, self).__init__(**kwargs) - - pass - - -SonicV1Connector.db_map = _connector_map[SonicV1Connector.__name__]['db_map'] - -if len(SonicV1Connector.db_map) != len({v['db'] for k, v in SonicV1Connector.db_map.items()}): - raise RuntimeError("Duplicate DB index detected in configuration.") - - class SonicV2Connector(DBInterface): def __init__(self, **kwargs): super(SonicV2Connector, self).__init__(**kwargs) @@ -32,8 +18,3 @@ def __init__(self, **kwargs): if len(SonicV2Connector.db_map) != len({v['db'] for k, v in SonicV2Connector.db_map.items()}): raise RuntimeError("Duplicate DB index detected in configuration.") - - -class DBConnector(SonicV1Connector): - logger.warning("DBConnector is DEPRECATED. 'swsssdk.dbconnector.DBConnector' -> 'swsssdk.SonicV1Connector'") - pass diff --git a/src/swsssdk/interface.py b/src/swsssdk/interface.py index 1ff3f947997a..c77530b719ed 100644 --- a/src/swsssdk/interface.py +++ b/src/swsssdk/interface.py @@ -16,13 +16,13 @@ def blockable(f): "blocking" decorator for Redis accessor methods. Wrapped functions that specify kwarg 'blocking' will wait for the specified accessor to return with data.:: - class SonicV1Connector: + class SonicV2Connector: @blockable def keys(self, db_name): # ... # call with: - db = SonicV1Connector() + db = SonicV2Connector() # ... db.keys('DATABASE', blocking=True) diff --git a/test/test_moduleLoad.py b/test/test_moduleLoad.py index b769dbf4f4ad..870680f2e3da 100644 --- a/test/test_moduleLoad.py +++ b/test/test_moduleLoad.py @@ -14,8 +14,6 @@ def test__load_connector_map(self): def test__db_map_attributes(self): import swsssdk - db1 = swsssdk.SonicV1Connector() - self.assertTrue(all(hasattr(db1, db_name) for db_name in db1.db_map)) db2 = swsssdk.SonicV2Connector() self.assertTrue(all(hasattr(db2, db_name) for db_name in db2.db_map)) pass