Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ansible/group_vars/lab/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ansible_become_pass: password
sonicadmin_user: admin
sonicadmin_password: password
sonicadmin_initial_password: password
sonic_bmc_root_user: root
sonic_bmc_root_password: 0penBmcTempPass!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that all products will have to use "0penBmcTempPass!" ? In some cases, the OS could be not OpenBMC, so the password should be something standard.


console_login:
console_telnet:
Expand Down
28 changes: 28 additions & 0 deletions tests/common/helpers/firmware_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import re


def show_firmware(duthost):
out = duthost.command("fwutil show status")
num_spaces = 2
curr_chassis = ""
output_data = {"chassis": {}}
status_output = out['stdout']
separators = re.split(r'\s{2,}', status_output.splitlines()[1]) # get separators
output_lines = status_output.splitlines()[2:]

for line in output_lines:
data = []
start = 0

for sep in separators:
curr_len = len(sep)
data.append(line[start:start+curr_len].strip())
start += curr_len + num_spaces

if data[0].strip() != "":
curr_chassis = data[0].strip()
output_data["chassis"][curr_chassis] = {"component": {}}

output_data["chassis"][curr_chassis]["component"][data[2]] = data[3]

return output_data
83 changes: 83 additions & 0 deletions tests/common/helpers/platform_api/bmc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
""" This module provides interface to interact with the BMC of the DUT via platform API remotely """
import ast
import json
import logging

logger = logging.getLogger(__name__)


def bmc_pmon_api(conn, name, args=None):
if args is None:
args = []
conn.request('POST', '/platform/chassis/bmc/{}'.format(name), json.dumps({'args': args}))
resp = conn.getresponse()
res = json.loads(resp.read())['res']
logger.info('Executing chassis API: "{}", arguments: "{}", result: "{}"'.format(name, args, res))
return res


def bmc_host_api(duthost, api_name, *args):
bmc_instance = 'sudo python -c "import sonic_platform; \
bmc = sonic_platform.platform.Platform().get_chassis().get_bmc(); \
print(bmc.{})"'
res = duthost.shell(bmc_instance.format(api_name + str(args)))['stdout']
try:
return ast.literal_eval(res)
except (ValueError, SyntaxError):
return res.strip()


def get_name(conn):
return bmc_pmon_api(conn, 'get_name')


def get_presence(conn):
return bmc_pmon_api(conn, 'get_presence')


def get_model(duthost):
return bmc_host_api(duthost, 'get_model')


def get_serial(duthost):
return bmc_host_api(duthost, 'get_serial')


def get_revision(conn):
return bmc_pmon_api(conn, 'get_revision')


def get_status(conn):
return bmc_pmon_api(conn, 'get_status')


def is_replaceable(conn):
return bmc_pmon_api(conn, 'is_replaceable')


def get_eeprom(duthost):
return bmc_host_api(duthost, 'get_eeprom')


def get_version(duthost):
return bmc_host_api(duthost, 'get_version')


def reset_root_password(duthost):
return bmc_host_api(duthost, 'reset_root_password')


def trigger_bmc_debug_log_dump(duthost):
return bmc_host_api(duthost, 'trigger_bmc_debug_log_dump')


def get_bmc_debug_log_dump(duthost, task_id, filename, path):
return bmc_host_api(duthost, 'get_bmc_debug_log_dump', task_id, filename, path)


def update_firmware(duthost, fw_image):
return bmc_host_api(duthost, 'update_firmware', fw_image)


def request_bmc_reset(duthost):
return bmc_host_api(duthost, '_request_bmc_reset')
Original file line number Diff line number Diff line change
Expand Up @@ -3638,6 +3638,12 @@ show_techsupport/test_auto_techsupport.py::TestAutoTechSupport::test_sai_sdk_dum
- "asic_type not in ['mellanox']"
- "is_multi_asic==True"

show_techsupport/test_techsupport.py::test_techsupport:
xfail:
reason: "ipv6 mgmt ip is not supported"
conditions:
- "is_mgmt_ipv6_only==True"

#######################################
##### snappi_tests #####
#######################################
Expand Down
Loading