sonic-buildimage/platform/vs/docker-sonic-vs/chassis_db.py

14 lines
413 B
Python
Raw Normal View History

#!/usr/bin/env python
import swsssdk
import json
chassisdb = swsssdk.SonicV2Connector(host='10.0.0.200', port='6380')
chassisdb.connect(chassisdb.CHASSIS_DB)
fname='/usr/share/sonic/virtual_chassis/chassis_db.json'
with open(fname) as f:
js = json.load(f)
client=chassisdb.get_redis_client(chassisdb.CHASSIS_DB)
for h, table in js.items():
for k, v in table.items():
client.hset(h, k, v)