Skip to content

BGP workspace and prefix catalogue

The comment-editing contract below only applies when the installed host API reports ui_annotations_version: 1 in its BGP workspace response. Older versions do not support annotation writes. Use your installation’s HTTPS origin and the existing human session. The example node and UUID below are documentation values.

GET /api/v1/modules/bgp/nodes/{node}/workspace requires node-scoped read. PUT on the same path requires candidate_write, and POST /api/v1/modules/bgp/nodes/{node}/apply requires apply_critical in the current authenticated session. An ordinary BGP draft commit does not ask for the password again. The server checks rights and tenant/node scope, and comments do not open any alternative authorization path. GET /api/v1/modules/bgp/nodes/{node}/context reports apply_authentication: "session"; an eligible authenticated user gets capabilities.apply: true and step_up_required: false. A missing field means an older API, whose advertised policy must be respected. POST /api/v1/modules/bgp/nodes/{node}/apply/retry uses the same node-scoped permission and existing session, and its JSON body contains expected_generation and reason. Both actions keep their audit and their existing concurrency fences. This exception covers only these BGP workspace actions and the catalogue Commit described below. Network/XDP changes, module installation, secrets, and user or credential administration keep their existing authentication requirements.

The workspace JSON includes ui_annotations_version (integer 1), ui_annotations (effective draft annotations) and committed_ui_annotations (the committed annotations from the same durable read). Both annotation fields are objects with community_sets and prefix_sets maps, which default to empty objects. Map keys are the exact existing object UUIDs. Community entries contain only members_text; prefix entries contain only entries_text. Annotations live apart from desired and committed_desired, and they are never sent in the controller snapshot.

Text keeps blank lines, ordering, and # comments, whether standalone or trailing. On each line, the value ends at the first #. Community syntax is one member per line. Prefix syntax is 192.0.2.0/24 or 192.0.2.0/24 24-32; if the underlying entry uses the explicit 0-0 mask form, it is retained. Parsed values must exactly match the corresponding submitted desired list, ordering and prefix mask fields included. Existing BGP semantic validation still applies.

Each text is capped at 16 KiB of UTF-8, and serialized annotation JSON at 256 KiB per node. Tab and LF are the only control characters accepted, so normalize CRLF to LF before sending. The server rejects unknown kinds, fields and IDs, duplicate object keys, null annotations, mismatched values, and anything over the limits.

Save needs the complete desired, a nonempty reason of at most 512 printable UTF-8 bytes, and both current fences: expected_generation and expected_draft_revision. The optional ui_annotations replaces the full annotation maps. Omitting it preserves compatible existing text and removes annotations for deleted objects. If an existing list’s values no longer match the retained text, the save is rejected. Send updated text, or an explicit empty map to clear it. Save is atomic with the draft and only increases the draft revision.

Apply consumes the saved draft, with both fences and a reason. If only annotations changed, it commits the text and audit, increases the draft revision once more, and leaves BGP generation alone without calling the controller. If BGP content changed too, the existing generation advance and delivery flow applies. apply_status stays draft while draft annotations differ from committed ones. A committed configuration response does not prove that peers are currently established.

This complete browser example edits comments on an existing community list, then saves and applies the exact revision returned. Both operations return the complete workspace JSON: the existing fields schema_version, workspace_mode, node, source_id, generation, draft_revision, applied_generation, apply_status, controller_configured, last_error, desired, committed_desired, controller_state, and module, plus the three annotation fields described above. These endpoints do not paginate.

