summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2013-10-03 12:42:08 -0500
committerGeorge Kraft <george.kraft@calxeda.com>2013-10-03 12:42:08 -0500
commit5039fc3400b7e63fc8f169c872ab9cbe094a553b (patch)
tree3d1c204d058e766219decf95545a7f8148de445d
parent52057843f2b4002095422069ae0abbfa360de9ed (diff)
downloadcxmanage-5039fc3400b7e63fc8f169c872ab9cbe094a553b.tar.gz
CXMAN-218: Remove node_fru and slot_fru commands
Those versions will be part of get_versions() instead.
-rw-r--r--cxmanage_api/cli/commands/fru_version.py71
-rw-r--r--cxmanage_api/cli/commands/tspackage.py42
-rw-r--r--cxmanage_api/cx_exceptions.py21
-rw-r--r--cxmanage_api/fabric.py38
-rw-r--r--cxmanage_api/node.py56
-rw-r--r--cxmanage_test/fabric_test.py12
-rw-r--r--cxmanage_test/node_test.py12
-rwxr-xr-xscripts/cxmanage12
8 files changed, 1 insertions, 263 deletions
diff --git a/cxmanage_api/cli/commands/fru_version.py b/cxmanage_api/cli/commands/fru_version.py
deleted file mode 100644
index 65d0418..0000000
--- a/cxmanage_api/cli/commands/fru_version.py
+++ /dev/null
@@ -1,71 +0,0 @@
-"""Calxeda: fru_version.py """
-
-
-# Copyright (c) 2013, 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 cxmanage_api.cli import get_tftp, get_nodes, get_node_strings, run_command
-
-
-def node_fru_version_command(args):
- """Get the node FRU version for each node. """
- tftp = get_tftp(args)
- nodes = get_nodes(args, tftp)
- results, errors = run_command(args, nodes, 'get_node_fru_version')
-
- # Print results if we were successful
- if results:
- node_strings = get_node_strings(args, results, justify=True)
- for node in nodes:
- print("%s: %s" % (node_strings[node], results[node]))
-
- print("") # For readability
-
- if not args.quiet and errors:
- print('Some errors occured during the command.\n')
-
-
-def slot_fru_version_command(args):
- """Get the slot FRU version for each node. """
- tftp = get_tftp(args)
- nodes = get_nodes(args, tftp)
- results, errors = run_command(args, nodes, 'get_slot_fru_version')
-
- # Print results if we were successful
- if results:
- node_strings = get_node_strings(args, results, justify=True)
- for node in nodes:
- print("%s: %s" % (node_strings[node], results[node]))
-
- print("") # For readability
-
- if not args.quiet and errors:
- print('Some errors occured during the command.\n')
diff --git a/cxmanage_api/cli/commands/tspackage.py b/cxmanage_api/cli/commands/tspackage.py
index e4ccb51..2d86aa4 100644
--- a/cxmanage_api/cli/commands/tspackage.py
+++ b/cxmanage_api/cli/commands/tspackage.py
@@ -88,14 +88,6 @@ def tspackage_command(args):
write_version_info(args, nodes)
if not quiet:
- print("Getting node FRU version...")
- write_node_fru_version(args, nodes)
-
- if not quiet:
- print("Getting slot FRU version...")
- write_slot_fru_version(args, nodes)
-
- if not quiet:
print("Getting boot order...")
write_boot_order(args, nodes)
@@ -172,40 +164,6 @@ def write_version_info(args, nodes):
write_to_file(node, lines)
-def write_node_fru_version(args, nodes):
- """Write the node and slot FRU versions for each node to their
- respective files.
-
- """
- node_fru_results, _ = run_command(args, nodes, "get_node_fru_version")
-
- for node in nodes:
- lines = [] # Lines of text to write to file
- if node in node_fru_results:
- lines.append("%s: %s" % \
- ("Node FRU Version".ljust(19), node_fru_results[node]))
- else:
- lines.append("\nWARNING: No node FRU found!")
- write_to_file(node, lines)
-
-def write_slot_fru_version(args, nodes):
- """Write the node and slot FRU versions for each node to their
- respective files.
-
- """
- slot_fru_results, _ = run_command(args, nodes, "get_slot_fru_version")
-
- for node in nodes:
- lines = [] # Lines of text to write to file
- if node in slot_fru_results:
- lines.append("%s: %s" % \
- ("Slot FRU Version".ljust(19), slot_fru_results[node]))
- else:
- lines.append("Error reading slot FRU. Perhaps the system board " +
- "does not have slot FRUs?")
-
- write_to_file(node, lines)
-
def write_mac_addrs(args, nodes):
"""Write the MAC addresses for each node to their respective files."""
mac_addr_results, _ = run_command(
diff --git a/cxmanage_api/cx_exceptions.py b/cxmanage_api/cx_exceptions.py
index 5f60df7..c4b2e0f 100644
--- a/cxmanage_api/cx_exceptions.py
+++ b/cxmanage_api/cx_exceptions.py
@@ -401,25 +401,4 @@ class IPDiscoveryError(Exception):
"""String representation of this Exception class."""
return self.msg
-class NoFRUVersionError(Exception):
- """Raised when a node does not detect a FRU version.
-
- >>> from cxmanage_api.cx_exceptions import NoFRUError
- >>> raise NoFRUError('My custom exception text!')
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- cxmanage_api.cx_exceptions.NoFRUError: My custom exception text!
-
- :param msg: Exceptions message and details to return to the user.
- :type msg: string
- :raised: When a node fails to detect a FRU version
-
- """
-
- def __init__(self, msg="No FRU version detected"):
- super(NoFRUVersionError, self).__init__()
- self.msg = msg
- def __str__(self):
- return self.msg
-
# End of file: exceptions.py
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py
index 564c97f..ab17677 100644
--- a/cxmanage_api/fabric.py
+++ b/cxmanage_api/fabric.py
@@ -1082,44 +1082,6 @@ class Fabric(object):
"""
return self._run_on_all_nodes(async, "get_depth_chart")
- def get_node_fru_version(self, async=False):
- """Get each node's node FRU version.
-
- >>> fabric.get_node_fru_version()
- {0: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c',
- 1: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c',
- 2: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c',
- 3: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c'}
-
- :param async: Flag that determines if the command result (dictionary)
- is returned or a Task object (can get status, etc.).
- :type async: boolean
-
- :returns: The node FRU versions for each node in the fabric
- :rtype: dictionary
-
- """
- return self._run_on_all_nodes(async, "get_node_fru_version")
-
- def get_slot_fru_version(self, async=False):
- """Get each node's slot FRU version.
-
- >>> fabric.get_slot_fru_version()
- {0: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c',
- 1: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c',
- 2: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c',
- 3: 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c'}
-
- :param async: Flag that determines if the command result (dictionary)
- is returned or a Task object (can get status, etc.).
- :type async: boolean
-
- :returns: The slot FRU versions for each node in the fabric
- :rtype: dictionary
-
- """
- return self._run_on_all_nodes(async, "get_slot_fru_version")
-
def _run_on_all_nodes(self, async, name, *args, **kwargs):
"""Start a command on all nodes."""
tasks = {}
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py
index f720d28..f827e8a 100644
--- a/cxmanage_api/node.py
+++ b/cxmanage_api/node.py
@@ -52,8 +52,7 @@ from cxmanage_api.ip_retriever import IPRetriever as IPRETRIEVER
from cxmanage_api.cx_exceptions import TimeoutError, NoSensorError, \
SocmanVersionError, FirmwareConfigError, PriorityIncrementError, \
NoPartitionError, TransferFailure, ImageSizeError, \
- PartitionInUseError, UbootenvError, NoFRUVersionError, \
- EEPROMUpdateError
+ PartitionInUseError, UbootenvError, EEPROMUpdateError
# pylint: disable=R0902, R0904
@@ -1566,59 +1565,6 @@ obtained.
"""
return self.bmc.fabric_get_uplink_info().strip()
- def get_node_fru_version(self):
- """Get the node FRU version.
-
- >>> node.get_node_fru_version
- 'bf7b471716113d5b9c47c6a5dd25f7a83f5c235c'
-
- :return: The node FRU version of this node
- :rtype: string
-
- This is essentially the equivalent of ipmitool FRU read 81 filename
- and reading only the version from that file.
- The in-file offset for the node FRU version is 516, and the
- length of the version string is 40 bytes.
-
- """
- version = self._read_fru(81, offset=516, bytes_to_read=40)
- # If there is an error reading the FRU, every byte could be x00
- if version == "\x00"*len(version):
- raise NoFRUVersionError("No node FRU detected")
-
- # If the version string is less than 40 bytes long, remove the x00's
- version = version.replace("\x00", "")
-
- return version
-
- def get_slot_fru_version(self):
- """Get the slot FRU version.
-
- >>> node.get_slot_fru_version
- 'Unknown'
-
- :return: The slot FRU version of this node
- :rtype: string
-
- This is essentially the equivalent of ipmitool FRU read 82 filename
- and reading only the version from that file.
- The in-file offset for the node FRU version is 516, and the
- length of the version string is 40 bytes.
-
- Note that some system boards do not have slot FRUs, and are
- therefore expected to raise an exception.
-
- """
- version = self._read_fru(82, offset=516, bytes_to_read=40)
- # If there is an error reading the FRU, every byte could be x00
- if version == "\x00"*len(version):
- raise NoFRUVersionError("No slot FRU detected.")
-
- # If the version string is less than 40 bytes long, remove the x00's
- version = version.replace("\x00", "")
-
- return version
-
def _run_fabric_command(self, function_name, **kwargs):
"""Handles the basics of sending a node a command for fabric data."""
filename = temp_file()
diff --git a/cxmanage_test/fabric_test.py b/cxmanage_test/fabric_test.py
index fe1a80c..3be19f2 100644
--- a/cxmanage_test/fabric_test.py
+++ b/cxmanage_test/fabric_test.py
@@ -422,18 +422,6 @@ class FabricTest(unittest.TestCase):
else:
self.assertEqual(node.bmc.executed, [])
- def test_get_node_fru_version(self):
- """ Test the get_node_fru_version method """
- self.fabric.get_node_fru_version()
- for node in self.nodes:
- self.assertEqual(node.executed, ["get_node_fru_version"])
-
- def test_get_slot_fru_version(self):
- """ Test the get_slot_fru_version method """
- self.fabric.get_slot_fru_version()
- for slot in self.nodes:
- self.assertEqual(slot.executed, ["get_slot_fru_version"])
-
def test_composite_bmc(self):
""" Test the CompositeBMC member """
with self.assertRaises(AttributeError):
diff --git a/cxmanage_test/node_test.py b/cxmanage_test/node_test.py
index 3c0e4a0..2f0e83f 100644
--- a/cxmanage_test/node_test.py
+++ b/cxmanage_test/node_test.py
@@ -451,18 +451,6 @@ class NodeTest(unittest.TestCase):
node.set_uplink(iface=0, uplink=0)
self.assertEqual(node.get_uplink(iface=0), 0)
- def test_get_node_fru_version(self):
- """ Test node.get_node_fru_version method """
- for node in self.nodes:
- node.get_node_fru_version()
- self.assertEqual(node.bmc.executed, ['node_fru_read'])
-
- def test_get_slot_fru_version(self):
- """ Test node.get_slot_fru_version method """
- for node in self.nodes:
- node.get_slot_fru_version()
- self.assertEqual(node.bmc.executed, ['slot_fru_read'])
-
# pylint: disable=R0902
class DummyBMC(LanBMC):
""" Dummy BMC for the node tests """
diff --git a/scripts/cxmanage b/scripts/cxmanage
index 93518dd..ea93997 100755
--- a/scripts/cxmanage
+++ b/scripts/cxmanage
@@ -48,8 +48,6 @@ from cxmanage_api.cli.commands.info import info_command
from cxmanage_api.cli.commands.ipmitool import ipmitool_command
from cxmanage_api.cli.commands.ipdiscover import ipdiscover_command
from cxmanage_api.cli.commands.tspackage import tspackage_command
-from cxmanage_api.cli.commands.fru_version import node_fru_version_command, \
- slot_fru_version_command
from cxmanage_api.cli.commands.eeprom import eepromupdate_command
@@ -319,16 +317,6 @@ def build_parser():
help='Save information about this node/fabric to a .tar')
tspackage.set_defaults(func=tspackage_command)
- # node_fru_version command
- node_fru_version = subparsers.add_parser('node_fru_version',
- help='Get the node FRU version')
- node_fru_version.set_defaults(func=node_fru_version_command)
-
- # slot_fru_version command
- slot_fru_version = subparsers.add_parser('slot_fru_version',
- help='Get the slot FRU version')
- slot_fru_version.set_defaults(func=slot_fru_version_command)
-
return parser