1*** Settings ***
2Documentation      Keywords for system data information.
3
4Resource           ../lib/os_utilities.robot
5
6*** Variables ***
7
8*** Keywords ***
9Get PNOR Info
10    [Documentation]  Get PNOR information.
11    ${version}  ${stderr}=  Execute Command  pflash -r /dev/stdout -P VERSION
12    ...  return_stderr=True
13    Should Be Empty  ${stderr}
14    Log  ${\n}version: ${version}  console=yes
15    RETURN  ${version}
16
17Get Inventory
18    [Documentation]  Get system inventory.
19    ${inventory}  ${stderr}=  Execute Command  lshw -short  return_stderr=True
20    Should Be Empty  ${stderr}
21    Log  ${\n}inventory: ${inventory}  console=yes
22    RETURN  ${inventory}
23
24Get Memory Count
25    [Documentation]  Get Memory Count.
26    ${memory_count}  ${stderr}=
27    ...  Execute Command  lshw -short | grep memory | wc -l  return_stderr=True
28    Should Be Empty  ${stderr}
29    Log  ${\n}memory count: ${memory_count}  console=yes
30    RETURN  ${memory_count}
31
32Verify Memory Count
33    [Documentation]  Verify memory count.
34    [Arguments]  ${expected_memory_count}
35    ${memory_count}=  Get Memory Count
36    Log  ${\n}memory count: ${memory_count}  console=yes
37    Should Be Equal As Integers  ${memory_count}  ${expected_memory_count}
38    ...  Error: memory count doesn't match expected count.
39
40Get Dimm Count
41    [Documentation]  Get DIMM count.
42    ${dimm_count}  ${stderr}=  Execute Command  lshw -short | grep DIMM | wc -l
43    ...  return_stderr=True
44    Should Be Empty  ${stderr}
45    Log  ${\n}dimm_count: ${dimm_count}  console=yes
46    RETURN  ${dimm_count}
47
48Verify Dimm Count
49    [Documentation]  Verify DIMM count.
50    [Arguments]  ${expected_dimm_count}
51    ${dimm_count}=  Get Dimm Count
52    Log  ${\n}dimm_count: ${dimm_count}  console=yes
53    Should Be Equal As Integers  ${dimm_count}  ${expected_dimm_count}
54    ...  msg=Error: dimm count doesn't match expected count.
55
56Verify Opal-Prd Installed
57    [Documentation]  Check whether opal-prd.service is running on OS.
58    ${output}  ${stderr}=  Execute Command  systemctl status opal-prd.service
59    ...  return_stderr=True
60    Should Be Empty  ${stderr}
61    Log  ${\n}${output}  console=yes
62    Should Not Contain  ${output}  could not be found
63    ...  msg=Error: opal-prd.service is not installed.
64
65Verify No Gard Records
66    [Documentation]  Verify no gard records are present on OS.
67    ${output}  ${stderr}=  Execute Command  opal-gard list
68    ...  return_stderr=True
69    Should Be Empty  ${stderr}
70    Should Contain  ${output}  No GARD entries to display
71
72Verify No Error Logs
73    [Documentation]  Verify no error logs.
74    ${output}  ${stderr}=  Execute Command  dmesg -xT -l emerg,alert,crit,err
75    ...  return_stderr=True
76    Should Be Empty  ${stderr}
77    Should Be Empty  ${output}
78