Skip to content

Commit 111e635

Browse files
authored
Enable orch_northbond_route_zmq_enabled feature in sonic-mgmt test. (#20441)
Enable orch_northbond_route_zmq_enabled feature in sonic-mgmt test. Why I did it Test orch_northbond_route_zmq_enabled in PR validation and nightly test. These change added in #19446, but been reverted by: #20261 Add change back and set buffer_model to traditional to prevent regression. Work item tracking Microsoft ADO (number only): 32582830 How I did it Enable orch_northbond_route_zmq_enabled in golden config. Set buffer_model to traditional to prevent regression. How to verify it Pass all test case.
1 parent 81a4620 commit 111e635

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

ansible/library/generate_golden_config_db.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,38 @@ def update_dns_config(self, config):
533533
else:
534534
return config
535535

536+
def generate_default_init_config_db(self):
537+
rc, out, err = self.module.run_command("sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data")
538+
if rc != 0:
539+
self.module.fail_json(msg="Failed to get config from minigraph: {}".format(err))
540+
541+
# Generate config table from init_cfg.ini
542+
ori_config_db = json.loads(out)
543+
544+
golden_config_db = {}
545+
if "DEVICE_METADATA" in ori_config_db:
546+
golden_config_db["DEVICE_METADATA"] = ori_config_db["DEVICE_METADATA"]
547+
548+
# Set buffer_model to traditional to prevent regression, as it is currently hardcoded here:
549+
# https://github.com/sonic-net/sonic-utilities/blob/19594b99129f3c881d500ff65d4955d077accb25/config/main.py#L2216
550+
golden_config_db["DEVICE_METADATA"]["localhost"]["buffer_model"] = "traditional"
551+
552+
return json.dumps(golden_config_db, indent=4)
553+
554+
def update_zmq_config(self, config):
555+
ori_config_db = json.loads(config)
556+
if "DEVICE_METADATA" not in ori_config_db:
557+
ori_config_db["DEVICE_METADATA"] = {}
558+
if "localhost" not in ori_config_db["DEVICE_METADATA"]:
559+
ori_config_db["DEVICE_METADATA"]["localhost"] = {}
560+
561+
# Older version image may not support ZMQ feature flag
562+
rc, out, err = self.module.run_command("sudo cat /usr/local/yang-models/sonic-device_metadata.yang")
563+
if "orch_northbond_route_zmq_enabled" in out:
564+
ori_config_db["DEVICE_METADATA"]["localhost"]["orch_northbond_route_zmq_enabled"] = "true"
565+
566+
return json.dumps(ori_config_db, indent=4)
567+
536568
def generate_lt2_ft2_golden_config_db(self):
537569
"""
538570
Generate golden_config for FT2 to enable FEC.
@@ -575,7 +607,10 @@ def generate(self):
575607
elif self.topo_name in ["t1-filterleaf-lag"]:
576608
config = self.generate_filterleaf_golden_config_db()
577609
else:
578-
config = "{}"
610+
config = self.generate_default_init_config_db()
611+
612+
# update ZMQ config
613+
config = self.update_zmq_config(config)
579614

580615
# update dns config
581616
config = self.update_dns_config(config)

0 commit comments

Comments
 (0)