From bdf6908cdaa2e2820d46511a6f3cd7e471d672f1 Mon Sep 17 00:00:00 2001 From: George Kraft Date: Tue, 5 Nov 2013 17:03:44 -0600 Subject: CXMAN-231: Add bindings for the PMIC get version command --- pyipmi/bmc.py | 4 ++++ pyipmi/commands/__init__.py | 2 ++ pyipmi/commands/pmic.py | 50 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 pyipmi/commands/pmic.py diff --git a/pyipmi/bmc.py b/pyipmi/bmc.py index f7f2222..d84e842 100644 --- a/pyipmi/bmc.py +++ b/pyipmi/bmc.py @@ -580,6 +580,10 @@ class BMC(object): return self.handle.fabric_info_getdepthchart(filename=filename, tftp_addr=tftp_addr) + def pmic_get_version(self): + return self.handle.pmic_get_version() + + class LanBMC(BMC): """A BMC that's accessed over the LAN""" def __init__(self, diff --git a/pyipmi/commands/__init__.py b/pyipmi/commands/__init__.py index 380aaf6..0ec7cbd 100644 --- a/pyipmi/commands/__init__.py +++ b/pyipmi/commands/__init__.py @@ -60,6 +60,7 @@ from bootparam import bootparam_commands from mc import mc_commands from data import data_commands from info import info_commands +from pmic import pmic_commands ipmi_commands = {} @@ -87,3 +88,4 @@ ipmi_commands.update(bootparam_commands) ipmi_commands.update(mc_commands) ipmi_commands.update(data_commands) ipmi_commands.update(info_commands) +ipmi_commands.update(pmic_commands) diff --git a/pyipmi/commands/pmic.py b/pyipmi/commands/pmic.py new file mode 100644 index 0000000..6163e35 --- /dev/null +++ b/pyipmi/commands/pmic.py @@ -0,0 +1,50 @@ +# Copyright (c) 2012, Calxeda Inc. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Calxeda Inc. nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. + + +from .. import Command +from pyipmi.info import * +from pyipmi.tools.responseparser import ResponseParserMixIn +from pyipmi import IpmiError + + +class PMICGetVersionCommand(Command): + """ Describes the pmic get version command """ + result_type = str + ipmitool_args = ['cxoem', 'pmic', 'get', 'version'] + + def parse_results(self, out, err): + """ Parse the command response """ + return out.partition(":")[2].strip() + + +pmic_commands = { + "pmic_get_version": PMICGetVersionCommand +} -- cgit v1.2.1