xref: /openbmc/openbmc-test-automation/redfish/managers/test_bmc_config_ipv6.robot (revision 2067a770fe31056ce24dcc630b99b03c77efa2b8)
1*** Settings ***
2Documentation  Network interface IPv6 configuration connected to DHCP server
3               ...   and verification tests.
4
5Resource       ../../lib/bmc_redfish_resource.robot
6Resource       ../../lib/openbmc_ffdc.robot
7Resource       ../../lib/bmc_ipv6_utils.robot
8Resource       ../../lib/bmc_network_utils.robot
9Library        Collections
10Library        Process
11Library        OperatingSystem
12Test Teardown   Test Teardown Execution
13Suite Setup     Suite Setup Execution
14Suite Teardown  Redfish.Logout
15
16Test Tags     BMC_IPv6_Config
17
18*** Variables ***
19# Remote DHCP test bed server. Leave variables EMPTY if server is configured local
20# to the test where it is running else if remote pass the server credentials
21# -v SERVER_IPv6:xx.xx.xx.xx
22# -v SERVER_USERNAME:root
23# -v SERVER_PASSWORD:*********
24
25${SERVER_USERNAME}      ${EMPTY}
26${SERVER_PASSWORD}      ${EMPTY}
27${SERVER_IPv6}          ${EMPTY}
28
29
30*** Test Cases ***
31
32Get SLAAC Address And Verify Connectivity
33    [Documentation]  Fetch the SLAAC address and verify ping and SSH connection.
34    [Tags]  Get_SLAAC_Address_And_Verify_Connectivity
35
36    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
37    ...  Get Address Origin List And Address For Type  SLAAC
38    IF  '${SERVER_USERNAME}' != '${EMPTY}'
39        Check IPv6 Connectivity  ${ipv6_slaac_addr}
40    ELSE
41        Wait For IPv6 Host To Ping  ${ipv6_slaac_addr}
42    END
43    Verify SSH Connection Via IPv6  ${ipv6_slaac_addr}
44
45
46*** Keywords ***
47
48Suite Setup Execution
49    [Documentation]  Do suite setup execution.
50
51    Redfish.Login
52    ${active_channel_config}=  Get Active Channel Config
53    Set Suite Variable  ${active_channel_config}
54    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
55    Set Suite variable  ${ethernet_interface}
56
57
58Test Teardown Execution
59    [Documentation]  Test teardown execution.
60
61    FFDC On Test Case Fail
62
63
64Wait For IPv6 Host To Ping
65    [Documentation]  Verify that the IPv6 host responds successfully to ping.
66    [Arguments]  ${host}  ${timeout}=${OPENBMC_REBOOT_TIMEOUT}sec
67    ...          ${interval}=5 sec  ${expected_rc}=${0}
68    # Description of argument(s):
69    # host         The IPv6 address of the host to ping.
70    # timeout      Maximum time to wait for the host to respond to ping.
71    # interval     Time to wait between ping attempts.
72    # expected_rc  Expected return code of ping command.
73    Wait Until Keyword Succeeds  ${timeout}  ${interval}  Ping Host Over IPv6  ${host}  ${expected_rc}
74
75
76Ping Host Over IPv6
77    [Documentation]  Ping6 the given host.
78    [Arguments]     ${host}  ${expected_rc}=${0}
79    # Description of argument(s):
80    # host           IPv6 address of the host to ping.
81    # expected_rc    Expected return code of ping command.
82    Should Not Be Empty    ${host}   msg=No host provided.
83    ${rc}   ${output}=     Run and return RC and Output    ping6 -c 4 ${host}
84    Log     RC: ${rc}\nOutput:\n${output}
85    Should Be Equal     ${rc}   ${expected_rc}
86
87
88Check IPv6 Connectivity
89    [Documentation]  Check ping6 status and verify.
90    [Arguments]  ${OPENBMC_HOST_IPv6}
91
92    # Description of argument(s):
93    # OPENBMC_HOST_IPv6   IPv6 address to check connectivity.
94
95    Open Connection And Log In  ${SERVER_USERNAME}  ${SERVER_PASSWORD}  host=${SERVER_IPv6}
96    Wait For IPv6 Host To Ping  ${OPENBMC_HOST_IPv6}  30 secs
97
98
99Verify SSH Connection Via IPv6
100    [Documentation]  Verify connectivity to the IPv6 host via SSH.
101    [Arguments]  ${OPENBMC_HOST_IPv6}
102
103    # Description of argument(s):
104    # OPENBMC_HOST_IPv6   IPv6 address to check connectivity.
105
106    IF  '${SERVER_USERNAME}' == '${EMPTY}'
107        SSHLibrary.Open Connection  ${OPENBMC_HOST_IPv6}
108        SSHLibrary.Login  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}
109    ELSE
110        Open Connection And Log In  ${SERVER_USERNAME}  ${SERVER_PASSWORD}  host=${SERVER_IPv6}  alias=IPv6Conn
111        SSHLibrary.Open Connection  ${OPENBMC_HOST_IPv6}
112        SSHLibrary.Login  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}  jumphost_index_or_alias=IPv6Conn
113    END
114
115