Code to verify system uptime and configure SNMP managers with different ports
Changes:
Added test case to verify system uptime
Added test case to configure multiple SNMP managers with different ports
Added test case to verify system uptime resets on BMC reboot
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
Change-Id: Ie75d2f1ec7556a4cc0f762a033f7fc2757e0b84e
diff --git a/redfish/events/test_bmc_snmp_trap.robot b/redfish/events/test_bmc_snmp_trap.robot
index 76f6914..8d1b6fb 100644
--- a/redfish/events/test_bmc_snmp_trap.robot
+++ b/redfish/events/test_bmc_snmp_trap.robot
@@ -149,6 +149,64 @@
${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
+Verify SNMP SysUpTime
+ [Documentation] Verify SNMP SysUpTime.
+ [Tags] Verify_SNMP_SysUpTime
+
+ Generate Error And Verify System Up Time
+
+
+Verify SNMP SysUpTime On BMC Reboot
+ [Documentation] Verify SNMP SysUpTime on BMC reboot.
+ [Tags] Verify_SNMP_SysUpTime_On_BMC_Reboot
+
+ # Reboot BMC to reset system uptime.
+ OBMC Reboot (off)
+
+ ${uptime}= Generate Error And Verify System Up Time
+
+ # Check if uptime is reset after reboot.
+ Should Be True ${uptime} <= 1 msg=SNMP SysUpTime is not reset on reboot
+
+
+Configure Multiple SNMP Managers With Non-default Port And Verify
+ [Documentation] Configure multiple SNMP Managers with non-default port And Verify.
+ [Tags] Configure_Multiple_SNMP_Managers_With_Non_Default_Port_And_Verify
+ [Teardown] Run Keywords
+ ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
+ ... AND
+ ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+
+ # Configure multiple SNMP managers with non-default port.
+ Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
+ Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+
+ # Verify if SNMP managers are configured.
+ Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
+ Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+
+
+Configure Multiple SNMP Managers With Different Ports And Verify
+ [Documentation] Configure multiple SNMP Managers with different ports And Verify.
+ [Tags] Configure_Multiple_SNMP_Managers_With_Different_Ports_And_Verify
+ [Teardown] Run Keywords
+ ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
+ ... AND
+ ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+ ... AND
+ ... Delete SNMP Manager Via Redfish ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
+
+ # Configure multiple SNMP managers with diffrent ports.
+ Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
+ Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+ Configure SNMP Manager Via Redfish ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
+
+ # Verify if SNMP managers are configured.
+ Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
+ Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+ Verify SNMP Manager Configured On BMC ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
+
+
*** Keywords ***
Suite Setup Execution
@@ -159,3 +217,40 @@
# Check for SNMP configurations.
Valid Value SNMP_MGR1_IP
Valid Value SNMP_DEFAULT_PORT
+
+
+Generate Error And Verify System Up Time
+ [Documentation] Generate error and verify system up time.
+
+ # Get system uptime on BMC.
+ # Example output of uptime:
+ # (8055.79 15032.86)
+
+ ${cmd_output} ${stderr} ${rc}= BMC Execute Command cat /proc/uptime
+ @{times}= Split String ${cmd_output}
+
+ ${bmc_uptime_in_minutes}= Evaluate int(${times}[0])/60
+
+ ${trap}= Create Error On BMC And Verify Trap
+
+ # Extract System up time from SNMP trap.
+ # Example - SNMP trap:
+ # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (252367) 0:42:03.67
+ # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
+ # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 54
+ # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: UInt64: 4622921648578756984
+ # SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
+ # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING:
+
+ @{words}= Split String ${trap}[0] =
+
+ ${timeticks}= Fetch From Right ${words}[1] (
+ ${snmp_sysuptime}= Fetch From Left ${timeticks} )
+
+ # SNMP SysUptime will be in milli seconds.
+ # Convert into minutes.
+ ${sysuptime_in_minutes}= Evaluate int(${snmp_sysuptime})/6000
+
+ Should Be Equal As Integers ${bmc_uptime_in_minutes} ${sysuptime_in_minutes}
+
+ [Return] ${sysuptime_in_minutes}