Add BMC IP configured and format checking

Change-Id: I43114311f85089ca9be09ce578e3dfea3fc0abdc
Signed-off-by: ppeng <peng.peng@windriver.com>
This commit is contained in:
ppeng
2025-11-19 10:28:22 -05:00
committed by Christian Roy
parent b49b9c235f
commit cc2a949838

View File

@@ -1,3 +1,5 @@
import ipaddress
from config.configuration_manager import ConfigurationManager
from framework.ssh.ssh_connection import SSHConnection
from keywords.base_keyword import BaseKeyword
@@ -18,6 +20,13 @@ class IPMIToolChassisPowerKeywords(BaseKeyword):
self.bm_ip = node.get_bm_ip()
self.bm_username = node.get_bm_username()
if not self.bm_ip or self.bm_ip == "None":
raise ValueError("BMC IP address is not configured or is None")
try:
ipaddress.ip_address(self.bm_ip)
except ValueError:
raise ValueError(f"Invalid BMC IP address format: {self.bm_ip}")
def _power_off(self, bm_ip: str, bm_username: str, bm_password: str):
"""Powers off the host using IPMI tool