Leverage the `Metadata` feature to allow advanced data governance
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
Related: https://github.com/nautobot/nautobot-app-ssot/issues/577
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.
yup, that's the point. I think it should be part of the framework to easily use it :)
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.
- Create a
MetadataTypeof typedatetimeper integration called "Last sync fromjob.Meta.data_source" - we can do this in the job in thesync_datamethod by checking if the Nautobot adapter is a subclass of or exactly thenautobot_ssot.contrib.NautobotAdapterclass- Also check the setting explained further down
- On
model.createandmodel.update, create or update the timestamp value in the metadata- Also check the settings explained further down
- In
nautobot_config.pyunderPLUGINS_CONFIG.nautobot_ssot.enable_metadata_forthere is a list of Job class names for which metadata should be used