blob: db1017278db2b2791f49561b061313737d4c5769 [file] [log] [blame]
Sushil Singh8023a8c2020-03-16 05:56:39 -05001*** Settings ***
Sushil Singhc5e9ebc2020-04-09 03:32:57 -05002Documentation Test to discover the BMC. Before running suit,
3... check BMC and Avahi browse machine should be in same subnet.
Sushil Singh8023a8c2020-03-16 05:56:39 -05004
5Variables ../../data/variables.py
6Library SSHLibrary
7Library ../../lib/external_intf/management_console_utils.py
8Library ../../lib/gen_robot_print.py
9Library ../../lib/gen_print.py
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050010Library ../../lib/gen_misc.py
11Resource ../../lib/external_intf/management_console_utils.robot
Sushil Singha2bf3f32020-04-15 05:23:57 -050012Resource ../../lib/redfish_code_update_utils.robot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050013Resource ../../lib/boot_utils.robot
Sushil Singh8023a8c2020-03-16 05:56:39 -050014Resource ../../syslib/utils_os.robot
15
16Suite Setup Suite Setup Execution
Sushil Singha2bf3f32020-04-15 05:23:57 -050017Test Teardown FFDC On Test Case Fail
Sushil Singh8023a8c2020-03-16 05:56:39 -050018
19*** Test Cases ***
20
21Discover BMC With Different Service Type
22 [Documentation] Discover all the BMC with different service type support.
23 [Tags] Discover_BMC_With_Different_Service_Type
24 [Template] Discover BMC With Service Type
25
26 # Service type
27 _obmc_rest._tcp
28 _obmc_redfish._tcp
29
30
Sushil Singhe6edfad2020-04-13 07:45:03 -050031Discover BMC Pre And Post Reboot
32 [Documentation] Discover BMC before and after reboot.
33 [Tags] Discover_BMC_Pre_And_Post_Reboot
34 [Template] Set Daemon And Discover BMC After Reboot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050035
36 # Service type
37 _obmc_rest._tcp
38 _obmc_redfish._tcp
39
Sushil Singhe6edfad2020-04-13 07:45:03 -050040
41Disable AvahiDaemon And Discover BMC After Reboot
42 [Documentation] BMC should be discoverable in next reboot even after disabling Avahi deamon.
43 [Tags] Disable_AvahiDaemon_And_Discover_BMC_After_Reboot
44 [Template] Set Daemon And Discover BMC After Reboot
45
46 # Service type skip
47 _obmc_rest._tcp True
48 _obmc_redfish._tcp True
49
Sushil Singha2bf3f32020-04-15 05:23:57 -050050
51Discover BMC Pre And Post Firmware Update Of Same Build
52 [Documentation] Discover BMC, when code update occurs for same build.
53 [Tags] Discover_BMC_Pre_And_Post_Firmware_Update_Of_Same_Build
54 [Template] Discover BMC Pre And Post Firmware Update
55
56 # Service type Service type
57 _obmc_rest._tcp _obmc_redfish._tcp
58
Sushil Singh8023a8c2020-03-16 05:56:39 -050059*** Keywords ***
60
61Suite Setup Execution
62 [Documentation] Do the suite setup.
63
64 Should Not Be Empty ${AVAHI_CLIENT}
65 Should Not Be Empty ${AVAHI_CLIENT_USERNAME}
66 Should Not Be Empty ${AVAHI_CLIENT_PASSWORD}
67 Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD}
68 Check Avahi Package
69
70
71Check Avahi Package
72 [Documentation] To check for avahi-tools package.
73
74 # Expected command output as below.
75 # avahi-tools-0.6.31-19.el7.x86_64
76
77 ${command}= Set Variable rpm -qa | grep avahi-tools
78 ${resp_rpm} ${stderr}= Execute Command ${command} return_stderr=True
79 Should Be Empty ${stderr}
80 Should Contain ${resp_rpm} avahi-tools ignore_case=True msg=avahi-tools is not available.
81
82
83Discover BMC With Service Type
84 [Documentation] To get the discoverd BMC list.
85 [Arguments] ${service_type}
86
87 # Description of argument(s):
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050088 # service_type BMC service type e.g.
89 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
Sushil Singh8023a8c2020-03-16 05:56:39 -050090
91 # bmc_list:
92 # [1]:
93 # [service]: _obmc_XXXX._tcp
94 # [hostname]: System Name
95 # [address]: XXX.XXX.XXX.XXX
96 # [port]: XXX
97 # [txt]:
98 # [2]:
99 # [service]: _obmc_XXXX._tcp
100 # [hostname]: System Name
101 # [address]: XXX.XXX.XXX.XXX
102 # [port]: XXX
103 # [txt]:
104
105 ${resp_service} ${stderr}= Execute Command avahi-browse -rt ${service_type} return_stderr=True
106 ${bmc_list} ${exc_msg}= Get BMC Records ${service_type} ${resp_service}
107 Print Timen Exception message is ${exc_msg}
108 Should Not Be Empty ${bmc_list}
109 Rprint Vars bmc_list
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500110 [Return] ${bmc_list}
111
112
113Verify Existence Of BMC Record From List
114 [Documentation] Verify the existence of BMC record from list of BMC records.
115 [Arguments] ${service_type}
116
117 # Description of argument(s):
118 # service_type BMC service type e.g.
119 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
120
121 ${bmc_list}= Discover BMC With Service Type ${service_type}
122 ${openbmc_host_name} ${openbmc_ip}= Get Host Name IP host=${OPENBMC_HOST}
123 ${resp}= Check BMC Record Exists ${bmc_list} ${openbmc_ip}
124 Should Be True 'True' == '${resp}'
125
126
Sushil Singhe6edfad2020-04-13 07:45:03 -0500127Set Daemon And Discover BMC After Reboot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500128 [Documentation] Discover BMC After reboot.
Sushil Singhe6edfad2020-04-13 07:45:03 -0500129 [Arguments] ${service_type} ${skip}=False
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500130
131 # Description of argument(s):
132 # service_type BMC service type e.g.
133 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
Sushil Singhe6edfad2020-04-13 07:45:03 -0500134 # skip Default value set to False.
135 # If the value is True, Disable the AvahiDaemon.
136 # If the value is False, skip the step to disable the AvahiDaemon.
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500137
Sushil Singhe6edfad2020-04-13 07:45:03 -0500138 Verify Existence Of BMC Record From List ${service_type}
139 Run Keyword If '${skip}' == 'True' Set AvahiDaemon Service command=stop
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500140 Redfish OBMC Reboot (off)
141 Verify AvahiDaemon Service Status message=start
142 Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD}
143 Wait Until Keyword Succeeds 2 min 30 sec
144 ... Verify Existence Of BMC Record From List ${service_type}
Sushil Singha2bf3f32020-04-15 05:23:57 -0500145
146
147Discover BMC Pre And Post Firmware Update
148 [Documentation] Discover BMC, After code update.
149 [Arguments] ${service_type1} ${service_type2}
150
151 # Description of argument(s):
152 # service_type BMC service type e.g.
153 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
154
155 Valid File Path IMAGE_FILE_PATH
156 Verify Existence Of BMC Record From List ${service_type1}
157 Verify Existence Of BMC Record From List ${service_type2}
158 Redfish.Login
159 Redfish Update Firmware apply_time=Immediate image_type=BMC image
160 Verify Existence Of BMC Record From List ${service_type1}
161 Verify Existence Of BMC Record From List ${service_type2}