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