From aeb2791f4d3a5e23090e56c330436205a61629d7 Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Fri, 22 Sep 2017 11:48:38 -0700 Subject: Remove 'tools' Directory All tools (and history) have been moved to the pharos-tools repository: https://git.opnfv.org/pharos-tools/ Change-Id: I84fa9b6ebd9b27f42d41f2722eb1221ec39a8c94 Signed-off-by: Trevor Bramwell --- .../src/validation_tool/src/ipmi.py | 63 ---------------------- 1 file changed, 63 deletions(-) delete mode 100644 tools/pharos-validator/src/validation_tool/src/ipmi.py (limited to 'tools/pharos-validator/src/validation_tool/src/ipmi.py') diff --git a/tools/pharos-validator/src/validation_tool/src/ipmi.py b/tools/pharos-validator/src/validation_tool/src/ipmi.py deleted file mode 100644 index 44be207a..00000000 --- a/tools/pharos-validator/src/validation_tool/src/ipmi.py +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Todd Gaunt and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import os -import subprocess -import logging - -def power_nodes(nodes, action): - """ Attempts to power on all nodes specified in a list, then returns a list - of the names of all failures. The list will be empty if no failures.""" - failed_nodes = [] - logger = logging.getLogger(__name__) - if not nodes: - logger.info("No nodes, is empty list") - for node in nodes: - # -I flag must be 'lanplus', 'lan' by itself doesn't work with - # the most recent idrac/ipmi version - if action == "on": - pass - elif action == "off": - pass - else: - logger.error("Invalid ipmi command") - - cmd = ["ipmitool", \ - "-I", "lanplus", \ - "-H ", "'"+node.ipmi_addr+"'", \ - "-U ", "'"+node.ipmi_user+"'", \ - "-P ", "'"+node.ipmi_pass+"'", \ - "power", action] - - logger.debug("Running: \"{}\"".format(' '.join(cmd))) - try: - with open(os.devnull, 'w') as fn: - status = subprocess.check_call(" ".join(cmd), \ - stdout=fn, stderr=fn, shell=True) - except subprocess.CalledProcessError as e: - status = e.returncode - logger.error("{} could not be accessed at {} (exit code {})".format(\ - node.name, node.ipmi_addr, status)) - failed_nodes.append(node.name) - if int(status) == 0: - logger.info("{} successfully powered {}".format(node.name, action)) - - return failed_nodes - -def status(node, ipaddr, username, passwd): - # -I flag must be 'lanplus', 'lan' by itself doesn't work with - # the most recent idrac/ipmi version - chkcmd = ["ipmitool", \ - "-I", "lanplus", \ - "-H", ipaddr, \ - "-U", username, \ - "-P", passwd, \ - "chassis", "status"] - print(chkcmd) - subprocess.Popen(chkcmd) -- cgit 1.2.3-korg