1*** Settings *** 2 3Documentation Test OpenBMC GUI "SNMP Alerts" sub-menu of "Settings". 4 5Resource ../../../lib/snmp/redfish_snmp_utils.robot 6Resource ../../../lib/snmp/resource.robot 7Resource ../../lib/gui_resource.robot 8Resource ../../lib/bmc_network_utils.robot 9 10Suite Setup Suite Setup Execution 11Suite Teardown Run Keywords Redfish.Logout AND Close Browser 12 13*** Variables *** 14 15${xpath_snmp_alerts_sub_menu} //*[@data-test-id='nav-item-snmp-alerts'] 16${xpath_snmp_alerts_heading} //h1[text()="SNMP alerts"] 17${xpath_select_all_snmp} //*[@data-test-id='snmpAlerts-checkbox-selectAll'] 18${xpath_add_destination} //button[contains(text(),'Add destination')] 19${xpath_snmp_alert_destination_heading} //h5[contains(text(),'Add SNMP alert destination')] 20${xpath_ip_address_input_button} //*[@data-test-id='snmpAlerts-input-ipAddress'] 21${xpath_port_optional_input_button} //*[@data-test-id='snmpAlerts-input-port'] 22${xpath_snmp_add_destination_button} //*[@data-test-id='snmpAlerts-button-ok'] 23${xpath_cancel_button} //button[contains(text(),'Cancel')] 24${xpath_delete_button} //*[@data-test-id='snmpAlerts-button-deleteRow-undefined'] 25${xpath_delete_destination} //button[contains(text(),'Delete destination')] 26 27${snmp_page_heading} SNMP alerts 28${invalid_port_error} Value must be between 0 – 65535 29${invalid_destination_error} Error in adding SNMP alert destination 30${invalid_ip_error} Field required 31${dns_server} 10.10.10.10 32 33 34*** Test Cases *** 35 36Verify Navigation To SNMP Alerts Page 37 [Documentation] Verify navigation to SNMP alerts page. 38 [Tags] Verify_Navigation_To_SNMP_Alerts_Page 39 40 Page Should Contain Element ${xpath_snmp_alerts_heading} 41 42 43Verify Existence Of All Input Boxes In SNMP Alerts Page 44 [Documentation] Verify existence of all sections in SNMP alerts page. 45 [Tags] Verify_Existence_Of_All_Input_Boxes_In_SNMP_Alerts_Page 46 47 Page Should Contain Checkbox ${xpath_select_all_snmp} 48 49 50Verify Existence Of All Buttons In SNMP Alerts Page 51 [Documentation] Verify existence of all buttons in SNMP alerts page. 52 [Tags] Verify_Existence_Of_All_Buttons_In_SNMP_Alerts_Page 53 54 Page should Contain Button ${xpath_add_destination} 55 56 57Verify Existence Of All Fields In Add Destination 58 [Documentation] Verify existence of all buttons and fields in add destination page. 59 [Tags] Verify_Existence_Of_All_Fields_In_Add_Destination 60 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND 61 ... Wait Until Keyword Succeeds 10 sec 5 sec 62 ... Refresh GUI And Verify Element Value ${xpath_snmp_alerts_heading} ${snmp_page_heading} 63 64 Click Element ${xpath_add_destination} 65 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading} 66 Page Should Contain Element ${xpath_ip_address_input_button} 67 Page Should Contain Element ${xpath_port_optional_input_button} 68 Page Should Contain Element ${xpath_cancel_button} 69 Page Should Contain Element ${xpath_snmp_add_destination_button} 70 71 72Configure SNMP Settings On BMC With Non Default Port Via GUI And Verify 73 [Documentation] Configure SNMP settings on BMC with non default port via GUI and verify. 74 [Tags] Configure_SNMP_Settings_On_BMC_With_Non_Default_Port_Via_GUI_And_Verify 75 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 76 77 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 78 79 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s 80 81 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 82 83 84Configure SNMP Settings On BMC Via GUI And Verify 85 [Documentation] Configure SNMP settings on BMC via GUI and verify. 86 [Tags] Configure_SNMP_Settings_On_BMC_Via_GUI_And_Verify 87 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 88 89 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 90 91 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s 92 93 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 94 95 96Configure SNMP Settings On BMC With Empty Port Via GUI And Verify 97 [Documentation] Configure SNMP settings on BMC with empty port via GUI and verify. 98 [Tags] Configure_SNMP_Settings_On_BMC_With_Empty_Port_Via_GUI_And_Verify 99 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${empty_port} 100 101 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${empty_port} 102 103 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s 104 105 # SNMP Manager IP is set with default port number when no port number is provided. 106 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 107 108 109Configure Invalid SNMP Settings On BMC Via GUI And Verify 110 111 [Documentation] Configure invalid SNMP settings on BMC via GUI and verify. 112 [Tags] Configure_Invalid_SNMP_Settings_On_BMC_Via_GUI_And_Verify 113 [Template] Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify 114 115 # snmp_manager_ip snmp_manager_port Expected status 116 ${SNMP_MGR1_IP} ${out_of_range_port} ${invalid_port_error} 117 ${SNMP_MGR1_IP} ${alpha_port} ${invalid_port_error} 118 ${SNMP_MGR1_IP} ${negative_port} ${invalid_port_error} 119 ${SNMP_MGR1_IP} ${alphanumeric_port} ${invalid_port_error} 120 ${empty_ip} ${NON_DEFAULT_PORT1} ${invalid_ip_error} 121 ${out_of_range_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error} 122 ${alpha_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error} 123 ${negative_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error} 124 ${less_octet_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error} 125 126 127Configure Multiple SNMP Managers On BMC Via GUI And Verify 128 [Documentation] Configure multiple SNMP managers on BMC via GUI and verify. 129 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify 130 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify 131 132 # snmp_manager_ip snmp_port 133 ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 134 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} 135 136 137Configure Multiple SNMP Managers With Non Default Port Via GUI And Verify 138 [Documentation] Configure multiple SNMP managers with non-default port via GUI and verify. 139 [Tags] Configure_Multiple_SNMP_Managers_With_Non_Default_Port_Via_GUI_And_Verify 140 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify 141 142 # snmp_manager_ip snmp_port 143 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 144 ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1} 145 146 147Configure Multiple SNMP Managers With Different Ports Via GUI And Verify 148 [Documentation] Configure multiple SNMP managers with different ports via GUI and verify. 149 [Tags] Configure_Multiple_SNMP_Managers_With_Different_Ports_Via_GUI_And_Verify 150 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify 151 152 # snmp_manager_ip snmp_port 153 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 154 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} 155 ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2} 156 157 158Configure Multiple SNMP Managers On BMC Via GUI And Verify Persistency On BMC Reboot 159 [Documentation] Login GUI SNMP alerts page and 160 ... add multiple SNMP Managers on BMC via GUI and verify persistency on BMC reboot. 161 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify_Persistency_On_BMC_Reboot 162 [Teardown] Run Keywords Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 163 ... AND Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} 164 165 ${ip_address_list}= Create list ${SNMP_MGR1_IP} ${SNMP_MGR2_IP} 166 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 167 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s 168 169 Configure SNMP Manager Via GUI ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} 170 Wait Until Page Contains ${SNMP_MGR2_IP} timeout=45s 171 172 # Reboot BMC and check persistency SNMP manager. 173 Reboot BMC via GUI 174 175 Navigate To SNMP Alerts Page 176 177 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 178 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} 179 180 181Configure SNMP Manager Via GUI And Verify SNMP Trap 182 [Documentation] Login GUI SNMP alerts page and add SNMP manager via GUI 183 ... and generate error on BMC and verify trap and its fields. 184 [Tags] Configure_SNMP_Manager_Via_GUI_And_Verify_SNMP_Trap 185 [Template] Create Error On BMC And Verify Trap On Default Port 186 187 # event_log expected_error 188 189 # Generate internal failure error. 190 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} 191 192 # Generate timeout error. 193 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR} 194 195 # Generate informational error. 196 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} 197 198 199Configure SNMP Manager By Its Hostname Via GUI And Verify 200 [Documentation] Login GUI SNMP alerts page and add SNMP manager with its hostname 201 ... via GUI and verify. 202 [Tags] Configure_SNMP_Manager_By_Its_Hostname_Via_GUI_And_Verify 203 204 Set DNS Server IP 205 206 # Navigate to SNMP page and configure SNMP manager. 207 Click Element ${xpath_snmp_alerts_sub_menu} 208 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts 209 210 Configure SNMP Manager Via GUI ${SNMP_HOSTNAME} ${SNMP_DEFAULT_PORT} 211 Wait Until Page Contains ${SNMP_HOSTNAME} timeout=15s 212 213 214Verify Persistency Of SNMP Manager And Trap On BMC Reboot 215 [Documentation] Configure the SNMP manager and verify that it remains operational 216 ... after a BMC system reboot. Also, confirm that a trap is successfully sent. 217 [Tags] Verify_Persistency_Of_SNMP_Manager_And_Trap_On_BMC_Reboot 218 [Template] Create Error On BMC And Verify Trap On Default Port 219 220 # event_log expected_error persistency_check 221 222 # Generate internal failure error. 223 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} ${True} 224 225 # Generate timeout error. 226 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR} ${True} 227 228 # Generate informational error. 229 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} ${True} 230 231 232Configure SNMP Manager Via GUI And Verify SNMP Trap On Non Default Port 233 [Documentation] Add SNMP manager via GUI SNMP alerts page, generate error on BMC 234 ... and verify trap on non default port. 235 [Tags] Configure_SNMP_Manager_Via_GUI_And_Verify_SNMP_Trap_On_Non_Default_Port 236 [Template] Generate Error Log On BMC And Verify Trap On Non Default Port 237 238 # event_log_cmd trap_msg 239 240 # Generate internal failure error. 241 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} 242 243 # Generate timeout error. 244 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR} 245 246 # Generate informational error. 247 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} 248 249 250Configure Multiple SNMP Managers Via GUI And Verify SNMP Trap 251 [Documentation] Configure multiple SNMP Managers on BMC via GUI and check trap. 252 [Tags] Configure_Multiple_SNMP_Managers_Via_GUI_And_Verify_SNMP_Trap 253 [Teardown] Run Keywords Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 254 ... AND Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1} 255 256 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 257 Configure SNMP Manager Via GUI ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1} 258 259 # Check if trap is generated and sent to SNMP managers those are configured. 260 261 Create Error Log On BMC And Verify Trap ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} 262 263 264*** Keywords *** 265 266Suite Setup Execution 267 [Documentation] Do test case setup tasks. 268 269 Launch Browser And Login GUI 270 271 Click Element ${xpath_settings_menu} 272 Click Element ${xpath_snmp_alerts_sub_menu} 273 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts 274 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 275 Redfish.Login 276 277 278Configure SNMP Manager Via GUI 279 [Documentation] Configure SNMP manager via GUI. 280 [Arguments] ${snmp_ip} ${port} 281 282 # Description of argument(s): 283 # snmp_ip SNMP manager IP address. 284 # port SNMP manager port. 285 286 Click Element ${xpath_add_destination} 287 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading} 288 Input Text ${xpath_ip_address_input_button} ${snmp_ip} 289 Wait Until Keyword Succeeds 30 sec 5 sec Get Value ${xpath_ip_address_input_button} 290 Input Text ${xpath_port_optional_input_button} ${port} 291 Click Element ${xpath_snmp_add_destination_button} 292 293 294Delete All SNMP Managers Via GUI 295 [Documentation] Delete SNMP manager via GUI. 296 297 Wait Until Page Contains Element ${xpath_select_all_snmp} timeout=30s 298 Click Element At Coordinates ${xpath_select_all_snmp} 0 0 299 Wait Until Keyword Succeeds 30 sec 5 sec Click Element ${xpath_delete_button} 300 Wait Until Page Contains Delete SNMP alert destination 301 Click Element ${xpath_delete_destination} 302 Wait Until Page Contains Successfully deleted SNMP alert destination timeout=45s 303 Wait Until Keyword Succeeds 30 sec 10 sec Refresh GUI And Verify Element Value 304 ... ${xpath_snmp_alerts_heading} ${snmp_page_heading} 305 306 307Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify 308 309 [Documentation] Configure SNMP manager on BMC with invalid setting via GUI and verify. 310 [Arguments] ${snmp_manager_ip} ${snmp_manager_port} ${expected_error} 311 [Teardown] Close Add SNMP Alerts Destination Window ${expected_error} 312 313 # Description of argument(s): 314 # snmp_manager_ip SNMP manager IP address. 315 # snmp_manager_port SNMP manager port. 316 # expected_error Expected error optionally provided in testcase 317 # .... (e.g. Invalid format / Value must be between 0 – 65535). 318 319 Configure SNMP Manager Via GUI ${snmp_manager_ip} ${snmp_manager_port} 320 Wait Until Page Contains ${expected_error} timeout=60sec 321 ${status}= Run Keyword And Return Status 322 ... Verify SNMP Manager Configured On BMC ${snmp_manager_ip} ${snmp_manager_port} 323 Should Be Equal As Strings ${status} False 324 ... msg=BMC is allowing to configure with invalid SNMP settings. 325 326 327Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify 328 [Documentation] Configure multiple SNMP managers on BMC with valid port value via GUI and verify. 329 [Arguments] ${snmp_ip_value} ${snmp_port_value} 330 [Teardown] Delete SNMP Manager Via Redfish ${snmp_ip_value} ${snmp_port_value} 331 332 # Description of argument(s): 333 # snmp_ip_value SNMP manager IP address. 334 # snmp_port_value SNMP manager port. 335 336 Configure SNMP Manager Via GUI ${snmp_ip_value} ${snmp_port_value} 337 Verify SNMP Manager Configured On BMC ${snmp_ip_value} ${snmp_port_value} 338 339 340Create Error On BMC And Verify Trap On Default Port 341 [Documentation] Generate error on BMC and verify if trap is sent to default port. 342 [Arguments] ${event_log}=${CMD_INTERNAL_FAILURE} ${expected_error}=${SNMP_TRAP_BMC_INTERNAL_FAILURE} 343 ... ${persistency_check}=${False} 344 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 345 346 # Description of argument(s): 347 # event_log Event logs to be created. 348 # expected_error Expected error on SNMP. 349 # persistency_check Check whether reboot is required or not (e.g. True, False). 350 351 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} 352 353 IF ${persistency_check} == ${True} 354 Reboot BMC via GUI 355 Navigate To SNMP Alerts Page 356 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 357 END 358 359 Start SNMP Manager 360 361 # Generate error log. 362 BMC Execute Command ${event_log} 363 364 SSHLibrary.Switch Connection snmp_server 365 ${SNMP_LISTEN_OUT}= Read delay=1s 366 367 # Stop SNMP manager process. 368 SSHLibrary.Execute Command sudo killall snmptrapd 369 370 # Sample SNMP trap: 371 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]: 372 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73 373 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1 374 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: 375 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3 376 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure" 377 378 ${lines}= Split To Lines ${SNMP_LISTEN_OUT} 379 ${trap_info}= Get From List ${lines} -1 380 ${snmp_trap}= Split String ${trap_info} \t 381 382 Verify SNMP Trap ${snmp_trap} ${expected_error} 383 384 385Close Add SNMP Alerts Destination Window 386 [Documentation] Close Add SNMP Alerts Destination window. 387 [Arguments] ${expected_error}=${invalid_port_error} 388 389 # Description of argument(s): 390 # expected_error Expected error on SNMP alerts page. 391 392 Run Keyword If '${expected_error}' == '${invalid_port_error}' 393 ... Click Element ${xpath_cancel_button} 394 ... ELSE IF '${expected_error}' == '${invalid_ip_error}' 395 ... Click Element ${xpath_cancel_button} 396 397 398Set DNS Server IP 399 [Documentation] Add static DNS IP. 400 401 Wait Until Page Contains Element ${xpath_settings_menu} timeout=30s 402 Click Element ${xpath_settings_menu} 403 Click Element ${xpath_network_sub_menu} 404 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network 405 406 Add DNS Servers And Verify ${dns_server} 407 408 409Delete Multiple SNMP Managers With Default Port Via GUI 410 [Documentation] Delete multiple SNMP managers with default port on BMC via GUI. 411 [Arguments] ${ip_address_list} 412 413 # Description of argument(s): 414 # ${ip_address_list} List of IP address. 415 416 FOR ${ip_address} IN @{ip_address_list} 417 Wait Until Keyword Succeeds 30 sec 10 sec 418 ... Delete SNMP Manager Via GUI ${ip_address} ${SNMP_DEFAULT_PORT} 419 END 420 421 422Navigate To SNMP Alerts Page 423 [Documentation] Navigate to SNMP alerts page. 424 425 Click Element ${xpath_settings_menu} 426 Click Element ${xpath_snmp_alerts_sub_menu} 427 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts 428 429 430Generate Error Log On BMC And Verify Trap On Non Default Port 431 [Documentation] Generate error log on BMC and verify if trap is sent to non default port. 432 [Arguments] ${event_log_cmd} ${trap_msg} 433 ... ${persistency_check}=${False} 434 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 435 436 # Description of argument(s): 437 # event_log_cmd Event logs to be created. 438 # trap_msg Expected trap on SNMP. 439 440 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 441 442 IF ${persistency_check} == ${True} 443 Reboot BMC via GUI 444 Navigate To SNMP Alerts Page 445 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 446 END 447 448 Start SNMP Manager On Specific Port ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} 449 450 # Generate error log. 451 BMC Execute Command ${event_log_cmd} 452 453 SSHLibrary.Switch Connection snmp_server 454 ${SNMP_LISTEN_OUT}= Read delay=1s 455 456 # Stop SNMP manager process. 457 SSHLibrary.Execute Command sudo killall snmptrapd 458 459 # Reference URL for SNMP MIB. 460 # https://github.com/openbmc/phosphor-snmp/blob/master/mibs/NotificationMIB.txt 461 462 # Sample SNMP trap: 463 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]: 464 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73 465 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1 466 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: 467 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3 468 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure" 469 470 ${snmp_info_list}= Split To Lines ${SNMP_LISTEN_OUT} 471 ${trap_info}= Get From List ${snmp_info_list} -1 472 ${snmp_trap}= Split String ${trap_info} \t 473 474 Verify SNMP Trap ${snmp_trap} ${trap_msg} 475 476 477Create Error Log On BMC And Verify Trap 478 [Documentation] Generate error on BMC 479 ... and check whether the trap is sent to all those are configured. 480 [Arguments] ${event_log_cmd} ${trap_msg} 481 482 # Description of argument(s): 483 # event_log_cmd Command to generate error log. 484 # trap_msg Expected trap on SNMP. 485 486 Start Multiple SNMP Managers On Specific Port 487 488 # Generate error log. 489 BMC Execute Command ${event_log_cmd} 490 491 ${alias}= Create List snmp_server1 snmp_server2 492 493 FOR ${snmp_server} IN @{alias} 494 SSHLibrary.Switch Connection ${snmp_server} 495 496 ${SNMP_LISTEN_OUT}= Read delay=1s 497 498 # Stop SNMP manager process. 499 SSHLibrary.Execute Command sudo killall snmptrapd 500 501 # Sample SNMP trap: 502 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]: 503 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73 504 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1 505 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 506 # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: 507 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3 508 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure" 509 510 ${lines}= Split To Lines ${SNMP_LISTEN_OUT} 511 ${trap_info}= Get From List ${lines} -1 512 ${snmp_trap}= Split String ${trap_info} \t 513 514 Verify SNMP Trap ${snmp_trap} ${trap_msg} 515 END 516 517 518Start Multiple SNMP Managers On Specific Port 519 [Documentation] Start multiple SNMP managers on specific port. 520 521 Open Connection And Log In ${SNMP_MGR1_USERNAME} ${SNMP_MGR1_PASSWORD} 522 ... alias=snmp_server1 host=${SNMP_MGR1_IP} 523 524 SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR1_IP}:${SNMP_DEFAULT_PORT} & 525 526 Open Connection And Log In ${SNMP_MGR2_USERNAME} ${SNMP_MGR2_PASSWORD} 527 ... alias=snmp_server2 host=${SNMP_MGR2_IP} 528 529 # The execution of the SNMP_TRAPD_CMD is necessary to cause SNMP to begin 530 # listening to SNMP messages. 531 SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR2_IP}:${NON_DEFAULT_PORT1} & 532