xref: /openbmc/openbmc-test-automation/openpower/ext_interfaces/test_discovery.robot (revision 6a8cb08f2819dc5557764ff779024ac57362fe56)
18023a8cfSSushil Singh*** Settings ***
2c5e9ebc6SSushil SinghDocumentation        Test to discover the BMC. Before running suit,
3c5e9ebc6SSushil Singh...                  check BMC and Avahi browse machine should be in same subnet.
48023a8cfSSushil Singh
58023a8cfSSushil SinghVariables            ../../data/variables.py
68023a8cfSSushil SinghLibrary              SSHLibrary
78023a8cfSSushil SinghLibrary              ../../lib/external_intf/management_console_utils.py
88023a8cfSSushil SinghLibrary              ../../lib/gen_robot_print.py
98023a8cfSSushil SinghLibrary              ../../lib/gen_print.py
10c5e9ebc6SSushil SinghLibrary              ../../lib/gen_misc.py
11c5e9ebc6SSushil SinghResource             ../../lib/external_intf/management_console_utils.robot
12a2bf3f3cSSushil SinghResource             ../../lib/redfish_code_update_utils.robot
13c5e9ebc6SSushil SinghResource             ../../lib/boot_utils.robot
148023a8cfSSushil SinghResource             ../../syslib/utils_os.robot
158023a8cfSSushil Singh
168023a8cfSSushil SinghSuite Setup          Suite Setup Execution
17a2bf3f3cSSushil SinghTest Teardown        FFDC On Test Case Fail
188023a8cfSSushil Singh
198023a8cfSSushil Singh*** Test Cases ***
208023a8cfSSushil Singh
218023a8cfSSushil SinghDiscover BMC With Different Service Type
228023a8cfSSushil Singh    [Documentation]  Discover all the BMC with different service type support.
238023a8cfSSushil Singh    [Tags]  Discover_BMC_With_Different_Service_Type
248023a8cfSSushil Singh    [Template]  Discover BMC With Service Type
258023a8cfSSushil Singh
268023a8cfSSushil Singh    # Service type
278023a8cfSSushil Singh    _obmc_rest._tcp
288023a8cfSSushil Singh    _obmc_redfish._tcp
298023a8cfSSushil Singh
308023a8cfSSushil Singh
31e6edfadbSSushil SinghDiscover BMC Pre And Post Reboot
32e6edfadbSSushil Singh    [Documentation]  Discover BMC before and after reboot.
33e6edfadbSSushil Singh    [Tags]  Discover_BMC_Pre_And_Post_Reboot
34e6edfadbSSushil Singh    [Template]  Set Daemon And Discover BMC After Reboot
35c5e9ebc6SSushil Singh
36c5e9ebc6SSushil Singh    # Service type
37c5e9ebc6SSushil Singh    _obmc_rest._tcp
38c5e9ebc6SSushil Singh    _obmc_redfish._tcp
39c5e9ebc6SSushil Singh
40e6edfadbSSushil Singh
41e6edfadbSSushil SinghDisable AvahiDaemon And Discover BMC After Reboot
42e6edfadbSSushil Singh    [Documentation]  BMC should be discoverable in next reboot even after disabling Avahi deamon.
43e6edfadbSSushil Singh    [Tags]  Disable_AvahiDaemon_And_Discover_BMC_After_Reboot
44e6edfadbSSushil Singh    [Template]  Set Daemon And Discover BMC After Reboot
45e6edfadbSSushil Singh
46e6edfadbSSushil Singh    # Service type       skip
47e6edfadbSSushil Singh    _obmc_rest._tcp      True
48e6edfadbSSushil Singh    _obmc_redfish._tcp   True
49e6edfadbSSushil Singh
50a2bf3f3cSSushil Singh
51a2bf3f3cSSushil SinghDiscover BMC Pre And Post Firmware Update Of Same Build
52a2bf3f3cSSushil Singh    [Documentation]  Discover BMC, when code update occurs for same build.
53a2bf3f3cSSushil Singh    [Tags]  Discover_BMC_Pre_And_Post_Firmware_Update_Of_Same_Build
54a2bf3f3cSSushil Singh    [Template]  Discover BMC Pre And Post Firmware Update
55a2bf3f3cSSushil Singh
56a2bf3f3cSSushil Singh    # Service type   Service type
57a2bf3f3cSSushil Singh    _obmc_rest._tcp  _obmc_redfish._tcp
58a2bf3f3cSSushil Singh
59*6a8cb08fSSushil Singh
60*6a8cb08fSSushil SinghDiscover BMC Pre And Post Firmware Update Of Different Build
61*6a8cb08fSSushil Singh    [Documentation]  Discover BMC when code update occurs for different release.
62*6a8cb08fSSushil Singh    [Tags]  Discover_BMC_Pre_And_Post_Firmware_Update_Of_Different_Build
63*6a8cb08fSSushil Singh    [Template]  Discover BMC Pre And Post Firmware Update
64*6a8cb08fSSushil Singh
65*6a8cb08fSSushil Singh    # Service type   Service type
66*6a8cb08fSSushil Singh    _obmc_rest._tcp  _obmc_redfish._tcp
67*6a8cb08fSSushil Singh
688023a8cfSSushil Singh*** Keywords ***
698023a8cfSSushil Singh
708023a8cfSSushil SinghSuite Setup Execution
718023a8cfSSushil Singh    [Documentation]  Do the suite setup.
728023a8cfSSushil Singh
738023a8cfSSushil Singh    Should Not Be Empty  ${AVAHI_CLIENT}
748023a8cfSSushil Singh    Should Not Be Empty  ${AVAHI_CLIENT_USERNAME}
758023a8cfSSushil Singh    Should Not Be Empty  ${AVAHI_CLIENT_PASSWORD}
768023a8cfSSushil Singh    Login To OS  ${AVAHI_CLIENT}  ${AVAHI_CLIENT_USERNAME}  ${AVAHI_CLIENT_PASSWORD}
778023a8cfSSushil Singh    Check Avahi Package
788023a8cfSSushil Singh
798023a8cfSSushil Singh
808023a8cfSSushil SinghCheck Avahi Package
818023a8cfSSushil Singh    [Documentation]  To check for avahi-tools package.
828023a8cfSSushil Singh
838023a8cfSSushil Singh    # Expected command output as below.
848023a8cfSSushil Singh    # avahi-tools-0.6.31-19.el7.x86_64
858023a8cfSSushil Singh
868023a8cfSSushil Singh    ${command}=  Set Variable  rpm -qa | grep avahi-tools
878023a8cfSSushil Singh    ${resp_rpm}  ${stderr}=  Execute Command  ${command}  return_stderr=True
888023a8cfSSushil Singh    Should Be Empty  ${stderr}
898023a8cfSSushil Singh    Should Contain  ${resp_rpm}  avahi-tools  ignore_case=True  msg=avahi-tools is not available.
908023a8cfSSushil Singh
918023a8cfSSushil Singh
928023a8cfSSushil SinghDiscover BMC With Service Type
938023a8cfSSushil Singh    [Documentation]  To get the discoverd BMC list.
948023a8cfSSushil Singh    [Arguments]  ${service_type}
958023a8cfSSushil Singh
968023a8cfSSushil Singh    # Description of argument(s):
978023a8cfSSushil Singh    # service_type  BMC service type e.g.
988023a8cfSSushil Singh    #               (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
998023a8cfSSushil Singh
1008023a8cfSSushil Singh    # bmc_list:
1018023a8cfSSushil Singh    # [1]:
1028023a8cfSSushil Singh    #    [service]:          _obmc_XXXX._tcp
1038023a8cfSSushil Singh    #    [hostname]:         System Name
1048023a8cfSSushil Singh    #    [address]:          XXX.XXX.XXX.XXX
1058023a8cfSSushil Singh    #    [port]:             XXX
1068023a8cfSSushil Singh    #    [txt]:
1078023a8cfSSushil Singh    # [2]:
1088023a8cfSSushil Singh    #    [service]:          _obmc_XXXX._tcp
1098023a8cfSSushil Singh    #    [hostname]:         System Name
1108023a8cfSSushil Singh    #    [address]:          XXX.XXX.XXX.XXX
1118023a8cfSSushil Singh    #    [port]:             XXX
1128023a8cfSSushil Singh    #    [txt]:
1138023a8cfSSushil Singh
1148023a8cfSSushil Singh    ${resp_service}  ${stderr}=  Execute Command  avahi-browse -rt ${service_type}  return_stderr=True
1158023a8cfSSushil Singh    ${bmc_list}  ${exc_msg}=  Get BMC Records  ${service_type}  ${resp_service}
1168023a8cfSSushil Singh    Print Timen  Exception message is ${exc_msg}
1178023a8cfSSushil Singh    Should Not Be Empty  ${bmc_list}
1188023a8cfSSushil Singh    Rprint Vars  bmc_list
119c5e9ebc6SSushil Singh    [Return]  ${bmc_list}
120c5e9ebc6SSushil Singh
121c5e9ebc6SSushil Singh
122c5e9ebc6SSushil SinghVerify Existence Of BMC Record From List
123c5e9ebc6SSushil Singh    [Documentation]  Verify the existence of BMC record from list of BMC records.
124c5e9ebc6SSushil Singh    [Arguments]  ${service_type}
125c5e9ebc6SSushil Singh
126c5e9ebc6SSushil Singh    # Description of argument(s):
127c5e9ebc6SSushil Singh    # service_type  BMC service type e.g.
128c5e9ebc6SSushil Singh    #               (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
129c5e9ebc6SSushil Singh
130c5e9ebc6SSushil Singh    ${bmc_list}=  Discover BMC With Service Type  ${service_type}
131c5e9ebc6SSushil Singh    ${openbmc_host_name}  ${openbmc_ip}=  Get Host Name IP  host=${OPENBMC_HOST}
132c5e9ebc6SSushil Singh    ${resp}=  Check BMC Record Exists  ${bmc_list}  ${openbmc_ip}
133c5e9ebc6SSushil Singh    Should Be True  'True' == '${resp}'
134c5e9ebc6SSushil Singh
135c5e9ebc6SSushil Singh
136e6edfadbSSushil SinghSet Daemon And Discover BMC After Reboot
137c5e9ebc6SSushil Singh    [Documentation]  Discover BMC After reboot.
138e6edfadbSSushil Singh    [Arguments]  ${service_type}  ${skip}=False
139c5e9ebc6SSushil Singh
140c5e9ebc6SSushil Singh    # Description of argument(s):
141c5e9ebc6SSushil Singh    # service_type  BMC service type e.g.
142c5e9ebc6SSushil Singh    #               (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
143e6edfadbSSushil Singh    # skip          Default value set to False.
144e6edfadbSSushil Singh    #               If the value is True, Disable the AvahiDaemon.
145e6edfadbSSushil Singh    #               If the value is False, skip the step to disable the AvahiDaemon.
146c5e9ebc6SSushil Singh
147e6edfadbSSushil Singh    Verify Existence Of BMC Record From List  ${service_type}
148e6edfadbSSushil Singh    Run Keyword If  '${skip}' == 'True'  Set AvahiDaemon Service  command=stop
149c5e9ebc6SSushil Singh    Redfish OBMC Reboot (off)
150c5e9ebc6SSushil Singh    Verify AvahiDaemon Service Status  message=start
151c5e9ebc6SSushil Singh    Login To OS  ${AVAHI_CLIENT}  ${AVAHI_CLIENT_USERNAME}  ${AVAHI_CLIENT_PASSWORD}
152c5e9ebc6SSushil Singh    Wait Until Keyword Succeeds  2 min  30 sec
153c5e9ebc6SSushil Singh    ...  Verify Existence Of BMC Record From List  ${service_type}
154a2bf3f3cSSushil Singh
155a2bf3f3cSSushil Singh
156a2bf3f3cSSushil SinghDiscover BMC Pre And Post Firmware Update
157a2bf3f3cSSushil Singh    [Documentation]  Discover BMC, After code update.
158a2bf3f3cSSushil Singh    [Arguments]  ${service_type1}  ${service_type2}
159a2bf3f3cSSushil Singh
160a2bf3f3cSSushil Singh    # Description of argument(s):
161a2bf3f3cSSushil Singh    # service_type  BMC service type e.g.
162a2bf3f3cSSushil Singh    #               (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
163a2bf3f3cSSushil Singh
164a2bf3f3cSSushil Singh    Valid File Path  IMAGE_FILE_PATH
165a2bf3f3cSSushil Singh    Verify Existence Of BMC Record From List  ${service_type1}
166a2bf3f3cSSushil Singh    Verify Existence Of BMC Record From List  ${service_type2}
167a2bf3f3cSSushil Singh    Redfish.Login
168a2bf3f3cSSushil Singh    Redfish Update Firmware  apply_time=Immediate   image_type=BMC image
169a2bf3f3cSSushil Singh    Verify Existence Of BMC Record From List  ${service_type1}
170a2bf3f3cSSushil Singh    Verify Existence Of BMC Record From List  ${service_type2}
171