const node = 'router-a';
const base = `/api/v1/modules/bgp/nodes/${node}`;
async function request(path, method = 'GET', body) {
const response = await fetch(base + path, {
method, credentials: 'same-origin',
headers: body === undefined ? {} : { 'Content-Type': 'application/json' },
...(body === undefined ? {} : { body: JSON.stringify(body) })
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error}`);
return result;
}
const workspace = await request('/workspace');
if (workspace.ui_annotations_version !== 1) throw new Error('Annotation editing unavailable');
const list = workspace.desired.community_sets.find(
row => row.id === '4830d083-6ee0-40a5-b876-f35a5e5c50f0'
);
if (!list) throw new Error('Example list does not exist');
const ui_annotations = structuredClone(workspace.ui_annotations);
ui_annotations.community_sets[list.id] = {
members_text: '# Example routing note\n' + list.members.join('\n') + '\n'
};
const saved = await request('/workspace', 'PUT', {
expected_draft_revision: workspace.draft_revision,
expected_generation: workspace.generation,
desired: workspace.desired,
ui_annotations,
reason: 'Save list documentation'
});
const applied = await request('/apply', 'POST', {
expected_draft_revision: saved.draft_revision,
expected_generation: saved.generation,
reason: 'Commit reviewed list documentation'
});
console.log(applied.generation, applied.draft_revision, applied.committed_ui_annotations);

Successful reads and writes return HTTP 200. Invalid desired content or annotation binding returns 400. Invalid JSON field types, unknown DTO fields and duplicate annotation object keys return 422. A missing or expired session returns 401, insufficient node permission 403, and a stale generation or draft revision 409. Ordinary BGP workspace Apply and Retry do not return 428 just because the session is no longer recent. Unconfigured human authentication returns 503. On 409, read the workspace again and resolve the conflict explicitly; do not overwrite another user’s draft automatically. JSON errors contain error and issues, and existing repository and controller errors keep their existing status codes. No new timestamp format or pagination is introduced.

Comments survive an API restart and a browser reload. For rollback after annotations have been saved, use an annotation-compatible API reader. Removing persistent annotations is not part of rollback. Shared lists follow the separate catalogue contract below.

In versions with per-router announcement settings, the BGP instance, next hop and community lists are chosen separately for each router. A prefix list is identified by project, name and address family, and the preview shows its actual prefixes on each router. These settings apply only to new announcements. Existing ones keep their parameters.

The current BGP module requires every enabled ordinary peer of the selected address family and instance. Route-server clients are excluded. An empty or incomplete selection blocks Save, and refreshing never selects newly added peers automatically. If creating the announcement would affect unselected group members, or leave ordered policies inconsistent across ordinary peers, configure those policies separately first.

Save writes router drafts, each versioned independently. Review and apply them through Commit Config. If a save partially fails, nothing is applied or retried automatically. Actual route export is confirmed by observed state, not by the draft preview.

This section only applies to a catalogue-capable API that exposes the four operations below and returns schema_version: 1 from the catalogue workspace. ui_annotations_version on its own does not enable the catalogue. What follows is the supported API contract, not the rollout status of any particular installation. Use your installation’s HTTPS origin, an existing human session, and Content-Type: application/json for writes. Do not treat an older or unconfigured API as an editable catalogue.

  • GET /api/v1/modules/bgp/prefix-catalog/workspace reads the authorized catalogue.
  • PUT /api/v1/modules/bgp/prefix-catalog/workspace saves a draft.
  • POST /api/v1/modules/bgp/prefix-catalog/commit/preview returns the exact pending changes and node revisions.
  • POST /api/v1/modules/bgp/prefix-catalog/commit commits that reviewed revision.

These paths take no query parameters and do not paginate. A region filter is just a client-side view of the returned data. global covers all configured BGP nodes of this installation; regional names exactly one server-configured region. Regions come back as id, label and node_ids. A list belongs to one project_id, and sharing does not cross projects. A list does not create BGP sessions or announcements by itself.

Read requires read on every node in a list’s scope. Regions, usages, existing local lists and a node workspace’s available_catalog are filtered the same way. Save requires both read and candidate_write across the union of the old scope, the new scope and the affected bound nodes. Preview requires complete read; Commit requires read and apply_critical across that complete scope. Catalogue Commit accepts an ordinary valid session without a fresh password prompt, and still keeps revocation, audit and every revision check. capabilities.draft or capabilities.commit only means that at least one node permits the action. To assess the complete scope, use write_nodes and apply_nodes. A true flag does not authorize every list. global_draft and global_commit report explicitly whether all configured nodes are covered for editing or committing a global list, so use those flags for global controls. The server rechecks the complete scope regardless.

committed and draft are maps keyed by the exact list UUID. revision is the catalogue concurrency fence, and each list also carries its own server-assigned revision. Save changes only the durable catalogue draft and the affected node drafts, preserved comments included. It does not contact the BGP runtime. Nothing imports or merges existing_local automatically. A list cannot be deleted while any saved or committed binding remains. A scope change cannot exclude an existing consumer, and a bound list cannot change project or address family.

A list ID is a canonical nonzero UUID. project_id and name are nonempty printable strings of at most 128 UTF-8 bytes. scope is either global with region_id: null, or regional with a known region ID of at most 64 UTF-8 bytes. family is ipv4_unicast or ipv6_unicast. Prefixes must use canonical network addresses of that family, with prefix length ≤ min_length ≤ max_length ≤ 32 or 128. The existing exact-prefix form min_length: 0, max_length: 0 is accepted too. Both zero values are preserved, including an explicit 0-0 in entries_text, and the canonical network address and family checks still apply. Duplicate prefix/range triples are rejected. The limits are 1,000 lists, 10,000 entries per list, 16 KiB for nonempty entries_text, and 1 to 512 printable UTF-8 bytes for reason. Nonempty text must parse to the exact entries, order included, and the comment rules above apply. When omitted, entries_text defaults to empty, revision to zero, and Save’s upsert/delete to empty arrays. The server assigns list revisions. Revisions and generations are nonnegative integers no greater than 9007199254740991.

The shapes below describe the catalogue requests and responses. before, after and existing_local.prefix_set keep the complete existing BGP snapshot or prefix-set schema. They are not arbitrary objects the BGP validators will accept. No new timestamp field is introduced.

type NodeId = 'router-a' | 'router-b' | 'edge';
type Binding = { catalog_id: string; revision: number };
type CatalogList = {
id: string; project_id: string; name: string;
scope: 'global' | 'regional'; region_id: string | null;
family: 'ipv4_unicast' | 'ipv6_unicast';
entries: Array<{ prefix: string; min_length: number; max_length: number }>;
entries_text: string; revision: number;
};
type CatalogListInput = Omit<CatalogList, 'entries_text' | 'revision'> & {
entries_text?: string; revision?: number;
};
type Save = { expected_revision: number; upsert?: CatalogListInput[]; delete?: string[]; reason: string };
type PreviewRequest = { expected_revision: number };
type NodeFence = { node: NodeId; generation: number; draft_revision: number };
type Commit = { expected_revision: number; nodes: NodeFence[]; reason: string };
type Workspace = {
schema_version: 1; revision: number;
regions: Array<{ id: string; label: string; node_ids: NodeId[] }>;
committed: Record<string, CatalogList>; draft: Record<string, CatalogList>;
usages: Array<{ node: NodeId; materialized_prefix_set_id: string; catalog_id: string; revision: number; state: 'committed' | 'draft' }>;
existing_local: Array<{ node: NodeId; prefix_set: Record<string, unknown> }>;
capabilities: { read: boolean; draft: boolean; commit: boolean; global_draft: boolean; global_commit: boolean; step_up_required: boolean; write_nodes: NodeId[]; apply_nodes: NodeId[] };
};
type Annotations = { community_sets: Record<string, { members_text: string }>; prefix_sets: Record<string, { entries_text: string }> };
type NodePreview = NodeFence & {
before: Record<string, unknown>; after: Record<string, unknown>;
before_annotations: Annotations; after_annotations: Annotations;
before_bindings: Record<string, Binding>; after_bindings: Record<string, Binding>;
delivery_state: string; requires_apply: boolean;
};
type Preview = { revision: number; changed_catalog_ids: string[]; nodes: NodePreview[] };
type CommitResult = {
revision: number; committed: boolean;
nodes: Array<{ node: NodeId; state: 'applied' | 'retry_required'; generation: number; error: string | null }>;
};
type ErrorResponse = { error: string; issues: unknown[] };

This example creates an unbound global list in an otherwise empty catalogue, as a user with full permissions on both example nodes. Each record pairs an HTTP request with its complete JSON response body; the outer request/response labels are documentation notation only. Every successful operation returns HTTP 200. The browser supplies the session cookie, so it is not shown. Review the Preview response before sending Commit. Empty nodes is correct for an unbound list, but the full global-scope permission checks still apply.

{
"request": {
"method": "GET",
"path": "/api/v1/modules/bgp/prefix-catalog/workspace"
},
"response": {
"schema_version": 1,
"revision": 0,
"regions": [
{
"id": "example-region",
"label": "Example region",
"node_ids": [
"router-a",
"router-b"
]
}
],
"committed": {},
"draft": {},
"usages": [],
"existing_local": [],
"capabilities": {
"read": true,
"draft": true,
"commit": true,
"global_draft": true,
"global_commit": true,
"step_up_required": false,
"write_nodes": [
"router-a",
"router-b"
],
"apply_nodes": [
"router-a",
"router-b"
]
}
}
}
{
"request": {
"method": "PUT",
"path": "/api/v1/modules/bgp/prefix-catalog/workspace",
"headers": {
"Content-Type": "application/json"
},
"body": {
"expected_revision": 0,
"upsert": [
{
"id": "da4efc77-5aee-4b80-91a2-fc8b58c84001",
"project_id": "example-project",
"name": "Documentation prefixes",
"scope": "global",
"region_id": null,
"family": "ipv4_unicast",
"entries": [
{
"prefix": "192.0.2.0/24",
"min_length": 24,
"max_length": 32
}
],
"entries_text": "# Example prefix\n192.0.2.0/24 24-32\n",
"revision": 0
}
],
"delete": [],
"reason": "Save reviewed documentation prefixes"
}
},
"response": {
"schema_version": 1,
"revision": 1,
"regions": [
{
"id": "example-region",
"label": "Example region",
"node_ids": [
"router-a",
"router-b"
]
}
],
"committed": {},
"draft": {
"da4efc77-5aee-4b80-91a2-fc8b58c84001": {
"id": "da4efc77-5aee-4b80-91a2-fc8b58c84001",
"project_id": "example-project",
"name": "Documentation prefixes",
"scope": "global",
"region_id": null,
"family": "ipv4_unicast",
"entries": [
{
"prefix": "192.0.2.0/24",
"min_length": 24,
"max_length": 32
}
],
"entries_text": "# Example prefix\n192.0.2.0/24 24-32\n",
"revision": 1
}
},
"usages": [],
"existing_local": [],
"capabilities": {
"read": true,
"draft": true,
"commit": true,
"global_draft": true,
"global_commit": true,
"step_up_required": false,
"write_nodes": [
"router-a",
"router-b"
],
"apply_nodes": [
"router-a",
"router-b"
]
}
}
}
{
"request": {
"method": "POST",
"path": "/api/v1/modules/bgp/prefix-catalog/commit/preview",
"headers": {
"Content-Type": "application/json"
},
"body": {
"expected_revision": 1
}
},
"response": {
"revision": 1,
"changed_catalog_ids": [
"da4efc77-5aee-4b80-91a2-fc8b58c84001"
],
"nodes": []
}
}
{
"request": {
"method": "POST",
"path": "/api/v1/modules/bgp/prefix-catalog/commit",
"headers": {
"Content-Type": "application/json"
},
"body": {
"expected_revision": 1,
"nodes": [],
"reason": "Commit reviewed documentation prefixes"
}
},
"response": {
"revision": 2,
"committed": true,
"nodes": []
}
}

Creating or replacing a binding requires read on every node in the selected list’s scope, on top of read and candidate_write on the edited node. Knowing a catalogue ID does not get around this check: insufficient scope returns 403 before anything is saved. Keeping the same existing binding during some other local edit requires only the edited node’s permissions.

The ordinary node workspace adds available_catalog, catalog_bindings and committed_catalog_bindings. In responses, bindings map a node prefix-set ID to {catalog_id, revision}. Node Save accepts an optional catalog_bindings, a complete map from node prefix-set ID to catalogue ID, with at most 1,000 bindings per node. Omitting it preserves existing bindings and their exact copies; {} explicitly unlinks all bindings while keeping the submitted local prefix sets. A new selection must exactly match the current catalogue draft’s project, family, name and entries. Re-selecting the same binding keeps its recorded revision. Policies and other consumers keep their node prefix-set IDs.

The function below saves a new node binding with both node fences and preserves existing bindings. Supply reviewed UUIDs, for example catalogue da4efc77-5aee-4b80-91a2-fc8b58c84001 and node prefix set 9b83b7d3-d31b-47b2-a3da-a88944b2f187. It returns the complete node workspace and does not Commit. Binding comments are derived from the catalogue. If the selected catalogue revision is still pending, go through catalogue Preview and Commit; ordinary node Apply must not bypass the pending shared change.

async function saveCatalogBinding(node, catalogId, prefixSetId) {
const path = `/api/v1/modules/bgp/nodes/${node}/workspace`;
const get = await fetch(path, { credentials: 'same-origin' });
const workspace = await get.json();
if (!get.ok) throw new Error(`${get.status}: ${workspace.error}`);
const list = workspace.available_catalog?.find(row => row.id === catalogId);
if (!list) throw new Error('Catalogue list unavailable');
const desired = structuredClone(workspace.desired);
desired.prefix_sets ??= [];
if (desired.prefix_sets.some(row => row.id === prefixSetId)) {
throw new Error('Use a new reviewed node prefix-set ID');
}
desired.prefix_sets.push({
id: prefixSetId, project_id: list.project_id, name: list.name,
family: list.family, entries: list.entries
});
const catalog_bindings = Object.fromEntries(
Object.entries(workspace.catalog_bindings).map(([id, ref]) => [id, ref.catalog_id])
);
catalog_bindings[prefixSetId] = list.id;
const put = await fetch(path, {
method: 'PUT', credentials: 'same-origin',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
expected_generation: workspace.generation,
expected_draft_revision: workspace.draft_revision,
desired, catalog_bindings, reason: 'Save an explicitly reviewed catalogue binding'
})
});
const saved = await put.json();
if (!put.ok) throw new Error(`${put.status}: ${saved.error}`);
return saved;
}

For bound lists, Preview includes the complete before and after node drafts, annotations, binding maps, delivery status and requires_apply. Review every change on each affected node, including any other changes already saved in that node draft. Commit must send exactly the Preview node set, each with its generation and draft_revision, plus expected_revision and a reason. Nodes are delivered independently. This is not an atomic cross-node runtime update.

A partial response has committed: false and a per-node result of applied or retry_required. Keep the returned generations and errors. Do not resend an unconfirmed generation by repeating catalogue Commit. Instead, use the existing node POST /api/v1/modules/bgp/nodes/{node}/apply/retry with that expected_generation and a reason, then get a new catalogue Preview and explicitly Commit its current fences. While a partially delivered catalogue remains unresolved, new catalogue edits are refused. Cancelling keeps saved drafts. A successful catalogue Commit advances the revision and makes committed equal draft. It does not prove that BGP peers are Established.

Malformed content, an unknown region, invalid binding content, an unchanged Save, no pending changes, or a missing, extra or duplicate Commit node returns 400. Invalid JSON types and unknown request fields return 422. A missing or expired session returns 401, insufficient complete-scope permission 403, and a stale catalogue, node generation or draft revision 409. Unconfigured human authentication, or an authorization change detected during the request, returns 503. Catalogue Commit does not return 428 merely because a valid session is no longer recent. Error JSON stays {error, issues}. After a 409, read and review again rather than overwriting another draft. Partial delivery can still return HTTP 200, so always inspect committed and every node result.

Catalogue state and bindings survive an API restart. The first explicit Save switches persistence to the catalogue-capable format, and startup does not auto-import existing lists. After saving, rollback requires a catalogue-compatible API reader and must keep the catalogue state. Older readers reject the newer format. Do not remove catalogue data to make an old binary start.