sonic-buildimage/platform/vs/docker-sonic-vs/chassis_db.py
BrynXu a2e3d2fcea
[ChassisDB]: bring up ChassisDB service (#5283)
bring up chassisdb service on sonic switch according to the design in
Distributed Forwarding in VoQ Arch HLD

Signed-off-by: Honggang Xu <hxu@arista.com>

**- Why I did it**
To bring up new ChassisDB service in sonic as designed in ['Distributed forwarding in a VOQ architecture HLD' ](90c1289eaf/doc/chassis/architecture.md). 

**- How I did it**
Implement the section 2.3.1 Global DB Organization of the VOQ architecture HLD.

**- How to verify it**
ChassisDB service won't start without chassisdb.conf file on the existing platforms.
ChassisDB service is accessible with global.conf file in the distributed arichitecture.

Signed-off-by: Honggang Xu <hxu@arista.com>
2020-10-14 15:15:24 -07:00

14 lines
421 B
Python

#!/usr/bin/env python
import swsssdk
import json
chassisdb = swsssdk.SonicV2Connector(host='10.0.0.200', port='6380')
chassisdb.connect(chassisdb.CHASSIS_APP_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_APP_DB)
for h, table in js.items():
for k, v in table.items():
client.hset(h, k, v)