Seneca-CDOT / simengine

simengine :: Hardware simulation engine for Alteeve's Anvil! Intelligent Availability platform and similar HA configurations
GNU General Public License v3.0
5 stars 7 forks source link

Minimal testcase - ipmi_sim uppercase names #15

Open ctyler opened 6 years ago

ctyler commented 6 years ago

ipmi_sim chokes on all-uppercase sensor names. Create a minimal test case to aid in debugging this.

belavina commented 5 years ago

Here's a minimal set of instructions needed to verify case-related bug:

Software Version

$ ipmi_sim -v
IPMI Simulator version 1.0.13
$ rpm -q OpenIPMI
OpenIPMI-2.0.25-8.fc29.x86_64

Correct Behaviour with Lower-Case Sensor id_string Ipmi_sim comes with a minimal BMC example out of the box (located in lanserv folder).

First, sensors need to be compiled:

$ sdrcomp -o my_statedir/ipmi_sim/ipmisim1/sdr.20.main ipmisim1.sdrs

Then start new ipmi_sim process:

$ ipmi_sim -c lan.conf -f ipmisim1.emu -s my_statedir

Querying sensor list with ipmitool (the sensor names are displayed correctly):

$ ipmitool -H localhost -p 9001 -U ipmiusr -P test sdr list
MBTemp           | 96 degrees C      | ok
SubTemp          | 0 degrees C       | ok
mm1pres          | 0x01              | ok

Upper-Case Sensor Names

Update ipmisim1.sdrs sensor “SubTemp” name to uppercase “SUBTEMP”

$ cat ipmisim1.sdrs

sdr type 18
        device_slave_address        0x20
        device_channel_number        0
        chassis                        true
        ipmb_event_gen                false
        ipmb_event_recv                false
        fru_inventory                true
        sel                        true
        sdr                        true
        sensor                        true
        entity_id                system_board
        entity_instance                1
        id_string                "IPMI sim1"
endsdr

# Watchdog timer
sdr type 3
        sensor_owner_id                0x20
        sensor_owner_lun        0
        channel_number                0
        sensor_number                0
        entity_id                system_board
        entity_instance                1
        sensor_type                Watchdog_2
        event_reading_type_code        0x6f
        id_string                "watchdog"
endsdr

# Temperature sensor on the main board
sdr type 1
        sensor_owner_id                0x20
        sensor_owner_lun        0
        channel_number                0
        sensor_number                1
        entity_id                system_board
        entity_instance                1
        sensor_type                Temperature
        init_scanning                true
        init_sensor_type        true
        default_sensor_scan_on        true
        event_reading_type_code        1
        analog_data_format        unsigned
        rate_unit                none
        modifier_unit                none
        percentage                false
        base_unit                degrees_C
        modifier_unit_code        unspecified
        linearization                linear
        m                        1
        tolerance                0
        b                        0
        accuracy                1
        accuracy_exp                0
        sensor_direction        input
        r_exp                        0
        b_exp                        0
        sensor_maximum                255
        sensor_minimum                0
        id_string                "MBTemp"
endsdr

# Temperature sensor on the sub board
sdr type 1
        sensor_owner_id                0x30
        sensor_owner_lun        0
        channel_number                0
        sensor_number                1
        entity_id                system_board
        entity_instance                1
        sensor_type                Temperature
        init_scanning                true
        init_sensor_type        true
        default_sensor_scan_on        true
        event_reading_type_code        1
        analog_data_format        unsigned
        rate_unit                none
        modifier_unit                none
        percentage                false
        base_unit                degrees_C
        modifier_unit_code        unspecified
        linearization                linear
        m                        1
        tolerance                0
        b                        0
        accuracy                1
        accuracy_exp                0
        sensor_direction        input
        r_exp                        0
        b_exp                        0
        sensor_maximum                255
        sensor_minimum                0
        id_string                "SUBTEMP"
endsdr

# A presence sensor for memory module 1
sdr type 2
        sensor_owner_id                0x20
        sensor_owner_lun        0
        channel_number                0
        sensor_number                2
        entity_id                memory_module
        entity_instance                1
        sensor_type                Entity_Presence
        event_reading_type_code        0x6f
        event0_state_ret        true
        assert_event0                true
        deassert_event0                true
        event1_state_ret        true
        assert_event1                true
        deassert_event1                true
        id_string                "mm1pres"
endsdr

# A FRU device locator for memory module 2
sdr type 0x11
        device_access_address        0x30
        fru_device_address        3
        logical_fru                1
        lun                        0
        device_type                0x10
        device_type_modifier        0
        fru_entity_id                memory_module
        fru_entity_instance        2
        id_string                "mm2frudev"
endsdr

Recompile sensors & restart ipmi_sim

$ sdrcomp -o my_statedir/ipmi_sim/ipmisim1/sdr.20.main ipmisim1.sdrs
$ ipmi_sim -c lan.conf -f ipmisim1.emu -s my_statedir

Querying sensor list with ipmitool (uppercase sensor name SUBTEMP is not displayed correctly):

$ ipmitool -H localhost -p 9001 -U ipmiusr -P test sdr list
MBTemp           | 96 degrees C      | ok
s-�e
    �           | 0 degrees C       | ok
mm1pres          | 0x01              | ok
belavina commented 5 years ago

Created bug report on official OpenIPMI project repo: https://sourceforge.net/p/openipmi/bugs/88/