blob: 427f42c484ce4f60b0d173481dbacd7bcc92f4a5 [file] [log] [blame]
*** Settings ***
Documentation Verify OBMC tool's network fuctionality.
Library String
Library OperatingSystem
Library ../../lib/gen_print.py
Library ../../lib/gen_robot_print.py
Library ../../lib/openbmctool_utils.py
Library ../../lib/gen_misc.py
Library ../../lib/gen_robot_valid.py
Resource ../../syslib/utils_os.robot
Resource ../../lib/resource.robot
Resource ../../lib/bmc_network_utils.robot
Resource ../../lib/utils.robot
Resource ../../lib/common_utils.robot
Suite Setup Suite Setup Execution
Test Setup Printn
*** Variables ***
${ip} 10.5.5.5
${dns_ip} 10.10.10.10
${domain_name} randomName.com
${parser} |grep "ipv4"|awk -F/ 'NR==1{print$5}'
${ignore_err} ${0}
*** Test Cases ***
Verify GetIP
[Documentation] Verify that openbmctool.py can run the getIP command.
[Tags] Verify_GetIP
${ip_records}= Network getIP I=eth0
${addresses}= Nested Get Address ${ip_records}
Verify IP On BMC ${addresses}[${0}]
Verify AddIP
[Documentation] Verify that openbmctool.py can run the addIP command.
[Tags] Verify_AddIP
Network addIP I=${interface} a=${ip} l=24 p=ipv4
Wait And Verify IP On BMC ${ip}
Verify GetDefaultGW
[Documentation] Verify that openbmctool.py can run the getDefaultGW command.
[Tags] Verify_GetDefaultGW
${default_gw}= Network getDefaultGW
Verify Gateway On BMC ${default_gw}
Verify RemoveIP
[Documentation] Verify that openbmctool.py can run the rmIP command.
[Tags] Verify_RemoveIP
Network addIP I=${interface} a=${ip} l=24 p=ipv4
Wait And Verify IP On BMC ${ip}
Network rmIP I=${interface} a=${ip}
${status}= Run Keyword And Return Status Wait And Verify IP On BMC ${ip}
Should Be Equal ${status} ${False}
Verify SetDNS
[Documentation] Verify that openbmctool.py can run the setDNS command.
[Tags] Verify_SetDNS
Network setDNS I=eth0 d=${dns_ip}
${dns_config}= CLI Get Nameservers
Should Contain ${dns_config} ${dns_ip}
Verify GetDNS
[Documentation] Verify that openbmctool.py can run the getDNS command.
[Tags] Verify_GetDNS
Network setDNS I=eth0 d=${dns_ip}
${dns_data}= Network getDNS I=eth0
${dns_config}= CLI Get Nameservers
Should Contain ${dns_config} ${dns_data}[${0}]
Verify SetHostName
[Documentation] Verify that openbmctool.py can run the setHostName command.
[Tags] Verify_SetHostName
Network setHostName H=randomName
${bmc_hostname}= Get BMC Hostname
Should Be Equal As Strings ${bmc_hostname} randomName
Verify GetHostName
[Documentation] Verify that openbmctool.py can run the getHostName command.
[Tags] Verify_GetHostName
${tool_hostname}= Network getHostName
${bmc_hostname}= Get BMC Hostname
Should Be Equal As Strings ${bmc_hostname} ${tool_hostname}
*** Keywords ***
Suite Setup Execution
[Documentation] Verify connectivity to run openbmctool commands.
Valid Value OPENBMC_HOST
Valid Value OPENBMC_USERNAME
Valid Value OPENBMC_PASSWORD
# Verify connectivity to the BMC host.
${bmc_version}= Get BMC Version
# Verify can find the openbmctool.
${openbmctool_file_path}= which openbmctool.py
Printn
Rprint Vars openbmctool_file_path
# Get the version number from openbmctool.
${openbmctool_version}= Get Openbmctool Version
${rc} ${res}= Openbmctool Execute Command network view-config${parser}
Set Suite Variable ${interface} ${res.strip()}
Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]
Validate Non Existence Of IP On BMC
[Documentation] Verify that IP address is not present in set of IP addresses.
[Arguments] ${ip_address} ${ip_data}
# Description of argument(s):
# ip_address IP address to check (e.g. xx.xx.xx.xx).
# ip_data Set of the IP addresses present.
Should Not Contain Match ${ip_data} ${ip_address}/*
... msg=${ip_address} found in the list provided.
Wait And Verify IP On BMC
[Documentation] Wait and verify if system IP exists.
[Arguments] ${ip}
# Description of argument(s):
# ip IP address to verify (e.g. xx.xx.xx.xx).
# Note:Network restart takes around 15-18s after network-config with openbmctool.
Sleep ${NETWORK_TIMEOUT}s
Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
Verify IP On BMC ${ip}