diff options
author | George Kraft <george.kraft@calxeda.com> | 2013-12-17 15:22:13 -0600 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2013-12-17 15:22:13 -0600 |
commit | d03c73ce29a1476cc7665bef6619c8faa6331570 (patch) | |
tree | 54264d36662f5586728451f7a26441397c250273 | |
parent | a6483e909e0f458adc95d9c639bc6a2f357b6ecb (diff) | |
download | cxmanage-d03c73ce29a1476cc7665bef6619c8faa6331570.tar.gz |
CXMAN-276: Add "cxmanage networks" command
-rw-r--r-- | cxmanage_api/cli/commands/fabric.py | 25 | ||||
-rwxr-xr-x | scripts/cxmanage | 8 |
2 files changed, 32 insertions, 1 deletions
diff --git a/cxmanage_api/cli/commands/fabric.py b/cxmanage_api/cli/commands/fabric.py index a47c5f3..3f4d4f6 100644 --- a/cxmanage_api/cli/commands/fabric.py +++ b/cxmanage_api/cli/commands/fabric.py @@ -156,3 +156,28 @@ def uplinks_command(args): print "Some errors occured during the command.\n" return len(errors) == 0 + + +def networks_command(args): + """get networks from nodes""" + args.all_nodes = False + + tftp = get_tftp(args) + nodes = get_nodes(args, tftp) + + if not args.quiet: + print "Getting networks..." + results, errors = run_command( + args, nodes, "run_fabric_tftp_command", "fabric_config_get_networks" + ) + + for node in nodes: + if node in results: + print "[ Networks 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 897724a..f2b7fc6 100755 --- a/scripts/cxmanage +++ b/scripts/cxmanage @@ -44,7 +44,8 @@ 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, uplinks_command + partition_config_command, uplink_info_command, uplinks_command, \ + networks_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 @@ -283,6 +284,11 @@ def build_parser(): help='get uplinks') uplinks.set_defaults(func=uplinks_command) + # networks command + networks = subparsers.add_parser('networks', + help='get networks') + networks.set_defaults(func=networks_command) + # config command config = subparsers.add_parser('config', help='configure hosts') config_subs = config.add_subparsers() |