Skip to content

ERR_OPS_GENERATE_DIFF when supplying multiple_objects on a custom field #324

@brandan-schmitz

Description

@brandan-schmitz

Diode version

v1.0.0

Deployment type

docker compose

Deployment type version

The version in v1.0.0 release

Diode SDK type

diode-sdk-python

Diode SDK version

v1.0.0

Diode NetBox Plugin version

v1.0.0

NetBox version

v4.2.8

Steps to reproduce

  1. Create a custom field that is of the Multiple objects type in Netbox. I have one for Devices called device_global_vlans that allows selecting multiple VLANs.
  2. Try/update to create a device that includes the custom_fields such as this:
from netboxlabs.diode.sdk import DiodeClient
from netboxlabs.diode.sdk.ingester import (
    Device,
    Entity,
    DeviceType,
    CustomFieldValue,
    CustomFieldObjectReference,
    VLAN
)

def main():
    with DiodeClient(
        target="grpc://localhost:8080/diode",
        app_name="my-test-app",
        app_version="0.0.1",
        client_id="",
        client_secret=""
    ) as client:
        entities = []

        device = Device(
            name="Test Device",
            site="Jamestown Office",
            status="active",
            device_type=DeviceType(
                model="WS-C3750G-24PS",
                manufacturer="Cisco"
            ),
            role="Switching",
            custom_fields={
                "device_global_vlans": CustomFieldValue(
                    multiple_objects=[CustomFieldObjectReference(
                        vlan=VLAN(
                            vid=1,
                            name="default"
                        )
                    )]
                )
            }
        )

        entities.append(Entity(device=device))

        response = client.ingest(entities=entities)
        if response.errors:
            print(f"Errors: {response.errors}")

if __name__ == "__main__":
    main()

Expected behavior

It should create/update a device and add/update the vlans provided in the devices device_global_vlans custom field in netbox.

Observed behavior

The following error was produced in the diode-reconciler:

{
  "time": "2025-05-08T20:51:07.788905214Z",
  "level": "ERROR",
  "msg": "error generating changeset",
  "error": "generate diff failed - ERR_OPS_GENERATE_DIFF - {\"id\":\"fd615071-6d2b-41dd-a6d6-1781dce8a273\",\"errors\":{\"dcim.device\":{\"device_global_vlans\":[\"Custom field device_global_vlans has unknown type: multiple_objects\"]}}}"
}

Using MessageToDict I can see this is the Entity being produced in the SDK:

{
  "timestamp": "2025-05-08T20:51:03.805823Z",
  "device": {
    "name": "Test Device",
    "deviceType": {
      "manufacturer": { "name": "Cisco" },
      "model": "WS-C3750G-24PS"
    },
    "role": { "name": "Switching" },
    "site": { "name": "Jamestown Office" },
    "status": "active",
    "customFields": {
      "device_global_vlans": {
        "multipleObjects": [{ "vlan": { "vid": "1", "name": "default" } }]
      }
    }
  }
}

And according the the logs of the reconciler, this is what it is it is receiving:

{
  "stream": "latest",
  "entities": [
    {
      "timestamp": { "seconds": 1746737463, "nanos": 805823000 },
      "Entity": {
        "Device": {
          "name": "Test Device",
          "device_type": {
            "manufacturer": { "name": "Cisco" },
            "model": "WS-C3750G-24PS"
          },
          "role": { "name": "Switching" },
          "site": { "name": "Jamestown Office" },
          "status": "active",
          "custom_fields": {
            "device_global_vlans": {
              "multiple_objects": [
                { "Object": { "Vlan": { "vid": 1, "name": "default" } } }
              ],
              "Value": null
            }
          }
        }
      }
    }
  ],
  "id": "d325bf33-eb4b-4ac9-9a29-654f67e80c24",
  "producer_app_name": "agent-01/device-discovery",
  "producer_app_version": "0.0.0",
  "sdk_name": "diode-sdk-python",
  "sdk_version": "1.0.0"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus: needs triageThis issue is awaiting triage by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions