1*** Settings ***
2Documentation    Module to test IPMI chipher functionality.
3Resource         ../lib/ipmi_client.robot
4Resource         ../lib/openbmc_ffdc.robot
5Library          ../lib/ipmi_utils.py
6Library          ../lib/var_funcs.py
7Variables        ../data/ipmi_raw_cmd_table.py
8Library          String
9
10Test Setup       Printn
11Test Teardown    FFDC On Test Case Fail
12
13*** Test Cases ***
14
15Verify Supported Ciphers
16    [Documentation]  Execute all supported ciphers and verify.
17    [Tags]  Verify_Supported_Ciphers
18    FOR  ${cipher}  IN  @{valid_ciphers}
19      Run External IPMI Standard Command  power status  C=${cipher}
20    END
21
22
23Verify Unsupported Ciphers
24    [Documentation]  Execute all unsupported ciphers and verify error.
25    [Tags]  Verify_Unsupported_Ciphers
26    FOR  ${cipher}  IN  @{unsupported_ciphers}
27      Run Keyword And Expect Error  *invalid * algorithm*
28      ...  Run External IPMI Standard Command  power status  C=${cipher}
29    END
30
31
32Verify Supported Ciphers Via Lan Print
33    [Documentation]  Verify supported ciphers via IPMI lan print command.
34    [Tags]  Verify_Supported_Ciphers_Via_Lan_Print
35
36    ${lan_print}=  Get Lan Print Dict
37    # Example 'RMCP+ Cipher Suites' entry: 3,17
38    ${ciphers}=  Split String  ${lan_print['RMCP+ Cipher Suites']}  ,
39    Rprint Vars  ciphers
40    Valid List  ciphers  valid_values=${valid_ciphers}
41
42
43Verify Supported Cipher Via Getciphers
44    [Documentation]  Verify supported chipers via IPMI getciphers command.
45    [Tags]  Verify_Supported_Cipher_Via_Getciphers
46
47    # Example output from 'Channel Getciphers IPMI':
48    # ipmi_channel_ciphers:
49    #   [0]:
50    #     [id]:                                         3
51    #     [iana]:                                       N/A
52    #     [auth_alg]:                                   hmac_sha1
53    #     [integrity_alg]:                              hmac_sha1_96
54    #     [confidentiality_alg]:                        aes_cbc_128
55    #   [1]:
56    #     [id]:                                         17
57    #     [iana]:                                       N/A
58    #     [auth_alg]:                                   hmac_sha256
59    #     [integrity_alg]:                              sha256_128
60    #     [confidentiality_alg]:                        aes_cbc_128
61
62    ${ipmi_channel_ciphers}=  Channel Getciphers IPMI
63    # Example cipher entry: 3 17
64    Rprint Vars  ipmi_channel_ciphers
65    ${ipmi_channel_cipher_ids}=  Nested Get  id  ${ipmi_channel_ciphers}
66    Rpvars  ipmi_channel_cipher_ids
67    Valid List  ipmi_channel_cipher_ids  valid_values=${valid_ciphers}
68