diff --git a/spytest/spytest/framework.py b/spytest/spytest/framework.py index df9290128b2..7f7cb859a11 100644 --- a/spytest/spytest/framework.py +++ b/spytest/spytest/framework.py @@ -3932,6 +3932,9 @@ def get_config_profile(self): profile = profile or self.cfg.config_profile profile = profile or "na" return profile.lower() + + def get_console(self, dut): + return self._context._tb.get_console(dut) def get_device_type(self, dut): return self._context._tb.get_device_type(dut) diff --git a/spytest/spytest/infra.py b/spytest/spytest/infra.py index 2da20a260b2..943f6bd547b 100644 --- a/spytest/spytest/infra.py +++ b/spytest/spytest/infra.py @@ -405,6 +405,10 @@ def get_mgmt_ip(dut): return getwa().get_mgmt_ip(dut) +def get_console_info(dut): + return getwa().get_console(dut) + + def get_datastore(dut, name, scope="default"): return getwa().get_datastore(dut, name, scope) diff --git a/spytest/spytest/testbed.py b/spytest/spytest/testbed.py index 12e38b3fdd0..0f60d44f5dd 100644 --- a/spytest/spytest/testbed.py +++ b/spytest/spytest/testbed.py @@ -1396,6 +1396,17 @@ def get_ts(self, dut): return rv["ts"] return None + def get_console(self, dut, default=""): + dinfo = self.get_device_info(dut) + rv = SpyTestDict() + if not dinfo: + return default + if dinfo["console"]: + rv.ip = dinfo["console"].ip + rv.port = dinfo["console"].port + rv.protocol = dinfo["console"].protocol + return rv + def get_rps(self, dut): """ Returns RPS details read from testbed file for given DUT