summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2013-12-17 15:18:32 -0600
committerGeorge Kraft <george.kraft@calxeda.com>2013-12-17 15:18:32 -0600
commita6483e909e0f458adc95d9c639bc6a2f357b6ecb (patch)
treee38aace7b8d6e875c4ac74f56ec9ef533662fcec
parentdc5b1b22b9db064ae7fb7e413404ab5a39f29ff6 (diff)
downloadcxmanage-a6483e909e0f458adc95d9c639bc6a2f357b6ecb.tar.gz
CXMAN-276: Add "cxmanage uplinks" command
-rw-r--r--cxmanage_api/cli/commands/fabric.py25
-rwxr-xr-xscripts/cxmanage7
2 files changed, 31 insertions, 1 deletions
diff --git a/cxmanage_api/cli/commands/fabric.py b/cxmanage_api/cli/commands/fabric.py
index df63128..a47c5f3 100644
--- a/cxmanage_api/cli/commands/fabric.py
+++ b/cxmanage_api/cli/commands/fabric.py
@@ -131,3 +131,28 @@ def uplink_info_command(args):
print "Some errors occured during the command.\n"
return len(errors) == 0
+
+
+def uplinks_command(args):
+ """get uplinks from nodes"""
+ args.all_nodes = False
+
+ tftp = get_tftp(args)
+ nodes = get_nodes(args, tftp)
+
+ if not args.quiet:
+ print "Getting uplinks..."
+ results, errors = run_command(
+ args, nodes, "run_fabric_tftp_command", "fabric_config_get_uplinks"
+ )
+
+ for node in nodes:
+ if node in results:
+ print "[ Uplinks from %s ]" % node.ip_address
+ print results[node].strip()
+ print
+
+ if not args.quiet and errors:
+ print "Some errors occured during the command.\n"
+
+ return len(errors) == 0
diff --git a/scripts/cxmanage b/scripts/cxmanage
index 6649026..897724a 100755
--- a/scripts/cxmanage
+++ b/scripts/cxmanage
@@ -44,7 +44,7 @@ from cxmanage_api.cli.commands.mc import mcreset_command
from cxmanage_api.cli.commands.fw import fwupdate_command, fwinfo_command
from cxmanage_api.cli.commands.sensor import sensor_command
from cxmanage_api.cli.commands.fabric import ipinfo_command, macaddrs_command, \
- partition_config_command, uplink_info_command
+ partition_config_command, uplink_info_command, uplinks_command
from cxmanage_api.cli.commands.config import config_reset_command, \
config_boot_command, config_pxe_command
from cxmanage_api.cli.commands.info import info_command
@@ -278,6 +278,11 @@ def build_parser():
help='get uplink info')
uplink_info.set_defaults(func=uplink_info_command)
+ # uplinks command
+ uplinks = subparsers.add_parser('uplinks',
+ help='get uplinks')
+ uplinks.set_defaults(func=uplinks_command)
+
# config command
config = subparsers.add_parser('config', help='configure hosts')
config_subs = config.add_subparsers()