def do_node_list(cc, args):
    """List nodes."""
    nodes = cc.node.list()
    field_labels = ['UUID', 'Instance UUID',
                    'Power State', 'Provisioning State']
    fields = ['uuid', 'instance_uuid', 'power_state', 'provision_state']
    utils.print_list(nodes, fields, field_labels, sortby=1)
def do_node_port_list(cc, args):
    """List the ports contained in the node."""
    try:
        ports = cc.node.list_ports(args.node)
    except exc.HTTPNotFound:
        raise exc.CommandError(_('Node not found: %s') % args.node)
    field_labels = ['UUID', 'Address']
    fields = ['uuid', 'address']
    utils.print_list(ports, fields, field_labels, sortby=1)
def do_chassis_node_list(cc, args):
    """List the nodes contained in the chassis."""
    try:
        nodes = cc.chassis.list_nodes(args.chassis)
    except exc.HTTPNotFound:
        raise exc.CommandError(_('Chassis not found: %s') % args.chassis)
    field_labels = ['UUID', 'Instance UUID',
                    'Power State', 'Provisioning State']
    fields = ['uuid', 'instance_uuid', 'power_state', 'provision_state']
    utils.print_list(nodes, fields, field_labels, sortby=1)
def do_port_list(cc, args):
    """List ports."""
    port = cc.port.list()
    field_labels = ['UUID', 'Address']
    fields = ['uuid', 'address']
    utils.print_list(port, fields, field_labels, sortby=1)
def do_chassis_list(cc, args):
    """List chassis."""
    chassis = cc.chassis.list()
    field_labels = ['UUID', 'Description']
    fields = ['uuid', 'description']
    utils.print_list(chassis, fields, field_labels, sortby=1)