Skip to content

Commit 0c3c9c6

Browse files
authored
Replace swsssdk with swsscommon (#2368)
**What I did** Replace py-swsssdk with sonic-swss-common **Why I did it** To deprecate py-swsssdk, need replace it from code. **How I verified it** Pass all UT. **Details if related**
1 parent bf91a49 commit 0c3c9c6

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

fpmsyncd/bgp_eoiu_marker.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"""
1818

1919
import sys
20-
import swsssdk
2120
import time
2221
import syslog
2322
import traceback
@@ -80,7 +79,7 @@ def init_peers_eor_status(self):
8079
# Only two families: 'ipv4' and 'ipv6'
8180
# state is "unknown" / "reached" / "consumed"
8281
def set_bgp_eoiu_marker(self, family, state):
83-
db = swsssdk.SonicV2Connector(host='127.0.0.1')
82+
db = swsscommon.SonicV2Connector(host='127.0.0.1')
8483
db.connect(db.STATE_DB, False)
8584
key = "BGP_STATE_TABLE|%s|eoiu" % family
8685
db.set(db.STATE_DB, key, 'state', state)
@@ -90,7 +89,7 @@ def set_bgp_eoiu_marker(self, family, state):
9089
return
9190

9291
def clean_bgp_eoiu_marker(self):
93-
db = swsssdk.SonicV2Connector(host='127.0.0.1')
92+
db = swsscommon.SonicV2Connector(host='127.0.0.1')
9493
db.connect(db.STATE_DB, False)
9594
db.delete(db.STATE_DB, "BGP_STATE_TABLE|IPv4|eoiu")
9695
db.delete(db.STATE_DB, "BGP_STATE_TABLE|IPv6|eoiu")

neighsyncd/restore_neighbors.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"""
1414

1515
import sys
16-
import swsssdk
1716
import netifaces
1817
import time
1918
from pyroute2 import IPRoute, NetlinkError
@@ -117,7 +116,7 @@ def is_intf_up(intf, db):
117116
# 2, need check interface state twice due to the split map
118117

119118
def read_neigh_table_to_maps():
120-
db = swsssdk.SonicV2Connector(host='127.0.0.1')
119+
db = swsscommon.SonicV2Connector(host='127.0.0.1')
121120
db.connect(db.APPL_DB, False)
122121

123122
intf_neigh_map = {}
@@ -207,7 +206,7 @@ def build_arp_ns_pkt(family, smac, src_ip, dst_ip):
207206

208207
# Set the statedb "NEIGH_RESTORE_TABLE|Flags", so neighsyncd can start reconciliation
209208
def set_statedb_neigh_restore_done():
210-
db = swsssdk.SonicV2Connector(host='127.0.0.1')
209+
db = swsscommon.SonicV2Connector(host='127.0.0.1')
211210
db.connect(db.STATE_DB, False)
212211
db.set(db.STATE_DB, 'NEIGH_RESTORE_TABLE|Flags', 'restored', 'true')
213212
db.close(db.STATE_DB)
@@ -228,7 +227,7 @@ def restore_update_kernel_neighbors(intf_neigh_map, timeout=DEF_TIME_OUT):
228227
ipclass = IPRoute()
229228
start_time = time.monotonic()
230229
is_intf_up.counter = 0
231-
db = swsssdk.SonicV2Connector(host='127.0.0.1')
230+
db = swsscommon.SonicV2Connector(host='127.0.0.1')
232231
db.connect(db.STATE_DB, False)
233232
while (time.monotonic() - start_time) < timeout:
234233
for intf, family_neigh_map in list(intf_neigh_map.items()):

0 commit comments

Comments
 (0)