Expose BGP Sessions in Device data model
Is your feature request related to a problem? Please describe. When creating device configuration templates, I would like to also include BGP sessions.
Describe the solution you'd like A data model relation for Device -> Session, not just the other way around.
Describe alternatives you've considered Adding BGP sessions as a Custom Field to the Device data model object, and linking them manually.
Found it using nbshell. The name bgpsession_set was not expected, to say the least.
As the documentation mentions https://github.com/netbox-community/netbox/blob/develop/docs/features/configuration-rendering.md , you can ask every class, including plugins.
From what I undertand on your needs, you could parse all sessions and filter by your device (as the relation session --> device exists), exemple:
{% for session in netbox_bgp.BGPSession.objects.all() %} {% if session.device.name == device.name %} session {{ session.name }} {% endif%} {% endfor %}
I don't think you could get a relation device --> session as it's a plugin
Even this is quite easier and quickier :
{% for session in netbox_bgp.BGPSession.objects.filter(device=device) %} session {{ session.name }} {% endfor %}