Replies: 2 comments 2 replies
-
Please @pke11y @glennmatthews @dgarros share your points about it |
Beta Was this translation helpful? Give feedback.
-
I think that in this case it makes more sense to implement the functionality as part of the parser in option 2. Organizationally, it keeps all of the ability to parse something in one place whether from email, api, or other source. It makes the parser totally usable in some other project and gives more value to the parsers in addition to the reasons that you listed. A point against putting it in the plugin is that there seems to be limited use for this data/capability outside of doing circuit maintenance, at least that I am aware of, so in a sense, something that is involved in parsing shouldn't be split out into two separate places, unless the utility of putting it in the plugin is for some specific purpose other than more quickly developing it. |
Beta Was this translation helpful? Give feedback.
-
Introduction
The main goal of this plugin is to be able to handle automatically circuit maintenance notifications, including:
From the beginning, we envisioned that notification data could come via different channels, for instance, receiving emails (traditional method) or via API (via active pulling or reacting to webhooks). Initially, the focused only in the first use case (email) because it is still the most common use-case.
Goal: Add support API endpoints as
NotificationSources
In this discussion we want to provide a HLD about the different options we have to implement this feature, considering the pros and cons.
Notification data collection/fetching
The current design of NotificationSource model it's quite open in the database, and depends on a more specific implementation as Source that take the initalisation data directly from the plugin configuration.
This loose implementation helps to define any kind of integration schema, accepting any attribute you may need, and deciding which type of integration based on the url (and other specific details in each case). Today, the plugin supports 3 types of
Sources
:IMAP
,GmailAPIOauth
andGmailAPIOauth
, but all these classes inherit from a[EmailSource](https://github.com/nautobot/nautobot-plugin-circuit-maintenance/blob/develop/nautobot_circuit_maintenance/handle_notifications/sources.py#L185)
class.In order to evolve this design we will need to create a new
Source
class ready to interact with external API endpoints, adding a field inNotificationSource
andSource
about the type, that could help to be more specific during the initialisation of theSource
, instead of deducing it from theurl
as commented above.Also, with the recently added support in Nautobot for
Secrets
, we could consider adding support to handleNotificationSource
directly from Nautobot. Today, the key configuration from aNotificationSource
can't be updated in Nautobot (UI/API) because we decided to not store secrets in the database. With the new backends available in the Secrets Provider Plugin we could revisit it and support both ways.One way or another, with the new API source, we will be able to get the information from API endpoints, most likely JSON data. But, this data will have a different schema from one provider to another, so we have to move to the next discussion point: data normalisation.
Notification data normalisation
One of the first design decisions of this plugin was to externalise the normalisation data to another library, so the global community could benefit from the parser library even they are not using the Nautobot plugin, so increase the odd of biggest impact.
This parser library serves 2 purposes:
Today, because this library is mostly driven by Networktocode, the parser library is only focused on parsing notifications from email, but it could be extended to support other data normalisation such as a custom JSON to the reference maintenance object.
The key question here is to decide, from the Circuit Maintenance plugin perspective, where it makes more sense to implement the data normalisation required for processing the new data gathered from API sources, that even doesn't require the same level of parsing than an email, still needs to convert between every provider schema to the expect object.
Option 1: Implement the API data normalisation in the Plugin
Option 2: Implement the API data normalisation in the Parser
Beta Was this translation helpful? Give feedback.
All reactions