feat(network): implement peer discovery features and UI integration
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
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
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.
This commit is contained in:
@@ -105,6 +105,13 @@ EvoBGP управляет генерацией и применением BGP-к
|
||||
### Настройки (`/v1/settings`)
|
||||
- KV c ключами BIRD и дополнительными feature flags.
|
||||
- Ключевые параметры BIRD: `bird_router_id`, `bird_local_ipv4`, `bird_local_ipv6`, `bird_local_asn`, `bird_bgp_source_ipv4`, `bird_bgp_source_ipv6`.
|
||||
- **Автообнаружение пиров (peer discovery):**
|
||||
- `peer_discovery_enabled` (bool) — генерирует в `evobgp_peers.conf` dynamic BGP listener (`neighbor range` + `import none` / `export none`).
|
||||
- `peer_discovery_ranges_v4` / `peer_discovery_ranges_v6` — CIDR через пробел/запятую (обязательны при enabled).
|
||||
- `peer_discovery_require_external` (bool, default true) — `neighbor range … external`.
|
||||
- Live-сессии `evobgp_dyn_*` попадают в `GET /v1/peers/discovered`; оператор **одобряет** (`POST …/approve` → обычный `bgp_peer` + `peer_reconcile`) или **отклоняет**.
|
||||
- Идентичность pending: **Neighbor ID** (BGP Identifier), иначе `neighbor+ASN`.
|
||||
- UI: Сеть → вкладка «На одобрение»; настройки — Параметры → BIRD.
|
||||
- **Tenant settings** — глобальный default. **Per-speaker** override: `meta_json.bird_bgp_source_ipv4` / `node_ipv4` в карточке спикера (Web UI → Сеть → Спикеры); pipeline накладывает overlay при сборке бандла для реплики. См. [remote-speakers.md](remote-speakers.md).
|
||||
|
||||
### Web UI: настройки tenant и интерфейса
|
||||
|
||||
@@ -1030,6 +1030,12 @@ components:
|
||||
type: string
|
||||
neighbor:
|
||||
type: string
|
||||
neighbor_as:
|
||||
type: integer
|
||||
description: Remote ASN from birdc (`Neighbor AS:`).
|
||||
neighbor_id:
|
||||
type: string
|
||||
description: BGP Identifier / Neighbor ID from birdc (`Neighbor ID:`).
|
||||
state:
|
||||
type: string
|
||||
additionalProperties: true
|
||||
@@ -1715,6 +1721,51 @@ components:
|
||||
type: string
|
||||
additionalProperties: true
|
||||
|
||||
BgpPeerDiscovery:
|
||||
type: object
|
||||
required: [id, neighbor, status]
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/ResourceId"
|
||||
speaker_id:
|
||||
type: ["string", "null"]
|
||||
neighbor_id:
|
||||
type: string
|
||||
description: BGP Identifier (Neighbor ID / router ID) from birdc.
|
||||
neighbor:
|
||||
type: string
|
||||
description: Neighbor IP address.
|
||||
remote_asn:
|
||||
type: integer
|
||||
protocol_name:
|
||||
type: string
|
||||
description: BIRD protocol name (evobgp_dyn_*).
|
||||
session_state:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
enum: [pending, approved, rejected]
|
||||
first_seen_at:
|
||||
type: string
|
||||
format: date-time
|
||||
last_seen_at:
|
||||
type: string
|
||||
format: date-time
|
||||
approved_peer_id:
|
||||
type: ["string", "null"]
|
||||
additionalProperties: true
|
||||
|
||||
BgpPeerDiscoveryApprove:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
bgp_speaker_id:
|
||||
type: ["string", "null"]
|
||||
enabled:
|
||||
type: boolean
|
||||
additionalProperties: false
|
||||
|
||||
BgpPeerCreate:
|
||||
type: object
|
||||
required: [neighbor, remote_asn]
|
||||
@@ -3100,6 +3151,90 @@ paths:
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/peers/discovered:
|
||||
get:
|
||||
tags: [Peers]
|
||||
summary: Список обнаруженных (неодобренных) пиров
|
||||
description: >
|
||||
Dynamic BGP-сессии (`evobgp_dyn_*`), которых ещё нет в `bgp_peer`.
|
||||
По умолчанию возвращает `status=pending`. При листинге выполняет live-опрос birdc/agent и upsert pending.
|
||||
operationId: listDiscoveredPeers
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- name: status
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
enum: [pending, approved, rejected, all]
|
||||
default: pending
|
||||
responses:
|
||||
"200":
|
||||
description: Успешно.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required: [items]
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/BgpPeerDiscovery"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/peers/discovered/{id}/approve:
|
||||
post:
|
||||
tags: [Peers]
|
||||
summary: Одобрить обнаруженного пира
|
||||
description: >
|
||||
Создаёт обычный `bgp_peer` из discovery-записи и запускает `peer_reconcile`.
|
||||
operationId: approveDiscoveredPeer
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- $ref: "#/components/parameters/PeerId"
|
||||
- $ref: "#/components/parameters/IdempotencyKey"
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BgpPeerDiscoveryApprove"
|
||||
responses:
|
||||
"200":
|
||||
description: Пир создан, discovery → approved.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
peer:
|
||||
$ref: "#/components/schemas/BgpPeer"
|
||||
discovery:
|
||||
$ref: "#/components/schemas/BgpPeerDiscovery"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/peers/discovered/{id}/reject:
|
||||
post:
|
||||
tags: [Peers]
|
||||
summary: Отклонить обнаруженного пира
|
||||
description: Помечает discovery как rejected; повторно не всплывает при sync.
|
||||
operationId: rejectDiscoveredPeer
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- $ref: "#/components/parameters/PeerId"
|
||||
- $ref: "#/components/parameters/IdempotencyKey"
|
||||
responses:
|
||||
"200":
|
||||
description: Discovery → rejected.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BgpPeerDiscovery"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/peers/{id}:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
|
||||
Reference in New Issue
Block a user