]> git.proxmox.com Git - mirror_frr.git/blob - doc/user/mgmtd.rst
Merge pull request #13455 from sri-mohan1/srib-ldpd
[mirror_frr.git] / doc / user / mgmtd.rst
1 .. _mgmtd:
2
3 *************************
4 MGMTd (Management Daemon)
5 *************************
6
7 The FRR Management Daemon (from now on referred to as MGMTd) is a new
8 centralized entity representing the FRR Management Plane which can take
9 management requests from any kind of UI/Frontend entity (e.g. CLI, Netconf,
10 Restconf, Grpc etc.) over a new unified and common Frontend interface and
11 can help maintain configurational data or retrieve operational data from
12 any number of FRR managed entities/components that have been integrated
13 with the new FRR Centralised Management Framework.
14
15 For organizing the management data to be owned by the FRR Management plane,
16 management data is stored in YANG in compliance with a pre-defined set
17 of YANG based schema. Data shall also be stored/retrieved in YANG format only.
18
19 The MGMTd also acts as a separate computational entity for offloading much
20 of the management related computational overload involved in maintaining of
21 management data and processing of management requests, from individual
22 component daemons (which can otherwise be a signficant burden on the individual
23 components, affecting performance of its other functionalities).
24
25 Lastly, the MGMTd works in-tandem with one (or more) MGMT Frontend
26 Clients and a bunch of MGMT Backend Clients to realize the entirety
27 of the FRR Management plane. Some of the advanatages of this new framework
28 are:
29
30 1. Consolidation and management of all Management data by a single entity.
31 2. Better control over configuration validation, commit and rollback.
32 3. Faster collection of configuration data (without needing to involve
33 individual component daemons).
34 4. Offload computational burden of YANG data parsing and validations
35 of new configuration data being provisoned away from individual
36 component daemons
37 5. Improve performance of individual component daemons while loading
38 huge configuration or retrieving huge operational dataset.
39
40 The new FRR Management Daemon consists of the following sub-components:
41 - MGMT Frontend Interface
42 - MGMT Backend Interface
43 - MGMT Transaction Engine
44
45 .. _mgmt_fe:
46
47 MGMT Frontend Interface
48 =======================
49
50 The MGMT Frontend Interface is a bunch of message-based APIs that lets
51 any UI/Frontend client to interact with the MGMT daemon to requests a
52 set of management operations on a specific datastore/database.
53 Following is a list of databases/datastores supported by the MGMT
54 Frontend Interface and MGMTd:
55
56 - Candidate Database:
57
58 - Consists of configuration data items only.
59 - Data can be edited anytime using SET_CONFIG API.
60 - Data can be retrieved anytime using GET_CONFIG/GET_DATA API.
61
62 - Running Database:
63
64 - Consists of configuration data items only.
65 - Data cannot be edited using SET_CONFIG API.
66 - Data can only be modified using COMMIT_CONFIG API after which un-committed
67 data from Candidate database will be first validated and applied to
68 individualBackend component(s). Only on successful validation and apply on
69 all individual components will the new data be copied over to the Running
70 database.
71 - Data can be retrieved anytime using GET_CONFIG/GET_DATA API.
72
73 - Operational Database:
74
75 - Consists of non-configurational data items.
76 - Data is not stored on MGMT daemon. Rather it will be need to be fetched
77 in real-time from the corresponding Backend component (if present).
78 - Data can be retrieved anytime using GET_DATA API.
79
80 Frontend Clients connected to MGMTd via Frontend Interface can themselves have
81 multiple connections from one (or more) of its own remote clients. The MGMT
82 Frontend Interface supports reresenting each of the remote clients for a given
83 Frontend client(e.g. Netconf clients on a single Netconf server) as individual
84 Frontend Client Sessions. So a single connection from a single Frontend Client
85 can create more than one Frontend Client sessions.
86
87 Following are some of the management operations supported:
88 - INIT_SESSION/CLOSE_SESSION: Create/Destroy a session. Rest of all the
89 operations are supported only in the context of a specific session.
90 - LOCK_DB/UNLOCK_DB: Lock/Unlock Management datastores/databases.
91 - GET_CONFIG/GET_DATA: Retrieve configurational/operational data from a
92 specific datastore/database.
93 - SET_CONFIG/DELETE_CONFIG: Add/Modify/Delete specific data in a specific
94 datastore/database.
95 - COMMIT_CONFIG: Validate and/or apply the uncommited set of configurations
96 from one configuration database to another.
97 - Currently committing configurations from Candidate to Running database
98 is only allowed, and not vice versa.
99
100 The exact set of message-based APIs are represented as Google Protobuf
101 messages and can be found in the following file distributed with FRR codebase.
102
103 .. code-block:: frr
104
105 lib/mgmt.proto
106
107 The MGMT daemon implements a MGMT Frontend Server that opens a UNIX
108 socket-based IPC channel on the following path to listen for incoming
109 connections from all possible Frontend clients:
110
111 .. code-block:: frr
112
113 /var/run/frr/mgmtd_fe.sock
114
115 Each connection received from a Frontend client is managed and tracked
116 as a MGMT Frontend adapter by the MGMT Frontend Adapter sub-component
117 implemented by MGMTd.
118
119 To facilitate faster development/integration of Frontend clients with
120 MGMT Frontend Interface, a C-based library has been developed. The API
121 specification of this library can be found at:
122
123 .. code-block:: frr
124
125 lib/mgmt_fe_client.h
126
127 Following is a list of message types supported on the MGMT Frontend Interface:
128 - SESSION_REQ<Client-Connection-Id, Destroy>
129 - SESSION_REPLY<Client-Connection-Id, Destroy, Session-Id>
130 - LOCK_DB_REQ <Session-Id, Database-Id>
131 - LOCK_DB_REPLY <Session-Id, Database-Id>
132 - UNLOCK_DB_REQ <Session-Id, Database-Id>
133 - UNLOCK_DB_REPLY <Session-Id, Database-Id>
134 - GET_CONFIG_REQ <Session-Id, Database-Id, Base-Yang-Xpath>
135 - GET_CONFIG_REPLY <Session-Id, Database-Id, Base-Yang-Xpath, Yang-Data-Set>
136 - SET_CONFIG_REQ <Session-Id, Database-Id, Base-Yang-Xpath, Delete, ...>
137 - SET_CONFIG_REPLY <Session-Id, Database-id, Base-Yang-Xpath, ..., Status>
138 - COMMIT_CONFIG_REQ <Session-Id, Source-Db-Id, Dest-Db-Id>
139 - COMMIT_CONFIG_REPLY <Session-Id, Source-Db-id, Dest-Db-Id, Status>
140 - GET_DATA_REQ <Session-Id, Database-Id, Base-Yang-Xpath>
141 - GET_DATA_REPLY <Session-Id, Database-id, Base-Yang-Xpath, Yang-Data-Set>
142 - REGISTER_NOTIFY_REQ <Session-Id, Database-Id, Base-Yang-Xpath>
143 - DATA_NOTIFY_REQ <Database-Id, Base-Yang-Xpath, Yang-Data-Set>
144
145 Please refer to the MGMT Frontend Client Developers Reference and Guide
146 (coming soon) for more details.
147
148 MGMTD Backend Interface
149 =======================
150 The MGMT Backend Interface is a bunch of message-based APIs that can be
151 used by individual component daemons like BGPd, Staticd, Zebra to connect
152 with MGMTd and utilize the new FRR Management Framework to let any Frontend
153 clients to retrieve any operational data or manipulate any configuration data
154 owned by the individual daemon component.
155
156 Like the MGMT Frontend Interface, the MGMT Backend Interface is is also
157 comprised of the following:
158
159 - MGMT Backend Server (running on MGMT daemon)
160 - MGMT Backend Adapter (running on MGMT daemon)
161 - MGMT Backend client (running on Backend component daemons)
162
163 The MGMT Backend Client and MGMT Backend Adapter sub-component communicates
164 using a specific set of message-based APIs.
165
166 The exact set of message-based APIs are represented as Google Protobuf
167 messages and can be found in the following file distributed with FRR codebase.
168
169 .. code-block:: frr
170
171 lib/mgmt.proto
172
173 The MGMT daemon implements a MGMT Backend Server that opens a UNIX
174 socket-based IPC channel on the following path to listen for incoming
175 connections from all possible Backend clients:
176
177 .. code-block:: frr
178
179 /var/run/frr/mgmtd_be.sock
180
181 Each connection received from a Backend client is managed and tracked
182 as a MGMT Backend adapter by the MGMT Backend Adapter sub-component
183 implemented by MGMTd.
184
185 To facilitate faster development/integration of Backend clients with
186 MGMTd, a C-based library has been developed. The API specification
187 of this library can be found at:
188
189 .. code-block:: frr
190
191 lib/mgmt_be_client.h
192
193 Following is a list of message types supported on the MGMT Backend Interface:
194
195 - SUBSCRIBE_REQ <Req-Id, Base-Yang-Xpath, Filter-Type>
196 - SUBSCRIBE_REPLY <Req-Id, Status>
197 - TXN_REQ <Txn-Id, Create>
198 - TXN_REPLY <Txn-Id, Status>
199 - CREATE_CFGDATA_REQ <Txn-Id, Req-Id, Batch-Id, ConfigDataContents>
200 - CREATE_CFGDATA_ERROR <Txn-Id, Req-Id, Batch-Id, Status>
201 - VALIDATE_CFGDATA_REQ <Txn-Id, Batch-Id>
202 - VALIDATE_CFGDATA_REPLY <Txn-Id, Batch-Id, Status, ErrorInfo>
203 - APPLY_CFGDATA_REQ <Txn-Id, Batch-Id>
204 - APPLY_CFGDATA_REPLY <Txn-Id, Batch-Id, Status, ErrorInfo>
205 - GET_OPERDATA_REQ <Txn-Id, Base-Yang-Xpath, Filter-Type>
206 - GET_OPERDATA_REPLY <Txn-Id, OperDataContents>
207
208 Please refer to the MGMT Backend Client Developers Reference and Guide
209 (coming soon) for more details.
210
211 MGMTD Transaction Engine
212 ========================
213
214 The MGMT Transaction sub-component is the main brain of the MGMT daemon that
215 takes management requests from one (or more) Frontend Client translates
216 them into transactions and drives them to completion in co-oridination with
217 one (or more) Backend client daemons involved in the request.
218
219 A transaction can be seen as a set of management procedures executed over
220 the Backend Interface with one (or more) individual Backend component
221 daemons, as a result of some management request initiated from a specific
222 Frontend client session. These group of operations on the Backend Interface
223 with one (or more) individual components involved should be executed without
224 taking any further management requests from other Frontend client sessions.
225 To maintain this kind of atomic behavior a lock needs to be acquired
226 (sometimes implicitly if not explicitly) by the corresponding Frontend client
227 session, on the various datastores/databases involved in the management request
228 being executed. The same datastores/databases need to be unlocked when all
229 the procedures have been executed and the transaction is being closed.
230
231 Following are some of the transaction types supported by MGMT:
232
233 - Configuration Transactions
234
235 - Used to execute management operations like SET_CONFIG and COMMIT_CONFIG
236 that involve writing/over-writing the contents of Candidate and Running
237 databases.
238 - One (and only) can be created and be in-progress at any given time.
239 - Once initiated by a specific Frontend Client session and is still
240 in-progress, all subsequent SET_CONFIG and COMMIT_CONFIG operations
241 from other Frontend Client sessions will be rejected and responded
242 with failure.
243 - Requires acquiring write-lock on Candidate (and later Running) databases.
244
245 - Show Transactions
246
247 - Used to execute management operations like GET_CONFIG and GET_DATA
248 that involve only reading the contents of Candidate and Running
249 databases (and sometimes real-time retrieval of operational data
250 from individual component daemons).
251 - Multiple instance of this transaction type can be created and be
252 in-progress at any given time.
253 - However, when a configuration transaction is currently in-progress
254 show transaction can be initiated by any Frontend Client session.
255 - Requires acquiring read-lock on Candidate and/or Running databases.
256 - NOTE: Currently GET_DATA on Operational database is NOT supported. To
257 be added in a future time soon.
258
259 MGMTD Configuration Rollback and Commit History
260 ===============================================
261
262 The MGMT daemon maintains upto 10 last configuration commit buffers
263 and can rollback the contents of the Running Database to any of the
264 commit-ids maintained in the commit buffers.
265
266 Once the number of commit buffers exceeds 10, the oldest commit
267 buffer is deleted to make space for the latest commit. Also on
268 rollback to a specific commit-id, buffer of all the later commits
269 are deleted from commit record.
270
271 Configuration rollback is only allowed via VTYSH shell as of today
272 and is not possible through the MGMT Frontend interface.
273
274 MGMT Configuration commands
275 ===========================
276
277 .. clicmd:: mgmt set-config XPATH VALUE
278
279 This command uses a SET_CONFIG request over the MGMT Frontend Interface
280 for the specified xpath with specific value. This command is used for
281 testing purpose only. But can be used to set configuration data from CLI
282 using SET_CONFIG operations.
283
284 .. clicmd:: mgmt delete-config XPATH
285
286 This command uses a SET_CONFIG request (with delete option) over the
287 MGMT Frontend Interface o delete the YANG data node at the given
288 xpath unless it is a key-leaf node(in which case it is not deleted).
289
290 .. clicmd:: mgmt load-config FILE <merge|replace>
291
292 This command loads configuration in JSON format from the filepath specified,
293 and merges or replaces the Candidate DB as per the option specified.
294
295 .. clicmd:: mgmt save-config <candidate|running> FILE
296
297 This command dumps the DB specified in the db-name into the file in JSON
298 format. This command in not supported for the Operational DB.
299
300 .. clicmd:: mgmt commit abort
301
302 This command will abort any configuration present on the Candidate but not
303 been applied to the Running DB.
304
305 .. clicmd:: mgmt commit apply
306
307 This command commits any uncommited changes in the Candidate DB to the
308 Running DB.
309
310 .. clicmd:: mgmt commit check
311
312 This command validates the configuration but does not apply them to the
313 Running DB.
314
315 .. clicmd:: mgmt rollback commit-id WORD
316
317 This command rolls back the Running Database contents to the state
318 corresponding to the commit-id specified.
319
320 .. clicmd:: mgmt rollback last WORD
321
322 This command rolls back the last specified number of recent commits.
323
324
325 MGMT Show commands
326 ==================
327
328 .. clicmd:: show mgmt backend-adapter all
329
330 This command shows the backend adapter information and the clients/daemons
331 connected to the adapters.
332
333 .. clicmd:: show mgmt backend-yang-xpath-registry
334
335 This command shows which Backend adapters are registered for which YANG
336 data subtree(s).
337
338 .. clicmd:: show mgmt frontend-adapter all [detail]
339
340 This command shows the frontend adapter information and the clients
341 connected to the adapters.
342
343 .. clicmd:: show mgmt transaction all
344
345 Shows the list of transaction and bunch of information about the transaction.
346
347 .. clicmd:: show mgmt get-config [candidate|running] XPATH
348
349 This command uses the GET_CONFIG operation over the MGMT Frontend interface and
350 returns the xpaths and values of the nodes of the subtree pointed by the <xpath>.
351
352 .. clicmd:: show mgmt get-data [candidate|operation|running] XPATH
353
354 This command uses the GET_DATA operation over the MGMT Frontend interface and
355 returns the xpaths and values of the nodes of the subtree pointed by the <xpath>.
356 Currenlty supported values for 'candidate' and 'running' only
357 ('operational' shall be supported in future soon).
358
359 .. clicmd:: show mgmt database-contents [candidate|operation|running] [xpath WORD] [file WORD] json|xml
360
361 This command dumps the subtree pointed by the xpath in JSON or XML format. If filepath is
362 not present then the tree will be printed on the shell.
363
364 .. clicmd:: show mgmt commit-history
365
366 This command dumps details of upto last 10 commits handled by MGMTd.
367
368
369 MGMT Daemon debug commands
370 ==========================
371
372 The following debug commands enable debugging within the management daemon:
373
374 .. clicmd:: [no] debug mgmt backend
375
376 Enable[/Disable] debugging messages related to backend operations within the
377 management daemon.
378
379 .. clicmd:: [no] debug mgmt datastore
380
381 Enable[/Disable] debugging messages related to YANG datastore operations
382 within the management daemon.
383
384 .. clicmd:: [no] debug mgmt frontend
385
386 Enable[/Disable] debugging messages related to frontend operations within the
387 management daemon.
388
389 .. clicmd:: [no] debug mgmt transaction
390
391 Enable[/Disable] debugging messages related to transactions within the
392 management daemon.
393
394
395 MGMT Client debug commands
396 ==========================
397
398 The following debug commands enable debugging within the management front and
399 backend clients:
400
401 .. clicmd:: [no] debug mgmt client backend
402
403 Enable[/Disable] debugging messages related to backend operations inside the
404 backend mgmtd clients.
405
406 .. clicmd:: [no] debug mgmt client frontend
407
408 Enable[/Disable] debugging messages related to frontend operations inside the
409 frontend mgmtd clients.