Skip to content

Commit e6f240a

Browse files
authored
Skip multiple servers testbed parsing on branch 202405 (#458)
In PRs: sonic-net/sonic-mgmt#15643 and sonic-net/sonic-mgmt#15881 We implemented multi-servers testbed design, however, to enable parsing multi-servers testbed definition, raise this PR to fix out of key error. The code is already in master branch, and we only need the four lines code to be backport to 202411 and 202405
2 parents 248bc97 + e7ed089 commit e6f240a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ansible/library/test_facts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ def _read_testbed_topo_from_yaml():
169169
with open(self.testbed_filename) as f:
170170
tb_info = yaml.safe_load(f)
171171
for tb in tb_info:
172-
if tb["ptf_ip"]:
172+
if "ptf_ip" in tb and tb["ptf_ip"]:
173173
tb["ptf_ip"], tb["ptf_netmask"] = \
174174
_cidr_to_ip_mask(tb["ptf_ip"])
175-
if tb["ptf_ipv6"]:
175+
if "ptf_ipv6" in tb and tb["ptf_ipv6"]:
176176
tb["ptf_ipv6"], tb["ptf_netmask_v6"] = \
177177
_cidr_to_ip_mask(tb["ptf_ipv6"])
178178
tb["duts"] = tb.pop("dut")

tests/common/testbed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ def _read_testbed_topo_from_yaml(self):
107107
with open(self.testbed_filename) as f:
108108
tb_info = yaml.safe_load(f)
109109
for tb in tb_info:
110-
if tb["ptf_ip"]:
110+
if "ptf_ip" in tb and tb["ptf_ip"]:
111111
tb["ptf_ip"], tb["ptf_netmask"] = \
112112
self._cidr_to_ip_mask(tb["ptf_ip"])
113-
if tb["ptf_ipv6"]:
113+
if "ptf_ipv6" in tb and tb["ptf_ipv6"]:
114114
tb["ptf_ipv6"], tb["ptf_netmask_v6"] = \
115115
self._cidr_to_ip_mask(tb["ptf_ipv6"])
116116
tb["duts"] = tb.pop("dut")

0 commit comments

Comments
 (0)