Skip to content

feat: add scope support for BGP Communities (Site, Region, SiteGroup, Location, Rack, RackGroup)#307

Open
Etibru wants to merge 3 commits into
netbox-community:developfrom
Etibru:306-feat-scope-in-community
Open

feat: add scope support for BGP Communities (Site, Region, SiteGroup, Location, Rack, RackGroup)#307
Etibru wants to merge 3 commits into
netbox-community:developfrom
Etibru:306-feat-scope-in-community

Conversation

@Etibru

@Etibru Etibru commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Fixes: #306

Implement a GenericForeignKey-based scope field on the Community model, following the pattern used in NetBox core (e.g. VLANGroup scoping). This approach is cleaner and more future-proof than adding one FK per object type.

Concretely, this means adding to the model:

scope_type   = models.ForeignKey(ContentType, null=True, blank=True, ...)
scope_id     = models.PositiveBigIntegerField(null=True, blank=True)
scope        = GenericForeignKey("scope_type", "scope_id")

with scope_type limited to the following content types:

Scope object App / model Typical use case
Site dcim.site Per-site communities (local-pref, blackhole…)
Region dcim.region Regional traffic engineering
SiteGroup dcim.sitegroup Logical grouping of sites
Location dcim.location Building / floor / room granularity
Rack dcim.rack Per-rack communities (e.g. colocation billing)
RackGroup dcim.rackgroup Row or cage-level grouping

@Etibru Etibru marked this pull request as ready for review June 3, 2026 09:24
@Etibru Etibru requested review from cruse1977 and k01ek as code owners June 3, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add scope support for BGP Communities (Site, Region, SiteGroup, Location, Rack, RackGroup)

1 participant