netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Add Tenant to Service Model

Open bencorrado opened this issue 1 year ago • 3 comments

NetBox version

v3.6.0

Feature type

New functionality

Proposed functionality

I would like to see the ability to assign Services in Netbox to a tenant.

  • Add Tenancy.Tenant to IPAM.Service model.
  • Add Tenancy filter option for IPAM.Service in list view.
  • Add link and badge for number of services in tenant detail view.

Use case

When a service is running on a VM or device and the service is owned by a different tenant than owns the VM or device.

Ideally ownership could be claimed on a Service level to able to track ownership of the services up to the tenant and see all of the services they own listed in the Tenant detail view.

Database changes

Unknown

External dependencies

None

bencorrado avatar Sep 04 '23 06:09 bencorrado

Hi!

You can already acheive this in NetBox without any changes to core NetBox.

Add Tenancy.Tenant to IPAM.Service model.

You can do this by creating a custom field for Tenant on the service.

Add Tenancy filter option for IPAM.Service in list view.

Filter options for custom fields are automatically added when you add a custom field.

Add link and badge for number of services in tenant detail view.

Half of this is easilly doable using a custom link!

Just create a custom link attached to the tenant model with the Link URL set to:

/ipam/services/?cf_Tenant={{ object.id }}

(If your custom field isn't named Tenant, change the sample accordingly.)

You won't get a badge showing how many services there are, but that might also be sort of doable because the Link Text is also templated using Jinja2, you might be able to do a query to populate this information, but since that'd take more than about 5 minutes for me to figure out, I'll leave that for you to play with if you find it important. :-)

pv2b avatar Sep 04 '23 11:09 pv2b

Hi!

You can already acheive this in NetBox without any changes to core NetBox.

Add Tenancy.Tenant to IPAM.Service model.

You can do this by creating a custom field for Tenant on the service.

Add Tenancy filter option for IPAM.Service in list view.

Filter options for custom fields are automatically added when you add a custom field.

Add link and badge for number of services in tenant detail view.

Half of this is easilly doable using a custom link!

Just create a custom link attached to the tenant model with the Link URL set to:

/ipam/services/?cf_Tenant={{ object.id }}

(If your custom field isn't named Tenant, change the sample accordingly.)

You won't get a badge showing how many services there are, but that might also be sort of doable because the Link Text is also templated using Jinja2, you might be able to do a query to populate this information, but since that'd take more than about 5 minutes for me to figure out, I'll leave that for you to play with if you find it important. :-)

Thanks for the suggestion. I am currently doing this, it works, but it is certainly not as clean as natively assigning the tenant.

bencorrado avatar Nov 12 '23 19:11 bencorrado

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

github-actions[bot] avatar Feb 11 '24 04:02 github-actions[bot]

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

github-actions[bot] avatar Mar 12 '24 04:03 github-actions[bot]