diff options
author | David Schwarz <david.schwarz@calxeda.com> | 2012-02-05 15:28:10 -0600 |
---|---|---|
committer | David Schwarz <david.schwarz@calxeda.com> | 2012-02-05 15:28:10 -0600 |
commit | 89b0d9343fbf3daa86538fd7c676e2081174ea54 (patch) | |
tree | ae6d050bc714cff95bc88e2905e325d96e04d221 | |
parent | 0fb38f0b66f74ba05a1f8ca475935bdd5db03e4b (diff) | |
download | pyipmi-89b0d9343fbf3daa86538fd7c676e2081174ea54.tar.gz |
Add generate test event commands
-rw-r--r-- | pyipmi/bmc.py | 6 | ||||
-rw-r--r-- | pyipmi/commands/__init__.py | 2 | ||||
-rw-r--r-- | pyipmi/commands/event.py | 49 | ||||
-rw-r--r-- | pyipmi/event.py | 12 |
4 files changed, 69 insertions, 0 deletions
diff --git a/pyipmi/bmc.py b/pyipmi/bmc.py index 2076257..eea1d75 100644 --- a/pyipmi/bmc.py +++ b/pyipmi/bmc.py @@ -240,6 +240,12 @@ class BMC(object): def pef_list_sections(self): return self.handle.pef_list_sections() + def generate_generic_event(self, event_type): + return self.handle.generic_event(event_type=event_type) + + def generate_sensor_event(self, sensor_id, state): + return self.handle.assert_sensor_event(sensor_id=sensor_id, + state=state) class LanBMC(BMC): """A BMC that's accessed over the LAN""" diff --git a/pyipmi/commands/__init__.py b/pyipmi/commands/__init__.py index 9522c8e..a805dbd 100644 --- a/pyipmi/commands/__init__.py +++ b/pyipmi/commands/__init__.py @@ -17,6 +17,7 @@ from dcmi import dcmi_commands from pef import pef_commands from freeipmi_pef import freeipmi_pef_commands from pet import pet_commands +from event import event_commands ipmi_commands = {} @@ -31,3 +32,4 @@ ipmi_commands.update(dcmi_commands) ipmi_commands.update(pef_commands) ipmi_commands.update(freeipmi_pef_commands) ipmi_commands.update(pet_commands) +ipmi_commands.update(event_commands) diff --git a/pyipmi/commands/event.py b/pyipmi/commands/event.py new file mode 100644 index 0000000..bb03f40 --- /dev/null +++ b/pyipmi/commands/event.py @@ -0,0 +1,49 @@ +#Copyright 2012 Calxeda, Inc. All Rights Reserved. +"""event related commands -- for generating test events""" + +from .. import Command +from pyipmi.event import * +from pyipmi.tools.responseparser import ResponseParserMixIn + + +class GenerateGenericEvent(Command, ResponseParserMixIn): + """Describes the generic event IPMI command + + This is "event <event_type>" to ipmitool + """ + name = "Generate Generic Event" + result_type = GenericEventResult + + response_fields = { + } + + @property + def ipmitool_args(self): + """ + """ + return ["event", self._params['event_type']] + + +class AssertSensorEvent(Command, ResponseParserMixIn): + """Describes the generic event IPMI command + + This is "event <sensorid> <state> assert" to ipmitool + """ + name = "Assert Sensor Event" + result_type = AssertSensorEventResult + + response_fields = { + } + + @property + def ipmitool_args(self): + """ + """ + return ["event", self._params['sensor_id'], + self._params['state'], 'assert'] + + +event_commands = { + 'generic_event' : GenerateGenericEvent, + 'assert_sensor_event' : AssertSensorEvent +} diff --git a/pyipmi/event.py b/pyipmi/event.py new file mode 100644 index 0000000..aabd10a --- /dev/null +++ b/pyipmi/event.py @@ -0,0 +1,12 @@ +"""ipmitool test event Results + +""" + +class GenericEventResult(object): + """Object to hold generic event generate results""" + pass + + +class AssertSensorEventResult(object): + """Object to hold sensor event generate results""" + pass |