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