Improve handling of subcloud oam ip retrieval

Add a check to return the oam_floating_ip if the
oam_ip is unavailable.
This ensures correct retrieval of the subcloud_ip
when the oam_ip missing.

Test Plan:
PASS: Run python scripts/lab_capability_scanner.py
      --lab_config_file=config/lab/files/<lab_config_file.json5>
      and verify subcloud section added in lab_config_file.json5.
PASS: Verify subcloud_ip was returning oam_flating_ip when
      oam_ip was not present.

Change-Id: Id3a5eaae811a5bcccb737059fe01e796d07dc15c
Signed-off-by: Swapna Gorre <swapna.gorre@windriver.com>
This commit is contained in:
Swapna Gorre 2025-02-03 06:35:39 -05:00
parent daf491c666
commit f9bbe7c27f

View File

@ -275,7 +275,11 @@ def get_subcloud_ip(subcloud_name: str, central_cloud_ssh_connection: SSHConnect
system_oam_show_output_list = central_cloud_ssh_connection.send_expect_prompts(f'ssh {subcloud_name} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no', expected_prompts)
system_oam_show_output: SystemOamShowOutput = SystemOamShowOutput(system_oam_show_output_list)
# Get the oam_ip if available (used in vbox environments).
subcloud_ip = system_oam_show_output.system_oam_show_object.get_oam_ip()
# If oam_ip is not available, fall back to oam_floating_ip (used in physical labs).
if not subcloud_ip:
subcloud_ip = system_oam_show_output.system_oam_show_object.get_oam_floating_ip()
return subcloud_ip