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 12c5e9ebc6SSushil SinghResource ../../lib/boot_utils.robot 138023a8cfSSushil SinghResource ../../syslib/utils_os.robot 148023a8cfSSushil Singh 158023a8cfSSushil SinghSuite Setup Suite Setup Execution 168023a8cfSSushil Singh 178023a8cfSSushil Singh*** Test Cases *** 188023a8cfSSushil Singh 198023a8cfSSushil SinghDiscover BMC With Different Service Type 208023a8cfSSushil Singh [Documentation] Discover all the BMC with different service type support. 218023a8cfSSushil Singh [Tags] Discover_BMC_With_Different_Service_Type 228023a8cfSSushil Singh [Template] Discover BMC With Service Type 238023a8cfSSushil Singh 248023a8cfSSushil Singh # Service type 258023a8cfSSushil Singh _obmc_rest._tcp 268023a8cfSSushil Singh _obmc_redfish._tcp 278023a8cfSSushil Singh 288023a8cfSSushil Singh 29*e6edfadbSSushil SinghDiscover BMC Pre And Post Reboot 30*e6edfadbSSushil Singh [Documentation] Discover BMC before and after reboot. 31*e6edfadbSSushil Singh [Tags] Discover_BMC_Pre_And_Post_Reboot 32*e6edfadbSSushil Singh [Template] Set Daemon And Discover BMC After Reboot 33c5e9ebc6SSushil Singh 34c5e9ebc6SSushil Singh # Service type 35c5e9ebc6SSushil Singh _obmc_rest._tcp 36c5e9ebc6SSushil Singh _obmc_redfish._tcp 37c5e9ebc6SSushil Singh 38*e6edfadbSSushil Singh 39*e6edfadbSSushil SinghDisable AvahiDaemon And Discover BMC After Reboot 40*e6edfadbSSushil Singh [Documentation] BMC should be discoverable in next reboot even after disabling Avahi deamon. 41*e6edfadbSSushil Singh [Tags] Disable_AvahiDaemon_And_Discover_BMC_After_Reboot 42*e6edfadbSSushil Singh [Template] Set Daemon And Discover BMC After Reboot 43*e6edfadbSSushil Singh 44*e6edfadbSSushil Singh # Service type skip 45*e6edfadbSSushil Singh _obmc_rest._tcp True 46*e6edfadbSSushil Singh _obmc_redfish._tcp True 47*e6edfadbSSushil Singh 488023a8cfSSushil Singh*** Keywords *** 498023a8cfSSushil Singh 508023a8cfSSushil SinghSuite Setup Execution 518023a8cfSSushil Singh [Documentation] Do the suite setup. 528023a8cfSSushil Singh 538023a8cfSSushil Singh Should Not Be Empty ${AVAHI_CLIENT} 548023a8cfSSushil Singh Should Not Be Empty ${AVAHI_CLIENT_USERNAME} 558023a8cfSSushil Singh Should Not Be Empty ${AVAHI_CLIENT_PASSWORD} 568023a8cfSSushil Singh Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD} 578023a8cfSSushil Singh Check Avahi Package 588023a8cfSSushil Singh 598023a8cfSSushil Singh 608023a8cfSSushil SinghCheck Avahi Package 618023a8cfSSushil Singh [Documentation] To check for avahi-tools package. 628023a8cfSSushil Singh 638023a8cfSSushil Singh # Expected command output as below. 648023a8cfSSushil Singh # avahi-tools-0.6.31-19.el7.x86_64 658023a8cfSSushil Singh 668023a8cfSSushil Singh ${command}= Set Variable rpm -qa | grep avahi-tools 678023a8cfSSushil Singh ${resp_rpm} ${stderr}= Execute Command ${command} return_stderr=True 688023a8cfSSushil Singh Should Be Empty ${stderr} 698023a8cfSSushil Singh Should Contain ${resp_rpm} avahi-tools ignore_case=True msg=avahi-tools is not available. 708023a8cfSSushil Singh 718023a8cfSSushil Singh 728023a8cfSSushil SinghDiscover BMC With Service Type 738023a8cfSSushil Singh [Documentation] To get the discoverd BMC list. 748023a8cfSSushil Singh [Arguments] ${service_type} 758023a8cfSSushil Singh 768023a8cfSSushil Singh # Description of argument(s): 778023a8cfSSushil Singh # service_type BMC service type e.g. 788023a8cfSSushil Singh # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). 798023a8cfSSushil Singh 808023a8cfSSushil Singh # bmc_list: 818023a8cfSSushil Singh # [1]: 828023a8cfSSushil Singh # [service]: _obmc_XXXX._tcp 838023a8cfSSushil Singh # [hostname]: System Name 848023a8cfSSushil Singh # [address]: XXX.XXX.XXX.XXX 858023a8cfSSushil Singh # [port]: XXX 868023a8cfSSushil Singh # [txt]: 878023a8cfSSushil Singh # [2]: 888023a8cfSSushil Singh # [service]: _obmc_XXXX._tcp 898023a8cfSSushil Singh # [hostname]: System Name 908023a8cfSSushil Singh # [address]: XXX.XXX.XXX.XXX 918023a8cfSSushil Singh # [port]: XXX 928023a8cfSSushil Singh # [txt]: 938023a8cfSSushil Singh 948023a8cfSSushil Singh ${resp_service} ${stderr}= Execute Command avahi-browse -rt ${service_type} return_stderr=True 958023a8cfSSushil Singh ${bmc_list} ${exc_msg}= Get BMC Records ${service_type} ${resp_service} 968023a8cfSSushil Singh Print Timen Exception message is ${exc_msg} 978023a8cfSSushil Singh Should Not Be Empty ${bmc_list} 988023a8cfSSushil Singh Rprint Vars bmc_list 99c5e9ebc6SSushil Singh [Return] ${bmc_list} 100c5e9ebc6SSushil Singh 101c5e9ebc6SSushil Singh 102c5e9ebc6SSushil SinghVerify Existence Of BMC Record From List 103c5e9ebc6SSushil Singh [Documentation] Verify the existence of BMC record from list of BMC records. 104c5e9ebc6SSushil Singh [Arguments] ${service_type} 105c5e9ebc6SSushil Singh 106c5e9ebc6SSushil Singh # Description of argument(s): 107c5e9ebc6SSushil Singh # service_type BMC service type e.g. 108c5e9ebc6SSushil Singh # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). 109c5e9ebc6SSushil Singh 110c5e9ebc6SSushil Singh ${bmc_list}= Discover BMC With Service Type ${service_type} 111c5e9ebc6SSushil Singh ${openbmc_host_name} ${openbmc_ip}= Get Host Name IP host=${OPENBMC_HOST} 112c5e9ebc6SSushil Singh ${resp}= Check BMC Record Exists ${bmc_list} ${openbmc_ip} 113c5e9ebc6SSushil Singh Should Be True 'True' == '${resp}' 114c5e9ebc6SSushil Singh 115c5e9ebc6SSushil Singh 116*e6edfadbSSushil SinghSet Daemon And Discover BMC After Reboot 117c5e9ebc6SSushil Singh [Documentation] Discover BMC After reboot. 118*e6edfadbSSushil Singh [Arguments] ${service_type} ${skip}=False 119c5e9ebc6SSushil Singh 120c5e9ebc6SSushil Singh # Description of argument(s): 121c5e9ebc6SSushil Singh # service_type BMC service type e.g. 122c5e9ebc6SSushil Singh # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). 123*e6edfadbSSushil Singh # skip Default value set to False. 124*e6edfadbSSushil Singh # If the value is True, Disable the AvahiDaemon. 125*e6edfadbSSushil Singh # If the value is False, skip the step to disable the AvahiDaemon. 126c5e9ebc6SSushil Singh 127*e6edfadbSSushil Singh Verify Existence Of BMC Record From List ${service_type} 128*e6edfadbSSushil Singh Run Keyword If '${skip}' == 'True' Set AvahiDaemon Service command=stop 129c5e9ebc6SSushil Singh Redfish OBMC Reboot (off) 130c5e9ebc6SSushil Singh Verify AvahiDaemon Service Status message=start 131c5e9ebc6SSushil Singh Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD} 132c5e9ebc6SSushil Singh Wait Until Keyword Succeeds 2 min 30 sec 133c5e9ebc6SSushil Singh ... Verify Existence Of BMC Record From List ${service_type} 134