-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create custom fields that are computed based on referencing other data #4
Comments
…contexts, export-templates, and custom-jobs.
Is there also a possibilty to add such functionality to interface templates? For e.g. a stacked switch has 48 Ports that have a name that depends on chassis nr Gi1/0/[1-48] for switch 1 so to define Gi{% chassis_nr %}/0/[1-48] |
@jifox Where would |
@jedelman8 It should reference the |
@jedelman8 with a default value of |
I'll take this one! |
This PR introduces an implementation for "Computed Fields" that are renderable on a ContentType based on a user-supplied Jinja2 template. It also introduces the ability for users to add custom jinja filters to the jinja rendering environment through plugins, similar to custom validators in implementation. The concept of `opt_in_fields` is also introduced to serializers, allowing certain fields to be considered "opt-in only" when being consumed from the API. This feature is handled by the `OptInFieldsMixin` class. Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com> Co-authored-by: Jathan McCollum <jathan@gmail.com> Co-authored-by: Ken Celenza <ken@celenza.org> Co-authored-by: evdzande <82216020+evdzande@users.noreply.github.com> Co-authored-by: tim-fiola <timothy.fiola@gmail.com>
I think we should be good to close this one |
Fixed by #577 |
Proposed Functionality
Read-only computed custom fields using existing data already stored in the database. This will allow users to be able to build lightweight Jinja (or Python) templates to populate a read-only custom field value.
Use Case
As a user, I want to dynamically generate interface descriptions using device, neighboring device, circuit, or circuit ID. All data already stored in Nautobot, I should be able to use Jinja templating, similar to custom links, to build that string thus simplifying the network configuration templates that are used to generate full configurations. As a user, I should be able to auto-generate fields that are required by automation systems like Ansible, e.g. ansible_network_os being "{{ vendor }}.{{ os }}.{{ os }}".
Database Changes
Will require some sort of database record to define and store these templates. Probably a new model as the existing custom-fields model is not directly applicable.
External Dependencies
None.
The text was updated successfully, but these errors were encountered: