Skip to content

Dell: partition attributes into PATCH and POST groups with POST-based drift detection #918

@atd9876

Description

@atd9876

Description

Dell iDRACs use two distinct write patterns: PATCH for DellAttributes and POST for actions like certificate import. This sub-task implements attribute partitioning and idempotent POST handling with drift detection.

Changes

  1. partitionAttributes in redfish_dell.go — splits the incoming SettingsAttributes map into two groups:

    • PATCH group: keys that map to DellAttributes endpoints (standard key-value pairs)
    • POST group: keys with the 3-field format "POST <action-url> <check-collection-url>" indicating an action that creates/replaces a collection member
  2. 3-field POST key format"POST /redfish/v1/.../ImportCertificate /redfish/v1/.../Certificates":

    • Field 1: literal POST
    • Field 2: the action URL to POST to
    • Field 3: the collection URL to check for existing members (drift detection)
  3. buildPostKey(actionURL, collectionURL) — constructs the 3-field key from components.

  4. hashRequestBody(body) — SHA-256 hash of the POST request body, stored as the ETag equivalent for POST operations (since POST responses from Dell don't return ETags).

  5. POST drift detection — before issuing a POST, check if the target collection already has a member whose body hash matches. If it does, the operation is a no-op (idempotent). This prevents duplicate certificate imports.

  6. Dell SetBMCAttributesImmediately — orchestrates both groups: PATCH attributes via httpBasedUpdateBMCAttributes, POST attributes via action URL, returns unified map[string]ApplyResult.

  7. Dell GetBMCAttributeValues — wires through to detectSettingsDrift for PATCH attributes; for POST attributes, checks collection member existence.

Tests

  • TestBuildPostKey — key construction and parsing
  • TestHashRequestBody — deterministic hash
  • TestPartitionAttributes — correct grouping of PATCH vs POST keys
  • POST idempotency: duplicate POST detected via body hash → no re-POST

Files

  • bmc/redfish_dell.go (partition logic, POST orchestration, drift detection)
  • bmc/oem_helpers.go (buildPostKey, hashRequestBody, POST handling in update path)
  • bmc/oem_helpers_test.go (tests for this PR's scope)

Acceptance Criteria

  • Attributes with POST prefix are routed to action URL, not PATCH
  • Duplicate POST is detected via body hash — no redundant certificate import
  • PATCH attributes still use ETag-based drift detection from sub-task 4
  • make test green

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog
    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions