> ## Documentation Index
> Fetch the complete documentation index at: https://sambanova-systems.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Inventory file schema

This page describes the file format used by `snctl rack import` and written by `snctl rack export`. JSON and YAML are both accepted.

See [Rack administration](/docs/en/sambastack/hardware-admin/sambarack-manager/srm-rack-admin#option-1--import-from-a-file-recommended) for the import workflow itself.

## Top-level keys

| Key       | Type                                 | Required | Description                  |
| --------- | ------------------------------------ | -------- | ---------------------------- |
| `version` | string                               | Yes      | Schema version. Use `"1.2"`. |
| `racks`   | map of rack ID to [Rack](#rack)      | Yes      | Keyed by rack ID             |
| `groups`  | map of group name to [Group](#group) | No       | Keyed by group name          |

## Rack

| Field              | Type                      | Required | Description                                |
| ------------------ | ------------------------- | -------- | ------------------------------------------ |
| `id`               | string                    | Yes      | Rack ID, matching the key it appears under |
| `part_number`      | string                    | Yes      | `1001934` (4 PDUs) or `1002331` (2 PDUs)   |
| `nodes`            | list of [Node](#node)     | Yes      | Nodes in the rack                          |
| `pdus`             | list of [Device](#device) | Yes      | 1-indexed                                  |
| `access_switches`  | list of [Device](#device) | Yes      | 0-indexed                                  |
| `data_switches`    | list of [Device](#device) | Yes      | 0-indexed                                  |
| `serial_terminals` | list of [Device](#device) | Yes      | 0-indexed                                  |

SambaRack Manager expands the rack to its full device layout and applies the file's entries on top, so list every device in that layout.

## Node

| Field          | Type                      | Required | Description                                    |
| -------------- | ------------------------- | -------- | ---------------------------------------------- |
| `rack_node_id` | integer                   | Yes      | Node slot within the rack, starting at `0`     |
| `node_name`    | string                    | Yes      | Name used to target the node in other commands |
| `host`         | [Device](#device)         | Yes      | Host interface                                 |
| `bmc`          | [Device](#device)         | Yes      | BMC interface                                  |
| `xrdus`        | list of [Device](#device) | Yes      | 0-indexed                                      |

## Device

| Field      | Type    | Required                  | Description                                                                                       |
| ---------- | ------- | ------------------------- | ------------------------------------------------------------------------------------------------- |
| `id`       | integer | Slotted devices only      | Slot index. Omit for `host` and `bmc`.                                                            |
| `ip`       | string  | One of `ip` or `hostname` | Management IP address                                                                             |
| `hostname` | string  | One of `ip` or `hostname` | Device hostname                                                                                   |
| `username` | string  | Yes                       | Login user                                                                                        |
| `port`     | integer | Yes                       | Connection port                                                                                   |
| `password` | string  | No                        | See [Device credentials](/docs/en/sambastack/hardware-admin/sambarack-manager/srm-device-credentials). |

<Note>
  Any real password in the source file – that is, one that is not already a `${<TYPE>_SECRET}` placeholder – is imported into the encrypted credential store. The inventory itself only ever stores the placeholder.
</Note>

## Group

| Field         | Type           | Required | Description                                                 |
| ------------- | -------------- | -------- | ----------------------------------------------------------- |
| `id`          | string         | Yes      | Group name, matching the key it appears under               |
| `description` | string         | Yes      | Group description                                           |
| `racks`       | list of string | Yes      | Rack IDs, each present in the inventory or in the same file |

## Example

A complete rack with part number `1002331`:

```yaml theme={}
version: "1.2"                          # schema version; use "1.2"

racks:
  "001":                                # rack ID; matches id below
    id: "001"
    part_number: "1002331"              # 1001934 | 1002331

    serial_terminals:                   # 0-indexed
      - id: 0
        ip: 192.168.10.19
        hostname: SN40L-16-SCS
        username: sysadmin

    access_switches:                    # 0-indexed
      - id: 0
        ip: 192.168.10.240
        hostname: SN40L-16-ACCSW
        username: root
        port: 3001

    data_switches:                      # 0-indexed
      - id: 0
        ip: 192.168.10.241
        hostname: SN40L-16-DATASW
        username: root
        port: 3002

    pdus:                               # 1-indexed; 2 for 1002331, 4 for 1001934
      - id: 1
        ip: 192.168.10.20
        hostname: SN40L-16-PDU1
        username: admin
        port: 3003
      - id: 2
        ip: 192.168.10.21
        hostname: SN40L-16-PDU2
        username: admin
        port: 3004

    nodes:
      - rack_node_id: 0                 # node slot in the rack, from 0
        node_name: prod-node-1          # name used to target this node
        host:                           # no id
          ip: 192.168.4.1
          hostname: SFT-SN40L-16-H-1
          username: root
          port: 3024
        bmc:                            # no id
          ip: 192.168.5.1
          hostname: SN40L-16-H-1-SP
          username: admin
        xrdus:                          # 0-indexed, 8 per node
          - id: 0
            ip: 192.168.6.1
            hostname: SN40L-16-H-1-XRDU0
            username: root
            port: 3026
          - id: 1
            ip: 192.168.6.2
            hostname: SN40L-16-H-1-XRDU1
            username: root
            port: 3025
          - id: 2
            ip: 192.168.6.3
            hostname: SN40L-16-H-1-XRDU2
            username: root
            port: 3023
          - id: 3
            ip: 192.168.6.4
            hostname: SN40L-16-H-1-XRDU3
            username: root
            port: 3022
          - id: 4
            ip: 192.168.6.5
            hostname: SN40L-16-H-1-XRDU4
            username: root
            port: 3016
          - id: 5
            ip: 192.168.6.6
            hostname: SN40L-16-H-1-XRDU5
            username: root
            port: 3015
          - id: 6
            ip: 192.168.6.7
            hostname: SN40L-16-H-1-XRDU6
            username: root
            port: 3013
          - id: 7
            ip: 192.168.6.8
            hostname: SN40L-16-H-1-XRDU7
            username: root
            port: 3012

groups:                                 # optional
  g1:
    id: g1
    description: Production
    racks: ["001"]
```

## Next step

After importing, configure your [Device credentials](srm-device-credentials). For the full listing of `snctl` subcommands and flags, see the [Command reference](srm-command-reference).
