nautobot-app-ssot icon indicating copy to clipboard operation
nautobot-app-ssot copied to clipboard

Leverage the `Metadata` feature to allow advanced data governance

Open chadell opened this issue 1 year ago • 5 comments

Environment

  • Nautobot version: 2.3.x
  • nautobot-ssot version:

Proposed Functionality

Incorporate basic metadata for data imported using the metadata feature

Use Case

This could allow better data governance in Nautobot, and allow for advanced data clean-up functionalities understanding which data souce takes more precedence

From the example:

... omitted code ...

# Define the different metadata sources, in this case ServiceNow
choice_service_now = MetadataChoice(
    metadata_type=source_cmdb_type,
    value="SNOW"
)

... omitted code ...

# For every object/fields, assign the  source
source_cmdb_metadata = ObjectMetadata(
    metadata_type=source_cmdb_type,
    assigned_object=device,
    scoped_fields=["name", "location", "primary_ip4", "device_type"]  # Only these fields are sourced from the upstream CMDB
)
source_cmdb_metadata.value = choice_service_now.value 

chadell avatar Dec 13 '24 07:12 chadell

Related: https://github.com/nautobot/nautobot-app-ssot/issues/577

Kircheneer avatar Dec 13 '24 08:12 Kircheneer

The documentation already hints at a clear use case, which is the one that you have already outlined @chadell.

The following are things are can provide out of the box through inference:

  • Which system of record is this data originally sourced from? (through the name of the integration, including fields through their names)
  • When was this data last synced from that system into Nautobot?

I believe we should make these toggle-able, potentially think about even making the names of the MetadataType configurable.

Kircheneer avatar Dec 20 '24 11:12 Kircheneer

yup, that's the point. I think it should be part of the framework to easily use it :)

chadell avatar Dec 20 '24 14:12 chadell

Not sure I want to close this quite yet, we haven't incorporated anything in the documentation, and only one of our integrations implement this feature, also there is nothing in contrib.

Kircheneer avatar Feb 18 '25 08:02 Kircheneer

  • Create a MetadataType of type datetime per integration called "Last sync from job.Meta.data_source" - we can do this in the job in the sync_data method by checking if the Nautobot adapter is a subclass of or exactly the nautobot_ssot.contrib.NautobotAdapter class
    • Also check the setting explained further down
  • On model.create and model.update, create or update the timestamp value in the metadata
    • Also check the settings explained further down
  • In nautobot_config.py under PLUGINS_CONFIG.nautobot_ssot.enable_metadata_for there is a list of Job class names for which metadata should be used

Kircheneer avatar Mar 14 '25 13:03 Kircheneer