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 9Resource ../../lib/protocol_setting_utils.robot 10 11Library Collections 12Library Process 13Library OperatingSystem 14Suite Setup Suite Setup Execution 15Test Teardown Test Teardown Execution 16 17Test Tags BMC_IPv6_Config 18 19*** Variables *** 20# Remote DHCP test bed server. Leave variables EMPTY if server is configured local 21# to the test where it is running else if remote pass the server credentials 22# -v SERVER_IPv6:xx.xx.xx.xx 23# -v SERVER_USERNAME:root 24# -v SERVER_PASSWORD:********* 25 26${SERVER_USERNAME} ${EMPTY} 27${SERVER_PASSWORD} ${EMPTY} 28${SERVER_IPv6} ${EMPTY} 29 30 31*** Test Cases *** 32 33Get SLAAC And Static IPv6 Address And Verify Connectivity 34 [Documentation] Fetch the SLAAC and Static IPv6 address 35 ... and verify ping and SSH connection. 36 [Tags] Get_SLAAC_And_Static_IPv6_Address_And_Verify_Connectivity 37 [Template] Get IPv6 Address And Verify Connectivity 38 39 # Address_type channel_number 40 SLAAC ${1} 41 Static ${1} 42 SLAAC ${2} 43 Static ${2} 44 45 46Enable SSH Protocol Via IPv6 And Verify 47 [Documentation] Enable SSH protocol via eth1 and verify. 48 [Tags] Enable_SSH_Protocol_Via_IPv6_And_Verify 49 50 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 51 ... Get Address Origin List And Address For Type SLAAC ${2} 52 Connect BMC Using IPv6 Address ${ipv6_slaac_addr} 53 Set SSH Protocol Using IPv6 Session And Verify ${True} 54 Verify SSH Login And Commands Work 55 Verify SSH Connection Via IPv6 ${ipv6_slaac_addr} 56 57 58Disable SSH Protocol Via IPv6 And Verify 59 [Documentation] Disable SSH protocol via IPv6 and verify. 60 [Tags] Disable_SSH_Protocol_Via_IPv6_And_Verify 61 [Teardown] Set SSH Protocol Using IPv6 Session And Verify ${True} 62 63 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 64 ... Get Address Origin List And Address For Type SLAAC ${2} 65 Connect BMC Using IPv6 Address ${ipv6_slaac_addr} 66 67 Set SSH Protocol Using IPv6 Session And Verify ${False} 68 69 # Verify SSH Login And Commands Work. 70 ${status}= Run Keyword And Return Status 71 ... Verify SSH Connection Via IPv6 ${ipv6_slaac_addr} 72 Should Be Equal As Strings ${status} False 73 ... msg=SSH Login and commands are working after disabling SSH via IPv6. 74 75 # Verify SSH Connection Via IPv6. 76 ${status}= Run Keyword And Return Status 77 ... Verify SSH Login And Commands Work 78 Should Be Equal As Strings ${status} False 79 ... msg=SSH Login and commands are working after disabling SSH. 80 81 82Verify BMC IPv4 And IPv6 Addresses Accessible Via SSH 83 [Documentation] Verify BMC IPv4 and IPv6 addresses accessible via SSH. 84 [Tags] Verify_BMC_IPv4_And_IPv6_Addresses_Accessible_Via_SSH 85 86 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST} 87 Verify SSH Connection Via IPv6 88 89 90Verify IPv4 And IPv6 Access Concurrently Via Redfish 91 [Documentation] Verify both interfaces access conurrently via redfish. 92 [Tags] Verify_IPv4_And_IPv6_Access_Concurrently_Via_Redfish 93 94 ${dict}= Execute Process Multi Keyword ${2} 95 ... Redfish.patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}} 96 ... RedfishIPv6.patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}} 97 Dictionary Should Not Contain Value ${dict} False 98 ... msg=One or more operations has failed. 99 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 100 ${resp1}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth0 101 Should Be Equal ${resp.dict["DHCPv4"]['UseDNSServers']} ${True} 102 Should Be Equal ${resp1.dict["DHCPv4"]['UseDNSServers']} ${True} 103 104 105Configure Static IPv6 From SLAAC Address 106 [Documentation] Configure Static IPv6 From SLAAC Address. 107 [Tags] Configure_Static_IPv6_From_SLAAC_Address 108 109 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 110 ... Get Address Origin List And Address For Type SLAAC ${2} 111 Connect BMC Using IPv6 Address ${ipv6_slaac_addr} 112 RedfishIPv6.Login 113 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} Version=IPv6 114 115 116Disable DHCP On Eth1 From SLAAC IPv6 And Verify 117 [Documentation] Disable DHCP on eth1 from SLAAC IPv6 and verify. 118 [Tags] Disable_DHCP_On_Eth1_From_SLAAC_IPv6_And_Verify 119 [Template] Disable Or Enable DHCP On Eth1 From IPv6 Address 120 121 SLAAC ${2} False 122 123 124*** Keywords *** 125 126Suite Setup Execution 127 [Documentation] Do suite setup execution. 128 129 Redfish.Login 130 ${active_channel_config}= Get Active Channel Config 131 Set Suite Variable ${active_channel_config} 132 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 133 Set Suite variable ${ethernet_interface} 134 135 136Test Teardown Execution 137 [Documentation] Test teardown execution. 138 139 FFDC On Test Case Fail 140 Redfish.Logout 141 RedfishIPv6.Logout 142 143 144Wait For IPv6 Host To Ping 145 [Documentation] Verify that the IPv6 host responds successfully to ping. 146 [Arguments] ${host} ${timeout}=${OPENBMC_REBOOT_TIMEOUT}sec 147 ... ${interval}=5 sec ${expected_rc}=${0} 148 # Description of argument(s): 149 # host The IPv6 address of the host to ping. 150 # timeout Maximum time to wait for the host to respond to ping. 151 # interval Time to wait between ping attempts. 152 # expected_rc Expected return code of ping command. 153 Wait Until Keyword Succeeds ${timeout} ${interval} Ping Host Over IPv6 ${host} ${expected_rc} 154 155 156Ping Host Over IPv6 157 [Documentation] Ping6 the given host. 158 [Arguments] ${host} ${expected_rc}=${0} 159 # Description of argument(s): 160 # host IPv6 address of the host to ping. 161 # expected_rc Expected return code of ping command. 162 Should Not Be Empty ${host} msg=No host provided. 163 ${rc} ${output}= Run and return RC and Output ping6 -c 4 ${host} 164 Log RC: ${rc}\nOutput:\n${output} 165 Should Be Equal ${rc} ${expected_rc} 166 167 168Check IPv6 Connectivity 169 [Documentation] Check ping6 status and verify. 170 [Arguments] ${OPENBMC_HOST_IPv6} 171 172 # Description of argument(s): 173 # OPENBMC_HOST_IPv6 IPv6 address to check connectivity. 174 175 Open Connection And Log In ${SERVER_USERNAME} ${SERVER_PASSWORD} host=${SERVER_IPv6} 176 Wait For IPv6 Host To Ping ${OPENBMC_HOST_IPv6} 30 secs 177 178 179Verify SSH Connection Via IPv6 180 [Documentation] Verify connectivity to the IPv6 host via SSH. 181 [Arguments] ${OPENBMC_HOST_IPv6} 182 183 # Description of argument(s): 184 # OPENBMC_HOST_IPv6 IPv6 address to check connectivity. 185 186 IF '${SERVER_USERNAME}' == '${EMPTY}' 187 SSHLibrary.Open Connection ${OPENBMC_HOST_IPv6} 188 SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 189 ELSE 190 Open Connection And Log In ${SERVER_USERNAME} ${SERVER_PASSWORD} host=${SERVER_IPv6} alias=IPv6Conn 191 SSHLibrary.Open Connection ${OPENBMC_HOST_IPv6} 192 SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} jumphost_index_or_alias=IPv6Conn 193 END 194 195 196Set SSH Protocol Using IPv6 Session And Verify 197 [Documentation] Enable or disable SSH protocol via IPv6 and verify. 198 [Arguments] ${enable_value}=${True} 199 200 # Description of argument(s}: 201 # enable_value Enable or disable SSH, e.g. (true, false). 202 203 ${ssh_state}= Create Dictionary ProtocolEnabled=${enable_value} 204 ${data}= Create Dictionary SSH=${ssh_state} 205 206 RedfishIPv6.Login 207 RedfishIPv6.Patch ${REDFISH_NW_PROTOCOL_URI} body=&{data} 208 ... valid_status_codes=[${HTTP_NO_CONTENT}] 209 210 # Wait for new values to take effect. 211 Sleep 30s 212 213 # Verify SSH Protocol State Via IPv6 214 ${resp}= RedfishIPv6.Get ${REDFISH_NW_PROTOCOL_URI} 215 Should Be Equal As Strings ${resp.dict['SSH']['ProtocolEnabled']} ${enable_value} 216 ... msg=Protocol states are not matching. 217 218 219Connect BMC Using IPv6 Address 220 [Documentation] Import bmc_redfish library with IPv6 configuration. 221 [Arguments] ${OPENBMC_HOST_IPv6} 222 223 # Description of argument(s): 224 # OPENBMC_HOST_IPv6 IPv6 address of the BMC. 225 226 Import Library ${CURDIR}/../../lib/bmc_redfish.py https://[${OPENBMC_HOST_IPv6}]:${HTTPS_PORT} 227 ... ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} AS RedfishIPv6 228 229 230Get IPv6 Address And Verify Connectivity 231 [Documentation] Get IPv6 address and verify connectivity. 232 [Arguments] ${ipv6_adress_type} ${channel_number} 233 234 # Description of argument(s): 235 # ipv6_adress_type Type of IPv6 address(slaac/static). 236 # channel_number Ethernet channel number, 1(eth0) or 2(eth1). 237 238 @{ipv6_addressorigin_list} ${ipv6_addr}= 239 ... Get Address Origin List And Address For Type ${ipv6_adress_type} ${channel_number} 240 IF '${SERVER_USERNAME}' != '${EMPTY}' 241 Check IPv6 Connectivity ${ipv6_addr} 242 ELSE 243 Wait For IPv6 Host To Ping ${ipv6_addr} 244 END 245 Verify SSH Connection Via IPv6 ${ipv6_addr} 246 247Disable Or Enable DHCP On Eth1 From IPv6 Address 248 [Documentation] Disable Or Enable DHCP On Eth1 From IPv6 Address 249 [Arguments] ${ipv6_adress_type} ${channel_number} ${DHCP_state} 250 251 # Description of argument(s): 252 # ipv6_adress_type Type of IPv6 address(slaac/static). 253 # channel_number Ethernet channel number, 1(eth0) or 2(eth1). 254 # DHCP_state Enable or Disable DHCP 255 256 @{ipv6_addressorigin_list} ${ipv6_addr}= 257 ... Get Address Origin List And Address For Type ${ipv6_adress_type} ${channel_number} 258 Connect BMC Using IPv6 Address ${ipv6_addr} 259 RedfishIPv6.Login 260 Set DHCPEnabled To Enable Or Disable ${DHCP_state} eth1 Version=IPv6 261