1*** Settings ***
2Documentation  Test BMC file mirroring sync from primary flash chip to
3...  alternate flash chip side.
4
5Resource       ../../lib/openbmc_ffdc.robot
6Resource       ../../lib/bmc_network_utils.robot
7Resource       ../../lib/bmc_redfish_resource.robot
8Library        ../../lib/bmc_ssh_utils.py
9
10Test Teardown  Test Teardown Execution
11
12*** Test Cases ***
13
14Test BMC Alt Side Mirroring
15    [Documentation]  Verify the modified file is synced to alt flash side.
16    [Tags]  Test_BMC_Alt_Side_Mirroring
17
18    # BMC file sync list.
19    # Example output from "cat /etc/synclist" file:
20    # /etc/dropbear/
21    # /etc/group
22    # /etc/gshadow
23    # /etc/hostname
24    # /etc/machine-id
25    # /etc/passwd
26    # /etc/shadow
27    # /etc/ssl/
28    # /etc/ssl/certs/nginx/
29    # /etc/ssl/private/
30    # /etc/systemd/network/
31
32    # Save off the original hostname.
33    ${orig_hostname}  ${stderr}  ${rc}=  BMC Execute Command
34    ...  cat /etc/hostname
35    Set Suite Variable  ${hostname}  ${orig_hostname}
36    ${mirror_filename}=  Set Variable  mirror-filename
37
38    Redfish.Login
39    Configure Hostname  ${mirror_filename}
40    ${curr_hostname}  ${stderr}  ${rc}=  BMC Execute Command  hostname
41
42    Should Be Equal As Strings  ${curr_hostname}  ${mirror_filename}
43    ...  msg=The hostname interface ${mirror_filename} and command value ${curr_hostname} do not match.
44
45    # File "hostname" should have synced to alt media space.
46    # Example output from "ls /media/alt/var/persist/etc/":
47    # group  group-  gshadow  gshadow-  hostname  machine-id  ssl  systemd
48
49    # Wait time for syncing to ALT side.
50    Sleep  2
51
52    ${curr_hostname}  ${stderr}  ${rc}=  BMC Execute Command
53    ...  cat /media/alt/var/persist/etc/hostname
54
55    Should Be Equal As Strings  ${curr_hostname}  ${mirror_filename}
56    ...  msg=hostname primary file is not synced to the alt flash chip side.
57
58*** Keywords ***
59
60Test Teardown Execution
61    [Documentation]  Do the post test teardown.
62
63    FFDC On Test Case Fail
64
65    Redfish.Login
66    Configure Hostname  ${hostname}
67
68