Skip to content

Commit 3bfef06

Browse files
authored
Normalize vpp topo name (#21510)
What is the motivation for this PR? vpp testbed has topo name with vpp suffix for the reason that in azure pipeline, it can use a different profile with different resources. However, from sonic-mgmt test perspective, t1-lag-vpp is exactly the same as t1-lag with the same topology. In sonic-mgmt tests, there are places check topo name. We don't want to add special logic for vpp topos. So we want to normalize the special topo name. How did you do it? In TestbedInfo, remove -vpp suffix when the testbed is loaded. How did you verify/test it? Run vpp sonic-mgmt test. Any platform specific information? Specific to vpp platform Signed-off-by: Yue Gao <[email protected]>
1 parent 55b707f commit 3bfef06

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/common/testbed.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(self, testbed_file):
6161
# create yaml testbed file
6262
self.dump_testbeds_to_yaml()
6363
self.parse_topo()
64+
self._normalize_topo_names()
6465

6566
def _cidr_to_ip_mask(self, network):
6667
addr = ipaddress.IPNetwork(network)
@@ -396,6 +397,13 @@ def parse_topo(self):
396397
tb['topo']['ptf_map_disabled'] = self.calculate_ptf_index_map_disabled(tb)
397398
tb['topo']['ptf_dut_intf_map'] = self.calculate_ptf_dut_intf_map(tb)
398399

400+
def _normalize_topo_names(self):
401+
"""Normalize topology names by removing the '-vpp' suffix if present."""
402+
for tb_name, tb in list(self.testbed_topo.items()):
403+
topo_name = tb["topo"]["name"]
404+
if topo_name.endswith("-vpp"):
405+
tb["topo"]["name"] = topo_name[:-4] # Remove the last 4 characters ("-vpp")
406+
399407

400408
if __name__ == "__main__":
401409
parser = argparse.ArgumentParser(

0 commit comments

Comments
 (0)