Skip to content

Add tenant relationship to SupportContract and License models #87

@empusas

Description

@empusas

Plugin version

v1.1.5

NetBox version

4.2.5

Feature type

Data model extension

Proposed functionality

I propose adding the ability to associate a support contract or license with one or multiple tenants. This functionality will allow for better documentation and tracking of which licenses or maintenance contracts belong to specific tenants.

The implementation will include updates to:
• Models: Introduce a ManyToManyField to link support contracts/licenses with tenants.
• Forms & UI: Provide an intuitive way to assign and manage tenant associations.
• API: Extend the API to support querying and managing tenant-license relationships.

This feature will enhance the system’s flexibility while maintaining a secure and structured approach to tenant-based licensing and contract management.

Use case

A support contract or license might be for one or a group of tenants only. Hence it would be nice to have a way to assign it to the right tenant(s).

Database changes

A support contract or license may apply to a single tenant or multiple tenants. Therefore, it should be possible to assign it to the appropriate tenant(s). This would help document which license or maintenance contract belongs to which tenant.

We are using a more restrictive permission model in our NetBox, where tenancy-based permissions filter user access to specific tenants. The additional relationship could be used within such permission constraints to enforce filtering.

I am happy to submit a pull request with all the necessary updates to models, forms, API, and other related components.

External dependencies

Both SupportContract and License models would need to change to allow assignment to one or more tenants.

class class SupportContract(PrimaryModel):
    tenants = models.ManyToManyField(
        to='tenancy.Tenant'
        related_name='contracts',
        blank=True  # Allows empty selection in forms
    )
...

class License(PrimaryModel)::
    tenants = models.ManyToManyField(
        to='tenancy.Tenant'
        related_name='licenses',
        blank=True  # Allows empty selection in forms
    )
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions