Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into syslog_telemetry_…
Browse files Browse the repository at this point in the history
…shared
  • Loading branch information
renukamanavalan committed Aug 3, 2022
2 parents b8e0b3d + 1b33f86 commit f8d066d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dockers/docker-database/docker-database-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ rm $db_cfg_file_tmp

# copy dump.rdb file to each instance for restoration
DUMPFILE=/var/lib/redis/dump.rdb
redis_inst_list=`/usr/bin/python3 -c "import swsssdk; print(' '.join(swsssdk.SonicDBConfig.get_instancelist().keys()))"`
redis_inst_list=`/usr/bin/python3 -c "from swsscommon import swsscommon; print(' '.join(swsscommon.SonicDBConfig.getInstanceList().keys()))"`
for inst in $redis_inst_list
do
mkdir -p /var/lib/$inst
Expand Down
12 changes: 6 additions & 6 deletions dockers/docker-database/flush_unused_database
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ while(True):
break
time.sleep(1)

instlists = swsscommon.SonicDBConfig.get_instancelist()
instlists = swsscommon.SonicDBConfig.getInstanceList()
for instname, v in instlists.items():
insthost = v['hostname']
instsocket = v['unix_socket_path']
insthost = v.hostname
instsocket = v.unixSocketPath

dblists = swsscommon.SonicDBConfig.get_dblist()
dblists = swsscommon.SonicDBConfig.getDbList()
for dbname in dblists:
dbid = swsscommon.SonicDBConfig.get_dbid(dbname)
dbinst = swsscommon.SonicDBConfig.get_instancename(dbname)
dbid = swsscommon.SonicDBConfig.getDbId(dbname)
dbinst = swsscommon.SonicDBConfig.getDbInst(dbname)

# this DB is on current instance, skip flush
if dbinst == instname:
Expand Down
3 changes: 2 additions & 1 deletion dockers/docker-platform-monitor/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ RUN apt-get update && \
i2c-tools \
psmisc \
python3-jsonschema \
libpci3
libpci3 \
iputils-ping

# On Arista devices, the sonic_platform wheel is not installed in the container.
# Instead, the installation directory is mounted from the host OS. However, this method
Expand Down
18 changes: 11 additions & 7 deletions src/sonic-bgpcfgd/bgpmon/bgpmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import json
import os
import syslog
import swsssdk
from swsscommon import swsscommon
import time

PIPE_BATCH_MAX_COUNT = 50
Expand All @@ -43,10 +43,9 @@ def __init__(self):
self.new_peer_l = set()
self.new_peer_state = {}
self.cached_timestamp = 0
self.db = swsssdk.SonicV2Connector()
self.db = swsscommon.SonicV2Connector()
self.db.connect(self.db.STATE_DB, False)
client = self.db.get_redis_client(self.db.STATE_DB)
self.pipe = client.pipeline()
self.pipe = swsscommon.RedisPipeline(self.db.get_redis_client(self.db.STATE_DB))
self.db.delete_all_by_pattern(self.db.STATE_DB, "NEIGH_STATE_TABLE|*" )

# A quick way to check if there are anything happening within BGP is to
Expand Down Expand Up @@ -106,11 +105,16 @@ def flush_pipe(self, data):
for key, value in data.items():
if value is None:
# delete case
self.pipe.delete(key)
command = swsscommon.RedisCommand()
command.formatDEL(key)
self.pipe.push(command)
else:
# Add or Modify case
self.pipe.hmset(key, value)
self.pipe.execute()
command = swsscommon.RedisCommand()
command.formatHSET(key, value)
self.pipe.push(command)

self.pipe.flush()
data.clear()

def update_neigh_states(self):
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-sairedis

0 comments on commit f8d066d

Please sign in to comment.