*** Settings ***
Documentation    This suite is to test service user login functionality.
...              This test expects SERVICE_FILE_PATH, PRODUCTION_KEY_FILE_PATH and
...              SERVICE_USER_PASSWORD to be provided.
...
...              Execution Method :
...              python -m robot -v OPENBMC_HOST:<hostname> -v SERVICE_FILE_PATH:<service file path>
...              -v PRODUCTION_KEY_FILE_PATH:<production key file path>
...              -v SERVICE_USER_PASSWORD:<service user password>
...              openpower/service_account/test_service_login.robot

Resource         ../../lib/connection_client.robot
Resource         ../../lib/openbmc_ffdc.robot
Resource         ../../lib/bmc_redfish_utils.robot

Library          SSHLibrary

Suite Setup      Suite Setup Execution
Test Teardown    FFDC On Test Case Fail


*** Variables ***

${acf_dir}            /etc/acf

*** Test Cases ***

Verify Service User Login With Valid ACF file
    [Documentation]  Verify service user login with valid ACF file.
    [Tags]  Verify_Service_User_Login_With_Valid_ACF_file

    Upload Valid ACF
    Redfish.Login  service  ${SERVICE_USER_PASSWORD}


Verify Service User Login Without ACF file
    [Documentation]  Verify service user login without ACF file.
    [Tags]  Verify_Service_User_Login_Without_ACF_file

    Remove Existing ACF
    Run Keyword And Expect Error  InvalidCredentialsError*
    ...  Redfish.Login  service  ${SERVICE_USER_PASSWORD}


*** Keywords ***

Suite Setup Execution
    [Documentation]  Do suite setup tasks.

    # Upload production key in BMC because it is not part of OpenBMC build yet.
    scp.Put File  ${PRODUCTION_KEY_FILE_PATH}  ${acf_dir}


Remove Existing ACF
    [Documentation]  Remove existing ACF.

    BMC Execute Command  rm -f ${acf_dir}/*.acf


Upload Valid ACF
    [Documentation]  Upload valid ACF.

    Run Keywords  Open Connection for SCP
    scp.Put File  ${SERVICE_FILE_PATH}  ${acf_dir}

Add service user login test automation suite
Add service user login test automation suite

Test cases added:
   - Verify Service User Login With Valid ACF file
   - Verify Service User Login Without ACF file

Change-Id: Ib2ee77b381b596bd5fec88b83c692d2f91c53c9f
Signed-off-by: manashsarma <bc095463df3ac81e71d6b05cdcfc30e87ec3c38e@in.ibm.com>

openbmc/openbmc-test-automation,openbmc/openbmc-test-automation