Skip to content

feat: Add gateway and DNS fields to pool model #32

@mgazza

Description

@mgazza

Problem

Pool definitions only store CIDR, prefix, exclusions, and metadata. Gateway and DNS configuration is missing, forcing each BNG node to be independently configured with --pool-gateway and --pool-dns CLI flags.

In a distributed deployment with multiple BNG nodes sharing a Nexus pool, this means:

  • No single source of truth for gateway/DNS per pool
  • Misconfiguration risk (different BNGs could serve different gateways for the same pool)
  • Breaks the ZTP story — BNG can auto-discover Nexus but still needs manual gateway/DNS config

Raised by @infinitydon in codelaboratoryltd/bng#92.

Proposed Changes

Add gateway and dns fields to the pool model and API:

Pool creation request:

{
  "id": "default",
  "cidr": "10.0.1.0/24",
  "prefix": 32,
  "gateway": "10.0.1.1",
  "dns": ["8.8.8.8", "8.8.4.4"]
}

Files to modify:

  • internal/store/models.go — Add Gateway and DNS fields to Pool struct
  • internal/api/pools.go — Add fields to PoolRequest and PoolResponse
  • internal/validation/ — Add validation for gateway (must be valid IP within or adjacent to CIDR) and DNS (valid IP addresses)

Acceptance Criteria

  • POST /api/v1/pools accepts optional gateway (string IP) and dns (array of string IPs)
  • GET /api/v1/pools/{id} returns gateway and dns in response
  • Gateway validated as valid IPv4/IPv6 address
  • DNS entries validated as valid IP addresses
  • Fields are optional (backwards compatible — existing pools without gateway/dns continue to work)
  • Tests updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions