Skip to content

CASMNET-2389 - Hill cabinet SLS entries contain <nil> gateway and empty CIDR#551

Merged
rustydb merged 2 commits into
mainfrom
fix/hill-cabinet-nil-gateway
Apr 29, 2026
Merged

CASMNET-2389 - Hill cabinet SLS entries contain <nil> gateway and empty CIDR#551
rustydb merged 2 commits into
mainfrom
fix/hill-cabinet-nil-gateway

Conversation

@spillerc-hpe

@spillerc-hpe spillerc-hpe commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary and Scope

  • Fixes: CASMNET-2310 regression — Hill cabinet SLS entries contain <nil> gateway and empty CIDR

Issue Type

  • Bugfix Pull Request

The CASMNET-2310 IPv6 refactor changed IPSubnet.CIDR from net.IPNet to a plain string, but the subnet-not-found guard in GenCabinetMap was not updated to match. The old guard relied on net.IPNet's zero-value .String() returning "<nil>":

if subnet.CIDR.String() != "<nil>"   // old: correctly skipped zero-value net.IPNet

After the refactor, CIDR is a string whose zero value is "", making the updated guard:

if subnet.CIDR != "<nil>"            // broken: "" != "<nil>" is always true

This means every failed subnet lookup writes a bad entry instead of being skipped. For Hill cabinets the effect is compounded by the network lookup loop ordering (NMN → HMN → NMN_MTN → HMN_MTN → NMN_RVR → HMN_RVR): the _MTN lookups succeed and write correct data, but the _RVR lookups that follow return empty subnets, pass the broken guard, and overwrite the good data — producing {CIDR: "", Gateway: "\u003cnil\u003e"} in the generated sls_input_file.json.

The fix is a one-line change:

if subnet.CIDR != ""

Testing

Verified against the odin system (hpc-shasta-system-configs/odin/1.7) which has one Hill cabinet (x9000).

Before fixsls_input_file.json contained:

"x9000": {
  "ExtraProperties": {
    "Networks": {
      "cn": {
        "HMN": {
          "CIDR": "",
          "Gateway": "\u003cnil\u003e"
        },
        "NMN": {
          "CIDR": "",
          "Gateway": "\u003cnil\u003e"
        }
      }
    }
  }
}

After fixsls_input_file.json correctly contains:

"x9000": {
  "ExtraProperties": {
    "Networks": {
      "cn": {
        "HMN": {
          "CIDR": "10.104.0.0/22",
          "Gateway": "10.104.0.1",
          "VLan": 3000
        },
        "NMN": {
          "CIDR": "10.120.0.0/22",
          "Gateway": "10.120.0.1",
          "VLan": 2000
        }
      }
    }
  }
}

CIDR and Gateway values match the corresponding HMN_MTN and NMN_MTN subnet entries in the same file. VLAN IDs match those defined in cabinets.yaml (hmn-vlan: 3000, nmn-vlan: 2000).

Prerequisites

  • I have included documentation in my PR (or it is not required)
  • I tested this on internal system (if yes, please include results or a description of the test)
  • I tested this on a vshasta system (if yes, please include results or a description of the test)

Idempotency

GenCabinetMap is a pure data-transformation function with no side effects. Running csi config init multiple times with the same inputs will produce consistent, correct SLS cabinet network entries after this fix.

Risks and Mitigations

Low risk — the change is a single character correction to a guard condition, restoring the behaviour that existed before the CASMNET-2310 refactor. The fix only affects cases where a subnet genuinely does not exist in a given network (e.g. looking up a Hill cabinet subnet in the base HMN/NMN networks), and prevents bad data from being written in those cases. No valid subnet entries are affected.

After the CASMNET-2310 IPv6 refactor, IPSubnet.CIDR changed from
net.IPNet (zero value .String() returns "<nil>") to a plain string
(zero value is ""). The subnet-not-found guard was updated to:

    if subnet.CIDR != "<nil>"

but this is always true when CIDR is an empty string, so every failed
subnet lookup now writes a bad entry instead of being skipped.

For Hill cabinets the symptom is particularly visible: the network
lookup loop runs NMN → HMN → NMN_MTN → HMN_MTN → NMN_RVR → HMN_RVR.
The _MTN lookups succeed and write correct cabinet network data, but
the _RVR lookups that follow return empty subnets (CIDR=""), pass the
broken guard, and overwrite the good MTN data with {CIDR:"",
Gateway:"<nil>"} — which is serialised as \u003cnil\u003e in JSON.

Fix by checking for an empty string instead:

    if subnet.CIDR != ""

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@spillerc-hpe
spillerc-hpe requested review from a team as code owners April 29, 2026 10:42
@rustydb
rustydb merged commit e38cc72 into main Apr 29, 2026
4 of 5 checks passed
@rustydb
rustydb deleted the fix/hill-cabinet-nil-gateway branch April 29, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants