Files
EvoBGP/migrations/postgres/000031_peer_discovery.up.sql
T
Denozordec 5fbe9c9b56
CI / changes (push) Successful in 6s
CI / commitlint (push) Skipped
CI / openapi (push) Successful in 28s
CI / web (push) Successful in 52s
CI / go (push) Successful in 2m22s
CI / bird2 (push) Successful in 15s
CI / release (push) Successful in 4m36s
feat(network): implement peer discovery features and UI integration
Added functionality for peer discovery, including new API endpoints for listing, approving, and rejecting discovered peers. Updated the network queries and settings to support peer discovery configurations. Enhanced the UI to display discovered peers and integrated related settings in the tenant settings component. Updated OpenAPI documentation to reflect the new endpoints and parameters. This improves the network management capabilities by allowing dynamic peer discovery and management.
2026-07-30 22:31:59 +07:00

31 lines
1.4 KiB
SQL

-- Peer auto-discovery pending / rejected / approved records.
CREATE TABLE IF NOT EXISTS bgp_peer_discovery (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL REFERENCES tenant (id) ON DELETE CASCADE,
speaker_id UUID REFERENCES bgp_speaker (id) ON DELETE SET NULL,
neighbor_id TEXT NOT NULL DEFAULT '',
neighbor INET NOT NULL,
remote_asn BIGINT NOT NULL DEFAULT 0,
protocol_name TEXT NOT NULL DEFAULT '',
session_state TEXT NOT NULL DEFAULT '',
status TEXT NOT NULL DEFAULT 'pending',
first_seen_at TIMESTAMPTZ NOT NULL DEFAULT now(),
last_seen_at TIMESTAMPTZ NOT NULL DEFAULT now(),
approved_peer_id UUID REFERENCES bgp_peer (id) ON DELETE SET NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT bgp_peer_discovery_status_chk CHECK (status IN ('pending', 'approved', 'rejected'))
);
CREATE INDEX IF NOT EXISTS idx_bgp_peer_discovery_tenant_status
ON bgp_peer_discovery (tenant_id, status);
CREATE UNIQUE INDEX IF NOT EXISTS idx_bgp_peer_discovery_tenant_neighbor_id
ON bgp_peer_discovery (tenant_id, neighbor_id)
WHERE neighbor_id <> '';
CREATE UNIQUE INDEX IF NOT EXISTS idx_bgp_peer_discovery_tenant_neighbor_asn
ON bgp_peer_discovery (tenant_id, neighbor, remote_asn)
WHERE neighbor_id = '';