Branch data Line data Source code
1 : : /* Generated automatically -- do not modify! -*- buffer-read-only: t -*- */
2 : :
3 : : #include <config.h>
4 : : #include "ovn/lib/ovn-nb-idl.h"
5 : : #include <limits.h>
6 : : #include "ovs-thread.h"
7 : : #include "ovsdb-data.h"
8 : : #include "ovsdb-error.h"
9 : : #include "util.h"
10 : :
11 : : #ifdef __CHECKER__
12 : : /* Sparse dislikes sizeof(bool) ("warning: expression using sizeof bool"). */
13 : : enum { sizeof_bool = 1 };
14 : : #else
15 : : enum { sizeof_bool = sizeof(bool) };
16 : : #endif
17 : :
18 : : static bool inited;
19 : :
20 : :
21 : : static struct nbrec_acl *
22 : 1357 : nbrec_acl_cast(const struct ovsdb_idl_row *row)
23 : : {
24 : 1357 : return row ? CONTAINER_OF(row, struct nbrec_acl, header_) : NULL;
25 : : }
26 : :
27 : : static struct nbrec_address_set *
28 : 2370 : nbrec_address_set_cast(const struct ovsdb_idl_row *row)
29 : : {
30 : 2370 : return row ? CONTAINER_OF(row, struct nbrec_address_set, header_) : NULL;
31 : : }
32 : :
33 : : static struct nbrec_dhcp_options *
34 : 187 : nbrec_dhcp_options_cast(const struct ovsdb_idl_row *row)
35 : : {
36 : 187 : return row ? CONTAINER_OF(row, struct nbrec_dhcp_options, header_) : NULL;
37 : : }
38 : :
39 : : static struct nbrec_load_balancer *
40 : 216 : nbrec_load_balancer_cast(const struct ovsdb_idl_row *row)
41 : : {
42 : 216 : return row ? CONTAINER_OF(row, struct nbrec_load_balancer, header_) : NULL;
43 : : }
44 : :
45 : : static struct nbrec_logical_router *
46 : 32818 : nbrec_logical_router_cast(const struct ovsdb_idl_row *row)
47 : : {
48 : 32818 : return row ? CONTAINER_OF(row, struct nbrec_logical_router, header_) : NULL;
49 : : }
50 : :
51 : : static struct nbrec_logical_router_port *
52 : 12541 : nbrec_logical_router_port_cast(const struct ovsdb_idl_row *row)
53 : : {
54 : 12541 : return row ? CONTAINER_OF(row, struct nbrec_logical_router_port, header_) : NULL;
55 : : }
56 : :
57 : : static struct nbrec_logical_router_static_route *
58 : 1926 : nbrec_logical_router_static_route_cast(const struct ovsdb_idl_row *row)
59 : : {
60 : 1926 : return row ? CONTAINER_OF(row, struct nbrec_logical_router_static_route, header_) : NULL;
61 : : }
62 : :
63 : : static struct nbrec_logical_switch *
64 : 85464 : nbrec_logical_switch_cast(const struct ovsdb_idl_row *row)
65 : : {
66 : 85464 : return row ? CONTAINER_OF(row, struct nbrec_logical_switch, header_) : NULL;
67 : : }
68 : :
69 : : static struct nbrec_logical_switch_port *
70 : 213501 : nbrec_logical_switch_port_cast(const struct ovsdb_idl_row *row)
71 : : {
72 : 213501 : return row ? CONTAINER_OF(row, struct nbrec_logical_switch_port, header_) : NULL;
73 : : }
74 : :
75 : : static struct nbrec_nat *
76 : 83 : nbrec_nat_cast(const struct ovsdb_idl_row *row)
77 : : {
78 : 83 : return row ? CONTAINER_OF(row, struct nbrec_nat, header_) : NULL;
79 : : }
80 : :
81 : : static struct nbrec_nb_global *
82 : 12299 : nbrec_nb_global_cast(const struct ovsdb_idl_row *row)
83 : : {
84 : 12299 : return row ? CONTAINER_OF(row, struct nbrec_nb_global, header_) : NULL;
85 : : }
86 : :
87 : : /* ACL table. */
88 : :
89 : : static void
90 : 117 : nbrec_acl_parse_action(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
91 : : {
92 : 117 : struct nbrec_acl *row = nbrec_acl_cast(row_);
93 : :
94 [ - + ]: 117 : ovs_assert(inited);
95 [ + - ]: 117 : if (datum->n >= 1) {
96 : 117 : row->action = datum->keys[0].string;
97 : : } else {
98 : 0 : row->action = "";
99 : : }
100 : 117 : }
101 : :
102 : : static void
103 : 117 : nbrec_acl_parse_direction(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
104 : : {
105 : 117 : struct nbrec_acl *row = nbrec_acl_cast(row_);
106 : :
107 [ - + ]: 117 : ovs_assert(inited);
108 [ + - ]: 117 : if (datum->n >= 1) {
109 : 117 : row->direction = datum->keys[0].string;
110 : : } else {
111 : 0 : row->direction = "";
112 : : }
113 : 117 : }
114 : :
115 : : static void
116 : 97 : nbrec_acl_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
117 : : {
118 : 97 : struct nbrec_acl *row = nbrec_acl_cast(row_);
119 : : size_t i;
120 : :
121 [ - + ]: 97 : ovs_assert(inited);
122 : 97 : smap_init(&row->external_ids);
123 [ - + ]: 97 : for (i = 0; i < datum->n; i++) {
124 : 0 : smap_add(&row->external_ids,
125 : 0 : datum->keys[i].string,
126 : 0 : datum->values[i].string);
127 : : }
128 : 97 : }
129 : :
130 : : static void
131 : 99 : nbrec_acl_parse_log(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
132 : : {
133 : 99 : struct nbrec_acl *row = nbrec_acl_cast(row_);
134 : :
135 [ - + ]: 99 : ovs_assert(inited);
136 [ + - ]: 99 : if (datum->n >= 1) {
137 : 99 : row->log = datum->keys[0].boolean;
138 : : } else {
139 : 0 : row->log = false;
140 : : }
141 : 99 : }
142 : :
143 : : static void
144 : 117 : nbrec_acl_parse_match(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
145 : : {
146 : 117 : struct nbrec_acl *row = nbrec_acl_cast(row_);
147 : :
148 [ - + ]: 117 : ovs_assert(inited);
149 [ + - ]: 117 : if (datum->n >= 1) {
150 : 117 : row->match = datum->keys[0].string;
151 : : } else {
152 : 0 : row->match = "";
153 : : }
154 : 117 : }
155 : :
156 : : static void
157 : 117 : nbrec_acl_parse_priority(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
158 : : {
159 : 117 : struct nbrec_acl *row = nbrec_acl_cast(row_);
160 : :
161 [ - + ]: 117 : ovs_assert(inited);
162 [ + - ]: 117 : if (datum->n >= 1) {
163 : 117 : row->priority = datum->keys[0].integer;
164 : : } else {
165 : 0 : row->priority = 0;
166 : : }
167 : 117 : }
168 : :
169 : : static void
170 : 137 : nbrec_acl_unparse_action(struct ovsdb_idl_row *row OVS_UNUSED)
171 : : {
172 : : /* Nothing to do. */
173 : 137 : }
174 : :
175 : : static void
176 : 137 : nbrec_acl_unparse_direction(struct ovsdb_idl_row *row OVS_UNUSED)
177 : : {
178 : : /* Nothing to do. */
179 : 137 : }
180 : :
181 : : static void
182 : 117 : nbrec_acl_unparse_external_ids(struct ovsdb_idl_row *row_)
183 : : {
184 : 117 : struct nbrec_acl *row = nbrec_acl_cast(row_);
185 : :
186 [ - + ]: 117 : ovs_assert(inited);
187 : 117 : smap_destroy(&row->external_ids);
188 : 117 : }
189 : :
190 : : static void
191 : 119 : nbrec_acl_unparse_log(struct ovsdb_idl_row *row OVS_UNUSED)
192 : : {
193 : : /* Nothing to do. */
194 : 119 : }
195 : :
196 : : static void
197 : 137 : nbrec_acl_unparse_match(struct ovsdb_idl_row *row OVS_UNUSED)
198 : : {
199 : : /* Nothing to do. */
200 : 137 : }
201 : :
202 : : static void
203 : 137 : nbrec_acl_unparse_priority(struct ovsdb_idl_row *row OVS_UNUSED)
204 : : {
205 : : /* Nothing to do. */
206 : 137 : }
207 : :
208 : : static void
209 : 117 : nbrec_acl_init__(struct ovsdb_idl_row *row)
210 : : {
211 : 117 : nbrec_acl_init(nbrec_acl_cast(row));
212 : 117 : }
213 : :
214 : : /* Clears the contents of 'row' in table "ACL". */
215 : : void
216 : 117 : nbrec_acl_init(struct nbrec_acl *row)
217 : : {
218 : 117 : memset(row, 0, sizeof *row);
219 : 117 : smap_init(&row->external_ids);
220 : 117 : }
221 : :
222 : : /* Searches table "ACL" in 'idl' for a row with UUID 'uuid'. Returns
223 : : * a pointer to the row if there is one, otherwise a null pointer. */
224 : : const struct nbrec_acl *
225 : 0 : nbrec_acl_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
226 : : {
227 : 0 : return nbrec_acl_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_ACL], uuid));
228 : : }
229 : :
230 : : /* Returns a row in table "ACL" in 'idl', or a null pointer if that
231 : : * table is empty.
232 : : *
233 : : * Database tables are internally maintained as hash tables, so adding or
234 : : * removing rows while traversing the same table can cause some rows to be
235 : : * visited twice or not at apply. */
236 : : const struct nbrec_acl *
237 : 0 : nbrec_acl_first(const struct ovsdb_idl *idl)
238 : : {
239 : 0 : return nbrec_acl_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_ACL]));
240 : : }
241 : :
242 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
243 : : * is the last row in its table. */
244 : : const struct nbrec_acl *
245 : 0 : nbrec_acl_next(const struct nbrec_acl *row)
246 : : {
247 : 0 : return nbrec_acl_cast(ovsdb_idl_next_row(&row->header_));
248 : : }
249 : :
250 : 0 : unsigned int nbrec_acl_get_seqno(const struct ovsdb_idl *idl)
251 : : {
252 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_ACL]);
253 : : }
254 : :
255 : 0 : unsigned int nbrec_acl_row_get_seqno(const struct nbrec_acl *row, enum ovsdb_idl_change change)
256 : : {
257 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
258 : : }
259 : :
260 : : const struct nbrec_acl *
261 : 0 : nbrec_acl_track_get_first(const struct ovsdb_idl *idl)
262 : : {
263 : 0 : return nbrec_acl_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_ACL]));
264 : : }
265 : :
266 : : const struct nbrec_acl
267 : 0 : *nbrec_acl_track_get_next(const struct nbrec_acl *row)
268 : : {
269 : 0 : return nbrec_acl_cast(ovsdb_idl_track_get_next(&row->header_));
270 : : }
271 : :
272 : :
273 : : /* Deletes 'row' from table "ACL". 'row' may be freed, so it must not be
274 : : * accessed afterward.
275 : : *
276 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
277 : : void
278 : 0 : nbrec_acl_delete(const struct nbrec_acl *row)
279 : : {
280 : 0 : ovsdb_idl_txn_delete(&row->header_);
281 : 0 : }
282 : :
283 : : /* Inserts and returns a new row in the table "ACL" in the database
284 : : * with open transaction 'txn'.
285 : : *
286 : : * The new row is assigned a randomly generated provisional UUID.
287 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
288 : : * but the IDL will replace any uses of the provisional UUID in the
289 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
290 : : struct nbrec_acl *
291 : 20 : nbrec_acl_insert(struct ovsdb_idl_txn *txn)
292 : : {
293 : 20 : return nbrec_acl_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_ACL], NULL));
294 : : }
295 : :
296 : : bool
297 : 0 : nbrec_acl_is_updated(const struct nbrec_acl *row, enum nbrec_acl_column_id column)
298 : : {
299 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_acl_columns[column]);
300 : : }
301 : :
302 : : /* Causes the original contents of column "action" in 'row' to be
303 : : * verified as a prerequisite to completing the transaction. That is, if
304 : : * "action" in 'row' changed (or if 'row' was deleted) between the
305 : : * time that the IDL originally read its contents and the time that the
306 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
307 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
308 : : * change has already been received).
309 : : *
310 : : * The intention is that, to ensure that no transaction commits based on dirty
311 : : * reads, an application should call this function any time "action" is
312 : : * read as part of a read-modify-write operation.
313 : : *
314 : : * In some cases this function reduces to a no-op, because the current value
315 : : * of "action" is already known:
316 : : *
317 : : * - If 'row' is a row created by the current transaction (returned by
318 : : * nbrec_acl_insert()).
319 : : *
320 : : * - If "action" has already been modified (with
321 : : * nbrec_acl_set_action()) within the current transaction.
322 : : *
323 : : * Because of the latter property, always call this function *before*
324 : : * nbrec_acl_set_action() for a given read-modify-write.
325 : : *
326 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
327 : : void
328 : 0 : nbrec_acl_verify_action(const struct nbrec_acl *row)
329 : : {
330 [ # # ]: 0 : ovs_assert(inited);
331 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_ACTION]);
332 : 0 : }
333 : :
334 : : /* Causes the original contents of column "direction" in 'row' to be
335 : : * verified as a prerequisite to completing the transaction. That is, if
336 : : * "direction" in 'row' changed (or if 'row' was deleted) between the
337 : : * time that the IDL originally read its contents and the time that the
338 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
339 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
340 : : * change has already been received).
341 : : *
342 : : * The intention is that, to ensure that no transaction commits based on dirty
343 : : * reads, an application should call this function any time "direction" is
344 : : * read as part of a read-modify-write operation.
345 : : *
346 : : * In some cases this function reduces to a no-op, because the current value
347 : : * of "direction" is already known:
348 : : *
349 : : * - If 'row' is a row created by the current transaction (returned by
350 : : * nbrec_acl_insert()).
351 : : *
352 : : * - If "direction" has already been modified (with
353 : : * nbrec_acl_set_direction()) within the current transaction.
354 : : *
355 : : * Because of the latter property, always call this function *before*
356 : : * nbrec_acl_set_direction() for a given read-modify-write.
357 : : *
358 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
359 : : void
360 : 0 : nbrec_acl_verify_direction(const struct nbrec_acl *row)
361 : : {
362 [ # # ]: 0 : ovs_assert(inited);
363 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_DIRECTION]);
364 : 0 : }
365 : :
366 : : /* Causes the original contents of column "external_ids" in 'row' to be
367 : : * verified as a prerequisite to completing the transaction. That is, if
368 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
369 : : * time that the IDL originally read its contents and the time that the
370 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
371 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
372 : : * change has already been received).
373 : : *
374 : : * The intention is that, to ensure that no transaction commits based on dirty
375 : : * reads, an application should call this function any time "external_ids" is
376 : : * read as part of a read-modify-write operation.
377 : : *
378 : : * In some cases this function reduces to a no-op, because the current value
379 : : * of "external_ids" is already known:
380 : : *
381 : : * - If 'row' is a row created by the current transaction (returned by
382 : : * nbrec_acl_insert()).
383 : : *
384 : : * - If "external_ids" has already been modified (with
385 : : * nbrec_acl_set_external_ids()) within the current transaction.
386 : : *
387 : : * Because of the latter property, always call this function *before*
388 : : * nbrec_acl_set_external_ids() for a given read-modify-write.
389 : : *
390 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
391 : : void
392 : 0 : nbrec_acl_verify_external_ids(const struct nbrec_acl *row)
393 : : {
394 [ # # ]: 0 : ovs_assert(inited);
395 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_EXTERNAL_IDS]);
396 : 0 : }
397 : :
398 : : /* Causes the original contents of column "log" in 'row' to be
399 : : * verified as a prerequisite to completing the transaction. That is, if
400 : : * "log" in 'row' changed (or if 'row' was deleted) between the
401 : : * time that the IDL originally read its contents and the time that the
402 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
403 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
404 : : * change has already been received).
405 : : *
406 : : * The intention is that, to ensure that no transaction commits based on dirty
407 : : * reads, an application should call this function any time "log" is
408 : : * read as part of a read-modify-write operation.
409 : : *
410 : : * In some cases this function reduces to a no-op, because the current value
411 : : * of "log" is already known:
412 : : *
413 : : * - If 'row' is a row created by the current transaction (returned by
414 : : * nbrec_acl_insert()).
415 : : *
416 : : * - If "log" has already been modified (with
417 : : * nbrec_acl_set_log()) within the current transaction.
418 : : *
419 : : * Because of the latter property, always call this function *before*
420 : : * nbrec_acl_set_log() for a given read-modify-write.
421 : : *
422 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
423 : : void
424 : 0 : nbrec_acl_verify_log(const struct nbrec_acl *row)
425 : : {
426 [ # # ]: 0 : ovs_assert(inited);
427 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_LOG]);
428 : 0 : }
429 : :
430 : : /* Causes the original contents of column "match" in 'row' to be
431 : : * verified as a prerequisite to completing the transaction. That is, if
432 : : * "match" in 'row' changed (or if 'row' was deleted) between the
433 : : * time that the IDL originally read its contents and the time that the
434 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
435 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
436 : : * change has already been received).
437 : : *
438 : : * The intention is that, to ensure that no transaction commits based on dirty
439 : : * reads, an application should call this function any time "match" is
440 : : * read as part of a read-modify-write operation.
441 : : *
442 : : * In some cases this function reduces to a no-op, because the current value
443 : : * of "match" is already known:
444 : : *
445 : : * - If 'row' is a row created by the current transaction (returned by
446 : : * nbrec_acl_insert()).
447 : : *
448 : : * - If "match" has already been modified (with
449 : : * nbrec_acl_set_match()) within the current transaction.
450 : : *
451 : : * Because of the latter property, always call this function *before*
452 : : * nbrec_acl_set_match() for a given read-modify-write.
453 : : *
454 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
455 : : void
456 : 0 : nbrec_acl_verify_match(const struct nbrec_acl *row)
457 : : {
458 [ # # ]: 0 : ovs_assert(inited);
459 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_MATCH]);
460 : 0 : }
461 : :
462 : : /* Causes the original contents of column "priority" in 'row' to be
463 : : * verified as a prerequisite to completing the transaction. That is, if
464 : : * "priority" in 'row' changed (or if 'row' was deleted) between the
465 : : * time that the IDL originally read its contents and the time that the
466 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
467 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
468 : : * change has already been received).
469 : : *
470 : : * The intention is that, to ensure that no transaction commits based on dirty
471 : : * reads, an application should call this function any time "priority" is
472 : : * read as part of a read-modify-write operation.
473 : : *
474 : : * In some cases this function reduces to a no-op, because the current value
475 : : * of "priority" is already known:
476 : : *
477 : : * - If 'row' is a row created by the current transaction (returned by
478 : : * nbrec_acl_insert()).
479 : : *
480 : : * - If "priority" has already been modified (with
481 : : * nbrec_acl_set_priority()) within the current transaction.
482 : : *
483 : : * Because of the latter property, always call this function *before*
484 : : * nbrec_acl_set_priority() for a given read-modify-write.
485 : : *
486 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
487 : : void
488 : 0 : nbrec_acl_verify_priority(const struct nbrec_acl *row)
489 : : {
490 [ # # ]: 0 : ovs_assert(inited);
491 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_PRIORITY]);
492 : 0 : }
493 : :
494 : : /* Returns the "action" column's value from the "ACL" table in 'row'
495 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
496 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
497 : : * for a given key than implementing the same operation on the "cooked"
498 : : * form in 'row'.
499 : : *
500 : : * 'key_type' must be OVSDB_TYPE_STRING.
501 : : * (This helps to avoid silent bugs if someone changes action's
502 : : * type without updating the caller.)
503 : : *
504 : : * The caller must not modify or free the returned value.
505 : : *
506 : : * Various kinds of changes can invalidate the returned value: modifying
507 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
508 : : * If the returned value is needed for a long time, it is best to make a copy
509 : : * of it with ovsdb_datum_clone().
510 : : *
511 : : * This function is rarely useful, since it is easier to access the value
512 : : * directly through the "action" member in nbrec_acl. */
513 : : const struct ovsdb_datum *
514 : 0 : nbrec_acl_get_action(const struct nbrec_acl *row,
515 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
516 : : {
517 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
518 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_acl_col_action);
519 : : }
520 : :
521 : : /* Returns the "direction" column's value from the "ACL" table in 'row'
522 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
523 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
524 : : * for a given key than implementing the same operation on the "cooked"
525 : : * form in 'row'.
526 : : *
527 : : * 'key_type' must be OVSDB_TYPE_STRING.
528 : : * (This helps to avoid silent bugs if someone changes direction's
529 : : * type without updating the caller.)
530 : : *
531 : : * The caller must not modify or free the returned value.
532 : : *
533 : : * Various kinds of changes can invalidate the returned value: modifying
534 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
535 : : * If the returned value is needed for a long time, it is best to make a copy
536 : : * of it with ovsdb_datum_clone().
537 : : *
538 : : * This function is rarely useful, since it is easier to access the value
539 : : * directly through the "direction" member in nbrec_acl. */
540 : : const struct ovsdb_datum *
541 : 0 : nbrec_acl_get_direction(const struct nbrec_acl *row,
542 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
543 : : {
544 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
545 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_acl_col_direction);
546 : : }
547 : :
548 : : /* Returns the "external_ids" column's value from the "ACL" table in 'row'
549 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
550 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
551 : : * for a given key than implementing the same operation on the "cooked"
552 : : * form in 'row'.
553 : : *
554 : : * 'key_type' must be OVSDB_TYPE_STRING.
555 : : * 'value_type' must be OVSDB_TYPE_STRING.
556 : : * (This helps to avoid silent bugs if someone changes external_ids's
557 : : * type without updating the caller.)
558 : : *
559 : : * The caller must not modify or free the returned value.
560 : : *
561 : : * Various kinds of changes can invalidate the returned value: modifying
562 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
563 : : * If the returned value is needed for a long time, it is best to make a copy
564 : : * of it with ovsdb_datum_clone().
565 : : *
566 : : * This function is rarely useful, since it is easier to access the value
567 : : * directly through the "external_ids" member in nbrec_acl. */
568 : : const struct ovsdb_datum *
569 : 0 : nbrec_acl_get_external_ids(const struct nbrec_acl *row,
570 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
571 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
572 : : {
573 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
574 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
575 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_acl_col_external_ids);
576 : : }
577 : :
578 : : /* Returns the "log" column's value from the "ACL" table in 'row'
579 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
580 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
581 : : * for a given key than implementing the same operation on the "cooked"
582 : : * form in 'row'.
583 : : *
584 : : * 'key_type' must be OVSDB_TYPE_BOOLEAN.
585 : : * (This helps to avoid silent bugs if someone changes log's
586 : : * type without updating the caller.)
587 : : *
588 : : * The caller must not modify or free the returned value.
589 : : *
590 : : * Various kinds of changes can invalidate the returned value: modifying
591 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
592 : : * If the returned value is needed for a long time, it is best to make a copy
593 : : * of it with ovsdb_datum_clone().
594 : : *
595 : : * This function is rarely useful, since it is easier to access the value
596 : : * directly through the "log" member in nbrec_acl. */
597 : : const struct ovsdb_datum *
598 : 0 : nbrec_acl_get_log(const struct nbrec_acl *row,
599 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
600 : : {
601 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
602 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_acl_col_log);
603 : : }
604 : :
605 : : /* Returns the "match" column's value from the "ACL" table in 'row'
606 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
607 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
608 : : * for a given key than implementing the same operation on the "cooked"
609 : : * form in 'row'.
610 : : *
611 : : * 'key_type' must be OVSDB_TYPE_STRING.
612 : : * (This helps to avoid silent bugs if someone changes match's
613 : : * type without updating the caller.)
614 : : *
615 : : * The caller must not modify or free the returned value.
616 : : *
617 : : * Various kinds of changes can invalidate the returned value: modifying
618 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
619 : : * If the returned value is needed for a long time, it is best to make a copy
620 : : * of it with ovsdb_datum_clone().
621 : : *
622 : : * This function is rarely useful, since it is easier to access the value
623 : : * directly through the "match" member in nbrec_acl. */
624 : : const struct ovsdb_datum *
625 : 0 : nbrec_acl_get_match(const struct nbrec_acl *row,
626 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
627 : : {
628 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
629 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_acl_col_match);
630 : : }
631 : :
632 : : /* Returns the "priority" column's value from the "ACL" table in 'row'
633 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
634 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
635 : : * for a given key than implementing the same operation on the "cooked"
636 : : * form in 'row'.
637 : : *
638 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
639 : : * (This helps to avoid silent bugs if someone changes priority's
640 : : * type without updating the caller.)
641 : : *
642 : : * The caller must not modify or free the returned value.
643 : : *
644 : : * Various kinds of changes can invalidate the returned value: modifying
645 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
646 : : * If the returned value is needed for a long time, it is best to make a copy
647 : : * of it with ovsdb_datum_clone().
648 : : *
649 : : * This function is rarely useful, since it is easier to access the value
650 : : * directly through the "priority" member in nbrec_acl. */
651 : : const struct ovsdb_datum *
652 : 0 : nbrec_acl_get_priority(const struct nbrec_acl *row,
653 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
654 : : {
655 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
656 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_acl_col_priority);
657 : : }
658 : :
659 : : /* Sets the "action" column from the "ACL" table in 'row' to
660 : : * 'action'.
661 : : *
662 : : * Argument constraints: one of "allow-related", "drop", "allow", or "reject"
663 : : *
664 : : * The caller retains ownership of the arguments. */
665 : : void
666 : 20 : nbrec_acl_set_action(const struct nbrec_acl *row, const char *action)
667 : : {
668 : : struct ovsdb_datum datum;
669 : : union ovsdb_atom key;
670 : :
671 [ - + ]: 20 : ovs_assert(inited);
672 : 20 : datum.n = 1;
673 : 20 : datum.keys = &key;
674 : 20 : key.string = CONST_CAST(char *, action);
675 : 20 : datum.values = NULL;
676 : 20 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_ACTION], &datum);
677 : 20 : }
678 : :
679 : : /* Sets the "direction" column from the "ACL" table in 'row' to
680 : : * 'direction'.
681 : : *
682 : : * Argument constraints: either "to-lport" or "from-lport"
683 : : *
684 : : * The caller retains ownership of the arguments. */
685 : : void
686 : 20 : nbrec_acl_set_direction(const struct nbrec_acl *row, const char *direction)
687 : : {
688 : : struct ovsdb_datum datum;
689 : : union ovsdb_atom key;
690 : :
691 [ - + ]: 20 : ovs_assert(inited);
692 : 20 : datum.n = 1;
693 : 20 : datum.keys = &key;
694 : 20 : key.string = CONST_CAST(char *, direction);
695 : 20 : datum.values = NULL;
696 : 20 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_DIRECTION], &datum);
697 : 20 : }
698 : :
699 : : /* Sets the "external_ids" column's value from the "ACL" table in 'row'
700 : : * to 'external_ids'.
701 : : *
702 : : * The caller retains ownership of 'external_ids' and everything in it. */
703 : : void
704 : 0 : nbrec_acl_set_external_ids(const struct nbrec_acl *row, const struct smap *external_ids)
705 : : {
706 : : struct ovsdb_datum datum;
707 : :
708 [ # # ]: 0 : ovs_assert(inited);
709 [ # # ]: 0 : if (external_ids) {
710 : : struct smap_node *node;
711 : : size_t i;
712 : :
713 : 0 : datum.n = smap_count(external_ids);
714 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
715 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
716 : :
717 : 0 : i = 0;
718 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
719 : 0 : datum.keys[i].string = xstrdup(node->key);
720 : 0 : datum.values[i].string = xstrdup(node->value);
721 : 0 : i++;
722 : : }
723 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
724 : : } else {
725 : 0 : ovsdb_datum_init_empty(&datum);
726 : : }
727 : 0 : ovsdb_idl_txn_write(&row->header_,
728 : : &nbrec_acl_columns[NBREC_ACL_COL_EXTERNAL_IDS],
729 : : &datum);
730 : 0 : }
731 : :
732 : :
733 : : /* Sets the "log" column from the "ACL" table in 'row' to
734 : : * 'log'.
735 : : *
736 : : * The caller retains ownership of the arguments. */
737 : : void
738 : 2 : nbrec_acl_set_log(const struct nbrec_acl *row, bool log)
739 : : {
740 : : struct ovsdb_datum datum;
741 : : union ovsdb_atom key;
742 : :
743 [ - + ]: 2 : ovs_assert(inited);
744 : 2 : datum.n = 1;
745 : 2 : datum.keys = &key;
746 : 2 : key.boolean = log;
747 : 2 : datum.values = NULL;
748 : 2 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_LOG], &datum);
749 : 2 : }
750 : :
751 : : /* Sets the "match" column from the "ACL" table in 'row' to
752 : : * 'match'.
753 : : *
754 : : * The caller retains ownership of the arguments. */
755 : : void
756 : 20 : nbrec_acl_set_match(const struct nbrec_acl *row, const char *match)
757 : : {
758 : : struct ovsdb_datum datum;
759 : : union ovsdb_atom key;
760 : :
761 [ - + ]: 20 : ovs_assert(inited);
762 : 20 : datum.n = 1;
763 : 20 : datum.keys = &key;
764 : 20 : key.string = CONST_CAST(char *, match);
765 : 20 : datum.values = NULL;
766 : 20 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_MATCH], &datum);
767 : 20 : }
768 : :
769 : : /* Sets the "priority" column from the "ACL" table in 'row' to
770 : : * 'priority'.
771 : : *
772 : : * Argument constraints: in range 0 to 32,767
773 : : *
774 : : * The caller retains ownership of the arguments. */
775 : : void
776 : 20 : nbrec_acl_set_priority(const struct nbrec_acl *row, int64_t priority)
777 : : {
778 : : struct ovsdb_datum datum;
779 : : union ovsdb_atom key;
780 : :
781 [ - + ]: 20 : ovs_assert(inited);
782 : 20 : datum.n = 1;
783 : 20 : datum.keys = &key;
784 : 20 : key.integer = priority;
785 : 20 : datum.values = NULL;
786 : 20 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_acl_columns[NBREC_ACL_COL_PRIORITY], &datum);
787 : 20 : }
788 : :
789 : : /* Sets an element of the "external_ids" map column from the "ACL" table in 'row'
790 : : * to 'new_value' given the key value 'new_key'.
791 : : *
792 : : */
793 : : void
794 : 0 : nbrec_acl_update_external_ids_setkey(const struct nbrec_acl *row, const char *new_key, const char *new_value)
795 : : {
796 : : struct ovsdb_datum *datum;
797 : :
798 [ # # ]: 0 : ovs_assert(inited);
799 : :
800 : 0 : datum = xmalloc(sizeof *datum);
801 : 0 : datum->n = 1;
802 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
803 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
804 : :
805 : 0 : datum->keys[0].string = xstrdup(new_key);
806 : 0 : datum->values[0].string = xstrdup(new_value);
807 : :
808 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
809 : : &nbrec_acl_columns[NBREC_ACL_COL_EXTERNAL_IDS],
810 : : datum);
811 : 0 : }
812 : :
813 : : /* Deletes an element of the "external_ids" map column from the "ACL" table in 'row'
814 : : * given the key value 'delete_key'.
815 : : *
816 : : */
817 : : void
818 : 0 : nbrec_acl_update_external_ids_delkey(const struct nbrec_acl *row, const char *delete_key)
819 : : {
820 : : struct ovsdb_datum *datum;
821 : :
822 [ # # ]: 0 : ovs_assert(inited);
823 : :
824 : 0 : datum = xmalloc(sizeof *datum);
825 : 0 : datum->n = 1;
826 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
827 : 0 : datum->values = NULL;
828 : :
829 : 0 : datum->keys[0].string = xstrdup(delete_key);
830 : :
831 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
832 : : &nbrec_acl_columns[NBREC_ACL_COL_EXTERNAL_IDS],
833 : : datum);
834 : 0 : }
835 : :
836 : : /* Sets the "action" column from the "ACL" table in 'row' to
837 : : * 'action'.
838 : : *
839 : : * Argument constraints: one of "allow-related", "drop", "allow", or "reject"
840 : : *
841 : : * The caller retains ownership of the arguments. */
842 : : void
843 : 0 : nbrec_acl_add_clause_action(struct ovsdb_idl *idl, enum ovsdb_function function, const char *action)
844 : : {
845 : : struct ovsdb_datum datum;
846 : : union ovsdb_atom key;
847 : :
848 [ # # ]: 0 : ovs_assert(inited);
849 : 0 : datum.n = 1;
850 : 0 : datum.keys = &key;
851 : 0 : key.string = CONST_CAST(char *, action);
852 : 0 : datum.values = NULL;
853 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
854 : : function,
855 : : &nbrec_acl_columns[NBREC_ACL_COL_ACTION],
856 : : &datum);
857 : 0 : }
858 : :
859 : : /* Sets the "direction" column from the "ACL" table in 'row' to
860 : : * 'direction'.
861 : : *
862 : : * Argument constraints: either "to-lport" or "from-lport"
863 : : *
864 : : * The caller retains ownership of the arguments. */
865 : : void
866 : 0 : nbrec_acl_add_clause_direction(struct ovsdb_idl *idl, enum ovsdb_function function, const char *direction)
867 : : {
868 : : struct ovsdb_datum datum;
869 : : union ovsdb_atom key;
870 : :
871 [ # # ]: 0 : ovs_assert(inited);
872 : 0 : datum.n = 1;
873 : 0 : datum.keys = &key;
874 : 0 : key.string = CONST_CAST(char *, direction);
875 : 0 : datum.values = NULL;
876 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
877 : : function,
878 : : &nbrec_acl_columns[NBREC_ACL_COL_DIRECTION],
879 : : &datum);
880 : 0 : }
881 : :
882 : : /* Sets the "external_ids" column's value from the "ACL" table in 'row'
883 : : * to 'external_ids'.
884 : : *
885 : : * The caller retains ownership of 'external_ids' and everything in it. */
886 : : void
887 : 0 : nbrec_acl_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
888 : : {
889 : : struct ovsdb_datum datum;
890 : :
891 [ # # ]: 0 : ovs_assert(inited);
892 [ # # ]: 0 : if (external_ids) {
893 : : struct smap_node *node;
894 : : size_t i;
895 : :
896 : 0 : datum.n = smap_count(external_ids);
897 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
898 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
899 : :
900 : 0 : i = 0;
901 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
902 : 0 : datum.keys[i].string = xstrdup(node->key);
903 : 0 : datum.values[i].string = xstrdup(node->value);
904 : 0 : i++;
905 : : }
906 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
907 : : } else {
908 : 0 : ovsdb_datum_init_empty(&datum);
909 : : }
910 : :
911 : 0 : ovsdb_idl_condition_add_clause(idl,
912 : : &nbrec_table_classes[NBREC_TABLE_ACL],
913 : : function,
914 : : &nbrec_acl_columns[NBREC_ACL_COL_EXTERNAL_IDS],
915 : : &datum);
916 : :
917 : 0 : ovsdb_datum_destroy(&datum, &nbrec_acl_col_external_ids.type);
918 : 0 : }
919 : :
920 : :
921 : : /* Sets the "log" column from the "ACL" table in 'row' to
922 : : * 'log'.
923 : : *
924 : : * The caller retains ownership of the arguments. */
925 : : void
926 : 0 : nbrec_acl_add_clause_log(struct ovsdb_idl *idl, enum ovsdb_function function, bool log)
927 : : {
928 : : struct ovsdb_datum datum;
929 : : union ovsdb_atom key;
930 : :
931 [ # # ]: 0 : ovs_assert(inited);
932 : 0 : datum.n = 1;
933 : 0 : datum.keys = &key;
934 : 0 : key.boolean = log;
935 : 0 : datum.values = NULL;
936 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
937 : : function,
938 : : &nbrec_acl_columns[NBREC_ACL_COL_LOG],
939 : : &datum);
940 : 0 : }
941 : :
942 : : /* Sets the "match" column from the "ACL" table in 'row' to
943 : : * 'match'.
944 : : *
945 : : * The caller retains ownership of the arguments. */
946 : : void
947 : 0 : nbrec_acl_add_clause_match(struct ovsdb_idl *idl, enum ovsdb_function function, const char *match)
948 : : {
949 : : struct ovsdb_datum datum;
950 : : union ovsdb_atom key;
951 : :
952 [ # # ]: 0 : ovs_assert(inited);
953 : 0 : datum.n = 1;
954 : 0 : datum.keys = &key;
955 : 0 : key.string = CONST_CAST(char *, match);
956 : 0 : datum.values = NULL;
957 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
958 : : function,
959 : : &nbrec_acl_columns[NBREC_ACL_COL_MATCH],
960 : : &datum);
961 : 0 : }
962 : :
963 : : /* Sets the "priority" column from the "ACL" table in 'row' to
964 : : * 'priority'.
965 : : *
966 : : * Argument constraints: in range 0 to 32,767
967 : : *
968 : : * The caller retains ownership of the arguments. */
969 : : void
970 : 0 : nbrec_acl_add_clause_priority(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t priority)
971 : : {
972 : : struct ovsdb_datum datum;
973 : : union ovsdb_atom key;
974 : :
975 [ # # ]: 0 : ovs_assert(inited);
976 : 0 : datum.n = 1;
977 : 0 : datum.keys = &key;
978 : 0 : key.integer = priority;
979 : 0 : datum.values = NULL;
980 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
981 : : function,
982 : : &nbrec_acl_columns[NBREC_ACL_COL_PRIORITY],
983 : : &datum);
984 : 0 : }
985 : : void
986 : 0 : nbrec_acl_add_clause_false(struct ovsdb_idl *idl)
987 : : {
988 : : struct ovsdb_datum datum;
989 : :
990 : 0 : ovsdb_datum_init_empty(&datum);
991 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL], OVSDB_F_FALSE, NULL, &datum);
992 : 0 : }
993 : : void
994 : 0 : nbrec_acl_add_clause_true(struct ovsdb_idl *idl)
995 : : {
996 : : struct ovsdb_datum datum;
997 : :
998 : 0 : ovsdb_datum_init_empty(&datum);
999 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL], OVSDB_F_TRUE, NULL, &datum);
1000 : 0 : }
1001 : :
1002 : : /* Sets the "action" column from the "ACL" table in 'row' to
1003 : : * 'action'.
1004 : : *
1005 : : * Argument constraints: one of "allow-related", "drop", "allow", or "reject"
1006 : : *
1007 : : * The caller retains ownership of the arguments. */
1008 : : void
1009 : 0 : nbrec_acl_remove_clause_action(struct ovsdb_idl *idl, enum ovsdb_function function, const char *action)
1010 : : {
1011 : : struct ovsdb_datum datum;
1012 : : union ovsdb_atom key;
1013 : :
1014 [ # # ]: 0 : ovs_assert(inited);
1015 : 0 : datum.n = 1;
1016 : 0 : datum.keys = &key;
1017 : 0 : key.string = CONST_CAST(char *, action);
1018 : 0 : datum.values = NULL;
1019 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
1020 : : function,
1021 : : &nbrec_acl_columns[NBREC_ACL_COL_ACTION],
1022 : : &datum);
1023 : 0 : }
1024 : :
1025 : : /* Sets the "direction" column from the "ACL" table in 'row' to
1026 : : * 'direction'.
1027 : : *
1028 : : * Argument constraints: either "to-lport" or "from-lport"
1029 : : *
1030 : : * The caller retains ownership of the arguments. */
1031 : : void
1032 : 0 : nbrec_acl_remove_clause_direction(struct ovsdb_idl *idl, enum ovsdb_function function, const char *direction)
1033 : : {
1034 : : struct ovsdb_datum datum;
1035 : : union ovsdb_atom key;
1036 : :
1037 [ # # ]: 0 : ovs_assert(inited);
1038 : 0 : datum.n = 1;
1039 : 0 : datum.keys = &key;
1040 : 0 : key.string = CONST_CAST(char *, direction);
1041 : 0 : datum.values = NULL;
1042 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
1043 : : function,
1044 : : &nbrec_acl_columns[NBREC_ACL_COL_DIRECTION],
1045 : : &datum);
1046 : 0 : }
1047 : :
1048 : : /* Sets the "external_ids" column's value from the "ACL" table in 'row'
1049 : : * to 'external_ids'.
1050 : : *
1051 : : * The caller retains ownership of 'external_ids' and everything in it. */
1052 : : void
1053 : 0 : nbrec_acl_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
1054 : : {
1055 : : struct ovsdb_datum datum;
1056 : :
1057 [ # # ]: 0 : ovs_assert(inited);
1058 [ # # ]: 0 : if (external_ids) {
1059 : : struct smap_node *node;
1060 : : size_t i;
1061 : :
1062 : 0 : datum.n = smap_count(external_ids);
1063 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1064 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
1065 : :
1066 : 0 : i = 0;
1067 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
1068 : 0 : datum.keys[i].string = xstrdup(node->key);
1069 : 0 : datum.values[i].string = xstrdup(node->value);
1070 : 0 : i++;
1071 : : }
1072 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1073 : : } else {
1074 : 0 : ovsdb_datum_init_empty(&datum);
1075 : : }
1076 : :
1077 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
1078 : : function,
1079 : : &nbrec_acl_columns[NBREC_ACL_COL_EXTERNAL_IDS],
1080 : : &datum);
1081 : :
1082 : 0 : ovsdb_datum_destroy(&datum, &nbrec_acl_col_external_ids.type);
1083 : 0 : }
1084 : :
1085 : :
1086 : : /* Sets the "log" column from the "ACL" table in 'row' to
1087 : : * 'log'.
1088 : : *
1089 : : * The caller retains ownership of the arguments. */
1090 : : void
1091 : 0 : nbrec_acl_remove_clause_log(struct ovsdb_idl *idl, enum ovsdb_function function, bool log)
1092 : : {
1093 : : struct ovsdb_datum datum;
1094 : : union ovsdb_atom key;
1095 : :
1096 [ # # ]: 0 : ovs_assert(inited);
1097 : 0 : datum.n = 1;
1098 : 0 : datum.keys = &key;
1099 : 0 : key.boolean = log;
1100 : 0 : datum.values = NULL;
1101 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
1102 : : function,
1103 : : &nbrec_acl_columns[NBREC_ACL_COL_LOG],
1104 : : &datum);
1105 : 0 : }
1106 : :
1107 : : /* Sets the "match" column from the "ACL" table in 'row' to
1108 : : * 'match'.
1109 : : *
1110 : : * The caller retains ownership of the arguments. */
1111 : : void
1112 : 0 : nbrec_acl_remove_clause_match(struct ovsdb_idl *idl, enum ovsdb_function function, const char *match)
1113 : : {
1114 : : struct ovsdb_datum datum;
1115 : : union ovsdb_atom key;
1116 : :
1117 [ # # ]: 0 : ovs_assert(inited);
1118 : 0 : datum.n = 1;
1119 : 0 : datum.keys = &key;
1120 : 0 : key.string = CONST_CAST(char *, match);
1121 : 0 : datum.values = NULL;
1122 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
1123 : : function,
1124 : : &nbrec_acl_columns[NBREC_ACL_COL_MATCH],
1125 : : &datum);
1126 : 0 : }
1127 : :
1128 : : /* Sets the "priority" column from the "ACL" table in 'row' to
1129 : : * 'priority'.
1130 : : *
1131 : : * Argument constraints: in range 0 to 32,767
1132 : : *
1133 : : * The caller retains ownership of the arguments. */
1134 : : void
1135 : 0 : nbrec_acl_remove_clause_priority(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t priority)
1136 : : {
1137 : : struct ovsdb_datum datum;
1138 : : union ovsdb_atom key;
1139 : :
1140 [ # # ]: 0 : ovs_assert(inited);
1141 : 0 : datum.n = 1;
1142 : 0 : datum.keys = &key;
1143 : 0 : key.integer = priority;
1144 : 0 : datum.values = NULL;
1145 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL],
1146 : : function,
1147 : : &nbrec_acl_columns[NBREC_ACL_COL_PRIORITY],
1148 : : &datum);
1149 : 0 : }
1150 : : void
1151 : 0 : nbrec_acl_remove_clause_false(struct ovsdb_idl *idl)
1152 : : {
1153 : : struct ovsdb_datum datum;
1154 : :
1155 : 0 : ovsdb_datum_init_empty(&datum);
1156 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL], OVSDB_F_FALSE, NULL, &datum);
1157 : 0 : }
1158 : : void
1159 : 0 : nbrec_acl_remove_clause_true(struct ovsdb_idl *idl)
1160 : : {
1161 : : struct ovsdb_datum datum;
1162 : :
1163 : 0 : ovsdb_datum_init_empty(&datum);
1164 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ACL], OVSDB_F_TRUE, NULL, &datum);
1165 : 0 : }
1166 : :
1167 : : struct ovsdb_idl_column nbrec_acl_columns[NBREC_ACL_N_COLUMNS];
1168 : :
1169 : : static void
1170 : 932 : nbrec_acl_columns_init(void)
1171 : : {
1172 : : struct ovsdb_idl_column *c;
1173 : :
1174 : : /* Initialize nbrec_acl_col_action. */
1175 : 932 : c = &nbrec_acl_col_action;
1176 : 932 : c->name = "action";
1177 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1178 : 932 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
1179 : 932 : c->type.key.enum_->n = 4;
1180 : 932 : c->type.key.enum_->keys = xmalloc(4 * sizeof *c->type.key.enum_->keys);
1181 : 932 : c->type.key.enum_->keys[0].string = xstrdup("allow");
1182 : 932 : c->type.key.enum_->keys[1].string = xstrdup("allow-related");
1183 : 932 : c->type.key.enum_->keys[2].string = xstrdup("drop");
1184 : 932 : c->type.key.enum_->keys[3].string = xstrdup("reject");
1185 : 932 : c->type.key.enum_->values = NULL;
1186 : 932 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
1187 : 932 : c->type.key.u.string.minLen = 0;
1188 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1189 : 932 : c->type.n_min = 1;
1190 : 932 : c->type.n_max = 1;
1191 : 932 : c->mutable = true;
1192 : 932 : c->parse = nbrec_acl_parse_action;
1193 : 932 : c->unparse = nbrec_acl_unparse_action;
1194 : :
1195 : : /* Initialize nbrec_acl_col_direction. */
1196 : 932 : c = &nbrec_acl_col_direction;
1197 : 932 : c->name = "direction";
1198 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1199 : 932 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
1200 : 932 : c->type.key.enum_->n = 2;
1201 : 932 : c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
1202 : 932 : c->type.key.enum_->keys[0].string = xstrdup("from-lport");
1203 : 932 : c->type.key.enum_->keys[1].string = xstrdup("to-lport");
1204 : 932 : c->type.key.enum_->values = NULL;
1205 : 932 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
1206 : 932 : c->type.key.u.string.minLen = 0;
1207 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1208 : 932 : c->type.n_min = 1;
1209 : 932 : c->type.n_max = 1;
1210 : 932 : c->mutable = true;
1211 : 932 : c->parse = nbrec_acl_parse_direction;
1212 : 932 : c->unparse = nbrec_acl_unparse_direction;
1213 : :
1214 : : /* Initialize nbrec_acl_col_external_ids. */
1215 : 932 : c = &nbrec_acl_col_external_ids;
1216 : 932 : c->name = "external_ids";
1217 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1218 : 932 : c->type.key.u.string.minLen = 0;
1219 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1220 : 932 : c->type.value.u.string.minLen = 0;
1221 : 932 : c->type.n_min = 0;
1222 : 932 : c->type.n_max = UINT_MAX;
1223 : 932 : c->mutable = true;
1224 : 932 : c->parse = nbrec_acl_parse_external_ids;
1225 : 932 : c->unparse = nbrec_acl_unparse_external_ids;
1226 : :
1227 : : /* Initialize nbrec_acl_col_log. */
1228 : 932 : c = &nbrec_acl_col_log;
1229 : 932 : c->name = "log";
1230 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
1231 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1232 : 932 : c->type.n_min = 1;
1233 : 932 : c->type.n_max = 1;
1234 : 932 : c->mutable = true;
1235 : 932 : c->parse = nbrec_acl_parse_log;
1236 : 932 : c->unparse = nbrec_acl_unparse_log;
1237 : :
1238 : : /* Initialize nbrec_acl_col_match. */
1239 : 932 : c = &nbrec_acl_col_match;
1240 : 932 : c->name = "match";
1241 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1242 : 932 : c->type.key.u.string.minLen = 0;
1243 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1244 : 932 : c->type.n_min = 1;
1245 : 932 : c->type.n_max = 1;
1246 : 932 : c->mutable = true;
1247 : 932 : c->parse = nbrec_acl_parse_match;
1248 : 932 : c->unparse = nbrec_acl_unparse_match;
1249 : :
1250 : : /* Initialize nbrec_acl_col_priority. */
1251 : 932 : c = &nbrec_acl_col_priority;
1252 : 932 : c->name = "priority";
1253 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
1254 : 932 : c->type.key.u.integer.min = INT64_C(0);
1255 : 932 : c->type.key.u.integer.max = INT64_C(32767);
1256 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1257 : 932 : c->type.n_min = 1;
1258 : 932 : c->type.n_max = 1;
1259 : 932 : c->mutable = true;
1260 : 932 : c->parse = nbrec_acl_parse_priority;
1261 : 932 : c->unparse = nbrec_acl_unparse_priority;
1262 : 932 : }
1263 : :
1264 : : /* Address_Set table. */
1265 : :
1266 : : static void
1267 : 18 : nbrec_address_set_parse_addresses(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1268 : : {
1269 : 18 : struct nbrec_address_set *row = nbrec_address_set_cast(row_);
1270 : : size_t i;
1271 : :
1272 [ - + ]: 18 : ovs_assert(inited);
1273 : 18 : row->addresses = NULL;
1274 : 18 : row->n_addresses = 0;
1275 [ + + ]: 50 : for (i = 0; i < datum->n; i++) {
1276 [ + + ]: 32 : if (!row->n_addresses) {
1277 : 18 : row->addresses = xmalloc(datum->n * sizeof *row->addresses);
1278 : : }
1279 : 32 : row->addresses[row->n_addresses] = datum->keys[i].string;
1280 : 32 : row->n_addresses++;
1281 : : }
1282 : 18 : }
1283 : :
1284 : : static void
1285 : 14 : nbrec_address_set_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1286 : : {
1287 : 14 : struct nbrec_address_set *row = nbrec_address_set_cast(row_);
1288 : : size_t i;
1289 : :
1290 [ - + ]: 14 : ovs_assert(inited);
1291 : 14 : smap_init(&row->external_ids);
1292 [ - + ]: 14 : for (i = 0; i < datum->n; i++) {
1293 : 0 : smap_add(&row->external_ids,
1294 : 0 : datum->keys[i].string,
1295 : 0 : datum->values[i].string);
1296 : : }
1297 : 14 : }
1298 : :
1299 : : static void
1300 : 18 : nbrec_address_set_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1301 : : {
1302 : 18 : struct nbrec_address_set *row = nbrec_address_set_cast(row_);
1303 : :
1304 [ - + ]: 18 : ovs_assert(inited);
1305 [ + - ]: 18 : if (datum->n >= 1) {
1306 : 18 : row->name = datum->keys[0].string;
1307 : : } else {
1308 : 0 : row->name = "";
1309 : : }
1310 : 18 : }
1311 : :
1312 : : static void
1313 : 21 : nbrec_address_set_unparse_addresses(struct ovsdb_idl_row *row_)
1314 : : {
1315 : 21 : struct nbrec_address_set *row = nbrec_address_set_cast(row_);
1316 : :
1317 [ - + ]: 21 : ovs_assert(inited);
1318 : 21 : free(row->addresses);
1319 : 21 : }
1320 : :
1321 : : static void
1322 : 17 : nbrec_address_set_unparse_external_ids(struct ovsdb_idl_row *row_)
1323 : : {
1324 : 17 : struct nbrec_address_set *row = nbrec_address_set_cast(row_);
1325 : :
1326 [ - + ]: 17 : ovs_assert(inited);
1327 : 17 : smap_destroy(&row->external_ids);
1328 : 17 : }
1329 : :
1330 : : static void
1331 : 21 : nbrec_address_set_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
1332 : : {
1333 : : /* Nothing to do. */
1334 : 21 : }
1335 : :
1336 : : static void
1337 : 14 : nbrec_address_set_init__(struct ovsdb_idl_row *row)
1338 : : {
1339 : 14 : nbrec_address_set_init(nbrec_address_set_cast(row));
1340 : 14 : }
1341 : :
1342 : : /* Clears the contents of 'row' in table "Address_Set". */
1343 : : void
1344 : 14 : nbrec_address_set_init(struct nbrec_address_set *row)
1345 : : {
1346 : 14 : memset(row, 0, sizeof *row);
1347 : 14 : smap_init(&row->external_ids);
1348 : 14 : }
1349 : :
1350 : : /* Searches table "Address_Set" in 'idl' for a row with UUID 'uuid'. Returns
1351 : : * a pointer to the row if there is one, otherwise a null pointer. */
1352 : : const struct nbrec_address_set *
1353 : 0 : nbrec_address_set_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
1354 : : {
1355 : 0 : return nbrec_address_set_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET], uuid));
1356 : : }
1357 : :
1358 : : /* Returns a row in table "Address_Set" in 'idl', or a null pointer if that
1359 : : * table is empty.
1360 : : *
1361 : : * Database tables are internally maintained as hash tables, so adding or
1362 : : * removing rows while traversing the same table can cause some rows to be
1363 : : * visited twice or not at apply. */
1364 : : const struct nbrec_address_set *
1365 : 2244 : nbrec_address_set_first(const struct ovsdb_idl *idl)
1366 : : {
1367 : 2244 : return nbrec_address_set_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET]));
1368 : : }
1369 : :
1370 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
1371 : : * is the last row in its table. */
1372 : : const struct nbrec_address_set *
1373 : 24 : nbrec_address_set_next(const struct nbrec_address_set *row)
1374 : : {
1375 : 24 : return nbrec_address_set_cast(ovsdb_idl_next_row(&row->header_));
1376 : : }
1377 : :
1378 : 0 : unsigned int nbrec_address_set_get_seqno(const struct ovsdb_idl *idl)
1379 : : {
1380 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET]);
1381 : : }
1382 : :
1383 : 0 : unsigned int nbrec_address_set_row_get_seqno(const struct nbrec_address_set *row, enum ovsdb_idl_change change)
1384 : : {
1385 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
1386 : : }
1387 : :
1388 : : const struct nbrec_address_set *
1389 : 0 : nbrec_address_set_track_get_first(const struct ovsdb_idl *idl)
1390 : : {
1391 : 0 : return nbrec_address_set_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET]));
1392 : : }
1393 : :
1394 : : const struct nbrec_address_set
1395 : 0 : *nbrec_address_set_track_get_next(const struct nbrec_address_set *row)
1396 : : {
1397 : 0 : return nbrec_address_set_cast(ovsdb_idl_track_get_next(&row->header_));
1398 : : }
1399 : :
1400 : :
1401 : : /* Deletes 'row' from table "Address_Set". 'row' may be freed, so it must not be
1402 : : * accessed afterward.
1403 : : *
1404 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1405 : : void
1406 : 0 : nbrec_address_set_delete(const struct nbrec_address_set *row)
1407 : : {
1408 : 0 : ovsdb_idl_txn_delete(&row->header_);
1409 : 0 : }
1410 : :
1411 : : /* Inserts and returns a new row in the table "Address_Set" in the database
1412 : : * with open transaction 'txn'.
1413 : : *
1414 : : * The new row is assigned a randomly generated provisional UUID.
1415 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
1416 : : * but the IDL will replace any uses of the provisional UUID in the
1417 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
1418 : : struct nbrec_address_set *
1419 : 0 : nbrec_address_set_insert(struct ovsdb_idl_txn *txn)
1420 : : {
1421 : 0 : return nbrec_address_set_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET], NULL));
1422 : : }
1423 : :
1424 : : bool
1425 : 0 : nbrec_address_set_is_updated(const struct nbrec_address_set *row, enum nbrec_address_set_column_id column)
1426 : : {
1427 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_address_set_columns[column]);
1428 : : }
1429 : :
1430 : : /* Causes the original contents of column "addresses" in 'row' to be
1431 : : * verified as a prerequisite to completing the transaction. That is, if
1432 : : * "addresses" in 'row' changed (or if 'row' was deleted) between the
1433 : : * time that the IDL originally read its contents and the time that the
1434 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
1435 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
1436 : : * change has already been received).
1437 : : *
1438 : : * The intention is that, to ensure that no transaction commits based on dirty
1439 : : * reads, an application should call this function any time "addresses" is
1440 : : * read as part of a read-modify-write operation.
1441 : : *
1442 : : * In some cases this function reduces to a no-op, because the current value
1443 : : * of "addresses" is already known:
1444 : : *
1445 : : * - If 'row' is a row created by the current transaction (returned by
1446 : : * nbrec_address_set_insert()).
1447 : : *
1448 : : * - If "addresses" has already been modified (with
1449 : : * nbrec_address_set_set_addresses()) within the current transaction.
1450 : : *
1451 : : * Because of the latter property, always call this function *before*
1452 : : * nbrec_address_set_set_addresses() for a given read-modify-write.
1453 : : *
1454 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1455 : : void
1456 : 0 : nbrec_address_set_verify_addresses(const struct nbrec_address_set *row)
1457 : : {
1458 [ # # ]: 0 : ovs_assert(inited);
1459 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_ADDRESSES]);
1460 : 0 : }
1461 : :
1462 : : /* Causes the original contents of column "external_ids" in 'row' to be
1463 : : * verified as a prerequisite to completing the transaction. That is, if
1464 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
1465 : : * time that the IDL originally read its contents and the time that the
1466 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
1467 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
1468 : : * change has already been received).
1469 : : *
1470 : : * The intention is that, to ensure that no transaction commits based on dirty
1471 : : * reads, an application should call this function any time "external_ids" is
1472 : : * read as part of a read-modify-write operation.
1473 : : *
1474 : : * In some cases this function reduces to a no-op, because the current value
1475 : : * of "external_ids" is already known:
1476 : : *
1477 : : * - If 'row' is a row created by the current transaction (returned by
1478 : : * nbrec_address_set_insert()).
1479 : : *
1480 : : * - If "external_ids" has already been modified (with
1481 : : * nbrec_address_set_set_external_ids()) within the current transaction.
1482 : : *
1483 : : * Because of the latter property, always call this function *before*
1484 : : * nbrec_address_set_set_external_ids() for a given read-modify-write.
1485 : : *
1486 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1487 : : void
1488 : 0 : nbrec_address_set_verify_external_ids(const struct nbrec_address_set *row)
1489 : : {
1490 [ # # ]: 0 : ovs_assert(inited);
1491 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_EXTERNAL_IDS]);
1492 : 0 : }
1493 : :
1494 : : /* Causes the original contents of column "name" in 'row' to be
1495 : : * verified as a prerequisite to completing the transaction. That is, if
1496 : : * "name" in 'row' changed (or if 'row' was deleted) between the
1497 : : * time that the IDL originally read its contents and the time that the
1498 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
1499 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
1500 : : * change has already been received).
1501 : : *
1502 : : * The intention is that, to ensure that no transaction commits based on dirty
1503 : : * reads, an application should call this function any time "name" is
1504 : : * read as part of a read-modify-write operation.
1505 : : *
1506 : : * In some cases this function reduces to a no-op, because the current value
1507 : : * of "name" is already known:
1508 : : *
1509 : : * - If 'row' is a row created by the current transaction (returned by
1510 : : * nbrec_address_set_insert()).
1511 : : *
1512 : : * - If "name" has already been modified (with
1513 : : * nbrec_address_set_set_name()) within the current transaction.
1514 : : *
1515 : : * Because of the latter property, always call this function *before*
1516 : : * nbrec_address_set_set_name() for a given read-modify-write.
1517 : : *
1518 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1519 : : void
1520 : 0 : nbrec_address_set_verify_name(const struct nbrec_address_set *row)
1521 : : {
1522 [ # # ]: 0 : ovs_assert(inited);
1523 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_NAME]);
1524 : 0 : }
1525 : :
1526 : : /* Returns the "addresses" column's value from the "Address_Set" table in 'row'
1527 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1528 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1529 : : * for a given key than implementing the same operation on the "cooked"
1530 : : * form in 'row'.
1531 : : *
1532 : : * 'key_type' must be OVSDB_TYPE_STRING.
1533 : : * (This helps to avoid silent bugs if someone changes addresses's
1534 : : * type without updating the caller.)
1535 : : *
1536 : : * The caller must not modify or free the returned value.
1537 : : *
1538 : : * Various kinds of changes can invalidate the returned value: modifying
1539 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1540 : : * If the returned value is needed for a long time, it is best to make a copy
1541 : : * of it with ovsdb_datum_clone().
1542 : : *
1543 : : * This function is rarely useful, since it is easier to access the value
1544 : : * directly through the "addresses" member in nbrec_address_set. */
1545 : : const struct ovsdb_datum *
1546 : 0 : nbrec_address_set_get_addresses(const struct nbrec_address_set *row,
1547 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
1548 : : {
1549 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
1550 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_address_set_col_addresses);
1551 : : }
1552 : :
1553 : : /* Returns the "external_ids" column's value from the "Address_Set" table in 'row'
1554 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1555 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1556 : : * for a given key than implementing the same operation on the "cooked"
1557 : : * form in 'row'.
1558 : : *
1559 : : * 'key_type' must be OVSDB_TYPE_STRING.
1560 : : * 'value_type' must be OVSDB_TYPE_STRING.
1561 : : * (This helps to avoid silent bugs if someone changes external_ids's
1562 : : * type without updating the caller.)
1563 : : *
1564 : : * The caller must not modify or free the returned value.
1565 : : *
1566 : : * Various kinds of changes can invalidate the returned value: modifying
1567 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1568 : : * If the returned value is needed for a long time, it is best to make a copy
1569 : : * of it with ovsdb_datum_clone().
1570 : : *
1571 : : * This function is rarely useful, since it is easier to access the value
1572 : : * directly through the "external_ids" member in nbrec_address_set. */
1573 : : const struct ovsdb_datum *
1574 : 0 : nbrec_address_set_get_external_ids(const struct nbrec_address_set *row,
1575 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
1576 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
1577 : : {
1578 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
1579 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
1580 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_address_set_col_external_ids);
1581 : : }
1582 : :
1583 : : /* Returns the "name" column's value from the "Address_Set" table in 'row'
1584 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1585 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1586 : : * for a given key than implementing the same operation on the "cooked"
1587 : : * form in 'row'.
1588 : : *
1589 : : * 'key_type' must be OVSDB_TYPE_STRING.
1590 : : * (This helps to avoid silent bugs if someone changes name's
1591 : : * type without updating the caller.)
1592 : : *
1593 : : * The caller must not modify or free the returned value.
1594 : : *
1595 : : * Various kinds of changes can invalidate the returned value: modifying
1596 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1597 : : * If the returned value is needed for a long time, it is best to make a copy
1598 : : * of it with ovsdb_datum_clone().
1599 : : *
1600 : : * This function is rarely useful, since it is easier to access the value
1601 : : * directly through the "name" member in nbrec_address_set. */
1602 : : const struct ovsdb_datum *
1603 : 0 : nbrec_address_set_get_name(const struct nbrec_address_set *row,
1604 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
1605 : : {
1606 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
1607 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_address_set_col_name);
1608 : : }
1609 : :
1610 : : /* Sets the "addresses" column from the "Address_Set" table in 'row' to
1611 : : * the 'addresses' set with 'n_addresses' entries.
1612 : : *
1613 : : * The caller retains ownership of the arguments. */
1614 : : void
1615 : 0 : nbrec_address_set_set_addresses(const struct nbrec_address_set *row, const char **addresses, size_t n_addresses)
1616 : : {
1617 : : struct ovsdb_datum datum;
1618 : : size_t i;
1619 : :
1620 [ # # ]: 0 : ovs_assert(inited);
1621 : 0 : datum.n = n_addresses;
1622 [ # # ]: 0 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
1623 : 0 : datum.values = NULL;
1624 [ # # ]: 0 : for (i = 0; i < n_addresses; i++) {
1625 : 0 : datum.keys[i].string = xstrdup(addresses[i]);
1626 : : }
1627 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1628 : 0 : ovsdb_idl_txn_write(&row->header_, &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_ADDRESSES], &datum);
1629 : 0 : }
1630 : :
1631 : : /* Sets the "external_ids" column's value from the "Address_Set" table in 'row'
1632 : : * to 'external_ids'.
1633 : : *
1634 : : * The caller retains ownership of 'external_ids' and everything in it. */
1635 : : void
1636 : 0 : nbrec_address_set_set_external_ids(const struct nbrec_address_set *row, const struct smap *external_ids)
1637 : : {
1638 : : struct ovsdb_datum datum;
1639 : :
1640 [ # # ]: 0 : ovs_assert(inited);
1641 [ # # ]: 0 : if (external_ids) {
1642 : : struct smap_node *node;
1643 : : size_t i;
1644 : :
1645 : 0 : datum.n = smap_count(external_ids);
1646 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1647 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
1648 : :
1649 : 0 : i = 0;
1650 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
1651 : 0 : datum.keys[i].string = xstrdup(node->key);
1652 : 0 : datum.values[i].string = xstrdup(node->value);
1653 : 0 : i++;
1654 : : }
1655 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1656 : : } else {
1657 : 0 : ovsdb_datum_init_empty(&datum);
1658 : : }
1659 : 0 : ovsdb_idl_txn_write(&row->header_,
1660 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_EXTERNAL_IDS],
1661 : : &datum);
1662 : 0 : }
1663 : :
1664 : :
1665 : : /* Sets the "name" column from the "Address_Set" table in 'row' to
1666 : : * 'name'.
1667 : : *
1668 : : * The caller retains ownership of the arguments. */
1669 : : void
1670 : 0 : nbrec_address_set_set_name(const struct nbrec_address_set *row, const char *name)
1671 : : {
1672 : : struct ovsdb_datum datum;
1673 : : union ovsdb_atom key;
1674 : :
1675 [ # # ]: 0 : ovs_assert(inited);
1676 : 0 : datum.n = 1;
1677 : 0 : datum.keys = &key;
1678 : 0 : key.string = CONST_CAST(char *, name);
1679 : 0 : datum.values = NULL;
1680 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_NAME], &datum);
1681 : 0 : }
1682 : :
1683 : : /* Adds the value 'new_value' to the "addresses" set column from the "Address_Set" table
1684 : : * in 'row'.
1685 : : *
1686 : : */
1687 : : void
1688 : 0 : nbrec_address_set_update_addresses_addvalue(const struct nbrec_address_set *row, const char *new_value)
1689 : : {
1690 : : struct ovsdb_datum *datum;
1691 : :
1692 [ # # ]: 0 : ovs_assert(inited);
1693 : :
1694 : 0 : datum = xmalloc(sizeof *datum);
1695 : 0 : datum->n = 1;
1696 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
1697 : 0 : datum->values = NULL;
1698 : :
1699 : 0 : datum->keys[0].string = xstrdup(new_value);
1700 : :
1701 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
1702 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_ADDRESSES],
1703 : : datum);
1704 : 0 : }
1705 : :
1706 : : /* Deletes the value 'delete_value' from the "addresses" set column from the
1707 : : * "Address_Set" table in 'row'.
1708 : : *
1709 : : */
1710 : : void
1711 : 0 : nbrec_address_set_update_addresses_delvalue(const struct nbrec_address_set *row, const char *delete_value)
1712 : : {
1713 : : struct ovsdb_datum *datum;
1714 : :
1715 [ # # ]: 0 : ovs_assert(inited);
1716 : :
1717 : 0 : datum = xmalloc(sizeof *datum);
1718 : 0 : datum->n = 1;
1719 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
1720 : 0 : datum->values = NULL;
1721 : :
1722 : 0 : datum->keys[0].string = xstrdup(delete_value);
1723 : :
1724 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
1725 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_ADDRESSES],
1726 : : datum);
1727 : 0 : }
1728 : :
1729 : : /* Sets an element of the "external_ids" map column from the "Address_Set" table in 'row'
1730 : : * to 'new_value' given the key value 'new_key'.
1731 : : *
1732 : : */
1733 : : void
1734 : 0 : nbrec_address_set_update_external_ids_setkey(const struct nbrec_address_set *row, const char *new_key, const char *new_value)
1735 : : {
1736 : : struct ovsdb_datum *datum;
1737 : :
1738 [ # # ]: 0 : ovs_assert(inited);
1739 : :
1740 : 0 : datum = xmalloc(sizeof *datum);
1741 : 0 : datum->n = 1;
1742 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
1743 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
1744 : :
1745 : 0 : datum->keys[0].string = xstrdup(new_key);
1746 : 0 : datum->values[0].string = xstrdup(new_value);
1747 : :
1748 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
1749 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_EXTERNAL_IDS],
1750 : : datum);
1751 : 0 : }
1752 : :
1753 : : /* Deletes an element of the "external_ids" map column from the "Address_Set" table in 'row'
1754 : : * given the key value 'delete_key'.
1755 : : *
1756 : : */
1757 : : void
1758 : 0 : nbrec_address_set_update_external_ids_delkey(const struct nbrec_address_set *row, const char *delete_key)
1759 : : {
1760 : : struct ovsdb_datum *datum;
1761 : :
1762 [ # # ]: 0 : ovs_assert(inited);
1763 : :
1764 : 0 : datum = xmalloc(sizeof *datum);
1765 : 0 : datum->n = 1;
1766 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
1767 : 0 : datum->values = NULL;
1768 : :
1769 : 0 : datum->keys[0].string = xstrdup(delete_key);
1770 : :
1771 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
1772 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_EXTERNAL_IDS],
1773 : : datum);
1774 : 0 : }
1775 : :
1776 : : /* Sets the "addresses" column from the "Address_Set" table in 'row' to
1777 : : * the 'addresses' set with 'n_addresses' entries.
1778 : : *
1779 : : * The caller retains ownership of the arguments. */
1780 : : void
1781 : 0 : nbrec_address_set_add_clause_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char **addresses, size_t n_addresses)
1782 : : {
1783 : : struct ovsdb_datum datum;
1784 : : size_t i;
1785 : :
1786 [ # # ]: 0 : ovs_assert(inited);
1787 : 0 : datum.n = n_addresses;
1788 [ # # ]: 0 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
1789 : 0 : datum.values = NULL;
1790 [ # # ]: 0 : for (i = 0; i < n_addresses; i++) {
1791 : 0 : datum.keys[i].string = CONST_CAST(char *, addresses[i]);
1792 : : }
1793 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1794 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET],
1795 : : function,
1796 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_ADDRESSES],
1797 : : &datum);
1798 : 0 : free(datum.keys);
1799 : 0 : }
1800 : :
1801 : : /* Sets the "external_ids" column's value from the "Address_Set" table in 'row'
1802 : : * to 'external_ids'.
1803 : : *
1804 : : * The caller retains ownership of 'external_ids' and everything in it. */
1805 : : void
1806 : 0 : nbrec_address_set_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
1807 : : {
1808 : : struct ovsdb_datum datum;
1809 : :
1810 [ # # ]: 0 : ovs_assert(inited);
1811 [ # # ]: 0 : if (external_ids) {
1812 : : struct smap_node *node;
1813 : : size_t i;
1814 : :
1815 : 0 : datum.n = smap_count(external_ids);
1816 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1817 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
1818 : :
1819 : 0 : i = 0;
1820 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
1821 : 0 : datum.keys[i].string = xstrdup(node->key);
1822 : 0 : datum.values[i].string = xstrdup(node->value);
1823 : 0 : i++;
1824 : : }
1825 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1826 : : } else {
1827 : 0 : ovsdb_datum_init_empty(&datum);
1828 : : }
1829 : :
1830 : 0 : ovsdb_idl_condition_add_clause(idl,
1831 : : &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET],
1832 : : function,
1833 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_EXTERNAL_IDS],
1834 : : &datum);
1835 : :
1836 : 0 : ovsdb_datum_destroy(&datum, &nbrec_address_set_col_external_ids.type);
1837 : 0 : }
1838 : :
1839 : :
1840 : : /* Sets the "name" column from the "Address_Set" table in 'row' to
1841 : : * 'name'.
1842 : : *
1843 : : * The caller retains ownership of the arguments. */
1844 : : void
1845 : 0 : nbrec_address_set_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
1846 : : {
1847 : : struct ovsdb_datum datum;
1848 : : union ovsdb_atom key;
1849 : :
1850 [ # # ]: 0 : ovs_assert(inited);
1851 : 0 : datum.n = 1;
1852 : 0 : datum.keys = &key;
1853 : 0 : key.string = CONST_CAST(char *, name);
1854 : 0 : datum.values = NULL;
1855 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET],
1856 : : function,
1857 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_NAME],
1858 : : &datum);
1859 : 0 : }
1860 : : void
1861 : 0 : nbrec_address_set_add_clause_false(struct ovsdb_idl *idl)
1862 : : {
1863 : : struct ovsdb_datum datum;
1864 : :
1865 : 0 : ovsdb_datum_init_empty(&datum);
1866 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET], OVSDB_F_FALSE, NULL, &datum);
1867 : 0 : }
1868 : : void
1869 : 0 : nbrec_address_set_add_clause_true(struct ovsdb_idl *idl)
1870 : : {
1871 : : struct ovsdb_datum datum;
1872 : :
1873 : 0 : ovsdb_datum_init_empty(&datum);
1874 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET], OVSDB_F_TRUE, NULL, &datum);
1875 : 0 : }
1876 : :
1877 : : /* Sets the "addresses" column from the "Address_Set" table in 'row' to
1878 : : * the 'addresses' set with 'n_addresses' entries.
1879 : : *
1880 : : * The caller retains ownership of the arguments. */
1881 : : void
1882 : 0 : nbrec_address_set_remove_clause_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char **addresses, size_t n_addresses)
1883 : : {
1884 : : struct ovsdb_datum datum;
1885 : : size_t i;
1886 : :
1887 [ # # ]: 0 : ovs_assert(inited);
1888 : 0 : datum.n = n_addresses;
1889 [ # # ]: 0 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
1890 : 0 : datum.values = NULL;
1891 [ # # ]: 0 : for (i = 0; i < n_addresses; i++) {
1892 : 0 : datum.keys[i].string = CONST_CAST(char *, addresses[i]);
1893 : : }
1894 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1895 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET],
1896 : : function,
1897 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_ADDRESSES],
1898 : : &datum);
1899 : 0 : free(datum.keys);
1900 : 0 : }
1901 : :
1902 : : /* Sets the "external_ids" column's value from the "Address_Set" table in 'row'
1903 : : * to 'external_ids'.
1904 : : *
1905 : : * The caller retains ownership of 'external_ids' and everything in it. */
1906 : : void
1907 : 0 : nbrec_address_set_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
1908 : : {
1909 : : struct ovsdb_datum datum;
1910 : :
1911 [ # # ]: 0 : ovs_assert(inited);
1912 [ # # ]: 0 : if (external_ids) {
1913 : : struct smap_node *node;
1914 : : size_t i;
1915 : :
1916 : 0 : datum.n = smap_count(external_ids);
1917 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1918 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
1919 : :
1920 : 0 : i = 0;
1921 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
1922 : 0 : datum.keys[i].string = xstrdup(node->key);
1923 : 0 : datum.values[i].string = xstrdup(node->value);
1924 : 0 : i++;
1925 : : }
1926 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1927 : : } else {
1928 : 0 : ovsdb_datum_init_empty(&datum);
1929 : : }
1930 : :
1931 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET],
1932 : : function,
1933 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_EXTERNAL_IDS],
1934 : : &datum);
1935 : :
1936 : 0 : ovsdb_datum_destroy(&datum, &nbrec_address_set_col_external_ids.type);
1937 : 0 : }
1938 : :
1939 : :
1940 : : /* Sets the "name" column from the "Address_Set" table in 'row' to
1941 : : * 'name'.
1942 : : *
1943 : : * The caller retains ownership of the arguments. */
1944 : : void
1945 : 0 : nbrec_address_set_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
1946 : : {
1947 : : struct ovsdb_datum datum;
1948 : : union ovsdb_atom key;
1949 : :
1950 [ # # ]: 0 : ovs_assert(inited);
1951 : 0 : datum.n = 1;
1952 : 0 : datum.keys = &key;
1953 : 0 : key.string = CONST_CAST(char *, name);
1954 : 0 : datum.values = NULL;
1955 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET],
1956 : : function,
1957 : : &nbrec_address_set_columns[NBREC_ADDRESS_SET_COL_NAME],
1958 : : &datum);
1959 : 0 : }
1960 : : void
1961 : 0 : nbrec_address_set_remove_clause_false(struct ovsdb_idl *idl)
1962 : : {
1963 : : struct ovsdb_datum datum;
1964 : :
1965 : 0 : ovsdb_datum_init_empty(&datum);
1966 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET], OVSDB_F_FALSE, NULL, &datum);
1967 : 0 : }
1968 : : void
1969 : 0 : nbrec_address_set_remove_clause_true(struct ovsdb_idl *idl)
1970 : : {
1971 : : struct ovsdb_datum datum;
1972 : :
1973 : 0 : ovsdb_datum_init_empty(&datum);
1974 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_ADDRESS_SET], OVSDB_F_TRUE, NULL, &datum);
1975 : 0 : }
1976 : :
1977 : : struct ovsdb_idl_column nbrec_address_set_columns[NBREC_ADDRESS_SET_N_COLUMNS];
1978 : :
1979 : : static void
1980 : 932 : nbrec_address_set_columns_init(void)
1981 : : {
1982 : : struct ovsdb_idl_column *c;
1983 : :
1984 : : /* Initialize nbrec_address_set_col_addresses. */
1985 : 932 : c = &nbrec_address_set_col_addresses;
1986 : 932 : c->name = "addresses";
1987 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1988 : 932 : c->type.key.u.string.minLen = 0;
1989 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1990 : 932 : c->type.n_min = 0;
1991 : 932 : c->type.n_max = UINT_MAX;
1992 : 932 : c->mutable = true;
1993 : 932 : c->parse = nbrec_address_set_parse_addresses;
1994 : 932 : c->unparse = nbrec_address_set_unparse_addresses;
1995 : :
1996 : : /* Initialize nbrec_address_set_col_external_ids. */
1997 : 932 : c = &nbrec_address_set_col_external_ids;
1998 : 932 : c->name = "external_ids";
1999 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2000 : 932 : c->type.key.u.string.minLen = 0;
2001 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2002 : 932 : c->type.value.u.string.minLen = 0;
2003 : 932 : c->type.n_min = 0;
2004 : 932 : c->type.n_max = UINT_MAX;
2005 : 932 : c->mutable = true;
2006 : 932 : c->parse = nbrec_address_set_parse_external_ids;
2007 : 932 : c->unparse = nbrec_address_set_unparse_external_ids;
2008 : :
2009 : : /* Initialize nbrec_address_set_col_name. */
2010 : 932 : c = &nbrec_address_set_col_name;
2011 : 932 : c->name = "name";
2012 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2013 : 932 : c->type.key.u.string.minLen = 0;
2014 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2015 : 932 : c->type.n_min = 1;
2016 : 932 : c->type.n_max = 1;
2017 : 932 : c->mutable = true;
2018 : 932 : c->parse = nbrec_address_set_parse_name;
2019 : 932 : c->unparse = nbrec_address_set_unparse_name;
2020 : 932 : }
2021 : :
2022 : : /* DHCP_Options table. */
2023 : :
2024 : : static void
2025 : 18 : nbrec_dhcp_options_parse_cidr(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2026 : : {
2027 : 18 : struct nbrec_dhcp_options *row = nbrec_dhcp_options_cast(row_);
2028 : :
2029 [ - + ]: 18 : ovs_assert(inited);
2030 [ + - ]: 18 : if (datum->n >= 1) {
2031 : 18 : row->cidr = datum->keys[0].string;
2032 : : } else {
2033 : 0 : row->cidr = "";
2034 : : }
2035 : 18 : }
2036 : :
2037 : : static void
2038 : 15 : nbrec_dhcp_options_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2039 : : {
2040 : 15 : struct nbrec_dhcp_options *row = nbrec_dhcp_options_cast(row_);
2041 : : size_t i;
2042 : :
2043 [ - + ]: 15 : ovs_assert(inited);
2044 : 15 : smap_init(&row->external_ids);
2045 [ - + ]: 15 : for (i = 0; i < datum->n; i++) {
2046 : 0 : smap_add(&row->external_ids,
2047 : 0 : datum->keys[i].string,
2048 : 0 : datum->values[i].string);
2049 : : }
2050 : 15 : }
2051 : :
2052 : : static void
2053 : 18 : nbrec_dhcp_options_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2054 : : {
2055 : 18 : struct nbrec_dhcp_options *row = nbrec_dhcp_options_cast(row_);
2056 : : size_t i;
2057 : :
2058 [ - + ]: 18 : ovs_assert(inited);
2059 : 18 : smap_init(&row->options);
2060 [ + + ]: 59 : for (i = 0; i < datum->n; i++) {
2061 : 41 : smap_add(&row->options,
2062 : 41 : datum->keys[i].string,
2063 : 41 : datum->values[i].string);
2064 : : }
2065 : 18 : }
2066 : :
2067 : : static void
2068 : 21 : nbrec_dhcp_options_unparse_cidr(struct ovsdb_idl_row *row OVS_UNUSED)
2069 : : {
2070 : : /* Nothing to do. */
2071 : 21 : }
2072 : :
2073 : : static void
2074 : 18 : nbrec_dhcp_options_unparse_external_ids(struct ovsdb_idl_row *row_)
2075 : : {
2076 : 18 : struct nbrec_dhcp_options *row = nbrec_dhcp_options_cast(row_);
2077 : :
2078 [ - + ]: 18 : ovs_assert(inited);
2079 : 18 : smap_destroy(&row->external_ids);
2080 : 18 : }
2081 : :
2082 : : static void
2083 : 21 : nbrec_dhcp_options_unparse_options(struct ovsdb_idl_row *row_)
2084 : : {
2085 : 21 : struct nbrec_dhcp_options *row = nbrec_dhcp_options_cast(row_);
2086 : :
2087 [ - + ]: 21 : ovs_assert(inited);
2088 : 21 : smap_destroy(&row->options);
2089 : 21 : }
2090 : :
2091 : : static void
2092 : 18 : nbrec_dhcp_options_init__(struct ovsdb_idl_row *row)
2093 : : {
2094 : 18 : nbrec_dhcp_options_init(nbrec_dhcp_options_cast(row));
2095 : 18 : }
2096 : :
2097 : : /* Clears the contents of 'row' in table "DHCP_Options". */
2098 : : void
2099 : 18 : nbrec_dhcp_options_init(struct nbrec_dhcp_options *row)
2100 : : {
2101 : 18 : memset(row, 0, sizeof *row);
2102 : 18 : smap_init(&row->external_ids);
2103 : 18 : smap_init(&row->options);
2104 : 18 : }
2105 : :
2106 : : /* Searches table "DHCP_Options" in 'idl' for a row with UUID 'uuid'. Returns
2107 : : * a pointer to the row if there is one, otherwise a null pointer. */
2108 : : const struct nbrec_dhcp_options *
2109 : 0 : nbrec_dhcp_options_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
2110 : : {
2111 : 0 : return nbrec_dhcp_options_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], uuid));
2112 : : }
2113 : :
2114 : : /* Returns a row in table "DHCP_Options" in 'idl', or a null pointer if that
2115 : : * table is empty.
2116 : : *
2117 : : * Database tables are internally maintained as hash tables, so adding or
2118 : : * removing rows while traversing the same table can cause some rows to be
2119 : : * visited twice or not at apply. */
2120 : : const struct nbrec_dhcp_options *
2121 : 0 : nbrec_dhcp_options_first(const struct ovsdb_idl *idl)
2122 : : {
2123 : 0 : return nbrec_dhcp_options_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS]));
2124 : : }
2125 : :
2126 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
2127 : : * is the last row in its table. */
2128 : : const struct nbrec_dhcp_options *
2129 : 0 : nbrec_dhcp_options_next(const struct nbrec_dhcp_options *row)
2130 : : {
2131 : 0 : return nbrec_dhcp_options_cast(ovsdb_idl_next_row(&row->header_));
2132 : : }
2133 : :
2134 : 0 : unsigned int nbrec_dhcp_options_get_seqno(const struct ovsdb_idl *idl)
2135 : : {
2136 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS]);
2137 : : }
2138 : :
2139 : 0 : unsigned int nbrec_dhcp_options_row_get_seqno(const struct nbrec_dhcp_options *row, enum ovsdb_idl_change change)
2140 : : {
2141 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
2142 : : }
2143 : :
2144 : : const struct nbrec_dhcp_options *
2145 : 0 : nbrec_dhcp_options_track_get_first(const struct ovsdb_idl *idl)
2146 : : {
2147 : 0 : return nbrec_dhcp_options_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS]));
2148 : : }
2149 : :
2150 : : const struct nbrec_dhcp_options
2151 : 0 : *nbrec_dhcp_options_track_get_next(const struct nbrec_dhcp_options *row)
2152 : : {
2153 : 0 : return nbrec_dhcp_options_cast(ovsdb_idl_track_get_next(&row->header_));
2154 : : }
2155 : :
2156 : :
2157 : : /* Deletes 'row' from table "DHCP_Options". 'row' may be freed, so it must not be
2158 : : * accessed afterward.
2159 : : *
2160 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2161 : : void
2162 : 0 : nbrec_dhcp_options_delete(const struct nbrec_dhcp_options *row)
2163 : : {
2164 : 0 : ovsdb_idl_txn_delete(&row->header_);
2165 : 0 : }
2166 : :
2167 : : /* Inserts and returns a new row in the table "DHCP_Options" in the database
2168 : : * with open transaction 'txn'.
2169 : : *
2170 : : * The new row is assigned a randomly generated provisional UUID.
2171 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
2172 : : * but the IDL will replace any uses of the provisional UUID in the
2173 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
2174 : : struct nbrec_dhcp_options *
2175 : 0 : nbrec_dhcp_options_insert(struct ovsdb_idl_txn *txn)
2176 : : {
2177 : 0 : return nbrec_dhcp_options_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], NULL));
2178 : : }
2179 : :
2180 : : bool
2181 : 0 : nbrec_dhcp_options_is_updated(const struct nbrec_dhcp_options *row, enum nbrec_dhcp_options_column_id column)
2182 : : {
2183 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_dhcp_options_columns[column]);
2184 : : }
2185 : :
2186 : : /* Causes the original contents of column "cidr" in 'row' to be
2187 : : * verified as a prerequisite to completing the transaction. That is, if
2188 : : * "cidr" in 'row' changed (or if 'row' was deleted) between the
2189 : : * time that the IDL originally read its contents and the time that the
2190 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2191 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2192 : : * change has already been received).
2193 : : *
2194 : : * The intention is that, to ensure that no transaction commits based on dirty
2195 : : * reads, an application should call this function any time "cidr" is
2196 : : * read as part of a read-modify-write operation.
2197 : : *
2198 : : * In some cases this function reduces to a no-op, because the current value
2199 : : * of "cidr" is already known:
2200 : : *
2201 : : * - If 'row' is a row created by the current transaction (returned by
2202 : : * nbrec_dhcp_options_insert()).
2203 : : *
2204 : : * - If "cidr" has already been modified (with
2205 : : * nbrec_dhcp_options_set_cidr()) within the current transaction.
2206 : : *
2207 : : * Because of the latter property, always call this function *before*
2208 : : * nbrec_dhcp_options_set_cidr() for a given read-modify-write.
2209 : : *
2210 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2211 : : void
2212 : 0 : nbrec_dhcp_options_verify_cidr(const struct nbrec_dhcp_options *row)
2213 : : {
2214 [ # # ]: 0 : ovs_assert(inited);
2215 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_CIDR]);
2216 : 0 : }
2217 : :
2218 : : /* Causes the original contents of column "external_ids" in 'row' to be
2219 : : * verified as a prerequisite to completing the transaction. That is, if
2220 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
2221 : : * time that the IDL originally read its contents and the time that the
2222 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2223 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2224 : : * change has already been received).
2225 : : *
2226 : : * The intention is that, to ensure that no transaction commits based on dirty
2227 : : * reads, an application should call this function any time "external_ids" is
2228 : : * read as part of a read-modify-write operation.
2229 : : *
2230 : : * In some cases this function reduces to a no-op, because the current value
2231 : : * of "external_ids" is already known:
2232 : : *
2233 : : * - If 'row' is a row created by the current transaction (returned by
2234 : : * nbrec_dhcp_options_insert()).
2235 : : *
2236 : : * - If "external_ids" has already been modified (with
2237 : : * nbrec_dhcp_options_set_external_ids()) within the current transaction.
2238 : : *
2239 : : * Because of the latter property, always call this function *before*
2240 : : * nbrec_dhcp_options_set_external_ids() for a given read-modify-write.
2241 : : *
2242 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2243 : : void
2244 : 0 : nbrec_dhcp_options_verify_external_ids(const struct nbrec_dhcp_options *row)
2245 : : {
2246 [ # # ]: 0 : ovs_assert(inited);
2247 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_EXTERNAL_IDS]);
2248 : 0 : }
2249 : :
2250 : : /* Causes the original contents of column "options" in 'row' to be
2251 : : * verified as a prerequisite to completing the transaction. That is, if
2252 : : * "options" in 'row' changed (or if 'row' was deleted) between the
2253 : : * time that the IDL originally read its contents and the time that the
2254 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2255 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2256 : : * change has already been received).
2257 : : *
2258 : : * The intention is that, to ensure that no transaction commits based on dirty
2259 : : * reads, an application should call this function any time "options" is
2260 : : * read as part of a read-modify-write operation.
2261 : : *
2262 : : * In some cases this function reduces to a no-op, because the current value
2263 : : * of "options" is already known:
2264 : : *
2265 : : * - If 'row' is a row created by the current transaction (returned by
2266 : : * nbrec_dhcp_options_insert()).
2267 : : *
2268 : : * - If "options" has already been modified (with
2269 : : * nbrec_dhcp_options_set_options()) within the current transaction.
2270 : : *
2271 : : * Because of the latter property, always call this function *before*
2272 : : * nbrec_dhcp_options_set_options() for a given read-modify-write.
2273 : : *
2274 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2275 : : void
2276 : 0 : nbrec_dhcp_options_verify_options(const struct nbrec_dhcp_options *row)
2277 : : {
2278 [ # # ]: 0 : ovs_assert(inited);
2279 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_OPTIONS]);
2280 : 0 : }
2281 : :
2282 : : /* Returns the "cidr" column's value from the "DHCP_Options" table in 'row'
2283 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2284 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2285 : : * for a given key than implementing the same operation on the "cooked"
2286 : : * form in 'row'.
2287 : : *
2288 : : * 'key_type' must be OVSDB_TYPE_STRING.
2289 : : * (This helps to avoid silent bugs if someone changes cidr's
2290 : : * type without updating the caller.)
2291 : : *
2292 : : * The caller must not modify or free the returned value.
2293 : : *
2294 : : * Various kinds of changes can invalidate the returned value: modifying
2295 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2296 : : * If the returned value is needed for a long time, it is best to make a copy
2297 : : * of it with ovsdb_datum_clone().
2298 : : *
2299 : : * This function is rarely useful, since it is easier to access the value
2300 : : * directly through the "cidr" member in nbrec_dhcp_options. */
2301 : : const struct ovsdb_datum *
2302 : 0 : nbrec_dhcp_options_get_cidr(const struct nbrec_dhcp_options *row,
2303 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
2304 : : {
2305 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
2306 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_dhcp_options_col_cidr);
2307 : : }
2308 : :
2309 : : /* Returns the "external_ids" column's value from the "DHCP_Options" table in 'row'
2310 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2311 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2312 : : * for a given key than implementing the same operation on the "cooked"
2313 : : * form in 'row'.
2314 : : *
2315 : : * 'key_type' must be OVSDB_TYPE_STRING.
2316 : : * 'value_type' must be OVSDB_TYPE_STRING.
2317 : : * (This helps to avoid silent bugs if someone changes external_ids's
2318 : : * type without updating the caller.)
2319 : : *
2320 : : * The caller must not modify or free the returned value.
2321 : : *
2322 : : * Various kinds of changes can invalidate the returned value: modifying
2323 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2324 : : * If the returned value is needed for a long time, it is best to make a copy
2325 : : * of it with ovsdb_datum_clone().
2326 : : *
2327 : : * This function is rarely useful, since it is easier to access the value
2328 : : * directly through the "external_ids" member in nbrec_dhcp_options. */
2329 : : const struct ovsdb_datum *
2330 : 0 : nbrec_dhcp_options_get_external_ids(const struct nbrec_dhcp_options *row,
2331 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
2332 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
2333 : : {
2334 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
2335 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
2336 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_dhcp_options_col_external_ids);
2337 : : }
2338 : :
2339 : : /* Returns the "options" column's value from the "DHCP_Options" table in 'row'
2340 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2341 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2342 : : * for a given key than implementing the same operation on the "cooked"
2343 : : * form in 'row'.
2344 : : *
2345 : : * 'key_type' must be OVSDB_TYPE_STRING.
2346 : : * 'value_type' must be OVSDB_TYPE_STRING.
2347 : : * (This helps to avoid silent bugs if someone changes options's
2348 : : * type without updating the caller.)
2349 : : *
2350 : : * The caller must not modify or free the returned value.
2351 : : *
2352 : : * Various kinds of changes can invalidate the returned value: modifying
2353 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2354 : : * If the returned value is needed for a long time, it is best to make a copy
2355 : : * of it with ovsdb_datum_clone().
2356 : : *
2357 : : * This function is rarely useful, since it is easier to access the value
2358 : : * directly through the "options" member in nbrec_dhcp_options. */
2359 : : const struct ovsdb_datum *
2360 : 0 : nbrec_dhcp_options_get_options(const struct nbrec_dhcp_options *row,
2361 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
2362 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
2363 : : {
2364 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
2365 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
2366 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_dhcp_options_col_options);
2367 : : }
2368 : :
2369 : : /* Sets the "cidr" column from the "DHCP_Options" table in 'row' to
2370 : : * 'cidr'.
2371 : : *
2372 : : * The caller retains ownership of the arguments. */
2373 : : void
2374 : 0 : nbrec_dhcp_options_set_cidr(const struct nbrec_dhcp_options *row, const char *cidr)
2375 : : {
2376 : : struct ovsdb_datum datum;
2377 : : union ovsdb_atom key;
2378 : :
2379 [ # # ]: 0 : ovs_assert(inited);
2380 : 0 : datum.n = 1;
2381 : 0 : datum.keys = &key;
2382 : 0 : key.string = CONST_CAST(char *, cidr);
2383 : 0 : datum.values = NULL;
2384 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_CIDR], &datum);
2385 : 0 : }
2386 : :
2387 : : /* Sets the "external_ids" column's value from the "DHCP_Options" table in 'row'
2388 : : * to 'external_ids'.
2389 : : *
2390 : : * The caller retains ownership of 'external_ids' and everything in it. */
2391 : : void
2392 : 0 : nbrec_dhcp_options_set_external_ids(const struct nbrec_dhcp_options *row, const struct smap *external_ids)
2393 : : {
2394 : : struct ovsdb_datum datum;
2395 : :
2396 [ # # ]: 0 : ovs_assert(inited);
2397 [ # # ]: 0 : if (external_ids) {
2398 : : struct smap_node *node;
2399 : : size_t i;
2400 : :
2401 : 0 : datum.n = smap_count(external_ids);
2402 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2403 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
2404 : :
2405 : 0 : i = 0;
2406 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
2407 : 0 : datum.keys[i].string = xstrdup(node->key);
2408 : 0 : datum.values[i].string = xstrdup(node->value);
2409 : 0 : i++;
2410 : : }
2411 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2412 : : } else {
2413 : 0 : ovsdb_datum_init_empty(&datum);
2414 : : }
2415 : 0 : ovsdb_idl_txn_write(&row->header_,
2416 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_EXTERNAL_IDS],
2417 : : &datum);
2418 : 0 : }
2419 : :
2420 : :
2421 : : /* Sets the "options" column's value from the "DHCP_Options" table in 'row'
2422 : : * to 'options'.
2423 : : *
2424 : : * The caller retains ownership of 'options' and everything in it. */
2425 : : void
2426 : 0 : nbrec_dhcp_options_set_options(const struct nbrec_dhcp_options *row, const struct smap *options)
2427 : : {
2428 : : struct ovsdb_datum datum;
2429 : :
2430 [ # # ]: 0 : ovs_assert(inited);
2431 [ # # ]: 0 : if (options) {
2432 : : struct smap_node *node;
2433 : : size_t i;
2434 : :
2435 : 0 : datum.n = smap_count(options);
2436 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2437 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
2438 : :
2439 : 0 : i = 0;
2440 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
2441 : 0 : datum.keys[i].string = xstrdup(node->key);
2442 : 0 : datum.values[i].string = xstrdup(node->value);
2443 : 0 : i++;
2444 : : }
2445 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2446 : : } else {
2447 : 0 : ovsdb_datum_init_empty(&datum);
2448 : : }
2449 : 0 : ovsdb_idl_txn_write(&row->header_,
2450 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_OPTIONS],
2451 : : &datum);
2452 : 0 : }
2453 : :
2454 : :
2455 : : /* Sets an element of the "external_ids" map column from the "DHCP_Options" table in 'row'
2456 : : * to 'new_value' given the key value 'new_key'.
2457 : : *
2458 : : */
2459 : : void
2460 : 0 : nbrec_dhcp_options_update_external_ids_setkey(const struct nbrec_dhcp_options *row, const char *new_key, const char *new_value)
2461 : : {
2462 : : struct ovsdb_datum *datum;
2463 : :
2464 [ # # ]: 0 : ovs_assert(inited);
2465 : :
2466 : 0 : datum = xmalloc(sizeof *datum);
2467 : 0 : datum->n = 1;
2468 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
2469 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
2470 : :
2471 : 0 : datum->keys[0].string = xstrdup(new_key);
2472 : 0 : datum->values[0].string = xstrdup(new_value);
2473 : :
2474 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
2475 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_EXTERNAL_IDS],
2476 : : datum);
2477 : 0 : }
2478 : :
2479 : : /* Deletes an element of the "external_ids" map column from the "DHCP_Options" table in 'row'
2480 : : * given the key value 'delete_key'.
2481 : : *
2482 : : */
2483 : : void
2484 : 0 : nbrec_dhcp_options_update_external_ids_delkey(const struct nbrec_dhcp_options *row, const char *delete_key)
2485 : : {
2486 : : struct ovsdb_datum *datum;
2487 : :
2488 [ # # ]: 0 : ovs_assert(inited);
2489 : :
2490 : 0 : datum = xmalloc(sizeof *datum);
2491 : 0 : datum->n = 1;
2492 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
2493 : 0 : datum->values = NULL;
2494 : :
2495 : 0 : datum->keys[0].string = xstrdup(delete_key);
2496 : :
2497 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
2498 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_EXTERNAL_IDS],
2499 : : datum);
2500 : 0 : }
2501 : :
2502 : : /* Sets an element of the "options" map column from the "DHCP_Options" table in 'row'
2503 : : * to 'new_value' given the key value 'new_key'.
2504 : : *
2505 : : */
2506 : : void
2507 : 0 : nbrec_dhcp_options_update_options_setkey(const struct nbrec_dhcp_options *row, const char *new_key, const char *new_value)
2508 : : {
2509 : : struct ovsdb_datum *datum;
2510 : :
2511 [ # # ]: 0 : ovs_assert(inited);
2512 : :
2513 : 0 : datum = xmalloc(sizeof *datum);
2514 : 0 : datum->n = 1;
2515 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
2516 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
2517 : :
2518 : 0 : datum->keys[0].string = xstrdup(new_key);
2519 : 0 : datum->values[0].string = xstrdup(new_value);
2520 : :
2521 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
2522 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_OPTIONS],
2523 : : datum);
2524 : 0 : }
2525 : :
2526 : : /* Deletes an element of the "options" map column from the "DHCP_Options" table in 'row'
2527 : : * given the key value 'delete_key'.
2528 : : *
2529 : : */
2530 : : void
2531 : 0 : nbrec_dhcp_options_update_options_delkey(const struct nbrec_dhcp_options *row, const char *delete_key)
2532 : : {
2533 : : struct ovsdb_datum *datum;
2534 : :
2535 [ # # ]: 0 : ovs_assert(inited);
2536 : :
2537 : 0 : datum = xmalloc(sizeof *datum);
2538 : 0 : datum->n = 1;
2539 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
2540 : 0 : datum->values = NULL;
2541 : :
2542 : 0 : datum->keys[0].string = xstrdup(delete_key);
2543 : :
2544 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
2545 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_OPTIONS],
2546 : : datum);
2547 : 0 : }
2548 : :
2549 : : /* Sets the "cidr" column from the "DHCP_Options" table in 'row' to
2550 : : * 'cidr'.
2551 : : *
2552 : : * The caller retains ownership of the arguments. */
2553 : : void
2554 : 0 : nbrec_dhcp_options_add_clause_cidr(struct ovsdb_idl *idl, enum ovsdb_function function, const char *cidr)
2555 : : {
2556 : : struct ovsdb_datum datum;
2557 : : union ovsdb_atom key;
2558 : :
2559 [ # # ]: 0 : ovs_assert(inited);
2560 : 0 : datum.n = 1;
2561 : 0 : datum.keys = &key;
2562 : 0 : key.string = CONST_CAST(char *, cidr);
2563 : 0 : datum.values = NULL;
2564 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS],
2565 : : function,
2566 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_CIDR],
2567 : : &datum);
2568 : 0 : }
2569 : :
2570 : : /* Sets the "external_ids" column's value from the "DHCP_Options" table in 'row'
2571 : : * to 'external_ids'.
2572 : : *
2573 : : * The caller retains ownership of 'external_ids' and everything in it. */
2574 : : void
2575 : 0 : nbrec_dhcp_options_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
2576 : : {
2577 : : struct ovsdb_datum datum;
2578 : :
2579 [ # # ]: 0 : ovs_assert(inited);
2580 [ # # ]: 0 : if (external_ids) {
2581 : : struct smap_node *node;
2582 : : size_t i;
2583 : :
2584 : 0 : datum.n = smap_count(external_ids);
2585 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2586 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
2587 : :
2588 : 0 : i = 0;
2589 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
2590 : 0 : datum.keys[i].string = xstrdup(node->key);
2591 : 0 : datum.values[i].string = xstrdup(node->value);
2592 : 0 : i++;
2593 : : }
2594 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2595 : : } else {
2596 : 0 : ovsdb_datum_init_empty(&datum);
2597 : : }
2598 : :
2599 : 0 : ovsdb_idl_condition_add_clause(idl,
2600 : : &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS],
2601 : : function,
2602 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_EXTERNAL_IDS],
2603 : : &datum);
2604 : :
2605 : 0 : ovsdb_datum_destroy(&datum, &nbrec_dhcp_options_col_external_ids.type);
2606 : 0 : }
2607 : :
2608 : :
2609 : : /* Sets the "options" column's value from the "DHCP_Options" table in 'row'
2610 : : * to 'options'.
2611 : : *
2612 : : * The caller retains ownership of 'options' and everything in it. */
2613 : : void
2614 : 0 : nbrec_dhcp_options_add_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
2615 : : {
2616 : : struct ovsdb_datum datum;
2617 : :
2618 [ # # ]: 0 : ovs_assert(inited);
2619 [ # # ]: 0 : if (options) {
2620 : : struct smap_node *node;
2621 : : size_t i;
2622 : :
2623 : 0 : datum.n = smap_count(options);
2624 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2625 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
2626 : :
2627 : 0 : i = 0;
2628 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
2629 : 0 : datum.keys[i].string = xstrdup(node->key);
2630 : 0 : datum.values[i].string = xstrdup(node->value);
2631 : 0 : i++;
2632 : : }
2633 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2634 : : } else {
2635 : 0 : ovsdb_datum_init_empty(&datum);
2636 : : }
2637 : :
2638 : 0 : ovsdb_idl_condition_add_clause(idl,
2639 : : &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS],
2640 : : function,
2641 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_OPTIONS],
2642 : : &datum);
2643 : :
2644 : 0 : ovsdb_datum_destroy(&datum, &nbrec_dhcp_options_col_options.type);
2645 : 0 : }
2646 : :
2647 : : void
2648 : 0 : nbrec_dhcp_options_add_clause_false(struct ovsdb_idl *idl)
2649 : : {
2650 : : struct ovsdb_datum datum;
2651 : :
2652 : 0 : ovsdb_datum_init_empty(&datum);
2653 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], OVSDB_F_FALSE, NULL, &datum);
2654 : 0 : }
2655 : : void
2656 : 0 : nbrec_dhcp_options_add_clause_true(struct ovsdb_idl *idl)
2657 : : {
2658 : : struct ovsdb_datum datum;
2659 : :
2660 : 0 : ovsdb_datum_init_empty(&datum);
2661 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], OVSDB_F_TRUE, NULL, &datum);
2662 : 0 : }
2663 : :
2664 : : /* Sets the "cidr" column from the "DHCP_Options" table in 'row' to
2665 : : * 'cidr'.
2666 : : *
2667 : : * The caller retains ownership of the arguments. */
2668 : : void
2669 : 0 : nbrec_dhcp_options_remove_clause_cidr(struct ovsdb_idl *idl, enum ovsdb_function function, const char *cidr)
2670 : : {
2671 : : struct ovsdb_datum datum;
2672 : : union ovsdb_atom key;
2673 : :
2674 [ # # ]: 0 : ovs_assert(inited);
2675 : 0 : datum.n = 1;
2676 : 0 : datum.keys = &key;
2677 : 0 : key.string = CONST_CAST(char *, cidr);
2678 : 0 : datum.values = NULL;
2679 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS],
2680 : : function,
2681 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_CIDR],
2682 : : &datum);
2683 : 0 : }
2684 : :
2685 : : /* Sets the "external_ids" column's value from the "DHCP_Options" table in 'row'
2686 : : * to 'external_ids'.
2687 : : *
2688 : : * The caller retains ownership of 'external_ids' and everything in it. */
2689 : : void
2690 : 0 : nbrec_dhcp_options_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
2691 : : {
2692 : : struct ovsdb_datum datum;
2693 : :
2694 [ # # ]: 0 : ovs_assert(inited);
2695 [ # # ]: 0 : if (external_ids) {
2696 : : struct smap_node *node;
2697 : : size_t i;
2698 : :
2699 : 0 : datum.n = smap_count(external_ids);
2700 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2701 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
2702 : :
2703 : 0 : i = 0;
2704 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
2705 : 0 : datum.keys[i].string = xstrdup(node->key);
2706 : 0 : datum.values[i].string = xstrdup(node->value);
2707 : 0 : i++;
2708 : : }
2709 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2710 : : } else {
2711 : 0 : ovsdb_datum_init_empty(&datum);
2712 : : }
2713 : :
2714 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS],
2715 : : function,
2716 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_EXTERNAL_IDS],
2717 : : &datum);
2718 : :
2719 : 0 : ovsdb_datum_destroy(&datum, &nbrec_dhcp_options_col_external_ids.type);
2720 : 0 : }
2721 : :
2722 : :
2723 : : /* Sets the "options" column's value from the "DHCP_Options" table in 'row'
2724 : : * to 'options'.
2725 : : *
2726 : : * The caller retains ownership of 'options' and everything in it. */
2727 : : void
2728 : 0 : nbrec_dhcp_options_remove_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
2729 : : {
2730 : : struct ovsdb_datum datum;
2731 : :
2732 [ # # ]: 0 : ovs_assert(inited);
2733 [ # # ]: 0 : if (options) {
2734 : : struct smap_node *node;
2735 : : size_t i;
2736 : :
2737 : 0 : datum.n = smap_count(options);
2738 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2739 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
2740 : :
2741 : 0 : i = 0;
2742 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
2743 : 0 : datum.keys[i].string = xstrdup(node->key);
2744 : 0 : datum.values[i].string = xstrdup(node->value);
2745 : 0 : i++;
2746 : : }
2747 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2748 : : } else {
2749 : 0 : ovsdb_datum_init_empty(&datum);
2750 : : }
2751 : :
2752 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS],
2753 : : function,
2754 : : &nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_COL_OPTIONS],
2755 : : &datum);
2756 : :
2757 : 0 : ovsdb_datum_destroy(&datum, &nbrec_dhcp_options_col_options.type);
2758 : 0 : }
2759 : :
2760 : : void
2761 : 0 : nbrec_dhcp_options_remove_clause_false(struct ovsdb_idl *idl)
2762 : : {
2763 : : struct ovsdb_datum datum;
2764 : :
2765 : 0 : ovsdb_datum_init_empty(&datum);
2766 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], OVSDB_F_FALSE, NULL, &datum);
2767 : 0 : }
2768 : : void
2769 : 0 : nbrec_dhcp_options_remove_clause_true(struct ovsdb_idl *idl)
2770 : : {
2771 : : struct ovsdb_datum datum;
2772 : :
2773 : 0 : ovsdb_datum_init_empty(&datum);
2774 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], OVSDB_F_TRUE, NULL, &datum);
2775 : 0 : }
2776 : :
2777 : : struct ovsdb_idl_column nbrec_dhcp_options_columns[NBREC_DHCP_OPTIONS_N_COLUMNS];
2778 : :
2779 : : static void
2780 : 932 : nbrec_dhcp_options_columns_init(void)
2781 : : {
2782 : : struct ovsdb_idl_column *c;
2783 : :
2784 : : /* Initialize nbrec_dhcp_options_col_cidr. */
2785 : 932 : c = &nbrec_dhcp_options_col_cidr;
2786 : 932 : c->name = "cidr";
2787 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2788 : 932 : c->type.key.u.string.minLen = 0;
2789 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2790 : 932 : c->type.n_min = 1;
2791 : 932 : c->type.n_max = 1;
2792 : 932 : c->mutable = true;
2793 : 932 : c->parse = nbrec_dhcp_options_parse_cidr;
2794 : 932 : c->unparse = nbrec_dhcp_options_unparse_cidr;
2795 : :
2796 : : /* Initialize nbrec_dhcp_options_col_external_ids. */
2797 : 932 : c = &nbrec_dhcp_options_col_external_ids;
2798 : 932 : c->name = "external_ids";
2799 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2800 : 932 : c->type.key.u.string.minLen = 0;
2801 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2802 : 932 : c->type.value.u.string.minLen = 0;
2803 : 932 : c->type.n_min = 0;
2804 : 932 : c->type.n_max = UINT_MAX;
2805 : 932 : c->mutable = true;
2806 : 932 : c->parse = nbrec_dhcp_options_parse_external_ids;
2807 : 932 : c->unparse = nbrec_dhcp_options_unparse_external_ids;
2808 : :
2809 : : /* Initialize nbrec_dhcp_options_col_options. */
2810 : 932 : c = &nbrec_dhcp_options_col_options;
2811 : 932 : c->name = "options";
2812 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2813 : 932 : c->type.key.u.string.minLen = 0;
2814 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2815 : 932 : c->type.value.u.string.minLen = 0;
2816 : 932 : c->type.n_min = 0;
2817 : 932 : c->type.n_max = UINT_MAX;
2818 : 932 : c->mutable = true;
2819 : 932 : c->parse = nbrec_dhcp_options_parse_options;
2820 : 932 : c->unparse = nbrec_dhcp_options_unparse_options;
2821 : 932 : }
2822 : :
2823 : : /* Load_Balancer table. */
2824 : :
2825 : : static void
2826 : 27 : nbrec_load_balancer_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2827 : : {
2828 : 27 : struct nbrec_load_balancer *row = nbrec_load_balancer_cast(row_);
2829 : : size_t i;
2830 : :
2831 [ - + ]: 27 : ovs_assert(inited);
2832 : 27 : smap_init(&row->external_ids);
2833 [ - + ]: 27 : for (i = 0; i < datum->n; i++) {
2834 : 0 : smap_add(&row->external_ids,
2835 : 0 : datum->keys[i].string,
2836 : 0 : datum->values[i].string);
2837 : : }
2838 : 27 : }
2839 : :
2840 : : static void
2841 : 27 : nbrec_load_balancer_parse_protocol(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2842 : : {
2843 : 27 : struct nbrec_load_balancer *row = nbrec_load_balancer_cast(row_);
2844 : :
2845 [ - + ]: 27 : ovs_assert(inited);
2846 [ - + ]: 27 : if (datum->n >= 1) {
2847 : 0 : row->protocol = datum->keys[0].string;
2848 : : } else {
2849 : 27 : row->protocol = NULL;
2850 : : }
2851 : 27 : }
2852 : :
2853 : : static void
2854 : 34 : nbrec_load_balancer_parse_vips(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2855 : : {
2856 : 34 : struct nbrec_load_balancer *row = nbrec_load_balancer_cast(row_);
2857 : : size_t i;
2858 : :
2859 [ - + ]: 34 : ovs_assert(inited);
2860 : 34 : smap_init(&row->vips);
2861 [ + + ]: 77 : for (i = 0; i < datum->n; i++) {
2862 : 43 : smap_add(&row->vips,
2863 : 43 : datum->keys[i].string,
2864 : 43 : datum->values[i].string);
2865 : : }
2866 : 34 : }
2867 : :
2868 : : static void
2869 : 31 : nbrec_load_balancer_unparse_external_ids(struct ovsdb_idl_row *row_)
2870 : : {
2871 : 31 : struct nbrec_load_balancer *row = nbrec_load_balancer_cast(row_);
2872 : :
2873 [ - + ]: 31 : ovs_assert(inited);
2874 : 31 : smap_destroy(&row->external_ids);
2875 : 31 : }
2876 : :
2877 : : static void
2878 : 31 : nbrec_load_balancer_unparse_protocol(struct ovsdb_idl_row *row OVS_UNUSED)
2879 : : {
2880 : : /* Nothing to do. */
2881 : 31 : }
2882 : :
2883 : : static void
2884 : 38 : nbrec_load_balancer_unparse_vips(struct ovsdb_idl_row *row_)
2885 : : {
2886 : 38 : struct nbrec_load_balancer *row = nbrec_load_balancer_cast(row_);
2887 : :
2888 [ - + ]: 38 : ovs_assert(inited);
2889 : 38 : smap_destroy(&row->vips);
2890 : 38 : }
2891 : :
2892 : : static void
2893 : 22 : nbrec_load_balancer_init__(struct ovsdb_idl_row *row)
2894 : : {
2895 : 22 : nbrec_load_balancer_init(nbrec_load_balancer_cast(row));
2896 : 22 : }
2897 : :
2898 : : /* Clears the contents of 'row' in table "Load_Balancer". */
2899 : : void
2900 : 22 : nbrec_load_balancer_init(struct nbrec_load_balancer *row)
2901 : : {
2902 : 22 : memset(row, 0, sizeof *row);
2903 : 22 : smap_init(&row->external_ids);
2904 : 22 : smap_init(&row->vips);
2905 : 22 : }
2906 : :
2907 : : /* Searches table "Load_Balancer" in 'idl' for a row with UUID 'uuid'. Returns
2908 : : * a pointer to the row if there is one, otherwise a null pointer. */
2909 : : const struct nbrec_load_balancer *
2910 : 0 : nbrec_load_balancer_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
2911 : : {
2912 : 0 : return nbrec_load_balancer_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], uuid));
2913 : : }
2914 : :
2915 : : /* Returns a row in table "Load_Balancer" in 'idl', or a null pointer if that
2916 : : * table is empty.
2917 : : *
2918 : : * Database tables are internally maintained as hash tables, so adding or
2919 : : * removing rows while traversing the same table can cause some rows to be
2920 : : * visited twice or not at apply. */
2921 : : const struct nbrec_load_balancer *
2922 : 0 : nbrec_load_balancer_first(const struct ovsdb_idl *idl)
2923 : : {
2924 : 0 : return nbrec_load_balancer_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER]));
2925 : : }
2926 : :
2927 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
2928 : : * is the last row in its table. */
2929 : : const struct nbrec_load_balancer *
2930 : 0 : nbrec_load_balancer_next(const struct nbrec_load_balancer *row)
2931 : : {
2932 : 0 : return nbrec_load_balancer_cast(ovsdb_idl_next_row(&row->header_));
2933 : : }
2934 : :
2935 : 0 : unsigned int nbrec_load_balancer_get_seqno(const struct ovsdb_idl *idl)
2936 : : {
2937 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER]);
2938 : : }
2939 : :
2940 : 0 : unsigned int nbrec_load_balancer_row_get_seqno(const struct nbrec_load_balancer *row, enum ovsdb_idl_change change)
2941 : : {
2942 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
2943 : : }
2944 : :
2945 : : const struct nbrec_load_balancer *
2946 : 0 : nbrec_load_balancer_track_get_first(const struct ovsdb_idl *idl)
2947 : : {
2948 : 0 : return nbrec_load_balancer_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER]));
2949 : : }
2950 : :
2951 : : const struct nbrec_load_balancer
2952 : 0 : *nbrec_load_balancer_track_get_next(const struct nbrec_load_balancer *row)
2953 : : {
2954 : 0 : return nbrec_load_balancer_cast(ovsdb_idl_track_get_next(&row->header_));
2955 : : }
2956 : :
2957 : :
2958 : : /* Deletes 'row' from table "Load_Balancer". 'row' may be freed, so it must not be
2959 : : * accessed afterward.
2960 : : *
2961 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2962 : : void
2963 : 0 : nbrec_load_balancer_delete(const struct nbrec_load_balancer *row)
2964 : : {
2965 : 0 : ovsdb_idl_txn_delete(&row->header_);
2966 : 0 : }
2967 : :
2968 : : /* Inserts and returns a new row in the table "Load_Balancer" in the database
2969 : : * with open transaction 'txn'.
2970 : : *
2971 : : * The new row is assigned a randomly generated provisional UUID.
2972 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
2973 : : * but the IDL will replace any uses of the provisional UUID in the
2974 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
2975 : : struct nbrec_load_balancer *
2976 : 0 : nbrec_load_balancer_insert(struct ovsdb_idl_txn *txn)
2977 : : {
2978 : 0 : return nbrec_load_balancer_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], NULL));
2979 : : }
2980 : :
2981 : : bool
2982 : 0 : nbrec_load_balancer_is_updated(const struct nbrec_load_balancer *row, enum nbrec_load_balancer_column_id column)
2983 : : {
2984 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_load_balancer_columns[column]);
2985 : : }
2986 : :
2987 : : /* Causes the original contents of column "external_ids" in 'row' to be
2988 : : * verified as a prerequisite to completing the transaction. That is, if
2989 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
2990 : : * time that the IDL originally read its contents and the time that the
2991 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2992 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2993 : : * change has already been received).
2994 : : *
2995 : : * The intention is that, to ensure that no transaction commits based on dirty
2996 : : * reads, an application should call this function any time "external_ids" is
2997 : : * read as part of a read-modify-write operation.
2998 : : *
2999 : : * In some cases this function reduces to a no-op, because the current value
3000 : : * of "external_ids" is already known:
3001 : : *
3002 : : * - If 'row' is a row created by the current transaction (returned by
3003 : : * nbrec_load_balancer_insert()).
3004 : : *
3005 : : * - If "external_ids" has already been modified (with
3006 : : * nbrec_load_balancer_set_external_ids()) within the current transaction.
3007 : : *
3008 : : * Because of the latter property, always call this function *before*
3009 : : * nbrec_load_balancer_set_external_ids() for a given read-modify-write.
3010 : : *
3011 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3012 : : void
3013 : 0 : nbrec_load_balancer_verify_external_ids(const struct nbrec_load_balancer *row)
3014 : : {
3015 [ # # ]: 0 : ovs_assert(inited);
3016 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_EXTERNAL_IDS]);
3017 : 0 : }
3018 : :
3019 : : /* Causes the original contents of column "protocol" in 'row' to be
3020 : : * verified as a prerequisite to completing the transaction. That is, if
3021 : : * "protocol" in 'row' changed (or if 'row' was deleted) between the
3022 : : * time that the IDL originally read its contents and the time that the
3023 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
3024 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
3025 : : * change has already been received).
3026 : : *
3027 : : * The intention is that, to ensure that no transaction commits based on dirty
3028 : : * reads, an application should call this function any time "protocol" is
3029 : : * read as part of a read-modify-write operation.
3030 : : *
3031 : : * In some cases this function reduces to a no-op, because the current value
3032 : : * of "protocol" is already known:
3033 : : *
3034 : : * - If 'row' is a row created by the current transaction (returned by
3035 : : * nbrec_load_balancer_insert()).
3036 : : *
3037 : : * - If "protocol" has already been modified (with
3038 : : * nbrec_load_balancer_set_protocol()) within the current transaction.
3039 : : *
3040 : : * Because of the latter property, always call this function *before*
3041 : : * nbrec_load_balancer_set_protocol() for a given read-modify-write.
3042 : : *
3043 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3044 : : void
3045 : 0 : nbrec_load_balancer_verify_protocol(const struct nbrec_load_balancer *row)
3046 : : {
3047 [ # # ]: 0 : ovs_assert(inited);
3048 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_PROTOCOL]);
3049 : 0 : }
3050 : :
3051 : : /* Causes the original contents of column "vips" in 'row' to be
3052 : : * verified as a prerequisite to completing the transaction. That is, if
3053 : : * "vips" in 'row' changed (or if 'row' was deleted) between the
3054 : : * time that the IDL originally read its contents and the time that the
3055 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
3056 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
3057 : : * change has already been received).
3058 : : *
3059 : : * The intention is that, to ensure that no transaction commits based on dirty
3060 : : * reads, an application should call this function any time "vips" is
3061 : : * read as part of a read-modify-write operation.
3062 : : *
3063 : : * In some cases this function reduces to a no-op, because the current value
3064 : : * of "vips" is already known:
3065 : : *
3066 : : * - If 'row' is a row created by the current transaction (returned by
3067 : : * nbrec_load_balancer_insert()).
3068 : : *
3069 : : * - If "vips" has already been modified (with
3070 : : * nbrec_load_balancer_set_vips()) within the current transaction.
3071 : : *
3072 : : * Because of the latter property, always call this function *before*
3073 : : * nbrec_load_balancer_set_vips() for a given read-modify-write.
3074 : : *
3075 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3076 : : void
3077 : 0 : nbrec_load_balancer_verify_vips(const struct nbrec_load_balancer *row)
3078 : : {
3079 [ # # ]: 0 : ovs_assert(inited);
3080 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_VIPS]);
3081 : 0 : }
3082 : :
3083 : : /* Returns the "external_ids" column's value from the "Load_Balancer" table in 'row'
3084 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3085 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3086 : : * for a given key than implementing the same operation on the "cooked"
3087 : : * form in 'row'.
3088 : : *
3089 : : * 'key_type' must be OVSDB_TYPE_STRING.
3090 : : * 'value_type' must be OVSDB_TYPE_STRING.
3091 : : * (This helps to avoid silent bugs if someone changes external_ids's
3092 : : * type without updating the caller.)
3093 : : *
3094 : : * The caller must not modify or free the returned value.
3095 : : *
3096 : : * Various kinds of changes can invalidate the returned value: modifying
3097 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3098 : : * If the returned value is needed for a long time, it is best to make a copy
3099 : : * of it with ovsdb_datum_clone().
3100 : : *
3101 : : * This function is rarely useful, since it is easier to access the value
3102 : : * directly through the "external_ids" member in nbrec_load_balancer. */
3103 : : const struct ovsdb_datum *
3104 : 0 : nbrec_load_balancer_get_external_ids(const struct nbrec_load_balancer *row,
3105 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
3106 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
3107 : : {
3108 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
3109 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
3110 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_load_balancer_col_external_ids);
3111 : : }
3112 : :
3113 : : /* Returns the "protocol" column's value from the "Load_Balancer" table in 'row'
3114 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3115 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3116 : : * for a given key than implementing the same operation on the "cooked"
3117 : : * form in 'row'.
3118 : : *
3119 : : * 'key_type' must be OVSDB_TYPE_STRING.
3120 : : * (This helps to avoid silent bugs if someone changes protocol's
3121 : : * type without updating the caller.)
3122 : : *
3123 : : * The caller must not modify or free the returned value.
3124 : : *
3125 : : * Various kinds of changes can invalidate the returned value: modifying
3126 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3127 : : * If the returned value is needed for a long time, it is best to make a copy
3128 : : * of it with ovsdb_datum_clone().
3129 : : *
3130 : : * This function is rarely useful, since it is easier to access the value
3131 : : * directly through the "protocol" member in nbrec_load_balancer. */
3132 : : const struct ovsdb_datum *
3133 : 0 : nbrec_load_balancer_get_protocol(const struct nbrec_load_balancer *row,
3134 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
3135 : : {
3136 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
3137 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_load_balancer_col_protocol);
3138 : : }
3139 : :
3140 : : /* Returns the "vips" column's value from the "Load_Balancer" table in 'row'
3141 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3142 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3143 : : * for a given key than implementing the same operation on the "cooked"
3144 : : * form in 'row'.
3145 : : *
3146 : : * 'key_type' must be OVSDB_TYPE_STRING.
3147 : : * 'value_type' must be OVSDB_TYPE_STRING.
3148 : : * (This helps to avoid silent bugs if someone changes vips's
3149 : : * type without updating the caller.)
3150 : : *
3151 : : * The caller must not modify or free the returned value.
3152 : : *
3153 : : * Various kinds of changes can invalidate the returned value: modifying
3154 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3155 : : * If the returned value is needed for a long time, it is best to make a copy
3156 : : * of it with ovsdb_datum_clone().
3157 : : *
3158 : : * This function is rarely useful, since it is easier to access the value
3159 : : * directly through the "vips" member in nbrec_load_balancer. */
3160 : : const struct ovsdb_datum *
3161 : 0 : nbrec_load_balancer_get_vips(const struct nbrec_load_balancer *row,
3162 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
3163 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
3164 : : {
3165 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
3166 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
3167 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_load_balancer_col_vips);
3168 : : }
3169 : :
3170 : : /* Sets the "external_ids" column's value from the "Load_Balancer" table in 'row'
3171 : : * to 'external_ids'.
3172 : : *
3173 : : * The caller retains ownership of 'external_ids' and everything in it. */
3174 : : void
3175 : 0 : nbrec_load_balancer_set_external_ids(const struct nbrec_load_balancer *row, const struct smap *external_ids)
3176 : : {
3177 : : struct ovsdb_datum datum;
3178 : :
3179 [ # # ]: 0 : ovs_assert(inited);
3180 [ # # ]: 0 : if (external_ids) {
3181 : : struct smap_node *node;
3182 : : size_t i;
3183 : :
3184 : 0 : datum.n = smap_count(external_ids);
3185 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3186 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3187 : :
3188 : 0 : i = 0;
3189 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
3190 : 0 : datum.keys[i].string = xstrdup(node->key);
3191 : 0 : datum.values[i].string = xstrdup(node->value);
3192 : 0 : i++;
3193 : : }
3194 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3195 : : } else {
3196 : 0 : ovsdb_datum_init_empty(&datum);
3197 : : }
3198 : 0 : ovsdb_idl_txn_write(&row->header_,
3199 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_EXTERNAL_IDS],
3200 : : &datum);
3201 : 0 : }
3202 : :
3203 : :
3204 : : /* Sets the "protocol" column from the "Load_Balancer" table in 'row' to
3205 : : * the 'protocol' set.
3206 : : *
3207 : : * If "protocol" is null, the column will be the empty set,
3208 : : * otherwise it will contain the specified value.
3209 : : *
3210 : : * Argument constraints: either "udp" or "tcp"
3211 : : *
3212 : : * The caller retains ownership of the arguments. */
3213 : : void
3214 : 0 : nbrec_load_balancer_set_protocol(const struct nbrec_load_balancer *row, const char *protocol)
3215 : : {
3216 : : struct ovsdb_datum datum;
3217 : : union ovsdb_atom key;
3218 : :
3219 [ # # ]: 0 : ovs_assert(inited);
3220 [ # # ]: 0 : if (protocol) {
3221 : 0 : datum.n = 1;
3222 : 0 : datum.keys = &key;
3223 : 0 : key.string = CONST_CAST(char *, protocol);
3224 : : } else {
3225 : 0 : datum.n = 0;
3226 : 0 : datum.keys = NULL;
3227 : : }
3228 : 0 : datum.values = NULL;
3229 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_PROTOCOL], &datum);
3230 : 0 : }
3231 : :
3232 : : /* Sets the "vips" column's value from the "Load_Balancer" table in 'row'
3233 : : * to 'vips'.
3234 : : *
3235 : : * The caller retains ownership of 'vips' and everything in it. */
3236 : : void
3237 : 0 : nbrec_load_balancer_set_vips(const struct nbrec_load_balancer *row, const struct smap *vips)
3238 : : {
3239 : : struct ovsdb_datum datum;
3240 : :
3241 [ # # ]: 0 : ovs_assert(inited);
3242 [ # # ]: 0 : if (vips) {
3243 : : struct smap_node *node;
3244 : : size_t i;
3245 : :
3246 : 0 : datum.n = smap_count(vips);
3247 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3248 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3249 : :
3250 : 0 : i = 0;
3251 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, vips) {
3252 : 0 : datum.keys[i].string = xstrdup(node->key);
3253 : 0 : datum.values[i].string = xstrdup(node->value);
3254 : 0 : i++;
3255 : : }
3256 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3257 : : } else {
3258 : 0 : ovsdb_datum_init_empty(&datum);
3259 : : }
3260 : 0 : ovsdb_idl_txn_write(&row->header_,
3261 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_VIPS],
3262 : : &datum);
3263 : 0 : }
3264 : :
3265 : :
3266 : : /* Sets an element of the "external_ids" map column from the "Load_Balancer" table in 'row'
3267 : : * to 'new_value' given the key value 'new_key'.
3268 : : *
3269 : : */
3270 : : void
3271 : 0 : nbrec_load_balancer_update_external_ids_setkey(const struct nbrec_load_balancer *row, const char *new_key, const char *new_value)
3272 : : {
3273 : : struct ovsdb_datum *datum;
3274 : :
3275 [ # # ]: 0 : ovs_assert(inited);
3276 : :
3277 : 0 : datum = xmalloc(sizeof *datum);
3278 : 0 : datum->n = 1;
3279 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3280 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
3281 : :
3282 : 0 : datum->keys[0].string = xstrdup(new_key);
3283 : 0 : datum->values[0].string = xstrdup(new_value);
3284 : :
3285 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
3286 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_EXTERNAL_IDS],
3287 : : datum);
3288 : 0 : }
3289 : :
3290 : : /* Deletes an element of the "external_ids" map column from the "Load_Balancer" table in 'row'
3291 : : * given the key value 'delete_key'.
3292 : : *
3293 : : */
3294 : : void
3295 : 0 : nbrec_load_balancer_update_external_ids_delkey(const struct nbrec_load_balancer *row, const char *delete_key)
3296 : : {
3297 : : struct ovsdb_datum *datum;
3298 : :
3299 [ # # ]: 0 : ovs_assert(inited);
3300 : :
3301 : 0 : datum = xmalloc(sizeof *datum);
3302 : 0 : datum->n = 1;
3303 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3304 : 0 : datum->values = NULL;
3305 : :
3306 : 0 : datum->keys[0].string = xstrdup(delete_key);
3307 : :
3308 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
3309 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_EXTERNAL_IDS],
3310 : : datum);
3311 : 0 : }
3312 : :
3313 : : /* Adds the value 'new_value' to the "protocol" set column from the "Load_Balancer" table
3314 : : * in 'row'.
3315 : : *
3316 : : */
3317 : : void
3318 : 0 : nbrec_load_balancer_update_protocol_addvalue(const struct nbrec_load_balancer *row, const char *new_value)
3319 : : {
3320 : : struct ovsdb_datum *datum;
3321 : :
3322 [ # # ]: 0 : ovs_assert(inited);
3323 : :
3324 : 0 : datum = xmalloc(sizeof *datum);
3325 : 0 : datum->n = 1;
3326 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
3327 : 0 : datum->values = NULL;
3328 : :
3329 : 0 : datum->keys[0].string = xstrdup(new_value);
3330 : :
3331 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
3332 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_PROTOCOL],
3333 : : datum);
3334 : 0 : }
3335 : :
3336 : : /* Deletes the value 'delete_value' from the "protocol" set column from the
3337 : : * "Load_Balancer" table in 'row'.
3338 : : *
3339 : : */
3340 : : void
3341 : 0 : nbrec_load_balancer_update_protocol_delvalue(const struct nbrec_load_balancer *row, const char *delete_value)
3342 : : {
3343 : : struct ovsdb_datum *datum;
3344 : :
3345 [ # # ]: 0 : ovs_assert(inited);
3346 : :
3347 : 0 : datum = xmalloc(sizeof *datum);
3348 : 0 : datum->n = 1;
3349 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
3350 : 0 : datum->values = NULL;
3351 : :
3352 : 0 : datum->keys[0].string = xstrdup(delete_value);
3353 : :
3354 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
3355 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_PROTOCOL],
3356 : : datum);
3357 : 0 : }
3358 : :
3359 : : /* Sets an element of the "vips" map column from the "Load_Balancer" table in 'row'
3360 : : * to 'new_value' given the key value 'new_key'.
3361 : : *
3362 : : */
3363 : : void
3364 : 0 : nbrec_load_balancer_update_vips_setkey(const struct nbrec_load_balancer *row, const char *new_key, const char *new_value)
3365 : : {
3366 : : struct ovsdb_datum *datum;
3367 : :
3368 [ # # ]: 0 : ovs_assert(inited);
3369 : :
3370 : 0 : datum = xmalloc(sizeof *datum);
3371 : 0 : datum->n = 1;
3372 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3373 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
3374 : :
3375 : 0 : datum->keys[0].string = xstrdup(new_key);
3376 : 0 : datum->values[0].string = xstrdup(new_value);
3377 : :
3378 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
3379 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_VIPS],
3380 : : datum);
3381 : 0 : }
3382 : :
3383 : : /* Deletes an element of the "vips" map column from the "Load_Balancer" table in 'row'
3384 : : * given the key value 'delete_key'.
3385 : : *
3386 : : */
3387 : : void
3388 : 0 : nbrec_load_balancer_update_vips_delkey(const struct nbrec_load_balancer *row, const char *delete_key)
3389 : : {
3390 : : struct ovsdb_datum *datum;
3391 : :
3392 [ # # ]: 0 : ovs_assert(inited);
3393 : :
3394 : 0 : datum = xmalloc(sizeof *datum);
3395 : 0 : datum->n = 1;
3396 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3397 : 0 : datum->values = NULL;
3398 : :
3399 : 0 : datum->keys[0].string = xstrdup(delete_key);
3400 : :
3401 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
3402 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_VIPS],
3403 : : datum);
3404 : 0 : }
3405 : :
3406 : : /* Sets the "external_ids" column's value from the "Load_Balancer" table in 'row'
3407 : : * to 'external_ids'.
3408 : : *
3409 : : * The caller retains ownership of 'external_ids' and everything in it. */
3410 : : void
3411 : 0 : nbrec_load_balancer_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
3412 : : {
3413 : : struct ovsdb_datum datum;
3414 : :
3415 [ # # ]: 0 : ovs_assert(inited);
3416 [ # # ]: 0 : if (external_ids) {
3417 : : struct smap_node *node;
3418 : : size_t i;
3419 : :
3420 : 0 : datum.n = smap_count(external_ids);
3421 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3422 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3423 : :
3424 : 0 : i = 0;
3425 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
3426 : 0 : datum.keys[i].string = xstrdup(node->key);
3427 : 0 : datum.values[i].string = xstrdup(node->value);
3428 : 0 : i++;
3429 : : }
3430 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3431 : : } else {
3432 : 0 : ovsdb_datum_init_empty(&datum);
3433 : : }
3434 : :
3435 : 0 : ovsdb_idl_condition_add_clause(idl,
3436 : : &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER],
3437 : : function,
3438 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_EXTERNAL_IDS],
3439 : : &datum);
3440 : :
3441 : 0 : ovsdb_datum_destroy(&datum, &nbrec_load_balancer_col_external_ids.type);
3442 : 0 : }
3443 : :
3444 : :
3445 : : /* Sets the "protocol" column from the "Load_Balancer" table in 'row' to
3446 : : * the 'protocol' set.
3447 : : *
3448 : : * If "protocol" is null, the column will be the empty set,
3449 : : * otherwise it will contain the specified value.
3450 : : *
3451 : : * Argument constraints: either "udp" or "tcp"
3452 : : *
3453 : : * The caller retains ownership of the arguments. */
3454 : : void
3455 : 0 : nbrec_load_balancer_add_clause_protocol(struct ovsdb_idl *idl, enum ovsdb_function function, const char *protocol)
3456 : : {
3457 : : struct ovsdb_datum datum;
3458 : : union ovsdb_atom key;
3459 : :
3460 [ # # ]: 0 : ovs_assert(inited);
3461 [ # # ]: 0 : if (protocol) {
3462 : 0 : datum.n = 1;
3463 : 0 : datum.keys = &key;
3464 : 0 : key.string = CONST_CAST(char *, protocol);
3465 : : } else {
3466 : 0 : datum.n = 0;
3467 : 0 : datum.keys = NULL;
3468 : : }
3469 : 0 : datum.values = NULL;
3470 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER],
3471 : : function,
3472 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_PROTOCOL],
3473 : : &datum);
3474 : 0 : }
3475 : :
3476 : : /* Sets the "vips" column's value from the "Load_Balancer" table in 'row'
3477 : : * to 'vips'.
3478 : : *
3479 : : * The caller retains ownership of 'vips' and everything in it. */
3480 : : void
3481 : 0 : nbrec_load_balancer_add_clause_vips(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *vips)
3482 : : {
3483 : : struct ovsdb_datum datum;
3484 : :
3485 [ # # ]: 0 : ovs_assert(inited);
3486 [ # # ]: 0 : if (vips) {
3487 : : struct smap_node *node;
3488 : : size_t i;
3489 : :
3490 : 0 : datum.n = smap_count(vips);
3491 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3492 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3493 : :
3494 : 0 : i = 0;
3495 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, vips) {
3496 : 0 : datum.keys[i].string = xstrdup(node->key);
3497 : 0 : datum.values[i].string = xstrdup(node->value);
3498 : 0 : i++;
3499 : : }
3500 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3501 : : } else {
3502 : 0 : ovsdb_datum_init_empty(&datum);
3503 : : }
3504 : :
3505 : 0 : ovsdb_idl_condition_add_clause(idl,
3506 : : &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER],
3507 : : function,
3508 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_VIPS],
3509 : : &datum);
3510 : :
3511 : 0 : ovsdb_datum_destroy(&datum, &nbrec_load_balancer_col_vips.type);
3512 : 0 : }
3513 : :
3514 : : void
3515 : 0 : nbrec_load_balancer_add_clause_false(struct ovsdb_idl *idl)
3516 : : {
3517 : : struct ovsdb_datum datum;
3518 : :
3519 : 0 : ovsdb_datum_init_empty(&datum);
3520 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], OVSDB_F_FALSE, NULL, &datum);
3521 : 0 : }
3522 : : void
3523 : 0 : nbrec_load_balancer_add_clause_true(struct ovsdb_idl *idl)
3524 : : {
3525 : : struct ovsdb_datum datum;
3526 : :
3527 : 0 : ovsdb_datum_init_empty(&datum);
3528 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], OVSDB_F_TRUE, NULL, &datum);
3529 : 0 : }
3530 : :
3531 : : /* Sets the "external_ids" column's value from the "Load_Balancer" table in 'row'
3532 : : * to 'external_ids'.
3533 : : *
3534 : : * The caller retains ownership of 'external_ids' and everything in it. */
3535 : : void
3536 : 0 : nbrec_load_balancer_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
3537 : : {
3538 : : struct ovsdb_datum datum;
3539 : :
3540 [ # # ]: 0 : ovs_assert(inited);
3541 [ # # ]: 0 : if (external_ids) {
3542 : : struct smap_node *node;
3543 : : size_t i;
3544 : :
3545 : 0 : datum.n = smap_count(external_ids);
3546 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3547 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3548 : :
3549 : 0 : i = 0;
3550 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
3551 : 0 : datum.keys[i].string = xstrdup(node->key);
3552 : 0 : datum.values[i].string = xstrdup(node->value);
3553 : 0 : i++;
3554 : : }
3555 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3556 : : } else {
3557 : 0 : ovsdb_datum_init_empty(&datum);
3558 : : }
3559 : :
3560 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER],
3561 : : function,
3562 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_EXTERNAL_IDS],
3563 : : &datum);
3564 : :
3565 : 0 : ovsdb_datum_destroy(&datum, &nbrec_load_balancer_col_external_ids.type);
3566 : 0 : }
3567 : :
3568 : :
3569 : : /* Sets the "protocol" column from the "Load_Balancer" table in 'row' to
3570 : : * the 'protocol' set.
3571 : : *
3572 : : * If "protocol" is null, the column will be the empty set,
3573 : : * otherwise it will contain the specified value.
3574 : : *
3575 : : * Argument constraints: either "udp" or "tcp"
3576 : : *
3577 : : * The caller retains ownership of the arguments. */
3578 : : void
3579 : 0 : nbrec_load_balancer_remove_clause_protocol(struct ovsdb_idl *idl, enum ovsdb_function function, const char *protocol)
3580 : : {
3581 : : struct ovsdb_datum datum;
3582 : : union ovsdb_atom key;
3583 : :
3584 [ # # ]: 0 : ovs_assert(inited);
3585 [ # # ]: 0 : if (protocol) {
3586 : 0 : datum.n = 1;
3587 : 0 : datum.keys = &key;
3588 : 0 : key.string = CONST_CAST(char *, protocol);
3589 : : } else {
3590 : 0 : datum.n = 0;
3591 : 0 : datum.keys = NULL;
3592 : : }
3593 : 0 : datum.values = NULL;
3594 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER],
3595 : : function,
3596 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_PROTOCOL],
3597 : : &datum);
3598 : 0 : }
3599 : :
3600 : : /* Sets the "vips" column's value from the "Load_Balancer" table in 'row'
3601 : : * to 'vips'.
3602 : : *
3603 : : * The caller retains ownership of 'vips' and everything in it. */
3604 : : void
3605 : 0 : nbrec_load_balancer_remove_clause_vips(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *vips)
3606 : : {
3607 : : struct ovsdb_datum datum;
3608 : :
3609 [ # # ]: 0 : ovs_assert(inited);
3610 [ # # ]: 0 : if (vips) {
3611 : : struct smap_node *node;
3612 : : size_t i;
3613 : :
3614 : 0 : datum.n = smap_count(vips);
3615 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3616 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3617 : :
3618 : 0 : i = 0;
3619 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, vips) {
3620 : 0 : datum.keys[i].string = xstrdup(node->key);
3621 : 0 : datum.values[i].string = xstrdup(node->value);
3622 : 0 : i++;
3623 : : }
3624 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3625 : : } else {
3626 : 0 : ovsdb_datum_init_empty(&datum);
3627 : : }
3628 : :
3629 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER],
3630 : : function,
3631 : : &nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_COL_VIPS],
3632 : : &datum);
3633 : :
3634 : 0 : ovsdb_datum_destroy(&datum, &nbrec_load_balancer_col_vips.type);
3635 : 0 : }
3636 : :
3637 : : void
3638 : 0 : nbrec_load_balancer_remove_clause_false(struct ovsdb_idl *idl)
3639 : : {
3640 : : struct ovsdb_datum datum;
3641 : :
3642 : 0 : ovsdb_datum_init_empty(&datum);
3643 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], OVSDB_F_FALSE, NULL, &datum);
3644 : 0 : }
3645 : : void
3646 : 0 : nbrec_load_balancer_remove_clause_true(struct ovsdb_idl *idl)
3647 : : {
3648 : : struct ovsdb_datum datum;
3649 : :
3650 : 0 : ovsdb_datum_init_empty(&datum);
3651 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], OVSDB_F_TRUE, NULL, &datum);
3652 : 0 : }
3653 : :
3654 : : struct ovsdb_idl_column nbrec_load_balancer_columns[NBREC_LOAD_BALANCER_N_COLUMNS];
3655 : :
3656 : : static void
3657 : 932 : nbrec_load_balancer_columns_init(void)
3658 : : {
3659 : : struct ovsdb_idl_column *c;
3660 : :
3661 : : /* Initialize nbrec_load_balancer_col_external_ids. */
3662 : 932 : c = &nbrec_load_balancer_col_external_ids;
3663 : 932 : c->name = "external_ids";
3664 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3665 : 932 : c->type.key.u.string.minLen = 0;
3666 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
3667 : 932 : c->type.value.u.string.minLen = 0;
3668 : 932 : c->type.n_min = 0;
3669 : 932 : c->type.n_max = UINT_MAX;
3670 : 932 : c->mutable = true;
3671 : 932 : c->parse = nbrec_load_balancer_parse_external_ids;
3672 : 932 : c->unparse = nbrec_load_balancer_unparse_external_ids;
3673 : :
3674 : : /* Initialize nbrec_load_balancer_col_protocol. */
3675 : 932 : c = &nbrec_load_balancer_col_protocol;
3676 : 932 : c->name = "protocol";
3677 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3678 : 932 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
3679 : 932 : c->type.key.enum_->n = 2;
3680 : 932 : c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
3681 : 932 : c->type.key.enum_->keys[0].string = xstrdup("tcp");
3682 : 932 : c->type.key.enum_->keys[1].string = xstrdup("udp");
3683 : 932 : c->type.key.enum_->values = NULL;
3684 : 932 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
3685 : 932 : c->type.key.u.string.minLen = 0;
3686 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3687 : 932 : c->type.n_min = 0;
3688 : 932 : c->type.n_max = 1;
3689 : 932 : c->mutable = true;
3690 : 932 : c->parse = nbrec_load_balancer_parse_protocol;
3691 : 932 : c->unparse = nbrec_load_balancer_unparse_protocol;
3692 : :
3693 : : /* Initialize nbrec_load_balancer_col_vips. */
3694 : 932 : c = &nbrec_load_balancer_col_vips;
3695 : 932 : c->name = "vips";
3696 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3697 : 932 : c->type.key.u.string.minLen = 0;
3698 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
3699 : 932 : c->type.value.u.string.minLen = 0;
3700 : 932 : c->type.n_min = 0;
3701 : 932 : c->type.n_max = UINT_MAX;
3702 : 932 : c->mutable = true;
3703 : 932 : c->parse = nbrec_load_balancer_parse_vips;
3704 : 932 : c->unparse = nbrec_load_balancer_unparse_vips;
3705 : 932 : }
3706 : :
3707 : : /* Logical_Router table. */
3708 : :
3709 : : static void
3710 : 1811 : nbrec_logical_router_parse_enabled(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3711 : : {
3712 : 1811 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3713 : 1811 : size_t n = MIN(1, datum->n);
3714 : : size_t i;
3715 : :
3716 [ - + ]: 1811 : ovs_assert(inited);
3717 : 1811 : row->enabled = NULL;
3718 : 1811 : row->n_enabled = 0;
3719 [ + + ]: 1817 : for (i = 0; i < n; i++) {
3720 [ + - ]: 6 : if (!row->n_enabled) {
3721 : 6 : row->enabled = xmalloc(n * sizeof_bool);
3722 : : }
3723 : 6 : row->enabled[row->n_enabled] = datum->keys[i].boolean;
3724 : 6 : row->n_enabled++;
3725 : : }
3726 : 1811 : }
3727 : :
3728 : : static void
3729 : 1809 : nbrec_logical_router_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3730 : : {
3731 : 1809 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3732 : : size_t i;
3733 : :
3734 [ - + ]: 1809 : ovs_assert(inited);
3735 : 1809 : smap_init(&row->external_ids);
3736 [ - + ]: 1809 : for (i = 0; i < datum->n; i++) {
3737 : 0 : smap_add(&row->external_ids,
3738 : 0 : datum->keys[i].string,
3739 : 0 : datum->values[i].string);
3740 : : }
3741 : 1809 : }
3742 : :
3743 : : static void
3744 : 1810 : nbrec_logical_router_parse_load_balancer(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3745 : : {
3746 : 1810 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3747 : : size_t i;
3748 : :
3749 [ - + ]: 1810 : ovs_assert(inited);
3750 : 1810 : row->load_balancer = NULL;
3751 : 1810 : row->n_load_balancer = 0;
3752 [ + + ]: 1816 : for (i = 0; i < datum->n; i++) {
3753 : 6 : struct nbrec_load_balancer *keyRow = nbrec_load_balancer_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], &datum->keys[i].uuid));
3754 [ + - ]: 6 : if (keyRow) {
3755 [ + - ]: 6 : if (!row->n_load_balancer) {
3756 : 6 : row->load_balancer = xmalloc(datum->n * sizeof *row->load_balancer);
3757 : : }
3758 : 6 : row->load_balancer[row->n_load_balancer] = keyRow;
3759 : 6 : row->n_load_balancer++;
3760 : : }
3761 : : }
3762 : 1810 : }
3763 : :
3764 : : static void
3765 : 1845 : nbrec_logical_router_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3766 : : {
3767 : 1845 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3768 : :
3769 [ - + ]: 1845 : ovs_assert(inited);
3770 [ + - ]: 1845 : if (datum->n >= 1) {
3771 : 1845 : row->name = datum->keys[0].string;
3772 : : } else {
3773 : 0 : row->name = "";
3774 : : }
3775 : 1845 : }
3776 : :
3777 : : static void
3778 : 1812 : nbrec_logical_router_parse_nat(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3779 : : {
3780 : 1812 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3781 : : size_t i;
3782 : :
3783 [ - + ]: 1812 : ovs_assert(inited);
3784 : 1812 : row->nat = NULL;
3785 : 1812 : row->n_nat = 0;
3786 [ + + ]: 1847 : for (i = 0; i < datum->n; i++) {
3787 : 35 : struct nbrec_nat *keyRow = nbrec_nat_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_NAT], &datum->keys[i].uuid));
3788 [ + + ]: 35 : if (keyRow) {
3789 [ + + ]: 25 : if (!row->n_nat) {
3790 : 19 : row->nat = xmalloc(datum->n * sizeof *row->nat);
3791 : : }
3792 : 25 : row->nat[row->n_nat] = keyRow;
3793 : 25 : row->n_nat++;
3794 : : }
3795 : : }
3796 : 1812 : }
3797 : :
3798 : : static void
3799 : 1815 : nbrec_logical_router_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3800 : : {
3801 : 1815 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3802 : : size_t i;
3803 : :
3804 [ - + ]: 1815 : ovs_assert(inited);
3805 : 1815 : smap_init(&row->options);
3806 [ + + ]: 2110 : for (i = 0; i < datum->n; i++) {
3807 : 295 : smap_add(&row->options,
3808 : 295 : datum->keys[i].string,
3809 : 295 : datum->values[i].string);
3810 : : }
3811 : 1815 : }
3812 : :
3813 : : static void
3814 : 1875 : nbrec_logical_router_parse_ports(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3815 : : {
3816 : 1875 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3817 : : size_t i;
3818 : :
3819 [ - + ]: 1875 : ovs_assert(inited);
3820 : 1875 : row->ports = NULL;
3821 : 1875 : row->n_ports = 0;
3822 [ + + ]: 5266 : for (i = 0; i < datum->n; i++) {
3823 : 3391 : struct nbrec_logical_router_port *keyRow = nbrec_logical_router_port_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT], &datum->keys[i].uuid));
3824 [ + + ]: 3391 : if (keyRow) {
3825 [ + + ]: 2021 : if (!row->n_ports) {
3826 : 1095 : row->ports = xmalloc(datum->n * sizeof *row->ports);
3827 : : }
3828 : 2021 : row->ports[row->n_ports] = keyRow;
3829 : 2021 : row->n_ports++;
3830 : : }
3831 : : }
3832 : 1875 : }
3833 : :
3834 : : static void
3835 : 1847 : nbrec_logical_router_parse_static_routes(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3836 : : {
3837 : 1847 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3838 : : size_t i;
3839 : :
3840 [ - + ]: 1847 : ovs_assert(inited);
3841 : 1847 : row->static_routes = NULL;
3842 : 1847 : row->n_static_routes = 0;
3843 [ + + ]: 2581 : for (i = 0; i < datum->n; i++) {
3844 : 734 : struct nbrec_logical_router_static_route *keyRow = nbrec_logical_router_static_route_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE], &datum->keys[i].uuid));
3845 [ + + ]: 734 : if (keyRow) {
3846 [ + + ]: 724 : if (!row->n_static_routes) {
3847 : 506 : row->static_routes = xmalloc(datum->n * sizeof *row->static_routes);
3848 : : }
3849 : 724 : row->static_routes[row->n_static_routes] = keyRow;
3850 : 724 : row->n_static_routes++;
3851 : : }
3852 : : }
3853 : 1847 : }
3854 : :
3855 : : static void
3856 : 1849 : nbrec_logical_router_unparse_enabled(struct ovsdb_idl_row *row_)
3857 : : {
3858 : 1849 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3859 : :
3860 [ - + ]: 1849 : ovs_assert(inited);
3861 : 1849 : free(row->enabled);
3862 : 1849 : }
3863 : :
3864 : : static void
3865 : 1847 : nbrec_logical_router_unparse_external_ids(struct ovsdb_idl_row *row_)
3866 : : {
3867 : 1847 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3868 : :
3869 [ - + ]: 1847 : ovs_assert(inited);
3870 : 1847 : smap_destroy(&row->external_ids);
3871 : 1847 : }
3872 : :
3873 : : static void
3874 : 1848 : nbrec_logical_router_unparse_load_balancer(struct ovsdb_idl_row *row_)
3875 : : {
3876 : 1848 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3877 : :
3878 [ - + ]: 1848 : ovs_assert(inited);
3879 : 1848 : free(row->load_balancer);
3880 : 1848 : }
3881 : :
3882 : : static void
3883 : 1883 : nbrec_logical_router_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
3884 : : {
3885 : : /* Nothing to do. */
3886 : 1883 : }
3887 : :
3888 : : static void
3889 : 1850 : nbrec_logical_router_unparse_nat(struct ovsdb_idl_row *row_)
3890 : : {
3891 : 1850 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3892 : :
3893 [ - + ]: 1850 : ovs_assert(inited);
3894 : 1850 : free(row->nat);
3895 : 1850 : }
3896 : :
3897 : : static void
3898 : 1853 : nbrec_logical_router_unparse_options(struct ovsdb_idl_row *row_)
3899 : : {
3900 : 1853 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3901 : :
3902 [ - + ]: 1853 : ovs_assert(inited);
3903 : 1853 : smap_destroy(&row->options);
3904 : 1853 : }
3905 : :
3906 : : static void
3907 : 1913 : nbrec_logical_router_unparse_ports(struct ovsdb_idl_row *row_)
3908 : : {
3909 : 1913 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3910 : :
3911 [ - + ]: 1913 : ovs_assert(inited);
3912 : 1913 : free(row->ports);
3913 : 1913 : }
3914 : :
3915 : : static void
3916 : 1885 : nbrec_logical_router_unparse_static_routes(struct ovsdb_idl_row *row_)
3917 : : {
3918 : 1885 : struct nbrec_logical_router *row = nbrec_logical_router_cast(row_);
3919 : :
3920 [ - + ]: 1885 : ovs_assert(inited);
3921 : 1885 : free(row->static_routes);
3922 : 1885 : }
3923 : :
3924 : : static void
3925 : 689 : nbrec_logical_router_init__(struct ovsdb_idl_row *row)
3926 : : {
3927 : 689 : nbrec_logical_router_init(nbrec_logical_router_cast(row));
3928 : 689 : }
3929 : :
3930 : : /* Clears the contents of 'row' in table "Logical_Router". */
3931 : : void
3932 : 689 : nbrec_logical_router_init(struct nbrec_logical_router *row)
3933 : : {
3934 : 689 : memset(row, 0, sizeof *row);
3935 : 689 : smap_init(&row->external_ids);
3936 : 689 : smap_init(&row->options);
3937 : 689 : }
3938 : :
3939 : : /* Searches table "Logical_Router" in 'idl' for a row with UUID 'uuid'. Returns
3940 : : * a pointer to the row if there is one, otherwise a null pointer. */
3941 : : const struct nbrec_logical_router *
3942 : 0 : nbrec_logical_router_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
3943 : : {
3944 : 0 : return nbrec_logical_router_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER], uuid));
3945 : : }
3946 : :
3947 : : /* Returns a row in table "Logical_Router" in 'idl', or a null pointer if that
3948 : : * table is empty.
3949 : : *
3950 : : * Database tables are internally maintained as hash tables, so adding or
3951 : : * removing rows while traversing the same table can cause some rows to be
3952 : : * visited twice or not at apply. */
3953 : : const struct nbrec_logical_router *
3954 : 2430 : nbrec_logical_router_first(const struct ovsdb_idl *idl)
3955 : : {
3956 : 2430 : return nbrec_logical_router_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER]));
3957 : : }
3958 : :
3959 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
3960 : : * is the last row in its table. */
3961 : : const struct nbrec_logical_router *
3962 : 2006 : nbrec_logical_router_next(const struct nbrec_logical_router *row)
3963 : : {
3964 : 2006 : return nbrec_logical_router_cast(ovsdb_idl_next_row(&row->header_));
3965 : : }
3966 : :
3967 : 0 : unsigned int nbrec_logical_router_get_seqno(const struct ovsdb_idl *idl)
3968 : : {
3969 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER]);
3970 : : }
3971 : :
3972 : 0 : unsigned int nbrec_logical_router_row_get_seqno(const struct nbrec_logical_router *row, enum ovsdb_idl_change change)
3973 : : {
3974 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
3975 : : }
3976 : :
3977 : : const struct nbrec_logical_router *
3978 : 0 : nbrec_logical_router_track_get_first(const struct ovsdb_idl *idl)
3979 : : {
3980 : 0 : return nbrec_logical_router_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER]));
3981 : : }
3982 : :
3983 : : const struct nbrec_logical_router
3984 : 0 : *nbrec_logical_router_track_get_next(const struct nbrec_logical_router *row)
3985 : : {
3986 : 0 : return nbrec_logical_router_cast(ovsdb_idl_track_get_next(&row->header_));
3987 : : }
3988 : :
3989 : :
3990 : : /* Deletes 'row' from table "Logical_Router". 'row' may be freed, so it must not be
3991 : : * accessed afterward.
3992 : : *
3993 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3994 : : void
3995 : 2 : nbrec_logical_router_delete(const struct nbrec_logical_router *row)
3996 : : {
3997 : 2 : ovsdb_idl_txn_delete(&row->header_);
3998 : 2 : }
3999 : :
4000 : : /* Inserts and returns a new row in the table "Logical_Router" in the database
4001 : : * with open transaction 'txn'.
4002 : : *
4003 : : * The new row is assigned a randomly generated provisional UUID.
4004 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
4005 : : * but the IDL will replace any uses of the provisional UUID in the
4006 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
4007 : : struct nbrec_logical_router *
4008 : 24 : nbrec_logical_router_insert(struct ovsdb_idl_txn *txn)
4009 : : {
4010 : 24 : return nbrec_logical_router_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER], NULL));
4011 : : }
4012 : :
4013 : : bool
4014 : 0 : nbrec_logical_router_is_updated(const struct nbrec_logical_router *row, enum nbrec_logical_router_column_id column)
4015 : : {
4016 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_logical_router_columns[column]);
4017 : : }
4018 : :
4019 : : /* Causes the original contents of column "enabled" in 'row' to be
4020 : : * verified as a prerequisite to completing the transaction. That is, if
4021 : : * "enabled" in 'row' changed (or if 'row' was deleted) between the
4022 : : * time that the IDL originally read its contents and the time that the
4023 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4024 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4025 : : * change has already been received).
4026 : : *
4027 : : * The intention is that, to ensure that no transaction commits based on dirty
4028 : : * reads, an application should call this function any time "enabled" is
4029 : : * read as part of a read-modify-write operation.
4030 : : *
4031 : : * In some cases this function reduces to a no-op, because the current value
4032 : : * of "enabled" is already known:
4033 : : *
4034 : : * - If 'row' is a row created by the current transaction (returned by
4035 : : * nbrec_logical_router_insert()).
4036 : : *
4037 : : * - If "enabled" has already been modified (with
4038 : : * nbrec_logical_router_set_enabled()) within the current transaction.
4039 : : *
4040 : : * Because of the latter property, always call this function *before*
4041 : : * nbrec_logical_router_set_enabled() for a given read-modify-write.
4042 : : *
4043 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4044 : : void
4045 : 0 : nbrec_logical_router_verify_enabled(const struct nbrec_logical_router *row)
4046 : : {
4047 [ # # ]: 0 : ovs_assert(inited);
4048 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_ENABLED]);
4049 : 0 : }
4050 : :
4051 : : /* Causes the original contents of column "external_ids" in 'row' to be
4052 : : * verified as a prerequisite to completing the transaction. That is, if
4053 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
4054 : : * time that the IDL originally read its contents and the time that the
4055 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4056 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4057 : : * change has already been received).
4058 : : *
4059 : : * The intention is that, to ensure that no transaction commits based on dirty
4060 : : * reads, an application should call this function any time "external_ids" is
4061 : : * read as part of a read-modify-write operation.
4062 : : *
4063 : : * In some cases this function reduces to a no-op, because the current value
4064 : : * of "external_ids" is already known:
4065 : : *
4066 : : * - If 'row' is a row created by the current transaction (returned by
4067 : : * nbrec_logical_router_insert()).
4068 : : *
4069 : : * - If "external_ids" has already been modified (with
4070 : : * nbrec_logical_router_set_external_ids()) within the current transaction.
4071 : : *
4072 : : * Because of the latter property, always call this function *before*
4073 : : * nbrec_logical_router_set_external_ids() for a given read-modify-write.
4074 : : *
4075 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4076 : : void
4077 : 0 : nbrec_logical_router_verify_external_ids(const struct nbrec_logical_router *row)
4078 : : {
4079 [ # # ]: 0 : ovs_assert(inited);
4080 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_EXTERNAL_IDS]);
4081 : 0 : }
4082 : :
4083 : : /* Causes the original contents of column "load_balancer" in 'row' to be
4084 : : * verified as a prerequisite to completing the transaction. That is, if
4085 : : * "load_balancer" in 'row' changed (or if 'row' was deleted) between the
4086 : : * time that the IDL originally read its contents and the time that the
4087 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4088 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4089 : : * change has already been received).
4090 : : *
4091 : : * The intention is that, to ensure that no transaction commits based on dirty
4092 : : * reads, an application should call this function any time "load_balancer" is
4093 : : * read as part of a read-modify-write operation.
4094 : : *
4095 : : * In some cases this function reduces to a no-op, because the current value
4096 : : * of "load_balancer" is already known:
4097 : : *
4098 : : * - If 'row' is a row created by the current transaction (returned by
4099 : : * nbrec_logical_router_insert()).
4100 : : *
4101 : : * - If "load_balancer" has already been modified (with
4102 : : * nbrec_logical_router_set_load_balancer()) within the current transaction.
4103 : : *
4104 : : * Because of the latter property, always call this function *before*
4105 : : * nbrec_logical_router_set_load_balancer() for a given read-modify-write.
4106 : : *
4107 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4108 : : void
4109 : 0 : nbrec_logical_router_verify_load_balancer(const struct nbrec_logical_router *row)
4110 : : {
4111 [ # # ]: 0 : ovs_assert(inited);
4112 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_LOAD_BALANCER]);
4113 : 0 : }
4114 : :
4115 : : /* Causes the original contents of column "name" in 'row' to be
4116 : : * verified as a prerequisite to completing the transaction. That is, if
4117 : : * "name" in 'row' changed (or if 'row' was deleted) between the
4118 : : * time that the IDL originally read its contents and the time that the
4119 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4120 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4121 : : * change has already been received).
4122 : : *
4123 : : * The intention is that, to ensure that no transaction commits based on dirty
4124 : : * reads, an application should call this function any time "name" is
4125 : : * read as part of a read-modify-write operation.
4126 : : *
4127 : : * In some cases this function reduces to a no-op, because the current value
4128 : : * of "name" is already known:
4129 : : *
4130 : : * - If 'row' is a row created by the current transaction (returned by
4131 : : * nbrec_logical_router_insert()).
4132 : : *
4133 : : * - If "name" has already been modified (with
4134 : : * nbrec_logical_router_set_name()) within the current transaction.
4135 : : *
4136 : : * Because of the latter property, always call this function *before*
4137 : : * nbrec_logical_router_set_name() for a given read-modify-write.
4138 : : *
4139 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4140 : : void
4141 : 0 : nbrec_logical_router_verify_name(const struct nbrec_logical_router *row)
4142 : : {
4143 [ # # ]: 0 : ovs_assert(inited);
4144 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAME]);
4145 : 0 : }
4146 : :
4147 : : /* Causes the original contents of column "nat" in 'row' to be
4148 : : * verified as a prerequisite to completing the transaction. That is, if
4149 : : * "nat" in 'row' changed (or if 'row' was deleted) between the
4150 : : * time that the IDL originally read its contents and the time that the
4151 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4152 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4153 : : * change has already been received).
4154 : : *
4155 : : * The intention is that, to ensure that no transaction commits based on dirty
4156 : : * reads, an application should call this function any time "nat" is
4157 : : * read as part of a read-modify-write operation.
4158 : : *
4159 : : * In some cases this function reduces to a no-op, because the current value
4160 : : * of "nat" is already known:
4161 : : *
4162 : : * - If 'row' is a row created by the current transaction (returned by
4163 : : * nbrec_logical_router_insert()).
4164 : : *
4165 : : * - If "nat" has already been modified (with
4166 : : * nbrec_logical_router_set_nat()) within the current transaction.
4167 : : *
4168 : : * Because of the latter property, always call this function *before*
4169 : : * nbrec_logical_router_set_nat() for a given read-modify-write.
4170 : : *
4171 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4172 : : void
4173 : 0 : nbrec_logical_router_verify_nat(const struct nbrec_logical_router *row)
4174 : : {
4175 [ # # ]: 0 : ovs_assert(inited);
4176 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAT]);
4177 : 0 : }
4178 : :
4179 : : /* Causes the original contents of column "options" in 'row' to be
4180 : : * verified as a prerequisite to completing the transaction. That is, if
4181 : : * "options" in 'row' changed (or if 'row' was deleted) between the
4182 : : * time that the IDL originally read its contents and the time that the
4183 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4184 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4185 : : * change has already been received).
4186 : : *
4187 : : * The intention is that, to ensure that no transaction commits based on dirty
4188 : : * reads, an application should call this function any time "options" is
4189 : : * read as part of a read-modify-write operation.
4190 : : *
4191 : : * In some cases this function reduces to a no-op, because the current value
4192 : : * of "options" is already known:
4193 : : *
4194 : : * - If 'row' is a row created by the current transaction (returned by
4195 : : * nbrec_logical_router_insert()).
4196 : : *
4197 : : * - If "options" has already been modified (with
4198 : : * nbrec_logical_router_set_options()) within the current transaction.
4199 : : *
4200 : : * Because of the latter property, always call this function *before*
4201 : : * nbrec_logical_router_set_options() for a given read-modify-write.
4202 : : *
4203 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4204 : : void
4205 : 0 : nbrec_logical_router_verify_options(const struct nbrec_logical_router *row)
4206 : : {
4207 [ # # ]: 0 : ovs_assert(inited);
4208 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_OPTIONS]);
4209 : 0 : }
4210 : :
4211 : : /* Causes the original contents of column "ports" in 'row' to be
4212 : : * verified as a prerequisite to completing the transaction. That is, if
4213 : : * "ports" in 'row' changed (or if 'row' was deleted) between the
4214 : : * time that the IDL originally read its contents and the time that the
4215 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4216 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4217 : : * change has already been received).
4218 : : *
4219 : : * The intention is that, to ensure that no transaction commits based on dirty
4220 : : * reads, an application should call this function any time "ports" is
4221 : : * read as part of a read-modify-write operation.
4222 : : *
4223 : : * In some cases this function reduces to a no-op, because the current value
4224 : : * of "ports" is already known:
4225 : : *
4226 : : * - If 'row' is a row created by the current transaction (returned by
4227 : : * nbrec_logical_router_insert()).
4228 : : *
4229 : : * - If "ports" has already been modified (with
4230 : : * nbrec_logical_router_set_ports()) within the current transaction.
4231 : : *
4232 : : * Because of the latter property, always call this function *before*
4233 : : * nbrec_logical_router_set_ports() for a given read-modify-write.
4234 : : *
4235 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4236 : : void
4237 : 64 : nbrec_logical_router_verify_ports(const struct nbrec_logical_router *row)
4238 : : {
4239 [ - + ]: 64 : ovs_assert(inited);
4240 : 64 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_PORTS]);
4241 : 64 : }
4242 : :
4243 : : /* Causes the original contents of column "static_routes" in 'row' to be
4244 : : * verified as a prerequisite to completing the transaction. That is, if
4245 : : * "static_routes" in 'row' changed (or if 'row' was deleted) between the
4246 : : * time that the IDL originally read its contents and the time that the
4247 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4248 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4249 : : * change has already been received).
4250 : : *
4251 : : * The intention is that, to ensure that no transaction commits based on dirty
4252 : : * reads, an application should call this function any time "static_routes" is
4253 : : * read as part of a read-modify-write operation.
4254 : : *
4255 : : * In some cases this function reduces to a no-op, because the current value
4256 : : * of "static_routes" is already known:
4257 : : *
4258 : : * - If 'row' is a row created by the current transaction (returned by
4259 : : * nbrec_logical_router_insert()).
4260 : : *
4261 : : * - If "static_routes" has already been modified (with
4262 : : * nbrec_logical_router_set_static_routes()) within the current transaction.
4263 : : *
4264 : : * Because of the latter property, always call this function *before*
4265 : : * nbrec_logical_router_set_static_routes() for a given read-modify-write.
4266 : : *
4267 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4268 : : void
4269 : 35 : nbrec_logical_router_verify_static_routes(const struct nbrec_logical_router *row)
4270 : : {
4271 [ - + ]: 35 : ovs_assert(inited);
4272 : 35 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_STATIC_ROUTES]);
4273 : 35 : }
4274 : :
4275 : : /* Returns the "enabled" column's value from the "Logical_Router" table in 'row'
4276 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4277 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4278 : : * for a given key than implementing the same operation on the "cooked"
4279 : : * form in 'row'.
4280 : : *
4281 : : * 'key_type' must be OVSDB_TYPE_BOOLEAN.
4282 : : * (This helps to avoid silent bugs if someone changes enabled's
4283 : : * type without updating the caller.)
4284 : : *
4285 : : * The caller must not modify or free the returned value.
4286 : : *
4287 : : * Various kinds of changes can invalidate the returned value: modifying
4288 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4289 : : * If the returned value is needed for a long time, it is best to make a copy
4290 : : * of it with ovsdb_datum_clone().
4291 : : *
4292 : : * This function is rarely useful, since it is easier to access the value
4293 : : * directly through the "enabled" member in nbrec_logical_router. */
4294 : : const struct ovsdb_datum *
4295 : 0 : nbrec_logical_router_get_enabled(const struct nbrec_logical_router *row,
4296 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4297 : : {
4298 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
4299 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_enabled);
4300 : : }
4301 : :
4302 : : /* Returns the "external_ids" column's value from the "Logical_Router" table in 'row'
4303 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4304 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4305 : : * for a given key than implementing the same operation on the "cooked"
4306 : : * form in 'row'.
4307 : : *
4308 : : * 'key_type' must be OVSDB_TYPE_STRING.
4309 : : * 'value_type' must be OVSDB_TYPE_STRING.
4310 : : * (This helps to avoid silent bugs if someone changes external_ids's
4311 : : * type without updating the caller.)
4312 : : *
4313 : : * The caller must not modify or free the returned value.
4314 : : *
4315 : : * Various kinds of changes can invalidate the returned value: modifying
4316 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4317 : : * If the returned value is needed for a long time, it is best to make a copy
4318 : : * of it with ovsdb_datum_clone().
4319 : : *
4320 : : * This function is rarely useful, since it is easier to access the value
4321 : : * directly through the "external_ids" member in nbrec_logical_router. */
4322 : : const struct ovsdb_datum *
4323 : 0 : nbrec_logical_router_get_external_ids(const struct nbrec_logical_router *row,
4324 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
4325 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
4326 : : {
4327 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
4328 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
4329 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_external_ids);
4330 : : }
4331 : :
4332 : : /* Returns the "load_balancer" column's value from the "Logical_Router" table in 'row'
4333 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4334 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4335 : : * for a given key than implementing the same operation on the "cooked"
4336 : : * form in 'row'.
4337 : : *
4338 : : * 'key_type' must be OVSDB_TYPE_UUID.
4339 : : * (This helps to avoid silent bugs if someone changes load_balancer's
4340 : : * type without updating the caller.)
4341 : : *
4342 : : * The caller must not modify or free the returned value.
4343 : : *
4344 : : * Various kinds of changes can invalidate the returned value: modifying
4345 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4346 : : * If the returned value is needed for a long time, it is best to make a copy
4347 : : * of it with ovsdb_datum_clone().
4348 : : *
4349 : : * This function is rarely useful, since it is easier to access the value
4350 : : * directly through the "load_balancer" member in nbrec_logical_router. */
4351 : : const struct ovsdb_datum *
4352 : 0 : nbrec_logical_router_get_load_balancer(const struct nbrec_logical_router *row,
4353 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4354 : : {
4355 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
4356 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_load_balancer);
4357 : : }
4358 : :
4359 : : /* Returns the "name" column's value from the "Logical_Router" table in 'row'
4360 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4361 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4362 : : * for a given key than implementing the same operation on the "cooked"
4363 : : * form in 'row'.
4364 : : *
4365 : : * 'key_type' must be OVSDB_TYPE_STRING.
4366 : : * (This helps to avoid silent bugs if someone changes name's
4367 : : * type without updating the caller.)
4368 : : *
4369 : : * The caller must not modify or free the returned value.
4370 : : *
4371 : : * Various kinds of changes can invalidate the returned value: modifying
4372 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4373 : : * If the returned value is needed for a long time, it is best to make a copy
4374 : : * of it with ovsdb_datum_clone().
4375 : : *
4376 : : * This function is rarely useful, since it is easier to access the value
4377 : : * directly through the "name" member in nbrec_logical_router. */
4378 : : const struct ovsdb_datum *
4379 : 0 : nbrec_logical_router_get_name(const struct nbrec_logical_router *row,
4380 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4381 : : {
4382 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
4383 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_name);
4384 : : }
4385 : :
4386 : : /* Returns the "nat" column's value from the "Logical_Router" table in 'row'
4387 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4388 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4389 : : * for a given key than implementing the same operation on the "cooked"
4390 : : * form in 'row'.
4391 : : *
4392 : : * 'key_type' must be OVSDB_TYPE_UUID.
4393 : : * (This helps to avoid silent bugs if someone changes nat's
4394 : : * type without updating the caller.)
4395 : : *
4396 : : * The caller must not modify or free the returned value.
4397 : : *
4398 : : * Various kinds of changes can invalidate the returned value: modifying
4399 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4400 : : * If the returned value is needed for a long time, it is best to make a copy
4401 : : * of it with ovsdb_datum_clone().
4402 : : *
4403 : : * This function is rarely useful, since it is easier to access the value
4404 : : * directly through the "nat" member in nbrec_logical_router. */
4405 : : const struct ovsdb_datum *
4406 : 0 : nbrec_logical_router_get_nat(const struct nbrec_logical_router *row,
4407 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4408 : : {
4409 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
4410 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_nat);
4411 : : }
4412 : :
4413 : : /* Returns the "options" column's value from the "Logical_Router" table in 'row'
4414 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4415 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4416 : : * for a given key than implementing the same operation on the "cooked"
4417 : : * form in 'row'.
4418 : : *
4419 : : * 'key_type' must be OVSDB_TYPE_STRING.
4420 : : * 'value_type' must be OVSDB_TYPE_STRING.
4421 : : * (This helps to avoid silent bugs if someone changes options's
4422 : : * type without updating the caller.)
4423 : : *
4424 : : * The caller must not modify or free the returned value.
4425 : : *
4426 : : * Various kinds of changes can invalidate the returned value: modifying
4427 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4428 : : * If the returned value is needed for a long time, it is best to make a copy
4429 : : * of it with ovsdb_datum_clone().
4430 : : *
4431 : : * This function is rarely useful, since it is easier to access the value
4432 : : * directly through the "options" member in nbrec_logical_router. */
4433 : : const struct ovsdb_datum *
4434 : 0 : nbrec_logical_router_get_options(const struct nbrec_logical_router *row,
4435 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
4436 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
4437 : : {
4438 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
4439 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
4440 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_options);
4441 : : }
4442 : :
4443 : : /* Returns the "ports" column's value from the "Logical_Router" table in 'row'
4444 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4445 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4446 : : * for a given key than implementing the same operation on the "cooked"
4447 : : * form in 'row'.
4448 : : *
4449 : : * 'key_type' must be OVSDB_TYPE_UUID.
4450 : : * (This helps to avoid silent bugs if someone changes ports's
4451 : : * type without updating the caller.)
4452 : : *
4453 : : * The caller must not modify or free the returned value.
4454 : : *
4455 : : * Various kinds of changes can invalidate the returned value: modifying
4456 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4457 : : * If the returned value is needed for a long time, it is best to make a copy
4458 : : * of it with ovsdb_datum_clone().
4459 : : *
4460 : : * This function is rarely useful, since it is easier to access the value
4461 : : * directly through the "ports" member in nbrec_logical_router. */
4462 : : const struct ovsdb_datum *
4463 : 0 : nbrec_logical_router_get_ports(const struct nbrec_logical_router *row,
4464 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4465 : : {
4466 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
4467 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_ports);
4468 : : }
4469 : :
4470 : : /* Returns the "static_routes" column's value from the "Logical_Router" table in 'row'
4471 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4472 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4473 : : * for a given key than implementing the same operation on the "cooked"
4474 : : * form in 'row'.
4475 : : *
4476 : : * 'key_type' must be OVSDB_TYPE_UUID.
4477 : : * (This helps to avoid silent bugs if someone changes static_routes's
4478 : : * type without updating the caller.)
4479 : : *
4480 : : * The caller must not modify or free the returned value.
4481 : : *
4482 : : * Various kinds of changes can invalidate the returned value: modifying
4483 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4484 : : * If the returned value is needed for a long time, it is best to make a copy
4485 : : * of it with ovsdb_datum_clone().
4486 : : *
4487 : : * This function is rarely useful, since it is easier to access the value
4488 : : * directly through the "static_routes" member in nbrec_logical_router. */
4489 : : const struct ovsdb_datum *
4490 : 0 : nbrec_logical_router_get_static_routes(const struct nbrec_logical_router *row,
4491 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4492 : : {
4493 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
4494 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_col_static_routes);
4495 : : }
4496 : :
4497 : : /* Sets the "enabled" column from the "Logical_Router" table in 'row' to
4498 : : * the 'enabled' set with 'n_enabled' entries.
4499 : : *
4500 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
4501 : : * may be NULL.
4502 : : *
4503 : : * The caller retains ownership of the arguments. */
4504 : : void
4505 : 0 : nbrec_logical_router_set_enabled(const struct nbrec_logical_router *row, const bool *enabled, size_t n_enabled)
4506 : : {
4507 : : struct ovsdb_datum datum;
4508 : : union ovsdb_atom key;
4509 : :
4510 [ # # ]: 0 : ovs_assert(inited);
4511 [ # # ]: 0 : if (n_enabled) {
4512 : 0 : datum.n = 1;
4513 : 0 : datum.keys = &key;
4514 : 0 : key.boolean = *enabled;
4515 : : } else {
4516 : 0 : datum.n = 0;
4517 : 0 : datum.keys = NULL;
4518 : : }
4519 : 0 : datum.values = NULL;
4520 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_ENABLED], &datum);
4521 : 0 : }
4522 : :
4523 : : /* Sets the "external_ids" column's value from the "Logical_Router" table in 'row'
4524 : : * to 'external_ids'.
4525 : : *
4526 : : * The caller retains ownership of 'external_ids' and everything in it. */
4527 : : void
4528 : 0 : nbrec_logical_router_set_external_ids(const struct nbrec_logical_router *row, const struct smap *external_ids)
4529 : : {
4530 : : struct ovsdb_datum datum;
4531 : :
4532 [ # # ]: 0 : ovs_assert(inited);
4533 [ # # ]: 0 : if (external_ids) {
4534 : : struct smap_node *node;
4535 : : size_t i;
4536 : :
4537 : 0 : datum.n = smap_count(external_ids);
4538 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
4539 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
4540 : :
4541 : 0 : i = 0;
4542 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
4543 : 0 : datum.keys[i].string = xstrdup(node->key);
4544 : 0 : datum.values[i].string = xstrdup(node->value);
4545 : 0 : i++;
4546 : : }
4547 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
4548 : : } else {
4549 : 0 : ovsdb_datum_init_empty(&datum);
4550 : : }
4551 : 0 : ovsdb_idl_txn_write(&row->header_,
4552 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_EXTERNAL_IDS],
4553 : : &datum);
4554 : 0 : }
4555 : :
4556 : :
4557 : : /* Sets the "load_balancer" column from the "Logical_Router" table in 'row' to
4558 : : * the 'load_balancer' set with 'n_load_balancer' entries.
4559 : : *
4560 : : * The caller retains ownership of the arguments. */
4561 : : void
4562 : 0 : nbrec_logical_router_set_load_balancer(const struct nbrec_logical_router *row, struct nbrec_load_balancer **load_balancer, size_t n_load_balancer)
4563 : : {
4564 : : struct ovsdb_datum datum;
4565 : : size_t i;
4566 : :
4567 [ # # ]: 0 : ovs_assert(inited);
4568 : 0 : datum.n = n_load_balancer;
4569 [ # # ]: 0 : datum.keys = n_load_balancer ? xmalloc(n_load_balancer * sizeof *datum.keys) : NULL;
4570 : 0 : datum.values = NULL;
4571 [ # # ]: 0 : for (i = 0; i < n_load_balancer; i++) {
4572 : 0 : datum.keys[i].uuid = load_balancer[i]->header_.uuid;
4573 : : }
4574 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
4575 : 0 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_LOAD_BALANCER], &datum);
4576 : 0 : }
4577 : :
4578 : : /* Sets the "name" column from the "Logical_Router" table in 'row' to
4579 : : * 'name'.
4580 : : *
4581 : : * The caller retains ownership of the arguments. */
4582 : : void
4583 : 22 : nbrec_logical_router_set_name(const struct nbrec_logical_router *row, const char *name)
4584 : : {
4585 : : struct ovsdb_datum datum;
4586 : : union ovsdb_atom key;
4587 : :
4588 [ - + ]: 22 : ovs_assert(inited);
4589 : 22 : datum.n = 1;
4590 : 22 : datum.keys = &key;
4591 : 22 : key.string = CONST_CAST(char *, name);
4592 : 22 : datum.values = NULL;
4593 : 22 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAME], &datum);
4594 : 22 : }
4595 : :
4596 : : /* Sets the "nat" column from the "Logical_Router" table in 'row' to
4597 : : * the 'nat' set with 'n_nat' entries.
4598 : : *
4599 : : * The caller retains ownership of the arguments. */
4600 : : void
4601 : 0 : nbrec_logical_router_set_nat(const struct nbrec_logical_router *row, struct nbrec_nat **nat, size_t n_nat)
4602 : : {
4603 : : struct ovsdb_datum datum;
4604 : : size_t i;
4605 : :
4606 [ # # ]: 0 : ovs_assert(inited);
4607 : 0 : datum.n = n_nat;
4608 [ # # ]: 0 : datum.keys = n_nat ? xmalloc(n_nat * sizeof *datum.keys) : NULL;
4609 : 0 : datum.values = NULL;
4610 [ # # ]: 0 : for (i = 0; i < n_nat; i++) {
4611 : 0 : datum.keys[i].uuid = nat[i]->header_.uuid;
4612 : : }
4613 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
4614 : 0 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAT], &datum);
4615 : 0 : }
4616 : :
4617 : : /* Sets the "options" column's value from the "Logical_Router" table in 'row'
4618 : : * to 'options'.
4619 : : *
4620 : : * The caller retains ownership of 'options' and everything in it. */
4621 : : void
4622 : 0 : nbrec_logical_router_set_options(const struct nbrec_logical_router *row, const struct smap *options)
4623 : : {
4624 : : struct ovsdb_datum datum;
4625 : :
4626 [ # # ]: 0 : ovs_assert(inited);
4627 [ # # ]: 0 : if (options) {
4628 : : struct smap_node *node;
4629 : : size_t i;
4630 : :
4631 : 0 : datum.n = smap_count(options);
4632 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
4633 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
4634 : :
4635 : 0 : i = 0;
4636 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
4637 : 0 : datum.keys[i].string = xstrdup(node->key);
4638 : 0 : datum.values[i].string = xstrdup(node->value);
4639 : 0 : i++;
4640 : : }
4641 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
4642 : : } else {
4643 : 0 : ovsdb_datum_init_empty(&datum);
4644 : : }
4645 : 0 : ovsdb_idl_txn_write(&row->header_,
4646 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_OPTIONS],
4647 : : &datum);
4648 : 0 : }
4649 : :
4650 : :
4651 : : /* Sets the "ports" column from the "Logical_Router" table in 'row' to
4652 : : * the 'ports' set with 'n_ports' entries.
4653 : : *
4654 : : * The caller retains ownership of the arguments. */
4655 : : void
4656 : 64 : nbrec_logical_router_set_ports(const struct nbrec_logical_router *row, struct nbrec_logical_router_port **ports, size_t n_ports)
4657 : : {
4658 : : struct ovsdb_datum datum;
4659 : : size_t i;
4660 : :
4661 [ - + ]: 64 : ovs_assert(inited);
4662 : 64 : datum.n = n_ports;
4663 [ + - ]: 64 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
4664 : 64 : datum.values = NULL;
4665 [ + + ]: 194 : for (i = 0; i < n_ports; i++) {
4666 : 130 : datum.keys[i].uuid = ports[i]->header_.uuid;
4667 : : }
4668 : 64 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
4669 : 64 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_PORTS], &datum);
4670 : 64 : }
4671 : :
4672 : : /* Sets the "static_routes" column from the "Logical_Router" table in 'row' to
4673 : : * the 'static_routes' set with 'n_static_routes' entries.
4674 : : *
4675 : : * The caller retains ownership of the arguments. */
4676 : : void
4677 : 35 : nbrec_logical_router_set_static_routes(const struct nbrec_logical_router *row, struct nbrec_logical_router_static_route **static_routes, size_t n_static_routes)
4678 : : {
4679 : : struct ovsdb_datum datum;
4680 : : size_t i;
4681 : :
4682 [ - + ]: 35 : ovs_assert(inited);
4683 : 35 : datum.n = n_static_routes;
4684 [ + + ]: 35 : datum.keys = n_static_routes ? xmalloc(n_static_routes * sizeof *datum.keys) : NULL;
4685 : 35 : datum.values = NULL;
4686 [ + + ]: 96 : for (i = 0; i < n_static_routes; i++) {
4687 : 61 : datum.keys[i].uuid = static_routes[i]->header_.uuid;
4688 : : }
4689 : 35 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
4690 : 35 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_STATIC_ROUTES], &datum);
4691 : 35 : }
4692 : :
4693 : : /* Adds the value 'new_value' to the "enabled" set column from the "Logical_Router" table
4694 : : * in 'row'.
4695 : : *
4696 : : */
4697 : : void
4698 : 0 : nbrec_logical_router_update_enabled_addvalue(const struct nbrec_logical_router *row, bool new_value)
4699 : : {
4700 : : struct ovsdb_datum *datum;
4701 : :
4702 [ # # ]: 0 : ovs_assert(inited);
4703 : :
4704 : 0 : datum = xmalloc(sizeof *datum);
4705 : 0 : datum->n = 1;
4706 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4707 : 0 : datum->values = NULL;
4708 : :
4709 : 0 : datum->keys[0].boolean = new_value;
4710 : :
4711 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
4712 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_ENABLED],
4713 : : datum);
4714 : 0 : }
4715 : :
4716 : : /* Deletes the value 'delete_value' from the "enabled" set column from the
4717 : : * "Logical_Router" table in 'row'.
4718 : : *
4719 : : */
4720 : : void
4721 : 0 : nbrec_logical_router_update_enabled_delvalue(const struct nbrec_logical_router *row, bool delete_value)
4722 : : {
4723 : : struct ovsdb_datum *datum;
4724 : :
4725 [ # # ]: 0 : ovs_assert(inited);
4726 : :
4727 : 0 : datum = xmalloc(sizeof *datum);
4728 : 0 : datum->n = 1;
4729 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4730 : 0 : datum->values = NULL;
4731 : :
4732 : 0 : datum->keys[0].boolean = delete_value;
4733 : :
4734 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
4735 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_ENABLED],
4736 : : datum);
4737 : 0 : }
4738 : :
4739 : : /* Sets an element of the "external_ids" map column from the "Logical_Router" table in 'row'
4740 : : * to 'new_value' given the key value 'new_key'.
4741 : : *
4742 : : */
4743 : : void
4744 : 0 : nbrec_logical_router_update_external_ids_setkey(const struct nbrec_logical_router *row, const char *new_key, const char *new_value)
4745 : : {
4746 : : struct ovsdb_datum *datum;
4747 : :
4748 [ # # ]: 0 : ovs_assert(inited);
4749 : :
4750 : 0 : datum = xmalloc(sizeof *datum);
4751 : 0 : datum->n = 1;
4752 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4753 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
4754 : :
4755 : 0 : datum->keys[0].string = xstrdup(new_key);
4756 : 0 : datum->values[0].string = xstrdup(new_value);
4757 : :
4758 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
4759 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_EXTERNAL_IDS],
4760 : : datum);
4761 : 0 : }
4762 : :
4763 : : /* Deletes an element of the "external_ids" map column from the "Logical_Router" table in 'row'
4764 : : * given the key value 'delete_key'.
4765 : : *
4766 : : */
4767 : : void
4768 : 0 : nbrec_logical_router_update_external_ids_delkey(const struct nbrec_logical_router *row, const char *delete_key)
4769 : : {
4770 : : struct ovsdb_datum *datum;
4771 : :
4772 [ # # ]: 0 : ovs_assert(inited);
4773 : :
4774 : 0 : datum = xmalloc(sizeof *datum);
4775 : 0 : datum->n = 1;
4776 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4777 : 0 : datum->values = NULL;
4778 : :
4779 : 0 : datum->keys[0].string = xstrdup(delete_key);
4780 : :
4781 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
4782 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_EXTERNAL_IDS],
4783 : : datum);
4784 : 0 : }
4785 : :
4786 : : /* Adds the value 'new_value' to the "load_balancer" set column from the "Logical_Router" table
4787 : : * in 'row'.
4788 : : *
4789 : : */
4790 : : void
4791 : 0 : nbrec_logical_router_update_load_balancer_addvalue(const struct nbrec_logical_router *row, const struct nbrec_load_balancer *new_value)
4792 : : {
4793 : : struct ovsdb_datum *datum;
4794 : :
4795 [ # # ]: 0 : ovs_assert(inited);
4796 : :
4797 : 0 : datum = xmalloc(sizeof *datum);
4798 : 0 : datum->n = 1;
4799 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4800 : 0 : datum->values = NULL;
4801 : :
4802 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
4803 : :
4804 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
4805 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_LOAD_BALANCER],
4806 : : datum);
4807 : 0 : }
4808 : :
4809 : : /* Deletes the value 'delete_value' from the "load_balancer" set column from the
4810 : : * "Logical_Router" table in 'row'.
4811 : : *
4812 : : */
4813 : : void
4814 : 0 : nbrec_logical_router_update_load_balancer_delvalue(const struct nbrec_logical_router *row, const struct nbrec_load_balancer *delete_value)
4815 : : {
4816 : : struct ovsdb_datum *datum;
4817 : :
4818 [ # # ]: 0 : ovs_assert(inited);
4819 : :
4820 : 0 : datum = xmalloc(sizeof *datum);
4821 : 0 : datum->n = 1;
4822 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4823 : 0 : datum->values = NULL;
4824 : :
4825 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
4826 : :
4827 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
4828 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_LOAD_BALANCER],
4829 : : datum);
4830 : 0 : }
4831 : :
4832 : : /* Adds the value 'new_value' to the "nat" set column from the "Logical_Router" table
4833 : : * in 'row'.
4834 : : *
4835 : : */
4836 : : void
4837 : 0 : nbrec_logical_router_update_nat_addvalue(const struct nbrec_logical_router *row, const struct nbrec_nat *new_value)
4838 : : {
4839 : : struct ovsdb_datum *datum;
4840 : :
4841 [ # # ]: 0 : ovs_assert(inited);
4842 : :
4843 : 0 : datum = xmalloc(sizeof *datum);
4844 : 0 : datum->n = 1;
4845 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4846 : 0 : datum->values = NULL;
4847 : :
4848 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
4849 : :
4850 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
4851 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAT],
4852 : : datum);
4853 : 0 : }
4854 : :
4855 : : /* Deletes the value 'delete_value' from the "nat" set column from the
4856 : : * "Logical_Router" table in 'row'.
4857 : : *
4858 : : */
4859 : : void
4860 : 0 : nbrec_logical_router_update_nat_delvalue(const struct nbrec_logical_router *row, const struct nbrec_nat *delete_value)
4861 : : {
4862 : : struct ovsdb_datum *datum;
4863 : :
4864 [ # # ]: 0 : ovs_assert(inited);
4865 : :
4866 : 0 : datum = xmalloc(sizeof *datum);
4867 : 0 : datum->n = 1;
4868 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4869 : 0 : datum->values = NULL;
4870 : :
4871 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
4872 : :
4873 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
4874 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAT],
4875 : : datum);
4876 : 0 : }
4877 : :
4878 : : /* Sets an element of the "options" map column from the "Logical_Router" table in 'row'
4879 : : * to 'new_value' given the key value 'new_key'.
4880 : : *
4881 : : */
4882 : : void
4883 : 0 : nbrec_logical_router_update_options_setkey(const struct nbrec_logical_router *row, const char *new_key, const char *new_value)
4884 : : {
4885 : : struct ovsdb_datum *datum;
4886 : :
4887 [ # # ]: 0 : ovs_assert(inited);
4888 : :
4889 : 0 : datum = xmalloc(sizeof *datum);
4890 : 0 : datum->n = 1;
4891 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4892 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
4893 : :
4894 : 0 : datum->keys[0].string = xstrdup(new_key);
4895 : 0 : datum->values[0].string = xstrdup(new_value);
4896 : :
4897 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
4898 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_OPTIONS],
4899 : : datum);
4900 : 0 : }
4901 : :
4902 : : /* Deletes an element of the "options" map column from the "Logical_Router" table in 'row'
4903 : : * given the key value 'delete_key'.
4904 : : *
4905 : : */
4906 : : void
4907 : 0 : nbrec_logical_router_update_options_delkey(const struct nbrec_logical_router *row, const char *delete_key)
4908 : : {
4909 : : struct ovsdb_datum *datum;
4910 : :
4911 [ # # ]: 0 : ovs_assert(inited);
4912 : :
4913 : 0 : datum = xmalloc(sizeof *datum);
4914 : 0 : datum->n = 1;
4915 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4916 : 0 : datum->values = NULL;
4917 : :
4918 : 0 : datum->keys[0].string = xstrdup(delete_key);
4919 : :
4920 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
4921 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_OPTIONS],
4922 : : datum);
4923 : 0 : }
4924 : :
4925 : : /* Adds the value 'new_value' to the "ports" set column from the "Logical_Router" table
4926 : : * in 'row'.
4927 : : *
4928 : : */
4929 : : void
4930 : 0 : nbrec_logical_router_update_ports_addvalue(const struct nbrec_logical_router *row, const struct nbrec_logical_router_port *new_value)
4931 : : {
4932 : : struct ovsdb_datum *datum;
4933 : :
4934 [ # # ]: 0 : ovs_assert(inited);
4935 : :
4936 : 0 : datum = xmalloc(sizeof *datum);
4937 : 0 : datum->n = 1;
4938 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4939 : 0 : datum->values = NULL;
4940 : :
4941 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
4942 : :
4943 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
4944 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_PORTS],
4945 : : datum);
4946 : 0 : }
4947 : :
4948 : : /* Deletes the value 'delete_value' from the "ports" set column from the
4949 : : * "Logical_Router" table in 'row'.
4950 : : *
4951 : : */
4952 : : void
4953 : 0 : nbrec_logical_router_update_ports_delvalue(const struct nbrec_logical_router *row, const struct nbrec_logical_router_port *delete_value)
4954 : : {
4955 : : struct ovsdb_datum *datum;
4956 : :
4957 [ # # ]: 0 : ovs_assert(inited);
4958 : :
4959 : 0 : datum = xmalloc(sizeof *datum);
4960 : 0 : datum->n = 1;
4961 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4962 : 0 : datum->values = NULL;
4963 : :
4964 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
4965 : :
4966 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
4967 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_PORTS],
4968 : : datum);
4969 : 0 : }
4970 : :
4971 : : /* Adds the value 'new_value' to the "static_routes" set column from the "Logical_Router" table
4972 : : * in 'row'.
4973 : : *
4974 : : */
4975 : : void
4976 : 0 : nbrec_logical_router_update_static_routes_addvalue(const struct nbrec_logical_router *row, const struct nbrec_logical_router_static_route *new_value)
4977 : : {
4978 : : struct ovsdb_datum *datum;
4979 : :
4980 [ # # ]: 0 : ovs_assert(inited);
4981 : :
4982 : 0 : datum = xmalloc(sizeof *datum);
4983 : 0 : datum->n = 1;
4984 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
4985 : 0 : datum->values = NULL;
4986 : :
4987 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
4988 : :
4989 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
4990 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_STATIC_ROUTES],
4991 : : datum);
4992 : 0 : }
4993 : :
4994 : : /* Deletes the value 'delete_value' from the "static_routes" set column from the
4995 : : * "Logical_Router" table in 'row'.
4996 : : *
4997 : : */
4998 : : void
4999 : 0 : nbrec_logical_router_update_static_routes_delvalue(const struct nbrec_logical_router *row, const struct nbrec_logical_router_static_route *delete_value)
5000 : : {
5001 : : struct ovsdb_datum *datum;
5002 : :
5003 [ # # ]: 0 : ovs_assert(inited);
5004 : :
5005 : 0 : datum = xmalloc(sizeof *datum);
5006 : 0 : datum->n = 1;
5007 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
5008 : 0 : datum->values = NULL;
5009 : :
5010 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
5011 : :
5012 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
5013 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_STATIC_ROUTES],
5014 : : datum);
5015 : 0 : }
5016 : :
5017 : : /* Sets the "enabled" column from the "Logical_Router" table in 'row' to
5018 : : * the 'enabled' set with 'n_enabled' entries.
5019 : : *
5020 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
5021 : : * may be NULL.
5022 : : *
5023 : : * The caller retains ownership of the arguments. */
5024 : : void
5025 : 0 : nbrec_logical_router_add_clause_enabled(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *enabled, size_t n_enabled)
5026 : : {
5027 : : struct ovsdb_datum datum;
5028 : : union ovsdb_atom key;
5029 : :
5030 [ # # ]: 0 : ovs_assert(inited);
5031 [ # # ]: 0 : if (n_enabled) {
5032 : 0 : datum.n = 1;
5033 : 0 : datum.keys = &key;
5034 : 0 : key.boolean = *enabled;
5035 : : } else {
5036 : 0 : datum.n = 0;
5037 : 0 : datum.keys = NULL;
5038 : : }
5039 : 0 : datum.values = NULL;
5040 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5041 : : function,
5042 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_ENABLED],
5043 : : &datum);
5044 : 0 : }
5045 : :
5046 : : /* Sets the "external_ids" column's value from the "Logical_Router" table in 'row'
5047 : : * to 'external_ids'.
5048 : : *
5049 : : * The caller retains ownership of 'external_ids' and everything in it. */
5050 : : void
5051 : 0 : nbrec_logical_router_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
5052 : : {
5053 : : struct ovsdb_datum datum;
5054 : :
5055 [ # # ]: 0 : ovs_assert(inited);
5056 [ # # ]: 0 : if (external_ids) {
5057 : : struct smap_node *node;
5058 : : size_t i;
5059 : :
5060 : 0 : datum.n = smap_count(external_ids);
5061 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
5062 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
5063 : :
5064 : 0 : i = 0;
5065 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
5066 : 0 : datum.keys[i].string = xstrdup(node->key);
5067 : 0 : datum.values[i].string = xstrdup(node->value);
5068 : 0 : i++;
5069 : : }
5070 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
5071 : : } else {
5072 : 0 : ovsdb_datum_init_empty(&datum);
5073 : : }
5074 : :
5075 : 0 : ovsdb_idl_condition_add_clause(idl,
5076 : : &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5077 : : function,
5078 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_EXTERNAL_IDS],
5079 : : &datum);
5080 : :
5081 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_router_col_external_ids.type);
5082 : 0 : }
5083 : :
5084 : :
5085 : : /* Sets the "load_balancer" column from the "Logical_Router" table in 'row' to
5086 : : * the 'load_balancer' set with 'n_load_balancer' entries.
5087 : : *
5088 : : * The caller retains ownership of the arguments. */
5089 : : void
5090 : 0 : nbrec_logical_router_add_clause_load_balancer(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **load_balancer, size_t n_load_balancer)
5091 : : {
5092 : : struct ovsdb_datum datum;
5093 : : size_t i;
5094 : :
5095 [ # # ]: 0 : ovs_assert(inited);
5096 : 0 : datum.n = n_load_balancer;
5097 [ # # ]: 0 : datum.keys = n_load_balancer ? xmalloc(n_load_balancer * sizeof *datum.keys) : NULL;
5098 : 0 : datum.values = NULL;
5099 [ # # ]: 0 : for (i = 0; i < n_load_balancer; i++) {
5100 : 0 : datum.keys[i].uuid = *load_balancer[i];
5101 : : }
5102 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5103 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5104 : : function,
5105 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_LOAD_BALANCER],
5106 : : &datum);
5107 : 0 : free(datum.keys);
5108 : 0 : }
5109 : :
5110 : : /* Sets the "name" column from the "Logical_Router" table in 'row' to
5111 : : * 'name'.
5112 : : *
5113 : : * The caller retains ownership of the arguments. */
5114 : : void
5115 : 0 : nbrec_logical_router_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
5116 : : {
5117 : : struct ovsdb_datum datum;
5118 : : union ovsdb_atom key;
5119 : :
5120 [ # # ]: 0 : ovs_assert(inited);
5121 : 0 : datum.n = 1;
5122 : 0 : datum.keys = &key;
5123 : 0 : key.string = CONST_CAST(char *, name);
5124 : 0 : datum.values = NULL;
5125 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5126 : : function,
5127 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAME],
5128 : : &datum);
5129 : 0 : }
5130 : :
5131 : : /* Sets the "nat" column from the "Logical_Router" table in 'row' to
5132 : : * the 'nat' set with 'n_nat' entries.
5133 : : *
5134 : : * The caller retains ownership of the arguments. */
5135 : : void
5136 : 0 : nbrec_logical_router_add_clause_nat(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **nat, size_t n_nat)
5137 : : {
5138 : : struct ovsdb_datum datum;
5139 : : size_t i;
5140 : :
5141 [ # # ]: 0 : ovs_assert(inited);
5142 : 0 : datum.n = n_nat;
5143 [ # # ]: 0 : datum.keys = n_nat ? xmalloc(n_nat * sizeof *datum.keys) : NULL;
5144 : 0 : datum.values = NULL;
5145 [ # # ]: 0 : for (i = 0; i < n_nat; i++) {
5146 : 0 : datum.keys[i].uuid = *nat[i];
5147 : : }
5148 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5149 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5150 : : function,
5151 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAT],
5152 : : &datum);
5153 : 0 : free(datum.keys);
5154 : 0 : }
5155 : :
5156 : : /* Sets the "options" column's value from the "Logical_Router" table in 'row'
5157 : : * to 'options'.
5158 : : *
5159 : : * The caller retains ownership of 'options' and everything in it. */
5160 : : void
5161 : 0 : nbrec_logical_router_add_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
5162 : : {
5163 : : struct ovsdb_datum datum;
5164 : :
5165 [ # # ]: 0 : ovs_assert(inited);
5166 [ # # ]: 0 : if (options) {
5167 : : struct smap_node *node;
5168 : : size_t i;
5169 : :
5170 : 0 : datum.n = smap_count(options);
5171 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
5172 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
5173 : :
5174 : 0 : i = 0;
5175 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
5176 : 0 : datum.keys[i].string = xstrdup(node->key);
5177 : 0 : datum.values[i].string = xstrdup(node->value);
5178 : 0 : i++;
5179 : : }
5180 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
5181 : : } else {
5182 : 0 : ovsdb_datum_init_empty(&datum);
5183 : : }
5184 : :
5185 : 0 : ovsdb_idl_condition_add_clause(idl,
5186 : : &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5187 : : function,
5188 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_OPTIONS],
5189 : : &datum);
5190 : :
5191 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_router_col_options.type);
5192 : 0 : }
5193 : :
5194 : :
5195 : : /* Sets the "ports" column from the "Logical_Router" table in 'row' to
5196 : : * the 'ports' set with 'n_ports' entries.
5197 : : *
5198 : : * The caller retains ownership of the arguments. */
5199 : : void
5200 : 0 : nbrec_logical_router_add_clause_ports(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
5201 : : {
5202 : : struct ovsdb_datum datum;
5203 : : size_t i;
5204 : :
5205 [ # # ]: 0 : ovs_assert(inited);
5206 : 0 : datum.n = n_ports;
5207 [ # # ]: 0 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
5208 : 0 : datum.values = NULL;
5209 [ # # ]: 0 : for (i = 0; i < n_ports; i++) {
5210 : 0 : datum.keys[i].uuid = *ports[i];
5211 : : }
5212 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5213 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5214 : : function,
5215 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_PORTS],
5216 : : &datum);
5217 : 0 : free(datum.keys);
5218 : 0 : }
5219 : :
5220 : : /* Sets the "static_routes" column from the "Logical_Router" table in 'row' to
5221 : : * the 'static_routes' set with 'n_static_routes' entries.
5222 : : *
5223 : : * The caller retains ownership of the arguments. */
5224 : : void
5225 : 0 : nbrec_logical_router_add_clause_static_routes(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **static_routes, size_t n_static_routes)
5226 : : {
5227 : : struct ovsdb_datum datum;
5228 : : size_t i;
5229 : :
5230 [ # # ]: 0 : ovs_assert(inited);
5231 : 0 : datum.n = n_static_routes;
5232 [ # # ]: 0 : datum.keys = n_static_routes ? xmalloc(n_static_routes * sizeof *datum.keys) : NULL;
5233 : 0 : datum.values = NULL;
5234 [ # # ]: 0 : for (i = 0; i < n_static_routes; i++) {
5235 : 0 : datum.keys[i].uuid = *static_routes[i];
5236 : : }
5237 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5238 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5239 : : function,
5240 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_STATIC_ROUTES],
5241 : : &datum);
5242 : 0 : free(datum.keys);
5243 : 0 : }
5244 : : void
5245 : 0 : nbrec_logical_router_add_clause_false(struct ovsdb_idl *idl)
5246 : : {
5247 : : struct ovsdb_datum datum;
5248 : :
5249 : 0 : ovsdb_datum_init_empty(&datum);
5250 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER], OVSDB_F_FALSE, NULL, &datum);
5251 : 0 : }
5252 : : void
5253 : 0 : nbrec_logical_router_add_clause_true(struct ovsdb_idl *idl)
5254 : : {
5255 : : struct ovsdb_datum datum;
5256 : :
5257 : 0 : ovsdb_datum_init_empty(&datum);
5258 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER], OVSDB_F_TRUE, NULL, &datum);
5259 : 0 : }
5260 : :
5261 : : /* Sets the "enabled" column from the "Logical_Router" table in 'row' to
5262 : : * the 'enabled' set with 'n_enabled' entries.
5263 : : *
5264 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
5265 : : * may be NULL.
5266 : : *
5267 : : * The caller retains ownership of the arguments. */
5268 : : void
5269 : 0 : nbrec_logical_router_remove_clause_enabled(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *enabled, size_t n_enabled)
5270 : : {
5271 : : struct ovsdb_datum datum;
5272 : : union ovsdb_atom key;
5273 : :
5274 [ # # ]: 0 : ovs_assert(inited);
5275 [ # # ]: 0 : if (n_enabled) {
5276 : 0 : datum.n = 1;
5277 : 0 : datum.keys = &key;
5278 : 0 : key.boolean = *enabled;
5279 : : } else {
5280 : 0 : datum.n = 0;
5281 : 0 : datum.keys = NULL;
5282 : : }
5283 : 0 : datum.values = NULL;
5284 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5285 : : function,
5286 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_ENABLED],
5287 : : &datum);
5288 : 0 : }
5289 : :
5290 : : /* Sets the "external_ids" column's value from the "Logical_Router" table in 'row'
5291 : : * to 'external_ids'.
5292 : : *
5293 : : * The caller retains ownership of 'external_ids' and everything in it. */
5294 : : void
5295 : 0 : nbrec_logical_router_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
5296 : : {
5297 : : struct ovsdb_datum datum;
5298 : :
5299 [ # # ]: 0 : ovs_assert(inited);
5300 [ # # ]: 0 : if (external_ids) {
5301 : : struct smap_node *node;
5302 : : size_t i;
5303 : :
5304 : 0 : datum.n = smap_count(external_ids);
5305 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
5306 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
5307 : :
5308 : 0 : i = 0;
5309 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
5310 : 0 : datum.keys[i].string = xstrdup(node->key);
5311 : 0 : datum.values[i].string = xstrdup(node->value);
5312 : 0 : i++;
5313 : : }
5314 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
5315 : : } else {
5316 : 0 : ovsdb_datum_init_empty(&datum);
5317 : : }
5318 : :
5319 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5320 : : function,
5321 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_EXTERNAL_IDS],
5322 : : &datum);
5323 : :
5324 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_router_col_external_ids.type);
5325 : 0 : }
5326 : :
5327 : :
5328 : : /* Sets the "load_balancer" column from the "Logical_Router" table in 'row' to
5329 : : * the 'load_balancer' set with 'n_load_balancer' entries.
5330 : : *
5331 : : * The caller retains ownership of the arguments. */
5332 : : void
5333 : 0 : nbrec_logical_router_remove_clause_load_balancer(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **load_balancer, size_t n_load_balancer)
5334 : : {
5335 : : struct ovsdb_datum datum;
5336 : : size_t i;
5337 : :
5338 [ # # ]: 0 : ovs_assert(inited);
5339 : 0 : datum.n = n_load_balancer;
5340 [ # # ]: 0 : datum.keys = n_load_balancer ? xmalloc(n_load_balancer * sizeof *datum.keys) : NULL;
5341 : 0 : datum.values = NULL;
5342 [ # # ]: 0 : for (i = 0; i < n_load_balancer; i++) {
5343 : 0 : datum.keys[i].uuid = *load_balancer[i];
5344 : : }
5345 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5346 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5347 : : function,
5348 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_LOAD_BALANCER],
5349 : : &datum);
5350 : 0 : free(datum.keys);
5351 : 0 : }
5352 : :
5353 : : /* Sets the "name" column from the "Logical_Router" table in 'row' to
5354 : : * 'name'.
5355 : : *
5356 : : * The caller retains ownership of the arguments. */
5357 : : void
5358 : 0 : nbrec_logical_router_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
5359 : : {
5360 : : struct ovsdb_datum datum;
5361 : : union ovsdb_atom key;
5362 : :
5363 [ # # ]: 0 : ovs_assert(inited);
5364 : 0 : datum.n = 1;
5365 : 0 : datum.keys = &key;
5366 : 0 : key.string = CONST_CAST(char *, name);
5367 : 0 : datum.values = NULL;
5368 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5369 : : function,
5370 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAME],
5371 : : &datum);
5372 : 0 : }
5373 : :
5374 : : /* Sets the "nat" column from the "Logical_Router" table in 'row' to
5375 : : * the 'nat' set with 'n_nat' entries.
5376 : : *
5377 : : * The caller retains ownership of the arguments. */
5378 : : void
5379 : 0 : nbrec_logical_router_remove_clause_nat(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **nat, size_t n_nat)
5380 : : {
5381 : : struct ovsdb_datum datum;
5382 : : size_t i;
5383 : :
5384 [ # # ]: 0 : ovs_assert(inited);
5385 : 0 : datum.n = n_nat;
5386 [ # # ]: 0 : datum.keys = n_nat ? xmalloc(n_nat * sizeof *datum.keys) : NULL;
5387 : 0 : datum.values = NULL;
5388 [ # # ]: 0 : for (i = 0; i < n_nat; i++) {
5389 : 0 : datum.keys[i].uuid = *nat[i];
5390 : : }
5391 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5392 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5393 : : function,
5394 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_NAT],
5395 : : &datum);
5396 : 0 : free(datum.keys);
5397 : 0 : }
5398 : :
5399 : : /* Sets the "options" column's value from the "Logical_Router" table in 'row'
5400 : : * to 'options'.
5401 : : *
5402 : : * The caller retains ownership of 'options' and everything in it. */
5403 : : void
5404 : 0 : nbrec_logical_router_remove_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
5405 : : {
5406 : : struct ovsdb_datum datum;
5407 : :
5408 [ # # ]: 0 : ovs_assert(inited);
5409 [ # # ]: 0 : if (options) {
5410 : : struct smap_node *node;
5411 : : size_t i;
5412 : :
5413 : 0 : datum.n = smap_count(options);
5414 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
5415 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
5416 : :
5417 : 0 : i = 0;
5418 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
5419 : 0 : datum.keys[i].string = xstrdup(node->key);
5420 : 0 : datum.values[i].string = xstrdup(node->value);
5421 : 0 : i++;
5422 : : }
5423 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
5424 : : } else {
5425 : 0 : ovsdb_datum_init_empty(&datum);
5426 : : }
5427 : :
5428 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5429 : : function,
5430 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_OPTIONS],
5431 : : &datum);
5432 : :
5433 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_router_col_options.type);
5434 : 0 : }
5435 : :
5436 : :
5437 : : /* Sets the "ports" column from the "Logical_Router" table in 'row' to
5438 : : * the 'ports' set with 'n_ports' entries.
5439 : : *
5440 : : * The caller retains ownership of the arguments. */
5441 : : void
5442 : 0 : nbrec_logical_router_remove_clause_ports(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
5443 : : {
5444 : : struct ovsdb_datum datum;
5445 : : size_t i;
5446 : :
5447 [ # # ]: 0 : ovs_assert(inited);
5448 : 0 : datum.n = n_ports;
5449 [ # # ]: 0 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
5450 : 0 : datum.values = NULL;
5451 [ # # ]: 0 : for (i = 0; i < n_ports; i++) {
5452 : 0 : datum.keys[i].uuid = *ports[i];
5453 : : }
5454 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5455 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5456 : : function,
5457 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_PORTS],
5458 : : &datum);
5459 : 0 : free(datum.keys);
5460 : 0 : }
5461 : :
5462 : : /* Sets the "static_routes" column from the "Logical_Router" table in 'row' to
5463 : : * the 'static_routes' set with 'n_static_routes' entries.
5464 : : *
5465 : : * The caller retains ownership of the arguments. */
5466 : : void
5467 : 0 : nbrec_logical_router_remove_clause_static_routes(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **static_routes, size_t n_static_routes)
5468 : : {
5469 : : struct ovsdb_datum datum;
5470 : : size_t i;
5471 : :
5472 [ # # ]: 0 : ovs_assert(inited);
5473 : 0 : datum.n = n_static_routes;
5474 [ # # ]: 0 : datum.keys = n_static_routes ? xmalloc(n_static_routes * sizeof *datum.keys) : NULL;
5475 : 0 : datum.values = NULL;
5476 [ # # ]: 0 : for (i = 0; i < n_static_routes; i++) {
5477 : 0 : datum.keys[i].uuid = *static_routes[i];
5478 : : }
5479 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
5480 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER],
5481 : : function,
5482 : : &nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_COL_STATIC_ROUTES],
5483 : : &datum);
5484 : 0 : free(datum.keys);
5485 : 0 : }
5486 : : void
5487 : 0 : nbrec_logical_router_remove_clause_false(struct ovsdb_idl *idl)
5488 : : {
5489 : : struct ovsdb_datum datum;
5490 : :
5491 : 0 : ovsdb_datum_init_empty(&datum);
5492 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER], OVSDB_F_FALSE, NULL, &datum);
5493 : 0 : }
5494 : : void
5495 : 0 : nbrec_logical_router_remove_clause_true(struct ovsdb_idl *idl)
5496 : : {
5497 : : struct ovsdb_datum datum;
5498 : :
5499 : 0 : ovsdb_datum_init_empty(&datum);
5500 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER], OVSDB_F_TRUE, NULL, &datum);
5501 : 0 : }
5502 : :
5503 : : struct ovsdb_idl_column nbrec_logical_router_columns[NBREC_LOGICAL_ROUTER_N_COLUMNS];
5504 : :
5505 : : static void
5506 : 932 : nbrec_logical_router_columns_init(void)
5507 : : {
5508 : : struct ovsdb_idl_column *c;
5509 : :
5510 : : /* Initialize nbrec_logical_router_col_enabled. */
5511 : 932 : c = &nbrec_logical_router_col_enabled;
5512 : 932 : c->name = "enabled";
5513 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
5514 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5515 : 932 : c->type.n_min = 0;
5516 : 932 : c->type.n_max = 1;
5517 : 932 : c->mutable = true;
5518 : 932 : c->parse = nbrec_logical_router_parse_enabled;
5519 : 932 : c->unparse = nbrec_logical_router_unparse_enabled;
5520 : :
5521 : : /* Initialize nbrec_logical_router_col_external_ids. */
5522 : 932 : c = &nbrec_logical_router_col_external_ids;
5523 : 932 : c->name = "external_ids";
5524 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
5525 : 932 : c->type.key.u.string.minLen = 0;
5526 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
5527 : 932 : c->type.value.u.string.minLen = 0;
5528 : 932 : c->type.n_min = 0;
5529 : 932 : c->type.n_max = UINT_MAX;
5530 : 932 : c->mutable = true;
5531 : 932 : c->parse = nbrec_logical_router_parse_external_ids;
5532 : 932 : c->unparse = nbrec_logical_router_unparse_external_ids;
5533 : :
5534 : : /* Initialize nbrec_logical_router_col_load_balancer. */
5535 : 932 : c = &nbrec_logical_router_col_load_balancer;
5536 : 932 : c->name = "load_balancer";
5537 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
5538 : 932 : c->type.key.u.uuid.refTableName = "Load_Balancer";
5539 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
5540 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5541 : 932 : c->type.n_min = 0;
5542 : 932 : c->type.n_max = UINT_MAX;
5543 : 932 : c->mutable = true;
5544 : 932 : c->parse = nbrec_logical_router_parse_load_balancer;
5545 : 932 : c->unparse = nbrec_logical_router_unparse_load_balancer;
5546 : :
5547 : : /* Initialize nbrec_logical_router_col_name. */
5548 : 932 : c = &nbrec_logical_router_col_name;
5549 : 932 : c->name = "name";
5550 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
5551 : 932 : c->type.key.u.string.minLen = 0;
5552 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5553 : 932 : c->type.n_min = 1;
5554 : 932 : c->type.n_max = 1;
5555 : 932 : c->mutable = true;
5556 : 932 : c->parse = nbrec_logical_router_parse_name;
5557 : 932 : c->unparse = nbrec_logical_router_unparse_name;
5558 : :
5559 : : /* Initialize nbrec_logical_router_col_nat. */
5560 : 932 : c = &nbrec_logical_router_col_nat;
5561 : 932 : c->name = "nat";
5562 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
5563 : 932 : c->type.key.u.uuid.refTableName = "NAT";
5564 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
5565 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5566 : 932 : c->type.n_min = 0;
5567 : 932 : c->type.n_max = UINT_MAX;
5568 : 932 : c->mutable = true;
5569 : 932 : c->parse = nbrec_logical_router_parse_nat;
5570 : 932 : c->unparse = nbrec_logical_router_unparse_nat;
5571 : :
5572 : : /* Initialize nbrec_logical_router_col_options. */
5573 : 932 : c = &nbrec_logical_router_col_options;
5574 : 932 : c->name = "options";
5575 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
5576 : 932 : c->type.key.u.string.minLen = 0;
5577 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
5578 : 932 : c->type.value.u.string.minLen = 0;
5579 : 932 : c->type.n_min = 0;
5580 : 932 : c->type.n_max = UINT_MAX;
5581 : 932 : c->mutable = true;
5582 : 932 : c->parse = nbrec_logical_router_parse_options;
5583 : 932 : c->unparse = nbrec_logical_router_unparse_options;
5584 : :
5585 : : /* Initialize nbrec_logical_router_col_ports. */
5586 : 932 : c = &nbrec_logical_router_col_ports;
5587 : 932 : c->name = "ports";
5588 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
5589 : 932 : c->type.key.u.uuid.refTableName = "Logical_Router_Port";
5590 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
5591 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5592 : 932 : c->type.n_min = 0;
5593 : 932 : c->type.n_max = UINT_MAX;
5594 : 932 : c->mutable = true;
5595 : 932 : c->parse = nbrec_logical_router_parse_ports;
5596 : 932 : c->unparse = nbrec_logical_router_unparse_ports;
5597 : :
5598 : : /* Initialize nbrec_logical_router_col_static_routes. */
5599 : 932 : c = &nbrec_logical_router_col_static_routes;
5600 : 932 : c->name = "static_routes";
5601 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
5602 : 932 : c->type.key.u.uuid.refTableName = "Logical_Router_Static_Route";
5603 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
5604 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5605 : 932 : c->type.n_min = 0;
5606 : 932 : c->type.n_max = UINT_MAX;
5607 : 932 : c->mutable = true;
5608 : 932 : c->parse = nbrec_logical_router_parse_static_routes;
5609 : 932 : c->unparse = nbrec_logical_router_unparse_static_routes;
5610 : 932 : }
5611 : :
5612 : : /* Logical_Router_Port table. */
5613 : :
5614 : : static void
5615 : 838 : nbrec_logical_router_port_parse_enabled(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5616 : : {
5617 : 838 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5618 : 838 : size_t n = MIN(1, datum->n);
5619 : : size_t i;
5620 : :
5621 [ - + ]: 838 : ovs_assert(inited);
5622 : 838 : row->enabled = NULL;
5623 : 838 : row->n_enabled = 0;
5624 [ + + ]: 847 : for (i = 0; i < n; i++) {
5625 [ + - ]: 9 : if (!row->n_enabled) {
5626 : 9 : row->enabled = xmalloc(n * sizeof_bool);
5627 : : }
5628 : 9 : row->enabled[row->n_enabled] = datum->keys[i].boolean;
5629 : 9 : row->n_enabled++;
5630 : : }
5631 : 838 : }
5632 : :
5633 : : static void
5634 : 836 : nbrec_logical_router_port_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5635 : : {
5636 : 836 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5637 : : size_t i;
5638 : :
5639 [ - + ]: 836 : ovs_assert(inited);
5640 : 836 : smap_init(&row->external_ids);
5641 [ - + ]: 836 : for (i = 0; i < datum->n; i++) {
5642 : 0 : smap_add(&row->external_ids,
5643 : 0 : datum->keys[i].string,
5644 : 0 : datum->values[i].string);
5645 : : }
5646 : 836 : }
5647 : :
5648 : : static void
5649 : 901 : nbrec_logical_router_port_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5650 : : {
5651 : 901 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5652 : :
5653 [ - + ]: 901 : ovs_assert(inited);
5654 [ + - ]: 901 : if (datum->n >= 1) {
5655 : 901 : row->mac = datum->keys[0].string;
5656 : : } else {
5657 : 0 : row->mac = "";
5658 : : }
5659 : 901 : }
5660 : :
5661 : : static void
5662 : 901 : nbrec_logical_router_port_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5663 : : {
5664 : 901 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5665 : :
5666 [ - + ]: 901 : ovs_assert(inited);
5667 [ + - ]: 901 : if (datum->n >= 1) {
5668 : 901 : row->name = datum->keys[0].string;
5669 : : } else {
5670 : 0 : row->name = "";
5671 : : }
5672 : 901 : }
5673 : :
5674 : : static void
5675 : 901 : nbrec_logical_router_port_parse_networks(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5676 : : {
5677 : 901 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5678 : : size_t i;
5679 : :
5680 [ - + ]: 901 : ovs_assert(inited);
5681 : 901 : row->networks = NULL;
5682 : 901 : row->n_networks = 0;
5683 [ + + ]: 1816 : for (i = 0; i < datum->n; i++) {
5684 [ + + ]: 915 : if (!row->n_networks) {
5685 : 901 : row->networks = xmalloc(datum->n * sizeof *row->networks);
5686 : : }
5687 : 915 : row->networks[row->n_networks] = datum->keys[i].string;
5688 : 915 : row->n_networks++;
5689 : : }
5690 : 901 : }
5691 : :
5692 : : static void
5693 : 842 : nbrec_logical_router_port_parse_peer(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5694 : : {
5695 : 842 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5696 : :
5697 [ - + ]: 842 : ovs_assert(inited);
5698 [ + + ]: 842 : if (datum->n >= 1) {
5699 : 61 : row->peer = datum->keys[0].string;
5700 : : } else {
5701 : 781 : row->peer = NULL;
5702 : : }
5703 : 842 : }
5704 : :
5705 : : static void
5706 : 903 : nbrec_logical_router_port_unparse_enabled(struct ovsdb_idl_row *row_)
5707 : : {
5708 : 903 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5709 : :
5710 [ - + ]: 903 : ovs_assert(inited);
5711 : 903 : free(row->enabled);
5712 : 903 : }
5713 : :
5714 : : static void
5715 : 901 : nbrec_logical_router_port_unparse_external_ids(struct ovsdb_idl_row *row_)
5716 : : {
5717 : 901 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5718 : :
5719 [ - + ]: 901 : ovs_assert(inited);
5720 : 901 : smap_destroy(&row->external_ids);
5721 : 901 : }
5722 : :
5723 : : static void
5724 : 966 : nbrec_logical_router_port_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
5725 : : {
5726 : : /* Nothing to do. */
5727 : 966 : }
5728 : :
5729 : : static void
5730 : 966 : nbrec_logical_router_port_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
5731 : : {
5732 : : /* Nothing to do. */
5733 : 966 : }
5734 : :
5735 : : static void
5736 : 966 : nbrec_logical_router_port_unparse_networks(struct ovsdb_idl_row *row_)
5737 : : {
5738 : 966 : struct nbrec_logical_router_port *row = nbrec_logical_router_port_cast(row_);
5739 : :
5740 [ - + ]: 966 : ovs_assert(inited);
5741 : 966 : free(row->networks);
5742 : 966 : }
5743 : :
5744 : : static void
5745 : 907 : nbrec_logical_router_port_unparse_peer(struct ovsdb_idl_row *row OVS_UNUSED)
5746 : : {
5747 : : /* Nothing to do. */
5748 : 907 : }
5749 : :
5750 : : static void
5751 : 897 : nbrec_logical_router_port_init__(struct ovsdb_idl_row *row)
5752 : : {
5753 : 897 : nbrec_logical_router_port_init(nbrec_logical_router_port_cast(row));
5754 : 897 : }
5755 : :
5756 : : /* Clears the contents of 'row' in table "Logical_Router_Port". */
5757 : : void
5758 : 897 : nbrec_logical_router_port_init(struct nbrec_logical_router_port *row)
5759 : : {
5760 : 897 : memset(row, 0, sizeof *row);
5761 : 897 : smap_init(&row->external_ids);
5762 : 897 : }
5763 : :
5764 : : /* Searches table "Logical_Router_Port" in 'idl' for a row with UUID 'uuid'. Returns
5765 : : * a pointer to the row if there is one, otherwise a null pointer. */
5766 : : const struct nbrec_logical_router_port *
5767 : 0 : nbrec_logical_router_port_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
5768 : : {
5769 : 0 : return nbrec_logical_router_port_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT], uuid));
5770 : : }
5771 : :
5772 : : /* Returns a row in table "Logical_Router_Port" in 'idl', or a null pointer if that
5773 : : * table is empty.
5774 : : *
5775 : : * Database tables are internally maintained as hash tables, so adding or
5776 : : * removing rows while traversing the same table can cause some rows to be
5777 : : * visited twice or not at apply. */
5778 : : const struct nbrec_logical_router_port *
5779 : 80 : nbrec_logical_router_port_first(const struct ovsdb_idl *idl)
5780 : : {
5781 : 80 : return nbrec_logical_router_port_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT]));
5782 : : }
5783 : :
5784 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
5785 : : * is the last row in its table. */
5786 : : const struct nbrec_logical_router_port *
5787 : 121 : nbrec_logical_router_port_next(const struct nbrec_logical_router_port *row)
5788 : : {
5789 : 121 : return nbrec_logical_router_port_cast(ovsdb_idl_next_row(&row->header_));
5790 : : }
5791 : :
5792 : 0 : unsigned int nbrec_logical_router_port_get_seqno(const struct ovsdb_idl *idl)
5793 : : {
5794 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT]);
5795 : : }
5796 : :
5797 : 0 : unsigned int nbrec_logical_router_port_row_get_seqno(const struct nbrec_logical_router_port *row, enum ovsdb_idl_change change)
5798 : : {
5799 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
5800 : : }
5801 : :
5802 : : const struct nbrec_logical_router_port *
5803 : 0 : nbrec_logical_router_port_track_get_first(const struct ovsdb_idl *idl)
5804 : : {
5805 : 0 : return nbrec_logical_router_port_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT]));
5806 : : }
5807 : :
5808 : : const struct nbrec_logical_router_port
5809 : 0 : *nbrec_logical_router_port_track_get_next(const struct nbrec_logical_router_port *row)
5810 : : {
5811 : 0 : return nbrec_logical_router_port_cast(ovsdb_idl_track_get_next(&row->header_));
5812 : : }
5813 : :
5814 : :
5815 : : /* Deletes 'row' from table "Logical_Router_Port". 'row' may be freed, so it must not be
5816 : : * accessed afterward.
5817 : : *
5818 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5819 : : void
5820 : 1 : nbrec_logical_router_port_delete(const struct nbrec_logical_router_port *row)
5821 : : {
5822 : 1 : ovsdb_idl_txn_delete(&row->header_);
5823 : 1 : }
5824 : :
5825 : : /* Inserts and returns a new row in the table "Logical_Router_Port" in the database
5826 : : * with open transaction 'txn'.
5827 : : *
5828 : : * The new row is assigned a randomly generated provisional UUID.
5829 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
5830 : : * but the IDL will replace any uses of the provisional UUID in the
5831 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
5832 : : struct nbrec_logical_router_port *
5833 : 63 : nbrec_logical_router_port_insert(struct ovsdb_idl_txn *txn)
5834 : : {
5835 : 63 : return nbrec_logical_router_port_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT], NULL));
5836 : : }
5837 : :
5838 : : bool
5839 : 0 : nbrec_logical_router_port_is_updated(const struct nbrec_logical_router_port *row, enum nbrec_logical_router_port_column_id column)
5840 : : {
5841 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_logical_router_port_columns[column]);
5842 : : }
5843 : :
5844 : : /* Causes the original contents of column "enabled" in 'row' to be
5845 : : * verified as a prerequisite to completing the transaction. That is, if
5846 : : * "enabled" in 'row' changed (or if 'row' was deleted) between the
5847 : : * time that the IDL originally read its contents and the time that the
5848 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5849 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5850 : : * change has already been received).
5851 : : *
5852 : : * The intention is that, to ensure that no transaction commits based on dirty
5853 : : * reads, an application should call this function any time "enabled" is
5854 : : * read as part of a read-modify-write operation.
5855 : : *
5856 : : * In some cases this function reduces to a no-op, because the current value
5857 : : * of "enabled" is already known:
5858 : : *
5859 : : * - If 'row' is a row created by the current transaction (returned by
5860 : : * nbrec_logical_router_port_insert()).
5861 : : *
5862 : : * - If "enabled" has already been modified (with
5863 : : * nbrec_logical_router_port_set_enabled()) within the current transaction.
5864 : : *
5865 : : * Because of the latter property, always call this function *before*
5866 : : * nbrec_logical_router_port_set_enabled() for a given read-modify-write.
5867 : : *
5868 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5869 : : void
5870 : 0 : nbrec_logical_router_port_verify_enabled(const struct nbrec_logical_router_port *row)
5871 : : {
5872 [ # # ]: 0 : ovs_assert(inited);
5873 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_ENABLED]);
5874 : 0 : }
5875 : :
5876 : : /* Causes the original contents of column "external_ids" in 'row' to be
5877 : : * verified as a prerequisite to completing the transaction. That is, if
5878 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
5879 : : * time that the IDL originally read its contents and the time that the
5880 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5881 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5882 : : * change has already been received).
5883 : : *
5884 : : * The intention is that, to ensure that no transaction commits based on dirty
5885 : : * reads, an application should call this function any time "external_ids" is
5886 : : * read as part of a read-modify-write operation.
5887 : : *
5888 : : * In some cases this function reduces to a no-op, because the current value
5889 : : * of "external_ids" is already known:
5890 : : *
5891 : : * - If 'row' is a row created by the current transaction (returned by
5892 : : * nbrec_logical_router_port_insert()).
5893 : : *
5894 : : * - If "external_ids" has already been modified (with
5895 : : * nbrec_logical_router_port_set_external_ids()) within the current transaction.
5896 : : *
5897 : : * Because of the latter property, always call this function *before*
5898 : : * nbrec_logical_router_port_set_external_ids() for a given read-modify-write.
5899 : : *
5900 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5901 : : void
5902 : 0 : nbrec_logical_router_port_verify_external_ids(const struct nbrec_logical_router_port *row)
5903 : : {
5904 [ # # ]: 0 : ovs_assert(inited);
5905 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_EXTERNAL_IDS]);
5906 : 0 : }
5907 : :
5908 : : /* Causes the original contents of column "mac" in 'row' to be
5909 : : * verified as a prerequisite to completing the transaction. That is, if
5910 : : * "mac" in 'row' changed (or if 'row' was deleted) between the
5911 : : * time that the IDL originally read its contents and the time that the
5912 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5913 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5914 : : * change has already been received).
5915 : : *
5916 : : * The intention is that, to ensure that no transaction commits based on dirty
5917 : : * reads, an application should call this function any time "mac" is
5918 : : * read as part of a read-modify-write operation.
5919 : : *
5920 : : * In some cases this function reduces to a no-op, because the current value
5921 : : * of "mac" is already known:
5922 : : *
5923 : : * - If 'row' is a row created by the current transaction (returned by
5924 : : * nbrec_logical_router_port_insert()).
5925 : : *
5926 : : * - If "mac" has already been modified (with
5927 : : * nbrec_logical_router_port_set_mac()) within the current transaction.
5928 : : *
5929 : : * Because of the latter property, always call this function *before*
5930 : : * nbrec_logical_router_port_set_mac() for a given read-modify-write.
5931 : : *
5932 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5933 : : void
5934 : 0 : nbrec_logical_router_port_verify_mac(const struct nbrec_logical_router_port *row)
5935 : : {
5936 [ # # ]: 0 : ovs_assert(inited);
5937 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_MAC]);
5938 : 0 : }
5939 : :
5940 : : /* Causes the original contents of column "name" in 'row' to be
5941 : : * verified as a prerequisite to completing the transaction. That is, if
5942 : : * "name" in 'row' changed (or if 'row' was deleted) between the
5943 : : * time that the IDL originally read its contents and the time that the
5944 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5945 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5946 : : * change has already been received).
5947 : : *
5948 : : * The intention is that, to ensure that no transaction commits based on dirty
5949 : : * reads, an application should call this function any time "name" is
5950 : : * read as part of a read-modify-write operation.
5951 : : *
5952 : : * In some cases this function reduces to a no-op, because the current value
5953 : : * of "name" is already known:
5954 : : *
5955 : : * - If 'row' is a row created by the current transaction (returned by
5956 : : * nbrec_logical_router_port_insert()).
5957 : : *
5958 : : * - If "name" has already been modified (with
5959 : : * nbrec_logical_router_port_set_name()) within the current transaction.
5960 : : *
5961 : : * Because of the latter property, always call this function *before*
5962 : : * nbrec_logical_router_port_set_name() for a given read-modify-write.
5963 : : *
5964 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5965 : : void
5966 : 0 : nbrec_logical_router_port_verify_name(const struct nbrec_logical_router_port *row)
5967 : : {
5968 [ # # ]: 0 : ovs_assert(inited);
5969 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NAME]);
5970 : 0 : }
5971 : :
5972 : : /* Causes the original contents of column "networks" in 'row' to be
5973 : : * verified as a prerequisite to completing the transaction. That is, if
5974 : : * "networks" in 'row' changed (or if 'row' was deleted) between the
5975 : : * time that the IDL originally read its contents and the time that the
5976 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5977 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5978 : : * change has already been received).
5979 : : *
5980 : : * The intention is that, to ensure that no transaction commits based on dirty
5981 : : * reads, an application should call this function any time "networks" is
5982 : : * read as part of a read-modify-write operation.
5983 : : *
5984 : : * In some cases this function reduces to a no-op, because the current value
5985 : : * of "networks" is already known:
5986 : : *
5987 : : * - If 'row' is a row created by the current transaction (returned by
5988 : : * nbrec_logical_router_port_insert()).
5989 : : *
5990 : : * - If "networks" has already been modified (with
5991 : : * nbrec_logical_router_port_set_networks()) within the current transaction.
5992 : : *
5993 : : * Because of the latter property, always call this function *before*
5994 : : * nbrec_logical_router_port_set_networks() for a given read-modify-write.
5995 : : *
5996 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5997 : : void
5998 : 0 : nbrec_logical_router_port_verify_networks(const struct nbrec_logical_router_port *row)
5999 : : {
6000 [ # # ]: 0 : ovs_assert(inited);
6001 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NETWORKS]);
6002 : 0 : }
6003 : :
6004 : : /* Causes the original contents of column "peer" in 'row' to be
6005 : : * verified as a prerequisite to completing the transaction. That is, if
6006 : : * "peer" in 'row' changed (or if 'row' was deleted) between the
6007 : : * time that the IDL originally read its contents and the time that the
6008 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
6009 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
6010 : : * change has already been received).
6011 : : *
6012 : : * The intention is that, to ensure that no transaction commits based on dirty
6013 : : * reads, an application should call this function any time "peer" is
6014 : : * read as part of a read-modify-write operation.
6015 : : *
6016 : : * In some cases this function reduces to a no-op, because the current value
6017 : : * of "peer" is already known:
6018 : : *
6019 : : * - If 'row' is a row created by the current transaction (returned by
6020 : : * nbrec_logical_router_port_insert()).
6021 : : *
6022 : : * - If "peer" has already been modified (with
6023 : : * nbrec_logical_router_port_set_peer()) within the current transaction.
6024 : : *
6025 : : * Because of the latter property, always call this function *before*
6026 : : * nbrec_logical_router_port_set_peer() for a given read-modify-write.
6027 : : *
6028 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6029 : : void
6030 : 0 : nbrec_logical_router_port_verify_peer(const struct nbrec_logical_router_port *row)
6031 : : {
6032 [ # # ]: 0 : ovs_assert(inited);
6033 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_PEER]);
6034 : 0 : }
6035 : :
6036 : : /* Returns the "enabled" column's value from the "Logical_Router_Port" table in 'row'
6037 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6038 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6039 : : * for a given key than implementing the same operation on the "cooked"
6040 : : * form in 'row'.
6041 : : *
6042 : : * 'key_type' must be OVSDB_TYPE_BOOLEAN.
6043 : : * (This helps to avoid silent bugs if someone changes enabled's
6044 : : * type without updating the caller.)
6045 : : *
6046 : : * The caller must not modify or free the returned value.
6047 : : *
6048 : : * Various kinds of changes can invalidate the returned value: modifying
6049 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6050 : : * If the returned value is needed for a long time, it is best to make a copy
6051 : : * of it with ovsdb_datum_clone().
6052 : : *
6053 : : * This function is rarely useful, since it is easier to access the value
6054 : : * directly through the "enabled" member in nbrec_logical_router_port. */
6055 : : const struct ovsdb_datum *
6056 : 0 : nbrec_logical_router_port_get_enabled(const struct nbrec_logical_router_port *row,
6057 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6058 : : {
6059 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
6060 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_port_col_enabled);
6061 : : }
6062 : :
6063 : : /* Returns the "external_ids" column's value from the "Logical_Router_Port" table in 'row'
6064 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6065 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6066 : : * for a given key than implementing the same operation on the "cooked"
6067 : : * form in 'row'.
6068 : : *
6069 : : * 'key_type' must be OVSDB_TYPE_STRING.
6070 : : * 'value_type' must be OVSDB_TYPE_STRING.
6071 : : * (This helps to avoid silent bugs if someone changes external_ids's
6072 : : * type without updating the caller.)
6073 : : *
6074 : : * The caller must not modify or free the returned value.
6075 : : *
6076 : : * Various kinds of changes can invalidate the returned value: modifying
6077 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6078 : : * If the returned value is needed for a long time, it is best to make a copy
6079 : : * of it with ovsdb_datum_clone().
6080 : : *
6081 : : * This function is rarely useful, since it is easier to access the value
6082 : : * directly through the "external_ids" member in nbrec_logical_router_port. */
6083 : : const struct ovsdb_datum *
6084 : 0 : nbrec_logical_router_port_get_external_ids(const struct nbrec_logical_router_port *row,
6085 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
6086 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
6087 : : {
6088 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6089 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
6090 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_port_col_external_ids);
6091 : : }
6092 : :
6093 : : /* Returns the "mac" column's value from the "Logical_Router_Port" table in 'row'
6094 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6095 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6096 : : * for a given key than implementing the same operation on the "cooked"
6097 : : * form in 'row'.
6098 : : *
6099 : : * 'key_type' must be OVSDB_TYPE_STRING.
6100 : : * (This helps to avoid silent bugs if someone changes mac's
6101 : : * type without updating the caller.)
6102 : : *
6103 : : * The caller must not modify or free the returned value.
6104 : : *
6105 : : * Various kinds of changes can invalidate the returned value: modifying
6106 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6107 : : * If the returned value is needed for a long time, it is best to make a copy
6108 : : * of it with ovsdb_datum_clone().
6109 : : *
6110 : : * This function is rarely useful, since it is easier to access the value
6111 : : * directly through the "mac" member in nbrec_logical_router_port. */
6112 : : const struct ovsdb_datum *
6113 : 0 : nbrec_logical_router_port_get_mac(const struct nbrec_logical_router_port *row,
6114 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6115 : : {
6116 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6117 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_port_col_mac);
6118 : : }
6119 : :
6120 : : /* Returns the "name" column's value from the "Logical_Router_Port" table in 'row'
6121 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6122 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6123 : : * for a given key than implementing the same operation on the "cooked"
6124 : : * form in 'row'.
6125 : : *
6126 : : * 'key_type' must be OVSDB_TYPE_STRING.
6127 : : * (This helps to avoid silent bugs if someone changes name's
6128 : : * type without updating the caller.)
6129 : : *
6130 : : * The caller must not modify or free the returned value.
6131 : : *
6132 : : * Various kinds of changes can invalidate the returned value: modifying
6133 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6134 : : * If the returned value is needed for a long time, it is best to make a copy
6135 : : * of it with ovsdb_datum_clone().
6136 : : *
6137 : : * This function is rarely useful, since it is easier to access the value
6138 : : * directly through the "name" member in nbrec_logical_router_port. */
6139 : : const struct ovsdb_datum *
6140 : 0 : nbrec_logical_router_port_get_name(const struct nbrec_logical_router_port *row,
6141 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6142 : : {
6143 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6144 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_port_col_name);
6145 : : }
6146 : :
6147 : : /* Returns the "networks" column's value from the "Logical_Router_Port" table in 'row'
6148 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6149 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6150 : : * for a given key than implementing the same operation on the "cooked"
6151 : : * form in 'row'.
6152 : : *
6153 : : * 'key_type' must be OVSDB_TYPE_STRING.
6154 : : * (This helps to avoid silent bugs if someone changes networks's
6155 : : * type without updating the caller.)
6156 : : *
6157 : : * The caller must not modify or free the returned value.
6158 : : *
6159 : : * Various kinds of changes can invalidate the returned value: modifying
6160 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6161 : : * If the returned value is needed for a long time, it is best to make a copy
6162 : : * of it with ovsdb_datum_clone().
6163 : : *
6164 : : * This function is rarely useful, since it is easier to access the value
6165 : : * directly through the "networks" member in nbrec_logical_router_port. */
6166 : : const struct ovsdb_datum *
6167 : 0 : nbrec_logical_router_port_get_networks(const struct nbrec_logical_router_port *row,
6168 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6169 : : {
6170 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6171 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_port_col_networks);
6172 : : }
6173 : :
6174 : : /* Returns the "peer" column's value from the "Logical_Router_Port" table in 'row'
6175 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6176 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6177 : : * for a given key than implementing the same operation on the "cooked"
6178 : : * form in 'row'.
6179 : : *
6180 : : * 'key_type' must be OVSDB_TYPE_STRING.
6181 : : * (This helps to avoid silent bugs if someone changes peer's
6182 : : * type without updating the caller.)
6183 : : *
6184 : : * The caller must not modify or free the returned value.
6185 : : *
6186 : : * Various kinds of changes can invalidate the returned value: modifying
6187 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6188 : : * If the returned value is needed for a long time, it is best to make a copy
6189 : : * of it with ovsdb_datum_clone().
6190 : : *
6191 : : * This function is rarely useful, since it is easier to access the value
6192 : : * directly through the "peer" member in nbrec_logical_router_port. */
6193 : : const struct ovsdb_datum *
6194 : 0 : nbrec_logical_router_port_get_peer(const struct nbrec_logical_router_port *row,
6195 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6196 : : {
6197 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6198 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_port_col_peer);
6199 : : }
6200 : :
6201 : : /* Sets the "enabled" column from the "Logical_Router_Port" table in 'row' to
6202 : : * the 'enabled' set with 'n_enabled' entries.
6203 : : *
6204 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
6205 : : * may be NULL.
6206 : : *
6207 : : * The caller retains ownership of the arguments. */
6208 : : void
6209 : 2 : nbrec_logical_router_port_set_enabled(const struct nbrec_logical_router_port *row, const bool *enabled, size_t n_enabled)
6210 : : {
6211 : : struct ovsdb_datum datum;
6212 : : union ovsdb_atom key;
6213 : :
6214 [ - + ]: 2 : ovs_assert(inited);
6215 [ + - ]: 2 : if (n_enabled) {
6216 : 2 : datum.n = 1;
6217 : 2 : datum.keys = &key;
6218 : 2 : key.boolean = *enabled;
6219 : : } else {
6220 : 0 : datum.n = 0;
6221 : 0 : datum.keys = NULL;
6222 : : }
6223 : 2 : datum.values = NULL;
6224 : 2 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_ENABLED], &datum);
6225 : 2 : }
6226 : :
6227 : : /* Sets the "external_ids" column's value from the "Logical_Router_Port" table in 'row'
6228 : : * to 'external_ids'.
6229 : : *
6230 : : * The caller retains ownership of 'external_ids' and everything in it. */
6231 : : void
6232 : 0 : nbrec_logical_router_port_set_external_ids(const struct nbrec_logical_router_port *row, const struct smap *external_ids)
6233 : : {
6234 : : struct ovsdb_datum datum;
6235 : :
6236 [ # # ]: 0 : ovs_assert(inited);
6237 [ # # ]: 0 : if (external_ids) {
6238 : : struct smap_node *node;
6239 : : size_t i;
6240 : :
6241 : 0 : datum.n = smap_count(external_ids);
6242 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6243 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
6244 : :
6245 : 0 : i = 0;
6246 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
6247 : 0 : datum.keys[i].string = xstrdup(node->key);
6248 : 0 : datum.values[i].string = xstrdup(node->value);
6249 : 0 : i++;
6250 : : }
6251 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6252 : : } else {
6253 : 0 : ovsdb_datum_init_empty(&datum);
6254 : : }
6255 : 0 : ovsdb_idl_txn_write(&row->header_,
6256 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_EXTERNAL_IDS],
6257 : : &datum);
6258 : 0 : }
6259 : :
6260 : :
6261 : : /* Sets the "mac" column from the "Logical_Router_Port" table in 'row' to
6262 : : * 'mac'.
6263 : : *
6264 : : * The caller retains ownership of the arguments. */
6265 : : void
6266 : 63 : nbrec_logical_router_port_set_mac(const struct nbrec_logical_router_port *row, const char *mac)
6267 : : {
6268 : : struct ovsdb_datum datum;
6269 : : union ovsdb_atom key;
6270 : :
6271 [ - + ]: 63 : ovs_assert(inited);
6272 : 63 : datum.n = 1;
6273 : 63 : datum.keys = &key;
6274 : 63 : key.string = CONST_CAST(char *, mac);
6275 : 63 : datum.values = NULL;
6276 : 63 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_MAC], &datum);
6277 : 63 : }
6278 : :
6279 : : /* Sets the "name" column from the "Logical_Router_Port" table in 'row' to
6280 : : * 'name'.
6281 : : *
6282 : : * The caller retains ownership of the arguments. */
6283 : : void
6284 : 63 : nbrec_logical_router_port_set_name(const struct nbrec_logical_router_port *row, const char *name)
6285 : : {
6286 : : struct ovsdb_datum datum;
6287 : : union ovsdb_atom key;
6288 : :
6289 [ - + ]: 63 : ovs_assert(inited);
6290 : 63 : datum.n = 1;
6291 : 63 : datum.keys = &key;
6292 : 63 : key.string = CONST_CAST(char *, name);
6293 : 63 : datum.values = NULL;
6294 : 63 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NAME], &datum);
6295 : 63 : }
6296 : :
6297 : : /* Sets the "networks" column from the "Logical_Router_Port" table in 'row' to
6298 : : * the 'networks' set with 'n_networks' entries.
6299 : : *
6300 : : * The caller retains ownership of the arguments. */
6301 : : void
6302 : 63 : nbrec_logical_router_port_set_networks(const struct nbrec_logical_router_port *row, const char **networks, size_t n_networks)
6303 : : {
6304 : : struct ovsdb_datum datum;
6305 : : size_t i;
6306 : :
6307 [ - + ]: 63 : ovs_assert(inited);
6308 : 63 : datum.n = n_networks;
6309 [ + - ]: 63 : datum.keys = n_networks ? xmalloc(n_networks * sizeof *datum.keys) : NULL;
6310 : 63 : datum.values = NULL;
6311 [ + + ]: 128 : for (i = 0; i < n_networks; i++) {
6312 : 65 : datum.keys[i].string = xstrdup(networks[i]);
6313 : : }
6314 : 63 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
6315 : 63 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NETWORKS], &datum);
6316 : 63 : }
6317 : :
6318 : : /* Sets the "peer" column from the "Logical_Router_Port" table in 'row' to
6319 : : * the 'peer' set.
6320 : : *
6321 : : * If "peer" is null, the column will be the empty set,
6322 : : * otherwise it will contain the specified value.
6323 : : *
6324 : : * The caller retains ownership of the arguments. */
6325 : : void
6326 : 0 : nbrec_logical_router_port_set_peer(const struct nbrec_logical_router_port *row, const char *peer)
6327 : : {
6328 : : struct ovsdb_datum datum;
6329 : : union ovsdb_atom key;
6330 : :
6331 [ # # ]: 0 : ovs_assert(inited);
6332 [ # # ]: 0 : if (peer) {
6333 : 0 : datum.n = 1;
6334 : 0 : datum.keys = &key;
6335 : 0 : key.string = CONST_CAST(char *, peer);
6336 : : } else {
6337 : 0 : datum.n = 0;
6338 : 0 : datum.keys = NULL;
6339 : : }
6340 : 0 : datum.values = NULL;
6341 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_PEER], &datum);
6342 : 0 : }
6343 : :
6344 : : /* Adds the value 'new_value' to the "enabled" set column from the "Logical_Router_Port" table
6345 : : * in 'row'.
6346 : : *
6347 : : */
6348 : : void
6349 : 0 : nbrec_logical_router_port_update_enabled_addvalue(const struct nbrec_logical_router_port *row, bool new_value)
6350 : : {
6351 : : struct ovsdb_datum *datum;
6352 : :
6353 [ # # ]: 0 : ovs_assert(inited);
6354 : :
6355 : 0 : datum = xmalloc(sizeof *datum);
6356 : 0 : datum->n = 1;
6357 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6358 : 0 : datum->values = NULL;
6359 : :
6360 : 0 : datum->keys[0].boolean = new_value;
6361 : :
6362 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
6363 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_ENABLED],
6364 : : datum);
6365 : 0 : }
6366 : :
6367 : : /* Deletes the value 'delete_value' from the "enabled" set column from the
6368 : : * "Logical_Router_Port" table in 'row'.
6369 : : *
6370 : : */
6371 : : void
6372 : 0 : nbrec_logical_router_port_update_enabled_delvalue(const struct nbrec_logical_router_port *row, bool delete_value)
6373 : : {
6374 : : struct ovsdb_datum *datum;
6375 : :
6376 [ # # ]: 0 : ovs_assert(inited);
6377 : :
6378 : 0 : datum = xmalloc(sizeof *datum);
6379 : 0 : datum->n = 1;
6380 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6381 : 0 : datum->values = NULL;
6382 : :
6383 : 0 : datum->keys[0].boolean = delete_value;
6384 : :
6385 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
6386 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_ENABLED],
6387 : : datum);
6388 : 0 : }
6389 : :
6390 : : /* Sets an element of the "external_ids" map column from the "Logical_Router_Port" table in 'row'
6391 : : * to 'new_value' given the key value 'new_key'.
6392 : : *
6393 : : */
6394 : : void
6395 : 0 : nbrec_logical_router_port_update_external_ids_setkey(const struct nbrec_logical_router_port *row, const char *new_key, const char *new_value)
6396 : : {
6397 : : struct ovsdb_datum *datum;
6398 : :
6399 [ # # ]: 0 : ovs_assert(inited);
6400 : :
6401 : 0 : datum = xmalloc(sizeof *datum);
6402 : 0 : datum->n = 1;
6403 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6404 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
6405 : :
6406 : 0 : datum->keys[0].string = xstrdup(new_key);
6407 : 0 : datum->values[0].string = xstrdup(new_value);
6408 : :
6409 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
6410 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_EXTERNAL_IDS],
6411 : : datum);
6412 : 0 : }
6413 : :
6414 : : /* Deletes an element of the "external_ids" map column from the "Logical_Router_Port" table in 'row'
6415 : : * given the key value 'delete_key'.
6416 : : *
6417 : : */
6418 : : void
6419 : 0 : nbrec_logical_router_port_update_external_ids_delkey(const struct nbrec_logical_router_port *row, const char *delete_key)
6420 : : {
6421 : : struct ovsdb_datum *datum;
6422 : :
6423 [ # # ]: 0 : ovs_assert(inited);
6424 : :
6425 : 0 : datum = xmalloc(sizeof *datum);
6426 : 0 : datum->n = 1;
6427 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6428 : 0 : datum->values = NULL;
6429 : :
6430 : 0 : datum->keys[0].string = xstrdup(delete_key);
6431 : :
6432 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
6433 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_EXTERNAL_IDS],
6434 : : datum);
6435 : 0 : }
6436 : :
6437 : : /* Adds the value 'new_value' to the "networks" set column from the "Logical_Router_Port" table
6438 : : * in 'row'.
6439 : : *
6440 : : */
6441 : : void
6442 : 0 : nbrec_logical_router_port_update_networks_addvalue(const struct nbrec_logical_router_port *row, const char *new_value)
6443 : : {
6444 : : struct ovsdb_datum *datum;
6445 : :
6446 [ # # ]: 0 : ovs_assert(inited);
6447 : :
6448 : 0 : datum = xmalloc(sizeof *datum);
6449 : 0 : datum->n = 1;
6450 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6451 : 0 : datum->values = NULL;
6452 : :
6453 : 0 : datum->keys[0].string = xstrdup(new_value);
6454 : :
6455 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
6456 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NETWORKS],
6457 : : datum);
6458 : 0 : }
6459 : :
6460 : : /* Deletes the value 'delete_value' from the "networks" set column from the
6461 : : * "Logical_Router_Port" table in 'row'.
6462 : : *
6463 : : */
6464 : : void
6465 : 0 : nbrec_logical_router_port_update_networks_delvalue(const struct nbrec_logical_router_port *row, const char *delete_value)
6466 : : {
6467 : : struct ovsdb_datum *datum;
6468 : :
6469 [ # # ]: 0 : ovs_assert(inited);
6470 : :
6471 : 0 : datum = xmalloc(sizeof *datum);
6472 : 0 : datum->n = 1;
6473 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6474 : 0 : datum->values = NULL;
6475 : :
6476 : 0 : datum->keys[0].string = xstrdup(delete_value);
6477 : :
6478 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
6479 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NETWORKS],
6480 : : datum);
6481 : 0 : }
6482 : :
6483 : : /* Adds the value 'new_value' to the "peer" set column from the "Logical_Router_Port" table
6484 : : * in 'row'.
6485 : : *
6486 : : */
6487 : : void
6488 : 0 : nbrec_logical_router_port_update_peer_addvalue(const struct nbrec_logical_router_port *row, const char *new_value)
6489 : : {
6490 : : struct ovsdb_datum *datum;
6491 : :
6492 [ # # ]: 0 : ovs_assert(inited);
6493 : :
6494 : 0 : datum = xmalloc(sizeof *datum);
6495 : 0 : datum->n = 1;
6496 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6497 : 0 : datum->values = NULL;
6498 : :
6499 : 0 : datum->keys[0].string = xstrdup(new_value);
6500 : :
6501 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
6502 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_PEER],
6503 : : datum);
6504 : 0 : }
6505 : :
6506 : : /* Deletes the value 'delete_value' from the "peer" set column from the
6507 : : * "Logical_Router_Port" table in 'row'.
6508 : : *
6509 : : */
6510 : : void
6511 : 0 : nbrec_logical_router_port_update_peer_delvalue(const struct nbrec_logical_router_port *row, const char *delete_value)
6512 : : {
6513 : : struct ovsdb_datum *datum;
6514 : :
6515 [ # # ]: 0 : ovs_assert(inited);
6516 : :
6517 : 0 : datum = xmalloc(sizeof *datum);
6518 : 0 : datum->n = 1;
6519 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6520 : 0 : datum->values = NULL;
6521 : :
6522 : 0 : datum->keys[0].string = xstrdup(delete_value);
6523 : :
6524 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
6525 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_PEER],
6526 : : datum);
6527 : 0 : }
6528 : :
6529 : : /* Sets the "enabled" column from the "Logical_Router_Port" table in 'row' to
6530 : : * the 'enabled' set with 'n_enabled' entries.
6531 : : *
6532 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
6533 : : * may be NULL.
6534 : : *
6535 : : * The caller retains ownership of the arguments. */
6536 : : void
6537 : 0 : nbrec_logical_router_port_add_clause_enabled(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *enabled, size_t n_enabled)
6538 : : {
6539 : : struct ovsdb_datum datum;
6540 : : union ovsdb_atom key;
6541 : :
6542 [ # # ]: 0 : ovs_assert(inited);
6543 [ # # ]: 0 : if (n_enabled) {
6544 : 0 : datum.n = 1;
6545 : 0 : datum.keys = &key;
6546 : 0 : key.boolean = *enabled;
6547 : : } else {
6548 : 0 : datum.n = 0;
6549 : 0 : datum.keys = NULL;
6550 : : }
6551 : 0 : datum.values = NULL;
6552 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6553 : : function,
6554 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_ENABLED],
6555 : : &datum);
6556 : 0 : }
6557 : :
6558 : : /* Sets the "external_ids" column's value from the "Logical_Router_Port" table in 'row'
6559 : : * to 'external_ids'.
6560 : : *
6561 : : * The caller retains ownership of 'external_ids' and everything in it. */
6562 : : void
6563 : 0 : nbrec_logical_router_port_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
6564 : : {
6565 : : struct ovsdb_datum datum;
6566 : :
6567 [ # # ]: 0 : ovs_assert(inited);
6568 [ # # ]: 0 : if (external_ids) {
6569 : : struct smap_node *node;
6570 : : size_t i;
6571 : :
6572 : 0 : datum.n = smap_count(external_ids);
6573 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6574 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
6575 : :
6576 : 0 : i = 0;
6577 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
6578 : 0 : datum.keys[i].string = xstrdup(node->key);
6579 : 0 : datum.values[i].string = xstrdup(node->value);
6580 : 0 : i++;
6581 : : }
6582 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6583 : : } else {
6584 : 0 : ovsdb_datum_init_empty(&datum);
6585 : : }
6586 : :
6587 : 0 : ovsdb_idl_condition_add_clause(idl,
6588 : : &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6589 : : function,
6590 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_EXTERNAL_IDS],
6591 : : &datum);
6592 : :
6593 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_router_port_col_external_ids.type);
6594 : 0 : }
6595 : :
6596 : :
6597 : : /* Sets the "mac" column from the "Logical_Router_Port" table in 'row' to
6598 : : * 'mac'.
6599 : : *
6600 : : * The caller retains ownership of the arguments. */
6601 : : void
6602 : 0 : nbrec_logical_router_port_add_clause_mac(struct ovsdb_idl *idl, enum ovsdb_function function, const char *mac)
6603 : : {
6604 : : struct ovsdb_datum datum;
6605 : : union ovsdb_atom key;
6606 : :
6607 [ # # ]: 0 : ovs_assert(inited);
6608 : 0 : datum.n = 1;
6609 : 0 : datum.keys = &key;
6610 : 0 : key.string = CONST_CAST(char *, mac);
6611 : 0 : datum.values = NULL;
6612 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6613 : : function,
6614 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_MAC],
6615 : : &datum);
6616 : 0 : }
6617 : :
6618 : : /* Sets the "name" column from the "Logical_Router_Port" table in 'row' to
6619 : : * 'name'.
6620 : : *
6621 : : * The caller retains ownership of the arguments. */
6622 : : void
6623 : 0 : nbrec_logical_router_port_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
6624 : : {
6625 : : struct ovsdb_datum datum;
6626 : : union ovsdb_atom key;
6627 : :
6628 [ # # ]: 0 : ovs_assert(inited);
6629 : 0 : datum.n = 1;
6630 : 0 : datum.keys = &key;
6631 : 0 : key.string = CONST_CAST(char *, name);
6632 : 0 : datum.values = NULL;
6633 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6634 : : function,
6635 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NAME],
6636 : : &datum);
6637 : 0 : }
6638 : :
6639 : : /* Sets the "networks" column from the "Logical_Router_Port" table in 'row' to
6640 : : * the 'networks' set with 'n_networks' entries.
6641 : : *
6642 : : * The caller retains ownership of the arguments. */
6643 : : void
6644 : 0 : nbrec_logical_router_port_add_clause_networks(struct ovsdb_idl *idl, enum ovsdb_function function, const char **networks, size_t n_networks)
6645 : : {
6646 : : struct ovsdb_datum datum;
6647 : : size_t i;
6648 : :
6649 [ # # ]: 0 : ovs_assert(inited);
6650 : 0 : datum.n = n_networks;
6651 [ # # ]: 0 : datum.keys = n_networks ? xmalloc(n_networks * sizeof *datum.keys) : NULL;
6652 : 0 : datum.values = NULL;
6653 [ # # ]: 0 : for (i = 0; i < n_networks; i++) {
6654 : 0 : datum.keys[i].string = CONST_CAST(char *, networks[i]);
6655 : : }
6656 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
6657 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6658 : : function,
6659 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NETWORKS],
6660 : : &datum);
6661 : 0 : free(datum.keys);
6662 : 0 : }
6663 : :
6664 : : /* Sets the "peer" column from the "Logical_Router_Port" table in 'row' to
6665 : : * the 'peer' set.
6666 : : *
6667 : : * If "peer" is null, the column will be the empty set,
6668 : : * otherwise it will contain the specified value.
6669 : : *
6670 : : * The caller retains ownership of the arguments. */
6671 : : void
6672 : 0 : nbrec_logical_router_port_add_clause_peer(struct ovsdb_idl *idl, enum ovsdb_function function, const char *peer)
6673 : : {
6674 : : struct ovsdb_datum datum;
6675 : : union ovsdb_atom key;
6676 : :
6677 [ # # ]: 0 : ovs_assert(inited);
6678 [ # # ]: 0 : if (peer) {
6679 : 0 : datum.n = 1;
6680 : 0 : datum.keys = &key;
6681 : 0 : key.string = CONST_CAST(char *, peer);
6682 : : } else {
6683 : 0 : datum.n = 0;
6684 : 0 : datum.keys = NULL;
6685 : : }
6686 : 0 : datum.values = NULL;
6687 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6688 : : function,
6689 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_PEER],
6690 : : &datum);
6691 : 0 : }
6692 : : void
6693 : 0 : nbrec_logical_router_port_add_clause_false(struct ovsdb_idl *idl)
6694 : : {
6695 : : struct ovsdb_datum datum;
6696 : :
6697 : 0 : ovsdb_datum_init_empty(&datum);
6698 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT], OVSDB_F_FALSE, NULL, &datum);
6699 : 0 : }
6700 : : void
6701 : 0 : nbrec_logical_router_port_add_clause_true(struct ovsdb_idl *idl)
6702 : : {
6703 : : struct ovsdb_datum datum;
6704 : :
6705 : 0 : ovsdb_datum_init_empty(&datum);
6706 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT], OVSDB_F_TRUE, NULL, &datum);
6707 : 0 : }
6708 : :
6709 : : /* Sets the "enabled" column from the "Logical_Router_Port" table in 'row' to
6710 : : * the 'enabled' set with 'n_enabled' entries.
6711 : : *
6712 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
6713 : : * may be NULL.
6714 : : *
6715 : : * The caller retains ownership of the arguments. */
6716 : : void
6717 : 0 : nbrec_logical_router_port_remove_clause_enabled(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *enabled, size_t n_enabled)
6718 : : {
6719 : : struct ovsdb_datum datum;
6720 : : union ovsdb_atom key;
6721 : :
6722 [ # # ]: 0 : ovs_assert(inited);
6723 [ # # ]: 0 : if (n_enabled) {
6724 : 0 : datum.n = 1;
6725 : 0 : datum.keys = &key;
6726 : 0 : key.boolean = *enabled;
6727 : : } else {
6728 : 0 : datum.n = 0;
6729 : 0 : datum.keys = NULL;
6730 : : }
6731 : 0 : datum.values = NULL;
6732 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6733 : : function,
6734 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_ENABLED],
6735 : : &datum);
6736 : 0 : }
6737 : :
6738 : : /* Sets the "external_ids" column's value from the "Logical_Router_Port" table in 'row'
6739 : : * to 'external_ids'.
6740 : : *
6741 : : * The caller retains ownership of 'external_ids' and everything in it. */
6742 : : void
6743 : 0 : nbrec_logical_router_port_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
6744 : : {
6745 : : struct ovsdb_datum datum;
6746 : :
6747 [ # # ]: 0 : ovs_assert(inited);
6748 [ # # ]: 0 : if (external_ids) {
6749 : : struct smap_node *node;
6750 : : size_t i;
6751 : :
6752 : 0 : datum.n = smap_count(external_ids);
6753 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6754 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
6755 : :
6756 : 0 : i = 0;
6757 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
6758 : 0 : datum.keys[i].string = xstrdup(node->key);
6759 : 0 : datum.values[i].string = xstrdup(node->value);
6760 : 0 : i++;
6761 : : }
6762 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6763 : : } else {
6764 : 0 : ovsdb_datum_init_empty(&datum);
6765 : : }
6766 : :
6767 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6768 : : function,
6769 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_EXTERNAL_IDS],
6770 : : &datum);
6771 : :
6772 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_router_port_col_external_ids.type);
6773 : 0 : }
6774 : :
6775 : :
6776 : : /* Sets the "mac" column from the "Logical_Router_Port" table in 'row' to
6777 : : * 'mac'.
6778 : : *
6779 : : * The caller retains ownership of the arguments. */
6780 : : void
6781 : 0 : nbrec_logical_router_port_remove_clause_mac(struct ovsdb_idl *idl, enum ovsdb_function function, const char *mac)
6782 : : {
6783 : : struct ovsdb_datum datum;
6784 : : union ovsdb_atom key;
6785 : :
6786 [ # # ]: 0 : ovs_assert(inited);
6787 : 0 : datum.n = 1;
6788 : 0 : datum.keys = &key;
6789 : 0 : key.string = CONST_CAST(char *, mac);
6790 : 0 : datum.values = NULL;
6791 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6792 : : function,
6793 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_MAC],
6794 : : &datum);
6795 : 0 : }
6796 : :
6797 : : /* Sets the "name" column from the "Logical_Router_Port" table in 'row' to
6798 : : * 'name'.
6799 : : *
6800 : : * The caller retains ownership of the arguments. */
6801 : : void
6802 : 0 : nbrec_logical_router_port_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
6803 : : {
6804 : : struct ovsdb_datum datum;
6805 : : union ovsdb_atom key;
6806 : :
6807 [ # # ]: 0 : ovs_assert(inited);
6808 : 0 : datum.n = 1;
6809 : 0 : datum.keys = &key;
6810 : 0 : key.string = CONST_CAST(char *, name);
6811 : 0 : datum.values = NULL;
6812 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6813 : : function,
6814 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NAME],
6815 : : &datum);
6816 : 0 : }
6817 : :
6818 : : /* Sets the "networks" column from the "Logical_Router_Port" table in 'row' to
6819 : : * the 'networks' set with 'n_networks' entries.
6820 : : *
6821 : : * The caller retains ownership of the arguments. */
6822 : : void
6823 : 0 : nbrec_logical_router_port_remove_clause_networks(struct ovsdb_idl *idl, enum ovsdb_function function, const char **networks, size_t n_networks)
6824 : : {
6825 : : struct ovsdb_datum datum;
6826 : : size_t i;
6827 : :
6828 [ # # ]: 0 : ovs_assert(inited);
6829 : 0 : datum.n = n_networks;
6830 [ # # ]: 0 : datum.keys = n_networks ? xmalloc(n_networks * sizeof *datum.keys) : NULL;
6831 : 0 : datum.values = NULL;
6832 [ # # ]: 0 : for (i = 0; i < n_networks; i++) {
6833 : 0 : datum.keys[i].string = CONST_CAST(char *, networks[i]);
6834 : : }
6835 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
6836 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6837 : : function,
6838 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_NETWORKS],
6839 : : &datum);
6840 : 0 : free(datum.keys);
6841 : 0 : }
6842 : :
6843 : : /* Sets the "peer" column from the "Logical_Router_Port" table in 'row' to
6844 : : * the 'peer' set.
6845 : : *
6846 : : * If "peer" is null, the column will be the empty set,
6847 : : * otherwise it will contain the specified value.
6848 : : *
6849 : : * The caller retains ownership of the arguments. */
6850 : : void
6851 : 0 : nbrec_logical_router_port_remove_clause_peer(struct ovsdb_idl *idl, enum ovsdb_function function, const char *peer)
6852 : : {
6853 : : struct ovsdb_datum datum;
6854 : : union ovsdb_atom key;
6855 : :
6856 [ # # ]: 0 : ovs_assert(inited);
6857 [ # # ]: 0 : if (peer) {
6858 : 0 : datum.n = 1;
6859 : 0 : datum.keys = &key;
6860 : 0 : key.string = CONST_CAST(char *, peer);
6861 : : } else {
6862 : 0 : datum.n = 0;
6863 : 0 : datum.keys = NULL;
6864 : : }
6865 : 0 : datum.values = NULL;
6866 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT],
6867 : : function,
6868 : : &nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_COL_PEER],
6869 : : &datum);
6870 : 0 : }
6871 : : void
6872 : 0 : nbrec_logical_router_port_remove_clause_false(struct ovsdb_idl *idl)
6873 : : {
6874 : : struct ovsdb_datum datum;
6875 : :
6876 : 0 : ovsdb_datum_init_empty(&datum);
6877 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT], OVSDB_F_FALSE, NULL, &datum);
6878 : 0 : }
6879 : : void
6880 : 0 : nbrec_logical_router_port_remove_clause_true(struct ovsdb_idl *idl)
6881 : : {
6882 : : struct ovsdb_datum datum;
6883 : :
6884 : 0 : ovsdb_datum_init_empty(&datum);
6885 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_PORT], OVSDB_F_TRUE, NULL, &datum);
6886 : 0 : }
6887 : :
6888 : : struct ovsdb_idl_column nbrec_logical_router_port_columns[NBREC_LOGICAL_ROUTER_PORT_N_COLUMNS];
6889 : :
6890 : : static void
6891 : 932 : nbrec_logical_router_port_columns_init(void)
6892 : : {
6893 : : struct ovsdb_idl_column *c;
6894 : :
6895 : : /* Initialize nbrec_logical_router_port_col_enabled. */
6896 : 932 : c = &nbrec_logical_router_port_col_enabled;
6897 : 932 : c->name = "enabled";
6898 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
6899 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6900 : 932 : c->type.n_min = 0;
6901 : 932 : c->type.n_max = 1;
6902 : 932 : c->mutable = true;
6903 : 932 : c->parse = nbrec_logical_router_port_parse_enabled;
6904 : 932 : c->unparse = nbrec_logical_router_port_unparse_enabled;
6905 : :
6906 : : /* Initialize nbrec_logical_router_port_col_external_ids. */
6907 : 932 : c = &nbrec_logical_router_port_col_external_ids;
6908 : 932 : c->name = "external_ids";
6909 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6910 : 932 : c->type.key.u.string.minLen = 0;
6911 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
6912 : 932 : c->type.value.u.string.minLen = 0;
6913 : 932 : c->type.n_min = 0;
6914 : 932 : c->type.n_max = UINT_MAX;
6915 : 932 : c->mutable = true;
6916 : 932 : c->parse = nbrec_logical_router_port_parse_external_ids;
6917 : 932 : c->unparse = nbrec_logical_router_port_unparse_external_ids;
6918 : :
6919 : : /* Initialize nbrec_logical_router_port_col_mac. */
6920 : 932 : c = &nbrec_logical_router_port_col_mac;
6921 : 932 : c->name = "mac";
6922 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6923 : 932 : c->type.key.u.string.minLen = 0;
6924 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6925 : 932 : c->type.n_min = 1;
6926 : 932 : c->type.n_max = 1;
6927 : 932 : c->mutable = true;
6928 : 932 : c->parse = nbrec_logical_router_port_parse_mac;
6929 : 932 : c->unparse = nbrec_logical_router_port_unparse_mac;
6930 : :
6931 : : /* Initialize nbrec_logical_router_port_col_name. */
6932 : 932 : c = &nbrec_logical_router_port_col_name;
6933 : 932 : c->name = "name";
6934 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6935 : 932 : c->type.key.u.string.minLen = 0;
6936 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6937 : 932 : c->type.n_min = 1;
6938 : 932 : c->type.n_max = 1;
6939 : 932 : c->mutable = true;
6940 : 932 : c->parse = nbrec_logical_router_port_parse_name;
6941 : 932 : c->unparse = nbrec_logical_router_port_unparse_name;
6942 : :
6943 : : /* Initialize nbrec_logical_router_port_col_networks. */
6944 : 932 : c = &nbrec_logical_router_port_col_networks;
6945 : 932 : c->name = "networks";
6946 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6947 : 932 : c->type.key.u.string.minLen = 0;
6948 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6949 : 932 : c->type.n_min = 1;
6950 : 932 : c->type.n_max = UINT_MAX;
6951 : 932 : c->mutable = true;
6952 : 932 : c->parse = nbrec_logical_router_port_parse_networks;
6953 : 932 : c->unparse = nbrec_logical_router_port_unparse_networks;
6954 : :
6955 : : /* Initialize nbrec_logical_router_port_col_peer. */
6956 : 932 : c = &nbrec_logical_router_port_col_peer;
6957 : 932 : c->name = "peer";
6958 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6959 : 932 : c->type.key.u.string.minLen = 0;
6960 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6961 : 932 : c->type.n_min = 0;
6962 : 932 : c->type.n_max = 1;
6963 : 932 : c->mutable = true;
6964 : 932 : c->parse = nbrec_logical_router_port_parse_peer;
6965 : 932 : c->unparse = nbrec_logical_router_port_unparse_peer;
6966 : 932 : }
6967 : :
6968 : : /* Logical_Router_Static_Route table. */
6969 : :
6970 : : static void
6971 : 299 : nbrec_logical_router_static_route_parse_ip_prefix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6972 : : {
6973 : 299 : struct nbrec_logical_router_static_route *row = nbrec_logical_router_static_route_cast(row_);
6974 : :
6975 [ - + ]: 299 : ovs_assert(inited);
6976 [ + - ]: 299 : if (datum->n >= 1) {
6977 : 299 : row->ip_prefix = datum->keys[0].string;
6978 : : } else {
6979 : 0 : row->ip_prefix = "";
6980 : : }
6981 : 299 : }
6982 : :
6983 : : static void
6984 : 299 : nbrec_logical_router_static_route_parse_nexthop(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6985 : : {
6986 : 299 : struct nbrec_logical_router_static_route *row = nbrec_logical_router_static_route_cast(row_);
6987 : :
6988 [ - + ]: 299 : ovs_assert(inited);
6989 [ + - ]: 299 : if (datum->n >= 1) {
6990 : 299 : row->nexthop = datum->keys[0].string;
6991 : : } else {
6992 : 0 : row->nexthop = "";
6993 : : }
6994 : 299 : }
6995 : :
6996 : : static void
6997 : 270 : nbrec_logical_router_static_route_parse_output_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6998 : : {
6999 : 270 : struct nbrec_logical_router_static_route *row = nbrec_logical_router_static_route_cast(row_);
7000 : :
7001 [ - + ]: 270 : ovs_assert(inited);
7002 [ + + ]: 270 : if (datum->n >= 1) {
7003 : 53 : row->output_port = datum->keys[0].string;
7004 : : } else {
7005 : 217 : row->output_port = NULL;
7006 : : }
7007 : 270 : }
7008 : :
7009 : : static void
7010 : 333 : nbrec_logical_router_static_route_unparse_ip_prefix(struct ovsdb_idl_row *row OVS_UNUSED)
7011 : : {
7012 : : /* Nothing to do. */
7013 : 333 : }
7014 : :
7015 : : static void
7016 : 333 : nbrec_logical_router_static_route_unparse_nexthop(struct ovsdb_idl_row *row OVS_UNUSED)
7017 : : {
7018 : : /* Nothing to do. */
7019 : 333 : }
7020 : :
7021 : : static void
7022 : 304 : nbrec_logical_router_static_route_unparse_output_port(struct ovsdb_idl_row *row OVS_UNUSED)
7023 : : {
7024 : : /* Nothing to do. */
7025 : 304 : }
7026 : :
7027 : : static void
7028 : 293 : nbrec_logical_router_static_route_init__(struct ovsdb_idl_row *row)
7029 : : {
7030 : 293 : nbrec_logical_router_static_route_init(nbrec_logical_router_static_route_cast(row));
7031 : 293 : }
7032 : :
7033 : : /* Clears the contents of 'row' in table "Logical_Router_Static_Route". */
7034 : : void
7035 : 293 : nbrec_logical_router_static_route_init(struct nbrec_logical_router_static_route *row)
7036 : : {
7037 : 293 : memset(row, 0, sizeof *row);
7038 : 293 : }
7039 : :
7040 : : /* Searches table "Logical_Router_Static_Route" in 'idl' for a row with UUID 'uuid'. Returns
7041 : : * a pointer to the row if there is one, otherwise a null pointer. */
7042 : : const struct nbrec_logical_router_static_route *
7043 : 0 : nbrec_logical_router_static_route_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
7044 : : {
7045 : 0 : return nbrec_logical_router_static_route_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE], uuid));
7046 : : }
7047 : :
7048 : : /* Returns a row in table "Logical_Router_Static_Route" in 'idl', or a null pointer if that
7049 : : * table is empty.
7050 : : *
7051 : : * Database tables are internally maintained as hash tables, so adding or
7052 : : * removing rows while traversing the same table can cause some rows to be
7053 : : * visited twice or not at apply. */
7054 : : const struct nbrec_logical_router_static_route *
7055 : 0 : nbrec_logical_router_static_route_first(const struct ovsdb_idl *idl)
7056 : : {
7057 : 0 : return nbrec_logical_router_static_route_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE]));
7058 : : }
7059 : :
7060 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
7061 : : * is the last row in its table. */
7062 : : const struct nbrec_logical_router_static_route *
7063 : 0 : nbrec_logical_router_static_route_next(const struct nbrec_logical_router_static_route *row)
7064 : : {
7065 : 0 : return nbrec_logical_router_static_route_cast(ovsdb_idl_next_row(&row->header_));
7066 : : }
7067 : :
7068 : 0 : unsigned int nbrec_logical_router_static_route_get_seqno(const struct ovsdb_idl *idl)
7069 : : {
7070 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE]);
7071 : : }
7072 : :
7073 : 0 : unsigned int nbrec_logical_router_static_route_row_get_seqno(const struct nbrec_logical_router_static_route *row, enum ovsdb_idl_change change)
7074 : : {
7075 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
7076 : : }
7077 : :
7078 : : const struct nbrec_logical_router_static_route *
7079 : 0 : nbrec_logical_router_static_route_track_get_first(const struct ovsdb_idl *idl)
7080 : : {
7081 : 0 : return nbrec_logical_router_static_route_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE]));
7082 : : }
7083 : :
7084 : : const struct nbrec_logical_router_static_route
7085 : 0 : *nbrec_logical_router_static_route_track_get_next(const struct nbrec_logical_router_static_route *row)
7086 : : {
7087 : 0 : return nbrec_logical_router_static_route_cast(ovsdb_idl_track_get_next(&row->header_));
7088 : : }
7089 : :
7090 : :
7091 : : /* Deletes 'row' from table "Logical_Router_Static_Route". 'row' may be freed, so it must not be
7092 : : * accessed afterward.
7093 : : *
7094 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7095 : : void
7096 : 0 : nbrec_logical_router_static_route_delete(const struct nbrec_logical_router_static_route *row)
7097 : : {
7098 : 0 : ovsdb_idl_txn_delete(&row->header_);
7099 : 0 : }
7100 : :
7101 : : /* Inserts and returns a new row in the table "Logical_Router_Static_Route" in the database
7102 : : * with open transaction 'txn'.
7103 : : *
7104 : : * The new row is assigned a randomly generated provisional UUID.
7105 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
7106 : : * but the IDL will replace any uses of the provisional UUID in the
7107 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
7108 : : struct nbrec_logical_router_static_route *
7109 : 31 : nbrec_logical_router_static_route_insert(struct ovsdb_idl_txn *txn)
7110 : : {
7111 : 31 : return nbrec_logical_router_static_route_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE], NULL));
7112 : : }
7113 : :
7114 : : bool
7115 : 0 : nbrec_logical_router_static_route_is_updated(const struct nbrec_logical_router_static_route *row, enum nbrec_logical_router_static_route_column_id column)
7116 : : {
7117 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_logical_router_static_route_columns[column]);
7118 : : }
7119 : :
7120 : : /* Causes the original contents of column "ip_prefix" in 'row' to be
7121 : : * verified as a prerequisite to completing the transaction. That is, if
7122 : : * "ip_prefix" in 'row' changed (or if 'row' was deleted) between the
7123 : : * time that the IDL originally read its contents and the time that the
7124 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7125 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7126 : : * change has already been received).
7127 : : *
7128 : : * The intention is that, to ensure that no transaction commits based on dirty
7129 : : * reads, an application should call this function any time "ip_prefix" is
7130 : : * read as part of a read-modify-write operation.
7131 : : *
7132 : : * In some cases this function reduces to a no-op, because the current value
7133 : : * of "ip_prefix" is already known:
7134 : : *
7135 : : * - If 'row' is a row created by the current transaction (returned by
7136 : : * nbrec_logical_router_static_route_insert()).
7137 : : *
7138 : : * - If "ip_prefix" has already been modified (with
7139 : : * nbrec_logical_router_static_route_set_ip_prefix()) within the current transaction.
7140 : : *
7141 : : * Because of the latter property, always call this function *before*
7142 : : * nbrec_logical_router_static_route_set_ip_prefix() for a given read-modify-write.
7143 : : *
7144 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7145 : : void
7146 : 2 : nbrec_logical_router_static_route_verify_ip_prefix(const struct nbrec_logical_router_static_route *row)
7147 : : {
7148 [ - + ]: 2 : ovs_assert(inited);
7149 : 2 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_IP_PREFIX]);
7150 : 2 : }
7151 : :
7152 : : /* Causes the original contents of column "nexthop" in 'row' to be
7153 : : * verified as a prerequisite to completing the transaction. That is, if
7154 : : * "nexthop" in 'row' changed (or if 'row' was deleted) between the
7155 : : * time that the IDL originally read its contents and the time that the
7156 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7157 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7158 : : * change has already been received).
7159 : : *
7160 : : * The intention is that, to ensure that no transaction commits based on dirty
7161 : : * reads, an application should call this function any time "nexthop" is
7162 : : * read as part of a read-modify-write operation.
7163 : : *
7164 : : * In some cases this function reduces to a no-op, because the current value
7165 : : * of "nexthop" is already known:
7166 : : *
7167 : : * - If 'row' is a row created by the current transaction (returned by
7168 : : * nbrec_logical_router_static_route_insert()).
7169 : : *
7170 : : * - If "nexthop" has already been modified (with
7171 : : * nbrec_logical_router_static_route_set_nexthop()) within the current transaction.
7172 : : *
7173 : : * Because of the latter property, always call this function *before*
7174 : : * nbrec_logical_router_static_route_set_nexthop() for a given read-modify-write.
7175 : : *
7176 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7177 : : void
7178 : 2 : nbrec_logical_router_static_route_verify_nexthop(const struct nbrec_logical_router_static_route *row)
7179 : : {
7180 [ - + ]: 2 : ovs_assert(inited);
7181 : 2 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_NEXTHOP]);
7182 : 2 : }
7183 : :
7184 : : /* Causes the original contents of column "output_port" in 'row' to be
7185 : : * verified as a prerequisite to completing the transaction. That is, if
7186 : : * "output_port" in 'row' changed (or if 'row' was deleted) between the
7187 : : * time that the IDL originally read its contents and the time that the
7188 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7189 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7190 : : * change has already been received).
7191 : : *
7192 : : * The intention is that, to ensure that no transaction commits based on dirty
7193 : : * reads, an application should call this function any time "output_port" is
7194 : : * read as part of a read-modify-write operation.
7195 : : *
7196 : : * In some cases this function reduces to a no-op, because the current value
7197 : : * of "output_port" is already known:
7198 : : *
7199 : : * - If 'row' is a row created by the current transaction (returned by
7200 : : * nbrec_logical_router_static_route_insert()).
7201 : : *
7202 : : * - If "output_port" has already been modified (with
7203 : : * nbrec_logical_router_static_route_set_output_port()) within the current transaction.
7204 : : *
7205 : : * Because of the latter property, always call this function *before*
7206 : : * nbrec_logical_router_static_route_set_output_port() for a given read-modify-write.
7207 : : *
7208 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7209 : : void
7210 : 0 : nbrec_logical_router_static_route_verify_output_port(const struct nbrec_logical_router_static_route *row)
7211 : : {
7212 [ # # ]: 0 : ovs_assert(inited);
7213 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_OUTPUT_PORT]);
7214 : 0 : }
7215 : :
7216 : : /* Returns the "ip_prefix" column's value from the "Logical_Router_Static_Route" table in 'row'
7217 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7218 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7219 : : * for a given key than implementing the same operation on the "cooked"
7220 : : * form in 'row'.
7221 : : *
7222 : : * 'key_type' must be OVSDB_TYPE_STRING.
7223 : : * (This helps to avoid silent bugs if someone changes ip_prefix's
7224 : : * type without updating the caller.)
7225 : : *
7226 : : * The caller must not modify or free the returned value.
7227 : : *
7228 : : * Various kinds of changes can invalidate the returned value: modifying
7229 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7230 : : * If the returned value is needed for a long time, it is best to make a copy
7231 : : * of it with ovsdb_datum_clone().
7232 : : *
7233 : : * This function is rarely useful, since it is easier to access the value
7234 : : * directly through the "ip_prefix" member in nbrec_logical_router_static_route. */
7235 : : const struct ovsdb_datum *
7236 : 0 : nbrec_logical_router_static_route_get_ip_prefix(const struct nbrec_logical_router_static_route *row,
7237 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7238 : : {
7239 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
7240 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_static_route_col_ip_prefix);
7241 : : }
7242 : :
7243 : : /* Returns the "nexthop" column's value from the "Logical_Router_Static_Route" table in 'row'
7244 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7245 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7246 : : * for a given key than implementing the same operation on the "cooked"
7247 : : * form in 'row'.
7248 : : *
7249 : : * 'key_type' must be OVSDB_TYPE_STRING.
7250 : : * (This helps to avoid silent bugs if someone changes nexthop's
7251 : : * type without updating the caller.)
7252 : : *
7253 : : * The caller must not modify or free the returned value.
7254 : : *
7255 : : * Various kinds of changes can invalidate the returned value: modifying
7256 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7257 : : * If the returned value is needed for a long time, it is best to make a copy
7258 : : * of it with ovsdb_datum_clone().
7259 : : *
7260 : : * This function is rarely useful, since it is easier to access the value
7261 : : * directly through the "nexthop" member in nbrec_logical_router_static_route. */
7262 : : const struct ovsdb_datum *
7263 : 0 : nbrec_logical_router_static_route_get_nexthop(const struct nbrec_logical_router_static_route *row,
7264 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7265 : : {
7266 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
7267 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_static_route_col_nexthop);
7268 : : }
7269 : :
7270 : : /* Returns the "output_port" column's value from the "Logical_Router_Static_Route" table in 'row'
7271 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7272 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7273 : : * for a given key than implementing the same operation on the "cooked"
7274 : : * form in 'row'.
7275 : : *
7276 : : * 'key_type' must be OVSDB_TYPE_STRING.
7277 : : * (This helps to avoid silent bugs if someone changes output_port's
7278 : : * type without updating the caller.)
7279 : : *
7280 : : * The caller must not modify or free the returned value.
7281 : : *
7282 : : * Various kinds of changes can invalidate the returned value: modifying
7283 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7284 : : * If the returned value is needed for a long time, it is best to make a copy
7285 : : * of it with ovsdb_datum_clone().
7286 : : *
7287 : : * This function is rarely useful, since it is easier to access the value
7288 : : * directly through the "output_port" member in nbrec_logical_router_static_route. */
7289 : : const struct ovsdb_datum *
7290 : 0 : nbrec_logical_router_static_route_get_output_port(const struct nbrec_logical_router_static_route *row,
7291 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7292 : : {
7293 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
7294 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_router_static_route_col_output_port);
7295 : : }
7296 : :
7297 : : /* Sets the "ip_prefix" column from the "Logical_Router_Static_Route" table in 'row' to
7298 : : * 'ip_prefix'.
7299 : : *
7300 : : * The caller retains ownership of the arguments. */
7301 : : void
7302 : 33 : nbrec_logical_router_static_route_set_ip_prefix(const struct nbrec_logical_router_static_route *row, const char *ip_prefix)
7303 : : {
7304 : : struct ovsdb_datum datum;
7305 : : union ovsdb_atom key;
7306 : :
7307 [ - + ]: 33 : ovs_assert(inited);
7308 : 33 : datum.n = 1;
7309 : 33 : datum.keys = &key;
7310 : 33 : key.string = CONST_CAST(char *, ip_prefix);
7311 : 33 : datum.values = NULL;
7312 : 33 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_IP_PREFIX], &datum);
7313 : 33 : }
7314 : :
7315 : : /* Sets the "nexthop" column from the "Logical_Router_Static_Route" table in 'row' to
7316 : : * 'nexthop'.
7317 : : *
7318 : : * The caller retains ownership of the arguments. */
7319 : : void
7320 : 33 : nbrec_logical_router_static_route_set_nexthop(const struct nbrec_logical_router_static_route *row, const char *nexthop)
7321 : : {
7322 : : struct ovsdb_datum datum;
7323 : : union ovsdb_atom key;
7324 : :
7325 [ - + ]: 33 : ovs_assert(inited);
7326 : 33 : datum.n = 1;
7327 : 33 : datum.keys = &key;
7328 : 33 : key.string = CONST_CAST(char *, nexthop);
7329 : 33 : datum.values = NULL;
7330 : 33 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_NEXTHOP], &datum);
7331 : 33 : }
7332 : :
7333 : : /* Sets the "output_port" column from the "Logical_Router_Static_Route" table in 'row' to
7334 : : * the 'output_port' set.
7335 : : *
7336 : : * If "output_port" is null, the column will be the empty set,
7337 : : * otherwise it will contain the specified value.
7338 : : *
7339 : : * The caller retains ownership of the arguments. */
7340 : : void
7341 : 7 : nbrec_logical_router_static_route_set_output_port(const struct nbrec_logical_router_static_route *row, const char *output_port)
7342 : : {
7343 : : struct ovsdb_datum datum;
7344 : : union ovsdb_atom key;
7345 : :
7346 [ - + ]: 7 : ovs_assert(inited);
7347 [ + - ]: 7 : if (output_port) {
7348 : 7 : datum.n = 1;
7349 : 7 : datum.keys = &key;
7350 : 7 : key.string = CONST_CAST(char *, output_port);
7351 : : } else {
7352 : 0 : datum.n = 0;
7353 : 0 : datum.keys = NULL;
7354 : : }
7355 : 7 : datum.values = NULL;
7356 : 7 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_OUTPUT_PORT], &datum);
7357 : 7 : }
7358 : :
7359 : : /* Adds the value 'new_value' to the "output_port" set column from the "Logical_Router_Static_Route" table
7360 : : * in 'row'.
7361 : : *
7362 : : */
7363 : : void
7364 : 0 : nbrec_logical_router_static_route_update_output_port_addvalue(const struct nbrec_logical_router_static_route *row, const char *new_value)
7365 : : {
7366 : : struct ovsdb_datum *datum;
7367 : :
7368 [ # # ]: 0 : ovs_assert(inited);
7369 : :
7370 : 0 : datum = xmalloc(sizeof *datum);
7371 : 0 : datum->n = 1;
7372 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
7373 : 0 : datum->values = NULL;
7374 : :
7375 : 0 : datum->keys[0].string = xstrdup(new_value);
7376 : :
7377 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
7378 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_OUTPUT_PORT],
7379 : : datum);
7380 : 0 : }
7381 : :
7382 : : /* Deletes the value 'delete_value' from the "output_port" set column from the
7383 : : * "Logical_Router_Static_Route" table in 'row'.
7384 : : *
7385 : : */
7386 : : void
7387 : 0 : nbrec_logical_router_static_route_update_output_port_delvalue(const struct nbrec_logical_router_static_route *row, const char *delete_value)
7388 : : {
7389 : : struct ovsdb_datum *datum;
7390 : :
7391 [ # # ]: 0 : ovs_assert(inited);
7392 : :
7393 : 0 : datum = xmalloc(sizeof *datum);
7394 : 0 : datum->n = 1;
7395 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
7396 : 0 : datum->values = NULL;
7397 : :
7398 : 0 : datum->keys[0].string = xstrdup(delete_value);
7399 : :
7400 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
7401 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_OUTPUT_PORT],
7402 : : datum);
7403 : 0 : }
7404 : :
7405 : : /* Sets the "ip_prefix" column from the "Logical_Router_Static_Route" table in 'row' to
7406 : : * 'ip_prefix'.
7407 : : *
7408 : : * The caller retains ownership of the arguments. */
7409 : : void
7410 : 0 : nbrec_logical_router_static_route_add_clause_ip_prefix(struct ovsdb_idl *idl, enum ovsdb_function function, const char *ip_prefix)
7411 : : {
7412 : : struct ovsdb_datum datum;
7413 : : union ovsdb_atom key;
7414 : :
7415 [ # # ]: 0 : ovs_assert(inited);
7416 : 0 : datum.n = 1;
7417 : 0 : datum.keys = &key;
7418 : 0 : key.string = CONST_CAST(char *, ip_prefix);
7419 : 0 : datum.values = NULL;
7420 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE],
7421 : : function,
7422 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_IP_PREFIX],
7423 : : &datum);
7424 : 0 : }
7425 : :
7426 : : /* Sets the "nexthop" column from the "Logical_Router_Static_Route" table in 'row' to
7427 : : * 'nexthop'.
7428 : : *
7429 : : * The caller retains ownership of the arguments. */
7430 : : void
7431 : 0 : nbrec_logical_router_static_route_add_clause_nexthop(struct ovsdb_idl *idl, enum ovsdb_function function, const char *nexthop)
7432 : : {
7433 : : struct ovsdb_datum datum;
7434 : : union ovsdb_atom key;
7435 : :
7436 [ # # ]: 0 : ovs_assert(inited);
7437 : 0 : datum.n = 1;
7438 : 0 : datum.keys = &key;
7439 : 0 : key.string = CONST_CAST(char *, nexthop);
7440 : 0 : datum.values = NULL;
7441 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE],
7442 : : function,
7443 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_NEXTHOP],
7444 : : &datum);
7445 : 0 : }
7446 : :
7447 : : /* Sets the "output_port" column from the "Logical_Router_Static_Route" table in 'row' to
7448 : : * the 'output_port' set.
7449 : : *
7450 : : * If "output_port" is null, the column will be the empty set,
7451 : : * otherwise it will contain the specified value.
7452 : : *
7453 : : * The caller retains ownership of the arguments. */
7454 : : void
7455 : 0 : nbrec_logical_router_static_route_add_clause_output_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *output_port)
7456 : : {
7457 : : struct ovsdb_datum datum;
7458 : : union ovsdb_atom key;
7459 : :
7460 [ # # ]: 0 : ovs_assert(inited);
7461 [ # # ]: 0 : if (output_port) {
7462 : 0 : datum.n = 1;
7463 : 0 : datum.keys = &key;
7464 : 0 : key.string = CONST_CAST(char *, output_port);
7465 : : } else {
7466 : 0 : datum.n = 0;
7467 : 0 : datum.keys = NULL;
7468 : : }
7469 : 0 : datum.values = NULL;
7470 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE],
7471 : : function,
7472 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_OUTPUT_PORT],
7473 : : &datum);
7474 : 0 : }
7475 : : void
7476 : 0 : nbrec_logical_router_static_route_add_clause_false(struct ovsdb_idl *idl)
7477 : : {
7478 : : struct ovsdb_datum datum;
7479 : :
7480 : 0 : ovsdb_datum_init_empty(&datum);
7481 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE], OVSDB_F_FALSE, NULL, &datum);
7482 : 0 : }
7483 : : void
7484 : 0 : nbrec_logical_router_static_route_add_clause_true(struct ovsdb_idl *idl)
7485 : : {
7486 : : struct ovsdb_datum datum;
7487 : :
7488 : 0 : ovsdb_datum_init_empty(&datum);
7489 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE], OVSDB_F_TRUE, NULL, &datum);
7490 : 0 : }
7491 : :
7492 : : /* Sets the "ip_prefix" column from the "Logical_Router_Static_Route" table in 'row' to
7493 : : * 'ip_prefix'.
7494 : : *
7495 : : * The caller retains ownership of the arguments. */
7496 : : void
7497 : 0 : nbrec_logical_router_static_route_remove_clause_ip_prefix(struct ovsdb_idl *idl, enum ovsdb_function function, const char *ip_prefix)
7498 : : {
7499 : : struct ovsdb_datum datum;
7500 : : union ovsdb_atom key;
7501 : :
7502 [ # # ]: 0 : ovs_assert(inited);
7503 : 0 : datum.n = 1;
7504 : 0 : datum.keys = &key;
7505 : 0 : key.string = CONST_CAST(char *, ip_prefix);
7506 : 0 : datum.values = NULL;
7507 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE],
7508 : : function,
7509 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_IP_PREFIX],
7510 : : &datum);
7511 : 0 : }
7512 : :
7513 : : /* Sets the "nexthop" column from the "Logical_Router_Static_Route" table in 'row' to
7514 : : * 'nexthop'.
7515 : : *
7516 : : * The caller retains ownership of the arguments. */
7517 : : void
7518 : 0 : nbrec_logical_router_static_route_remove_clause_nexthop(struct ovsdb_idl *idl, enum ovsdb_function function, const char *nexthop)
7519 : : {
7520 : : struct ovsdb_datum datum;
7521 : : union ovsdb_atom key;
7522 : :
7523 [ # # ]: 0 : ovs_assert(inited);
7524 : 0 : datum.n = 1;
7525 : 0 : datum.keys = &key;
7526 : 0 : key.string = CONST_CAST(char *, nexthop);
7527 : 0 : datum.values = NULL;
7528 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE],
7529 : : function,
7530 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_NEXTHOP],
7531 : : &datum);
7532 : 0 : }
7533 : :
7534 : : /* Sets the "output_port" column from the "Logical_Router_Static_Route" table in 'row' to
7535 : : * the 'output_port' set.
7536 : : *
7537 : : * If "output_port" is null, the column will be the empty set,
7538 : : * otherwise it will contain the specified value.
7539 : : *
7540 : : * The caller retains ownership of the arguments. */
7541 : : void
7542 : 0 : nbrec_logical_router_static_route_remove_clause_output_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *output_port)
7543 : : {
7544 : : struct ovsdb_datum datum;
7545 : : union ovsdb_atom key;
7546 : :
7547 [ # # ]: 0 : ovs_assert(inited);
7548 [ # # ]: 0 : if (output_port) {
7549 : 0 : datum.n = 1;
7550 : 0 : datum.keys = &key;
7551 : 0 : key.string = CONST_CAST(char *, output_port);
7552 : : } else {
7553 : 0 : datum.n = 0;
7554 : 0 : datum.keys = NULL;
7555 : : }
7556 : 0 : datum.values = NULL;
7557 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE],
7558 : : function,
7559 : : &nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_COL_OUTPUT_PORT],
7560 : : &datum);
7561 : 0 : }
7562 : : void
7563 : 0 : nbrec_logical_router_static_route_remove_clause_false(struct ovsdb_idl *idl)
7564 : : {
7565 : : struct ovsdb_datum datum;
7566 : :
7567 : 0 : ovsdb_datum_init_empty(&datum);
7568 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE], OVSDB_F_FALSE, NULL, &datum);
7569 : 0 : }
7570 : : void
7571 : 0 : nbrec_logical_router_static_route_remove_clause_true(struct ovsdb_idl *idl)
7572 : : {
7573 : : struct ovsdb_datum datum;
7574 : :
7575 : 0 : ovsdb_datum_init_empty(&datum);
7576 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_ROUTER_STATIC_ROUTE], OVSDB_F_TRUE, NULL, &datum);
7577 : 0 : }
7578 : :
7579 : : struct ovsdb_idl_column nbrec_logical_router_static_route_columns[NBREC_LOGICAL_ROUTER_STATIC_ROUTE_N_COLUMNS];
7580 : :
7581 : : static void
7582 : 932 : nbrec_logical_router_static_route_columns_init(void)
7583 : : {
7584 : : struct ovsdb_idl_column *c;
7585 : :
7586 : : /* Initialize nbrec_logical_router_static_route_col_ip_prefix. */
7587 : 932 : c = &nbrec_logical_router_static_route_col_ip_prefix;
7588 : 932 : c->name = "ip_prefix";
7589 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7590 : 932 : c->type.key.u.string.minLen = 0;
7591 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7592 : 932 : c->type.n_min = 1;
7593 : 932 : c->type.n_max = 1;
7594 : 932 : c->mutable = true;
7595 : 932 : c->parse = nbrec_logical_router_static_route_parse_ip_prefix;
7596 : 932 : c->unparse = nbrec_logical_router_static_route_unparse_ip_prefix;
7597 : :
7598 : : /* Initialize nbrec_logical_router_static_route_col_nexthop. */
7599 : 932 : c = &nbrec_logical_router_static_route_col_nexthop;
7600 : 932 : c->name = "nexthop";
7601 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7602 : 932 : c->type.key.u.string.minLen = 0;
7603 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7604 : 932 : c->type.n_min = 1;
7605 : 932 : c->type.n_max = 1;
7606 : 932 : c->mutable = true;
7607 : 932 : c->parse = nbrec_logical_router_static_route_parse_nexthop;
7608 : 932 : c->unparse = nbrec_logical_router_static_route_unparse_nexthop;
7609 : :
7610 : : /* Initialize nbrec_logical_router_static_route_col_output_port. */
7611 : 932 : c = &nbrec_logical_router_static_route_col_output_port;
7612 : 932 : c->name = "output_port";
7613 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7614 : 932 : c->type.key.u.string.minLen = 0;
7615 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7616 : 932 : c->type.n_min = 0;
7617 : 932 : c->type.n_max = 1;
7618 : 932 : c->mutable = true;
7619 : 932 : c->parse = nbrec_logical_router_static_route_parse_output_port;
7620 : 932 : c->unparse = nbrec_logical_router_static_route_unparse_output_port;
7621 : 932 : }
7622 : :
7623 : : /* Logical_Switch table. */
7624 : :
7625 : : static void
7626 : 6816 : nbrec_logical_switch_parse_acls(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7627 : : {
7628 : 6816 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7629 : : size_t i;
7630 : :
7631 [ - + ]: 6816 : ovs_assert(inited);
7632 : 6816 : row->acls = NULL;
7633 : 6816 : row->n_acls = 0;
7634 [ + + ]: 7255 : for (i = 0; i < datum->n; i++) {
7635 : 439 : struct nbrec_acl *keyRow = nbrec_acl_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_ACL], &datum->keys[i].uuid));
7636 [ + + ]: 439 : if (keyRow) {
7637 [ + + ]: 426 : if (!row->n_acls) {
7638 : 164 : row->acls = xmalloc(datum->n * sizeof *row->acls);
7639 : : }
7640 : 426 : row->acls[row->n_acls] = keyRow;
7641 : 426 : row->n_acls++;
7642 : : }
7643 : : }
7644 : 6816 : }
7645 : :
7646 : : static void
7647 : 6793 : nbrec_logical_switch_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7648 : : {
7649 : 6793 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7650 : : size_t i;
7651 : :
7652 [ - + ]: 6793 : ovs_assert(inited);
7653 : 6793 : smap_init(&row->external_ids);
7654 [ - + ]: 6793 : for (i = 0; i < datum->n; i++) {
7655 : 0 : smap_add(&row->external_ids,
7656 : 0 : datum->keys[i].string,
7657 : 0 : datum->values[i].string);
7658 : : }
7659 : 6793 : }
7660 : :
7661 : : static void
7662 : 6796 : nbrec_logical_switch_parse_load_balancer(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7663 : : {
7664 : 6796 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7665 : : size_t i;
7666 : :
7667 [ - + ]: 6796 : ovs_assert(inited);
7668 : 6796 : row->load_balancer = NULL;
7669 : 6796 : row->n_load_balancer = 0;
7670 [ + + ]: 6827 : for (i = 0; i < datum->n; i++) {
7671 : 31 : struct nbrec_load_balancer *keyRow = nbrec_load_balancer_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_LOAD_BALANCER], &datum->keys[i].uuid));
7672 [ + - ]: 31 : if (keyRow) {
7673 [ + + ]: 31 : if (!row->n_load_balancer) {
7674 : 25 : row->load_balancer = xmalloc(datum->n * sizeof *row->load_balancer);
7675 : : }
7676 : 31 : row->load_balancer[row->n_load_balancer] = keyRow;
7677 : 31 : row->n_load_balancer++;
7678 : : }
7679 : : }
7680 : 6796 : }
7681 : :
7682 : : static void
7683 : 6878 : nbrec_logical_switch_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7684 : : {
7685 : 6878 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7686 : :
7687 [ - + ]: 6878 : ovs_assert(inited);
7688 [ + - ]: 6878 : if (datum->n >= 1) {
7689 : 6878 : row->name = datum->keys[0].string;
7690 : : } else {
7691 : 0 : row->name = "";
7692 : : }
7693 : 6878 : }
7694 : :
7695 : : static void
7696 : 6798 : nbrec_logical_switch_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7697 : : {
7698 : 6798 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7699 : : size_t i;
7700 : :
7701 [ - + ]: 6798 : ovs_assert(inited);
7702 : 6798 : smap_init(&row->other_config);
7703 [ + + ]: 8231 : for (i = 0; i < datum->n; i++) {
7704 : 1433 : smap_add(&row->other_config,
7705 : 1433 : datum->keys[i].string,
7706 : 1433 : datum->values[i].string);
7707 : : }
7708 : 6798 : }
7709 : :
7710 : : static void
7711 : 7044 : nbrec_logical_switch_parse_ports(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7712 : : {
7713 : 7044 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7714 : : size_t i;
7715 : :
7716 [ - + ]: 7044 : ovs_assert(inited);
7717 : 7044 : row->ports = NULL;
7718 : 7044 : row->n_ports = 0;
7719 [ + + ]: 43247 : for (i = 0; i < datum->n; i++) {
7720 : 36203 : struct nbrec_logical_switch_port *keyRow = nbrec_logical_switch_port_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT], &datum->keys[i].uuid));
7721 [ + + ]: 36203 : if (keyRow) {
7722 [ + + ]: 20125 : if (!row->n_ports) {
7723 : 5216 : row->ports = xmalloc(datum->n * sizeof *row->ports);
7724 : : }
7725 : 20125 : row->ports[row->n_ports] = keyRow;
7726 : 20125 : row->n_ports++;
7727 : : }
7728 : : }
7729 : 7044 : }
7730 : :
7731 : : static void
7732 : 6903 : nbrec_logical_switch_unparse_acls(struct ovsdb_idl_row *row_)
7733 : : {
7734 : 6903 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7735 : :
7736 [ - + ]: 6903 : ovs_assert(inited);
7737 : 6903 : free(row->acls);
7738 : 6903 : }
7739 : :
7740 : : static void
7741 : 6880 : nbrec_logical_switch_unparse_external_ids(struct ovsdb_idl_row *row_)
7742 : : {
7743 : 6880 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7744 : :
7745 [ - + ]: 6880 : ovs_assert(inited);
7746 : 6880 : smap_destroy(&row->external_ids);
7747 : 6880 : }
7748 : :
7749 : : static void
7750 : 6883 : nbrec_logical_switch_unparse_load_balancer(struct ovsdb_idl_row *row_)
7751 : : {
7752 : 6883 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7753 : :
7754 [ - + ]: 6883 : ovs_assert(inited);
7755 : 6883 : free(row->load_balancer);
7756 : 6883 : }
7757 : :
7758 : : static void
7759 : 6965 : nbrec_logical_switch_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
7760 : : {
7761 : : /* Nothing to do. */
7762 : 6965 : }
7763 : :
7764 : : static void
7765 : 6885 : nbrec_logical_switch_unparse_other_config(struct ovsdb_idl_row *row_)
7766 : : {
7767 : 6885 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7768 : :
7769 [ - + ]: 6885 : ovs_assert(inited);
7770 : 6885 : smap_destroy(&row->other_config);
7771 : 6885 : }
7772 : :
7773 : : static void
7774 : 7131 : nbrec_logical_switch_unparse_ports(struct ovsdb_idl_row *row_)
7775 : : {
7776 : 7131 : struct nbrec_logical_switch *row = nbrec_logical_switch_cast(row_);
7777 : :
7778 [ - + ]: 7131 : ovs_assert(inited);
7779 : 7131 : free(row->ports);
7780 : 7131 : }
7781 : :
7782 : : static void
7783 : 1659 : nbrec_logical_switch_init__(struct ovsdb_idl_row *row)
7784 : : {
7785 : 1659 : nbrec_logical_switch_init(nbrec_logical_switch_cast(row));
7786 : 1659 : }
7787 : :
7788 : : /* Clears the contents of 'row' in table "Logical_Switch". */
7789 : : void
7790 : 1659 : nbrec_logical_switch_init(struct nbrec_logical_switch *row)
7791 : : {
7792 : 1659 : memset(row, 0, sizeof *row);
7793 : 1659 : smap_init(&row->external_ids);
7794 : 1659 : smap_init(&row->other_config);
7795 : 1659 : }
7796 : :
7797 : : /* Searches table "Logical_Switch" in 'idl' for a row with UUID 'uuid'. Returns
7798 : : * a pointer to the row if there is one, otherwise a null pointer. */
7799 : : const struct nbrec_logical_switch *
7800 : 0 : nbrec_logical_switch_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
7801 : : {
7802 : 0 : return nbrec_logical_switch_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH], uuid));
7803 : : }
7804 : :
7805 : : /* Returns a row in table "Logical_Switch" in 'idl', or a null pointer if that
7806 : : * table is empty.
7807 : : *
7808 : : * Database tables are internally maintained as hash tables, so adding or
7809 : : * removing rows while traversing the same table can cause some rows to be
7810 : : * visited twice or not at apply. */
7811 : : const struct nbrec_logical_switch *
7812 : 2656 : nbrec_logical_switch_first(const struct ovsdb_idl *idl)
7813 : : {
7814 : 2656 : return nbrec_logical_switch_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH]));
7815 : : }
7816 : :
7817 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
7818 : : * is the last row in its table. */
7819 : : const struct nbrec_logical_switch *
7820 : 5255 : nbrec_logical_switch_next(const struct nbrec_logical_switch *row)
7821 : : {
7822 : 5255 : return nbrec_logical_switch_cast(ovsdb_idl_next_row(&row->header_));
7823 : : }
7824 : :
7825 : 0 : unsigned int nbrec_logical_switch_get_seqno(const struct ovsdb_idl *idl)
7826 : : {
7827 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH]);
7828 : : }
7829 : :
7830 : 0 : unsigned int nbrec_logical_switch_row_get_seqno(const struct nbrec_logical_switch *row, enum ovsdb_idl_change change)
7831 : : {
7832 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
7833 : : }
7834 : :
7835 : : const struct nbrec_logical_switch *
7836 : 0 : nbrec_logical_switch_track_get_first(const struct ovsdb_idl *idl)
7837 : : {
7838 : 0 : return nbrec_logical_switch_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH]));
7839 : : }
7840 : :
7841 : : const struct nbrec_logical_switch
7842 : 0 : *nbrec_logical_switch_track_get_next(const struct nbrec_logical_switch *row)
7843 : : {
7844 : 0 : return nbrec_logical_switch_cast(ovsdb_idl_track_get_next(&row->header_));
7845 : : }
7846 : :
7847 : :
7848 : : /* Deletes 'row' from table "Logical_Switch". 'row' may be freed, so it must not be
7849 : : * accessed afterward.
7850 : : *
7851 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7852 : : void
7853 : 3 : nbrec_logical_switch_delete(const struct nbrec_logical_switch *row)
7854 : : {
7855 : 3 : ovsdb_idl_txn_delete(&row->header_);
7856 : 3 : }
7857 : :
7858 : : /* Inserts and returns a new row in the table "Logical_Switch" in the database
7859 : : * with open transaction 'txn'.
7860 : : *
7861 : : * The new row is assigned a randomly generated provisional UUID.
7862 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
7863 : : * but the IDL will replace any uses of the provisional UUID in the
7864 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
7865 : : struct nbrec_logical_switch *
7866 : 87 : nbrec_logical_switch_insert(struct ovsdb_idl_txn *txn)
7867 : : {
7868 : 87 : return nbrec_logical_switch_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH], NULL));
7869 : : }
7870 : :
7871 : : bool
7872 : 0 : nbrec_logical_switch_is_updated(const struct nbrec_logical_switch *row, enum nbrec_logical_switch_column_id column)
7873 : : {
7874 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_logical_switch_columns[column]);
7875 : : }
7876 : :
7877 : : /* Causes the original contents of column "acls" in 'row' to be
7878 : : * verified as a prerequisite to completing the transaction. That is, if
7879 : : * "acls" in 'row' changed (or if 'row' was deleted) between the
7880 : : * time that the IDL originally read its contents and the time that the
7881 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7882 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7883 : : * change has already been received).
7884 : : *
7885 : : * The intention is that, to ensure that no transaction commits based on dirty
7886 : : * reads, an application should call this function any time "acls" is
7887 : : * read as part of a read-modify-write operation.
7888 : : *
7889 : : * In some cases this function reduces to a no-op, because the current value
7890 : : * of "acls" is already known:
7891 : : *
7892 : : * - If 'row' is a row created by the current transaction (returned by
7893 : : * nbrec_logical_switch_insert()).
7894 : : *
7895 : : * - If "acls" has already been modified (with
7896 : : * nbrec_logical_switch_set_acls()) within the current transaction.
7897 : : *
7898 : : * Because of the latter property, always call this function *before*
7899 : : * nbrec_logical_switch_set_acls() for a given read-modify-write.
7900 : : *
7901 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7902 : : void
7903 : 23 : nbrec_logical_switch_verify_acls(const struct nbrec_logical_switch *row)
7904 : : {
7905 [ - + ]: 23 : ovs_assert(inited);
7906 : 23 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_ACLS]);
7907 : 23 : }
7908 : :
7909 : : /* Causes the original contents of column "external_ids" in 'row' to be
7910 : : * verified as a prerequisite to completing the transaction. That is, if
7911 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
7912 : : * time that the IDL originally read its contents and the time that the
7913 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7914 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7915 : : * change has already been received).
7916 : : *
7917 : : * The intention is that, to ensure that no transaction commits based on dirty
7918 : : * reads, an application should call this function any time "external_ids" is
7919 : : * read as part of a read-modify-write operation.
7920 : : *
7921 : : * In some cases this function reduces to a no-op, because the current value
7922 : : * of "external_ids" is already known:
7923 : : *
7924 : : * - If 'row' is a row created by the current transaction (returned by
7925 : : * nbrec_logical_switch_insert()).
7926 : : *
7927 : : * - If "external_ids" has already been modified (with
7928 : : * nbrec_logical_switch_set_external_ids()) within the current transaction.
7929 : : *
7930 : : * Because of the latter property, always call this function *before*
7931 : : * nbrec_logical_switch_set_external_ids() for a given read-modify-write.
7932 : : *
7933 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7934 : : void
7935 : 0 : nbrec_logical_switch_verify_external_ids(const struct nbrec_logical_switch *row)
7936 : : {
7937 [ # # ]: 0 : ovs_assert(inited);
7938 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_EXTERNAL_IDS]);
7939 : 0 : }
7940 : :
7941 : : /* Causes the original contents of column "load_balancer" in 'row' to be
7942 : : * verified as a prerequisite to completing the transaction. That is, if
7943 : : * "load_balancer" in 'row' changed (or if 'row' was deleted) between the
7944 : : * time that the IDL originally read its contents and the time that the
7945 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7946 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7947 : : * change has already been received).
7948 : : *
7949 : : * The intention is that, to ensure that no transaction commits based on dirty
7950 : : * reads, an application should call this function any time "load_balancer" is
7951 : : * read as part of a read-modify-write operation.
7952 : : *
7953 : : * In some cases this function reduces to a no-op, because the current value
7954 : : * of "load_balancer" is already known:
7955 : : *
7956 : : * - If 'row' is a row created by the current transaction (returned by
7957 : : * nbrec_logical_switch_insert()).
7958 : : *
7959 : : * - If "load_balancer" has already been modified (with
7960 : : * nbrec_logical_switch_set_load_balancer()) within the current transaction.
7961 : : *
7962 : : * Because of the latter property, always call this function *before*
7963 : : * nbrec_logical_switch_set_load_balancer() for a given read-modify-write.
7964 : : *
7965 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7966 : : void
7967 : 0 : nbrec_logical_switch_verify_load_balancer(const struct nbrec_logical_switch *row)
7968 : : {
7969 [ # # ]: 0 : ovs_assert(inited);
7970 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_LOAD_BALANCER]);
7971 : 0 : }
7972 : :
7973 : : /* Causes the original contents of column "name" in 'row' to be
7974 : : * verified as a prerequisite to completing the transaction. That is, if
7975 : : * "name" in 'row' changed (or if 'row' was deleted) between the
7976 : : * time that the IDL originally read its contents and the time that the
7977 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7978 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7979 : : * change has already been received).
7980 : : *
7981 : : * The intention is that, to ensure that no transaction commits based on dirty
7982 : : * reads, an application should call this function any time "name" is
7983 : : * read as part of a read-modify-write operation.
7984 : : *
7985 : : * In some cases this function reduces to a no-op, because the current value
7986 : : * of "name" is already known:
7987 : : *
7988 : : * - If 'row' is a row created by the current transaction (returned by
7989 : : * nbrec_logical_switch_insert()).
7990 : : *
7991 : : * - If "name" has already been modified (with
7992 : : * nbrec_logical_switch_set_name()) within the current transaction.
7993 : : *
7994 : : * Because of the latter property, always call this function *before*
7995 : : * nbrec_logical_switch_set_name() for a given read-modify-write.
7996 : : *
7997 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7998 : : void
7999 : 0 : nbrec_logical_switch_verify_name(const struct nbrec_logical_switch *row)
8000 : : {
8001 [ # # ]: 0 : ovs_assert(inited);
8002 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_NAME]);
8003 : 0 : }
8004 : :
8005 : : /* Causes the original contents of column "other_config" in 'row' to be
8006 : : * verified as a prerequisite to completing the transaction. That is, if
8007 : : * "other_config" in 'row' changed (or if 'row' was deleted) between the
8008 : : * time that the IDL originally read its contents and the time that the
8009 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
8010 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
8011 : : * change has already been received).
8012 : : *
8013 : : * The intention is that, to ensure that no transaction commits based on dirty
8014 : : * reads, an application should call this function any time "other_config" is
8015 : : * read as part of a read-modify-write operation.
8016 : : *
8017 : : * In some cases this function reduces to a no-op, because the current value
8018 : : * of "other_config" is already known:
8019 : : *
8020 : : * - If 'row' is a row created by the current transaction (returned by
8021 : : * nbrec_logical_switch_insert()).
8022 : : *
8023 : : * - If "other_config" has already been modified (with
8024 : : * nbrec_logical_switch_set_other_config()) within the current transaction.
8025 : : *
8026 : : * Because of the latter property, always call this function *before*
8027 : : * nbrec_logical_switch_set_other_config() for a given read-modify-write.
8028 : : *
8029 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8030 : : void
8031 : 0 : nbrec_logical_switch_verify_other_config(const struct nbrec_logical_switch *row)
8032 : : {
8033 [ # # ]: 0 : ovs_assert(inited);
8034 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_OTHER_CONFIG]);
8035 : 0 : }
8036 : :
8037 : : /* Causes the original contents of column "ports" in 'row' to be
8038 : : * verified as a prerequisite to completing the transaction. That is, if
8039 : : * "ports" in 'row' changed (or if 'row' was deleted) between the
8040 : : * time that the IDL originally read its contents and the time that the
8041 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
8042 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
8043 : : * change has already been received).
8044 : : *
8045 : : * The intention is that, to ensure that no transaction commits based on dirty
8046 : : * reads, an application should call this function any time "ports" is
8047 : : * read as part of a read-modify-write operation.
8048 : : *
8049 : : * In some cases this function reduces to a no-op, because the current value
8050 : : * of "ports" is already known:
8051 : : *
8052 : : * - If 'row' is a row created by the current transaction (returned by
8053 : : * nbrec_logical_switch_insert()).
8054 : : *
8055 : : * - If "ports" has already been modified (with
8056 : : * nbrec_logical_switch_set_ports()) within the current transaction.
8057 : : *
8058 : : * Because of the latter property, always call this function *before*
8059 : : * nbrec_logical_switch_set_ports() for a given read-modify-write.
8060 : : *
8061 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8062 : : void
8063 : 251 : nbrec_logical_switch_verify_ports(const struct nbrec_logical_switch *row)
8064 : : {
8065 [ - + ]: 251 : ovs_assert(inited);
8066 : 251 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_PORTS]);
8067 : 251 : }
8068 : :
8069 : : /* Returns the "acls" column's value from the "Logical_Switch" table in 'row'
8070 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
8071 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
8072 : : * for a given key than implementing the same operation on the "cooked"
8073 : : * form in 'row'.
8074 : : *
8075 : : * 'key_type' must be OVSDB_TYPE_UUID.
8076 : : * (This helps to avoid silent bugs if someone changes acls's
8077 : : * type without updating the caller.)
8078 : : *
8079 : : * The caller must not modify or free the returned value.
8080 : : *
8081 : : * Various kinds of changes can invalidate the returned value: modifying
8082 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8083 : : * If the returned value is needed for a long time, it is best to make a copy
8084 : : * of it with ovsdb_datum_clone().
8085 : : *
8086 : : * This function is rarely useful, since it is easier to access the value
8087 : : * directly through the "acls" member in nbrec_logical_switch. */
8088 : : const struct ovsdb_datum *
8089 : 0 : nbrec_logical_switch_get_acls(const struct nbrec_logical_switch *row,
8090 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
8091 : : {
8092 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
8093 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_col_acls);
8094 : : }
8095 : :
8096 : : /* Returns the "external_ids" column's value from the "Logical_Switch" table in 'row'
8097 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
8098 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
8099 : : * for a given key than implementing the same operation on the "cooked"
8100 : : * form in 'row'.
8101 : : *
8102 : : * 'key_type' must be OVSDB_TYPE_STRING.
8103 : : * 'value_type' must be OVSDB_TYPE_STRING.
8104 : : * (This helps to avoid silent bugs if someone changes external_ids's
8105 : : * type without updating the caller.)
8106 : : *
8107 : : * The caller must not modify or free the returned value.
8108 : : *
8109 : : * Various kinds of changes can invalidate the returned value: modifying
8110 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8111 : : * If the returned value is needed for a long time, it is best to make a copy
8112 : : * of it with ovsdb_datum_clone().
8113 : : *
8114 : : * This function is rarely useful, since it is easier to access the value
8115 : : * directly through the "external_ids" member in nbrec_logical_switch. */
8116 : : const struct ovsdb_datum *
8117 : 0 : nbrec_logical_switch_get_external_ids(const struct nbrec_logical_switch *row,
8118 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
8119 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
8120 : : {
8121 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
8122 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
8123 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_col_external_ids);
8124 : : }
8125 : :
8126 : : /* Returns the "load_balancer" column's value from the "Logical_Switch" table in 'row'
8127 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
8128 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
8129 : : * for a given key than implementing the same operation on the "cooked"
8130 : : * form in 'row'.
8131 : : *
8132 : : * 'key_type' must be OVSDB_TYPE_UUID.
8133 : : * (This helps to avoid silent bugs if someone changes load_balancer's
8134 : : * type without updating the caller.)
8135 : : *
8136 : : * The caller must not modify or free the returned value.
8137 : : *
8138 : : * Various kinds of changes can invalidate the returned value: modifying
8139 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8140 : : * If the returned value is needed for a long time, it is best to make a copy
8141 : : * of it with ovsdb_datum_clone().
8142 : : *
8143 : : * This function is rarely useful, since it is easier to access the value
8144 : : * directly through the "load_balancer" member in nbrec_logical_switch. */
8145 : : const struct ovsdb_datum *
8146 : 0 : nbrec_logical_switch_get_load_balancer(const struct nbrec_logical_switch *row,
8147 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
8148 : : {
8149 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
8150 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_col_load_balancer);
8151 : : }
8152 : :
8153 : : /* Returns the "name" column's value from the "Logical_Switch" table in 'row'
8154 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
8155 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
8156 : : * for a given key than implementing the same operation on the "cooked"
8157 : : * form in 'row'.
8158 : : *
8159 : : * 'key_type' must be OVSDB_TYPE_STRING.
8160 : : * (This helps to avoid silent bugs if someone changes name's
8161 : : * type without updating the caller.)
8162 : : *
8163 : : * The caller must not modify or free the returned value.
8164 : : *
8165 : : * Various kinds of changes can invalidate the returned value: modifying
8166 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8167 : : * If the returned value is needed for a long time, it is best to make a copy
8168 : : * of it with ovsdb_datum_clone().
8169 : : *
8170 : : * This function is rarely useful, since it is easier to access the value
8171 : : * directly through the "name" member in nbrec_logical_switch. */
8172 : : const struct ovsdb_datum *
8173 : 0 : nbrec_logical_switch_get_name(const struct nbrec_logical_switch *row,
8174 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
8175 : : {
8176 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
8177 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_col_name);
8178 : : }
8179 : :
8180 : : /* Returns the "other_config" column's value from the "Logical_Switch" table in 'row'
8181 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
8182 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
8183 : : * for a given key than implementing the same operation on the "cooked"
8184 : : * form in 'row'.
8185 : : *
8186 : : * 'key_type' must be OVSDB_TYPE_STRING.
8187 : : * 'value_type' must be OVSDB_TYPE_STRING.
8188 : : * (This helps to avoid silent bugs if someone changes other_config's
8189 : : * type without updating the caller.)
8190 : : *
8191 : : * The caller must not modify or free the returned value.
8192 : : *
8193 : : * Various kinds of changes can invalidate the returned value: modifying
8194 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8195 : : * If the returned value is needed for a long time, it is best to make a copy
8196 : : * of it with ovsdb_datum_clone().
8197 : : *
8198 : : * This function is rarely useful, since it is easier to access the value
8199 : : * directly through the "other_config" member in nbrec_logical_switch. */
8200 : : const struct ovsdb_datum *
8201 : 0 : nbrec_logical_switch_get_other_config(const struct nbrec_logical_switch *row,
8202 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
8203 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
8204 : : {
8205 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
8206 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
8207 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_col_other_config);
8208 : : }
8209 : :
8210 : : /* Returns the "ports" column's value from the "Logical_Switch" table in 'row'
8211 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
8212 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
8213 : : * for a given key than implementing the same operation on the "cooked"
8214 : : * form in 'row'.
8215 : : *
8216 : : * 'key_type' must be OVSDB_TYPE_UUID.
8217 : : * (This helps to avoid silent bugs if someone changes ports's
8218 : : * type without updating the caller.)
8219 : : *
8220 : : * The caller must not modify or free the returned value.
8221 : : *
8222 : : * Various kinds of changes can invalidate the returned value: modifying
8223 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8224 : : * If the returned value is needed for a long time, it is best to make a copy
8225 : : * of it with ovsdb_datum_clone().
8226 : : *
8227 : : * This function is rarely useful, since it is easier to access the value
8228 : : * directly through the "ports" member in nbrec_logical_switch. */
8229 : : const struct ovsdb_datum *
8230 : 0 : nbrec_logical_switch_get_ports(const struct nbrec_logical_switch *row,
8231 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
8232 : : {
8233 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
8234 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_col_ports);
8235 : : }
8236 : :
8237 : : /* Sets the "acls" column from the "Logical_Switch" table in 'row' to
8238 : : * the 'acls' set with 'n_acls' entries.
8239 : : *
8240 : : * The caller retains ownership of the arguments. */
8241 : : void
8242 : 23 : nbrec_logical_switch_set_acls(const struct nbrec_logical_switch *row, struct nbrec_acl **acls, size_t n_acls)
8243 : : {
8244 : : struct ovsdb_datum datum;
8245 : : size_t i;
8246 : :
8247 [ - + ]: 23 : ovs_assert(inited);
8248 : 23 : datum.n = n_acls;
8249 [ + + ]: 23 : datum.keys = n_acls ? xmalloc(n_acls * sizeof *datum.keys) : NULL;
8250 : 23 : datum.values = NULL;
8251 [ + + ]: 81 : for (i = 0; i < n_acls; i++) {
8252 : 58 : datum.keys[i].uuid = acls[i]->header_.uuid;
8253 : : }
8254 : 23 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8255 : 23 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_ACLS], &datum);
8256 : 23 : }
8257 : :
8258 : : /* Sets the "external_ids" column's value from the "Logical_Switch" table in 'row'
8259 : : * to 'external_ids'.
8260 : : *
8261 : : * The caller retains ownership of 'external_ids' and everything in it. */
8262 : : void
8263 : 0 : nbrec_logical_switch_set_external_ids(const struct nbrec_logical_switch *row, const struct smap *external_ids)
8264 : : {
8265 : : struct ovsdb_datum datum;
8266 : :
8267 [ # # ]: 0 : ovs_assert(inited);
8268 [ # # ]: 0 : if (external_ids) {
8269 : : struct smap_node *node;
8270 : : size_t i;
8271 : :
8272 : 0 : datum.n = smap_count(external_ids);
8273 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8274 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8275 : :
8276 : 0 : i = 0;
8277 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
8278 : 0 : datum.keys[i].string = xstrdup(node->key);
8279 : 0 : datum.values[i].string = xstrdup(node->value);
8280 : 0 : i++;
8281 : : }
8282 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8283 : : } else {
8284 : 0 : ovsdb_datum_init_empty(&datum);
8285 : : }
8286 : 0 : ovsdb_idl_txn_write(&row->header_,
8287 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_EXTERNAL_IDS],
8288 : : &datum);
8289 : 0 : }
8290 : :
8291 : :
8292 : : /* Sets the "load_balancer" column from the "Logical_Switch" table in 'row' to
8293 : : * the 'load_balancer' set with 'n_load_balancer' entries.
8294 : : *
8295 : : * The caller retains ownership of the arguments. */
8296 : : void
8297 : 0 : nbrec_logical_switch_set_load_balancer(const struct nbrec_logical_switch *row, struct nbrec_load_balancer **load_balancer, size_t n_load_balancer)
8298 : : {
8299 : : struct ovsdb_datum datum;
8300 : : size_t i;
8301 : :
8302 [ # # ]: 0 : ovs_assert(inited);
8303 : 0 : datum.n = n_load_balancer;
8304 [ # # ]: 0 : datum.keys = n_load_balancer ? xmalloc(n_load_balancer * sizeof *datum.keys) : NULL;
8305 : 0 : datum.values = NULL;
8306 [ # # ]: 0 : for (i = 0; i < n_load_balancer; i++) {
8307 : 0 : datum.keys[i].uuid = load_balancer[i]->header_.uuid;
8308 : : }
8309 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8310 : 0 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_LOAD_BALANCER], &datum);
8311 : 0 : }
8312 : :
8313 : : /* Sets the "name" column from the "Logical_Switch" table in 'row' to
8314 : : * 'name'.
8315 : : *
8316 : : * The caller retains ownership of the arguments. */
8317 : : void
8318 : 85 : nbrec_logical_switch_set_name(const struct nbrec_logical_switch *row, const char *name)
8319 : : {
8320 : : struct ovsdb_datum datum;
8321 : : union ovsdb_atom key;
8322 : :
8323 [ - + ]: 85 : ovs_assert(inited);
8324 : 85 : datum.n = 1;
8325 : 85 : datum.keys = &key;
8326 : 85 : key.string = CONST_CAST(char *, name);
8327 : 85 : datum.values = NULL;
8328 : 85 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_NAME], &datum);
8329 : 85 : }
8330 : :
8331 : : /* Sets the "other_config" column's value from the "Logical_Switch" table in 'row'
8332 : : * to 'other_config'.
8333 : : *
8334 : : * The caller retains ownership of 'other_config' and everything in it. */
8335 : : void
8336 : 0 : nbrec_logical_switch_set_other_config(const struct nbrec_logical_switch *row, const struct smap *other_config)
8337 : : {
8338 : : struct ovsdb_datum datum;
8339 : :
8340 [ # # ]: 0 : ovs_assert(inited);
8341 [ # # ]: 0 : if (other_config) {
8342 : : struct smap_node *node;
8343 : : size_t i;
8344 : :
8345 : 0 : datum.n = smap_count(other_config);
8346 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8347 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8348 : :
8349 : 0 : i = 0;
8350 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, other_config) {
8351 : 0 : datum.keys[i].string = xstrdup(node->key);
8352 : 0 : datum.values[i].string = xstrdup(node->value);
8353 : 0 : i++;
8354 : : }
8355 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8356 : : } else {
8357 : 0 : ovsdb_datum_init_empty(&datum);
8358 : : }
8359 : 0 : ovsdb_idl_txn_write(&row->header_,
8360 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_OTHER_CONFIG],
8361 : : &datum);
8362 : 0 : }
8363 : :
8364 : :
8365 : : /* Sets the "ports" column from the "Logical_Switch" table in 'row' to
8366 : : * the 'ports' set with 'n_ports' entries.
8367 : : *
8368 : : * The caller retains ownership of the arguments. */
8369 : : void
8370 : 251 : nbrec_logical_switch_set_ports(const struct nbrec_logical_switch *row, struct nbrec_logical_switch_port **ports, size_t n_ports)
8371 : : {
8372 : : struct ovsdb_datum datum;
8373 : : size_t i;
8374 : :
8375 [ - + ]: 251 : ovs_assert(inited);
8376 : 251 : datum.n = n_ports;
8377 [ + - ]: 251 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
8378 : 251 : datum.values = NULL;
8379 [ + + ]: 1110 : for (i = 0; i < n_ports; i++) {
8380 : 859 : datum.keys[i].uuid = ports[i]->header_.uuid;
8381 : : }
8382 : 251 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8383 : 251 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_PORTS], &datum);
8384 : 251 : }
8385 : :
8386 : : /* Adds the value 'new_value' to the "acls" set column from the "Logical_Switch" table
8387 : : * in 'row'.
8388 : : *
8389 : : */
8390 : : void
8391 : 0 : nbrec_logical_switch_update_acls_addvalue(const struct nbrec_logical_switch *row, const struct nbrec_acl *new_value)
8392 : : {
8393 : : struct ovsdb_datum *datum;
8394 : :
8395 [ # # ]: 0 : ovs_assert(inited);
8396 : :
8397 : 0 : datum = xmalloc(sizeof *datum);
8398 : 0 : datum->n = 1;
8399 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8400 : 0 : datum->values = NULL;
8401 : :
8402 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
8403 : :
8404 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
8405 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_ACLS],
8406 : : datum);
8407 : 0 : }
8408 : :
8409 : : /* Deletes the value 'delete_value' from the "acls" set column from the
8410 : : * "Logical_Switch" table in 'row'.
8411 : : *
8412 : : */
8413 : : void
8414 : 0 : nbrec_logical_switch_update_acls_delvalue(const struct nbrec_logical_switch *row, const struct nbrec_acl *delete_value)
8415 : : {
8416 : : struct ovsdb_datum *datum;
8417 : :
8418 [ # # ]: 0 : ovs_assert(inited);
8419 : :
8420 : 0 : datum = xmalloc(sizeof *datum);
8421 : 0 : datum->n = 1;
8422 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8423 : 0 : datum->values = NULL;
8424 : :
8425 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
8426 : :
8427 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
8428 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_ACLS],
8429 : : datum);
8430 : 0 : }
8431 : :
8432 : : /* Sets an element of the "external_ids" map column from the "Logical_Switch" table in 'row'
8433 : : * to 'new_value' given the key value 'new_key'.
8434 : : *
8435 : : */
8436 : : void
8437 : 0 : nbrec_logical_switch_update_external_ids_setkey(const struct nbrec_logical_switch *row, const char *new_key, const char *new_value)
8438 : : {
8439 : : struct ovsdb_datum *datum;
8440 : :
8441 [ # # ]: 0 : ovs_assert(inited);
8442 : :
8443 : 0 : datum = xmalloc(sizeof *datum);
8444 : 0 : datum->n = 1;
8445 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
8446 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
8447 : :
8448 : 0 : datum->keys[0].string = xstrdup(new_key);
8449 : 0 : datum->values[0].string = xstrdup(new_value);
8450 : :
8451 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
8452 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_EXTERNAL_IDS],
8453 : : datum);
8454 : 0 : }
8455 : :
8456 : : /* Deletes an element of the "external_ids" map column from the "Logical_Switch" table in 'row'
8457 : : * given the key value 'delete_key'.
8458 : : *
8459 : : */
8460 : : void
8461 : 0 : nbrec_logical_switch_update_external_ids_delkey(const struct nbrec_logical_switch *row, const char *delete_key)
8462 : : {
8463 : : struct ovsdb_datum *datum;
8464 : :
8465 [ # # ]: 0 : ovs_assert(inited);
8466 : :
8467 : 0 : datum = xmalloc(sizeof *datum);
8468 : 0 : datum->n = 1;
8469 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
8470 : 0 : datum->values = NULL;
8471 : :
8472 : 0 : datum->keys[0].string = xstrdup(delete_key);
8473 : :
8474 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
8475 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_EXTERNAL_IDS],
8476 : : datum);
8477 : 0 : }
8478 : :
8479 : : /* Adds the value 'new_value' to the "load_balancer" set column from the "Logical_Switch" table
8480 : : * in 'row'.
8481 : : *
8482 : : */
8483 : : void
8484 : 0 : nbrec_logical_switch_update_load_balancer_addvalue(const struct nbrec_logical_switch *row, const struct nbrec_load_balancer *new_value)
8485 : : {
8486 : : struct ovsdb_datum *datum;
8487 : :
8488 [ # # ]: 0 : ovs_assert(inited);
8489 : :
8490 : 0 : datum = xmalloc(sizeof *datum);
8491 : 0 : datum->n = 1;
8492 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8493 : 0 : datum->values = NULL;
8494 : :
8495 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
8496 : :
8497 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
8498 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_LOAD_BALANCER],
8499 : : datum);
8500 : 0 : }
8501 : :
8502 : : /* Deletes the value 'delete_value' from the "load_balancer" set column from the
8503 : : * "Logical_Switch" table in 'row'.
8504 : : *
8505 : : */
8506 : : void
8507 : 0 : nbrec_logical_switch_update_load_balancer_delvalue(const struct nbrec_logical_switch *row, const struct nbrec_load_balancer *delete_value)
8508 : : {
8509 : : struct ovsdb_datum *datum;
8510 : :
8511 [ # # ]: 0 : ovs_assert(inited);
8512 : :
8513 : 0 : datum = xmalloc(sizeof *datum);
8514 : 0 : datum->n = 1;
8515 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8516 : 0 : datum->values = NULL;
8517 : :
8518 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
8519 : :
8520 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
8521 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_LOAD_BALANCER],
8522 : : datum);
8523 : 0 : }
8524 : :
8525 : : /* Sets an element of the "other_config" map column from the "Logical_Switch" table in 'row'
8526 : : * to 'new_value' given the key value 'new_key'.
8527 : : *
8528 : : */
8529 : : void
8530 : 0 : nbrec_logical_switch_update_other_config_setkey(const struct nbrec_logical_switch *row, const char *new_key, const char *new_value)
8531 : : {
8532 : : struct ovsdb_datum *datum;
8533 : :
8534 [ # # ]: 0 : ovs_assert(inited);
8535 : :
8536 : 0 : datum = xmalloc(sizeof *datum);
8537 : 0 : datum->n = 1;
8538 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
8539 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
8540 : :
8541 : 0 : datum->keys[0].string = xstrdup(new_key);
8542 : 0 : datum->values[0].string = xstrdup(new_value);
8543 : :
8544 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
8545 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_OTHER_CONFIG],
8546 : : datum);
8547 : 0 : }
8548 : :
8549 : : /* Deletes an element of the "other_config" map column from the "Logical_Switch" table in 'row'
8550 : : * given the key value 'delete_key'.
8551 : : *
8552 : : */
8553 : : void
8554 : 0 : nbrec_logical_switch_update_other_config_delkey(const struct nbrec_logical_switch *row, const char *delete_key)
8555 : : {
8556 : : struct ovsdb_datum *datum;
8557 : :
8558 [ # # ]: 0 : ovs_assert(inited);
8559 : :
8560 : 0 : datum = xmalloc(sizeof *datum);
8561 : 0 : datum->n = 1;
8562 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
8563 : 0 : datum->values = NULL;
8564 : :
8565 : 0 : datum->keys[0].string = xstrdup(delete_key);
8566 : :
8567 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
8568 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_OTHER_CONFIG],
8569 : : datum);
8570 : 0 : }
8571 : :
8572 : : /* Adds the value 'new_value' to the "ports" set column from the "Logical_Switch" table
8573 : : * in 'row'.
8574 : : *
8575 : : */
8576 : : void
8577 : 0 : nbrec_logical_switch_update_ports_addvalue(const struct nbrec_logical_switch *row, const struct nbrec_logical_switch_port *new_value)
8578 : : {
8579 : : struct ovsdb_datum *datum;
8580 : :
8581 [ # # ]: 0 : ovs_assert(inited);
8582 : :
8583 : 0 : datum = xmalloc(sizeof *datum);
8584 : 0 : datum->n = 1;
8585 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8586 : 0 : datum->values = NULL;
8587 : :
8588 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
8589 : :
8590 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
8591 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_PORTS],
8592 : : datum);
8593 : 0 : }
8594 : :
8595 : : /* Deletes the value 'delete_value' from the "ports" set column from the
8596 : : * "Logical_Switch" table in 'row'.
8597 : : *
8598 : : */
8599 : : void
8600 : 0 : nbrec_logical_switch_update_ports_delvalue(const struct nbrec_logical_switch *row, const struct nbrec_logical_switch_port *delete_value)
8601 : : {
8602 : : struct ovsdb_datum *datum;
8603 : :
8604 [ # # ]: 0 : ovs_assert(inited);
8605 : :
8606 : 0 : datum = xmalloc(sizeof *datum);
8607 : 0 : datum->n = 1;
8608 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8609 : 0 : datum->values = NULL;
8610 : :
8611 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
8612 : :
8613 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
8614 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_PORTS],
8615 : : datum);
8616 : 0 : }
8617 : :
8618 : : /* Sets the "acls" column from the "Logical_Switch" table in 'row' to
8619 : : * the 'acls' set with 'n_acls' entries.
8620 : : *
8621 : : * The caller retains ownership of the arguments. */
8622 : : void
8623 : 0 : nbrec_logical_switch_add_clause_acls(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **acls, size_t n_acls)
8624 : : {
8625 : : struct ovsdb_datum datum;
8626 : : size_t i;
8627 : :
8628 [ # # ]: 0 : ovs_assert(inited);
8629 : 0 : datum.n = n_acls;
8630 [ # # ]: 0 : datum.keys = n_acls ? xmalloc(n_acls * sizeof *datum.keys) : NULL;
8631 : 0 : datum.values = NULL;
8632 [ # # ]: 0 : for (i = 0; i < n_acls; i++) {
8633 : 0 : datum.keys[i].uuid = *acls[i];
8634 : : }
8635 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8636 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8637 : : function,
8638 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_ACLS],
8639 : : &datum);
8640 : 0 : free(datum.keys);
8641 : 0 : }
8642 : :
8643 : : /* Sets the "external_ids" column's value from the "Logical_Switch" table in 'row'
8644 : : * to 'external_ids'.
8645 : : *
8646 : : * The caller retains ownership of 'external_ids' and everything in it. */
8647 : : void
8648 : 0 : nbrec_logical_switch_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
8649 : : {
8650 : : struct ovsdb_datum datum;
8651 : :
8652 [ # # ]: 0 : ovs_assert(inited);
8653 [ # # ]: 0 : if (external_ids) {
8654 : : struct smap_node *node;
8655 : : size_t i;
8656 : :
8657 : 0 : datum.n = smap_count(external_ids);
8658 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8659 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8660 : :
8661 : 0 : i = 0;
8662 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
8663 : 0 : datum.keys[i].string = xstrdup(node->key);
8664 : 0 : datum.values[i].string = xstrdup(node->value);
8665 : 0 : i++;
8666 : : }
8667 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8668 : : } else {
8669 : 0 : ovsdb_datum_init_empty(&datum);
8670 : : }
8671 : :
8672 : 0 : ovsdb_idl_condition_add_clause(idl,
8673 : : &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8674 : : function,
8675 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_EXTERNAL_IDS],
8676 : : &datum);
8677 : :
8678 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_col_external_ids.type);
8679 : 0 : }
8680 : :
8681 : :
8682 : : /* Sets the "load_balancer" column from the "Logical_Switch" table in 'row' to
8683 : : * the 'load_balancer' set with 'n_load_balancer' entries.
8684 : : *
8685 : : * The caller retains ownership of the arguments. */
8686 : : void
8687 : 0 : nbrec_logical_switch_add_clause_load_balancer(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **load_balancer, size_t n_load_balancer)
8688 : : {
8689 : : struct ovsdb_datum datum;
8690 : : size_t i;
8691 : :
8692 [ # # ]: 0 : ovs_assert(inited);
8693 : 0 : datum.n = n_load_balancer;
8694 [ # # ]: 0 : datum.keys = n_load_balancer ? xmalloc(n_load_balancer * sizeof *datum.keys) : NULL;
8695 : 0 : datum.values = NULL;
8696 [ # # ]: 0 : for (i = 0; i < n_load_balancer; i++) {
8697 : 0 : datum.keys[i].uuid = *load_balancer[i];
8698 : : }
8699 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8700 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8701 : : function,
8702 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_LOAD_BALANCER],
8703 : : &datum);
8704 : 0 : free(datum.keys);
8705 : 0 : }
8706 : :
8707 : : /* Sets the "name" column from the "Logical_Switch" table in 'row' to
8708 : : * 'name'.
8709 : : *
8710 : : * The caller retains ownership of the arguments. */
8711 : : void
8712 : 0 : nbrec_logical_switch_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
8713 : : {
8714 : : struct ovsdb_datum datum;
8715 : : union ovsdb_atom key;
8716 : :
8717 [ # # ]: 0 : ovs_assert(inited);
8718 : 0 : datum.n = 1;
8719 : 0 : datum.keys = &key;
8720 : 0 : key.string = CONST_CAST(char *, name);
8721 : 0 : datum.values = NULL;
8722 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8723 : : function,
8724 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_NAME],
8725 : : &datum);
8726 : 0 : }
8727 : :
8728 : : /* Sets the "other_config" column's value from the "Logical_Switch" table in 'row'
8729 : : * to 'other_config'.
8730 : : *
8731 : : * The caller retains ownership of 'other_config' and everything in it. */
8732 : : void
8733 : 0 : nbrec_logical_switch_add_clause_other_config(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *other_config)
8734 : : {
8735 : : struct ovsdb_datum datum;
8736 : :
8737 [ # # ]: 0 : ovs_assert(inited);
8738 [ # # ]: 0 : if (other_config) {
8739 : : struct smap_node *node;
8740 : : size_t i;
8741 : :
8742 : 0 : datum.n = smap_count(other_config);
8743 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8744 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8745 : :
8746 : 0 : i = 0;
8747 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, other_config) {
8748 : 0 : datum.keys[i].string = xstrdup(node->key);
8749 : 0 : datum.values[i].string = xstrdup(node->value);
8750 : 0 : i++;
8751 : : }
8752 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8753 : : } else {
8754 : 0 : ovsdb_datum_init_empty(&datum);
8755 : : }
8756 : :
8757 : 0 : ovsdb_idl_condition_add_clause(idl,
8758 : : &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8759 : : function,
8760 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_OTHER_CONFIG],
8761 : : &datum);
8762 : :
8763 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_col_other_config.type);
8764 : 0 : }
8765 : :
8766 : :
8767 : : /* Sets the "ports" column from the "Logical_Switch" table in 'row' to
8768 : : * the 'ports' set with 'n_ports' entries.
8769 : : *
8770 : : * The caller retains ownership of the arguments. */
8771 : : void
8772 : 0 : nbrec_logical_switch_add_clause_ports(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
8773 : : {
8774 : : struct ovsdb_datum datum;
8775 : : size_t i;
8776 : :
8777 [ # # ]: 0 : ovs_assert(inited);
8778 : 0 : datum.n = n_ports;
8779 [ # # ]: 0 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
8780 : 0 : datum.values = NULL;
8781 [ # # ]: 0 : for (i = 0; i < n_ports; i++) {
8782 : 0 : datum.keys[i].uuid = *ports[i];
8783 : : }
8784 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8785 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8786 : : function,
8787 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_PORTS],
8788 : : &datum);
8789 : 0 : free(datum.keys);
8790 : 0 : }
8791 : : void
8792 : 0 : nbrec_logical_switch_add_clause_false(struct ovsdb_idl *idl)
8793 : : {
8794 : : struct ovsdb_datum datum;
8795 : :
8796 : 0 : ovsdb_datum_init_empty(&datum);
8797 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH], OVSDB_F_FALSE, NULL, &datum);
8798 : 0 : }
8799 : : void
8800 : 0 : nbrec_logical_switch_add_clause_true(struct ovsdb_idl *idl)
8801 : : {
8802 : : struct ovsdb_datum datum;
8803 : :
8804 : 0 : ovsdb_datum_init_empty(&datum);
8805 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH], OVSDB_F_TRUE, NULL, &datum);
8806 : 0 : }
8807 : :
8808 : : /* Sets the "acls" column from the "Logical_Switch" table in 'row' to
8809 : : * the 'acls' set with 'n_acls' entries.
8810 : : *
8811 : : * The caller retains ownership of the arguments. */
8812 : : void
8813 : 0 : nbrec_logical_switch_remove_clause_acls(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **acls, size_t n_acls)
8814 : : {
8815 : : struct ovsdb_datum datum;
8816 : : size_t i;
8817 : :
8818 [ # # ]: 0 : ovs_assert(inited);
8819 : 0 : datum.n = n_acls;
8820 [ # # ]: 0 : datum.keys = n_acls ? xmalloc(n_acls * sizeof *datum.keys) : NULL;
8821 : 0 : datum.values = NULL;
8822 [ # # ]: 0 : for (i = 0; i < n_acls; i++) {
8823 : 0 : datum.keys[i].uuid = *acls[i];
8824 : : }
8825 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8826 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8827 : : function,
8828 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_ACLS],
8829 : : &datum);
8830 : 0 : free(datum.keys);
8831 : 0 : }
8832 : :
8833 : : /* Sets the "external_ids" column's value from the "Logical_Switch" table in 'row'
8834 : : * to 'external_ids'.
8835 : : *
8836 : : * The caller retains ownership of 'external_ids' and everything in it. */
8837 : : void
8838 : 0 : nbrec_logical_switch_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
8839 : : {
8840 : : struct ovsdb_datum datum;
8841 : :
8842 [ # # ]: 0 : ovs_assert(inited);
8843 [ # # ]: 0 : if (external_ids) {
8844 : : struct smap_node *node;
8845 : : size_t i;
8846 : :
8847 : 0 : datum.n = smap_count(external_ids);
8848 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8849 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8850 : :
8851 : 0 : i = 0;
8852 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
8853 : 0 : datum.keys[i].string = xstrdup(node->key);
8854 : 0 : datum.values[i].string = xstrdup(node->value);
8855 : 0 : i++;
8856 : : }
8857 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8858 : : } else {
8859 : 0 : ovsdb_datum_init_empty(&datum);
8860 : : }
8861 : :
8862 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8863 : : function,
8864 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_EXTERNAL_IDS],
8865 : : &datum);
8866 : :
8867 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_col_external_ids.type);
8868 : 0 : }
8869 : :
8870 : :
8871 : : /* Sets the "load_balancer" column from the "Logical_Switch" table in 'row' to
8872 : : * the 'load_balancer' set with 'n_load_balancer' entries.
8873 : : *
8874 : : * The caller retains ownership of the arguments. */
8875 : : void
8876 : 0 : nbrec_logical_switch_remove_clause_load_balancer(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **load_balancer, size_t n_load_balancer)
8877 : : {
8878 : : struct ovsdb_datum datum;
8879 : : size_t i;
8880 : :
8881 [ # # ]: 0 : ovs_assert(inited);
8882 : 0 : datum.n = n_load_balancer;
8883 [ # # ]: 0 : datum.keys = n_load_balancer ? xmalloc(n_load_balancer * sizeof *datum.keys) : NULL;
8884 : 0 : datum.values = NULL;
8885 [ # # ]: 0 : for (i = 0; i < n_load_balancer; i++) {
8886 : 0 : datum.keys[i].uuid = *load_balancer[i];
8887 : : }
8888 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8889 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8890 : : function,
8891 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_LOAD_BALANCER],
8892 : : &datum);
8893 : 0 : free(datum.keys);
8894 : 0 : }
8895 : :
8896 : : /* Sets the "name" column from the "Logical_Switch" table in 'row' to
8897 : : * 'name'.
8898 : : *
8899 : : * The caller retains ownership of the arguments. */
8900 : : void
8901 : 0 : nbrec_logical_switch_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
8902 : : {
8903 : : struct ovsdb_datum datum;
8904 : : union ovsdb_atom key;
8905 : :
8906 [ # # ]: 0 : ovs_assert(inited);
8907 : 0 : datum.n = 1;
8908 : 0 : datum.keys = &key;
8909 : 0 : key.string = CONST_CAST(char *, name);
8910 : 0 : datum.values = NULL;
8911 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8912 : : function,
8913 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_NAME],
8914 : : &datum);
8915 : 0 : }
8916 : :
8917 : : /* Sets the "other_config" column's value from the "Logical_Switch" table in 'row'
8918 : : * to 'other_config'.
8919 : : *
8920 : : * The caller retains ownership of 'other_config' and everything in it. */
8921 : : void
8922 : 0 : nbrec_logical_switch_remove_clause_other_config(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *other_config)
8923 : : {
8924 : : struct ovsdb_datum datum;
8925 : :
8926 [ # # ]: 0 : ovs_assert(inited);
8927 [ # # ]: 0 : if (other_config) {
8928 : : struct smap_node *node;
8929 : : size_t i;
8930 : :
8931 : 0 : datum.n = smap_count(other_config);
8932 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8933 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8934 : :
8935 : 0 : i = 0;
8936 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, other_config) {
8937 : 0 : datum.keys[i].string = xstrdup(node->key);
8938 : 0 : datum.values[i].string = xstrdup(node->value);
8939 : 0 : i++;
8940 : : }
8941 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8942 : : } else {
8943 : 0 : ovsdb_datum_init_empty(&datum);
8944 : : }
8945 : :
8946 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8947 : : function,
8948 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_OTHER_CONFIG],
8949 : : &datum);
8950 : :
8951 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_col_other_config.type);
8952 : 0 : }
8953 : :
8954 : :
8955 : : /* Sets the "ports" column from the "Logical_Switch" table in 'row' to
8956 : : * the 'ports' set with 'n_ports' entries.
8957 : : *
8958 : : * The caller retains ownership of the arguments. */
8959 : : void
8960 : 0 : nbrec_logical_switch_remove_clause_ports(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
8961 : : {
8962 : : struct ovsdb_datum datum;
8963 : : size_t i;
8964 : :
8965 [ # # ]: 0 : ovs_assert(inited);
8966 : 0 : datum.n = n_ports;
8967 [ # # ]: 0 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
8968 : 0 : datum.values = NULL;
8969 [ # # ]: 0 : for (i = 0; i < n_ports; i++) {
8970 : 0 : datum.keys[i].uuid = *ports[i];
8971 : : }
8972 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8973 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH],
8974 : : function,
8975 : : &nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_COL_PORTS],
8976 : : &datum);
8977 : 0 : free(datum.keys);
8978 : 0 : }
8979 : : void
8980 : 0 : nbrec_logical_switch_remove_clause_false(struct ovsdb_idl *idl)
8981 : : {
8982 : : struct ovsdb_datum datum;
8983 : :
8984 : 0 : ovsdb_datum_init_empty(&datum);
8985 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH], OVSDB_F_FALSE, NULL, &datum);
8986 : 0 : }
8987 : : void
8988 : 0 : nbrec_logical_switch_remove_clause_true(struct ovsdb_idl *idl)
8989 : : {
8990 : : struct ovsdb_datum datum;
8991 : :
8992 : 0 : ovsdb_datum_init_empty(&datum);
8993 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH], OVSDB_F_TRUE, NULL, &datum);
8994 : 0 : }
8995 : :
8996 : : struct ovsdb_idl_column nbrec_logical_switch_columns[NBREC_LOGICAL_SWITCH_N_COLUMNS];
8997 : :
8998 : : static void
8999 : 932 : nbrec_logical_switch_columns_init(void)
9000 : : {
9001 : : struct ovsdb_idl_column *c;
9002 : :
9003 : : /* Initialize nbrec_logical_switch_col_acls. */
9004 : 932 : c = &nbrec_logical_switch_col_acls;
9005 : 932 : c->name = "acls";
9006 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
9007 : 932 : c->type.key.u.uuid.refTableName = "ACL";
9008 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
9009 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9010 : 932 : c->type.n_min = 0;
9011 : 932 : c->type.n_max = UINT_MAX;
9012 : 932 : c->mutable = true;
9013 : 932 : c->parse = nbrec_logical_switch_parse_acls;
9014 : 932 : c->unparse = nbrec_logical_switch_unparse_acls;
9015 : :
9016 : : /* Initialize nbrec_logical_switch_col_external_ids. */
9017 : 932 : c = &nbrec_logical_switch_col_external_ids;
9018 : 932 : c->name = "external_ids";
9019 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9020 : 932 : c->type.key.u.string.minLen = 0;
9021 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
9022 : 932 : c->type.value.u.string.minLen = 0;
9023 : 932 : c->type.n_min = 0;
9024 : 932 : c->type.n_max = UINT_MAX;
9025 : 932 : c->mutable = true;
9026 : 932 : c->parse = nbrec_logical_switch_parse_external_ids;
9027 : 932 : c->unparse = nbrec_logical_switch_unparse_external_ids;
9028 : :
9029 : : /* Initialize nbrec_logical_switch_col_load_balancer. */
9030 : 932 : c = &nbrec_logical_switch_col_load_balancer;
9031 : 932 : c->name = "load_balancer";
9032 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
9033 : 932 : c->type.key.u.uuid.refTableName = "Load_Balancer";
9034 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
9035 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9036 : 932 : c->type.n_min = 0;
9037 : 932 : c->type.n_max = UINT_MAX;
9038 : 932 : c->mutable = true;
9039 : 932 : c->parse = nbrec_logical_switch_parse_load_balancer;
9040 : 932 : c->unparse = nbrec_logical_switch_unparse_load_balancer;
9041 : :
9042 : : /* Initialize nbrec_logical_switch_col_name. */
9043 : 932 : c = &nbrec_logical_switch_col_name;
9044 : 932 : c->name = "name";
9045 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9046 : 932 : c->type.key.u.string.minLen = 0;
9047 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9048 : 932 : c->type.n_min = 1;
9049 : 932 : c->type.n_max = 1;
9050 : 932 : c->mutable = true;
9051 : 932 : c->parse = nbrec_logical_switch_parse_name;
9052 : 932 : c->unparse = nbrec_logical_switch_unparse_name;
9053 : :
9054 : : /* Initialize nbrec_logical_switch_col_other_config. */
9055 : 932 : c = &nbrec_logical_switch_col_other_config;
9056 : 932 : c->name = "other_config";
9057 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9058 : 932 : c->type.key.u.string.minLen = 0;
9059 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
9060 : 932 : c->type.value.u.string.minLen = 0;
9061 : 932 : c->type.n_min = 0;
9062 : 932 : c->type.n_max = UINT_MAX;
9063 : 932 : c->mutable = true;
9064 : 932 : c->parse = nbrec_logical_switch_parse_other_config;
9065 : 932 : c->unparse = nbrec_logical_switch_unparse_other_config;
9066 : :
9067 : : /* Initialize nbrec_logical_switch_col_ports. */
9068 : 932 : c = &nbrec_logical_switch_col_ports;
9069 : 932 : c->name = "ports";
9070 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
9071 : 932 : c->type.key.u.uuid.refTableName = "Logical_Switch_Port";
9072 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
9073 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9074 : 932 : c->type.n_min = 0;
9075 : 932 : c->type.n_max = UINT_MAX;
9076 : 932 : c->mutable = true;
9077 : 932 : c->parse = nbrec_logical_switch_parse_ports;
9078 : 932 : c->unparse = nbrec_logical_switch_unparse_ports;
9079 : 932 : }
9080 : :
9081 : : /* Logical_Switch_Port table. */
9082 : :
9083 : : static void
9084 : 6429 : nbrec_logical_switch_port_parse_addresses(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9085 : : {
9086 : 6429 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9087 : : size_t i;
9088 : :
9089 [ - + ]: 6429 : ovs_assert(inited);
9090 : 6429 : row->addresses = NULL;
9091 : 6429 : row->n_addresses = 0;
9092 [ + + ]: 12168 : for (i = 0; i < datum->n; i++) {
9093 [ + + ]: 5739 : if (!row->n_addresses) {
9094 : 5355 : row->addresses = xmalloc(datum->n * sizeof *row->addresses);
9095 : : }
9096 : 5739 : row->addresses[row->n_addresses] = datum->keys[i].string;
9097 : 5739 : row->n_addresses++;
9098 : : }
9099 : 6429 : }
9100 : :
9101 : : static void
9102 : 6209 : nbrec_logical_switch_port_parse_dhcpv4_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9103 : : {
9104 : 6209 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9105 : :
9106 [ - + ]: 6209 : ovs_assert(inited);
9107 [ + + ]: 6209 : if (datum->n >= 1) {
9108 : 37 : row->dhcpv4_options = nbrec_dhcp_options_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], &datum->keys[0].uuid));
9109 : : } else {
9110 : 6172 : row->dhcpv4_options = NULL;
9111 : : }
9112 : 6209 : }
9113 : :
9114 : : static void
9115 : 6208 : nbrec_logical_switch_port_parse_dhcpv6_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9116 : : {
9117 : 6208 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9118 : :
9119 [ - + ]: 6208 : ovs_assert(inited);
9120 [ + + ]: 6208 : if (datum->n >= 1) {
9121 : 42 : row->dhcpv6_options = nbrec_dhcp_options_cast(ovsdb_idl_get_row_arc(row_, &nbrec_table_classes[NBREC_TABLE_DHCP_OPTIONS], &datum->keys[0].uuid));
9122 : : } else {
9123 : 6166 : row->dhcpv6_options = NULL;
9124 : : }
9125 : 6208 : }
9126 : :
9127 : : static void
9128 : 6235 : nbrec_logical_switch_port_parse_dynamic_addresses(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9129 : : {
9130 : 6235 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9131 : :
9132 [ - + ]: 6235 : ovs_assert(inited);
9133 [ + + ]: 6235 : if (datum->n >= 1) {
9134 : 1144 : row->dynamic_addresses = datum->keys[0].string;
9135 : : } else {
9136 : 5091 : row->dynamic_addresses = NULL;
9137 : : }
9138 : 6235 : }
9139 : :
9140 : : static void
9141 : 6206 : nbrec_logical_switch_port_parse_enabled(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9142 : : {
9143 : 6206 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9144 : 6206 : size_t n = MIN(1, datum->n);
9145 : : size_t i;
9146 : :
9147 [ - + ]: 6206 : ovs_assert(inited);
9148 : 6206 : row->enabled = NULL;
9149 : 6206 : row->n_enabled = 0;
9150 [ - + ]: 6206 : for (i = 0; i < n; i++) {
9151 [ # # ]: 0 : if (!row->n_enabled) {
9152 : 0 : row->enabled = xmalloc(n * sizeof_bool);
9153 : : }
9154 : 0 : row->enabled[row->n_enabled] = datum->keys[i].boolean;
9155 : 0 : row->n_enabled++;
9156 : : }
9157 : 6206 : }
9158 : :
9159 : : static void
9160 : 6206 : nbrec_logical_switch_port_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9161 : : {
9162 : 6206 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9163 : : size_t i;
9164 : :
9165 [ - + ]: 6206 : ovs_assert(inited);
9166 : 6206 : smap_init(&row->external_ids);
9167 [ - + ]: 6206 : for (i = 0; i < datum->n; i++) {
9168 : 0 : smap_add(&row->external_ids,
9169 : 0 : datum->keys[i].string,
9170 : 0 : datum->values[i].string);
9171 : : }
9172 : 6206 : }
9173 : :
9174 : : static void
9175 : 6450 : nbrec_logical_switch_port_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9176 : : {
9177 : 6450 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9178 : :
9179 [ - + ]: 6450 : ovs_assert(inited);
9180 [ + - ]: 6450 : if (datum->n >= 1) {
9181 : 6450 : row->name = datum->keys[0].string;
9182 : : } else {
9183 : 0 : row->name = "";
9184 : : }
9185 : 6450 : }
9186 : :
9187 : : static void
9188 : 6280 : nbrec_logical_switch_port_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9189 : : {
9190 : 6280 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9191 : : size_t i;
9192 : :
9193 [ - + ]: 6280 : ovs_assert(inited);
9194 : 6280 : smap_init(&row->options);
9195 [ + + ]: 7737 : for (i = 0; i < datum->n; i++) {
9196 : 1457 : smap_add(&row->options,
9197 : 1457 : datum->keys[i].string,
9198 : 1457 : datum->values[i].string);
9199 : : }
9200 : 6280 : }
9201 : :
9202 : : static void
9203 : 6218 : nbrec_logical_switch_port_parse_parent_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9204 : : {
9205 : 6218 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9206 : :
9207 [ - + ]: 6218 : ovs_assert(inited);
9208 [ + + ]: 6218 : if (datum->n >= 1) {
9209 : 456 : row->parent_name = datum->keys[0].string;
9210 : : } else {
9211 : 5762 : row->parent_name = NULL;
9212 : : }
9213 : 6218 : }
9214 : :
9215 : : static void
9216 : 6245 : nbrec_logical_switch_port_parse_port_security(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9217 : : {
9218 : 6245 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9219 : : size_t i;
9220 : :
9221 [ - + ]: 6245 : ovs_assert(inited);
9222 : 6245 : row->port_security = NULL;
9223 : 6245 : row->n_port_security = 0;
9224 [ + + ]: 6978 : for (i = 0; i < datum->n; i++) {
9225 [ + + ]: 733 : if (!row->n_port_security) {
9226 : 685 : row->port_security = xmalloc(datum->n * sizeof *row->port_security);
9227 : : }
9228 : 733 : row->port_security[row->n_port_security] = datum->keys[i].string;
9229 : 733 : row->n_port_security++;
9230 : : }
9231 : 6245 : }
9232 : :
9233 : : static void
9234 : 6347 : nbrec_logical_switch_port_parse_tag(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9235 : : {
9236 : 6347 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9237 : 6347 : size_t n = MIN(1, datum->n);
9238 : : size_t i;
9239 : :
9240 [ - + ]: 6347 : ovs_assert(inited);
9241 : 6347 : row->tag = NULL;
9242 : 6347 : row->n_tag = 0;
9243 [ + + ]: 6867 : for (i = 0; i < n; i++) {
9244 [ + - ]: 520 : if (!row->n_tag) {
9245 : 520 : row->tag = xmalloc(n * sizeof *row->tag);
9246 : : }
9247 : 520 : row->tag[row->n_tag] = datum->keys[i].integer;
9248 : 520 : row->n_tag++;
9249 : : }
9250 : 6347 : }
9251 : :
9252 : : static void
9253 : 6220 : nbrec_logical_switch_port_parse_tag_request(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9254 : : {
9255 : 6220 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9256 : 6220 : size_t n = MIN(1, datum->n);
9257 : : size_t i;
9258 : :
9259 [ - + ]: 6220 : ovs_assert(inited);
9260 : 6220 : row->tag_request = NULL;
9261 : 6220 : row->n_tag_request = 0;
9262 [ + + ]: 6675 : for (i = 0; i < n; i++) {
9263 [ + - ]: 455 : if (!row->n_tag_request) {
9264 : 455 : row->tag_request = xmalloc(n * sizeof *row->tag_request);
9265 : : }
9266 : 455 : row->tag_request[row->n_tag_request] = datum->keys[i].integer;
9267 : 455 : row->n_tag_request++;
9268 : : }
9269 : 6220 : }
9270 : :
9271 : : static void
9272 : 6280 : nbrec_logical_switch_port_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9273 : : {
9274 : 6280 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9275 : :
9276 [ - + ]: 6280 : ovs_assert(inited);
9277 [ + - ]: 6280 : if (datum->n >= 1) {
9278 : 6280 : row->type = datum->keys[0].string;
9279 : : } else {
9280 : 0 : row->type = "";
9281 : : }
9282 : 6280 : }
9283 : :
9284 : : static void
9285 : 6703 : nbrec_logical_switch_port_parse_up(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9286 : : {
9287 : 6703 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9288 : 6703 : size_t n = MIN(1, datum->n);
9289 : : size_t i;
9290 : :
9291 [ - + ]: 6703 : ovs_assert(inited);
9292 : 6703 : row->up = NULL;
9293 : 6703 : row->n_up = 0;
9294 [ + + ]: 12656 : for (i = 0; i < n; i++) {
9295 [ + - ]: 5953 : if (!row->n_up) {
9296 : 5953 : row->up = xmalloc(n * sizeof_bool);
9297 : : }
9298 : 5953 : row->up[row->n_up] = datum->keys[i].boolean;
9299 : 5953 : row->n_up++;
9300 : : }
9301 : 6703 : }
9302 : :
9303 : : static void
9304 : 6673 : nbrec_logical_switch_port_unparse_addresses(struct ovsdb_idl_row *row_)
9305 : : {
9306 : 6673 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9307 : :
9308 [ - + ]: 6673 : ovs_assert(inited);
9309 : 6673 : free(row->addresses);
9310 : 6673 : }
9311 : :
9312 : : static void
9313 : 6453 : nbrec_logical_switch_port_unparse_dhcpv4_options(struct ovsdb_idl_row *row OVS_UNUSED)
9314 : : {
9315 : : /* Nothing to do. */
9316 : 6453 : }
9317 : :
9318 : : static void
9319 : 6452 : nbrec_logical_switch_port_unparse_dhcpv6_options(struct ovsdb_idl_row *row OVS_UNUSED)
9320 : : {
9321 : : /* Nothing to do. */
9322 : 6452 : }
9323 : :
9324 : : static void
9325 : 6479 : nbrec_logical_switch_port_unparse_dynamic_addresses(struct ovsdb_idl_row *row OVS_UNUSED)
9326 : : {
9327 : : /* Nothing to do. */
9328 : 6479 : }
9329 : :
9330 : : static void
9331 : 6450 : nbrec_logical_switch_port_unparse_enabled(struct ovsdb_idl_row *row_)
9332 : : {
9333 : 6450 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9334 : :
9335 [ - + ]: 6450 : ovs_assert(inited);
9336 : 6450 : free(row->enabled);
9337 : 6450 : }
9338 : :
9339 : : static void
9340 : 6450 : nbrec_logical_switch_port_unparse_external_ids(struct ovsdb_idl_row *row_)
9341 : : {
9342 : 6450 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9343 : :
9344 [ - + ]: 6450 : ovs_assert(inited);
9345 : 6450 : smap_destroy(&row->external_ids);
9346 : 6450 : }
9347 : :
9348 : : static void
9349 : 6694 : nbrec_logical_switch_port_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
9350 : : {
9351 : : /* Nothing to do. */
9352 : 6694 : }
9353 : :
9354 : : static void
9355 : 6524 : nbrec_logical_switch_port_unparse_options(struct ovsdb_idl_row *row_)
9356 : : {
9357 : 6524 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9358 : :
9359 [ - + ]: 6524 : ovs_assert(inited);
9360 : 6524 : smap_destroy(&row->options);
9361 : 6524 : }
9362 : :
9363 : : static void
9364 : 6462 : nbrec_logical_switch_port_unparse_parent_name(struct ovsdb_idl_row *row OVS_UNUSED)
9365 : : {
9366 : : /* Nothing to do. */
9367 : 6462 : }
9368 : :
9369 : : static void
9370 : 6489 : nbrec_logical_switch_port_unparse_port_security(struct ovsdb_idl_row *row_)
9371 : : {
9372 : 6489 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9373 : :
9374 [ - + ]: 6489 : ovs_assert(inited);
9375 : 6489 : free(row->port_security);
9376 : 6489 : }
9377 : :
9378 : : static void
9379 : 6591 : nbrec_logical_switch_port_unparse_tag(struct ovsdb_idl_row *row_)
9380 : : {
9381 : 6591 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9382 : :
9383 [ - + ]: 6591 : ovs_assert(inited);
9384 : 6591 : free(row->tag);
9385 : 6591 : }
9386 : :
9387 : : static void
9388 : 6464 : nbrec_logical_switch_port_unparse_tag_request(struct ovsdb_idl_row *row_)
9389 : : {
9390 : 6464 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9391 : :
9392 [ - + ]: 6464 : ovs_assert(inited);
9393 : 6464 : free(row->tag_request);
9394 : 6464 : }
9395 : :
9396 : : static void
9397 : 6524 : nbrec_logical_switch_port_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
9398 : : {
9399 : : /* Nothing to do. */
9400 : 6524 : }
9401 : :
9402 : : static void
9403 : 6947 : nbrec_logical_switch_port_unparse_up(struct ovsdb_idl_row *row_)
9404 : : {
9405 : 6947 : struct nbrec_logical_switch_port *row = nbrec_logical_switch_port_cast(row_);
9406 : :
9407 [ - + ]: 6947 : ovs_assert(inited);
9408 : 6947 : free(row->up);
9409 : 6947 : }
9410 : :
9411 : : static void
9412 : 4652 : nbrec_logical_switch_port_init__(struct ovsdb_idl_row *row)
9413 : : {
9414 : 4652 : nbrec_logical_switch_port_init(nbrec_logical_switch_port_cast(row));
9415 : 4652 : }
9416 : :
9417 : : /* Clears the contents of 'row' in table "Logical_Switch_Port". */
9418 : : void
9419 : 4652 : nbrec_logical_switch_port_init(struct nbrec_logical_switch_port *row)
9420 : : {
9421 : 4652 : memset(row, 0, sizeof *row);
9422 : 4652 : smap_init(&row->external_ids);
9423 : 4652 : smap_init(&row->options);
9424 : 4652 : }
9425 : :
9426 : : /* Searches table "Logical_Switch_Port" in 'idl' for a row with UUID 'uuid'. Returns
9427 : : * a pointer to the row if there is one, otherwise a null pointer. */
9428 : : const struct nbrec_logical_switch_port *
9429 : 0 : nbrec_logical_switch_port_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
9430 : : {
9431 : 0 : return nbrec_logical_switch_port_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT], uuid));
9432 : : }
9433 : :
9434 : : /* Returns a row in table "Logical_Switch_Port" in 'idl', or a null pointer if that
9435 : : * table is empty.
9436 : : *
9437 : : * Database tables are internally maintained as hash tables, so adding or
9438 : : * removing rows while traversing the same table can cause some rows to be
9439 : : * visited twice or not at apply. */
9440 : : const struct nbrec_logical_switch_port *
9441 : 3525 : nbrec_logical_switch_port_first(const struct ovsdb_idl *idl)
9442 : : {
9443 : 3525 : return nbrec_logical_switch_port_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT]));
9444 : : }
9445 : :
9446 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
9447 : : * is the last row in its table. */
9448 : : const struct nbrec_logical_switch_port *
9449 : 28053 : nbrec_logical_switch_port_next(const struct nbrec_logical_switch_port *row)
9450 : : {
9451 : 28053 : return nbrec_logical_switch_port_cast(ovsdb_idl_next_row(&row->header_));
9452 : : }
9453 : :
9454 : 0 : unsigned int nbrec_logical_switch_port_get_seqno(const struct ovsdb_idl *idl)
9455 : : {
9456 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT]);
9457 : : }
9458 : :
9459 : 0 : unsigned int nbrec_logical_switch_port_row_get_seqno(const struct nbrec_logical_switch_port *row, enum ovsdb_idl_change change)
9460 : : {
9461 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
9462 : : }
9463 : :
9464 : : const struct nbrec_logical_switch_port *
9465 : 0 : nbrec_logical_switch_port_track_get_first(const struct ovsdb_idl *idl)
9466 : : {
9467 : 0 : return nbrec_logical_switch_port_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT]));
9468 : : }
9469 : :
9470 : : const struct nbrec_logical_switch_port
9471 : 0 : *nbrec_logical_switch_port_track_get_next(const struct nbrec_logical_switch_port *row)
9472 : : {
9473 : 0 : return nbrec_logical_switch_port_cast(ovsdb_idl_track_get_next(&row->header_));
9474 : : }
9475 : :
9476 : :
9477 : : /* Deletes 'row' from table "Logical_Switch_Port". 'row' may be freed, so it must not be
9478 : : * accessed afterward.
9479 : : *
9480 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9481 : : void
9482 : 7 : nbrec_logical_switch_port_delete(const struct nbrec_logical_switch_port *row)
9483 : : {
9484 : 7 : ovsdb_idl_txn_delete(&row->header_);
9485 : 7 : }
9486 : :
9487 : : /* Inserts and returns a new row in the table "Logical_Switch_Port" in the database
9488 : : * with open transaction 'txn'.
9489 : : *
9490 : : * The new row is assigned a randomly generated provisional UUID.
9491 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
9492 : : * but the IDL will replace any uses of the provisional UUID in the
9493 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
9494 : : struct nbrec_logical_switch_port *
9495 : 244 : nbrec_logical_switch_port_insert(struct ovsdb_idl_txn *txn)
9496 : : {
9497 : 244 : return nbrec_logical_switch_port_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT], NULL));
9498 : : }
9499 : :
9500 : : bool
9501 : 0 : nbrec_logical_switch_port_is_updated(const struct nbrec_logical_switch_port *row, enum nbrec_logical_switch_port_column_id column)
9502 : : {
9503 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_logical_switch_port_columns[column]);
9504 : : }
9505 : :
9506 : : /* Causes the original contents of column "addresses" in 'row' to be
9507 : : * verified as a prerequisite to completing the transaction. That is, if
9508 : : * "addresses" in 'row' changed (or if 'row' was deleted) between the
9509 : : * time that the IDL originally read its contents and the time that the
9510 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9511 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9512 : : * change has already been received).
9513 : : *
9514 : : * The intention is that, to ensure that no transaction commits based on dirty
9515 : : * reads, an application should call this function any time "addresses" is
9516 : : * read as part of a read-modify-write operation.
9517 : : *
9518 : : * In some cases this function reduces to a no-op, because the current value
9519 : : * of "addresses" is already known:
9520 : : *
9521 : : * - If 'row' is a row created by the current transaction (returned by
9522 : : * nbrec_logical_switch_port_insert()).
9523 : : *
9524 : : * - If "addresses" has already been modified (with
9525 : : * nbrec_logical_switch_port_set_addresses()) within the current transaction.
9526 : : *
9527 : : * Because of the latter property, always call this function *before*
9528 : : * nbrec_logical_switch_port_set_addresses() for a given read-modify-write.
9529 : : *
9530 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9531 : : void
9532 : 0 : nbrec_logical_switch_port_verify_addresses(const struct nbrec_logical_switch_port *row)
9533 : : {
9534 [ # # ]: 0 : ovs_assert(inited);
9535 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ADDRESSES]);
9536 : 0 : }
9537 : :
9538 : : /* Causes the original contents of column "dhcpv4_options" in 'row' to be
9539 : : * verified as a prerequisite to completing the transaction. That is, if
9540 : : * "dhcpv4_options" in 'row' changed (or if 'row' was deleted) between the
9541 : : * time that the IDL originally read its contents and the time that the
9542 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9543 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9544 : : * change has already been received).
9545 : : *
9546 : : * The intention is that, to ensure that no transaction commits based on dirty
9547 : : * reads, an application should call this function any time "dhcpv4_options" is
9548 : : * read as part of a read-modify-write operation.
9549 : : *
9550 : : * In some cases this function reduces to a no-op, because the current value
9551 : : * of "dhcpv4_options" is already known:
9552 : : *
9553 : : * - If 'row' is a row created by the current transaction (returned by
9554 : : * nbrec_logical_switch_port_insert()).
9555 : : *
9556 : : * - If "dhcpv4_options" has already been modified (with
9557 : : * nbrec_logical_switch_port_set_dhcpv4_options()) within the current transaction.
9558 : : *
9559 : : * Because of the latter property, always call this function *before*
9560 : : * nbrec_logical_switch_port_set_dhcpv4_options() for a given read-modify-write.
9561 : : *
9562 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9563 : : void
9564 : 0 : nbrec_logical_switch_port_verify_dhcpv4_options(const struct nbrec_logical_switch_port *row)
9565 : : {
9566 [ # # ]: 0 : ovs_assert(inited);
9567 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV4_OPTIONS]);
9568 : 0 : }
9569 : :
9570 : : /* Causes the original contents of column "dhcpv6_options" in 'row' to be
9571 : : * verified as a prerequisite to completing the transaction. That is, if
9572 : : * "dhcpv6_options" in 'row' changed (or if 'row' was deleted) between the
9573 : : * time that the IDL originally read its contents and the time that the
9574 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9575 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9576 : : * change has already been received).
9577 : : *
9578 : : * The intention is that, to ensure that no transaction commits based on dirty
9579 : : * reads, an application should call this function any time "dhcpv6_options" is
9580 : : * read as part of a read-modify-write operation.
9581 : : *
9582 : : * In some cases this function reduces to a no-op, because the current value
9583 : : * of "dhcpv6_options" is already known:
9584 : : *
9585 : : * - If 'row' is a row created by the current transaction (returned by
9586 : : * nbrec_logical_switch_port_insert()).
9587 : : *
9588 : : * - If "dhcpv6_options" has already been modified (with
9589 : : * nbrec_logical_switch_port_set_dhcpv6_options()) within the current transaction.
9590 : : *
9591 : : * Because of the latter property, always call this function *before*
9592 : : * nbrec_logical_switch_port_set_dhcpv6_options() for a given read-modify-write.
9593 : : *
9594 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9595 : : void
9596 : 0 : nbrec_logical_switch_port_verify_dhcpv6_options(const struct nbrec_logical_switch_port *row)
9597 : : {
9598 [ # # ]: 0 : ovs_assert(inited);
9599 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV6_OPTIONS]);
9600 : 0 : }
9601 : :
9602 : : /* Causes the original contents of column "dynamic_addresses" in 'row' to be
9603 : : * verified as a prerequisite to completing the transaction. That is, if
9604 : : * "dynamic_addresses" in 'row' changed (or if 'row' was deleted) between the
9605 : : * time that the IDL originally read its contents and the time that the
9606 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9607 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9608 : : * change has already been received).
9609 : : *
9610 : : * The intention is that, to ensure that no transaction commits based on dirty
9611 : : * reads, an application should call this function any time "dynamic_addresses" is
9612 : : * read as part of a read-modify-write operation.
9613 : : *
9614 : : * In some cases this function reduces to a no-op, because the current value
9615 : : * of "dynamic_addresses" is already known:
9616 : : *
9617 : : * - If 'row' is a row created by the current transaction (returned by
9618 : : * nbrec_logical_switch_port_insert()).
9619 : : *
9620 : : * - If "dynamic_addresses" has already been modified (with
9621 : : * nbrec_logical_switch_port_set_dynamic_addresses()) within the current transaction.
9622 : : *
9623 : : * Because of the latter property, always call this function *before*
9624 : : * nbrec_logical_switch_port_set_dynamic_addresses() for a given read-modify-write.
9625 : : *
9626 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9627 : : void
9628 : 0 : nbrec_logical_switch_port_verify_dynamic_addresses(const struct nbrec_logical_switch_port *row)
9629 : : {
9630 [ # # ]: 0 : ovs_assert(inited);
9631 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DYNAMIC_ADDRESSES]);
9632 : 0 : }
9633 : :
9634 : : /* Causes the original contents of column "enabled" in 'row' to be
9635 : : * verified as a prerequisite to completing the transaction. That is, if
9636 : : * "enabled" in 'row' changed (or if 'row' was deleted) between the
9637 : : * time that the IDL originally read its contents and the time that the
9638 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9639 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9640 : : * change has already been received).
9641 : : *
9642 : : * The intention is that, to ensure that no transaction commits based on dirty
9643 : : * reads, an application should call this function any time "enabled" is
9644 : : * read as part of a read-modify-write operation.
9645 : : *
9646 : : * In some cases this function reduces to a no-op, because the current value
9647 : : * of "enabled" is already known:
9648 : : *
9649 : : * - If 'row' is a row created by the current transaction (returned by
9650 : : * nbrec_logical_switch_port_insert()).
9651 : : *
9652 : : * - If "enabled" has already been modified (with
9653 : : * nbrec_logical_switch_port_set_enabled()) within the current transaction.
9654 : : *
9655 : : * Because of the latter property, always call this function *before*
9656 : : * nbrec_logical_switch_port_set_enabled() for a given read-modify-write.
9657 : : *
9658 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9659 : : void
9660 : 0 : nbrec_logical_switch_port_verify_enabled(const struct nbrec_logical_switch_port *row)
9661 : : {
9662 [ # # ]: 0 : ovs_assert(inited);
9663 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ENABLED]);
9664 : 0 : }
9665 : :
9666 : : /* Causes the original contents of column "external_ids" in 'row' to be
9667 : : * verified as a prerequisite to completing the transaction. That is, if
9668 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
9669 : : * time that the IDL originally read its contents and the time that the
9670 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9671 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9672 : : * change has already been received).
9673 : : *
9674 : : * The intention is that, to ensure that no transaction commits based on dirty
9675 : : * reads, an application should call this function any time "external_ids" is
9676 : : * read as part of a read-modify-write operation.
9677 : : *
9678 : : * In some cases this function reduces to a no-op, because the current value
9679 : : * of "external_ids" is already known:
9680 : : *
9681 : : * - If 'row' is a row created by the current transaction (returned by
9682 : : * nbrec_logical_switch_port_insert()).
9683 : : *
9684 : : * - If "external_ids" has already been modified (with
9685 : : * nbrec_logical_switch_port_set_external_ids()) within the current transaction.
9686 : : *
9687 : : * Because of the latter property, always call this function *before*
9688 : : * nbrec_logical_switch_port_set_external_ids() for a given read-modify-write.
9689 : : *
9690 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9691 : : void
9692 : 0 : nbrec_logical_switch_port_verify_external_ids(const struct nbrec_logical_switch_port *row)
9693 : : {
9694 [ # # ]: 0 : ovs_assert(inited);
9695 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_EXTERNAL_IDS]);
9696 : 0 : }
9697 : :
9698 : : /* Causes the original contents of column "name" in 'row' to be
9699 : : * verified as a prerequisite to completing the transaction. That is, if
9700 : : * "name" in 'row' changed (or if 'row' was deleted) between the
9701 : : * time that the IDL originally read its contents and the time that the
9702 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9703 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9704 : : * change has already been received).
9705 : : *
9706 : : * The intention is that, to ensure that no transaction commits based on dirty
9707 : : * reads, an application should call this function any time "name" is
9708 : : * read as part of a read-modify-write operation.
9709 : : *
9710 : : * In some cases this function reduces to a no-op, because the current value
9711 : : * of "name" is already known:
9712 : : *
9713 : : * - If 'row' is a row created by the current transaction (returned by
9714 : : * nbrec_logical_switch_port_insert()).
9715 : : *
9716 : : * - If "name" has already been modified (with
9717 : : * nbrec_logical_switch_port_set_name()) within the current transaction.
9718 : : *
9719 : : * Because of the latter property, always call this function *before*
9720 : : * nbrec_logical_switch_port_set_name() for a given read-modify-write.
9721 : : *
9722 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9723 : : void
9724 : 0 : nbrec_logical_switch_port_verify_name(const struct nbrec_logical_switch_port *row)
9725 : : {
9726 [ # # ]: 0 : ovs_assert(inited);
9727 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_NAME]);
9728 : 0 : }
9729 : :
9730 : : /* Causes the original contents of column "options" in 'row' to be
9731 : : * verified as a prerequisite to completing the transaction. That is, if
9732 : : * "options" in 'row' changed (or if 'row' was deleted) between the
9733 : : * time that the IDL originally read its contents and the time that the
9734 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9735 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9736 : : * change has already been received).
9737 : : *
9738 : : * The intention is that, to ensure that no transaction commits based on dirty
9739 : : * reads, an application should call this function any time "options" is
9740 : : * read as part of a read-modify-write operation.
9741 : : *
9742 : : * In some cases this function reduces to a no-op, because the current value
9743 : : * of "options" is already known:
9744 : : *
9745 : : * - If 'row' is a row created by the current transaction (returned by
9746 : : * nbrec_logical_switch_port_insert()).
9747 : : *
9748 : : * - If "options" has already been modified (with
9749 : : * nbrec_logical_switch_port_set_options()) within the current transaction.
9750 : : *
9751 : : * Because of the latter property, always call this function *before*
9752 : : * nbrec_logical_switch_port_set_options() for a given read-modify-write.
9753 : : *
9754 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9755 : : void
9756 : 0 : nbrec_logical_switch_port_verify_options(const struct nbrec_logical_switch_port *row)
9757 : : {
9758 [ # # ]: 0 : ovs_assert(inited);
9759 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_OPTIONS]);
9760 : 0 : }
9761 : :
9762 : : /* Causes the original contents of column "parent_name" in 'row' to be
9763 : : * verified as a prerequisite to completing the transaction. That is, if
9764 : : * "parent_name" in 'row' changed (or if 'row' was deleted) between the
9765 : : * time that the IDL originally read its contents and the time that the
9766 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9767 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9768 : : * change has already been received).
9769 : : *
9770 : : * The intention is that, to ensure that no transaction commits based on dirty
9771 : : * reads, an application should call this function any time "parent_name" is
9772 : : * read as part of a read-modify-write operation.
9773 : : *
9774 : : * In some cases this function reduces to a no-op, because the current value
9775 : : * of "parent_name" is already known:
9776 : : *
9777 : : * - If 'row' is a row created by the current transaction (returned by
9778 : : * nbrec_logical_switch_port_insert()).
9779 : : *
9780 : : * - If "parent_name" has already been modified (with
9781 : : * nbrec_logical_switch_port_set_parent_name()) within the current transaction.
9782 : : *
9783 : : * Because of the latter property, always call this function *before*
9784 : : * nbrec_logical_switch_port_set_parent_name() for a given read-modify-write.
9785 : : *
9786 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9787 : : void
9788 : 0 : nbrec_logical_switch_port_verify_parent_name(const struct nbrec_logical_switch_port *row)
9789 : : {
9790 [ # # ]: 0 : ovs_assert(inited);
9791 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PARENT_NAME]);
9792 : 0 : }
9793 : :
9794 : : /* Causes the original contents of column "port_security" in 'row' to be
9795 : : * verified as a prerequisite to completing the transaction. That is, if
9796 : : * "port_security" in 'row' changed (or if 'row' was deleted) between the
9797 : : * time that the IDL originally read its contents and the time that the
9798 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9799 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9800 : : * change has already been received).
9801 : : *
9802 : : * The intention is that, to ensure that no transaction commits based on dirty
9803 : : * reads, an application should call this function any time "port_security" is
9804 : : * read as part of a read-modify-write operation.
9805 : : *
9806 : : * In some cases this function reduces to a no-op, because the current value
9807 : : * of "port_security" is already known:
9808 : : *
9809 : : * - If 'row' is a row created by the current transaction (returned by
9810 : : * nbrec_logical_switch_port_insert()).
9811 : : *
9812 : : * - If "port_security" has already been modified (with
9813 : : * nbrec_logical_switch_port_set_port_security()) within the current transaction.
9814 : : *
9815 : : * Because of the latter property, always call this function *before*
9816 : : * nbrec_logical_switch_port_set_port_security() for a given read-modify-write.
9817 : : *
9818 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9819 : : void
9820 : 0 : nbrec_logical_switch_port_verify_port_security(const struct nbrec_logical_switch_port *row)
9821 : : {
9822 [ # # ]: 0 : ovs_assert(inited);
9823 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PORT_SECURITY]);
9824 : 0 : }
9825 : :
9826 : : /* Causes the original contents of column "tag" in 'row' to be
9827 : : * verified as a prerequisite to completing the transaction. That is, if
9828 : : * "tag" in 'row' changed (or if 'row' was deleted) between the
9829 : : * time that the IDL originally read its contents and the time that the
9830 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9831 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9832 : : * change has already been received).
9833 : : *
9834 : : * The intention is that, to ensure that no transaction commits based on dirty
9835 : : * reads, an application should call this function any time "tag" is
9836 : : * read as part of a read-modify-write operation.
9837 : : *
9838 : : * In some cases this function reduces to a no-op, because the current value
9839 : : * of "tag" is already known:
9840 : : *
9841 : : * - If 'row' is a row created by the current transaction (returned by
9842 : : * nbrec_logical_switch_port_insert()).
9843 : : *
9844 : : * - If "tag" has already been modified (with
9845 : : * nbrec_logical_switch_port_set_tag()) within the current transaction.
9846 : : *
9847 : : * Because of the latter property, always call this function *before*
9848 : : * nbrec_logical_switch_port_set_tag() for a given read-modify-write.
9849 : : *
9850 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9851 : : void
9852 : 0 : nbrec_logical_switch_port_verify_tag(const struct nbrec_logical_switch_port *row)
9853 : : {
9854 [ # # ]: 0 : ovs_assert(inited);
9855 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG]);
9856 : 0 : }
9857 : :
9858 : : /* Causes the original contents of column "tag_request" in 'row' to be
9859 : : * verified as a prerequisite to completing the transaction. That is, if
9860 : : * "tag_request" in 'row' changed (or if 'row' was deleted) between the
9861 : : * time that the IDL originally read its contents and the time that the
9862 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9863 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9864 : : * change has already been received).
9865 : : *
9866 : : * The intention is that, to ensure that no transaction commits based on dirty
9867 : : * reads, an application should call this function any time "tag_request" is
9868 : : * read as part of a read-modify-write operation.
9869 : : *
9870 : : * In some cases this function reduces to a no-op, because the current value
9871 : : * of "tag_request" is already known:
9872 : : *
9873 : : * - If 'row' is a row created by the current transaction (returned by
9874 : : * nbrec_logical_switch_port_insert()).
9875 : : *
9876 : : * - If "tag_request" has already been modified (with
9877 : : * nbrec_logical_switch_port_set_tag_request()) within the current transaction.
9878 : : *
9879 : : * Because of the latter property, always call this function *before*
9880 : : * nbrec_logical_switch_port_set_tag_request() for a given read-modify-write.
9881 : : *
9882 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9883 : : void
9884 : 0 : nbrec_logical_switch_port_verify_tag_request(const struct nbrec_logical_switch_port *row)
9885 : : {
9886 [ # # ]: 0 : ovs_assert(inited);
9887 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG_REQUEST]);
9888 : 0 : }
9889 : :
9890 : : /* Causes the original contents of column "type" in 'row' to be
9891 : : * verified as a prerequisite to completing the transaction. That is, if
9892 : : * "type" in 'row' changed (or if 'row' was deleted) between the
9893 : : * time that the IDL originally read its contents and the time that the
9894 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9895 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9896 : : * change has already been received).
9897 : : *
9898 : : * The intention is that, to ensure that no transaction commits based on dirty
9899 : : * reads, an application should call this function any time "type" is
9900 : : * read as part of a read-modify-write operation.
9901 : : *
9902 : : * In some cases this function reduces to a no-op, because the current value
9903 : : * of "type" is already known:
9904 : : *
9905 : : * - If 'row' is a row created by the current transaction (returned by
9906 : : * nbrec_logical_switch_port_insert()).
9907 : : *
9908 : : * - If "type" has already been modified (with
9909 : : * nbrec_logical_switch_port_set_type()) within the current transaction.
9910 : : *
9911 : : * Because of the latter property, always call this function *before*
9912 : : * nbrec_logical_switch_port_set_type() for a given read-modify-write.
9913 : : *
9914 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9915 : : void
9916 : 0 : nbrec_logical_switch_port_verify_type(const struct nbrec_logical_switch_port *row)
9917 : : {
9918 [ # # ]: 0 : ovs_assert(inited);
9919 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TYPE]);
9920 : 0 : }
9921 : :
9922 : : /* Causes the original contents of column "up" in 'row' to be
9923 : : * verified as a prerequisite to completing the transaction. That is, if
9924 : : * "up" in 'row' changed (or if 'row' was deleted) between the
9925 : : * time that the IDL originally read its contents and the time that the
9926 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9927 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9928 : : * change has already been received).
9929 : : *
9930 : : * The intention is that, to ensure that no transaction commits based on dirty
9931 : : * reads, an application should call this function any time "up" is
9932 : : * read as part of a read-modify-write operation.
9933 : : *
9934 : : * In some cases this function reduces to a no-op, because the current value
9935 : : * of "up" is already known:
9936 : : *
9937 : : * - If 'row' is a row created by the current transaction (returned by
9938 : : * nbrec_logical_switch_port_insert()).
9939 : : *
9940 : : * - If "up" has already been modified (with
9941 : : * nbrec_logical_switch_port_set_up()) within the current transaction.
9942 : : *
9943 : : * Because of the latter property, always call this function *before*
9944 : : * nbrec_logical_switch_port_set_up() for a given read-modify-write.
9945 : : *
9946 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9947 : : void
9948 : 0 : nbrec_logical_switch_port_verify_up(const struct nbrec_logical_switch_port *row)
9949 : : {
9950 [ # # ]: 0 : ovs_assert(inited);
9951 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_UP]);
9952 : 0 : }
9953 : :
9954 : : /* Returns the "addresses" column's value from the "Logical_Switch_Port" table in 'row'
9955 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
9956 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
9957 : : * for a given key than implementing the same operation on the "cooked"
9958 : : * form in 'row'.
9959 : : *
9960 : : * 'key_type' must be OVSDB_TYPE_STRING.
9961 : : * (This helps to avoid silent bugs if someone changes addresses's
9962 : : * type without updating the caller.)
9963 : : *
9964 : : * The caller must not modify or free the returned value.
9965 : : *
9966 : : * Various kinds of changes can invalidate the returned value: modifying
9967 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9968 : : * If the returned value is needed for a long time, it is best to make a copy
9969 : : * of it with ovsdb_datum_clone().
9970 : : *
9971 : : * This function is rarely useful, since it is easier to access the value
9972 : : * directly through the "addresses" member in nbrec_logical_switch_port. */
9973 : : const struct ovsdb_datum *
9974 : 0 : nbrec_logical_switch_port_get_addresses(const struct nbrec_logical_switch_port *row,
9975 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
9976 : : {
9977 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
9978 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_addresses);
9979 : : }
9980 : :
9981 : : /* Returns the "dhcpv4_options" column's value from the "Logical_Switch_Port" table in 'row'
9982 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
9983 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
9984 : : * for a given key than implementing the same operation on the "cooked"
9985 : : * form in 'row'.
9986 : : *
9987 : : * 'key_type' must be OVSDB_TYPE_UUID.
9988 : : * (This helps to avoid silent bugs if someone changes dhcpv4_options's
9989 : : * type without updating the caller.)
9990 : : *
9991 : : * The caller must not modify or free the returned value.
9992 : : *
9993 : : * Various kinds of changes can invalidate the returned value: modifying
9994 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9995 : : * If the returned value is needed for a long time, it is best to make a copy
9996 : : * of it with ovsdb_datum_clone().
9997 : : *
9998 : : * This function is rarely useful, since it is easier to access the value
9999 : : * directly through the "dhcpv4_options" member in nbrec_logical_switch_port. */
10000 : : const struct ovsdb_datum *
10001 : 0 : nbrec_logical_switch_port_get_dhcpv4_options(const struct nbrec_logical_switch_port *row,
10002 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10003 : : {
10004 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
10005 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_dhcpv4_options);
10006 : : }
10007 : :
10008 : : /* Returns the "dhcpv6_options" column's value from the "Logical_Switch_Port" table in 'row'
10009 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10010 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10011 : : * for a given key than implementing the same operation on the "cooked"
10012 : : * form in 'row'.
10013 : : *
10014 : : * 'key_type' must be OVSDB_TYPE_UUID.
10015 : : * (This helps to avoid silent bugs if someone changes dhcpv6_options's
10016 : : * type without updating the caller.)
10017 : : *
10018 : : * The caller must not modify or free the returned value.
10019 : : *
10020 : : * Various kinds of changes can invalidate the returned value: modifying
10021 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10022 : : * If the returned value is needed for a long time, it is best to make a copy
10023 : : * of it with ovsdb_datum_clone().
10024 : : *
10025 : : * This function is rarely useful, since it is easier to access the value
10026 : : * directly through the "dhcpv6_options" member in nbrec_logical_switch_port. */
10027 : : const struct ovsdb_datum *
10028 : 0 : nbrec_logical_switch_port_get_dhcpv6_options(const struct nbrec_logical_switch_port *row,
10029 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10030 : : {
10031 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
10032 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_dhcpv6_options);
10033 : : }
10034 : :
10035 : : /* Returns the "dynamic_addresses" column's value from the "Logical_Switch_Port" table in 'row'
10036 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10037 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10038 : : * for a given key than implementing the same operation on the "cooked"
10039 : : * form in 'row'.
10040 : : *
10041 : : * 'key_type' must be OVSDB_TYPE_STRING.
10042 : : * (This helps to avoid silent bugs if someone changes dynamic_addresses's
10043 : : * type without updating the caller.)
10044 : : *
10045 : : * The caller must not modify or free the returned value.
10046 : : *
10047 : : * Various kinds of changes can invalidate the returned value: modifying
10048 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10049 : : * If the returned value is needed for a long time, it is best to make a copy
10050 : : * of it with ovsdb_datum_clone().
10051 : : *
10052 : : * This function is rarely useful, since it is easier to access the value
10053 : : * directly through the "dynamic_addresses" member in nbrec_logical_switch_port. */
10054 : : const struct ovsdb_datum *
10055 : 0 : nbrec_logical_switch_port_get_dynamic_addresses(const struct nbrec_logical_switch_port *row,
10056 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10057 : : {
10058 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
10059 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_dynamic_addresses);
10060 : : }
10061 : :
10062 : : /* Returns the "enabled" column's value from the "Logical_Switch_Port" table in 'row'
10063 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10064 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10065 : : * for a given key than implementing the same operation on the "cooked"
10066 : : * form in 'row'.
10067 : : *
10068 : : * 'key_type' must be OVSDB_TYPE_BOOLEAN.
10069 : : * (This helps to avoid silent bugs if someone changes enabled's
10070 : : * type without updating the caller.)
10071 : : *
10072 : : * The caller must not modify or free the returned value.
10073 : : *
10074 : : * Various kinds of changes can invalidate the returned value: modifying
10075 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10076 : : * If the returned value is needed for a long time, it is best to make a copy
10077 : : * of it with ovsdb_datum_clone().
10078 : : *
10079 : : * This function is rarely useful, since it is easier to access the value
10080 : : * directly through the "enabled" member in nbrec_logical_switch_port. */
10081 : : const struct ovsdb_datum *
10082 : 0 : nbrec_logical_switch_port_get_enabled(const struct nbrec_logical_switch_port *row,
10083 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10084 : : {
10085 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
10086 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_enabled);
10087 : : }
10088 : :
10089 : : /* Returns the "external_ids" column's value from the "Logical_Switch_Port" table in 'row'
10090 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10091 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10092 : : * for a given key than implementing the same operation on the "cooked"
10093 : : * form in 'row'.
10094 : : *
10095 : : * 'key_type' must be OVSDB_TYPE_STRING.
10096 : : * 'value_type' must be OVSDB_TYPE_STRING.
10097 : : * (This helps to avoid silent bugs if someone changes external_ids's
10098 : : * type without updating the caller.)
10099 : : *
10100 : : * The caller must not modify or free the returned value.
10101 : : *
10102 : : * Various kinds of changes can invalidate the returned value: modifying
10103 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10104 : : * If the returned value is needed for a long time, it is best to make a copy
10105 : : * of it with ovsdb_datum_clone().
10106 : : *
10107 : : * This function is rarely useful, since it is easier to access the value
10108 : : * directly through the "external_ids" member in nbrec_logical_switch_port. */
10109 : : const struct ovsdb_datum *
10110 : 0 : nbrec_logical_switch_port_get_external_ids(const struct nbrec_logical_switch_port *row,
10111 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
10112 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
10113 : : {
10114 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
10115 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
10116 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_external_ids);
10117 : : }
10118 : :
10119 : : /* Returns the "name" column's value from the "Logical_Switch_Port" table in 'row'
10120 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10121 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10122 : : * for a given key than implementing the same operation on the "cooked"
10123 : : * form in 'row'.
10124 : : *
10125 : : * 'key_type' must be OVSDB_TYPE_STRING.
10126 : : * (This helps to avoid silent bugs if someone changes name's
10127 : : * type without updating the caller.)
10128 : : *
10129 : : * The caller must not modify or free the returned value.
10130 : : *
10131 : : * Various kinds of changes can invalidate the returned value: modifying
10132 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10133 : : * If the returned value is needed for a long time, it is best to make a copy
10134 : : * of it with ovsdb_datum_clone().
10135 : : *
10136 : : * This function is rarely useful, since it is easier to access the value
10137 : : * directly through the "name" member in nbrec_logical_switch_port. */
10138 : : const struct ovsdb_datum *
10139 : 0 : nbrec_logical_switch_port_get_name(const struct nbrec_logical_switch_port *row,
10140 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10141 : : {
10142 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
10143 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_name);
10144 : : }
10145 : :
10146 : : /* Returns the "options" column's value from the "Logical_Switch_Port" table in 'row'
10147 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10148 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10149 : : * for a given key than implementing the same operation on the "cooked"
10150 : : * form in 'row'.
10151 : : *
10152 : : * 'key_type' must be OVSDB_TYPE_STRING.
10153 : : * 'value_type' must be OVSDB_TYPE_STRING.
10154 : : * (This helps to avoid silent bugs if someone changes options's
10155 : : * type without updating the caller.)
10156 : : *
10157 : : * The caller must not modify or free the returned value.
10158 : : *
10159 : : * Various kinds of changes can invalidate the returned value: modifying
10160 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10161 : : * If the returned value is needed for a long time, it is best to make a copy
10162 : : * of it with ovsdb_datum_clone().
10163 : : *
10164 : : * This function is rarely useful, since it is easier to access the value
10165 : : * directly through the "options" member in nbrec_logical_switch_port. */
10166 : : const struct ovsdb_datum *
10167 : 0 : nbrec_logical_switch_port_get_options(const struct nbrec_logical_switch_port *row,
10168 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
10169 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
10170 : : {
10171 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
10172 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
10173 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_options);
10174 : : }
10175 : :
10176 : : /* Returns the "parent_name" column's value from the "Logical_Switch_Port" table in 'row'
10177 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10178 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10179 : : * for a given key than implementing the same operation on the "cooked"
10180 : : * form in 'row'.
10181 : : *
10182 : : * 'key_type' must be OVSDB_TYPE_STRING.
10183 : : * (This helps to avoid silent bugs if someone changes parent_name's
10184 : : * type without updating the caller.)
10185 : : *
10186 : : * The caller must not modify or free the returned value.
10187 : : *
10188 : : * Various kinds of changes can invalidate the returned value: modifying
10189 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10190 : : * If the returned value is needed for a long time, it is best to make a copy
10191 : : * of it with ovsdb_datum_clone().
10192 : : *
10193 : : * This function is rarely useful, since it is easier to access the value
10194 : : * directly through the "parent_name" member in nbrec_logical_switch_port. */
10195 : : const struct ovsdb_datum *
10196 : 0 : nbrec_logical_switch_port_get_parent_name(const struct nbrec_logical_switch_port *row,
10197 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10198 : : {
10199 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
10200 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_parent_name);
10201 : : }
10202 : :
10203 : : /* Returns the "port_security" column's value from the "Logical_Switch_Port" table in 'row'
10204 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10205 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10206 : : * for a given key than implementing the same operation on the "cooked"
10207 : : * form in 'row'.
10208 : : *
10209 : : * 'key_type' must be OVSDB_TYPE_STRING.
10210 : : * (This helps to avoid silent bugs if someone changes port_security's
10211 : : * type without updating the caller.)
10212 : : *
10213 : : * The caller must not modify or free the returned value.
10214 : : *
10215 : : * Various kinds of changes can invalidate the returned value: modifying
10216 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10217 : : * If the returned value is needed for a long time, it is best to make a copy
10218 : : * of it with ovsdb_datum_clone().
10219 : : *
10220 : : * This function is rarely useful, since it is easier to access the value
10221 : : * directly through the "port_security" member in nbrec_logical_switch_port. */
10222 : : const struct ovsdb_datum *
10223 : 0 : nbrec_logical_switch_port_get_port_security(const struct nbrec_logical_switch_port *row,
10224 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10225 : : {
10226 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
10227 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_port_security);
10228 : : }
10229 : :
10230 : : /* Returns the "tag" column's value from the "Logical_Switch_Port" table in 'row'
10231 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10232 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10233 : : * for a given key than implementing the same operation on the "cooked"
10234 : : * form in 'row'.
10235 : : *
10236 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
10237 : : * (This helps to avoid silent bugs if someone changes tag's
10238 : : * type without updating the caller.)
10239 : : *
10240 : : * The caller must not modify or free the returned value.
10241 : : *
10242 : : * Various kinds of changes can invalidate the returned value: modifying
10243 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10244 : : * If the returned value is needed for a long time, it is best to make a copy
10245 : : * of it with ovsdb_datum_clone().
10246 : : *
10247 : : * This function is rarely useful, since it is easier to access the value
10248 : : * directly through the "tag" member in nbrec_logical_switch_port. */
10249 : : const struct ovsdb_datum *
10250 : 0 : nbrec_logical_switch_port_get_tag(const struct nbrec_logical_switch_port *row,
10251 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10252 : : {
10253 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
10254 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_tag);
10255 : : }
10256 : :
10257 : : /* Returns the "tag_request" column's value from the "Logical_Switch_Port" table in 'row'
10258 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10259 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10260 : : * for a given key than implementing the same operation on the "cooked"
10261 : : * form in 'row'.
10262 : : *
10263 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
10264 : : * (This helps to avoid silent bugs if someone changes tag_request's
10265 : : * type without updating the caller.)
10266 : : *
10267 : : * The caller must not modify or free the returned value.
10268 : : *
10269 : : * Various kinds of changes can invalidate the returned value: modifying
10270 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10271 : : * If the returned value is needed for a long time, it is best to make a copy
10272 : : * of it with ovsdb_datum_clone().
10273 : : *
10274 : : * This function is rarely useful, since it is easier to access the value
10275 : : * directly through the "tag_request" member in nbrec_logical_switch_port. */
10276 : : const struct ovsdb_datum *
10277 : 0 : nbrec_logical_switch_port_get_tag_request(const struct nbrec_logical_switch_port *row,
10278 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10279 : : {
10280 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
10281 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_tag_request);
10282 : : }
10283 : :
10284 : : /* Returns the "type" column's value from the "Logical_Switch_Port" table in 'row'
10285 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10286 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10287 : : * for a given key than implementing the same operation on the "cooked"
10288 : : * form in 'row'.
10289 : : *
10290 : : * 'key_type' must be OVSDB_TYPE_STRING.
10291 : : * (This helps to avoid silent bugs if someone changes type's
10292 : : * type without updating the caller.)
10293 : : *
10294 : : * The caller must not modify or free the returned value.
10295 : : *
10296 : : * Various kinds of changes can invalidate the returned value: modifying
10297 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10298 : : * If the returned value is needed for a long time, it is best to make a copy
10299 : : * of it with ovsdb_datum_clone().
10300 : : *
10301 : : * This function is rarely useful, since it is easier to access the value
10302 : : * directly through the "type" member in nbrec_logical_switch_port. */
10303 : : const struct ovsdb_datum *
10304 : 0 : nbrec_logical_switch_port_get_type(const struct nbrec_logical_switch_port *row,
10305 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10306 : : {
10307 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
10308 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_type);
10309 : : }
10310 : :
10311 : : /* Returns the "up" column's value from the "Logical_Switch_Port" table in 'row'
10312 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
10313 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
10314 : : * for a given key than implementing the same operation on the "cooked"
10315 : : * form in 'row'.
10316 : : *
10317 : : * 'key_type' must be OVSDB_TYPE_BOOLEAN.
10318 : : * (This helps to avoid silent bugs if someone changes up's
10319 : : * type without updating the caller.)
10320 : : *
10321 : : * The caller must not modify or free the returned value.
10322 : : *
10323 : : * Various kinds of changes can invalidate the returned value: modifying
10324 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10325 : : * If the returned value is needed for a long time, it is best to make a copy
10326 : : * of it with ovsdb_datum_clone().
10327 : : *
10328 : : * This function is rarely useful, since it is easier to access the value
10329 : : * directly through the "up" member in nbrec_logical_switch_port. */
10330 : : const struct ovsdb_datum *
10331 : 0 : nbrec_logical_switch_port_get_up(const struct nbrec_logical_switch_port *row,
10332 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
10333 : : {
10334 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
10335 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_logical_switch_port_col_up);
10336 : : }
10337 : :
10338 : : /* Sets the "addresses" column from the "Logical_Switch_Port" table in 'row' to
10339 : : * the 'addresses' set with 'n_addresses' entries.
10340 : : *
10341 : : * The caller retains ownership of the arguments. */
10342 : : void
10343 : 169 : nbrec_logical_switch_port_set_addresses(const struct nbrec_logical_switch_port *row, const char **addresses, size_t n_addresses)
10344 : : {
10345 : : struct ovsdb_datum datum;
10346 : : size_t i;
10347 : :
10348 [ - + ]: 169 : ovs_assert(inited);
10349 : 169 : datum.n = n_addresses;
10350 [ + + ]: 169 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
10351 : 169 : datum.values = NULL;
10352 [ + + ]: 352 : for (i = 0; i < n_addresses; i++) {
10353 : 183 : datum.keys[i].string = xstrdup(addresses[i]);
10354 : : }
10355 : 169 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
10356 : 169 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ADDRESSES], &datum);
10357 : 169 : }
10358 : :
10359 : : /* Sets the "dhcpv4_options" column from the "Logical_Switch_Port" table in 'row' to
10360 : : * the 'dhcpv4_options' set.
10361 : : *
10362 : : * If "dhcpv4_options" is null, the column will be the empty set,
10363 : : * otherwise it will contain the specified value.
10364 : : *
10365 : : * The caller retains ownership of the arguments. */
10366 : : void
10367 : 0 : nbrec_logical_switch_port_set_dhcpv4_options(const struct nbrec_logical_switch_port *row, const struct nbrec_dhcp_options *dhcpv4_options)
10368 : : {
10369 : : struct ovsdb_datum datum;
10370 : : union ovsdb_atom key;
10371 : :
10372 [ # # ]: 0 : ovs_assert(inited);
10373 [ # # ]: 0 : if (dhcpv4_options) {
10374 : 0 : datum.n = 1;
10375 : 0 : datum.keys = &key;
10376 : 0 : key.uuid = dhcpv4_options->header_.uuid;
10377 : : } else {
10378 : 0 : datum.n = 0;
10379 : 0 : datum.keys = NULL;
10380 : : }
10381 : 0 : datum.values = NULL;
10382 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV4_OPTIONS], &datum);
10383 : 0 : }
10384 : :
10385 : : /* Sets the "dhcpv6_options" column from the "Logical_Switch_Port" table in 'row' to
10386 : : * the 'dhcpv6_options' set.
10387 : : *
10388 : : * If "dhcpv6_options" is null, the column will be the empty set,
10389 : : * otherwise it will contain the specified value.
10390 : : *
10391 : : * The caller retains ownership of the arguments. */
10392 : : void
10393 : 0 : nbrec_logical_switch_port_set_dhcpv6_options(const struct nbrec_logical_switch_port *row, const struct nbrec_dhcp_options *dhcpv6_options)
10394 : : {
10395 : : struct ovsdb_datum datum;
10396 : : union ovsdb_atom key;
10397 : :
10398 [ # # ]: 0 : ovs_assert(inited);
10399 [ # # ]: 0 : if (dhcpv6_options) {
10400 : 0 : datum.n = 1;
10401 : 0 : datum.keys = &key;
10402 : 0 : key.uuid = dhcpv6_options->header_.uuid;
10403 : : } else {
10404 : 0 : datum.n = 0;
10405 : 0 : datum.keys = NULL;
10406 : : }
10407 : 0 : datum.values = NULL;
10408 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV6_OPTIONS], &datum);
10409 : 0 : }
10410 : :
10411 : : /* Sets the "dynamic_addresses" column from the "Logical_Switch_Port" table in 'row' to
10412 : : * the 'dynamic_addresses' set.
10413 : : *
10414 : : * If "dynamic_addresses" is null, the column will be the empty set,
10415 : : * otherwise it will contain the specified value.
10416 : : *
10417 : : * The caller retains ownership of the arguments. */
10418 : : void
10419 : 29 : nbrec_logical_switch_port_set_dynamic_addresses(const struct nbrec_logical_switch_port *row, const char *dynamic_addresses)
10420 : : {
10421 : : struct ovsdb_datum datum;
10422 : : union ovsdb_atom key;
10423 : :
10424 [ - + ]: 29 : ovs_assert(inited);
10425 [ + - ]: 29 : if (dynamic_addresses) {
10426 : 29 : datum.n = 1;
10427 : 29 : datum.keys = &key;
10428 : 29 : key.string = CONST_CAST(char *, dynamic_addresses);
10429 : : } else {
10430 : 0 : datum.n = 0;
10431 : 0 : datum.keys = NULL;
10432 : : }
10433 : 29 : datum.values = NULL;
10434 : 29 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DYNAMIC_ADDRESSES], &datum);
10435 : 29 : }
10436 : :
10437 : : /* Sets the "enabled" column from the "Logical_Switch_Port" table in 'row' to
10438 : : * the 'enabled' set with 'n_enabled' entries.
10439 : : *
10440 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
10441 : : * may be NULL.
10442 : : *
10443 : : * The caller retains ownership of the arguments. */
10444 : : void
10445 : 0 : nbrec_logical_switch_port_set_enabled(const struct nbrec_logical_switch_port *row, const bool *enabled, size_t n_enabled)
10446 : : {
10447 : : struct ovsdb_datum datum;
10448 : : union ovsdb_atom key;
10449 : :
10450 [ # # ]: 0 : ovs_assert(inited);
10451 [ # # ]: 0 : if (n_enabled) {
10452 : 0 : datum.n = 1;
10453 : 0 : datum.keys = &key;
10454 : 0 : key.boolean = *enabled;
10455 : : } else {
10456 : 0 : datum.n = 0;
10457 : 0 : datum.keys = NULL;
10458 : : }
10459 : 0 : datum.values = NULL;
10460 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ENABLED], &datum);
10461 : 0 : }
10462 : :
10463 : : /* Sets the "external_ids" column's value from the "Logical_Switch_Port" table in 'row'
10464 : : * to 'external_ids'.
10465 : : *
10466 : : * The caller retains ownership of 'external_ids' and everything in it. */
10467 : : void
10468 : 0 : nbrec_logical_switch_port_set_external_ids(const struct nbrec_logical_switch_port *row, const struct smap *external_ids)
10469 : : {
10470 : : struct ovsdb_datum datum;
10471 : :
10472 [ # # ]: 0 : ovs_assert(inited);
10473 [ # # ]: 0 : if (external_ids) {
10474 : : struct smap_node *node;
10475 : : size_t i;
10476 : :
10477 : 0 : datum.n = smap_count(external_ids);
10478 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10479 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
10480 : :
10481 : 0 : i = 0;
10482 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
10483 : 0 : datum.keys[i].string = xstrdup(node->key);
10484 : 0 : datum.values[i].string = xstrdup(node->value);
10485 : 0 : i++;
10486 : : }
10487 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10488 : : } else {
10489 : 0 : ovsdb_datum_init_empty(&datum);
10490 : : }
10491 : 0 : ovsdb_idl_txn_write(&row->header_,
10492 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_EXTERNAL_IDS],
10493 : : &datum);
10494 : 0 : }
10495 : :
10496 : :
10497 : : /* Sets the "name" column from the "Logical_Switch_Port" table in 'row' to
10498 : : * 'name'.
10499 : : *
10500 : : * The caller retains ownership of the arguments. */
10501 : : void
10502 : 244 : nbrec_logical_switch_port_set_name(const struct nbrec_logical_switch_port *row, const char *name)
10503 : : {
10504 : : struct ovsdb_datum datum;
10505 : : union ovsdb_atom key;
10506 : :
10507 [ - + ]: 244 : ovs_assert(inited);
10508 : 244 : datum.n = 1;
10509 : 244 : datum.keys = &key;
10510 : 244 : key.string = CONST_CAST(char *, name);
10511 : 244 : datum.values = NULL;
10512 : 244 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_NAME], &datum);
10513 : 244 : }
10514 : :
10515 : : /* Sets the "options" column's value from the "Logical_Switch_Port" table in 'row'
10516 : : * to 'options'.
10517 : : *
10518 : : * The caller retains ownership of 'options' and everything in it. */
10519 : : void
10520 : 19 : nbrec_logical_switch_port_set_options(const struct nbrec_logical_switch_port *row, const struct smap *options)
10521 : : {
10522 : : struct ovsdb_datum datum;
10523 : :
10524 [ - + ]: 19 : ovs_assert(inited);
10525 [ + - ]: 19 : if (options) {
10526 : : struct smap_node *node;
10527 : : size_t i;
10528 : :
10529 : 19 : datum.n = smap_count(options);
10530 : 19 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10531 : 19 : datum.values = xmalloc(datum.n * sizeof *datum.values);
10532 : :
10533 : 19 : i = 0;
10534 [ + + ][ - + ]: 52 : SMAP_FOR_EACH (node, options) {
10535 : 33 : datum.keys[i].string = xstrdup(node->key);
10536 : 33 : datum.values[i].string = xstrdup(node->value);
10537 : 33 : i++;
10538 : : }
10539 : 19 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10540 : : } else {
10541 : 0 : ovsdb_datum_init_empty(&datum);
10542 : : }
10543 : 19 : ovsdb_idl_txn_write(&row->header_,
10544 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_OPTIONS],
10545 : : &datum);
10546 : 19 : }
10547 : :
10548 : :
10549 : : /* Sets the "parent_name" column from the "Logical_Switch_Port" table in 'row' to
10550 : : * the 'parent_name' set.
10551 : : *
10552 : : * If "parent_name" is null, the column will be the empty set,
10553 : : * otherwise it will contain the specified value.
10554 : : *
10555 : : * The caller retains ownership of the arguments. */
10556 : : void
10557 : 12 : nbrec_logical_switch_port_set_parent_name(const struct nbrec_logical_switch_port *row, const char *parent_name)
10558 : : {
10559 : : struct ovsdb_datum datum;
10560 : : union ovsdb_atom key;
10561 : :
10562 [ - + ]: 12 : ovs_assert(inited);
10563 [ + - ]: 12 : if (parent_name) {
10564 : 12 : datum.n = 1;
10565 : 12 : datum.keys = &key;
10566 : 12 : key.string = CONST_CAST(char *, parent_name);
10567 : : } else {
10568 : 0 : datum.n = 0;
10569 : 0 : datum.keys = NULL;
10570 : : }
10571 : 12 : datum.values = NULL;
10572 : 12 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PARENT_NAME], &datum);
10573 : 12 : }
10574 : :
10575 : : /* Sets the "port_security" column from the "Logical_Switch_Port" table in 'row' to
10576 : : * the 'port_security' set with 'n_port_security' entries.
10577 : : *
10578 : : * The caller retains ownership of the arguments. */
10579 : : void
10580 : 39 : nbrec_logical_switch_port_set_port_security(const struct nbrec_logical_switch_port *row, const char **port_security, size_t n_port_security)
10581 : : {
10582 : : struct ovsdb_datum datum;
10583 : : size_t i;
10584 : :
10585 [ - + ]: 39 : ovs_assert(inited);
10586 : 39 : datum.n = n_port_security;
10587 [ + + ]: 39 : datum.keys = n_port_security ? xmalloc(n_port_security * sizeof *datum.keys) : NULL;
10588 : 39 : datum.values = NULL;
10589 [ + + ]: 81 : for (i = 0; i < n_port_security; i++) {
10590 : 42 : datum.keys[i].string = xstrdup(port_security[i]);
10591 : : }
10592 : 39 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
10593 : 39 : ovsdb_idl_txn_write(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PORT_SECURITY], &datum);
10594 : 39 : }
10595 : :
10596 : : /* Sets the "tag" column from the "Logical_Switch_Port" table in 'row' to
10597 : : * the 'tag' set with 'n_tag' entries.
10598 : : *
10599 : : * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
10600 : : * may be NULL.
10601 : : *
10602 : : * Argument constraints: in range 1 to 4,095
10603 : : *
10604 : : * The caller retains ownership of the arguments. */
10605 : : void
10606 : 141 : nbrec_logical_switch_port_set_tag(const struct nbrec_logical_switch_port *row, const int64_t *tag, size_t n_tag)
10607 : : {
10608 : : struct ovsdb_datum datum;
10609 : : union ovsdb_atom key;
10610 : :
10611 [ - + ]: 141 : ovs_assert(inited);
10612 [ + - ]: 141 : if (n_tag) {
10613 : 141 : datum.n = 1;
10614 : 141 : datum.keys = &key;
10615 : 141 : key.integer = *tag;
10616 : : } else {
10617 : 0 : datum.n = 0;
10618 : 0 : datum.keys = NULL;
10619 : : }
10620 : 141 : datum.values = NULL;
10621 : 141 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG], &datum);
10622 : 141 : }
10623 : :
10624 : : /* Sets the "tag_request" column from the "Logical_Switch_Port" table in 'row' to
10625 : : * the 'tag_request' set with 'n_tag_request' entries.
10626 : : *
10627 : : * 'n_tag_request' may be 0 or 1; if it is 0, then 'tag_request'
10628 : : * may be NULL.
10629 : : *
10630 : : * Argument constraints: in range 0 to 4,095
10631 : : *
10632 : : * The caller retains ownership of the arguments. */
10633 : : void
10634 : 12 : nbrec_logical_switch_port_set_tag_request(const struct nbrec_logical_switch_port *row, const int64_t *tag_request, size_t n_tag_request)
10635 : : {
10636 : : struct ovsdb_datum datum;
10637 : : union ovsdb_atom key;
10638 : :
10639 [ - + ]: 12 : ovs_assert(inited);
10640 [ + - ]: 12 : if (n_tag_request) {
10641 : 12 : datum.n = 1;
10642 : 12 : datum.keys = &key;
10643 : 12 : key.integer = *tag_request;
10644 : : } else {
10645 : 0 : datum.n = 0;
10646 : 0 : datum.keys = NULL;
10647 : : }
10648 : 12 : datum.values = NULL;
10649 : 12 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG_REQUEST], &datum);
10650 : 12 : }
10651 : :
10652 : : /* Sets the "type" column from the "Logical_Switch_Port" table in 'row' to
10653 : : * 'type'.
10654 : : *
10655 : : * The caller retains ownership of the arguments. */
10656 : : void
10657 : 19 : nbrec_logical_switch_port_set_type(const struct nbrec_logical_switch_port *row, const char *type)
10658 : : {
10659 : : struct ovsdb_datum datum;
10660 : : union ovsdb_atom key;
10661 : :
10662 [ - + ]: 19 : ovs_assert(inited);
10663 : 19 : datum.n = 1;
10664 : 19 : datum.keys = &key;
10665 : 19 : key.string = CONST_CAST(char *, type);
10666 : 19 : datum.values = NULL;
10667 : 19 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TYPE], &datum);
10668 : 19 : }
10669 : :
10670 : : /* Sets the "up" column from the "Logical_Switch_Port" table in 'row' to
10671 : : * the 'up' set with 'n_up' entries.
10672 : : *
10673 : : * 'n_up' may be 0 or 1; if it is 0, then 'up'
10674 : : * may be NULL.
10675 : : *
10676 : : * The caller retains ownership of the arguments. */
10677 : : void
10678 : 497 : nbrec_logical_switch_port_set_up(const struct nbrec_logical_switch_port *row, const bool *up, size_t n_up)
10679 : : {
10680 : : struct ovsdb_datum datum;
10681 : : union ovsdb_atom key;
10682 : :
10683 [ - + ]: 497 : ovs_assert(inited);
10684 [ + - ]: 497 : if (n_up) {
10685 : 497 : datum.n = 1;
10686 : 497 : datum.keys = &key;
10687 : 497 : key.boolean = *up;
10688 : : } else {
10689 : 0 : datum.n = 0;
10690 : 0 : datum.keys = NULL;
10691 : : }
10692 : 497 : datum.values = NULL;
10693 : 497 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_UP], &datum);
10694 : 497 : }
10695 : :
10696 : : /* Adds the value 'new_value' to the "addresses" set column from the "Logical_Switch_Port" table
10697 : : * in 'row'.
10698 : : *
10699 : : */
10700 : : void
10701 : 0 : nbrec_logical_switch_port_update_addresses_addvalue(const struct nbrec_logical_switch_port *row, const char *new_value)
10702 : : {
10703 : : struct ovsdb_datum *datum;
10704 : :
10705 [ # # ]: 0 : ovs_assert(inited);
10706 : :
10707 : 0 : datum = xmalloc(sizeof *datum);
10708 : 0 : datum->n = 1;
10709 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10710 : 0 : datum->values = NULL;
10711 : :
10712 : 0 : datum->keys[0].string = xstrdup(new_value);
10713 : :
10714 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
10715 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ADDRESSES],
10716 : : datum);
10717 : 0 : }
10718 : :
10719 : : /* Deletes the value 'delete_value' from the "addresses" set column from the
10720 : : * "Logical_Switch_Port" table in 'row'.
10721 : : *
10722 : : */
10723 : : void
10724 : 0 : nbrec_logical_switch_port_update_addresses_delvalue(const struct nbrec_logical_switch_port *row, const char *delete_value)
10725 : : {
10726 : : struct ovsdb_datum *datum;
10727 : :
10728 [ # # ]: 0 : ovs_assert(inited);
10729 : :
10730 : 0 : datum = xmalloc(sizeof *datum);
10731 : 0 : datum->n = 1;
10732 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10733 : 0 : datum->values = NULL;
10734 : :
10735 : 0 : datum->keys[0].string = xstrdup(delete_value);
10736 : :
10737 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
10738 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ADDRESSES],
10739 : : datum);
10740 : 0 : }
10741 : :
10742 : : /* Adds the value 'new_value' to the "dhcpv4_options" set column from the "Logical_Switch_Port" table
10743 : : * in 'row'.
10744 : : *
10745 : : */
10746 : : void
10747 : 0 : nbrec_logical_switch_port_update_dhcpv4_options_addvalue(const struct nbrec_logical_switch_port *row, const struct nbrec_dhcp_options *new_value)
10748 : : {
10749 : : struct ovsdb_datum *datum;
10750 : :
10751 [ # # ]: 0 : ovs_assert(inited);
10752 : :
10753 : 0 : datum = xmalloc(sizeof *datum);
10754 : 0 : datum->n = 1;
10755 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10756 : 0 : datum->values = NULL;
10757 : :
10758 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
10759 : :
10760 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
10761 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV4_OPTIONS],
10762 : : datum);
10763 : 0 : }
10764 : :
10765 : : /* Deletes the value 'delete_value' from the "dhcpv4_options" set column from the
10766 : : * "Logical_Switch_Port" table in 'row'.
10767 : : *
10768 : : */
10769 : : void
10770 : 0 : nbrec_logical_switch_port_update_dhcpv4_options_delvalue(const struct nbrec_logical_switch_port *row, const struct nbrec_dhcp_options *delete_value)
10771 : : {
10772 : : struct ovsdb_datum *datum;
10773 : :
10774 [ # # ]: 0 : ovs_assert(inited);
10775 : :
10776 : 0 : datum = xmalloc(sizeof *datum);
10777 : 0 : datum->n = 1;
10778 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10779 : 0 : datum->values = NULL;
10780 : :
10781 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
10782 : :
10783 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
10784 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV4_OPTIONS],
10785 : : datum);
10786 : 0 : }
10787 : :
10788 : : /* Adds the value 'new_value' to the "dhcpv6_options" set column from the "Logical_Switch_Port" table
10789 : : * in 'row'.
10790 : : *
10791 : : */
10792 : : void
10793 : 0 : nbrec_logical_switch_port_update_dhcpv6_options_addvalue(const struct nbrec_logical_switch_port *row, const struct nbrec_dhcp_options *new_value)
10794 : : {
10795 : : struct ovsdb_datum *datum;
10796 : :
10797 [ # # ]: 0 : ovs_assert(inited);
10798 : :
10799 : 0 : datum = xmalloc(sizeof *datum);
10800 : 0 : datum->n = 1;
10801 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10802 : 0 : datum->values = NULL;
10803 : :
10804 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
10805 : :
10806 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
10807 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV6_OPTIONS],
10808 : : datum);
10809 : 0 : }
10810 : :
10811 : : /* Deletes the value 'delete_value' from the "dhcpv6_options" set column from the
10812 : : * "Logical_Switch_Port" table in 'row'.
10813 : : *
10814 : : */
10815 : : void
10816 : 0 : nbrec_logical_switch_port_update_dhcpv6_options_delvalue(const struct nbrec_logical_switch_port *row, const struct nbrec_dhcp_options *delete_value)
10817 : : {
10818 : : struct ovsdb_datum *datum;
10819 : :
10820 [ # # ]: 0 : ovs_assert(inited);
10821 : :
10822 : 0 : datum = xmalloc(sizeof *datum);
10823 : 0 : datum->n = 1;
10824 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10825 : 0 : datum->values = NULL;
10826 : :
10827 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
10828 : :
10829 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
10830 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV6_OPTIONS],
10831 : : datum);
10832 : 0 : }
10833 : :
10834 : : /* Adds the value 'new_value' to the "dynamic_addresses" set column from the "Logical_Switch_Port" table
10835 : : * in 'row'.
10836 : : *
10837 : : */
10838 : : void
10839 : 0 : nbrec_logical_switch_port_update_dynamic_addresses_addvalue(const struct nbrec_logical_switch_port *row, const char *new_value)
10840 : : {
10841 : : struct ovsdb_datum *datum;
10842 : :
10843 [ # # ]: 0 : ovs_assert(inited);
10844 : :
10845 : 0 : datum = xmalloc(sizeof *datum);
10846 : 0 : datum->n = 1;
10847 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10848 : 0 : datum->values = NULL;
10849 : :
10850 : 0 : datum->keys[0].string = xstrdup(new_value);
10851 : :
10852 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
10853 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DYNAMIC_ADDRESSES],
10854 : : datum);
10855 : 0 : }
10856 : :
10857 : : /* Deletes the value 'delete_value' from the "dynamic_addresses" set column from the
10858 : : * "Logical_Switch_Port" table in 'row'.
10859 : : *
10860 : : */
10861 : : void
10862 : 0 : nbrec_logical_switch_port_update_dynamic_addresses_delvalue(const struct nbrec_logical_switch_port *row, const char *delete_value)
10863 : : {
10864 : : struct ovsdb_datum *datum;
10865 : :
10866 [ # # ]: 0 : ovs_assert(inited);
10867 : :
10868 : 0 : datum = xmalloc(sizeof *datum);
10869 : 0 : datum->n = 1;
10870 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10871 : 0 : datum->values = NULL;
10872 : :
10873 : 0 : datum->keys[0].string = xstrdup(delete_value);
10874 : :
10875 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
10876 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DYNAMIC_ADDRESSES],
10877 : : datum);
10878 : 0 : }
10879 : :
10880 : : /* Adds the value 'new_value' to the "enabled" set column from the "Logical_Switch_Port" table
10881 : : * in 'row'.
10882 : : *
10883 : : */
10884 : : void
10885 : 0 : nbrec_logical_switch_port_update_enabled_addvalue(const struct nbrec_logical_switch_port *row, bool new_value)
10886 : : {
10887 : : struct ovsdb_datum *datum;
10888 : :
10889 [ # # ]: 0 : ovs_assert(inited);
10890 : :
10891 : 0 : datum = xmalloc(sizeof *datum);
10892 : 0 : datum->n = 1;
10893 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10894 : 0 : datum->values = NULL;
10895 : :
10896 : 0 : datum->keys[0].boolean = new_value;
10897 : :
10898 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
10899 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ENABLED],
10900 : : datum);
10901 : 0 : }
10902 : :
10903 : : /* Deletes the value 'delete_value' from the "enabled" set column from the
10904 : : * "Logical_Switch_Port" table in 'row'.
10905 : : *
10906 : : */
10907 : : void
10908 : 0 : nbrec_logical_switch_port_update_enabled_delvalue(const struct nbrec_logical_switch_port *row, bool delete_value)
10909 : : {
10910 : : struct ovsdb_datum *datum;
10911 : :
10912 [ # # ]: 0 : ovs_assert(inited);
10913 : :
10914 : 0 : datum = xmalloc(sizeof *datum);
10915 : 0 : datum->n = 1;
10916 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
10917 : 0 : datum->values = NULL;
10918 : :
10919 : 0 : datum->keys[0].boolean = delete_value;
10920 : :
10921 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
10922 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ENABLED],
10923 : : datum);
10924 : 0 : }
10925 : :
10926 : : /* Sets an element of the "external_ids" map column from the "Logical_Switch_Port" table in 'row'
10927 : : * to 'new_value' given the key value 'new_key'.
10928 : : *
10929 : : */
10930 : : void
10931 : 0 : nbrec_logical_switch_port_update_external_ids_setkey(const struct nbrec_logical_switch_port *row, const char *new_key, const char *new_value)
10932 : : {
10933 : : struct ovsdb_datum *datum;
10934 : :
10935 [ # # ]: 0 : ovs_assert(inited);
10936 : :
10937 : 0 : datum = xmalloc(sizeof *datum);
10938 : 0 : datum->n = 1;
10939 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10940 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
10941 : :
10942 : 0 : datum->keys[0].string = xstrdup(new_key);
10943 : 0 : datum->values[0].string = xstrdup(new_value);
10944 : :
10945 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
10946 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_EXTERNAL_IDS],
10947 : : datum);
10948 : 0 : }
10949 : :
10950 : : /* Deletes an element of the "external_ids" map column from the "Logical_Switch_Port" table in 'row'
10951 : : * given the key value 'delete_key'.
10952 : : *
10953 : : */
10954 : : void
10955 : 0 : nbrec_logical_switch_port_update_external_ids_delkey(const struct nbrec_logical_switch_port *row, const char *delete_key)
10956 : : {
10957 : : struct ovsdb_datum *datum;
10958 : :
10959 [ # # ]: 0 : ovs_assert(inited);
10960 : :
10961 : 0 : datum = xmalloc(sizeof *datum);
10962 : 0 : datum->n = 1;
10963 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10964 : 0 : datum->values = NULL;
10965 : :
10966 : 0 : datum->keys[0].string = xstrdup(delete_key);
10967 : :
10968 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
10969 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_EXTERNAL_IDS],
10970 : : datum);
10971 : 0 : }
10972 : :
10973 : : /* Sets an element of the "options" map column from the "Logical_Switch_Port" table in 'row'
10974 : : * to 'new_value' given the key value 'new_key'.
10975 : : *
10976 : : */
10977 : : void
10978 : 0 : nbrec_logical_switch_port_update_options_setkey(const struct nbrec_logical_switch_port *row, const char *new_key, const char *new_value)
10979 : : {
10980 : : struct ovsdb_datum *datum;
10981 : :
10982 [ # # ]: 0 : ovs_assert(inited);
10983 : :
10984 : 0 : datum = xmalloc(sizeof *datum);
10985 : 0 : datum->n = 1;
10986 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10987 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
10988 : :
10989 : 0 : datum->keys[0].string = xstrdup(new_key);
10990 : 0 : datum->values[0].string = xstrdup(new_value);
10991 : :
10992 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
10993 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_OPTIONS],
10994 : : datum);
10995 : 0 : }
10996 : :
10997 : : /* Deletes an element of the "options" map column from the "Logical_Switch_Port" table in 'row'
10998 : : * given the key value 'delete_key'.
10999 : : *
11000 : : */
11001 : : void
11002 : 0 : nbrec_logical_switch_port_update_options_delkey(const struct nbrec_logical_switch_port *row, const char *delete_key)
11003 : : {
11004 : : struct ovsdb_datum *datum;
11005 : :
11006 [ # # ]: 0 : ovs_assert(inited);
11007 : :
11008 : 0 : datum = xmalloc(sizeof *datum);
11009 : 0 : datum->n = 1;
11010 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11011 : 0 : datum->values = NULL;
11012 : :
11013 : 0 : datum->keys[0].string = xstrdup(delete_key);
11014 : :
11015 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
11016 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_OPTIONS],
11017 : : datum);
11018 : 0 : }
11019 : :
11020 : : /* Adds the value 'new_value' to the "parent_name" set column from the "Logical_Switch_Port" table
11021 : : * in 'row'.
11022 : : *
11023 : : */
11024 : : void
11025 : 0 : nbrec_logical_switch_port_update_parent_name_addvalue(const struct nbrec_logical_switch_port *row, const char *new_value)
11026 : : {
11027 : : struct ovsdb_datum *datum;
11028 : :
11029 [ # # ]: 0 : ovs_assert(inited);
11030 : :
11031 : 0 : datum = xmalloc(sizeof *datum);
11032 : 0 : datum->n = 1;
11033 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11034 : 0 : datum->values = NULL;
11035 : :
11036 : 0 : datum->keys[0].string = xstrdup(new_value);
11037 : :
11038 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
11039 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PARENT_NAME],
11040 : : datum);
11041 : 0 : }
11042 : :
11043 : : /* Deletes the value 'delete_value' from the "parent_name" set column from the
11044 : : * "Logical_Switch_Port" table in 'row'.
11045 : : *
11046 : : */
11047 : : void
11048 : 0 : nbrec_logical_switch_port_update_parent_name_delvalue(const struct nbrec_logical_switch_port *row, const char *delete_value)
11049 : : {
11050 : : struct ovsdb_datum *datum;
11051 : :
11052 [ # # ]: 0 : ovs_assert(inited);
11053 : :
11054 : 0 : datum = xmalloc(sizeof *datum);
11055 : 0 : datum->n = 1;
11056 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11057 : 0 : datum->values = NULL;
11058 : :
11059 : 0 : datum->keys[0].string = xstrdup(delete_value);
11060 : :
11061 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
11062 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PARENT_NAME],
11063 : : datum);
11064 : 0 : }
11065 : :
11066 : : /* Adds the value 'new_value' to the "port_security" set column from the "Logical_Switch_Port" table
11067 : : * in 'row'.
11068 : : *
11069 : : */
11070 : : void
11071 : 0 : nbrec_logical_switch_port_update_port_security_addvalue(const struct nbrec_logical_switch_port *row, const char *new_value)
11072 : : {
11073 : : struct ovsdb_datum *datum;
11074 : :
11075 [ # # ]: 0 : ovs_assert(inited);
11076 : :
11077 : 0 : datum = xmalloc(sizeof *datum);
11078 : 0 : datum->n = 1;
11079 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11080 : 0 : datum->values = NULL;
11081 : :
11082 : 0 : datum->keys[0].string = xstrdup(new_value);
11083 : :
11084 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
11085 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PORT_SECURITY],
11086 : : datum);
11087 : 0 : }
11088 : :
11089 : : /* Deletes the value 'delete_value' from the "port_security" set column from the
11090 : : * "Logical_Switch_Port" table in 'row'.
11091 : : *
11092 : : */
11093 : : void
11094 : 0 : nbrec_logical_switch_port_update_port_security_delvalue(const struct nbrec_logical_switch_port *row, const char *delete_value)
11095 : : {
11096 : : struct ovsdb_datum *datum;
11097 : :
11098 [ # # ]: 0 : ovs_assert(inited);
11099 : :
11100 : 0 : datum = xmalloc(sizeof *datum);
11101 : 0 : datum->n = 1;
11102 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11103 : 0 : datum->values = NULL;
11104 : :
11105 : 0 : datum->keys[0].string = xstrdup(delete_value);
11106 : :
11107 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
11108 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PORT_SECURITY],
11109 : : datum);
11110 : 0 : }
11111 : :
11112 : : /* Adds the value 'new_value' to the "tag" set column from the "Logical_Switch_Port" table
11113 : : * in 'row'.
11114 : : *
11115 : : */
11116 : : void
11117 : 0 : nbrec_logical_switch_port_update_tag_addvalue(const struct nbrec_logical_switch_port *row, int64_t new_value)
11118 : : {
11119 : : struct ovsdb_datum *datum;
11120 : :
11121 [ # # ]: 0 : ovs_assert(inited);
11122 : :
11123 : 0 : datum = xmalloc(sizeof *datum);
11124 : 0 : datum->n = 1;
11125 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11126 : 0 : datum->values = NULL;
11127 : :
11128 : 0 : datum->keys[0].integer = new_value;
11129 : :
11130 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
11131 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG],
11132 : : datum);
11133 : 0 : }
11134 : :
11135 : : /* Deletes the value 'delete_value' from the "tag" set column from the
11136 : : * "Logical_Switch_Port" table in 'row'.
11137 : : *
11138 : : */
11139 : : void
11140 : 0 : nbrec_logical_switch_port_update_tag_delvalue(const struct nbrec_logical_switch_port *row, int64_t delete_value)
11141 : : {
11142 : : struct ovsdb_datum *datum;
11143 : :
11144 [ # # ]: 0 : ovs_assert(inited);
11145 : :
11146 : 0 : datum = xmalloc(sizeof *datum);
11147 : 0 : datum->n = 1;
11148 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11149 : 0 : datum->values = NULL;
11150 : :
11151 : 0 : datum->keys[0].integer = delete_value;
11152 : :
11153 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
11154 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG],
11155 : : datum);
11156 : 0 : }
11157 : :
11158 : : /* Adds the value 'new_value' to the "tag_request" set column from the "Logical_Switch_Port" table
11159 : : * in 'row'.
11160 : : *
11161 : : */
11162 : : void
11163 : 0 : nbrec_logical_switch_port_update_tag_request_addvalue(const struct nbrec_logical_switch_port *row, int64_t new_value)
11164 : : {
11165 : : struct ovsdb_datum *datum;
11166 : :
11167 [ # # ]: 0 : ovs_assert(inited);
11168 : :
11169 : 0 : datum = xmalloc(sizeof *datum);
11170 : 0 : datum->n = 1;
11171 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11172 : 0 : datum->values = NULL;
11173 : :
11174 : 0 : datum->keys[0].integer = new_value;
11175 : :
11176 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
11177 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG_REQUEST],
11178 : : datum);
11179 : 0 : }
11180 : :
11181 : : /* Deletes the value 'delete_value' from the "tag_request" set column from the
11182 : : * "Logical_Switch_Port" table in 'row'.
11183 : : *
11184 : : */
11185 : : void
11186 : 0 : nbrec_logical_switch_port_update_tag_request_delvalue(const struct nbrec_logical_switch_port *row, int64_t delete_value)
11187 : : {
11188 : : struct ovsdb_datum *datum;
11189 : :
11190 [ # # ]: 0 : ovs_assert(inited);
11191 : :
11192 : 0 : datum = xmalloc(sizeof *datum);
11193 : 0 : datum->n = 1;
11194 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11195 : 0 : datum->values = NULL;
11196 : :
11197 : 0 : datum->keys[0].integer = delete_value;
11198 : :
11199 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
11200 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG_REQUEST],
11201 : : datum);
11202 : 0 : }
11203 : :
11204 : : /* Adds the value 'new_value' to the "up" set column from the "Logical_Switch_Port" table
11205 : : * in 'row'.
11206 : : *
11207 : : */
11208 : : void
11209 : 0 : nbrec_logical_switch_port_update_up_addvalue(const struct nbrec_logical_switch_port *row, bool new_value)
11210 : : {
11211 : : struct ovsdb_datum *datum;
11212 : :
11213 [ # # ]: 0 : ovs_assert(inited);
11214 : :
11215 : 0 : datum = xmalloc(sizeof *datum);
11216 : 0 : datum->n = 1;
11217 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11218 : 0 : datum->values = NULL;
11219 : :
11220 : 0 : datum->keys[0].boolean = new_value;
11221 : :
11222 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
11223 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_UP],
11224 : : datum);
11225 : 0 : }
11226 : :
11227 : : /* Deletes the value 'delete_value' from the "up" set column from the
11228 : : * "Logical_Switch_Port" table in 'row'.
11229 : : *
11230 : : */
11231 : : void
11232 : 0 : nbrec_logical_switch_port_update_up_delvalue(const struct nbrec_logical_switch_port *row, bool delete_value)
11233 : : {
11234 : : struct ovsdb_datum *datum;
11235 : :
11236 [ # # ]: 0 : ovs_assert(inited);
11237 : :
11238 : 0 : datum = xmalloc(sizeof *datum);
11239 : 0 : datum->n = 1;
11240 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
11241 : 0 : datum->values = NULL;
11242 : :
11243 : 0 : datum->keys[0].boolean = delete_value;
11244 : :
11245 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
11246 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_UP],
11247 : : datum);
11248 : 0 : }
11249 : :
11250 : : /* Sets the "addresses" column from the "Logical_Switch_Port" table in 'row' to
11251 : : * the 'addresses' set with 'n_addresses' entries.
11252 : : *
11253 : : * The caller retains ownership of the arguments. */
11254 : : void
11255 : 0 : nbrec_logical_switch_port_add_clause_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char **addresses, size_t n_addresses)
11256 : : {
11257 : : struct ovsdb_datum datum;
11258 : : size_t i;
11259 : :
11260 [ # # ]: 0 : ovs_assert(inited);
11261 : 0 : datum.n = n_addresses;
11262 [ # # ]: 0 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
11263 : 0 : datum.values = NULL;
11264 [ # # ]: 0 : for (i = 0; i < n_addresses; i++) {
11265 : 0 : datum.keys[i].string = CONST_CAST(char *, addresses[i]);
11266 : : }
11267 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
11268 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11269 : : function,
11270 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ADDRESSES],
11271 : : &datum);
11272 : 0 : free(datum.keys);
11273 : 0 : }
11274 : :
11275 : : /* Sets the "dhcpv4_options" column from the "Logical_Switch_Port" table in 'row' to
11276 : : * the 'dhcpv4_options' set.
11277 : : *
11278 : : * If "dhcpv4_options" is null, the column will be the empty set,
11279 : : * otherwise it will contain the specified value.
11280 : : *
11281 : : * The caller retains ownership of the arguments. */
11282 : : void
11283 : 0 : nbrec_logical_switch_port_add_clause_dhcpv4_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *dhcpv4_options)
11284 : : {
11285 : : struct ovsdb_datum datum;
11286 : : union ovsdb_atom key;
11287 : :
11288 [ # # ]: 0 : ovs_assert(inited);
11289 [ # # ]: 0 : if (dhcpv4_options) {
11290 : 0 : datum.n = 1;
11291 : 0 : datum.keys = &key;
11292 : 0 : key.uuid = *dhcpv4_options;
11293 : : } else {
11294 : 0 : datum.n = 0;
11295 : 0 : datum.keys = NULL;
11296 : : }
11297 : 0 : datum.values = NULL;
11298 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11299 : : function,
11300 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV4_OPTIONS],
11301 : : &datum);
11302 : 0 : }
11303 : :
11304 : : /* Sets the "dhcpv6_options" column from the "Logical_Switch_Port" table in 'row' to
11305 : : * the 'dhcpv6_options' set.
11306 : : *
11307 : : * If "dhcpv6_options" is null, the column will be the empty set,
11308 : : * otherwise it will contain the specified value.
11309 : : *
11310 : : * The caller retains ownership of the arguments. */
11311 : : void
11312 : 0 : nbrec_logical_switch_port_add_clause_dhcpv6_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *dhcpv6_options)
11313 : : {
11314 : : struct ovsdb_datum datum;
11315 : : union ovsdb_atom key;
11316 : :
11317 [ # # ]: 0 : ovs_assert(inited);
11318 [ # # ]: 0 : if (dhcpv6_options) {
11319 : 0 : datum.n = 1;
11320 : 0 : datum.keys = &key;
11321 : 0 : key.uuid = *dhcpv6_options;
11322 : : } else {
11323 : 0 : datum.n = 0;
11324 : 0 : datum.keys = NULL;
11325 : : }
11326 : 0 : datum.values = NULL;
11327 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11328 : : function,
11329 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV6_OPTIONS],
11330 : : &datum);
11331 : 0 : }
11332 : :
11333 : : /* Sets the "dynamic_addresses" column from the "Logical_Switch_Port" table in 'row' to
11334 : : * the 'dynamic_addresses' set.
11335 : : *
11336 : : * If "dynamic_addresses" is null, the column will be the empty set,
11337 : : * otherwise it will contain the specified value.
11338 : : *
11339 : : * The caller retains ownership of the arguments. */
11340 : : void
11341 : 0 : nbrec_logical_switch_port_add_clause_dynamic_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char *dynamic_addresses)
11342 : : {
11343 : : struct ovsdb_datum datum;
11344 : : union ovsdb_atom key;
11345 : :
11346 [ # # ]: 0 : ovs_assert(inited);
11347 [ # # ]: 0 : if (dynamic_addresses) {
11348 : 0 : datum.n = 1;
11349 : 0 : datum.keys = &key;
11350 : 0 : key.string = CONST_CAST(char *, dynamic_addresses);
11351 : : } else {
11352 : 0 : datum.n = 0;
11353 : 0 : datum.keys = NULL;
11354 : : }
11355 : 0 : datum.values = NULL;
11356 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11357 : : function,
11358 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DYNAMIC_ADDRESSES],
11359 : : &datum);
11360 : 0 : }
11361 : :
11362 : : /* Sets the "enabled" column from the "Logical_Switch_Port" table in 'row' to
11363 : : * the 'enabled' set with 'n_enabled' entries.
11364 : : *
11365 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
11366 : : * may be NULL.
11367 : : *
11368 : : * The caller retains ownership of the arguments. */
11369 : : void
11370 : 0 : nbrec_logical_switch_port_add_clause_enabled(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *enabled, size_t n_enabled)
11371 : : {
11372 : : struct ovsdb_datum datum;
11373 : : union ovsdb_atom key;
11374 : :
11375 [ # # ]: 0 : ovs_assert(inited);
11376 [ # # ]: 0 : if (n_enabled) {
11377 : 0 : datum.n = 1;
11378 : 0 : datum.keys = &key;
11379 : 0 : key.boolean = *enabled;
11380 : : } else {
11381 : 0 : datum.n = 0;
11382 : 0 : datum.keys = NULL;
11383 : : }
11384 : 0 : datum.values = NULL;
11385 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11386 : : function,
11387 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ENABLED],
11388 : : &datum);
11389 : 0 : }
11390 : :
11391 : : /* Sets the "external_ids" column's value from the "Logical_Switch_Port" table in 'row'
11392 : : * to 'external_ids'.
11393 : : *
11394 : : * The caller retains ownership of 'external_ids' and everything in it. */
11395 : : void
11396 : 0 : nbrec_logical_switch_port_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
11397 : : {
11398 : : struct ovsdb_datum datum;
11399 : :
11400 [ # # ]: 0 : ovs_assert(inited);
11401 [ # # ]: 0 : if (external_ids) {
11402 : : struct smap_node *node;
11403 : : size_t i;
11404 : :
11405 : 0 : datum.n = smap_count(external_ids);
11406 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11407 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
11408 : :
11409 : 0 : i = 0;
11410 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
11411 : 0 : datum.keys[i].string = xstrdup(node->key);
11412 : 0 : datum.values[i].string = xstrdup(node->value);
11413 : 0 : i++;
11414 : : }
11415 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11416 : : } else {
11417 : 0 : ovsdb_datum_init_empty(&datum);
11418 : : }
11419 : :
11420 : 0 : ovsdb_idl_condition_add_clause(idl,
11421 : : &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11422 : : function,
11423 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_EXTERNAL_IDS],
11424 : : &datum);
11425 : :
11426 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_port_col_external_ids.type);
11427 : 0 : }
11428 : :
11429 : :
11430 : : /* Sets the "name" column from the "Logical_Switch_Port" table in 'row' to
11431 : : * 'name'.
11432 : : *
11433 : : * The caller retains ownership of the arguments. */
11434 : : void
11435 : 0 : nbrec_logical_switch_port_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
11436 : : {
11437 : : struct ovsdb_datum datum;
11438 : : union ovsdb_atom key;
11439 : :
11440 [ # # ]: 0 : ovs_assert(inited);
11441 : 0 : datum.n = 1;
11442 : 0 : datum.keys = &key;
11443 : 0 : key.string = CONST_CAST(char *, name);
11444 : 0 : datum.values = NULL;
11445 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11446 : : function,
11447 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_NAME],
11448 : : &datum);
11449 : 0 : }
11450 : :
11451 : : /* Sets the "options" column's value from the "Logical_Switch_Port" table in 'row'
11452 : : * to 'options'.
11453 : : *
11454 : : * The caller retains ownership of 'options' and everything in it. */
11455 : : void
11456 : 0 : nbrec_logical_switch_port_add_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
11457 : : {
11458 : : struct ovsdb_datum datum;
11459 : :
11460 [ # # ]: 0 : ovs_assert(inited);
11461 [ # # ]: 0 : if (options) {
11462 : : struct smap_node *node;
11463 : : size_t i;
11464 : :
11465 : 0 : datum.n = smap_count(options);
11466 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11467 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
11468 : :
11469 : 0 : i = 0;
11470 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
11471 : 0 : datum.keys[i].string = xstrdup(node->key);
11472 : 0 : datum.values[i].string = xstrdup(node->value);
11473 : 0 : i++;
11474 : : }
11475 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11476 : : } else {
11477 : 0 : ovsdb_datum_init_empty(&datum);
11478 : : }
11479 : :
11480 : 0 : ovsdb_idl_condition_add_clause(idl,
11481 : : &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11482 : : function,
11483 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_OPTIONS],
11484 : : &datum);
11485 : :
11486 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_port_col_options.type);
11487 : 0 : }
11488 : :
11489 : :
11490 : : /* Sets the "parent_name" column from the "Logical_Switch_Port" table in 'row' to
11491 : : * the 'parent_name' set.
11492 : : *
11493 : : * If "parent_name" is null, the column will be the empty set,
11494 : : * otherwise it will contain the specified value.
11495 : : *
11496 : : * The caller retains ownership of the arguments. */
11497 : : void
11498 : 0 : nbrec_logical_switch_port_add_clause_parent_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *parent_name)
11499 : : {
11500 : : struct ovsdb_datum datum;
11501 : : union ovsdb_atom key;
11502 : :
11503 [ # # ]: 0 : ovs_assert(inited);
11504 [ # # ]: 0 : if (parent_name) {
11505 : 0 : datum.n = 1;
11506 : 0 : datum.keys = &key;
11507 : 0 : key.string = CONST_CAST(char *, parent_name);
11508 : : } else {
11509 : 0 : datum.n = 0;
11510 : 0 : datum.keys = NULL;
11511 : : }
11512 : 0 : datum.values = NULL;
11513 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11514 : : function,
11515 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PARENT_NAME],
11516 : : &datum);
11517 : 0 : }
11518 : :
11519 : : /* Sets the "port_security" column from the "Logical_Switch_Port" table in 'row' to
11520 : : * the 'port_security' set with 'n_port_security' entries.
11521 : : *
11522 : : * The caller retains ownership of the arguments. */
11523 : : void
11524 : 0 : nbrec_logical_switch_port_add_clause_port_security(struct ovsdb_idl *idl, enum ovsdb_function function, const char **port_security, size_t n_port_security)
11525 : : {
11526 : : struct ovsdb_datum datum;
11527 : : size_t i;
11528 : :
11529 [ # # ]: 0 : ovs_assert(inited);
11530 : 0 : datum.n = n_port_security;
11531 [ # # ]: 0 : datum.keys = n_port_security ? xmalloc(n_port_security * sizeof *datum.keys) : NULL;
11532 : 0 : datum.values = NULL;
11533 [ # # ]: 0 : for (i = 0; i < n_port_security; i++) {
11534 : 0 : datum.keys[i].string = CONST_CAST(char *, port_security[i]);
11535 : : }
11536 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
11537 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11538 : : function,
11539 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PORT_SECURITY],
11540 : : &datum);
11541 : 0 : free(datum.keys);
11542 : 0 : }
11543 : :
11544 : : /* Sets the "tag" column from the "Logical_Switch_Port" table in 'row' to
11545 : : * the 'tag' set with 'n_tag' entries.
11546 : : *
11547 : : * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
11548 : : * may be NULL.
11549 : : *
11550 : : * Argument constraints: in range 1 to 4,095
11551 : : *
11552 : : * The caller retains ownership of the arguments. */
11553 : : void
11554 : 0 : nbrec_logical_switch_port_add_clause_tag(struct ovsdb_idl *idl, enum ovsdb_function function, const int64_t *tag, size_t n_tag)
11555 : : {
11556 : : struct ovsdb_datum datum;
11557 : : union ovsdb_atom key;
11558 : :
11559 [ # # ]: 0 : ovs_assert(inited);
11560 [ # # ]: 0 : if (n_tag) {
11561 : 0 : datum.n = 1;
11562 : 0 : datum.keys = &key;
11563 : 0 : key.integer = *tag;
11564 : : } else {
11565 : 0 : datum.n = 0;
11566 : 0 : datum.keys = NULL;
11567 : : }
11568 : 0 : datum.values = NULL;
11569 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11570 : : function,
11571 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG],
11572 : : &datum);
11573 : 0 : }
11574 : :
11575 : : /* Sets the "tag_request" column from the "Logical_Switch_Port" table in 'row' to
11576 : : * the 'tag_request' set with 'n_tag_request' entries.
11577 : : *
11578 : : * 'n_tag_request' may be 0 or 1; if it is 0, then 'tag_request'
11579 : : * may be NULL.
11580 : : *
11581 : : * Argument constraints: in range 0 to 4,095
11582 : : *
11583 : : * The caller retains ownership of the arguments. */
11584 : : void
11585 : 0 : nbrec_logical_switch_port_add_clause_tag_request(struct ovsdb_idl *idl, enum ovsdb_function function, const int64_t *tag_request, size_t n_tag_request)
11586 : : {
11587 : : struct ovsdb_datum datum;
11588 : : union ovsdb_atom key;
11589 : :
11590 [ # # ]: 0 : ovs_assert(inited);
11591 [ # # ]: 0 : if (n_tag_request) {
11592 : 0 : datum.n = 1;
11593 : 0 : datum.keys = &key;
11594 : 0 : key.integer = *tag_request;
11595 : : } else {
11596 : 0 : datum.n = 0;
11597 : 0 : datum.keys = NULL;
11598 : : }
11599 : 0 : datum.values = NULL;
11600 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11601 : : function,
11602 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG_REQUEST],
11603 : : &datum);
11604 : 0 : }
11605 : :
11606 : : /* Sets the "type" column from the "Logical_Switch_Port" table in 'row' to
11607 : : * 'type'.
11608 : : *
11609 : : * The caller retains ownership of the arguments. */
11610 : : void
11611 : 0 : nbrec_logical_switch_port_add_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
11612 : : {
11613 : : struct ovsdb_datum datum;
11614 : : union ovsdb_atom key;
11615 : :
11616 [ # # ]: 0 : ovs_assert(inited);
11617 : 0 : datum.n = 1;
11618 : 0 : datum.keys = &key;
11619 : 0 : key.string = CONST_CAST(char *, type);
11620 : 0 : datum.values = NULL;
11621 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11622 : : function,
11623 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TYPE],
11624 : : &datum);
11625 : 0 : }
11626 : :
11627 : : /* Sets the "up" column from the "Logical_Switch_Port" table in 'row' to
11628 : : * the 'up' set with 'n_up' entries.
11629 : : *
11630 : : * 'n_up' may be 0 or 1; if it is 0, then 'up'
11631 : : * may be NULL.
11632 : : *
11633 : : * The caller retains ownership of the arguments. */
11634 : : void
11635 : 0 : nbrec_logical_switch_port_add_clause_up(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *up, size_t n_up)
11636 : : {
11637 : : struct ovsdb_datum datum;
11638 : : union ovsdb_atom key;
11639 : :
11640 [ # # ]: 0 : ovs_assert(inited);
11641 [ # # ]: 0 : if (n_up) {
11642 : 0 : datum.n = 1;
11643 : 0 : datum.keys = &key;
11644 : 0 : key.boolean = *up;
11645 : : } else {
11646 : 0 : datum.n = 0;
11647 : 0 : datum.keys = NULL;
11648 : : }
11649 : 0 : datum.values = NULL;
11650 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11651 : : function,
11652 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_UP],
11653 : : &datum);
11654 : 0 : }
11655 : : void
11656 : 0 : nbrec_logical_switch_port_add_clause_false(struct ovsdb_idl *idl)
11657 : : {
11658 : : struct ovsdb_datum datum;
11659 : :
11660 : 0 : ovsdb_datum_init_empty(&datum);
11661 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT], OVSDB_F_FALSE, NULL, &datum);
11662 : 0 : }
11663 : : void
11664 : 0 : nbrec_logical_switch_port_add_clause_true(struct ovsdb_idl *idl)
11665 : : {
11666 : : struct ovsdb_datum datum;
11667 : :
11668 : 0 : ovsdb_datum_init_empty(&datum);
11669 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT], OVSDB_F_TRUE, NULL, &datum);
11670 : 0 : }
11671 : :
11672 : : /* Sets the "addresses" column from the "Logical_Switch_Port" table in 'row' to
11673 : : * the 'addresses' set with 'n_addresses' entries.
11674 : : *
11675 : : * The caller retains ownership of the arguments. */
11676 : : void
11677 : 0 : nbrec_logical_switch_port_remove_clause_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char **addresses, size_t n_addresses)
11678 : : {
11679 : : struct ovsdb_datum datum;
11680 : : size_t i;
11681 : :
11682 [ # # ]: 0 : ovs_assert(inited);
11683 : 0 : datum.n = n_addresses;
11684 [ # # ]: 0 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
11685 : 0 : datum.values = NULL;
11686 [ # # ]: 0 : for (i = 0; i < n_addresses; i++) {
11687 : 0 : datum.keys[i].string = CONST_CAST(char *, addresses[i]);
11688 : : }
11689 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
11690 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11691 : : function,
11692 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ADDRESSES],
11693 : : &datum);
11694 : 0 : free(datum.keys);
11695 : 0 : }
11696 : :
11697 : : /* Sets the "dhcpv4_options" column from the "Logical_Switch_Port" table in 'row' to
11698 : : * the 'dhcpv4_options' set.
11699 : : *
11700 : : * If "dhcpv4_options" is null, the column will be the empty set,
11701 : : * otherwise it will contain the specified value.
11702 : : *
11703 : : * The caller retains ownership of the arguments. */
11704 : : void
11705 : 0 : nbrec_logical_switch_port_remove_clause_dhcpv4_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *dhcpv4_options)
11706 : : {
11707 : : struct ovsdb_datum datum;
11708 : : union ovsdb_atom key;
11709 : :
11710 [ # # ]: 0 : ovs_assert(inited);
11711 [ # # ]: 0 : if (dhcpv4_options) {
11712 : 0 : datum.n = 1;
11713 : 0 : datum.keys = &key;
11714 : 0 : key.uuid = *dhcpv4_options;
11715 : : } else {
11716 : 0 : datum.n = 0;
11717 : 0 : datum.keys = NULL;
11718 : : }
11719 : 0 : datum.values = NULL;
11720 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11721 : : function,
11722 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV4_OPTIONS],
11723 : : &datum);
11724 : 0 : }
11725 : :
11726 : : /* Sets the "dhcpv6_options" column from the "Logical_Switch_Port" table in 'row' to
11727 : : * the 'dhcpv6_options' set.
11728 : : *
11729 : : * If "dhcpv6_options" is null, the column will be the empty set,
11730 : : * otherwise it will contain the specified value.
11731 : : *
11732 : : * The caller retains ownership of the arguments. */
11733 : : void
11734 : 0 : nbrec_logical_switch_port_remove_clause_dhcpv6_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *dhcpv6_options)
11735 : : {
11736 : : struct ovsdb_datum datum;
11737 : : union ovsdb_atom key;
11738 : :
11739 [ # # ]: 0 : ovs_assert(inited);
11740 [ # # ]: 0 : if (dhcpv6_options) {
11741 : 0 : datum.n = 1;
11742 : 0 : datum.keys = &key;
11743 : 0 : key.uuid = *dhcpv6_options;
11744 : : } else {
11745 : 0 : datum.n = 0;
11746 : 0 : datum.keys = NULL;
11747 : : }
11748 : 0 : datum.values = NULL;
11749 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11750 : : function,
11751 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DHCPV6_OPTIONS],
11752 : : &datum);
11753 : 0 : }
11754 : :
11755 : : /* Sets the "dynamic_addresses" column from the "Logical_Switch_Port" table in 'row' to
11756 : : * the 'dynamic_addresses' set.
11757 : : *
11758 : : * If "dynamic_addresses" is null, the column will be the empty set,
11759 : : * otherwise it will contain the specified value.
11760 : : *
11761 : : * The caller retains ownership of the arguments. */
11762 : : void
11763 : 0 : nbrec_logical_switch_port_remove_clause_dynamic_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char *dynamic_addresses)
11764 : : {
11765 : : struct ovsdb_datum datum;
11766 : : union ovsdb_atom key;
11767 : :
11768 [ # # ]: 0 : ovs_assert(inited);
11769 [ # # ]: 0 : if (dynamic_addresses) {
11770 : 0 : datum.n = 1;
11771 : 0 : datum.keys = &key;
11772 : 0 : key.string = CONST_CAST(char *, dynamic_addresses);
11773 : : } else {
11774 : 0 : datum.n = 0;
11775 : 0 : datum.keys = NULL;
11776 : : }
11777 : 0 : datum.values = NULL;
11778 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11779 : : function,
11780 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_DYNAMIC_ADDRESSES],
11781 : : &datum);
11782 : 0 : }
11783 : :
11784 : : /* Sets the "enabled" column from the "Logical_Switch_Port" table in 'row' to
11785 : : * the 'enabled' set with 'n_enabled' entries.
11786 : : *
11787 : : * 'n_enabled' may be 0 or 1; if it is 0, then 'enabled'
11788 : : * may be NULL.
11789 : : *
11790 : : * The caller retains ownership of the arguments. */
11791 : : void
11792 : 0 : nbrec_logical_switch_port_remove_clause_enabled(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *enabled, size_t n_enabled)
11793 : : {
11794 : : struct ovsdb_datum datum;
11795 : : union ovsdb_atom key;
11796 : :
11797 [ # # ]: 0 : ovs_assert(inited);
11798 [ # # ]: 0 : if (n_enabled) {
11799 : 0 : datum.n = 1;
11800 : 0 : datum.keys = &key;
11801 : 0 : key.boolean = *enabled;
11802 : : } else {
11803 : 0 : datum.n = 0;
11804 : 0 : datum.keys = NULL;
11805 : : }
11806 : 0 : datum.values = NULL;
11807 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11808 : : function,
11809 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_ENABLED],
11810 : : &datum);
11811 : 0 : }
11812 : :
11813 : : /* Sets the "external_ids" column's value from the "Logical_Switch_Port" table in 'row'
11814 : : * to 'external_ids'.
11815 : : *
11816 : : * The caller retains ownership of 'external_ids' and everything in it. */
11817 : : void
11818 : 0 : nbrec_logical_switch_port_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
11819 : : {
11820 : : struct ovsdb_datum datum;
11821 : :
11822 [ # # ]: 0 : ovs_assert(inited);
11823 [ # # ]: 0 : if (external_ids) {
11824 : : struct smap_node *node;
11825 : : size_t i;
11826 : :
11827 : 0 : datum.n = smap_count(external_ids);
11828 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11829 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
11830 : :
11831 : 0 : i = 0;
11832 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
11833 : 0 : datum.keys[i].string = xstrdup(node->key);
11834 : 0 : datum.values[i].string = xstrdup(node->value);
11835 : 0 : i++;
11836 : : }
11837 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11838 : : } else {
11839 : 0 : ovsdb_datum_init_empty(&datum);
11840 : : }
11841 : :
11842 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11843 : : function,
11844 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_EXTERNAL_IDS],
11845 : : &datum);
11846 : :
11847 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_port_col_external_ids.type);
11848 : 0 : }
11849 : :
11850 : :
11851 : : /* Sets the "name" column from the "Logical_Switch_Port" table in 'row' to
11852 : : * 'name'.
11853 : : *
11854 : : * The caller retains ownership of the arguments. */
11855 : : void
11856 : 0 : nbrec_logical_switch_port_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
11857 : : {
11858 : : struct ovsdb_datum datum;
11859 : : union ovsdb_atom key;
11860 : :
11861 [ # # ]: 0 : ovs_assert(inited);
11862 : 0 : datum.n = 1;
11863 : 0 : datum.keys = &key;
11864 : 0 : key.string = CONST_CAST(char *, name);
11865 : 0 : datum.values = NULL;
11866 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11867 : : function,
11868 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_NAME],
11869 : : &datum);
11870 : 0 : }
11871 : :
11872 : : /* Sets the "options" column's value from the "Logical_Switch_Port" table in 'row'
11873 : : * to 'options'.
11874 : : *
11875 : : * The caller retains ownership of 'options' and everything in it. */
11876 : : void
11877 : 0 : nbrec_logical_switch_port_remove_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
11878 : : {
11879 : : struct ovsdb_datum datum;
11880 : :
11881 [ # # ]: 0 : ovs_assert(inited);
11882 [ # # ]: 0 : if (options) {
11883 : : struct smap_node *node;
11884 : : size_t i;
11885 : :
11886 : 0 : datum.n = smap_count(options);
11887 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11888 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
11889 : :
11890 : 0 : i = 0;
11891 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
11892 : 0 : datum.keys[i].string = xstrdup(node->key);
11893 : 0 : datum.values[i].string = xstrdup(node->value);
11894 : 0 : i++;
11895 : : }
11896 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11897 : : } else {
11898 : 0 : ovsdb_datum_init_empty(&datum);
11899 : : }
11900 : :
11901 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11902 : : function,
11903 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_OPTIONS],
11904 : : &datum);
11905 : :
11906 : 0 : ovsdb_datum_destroy(&datum, &nbrec_logical_switch_port_col_options.type);
11907 : 0 : }
11908 : :
11909 : :
11910 : : /* Sets the "parent_name" column from the "Logical_Switch_Port" table in 'row' to
11911 : : * the 'parent_name' set.
11912 : : *
11913 : : * If "parent_name" is null, the column will be the empty set,
11914 : : * otherwise it will contain the specified value.
11915 : : *
11916 : : * The caller retains ownership of the arguments. */
11917 : : void
11918 : 0 : nbrec_logical_switch_port_remove_clause_parent_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *parent_name)
11919 : : {
11920 : : struct ovsdb_datum datum;
11921 : : union ovsdb_atom key;
11922 : :
11923 [ # # ]: 0 : ovs_assert(inited);
11924 [ # # ]: 0 : if (parent_name) {
11925 : 0 : datum.n = 1;
11926 : 0 : datum.keys = &key;
11927 : 0 : key.string = CONST_CAST(char *, parent_name);
11928 : : } else {
11929 : 0 : datum.n = 0;
11930 : 0 : datum.keys = NULL;
11931 : : }
11932 : 0 : datum.values = NULL;
11933 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11934 : : function,
11935 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PARENT_NAME],
11936 : : &datum);
11937 : 0 : }
11938 : :
11939 : : /* Sets the "port_security" column from the "Logical_Switch_Port" table in 'row' to
11940 : : * the 'port_security' set with 'n_port_security' entries.
11941 : : *
11942 : : * The caller retains ownership of the arguments. */
11943 : : void
11944 : 0 : nbrec_logical_switch_port_remove_clause_port_security(struct ovsdb_idl *idl, enum ovsdb_function function, const char **port_security, size_t n_port_security)
11945 : : {
11946 : : struct ovsdb_datum datum;
11947 : : size_t i;
11948 : :
11949 [ # # ]: 0 : ovs_assert(inited);
11950 : 0 : datum.n = n_port_security;
11951 [ # # ]: 0 : datum.keys = n_port_security ? xmalloc(n_port_security * sizeof *datum.keys) : NULL;
11952 : 0 : datum.values = NULL;
11953 [ # # ]: 0 : for (i = 0; i < n_port_security; i++) {
11954 : 0 : datum.keys[i].string = CONST_CAST(char *, port_security[i]);
11955 : : }
11956 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
11957 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11958 : : function,
11959 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_PORT_SECURITY],
11960 : : &datum);
11961 : 0 : free(datum.keys);
11962 : 0 : }
11963 : :
11964 : : /* Sets the "tag" column from the "Logical_Switch_Port" table in 'row' to
11965 : : * the 'tag' set with 'n_tag' entries.
11966 : : *
11967 : : * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
11968 : : * may be NULL.
11969 : : *
11970 : : * Argument constraints: in range 1 to 4,095
11971 : : *
11972 : : * The caller retains ownership of the arguments. */
11973 : : void
11974 : 0 : nbrec_logical_switch_port_remove_clause_tag(struct ovsdb_idl *idl, enum ovsdb_function function, const int64_t *tag, size_t n_tag)
11975 : : {
11976 : : struct ovsdb_datum datum;
11977 : : union ovsdb_atom key;
11978 : :
11979 [ # # ]: 0 : ovs_assert(inited);
11980 [ # # ]: 0 : if (n_tag) {
11981 : 0 : datum.n = 1;
11982 : 0 : datum.keys = &key;
11983 : 0 : key.integer = *tag;
11984 : : } else {
11985 : 0 : datum.n = 0;
11986 : 0 : datum.keys = NULL;
11987 : : }
11988 : 0 : datum.values = NULL;
11989 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
11990 : : function,
11991 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG],
11992 : : &datum);
11993 : 0 : }
11994 : :
11995 : : /* Sets the "tag_request" column from the "Logical_Switch_Port" table in 'row' to
11996 : : * the 'tag_request' set with 'n_tag_request' entries.
11997 : : *
11998 : : * 'n_tag_request' may be 0 or 1; if it is 0, then 'tag_request'
11999 : : * may be NULL.
12000 : : *
12001 : : * Argument constraints: in range 0 to 4,095
12002 : : *
12003 : : * The caller retains ownership of the arguments. */
12004 : : void
12005 : 0 : nbrec_logical_switch_port_remove_clause_tag_request(struct ovsdb_idl *idl, enum ovsdb_function function, const int64_t *tag_request, size_t n_tag_request)
12006 : : {
12007 : : struct ovsdb_datum datum;
12008 : : union ovsdb_atom key;
12009 : :
12010 [ # # ]: 0 : ovs_assert(inited);
12011 [ # # ]: 0 : if (n_tag_request) {
12012 : 0 : datum.n = 1;
12013 : 0 : datum.keys = &key;
12014 : 0 : key.integer = *tag_request;
12015 : : } else {
12016 : 0 : datum.n = 0;
12017 : 0 : datum.keys = NULL;
12018 : : }
12019 : 0 : datum.values = NULL;
12020 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
12021 : : function,
12022 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TAG_REQUEST],
12023 : : &datum);
12024 : 0 : }
12025 : :
12026 : : /* Sets the "type" column from the "Logical_Switch_Port" table in 'row' to
12027 : : * 'type'.
12028 : : *
12029 : : * The caller retains ownership of the arguments. */
12030 : : void
12031 : 0 : nbrec_logical_switch_port_remove_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
12032 : : {
12033 : : struct ovsdb_datum datum;
12034 : : union ovsdb_atom key;
12035 : :
12036 [ # # ]: 0 : ovs_assert(inited);
12037 : 0 : datum.n = 1;
12038 : 0 : datum.keys = &key;
12039 : 0 : key.string = CONST_CAST(char *, type);
12040 : 0 : datum.values = NULL;
12041 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
12042 : : function,
12043 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_TYPE],
12044 : : &datum);
12045 : 0 : }
12046 : :
12047 : : /* Sets the "up" column from the "Logical_Switch_Port" table in 'row' to
12048 : : * the 'up' set with 'n_up' entries.
12049 : : *
12050 : : * 'n_up' may be 0 or 1; if it is 0, then 'up'
12051 : : * may be NULL.
12052 : : *
12053 : : * The caller retains ownership of the arguments. */
12054 : : void
12055 : 0 : nbrec_logical_switch_port_remove_clause_up(struct ovsdb_idl *idl, enum ovsdb_function function, const bool *up, size_t n_up)
12056 : : {
12057 : : struct ovsdb_datum datum;
12058 : : union ovsdb_atom key;
12059 : :
12060 [ # # ]: 0 : ovs_assert(inited);
12061 [ # # ]: 0 : if (n_up) {
12062 : 0 : datum.n = 1;
12063 : 0 : datum.keys = &key;
12064 : 0 : key.boolean = *up;
12065 : : } else {
12066 : 0 : datum.n = 0;
12067 : 0 : datum.keys = NULL;
12068 : : }
12069 : 0 : datum.values = NULL;
12070 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT],
12071 : : function,
12072 : : &nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_COL_UP],
12073 : : &datum);
12074 : 0 : }
12075 : : void
12076 : 0 : nbrec_logical_switch_port_remove_clause_false(struct ovsdb_idl *idl)
12077 : : {
12078 : : struct ovsdb_datum datum;
12079 : :
12080 : 0 : ovsdb_datum_init_empty(&datum);
12081 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT], OVSDB_F_FALSE, NULL, &datum);
12082 : 0 : }
12083 : : void
12084 : 0 : nbrec_logical_switch_port_remove_clause_true(struct ovsdb_idl *idl)
12085 : : {
12086 : : struct ovsdb_datum datum;
12087 : :
12088 : 0 : ovsdb_datum_init_empty(&datum);
12089 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_LOGICAL_SWITCH_PORT], OVSDB_F_TRUE, NULL, &datum);
12090 : 0 : }
12091 : :
12092 : : struct ovsdb_idl_column nbrec_logical_switch_port_columns[NBREC_LOGICAL_SWITCH_PORT_N_COLUMNS];
12093 : :
12094 : : static void
12095 : 932 : nbrec_logical_switch_port_columns_init(void)
12096 : : {
12097 : : struct ovsdb_idl_column *c;
12098 : :
12099 : : /* Initialize nbrec_logical_switch_port_col_addresses. */
12100 : 932 : c = &nbrec_logical_switch_port_col_addresses;
12101 : 932 : c->name = "addresses";
12102 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12103 : 932 : c->type.key.u.string.minLen = 0;
12104 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12105 : 932 : c->type.n_min = 0;
12106 : 932 : c->type.n_max = UINT_MAX;
12107 : 932 : c->mutable = true;
12108 : 932 : c->parse = nbrec_logical_switch_port_parse_addresses;
12109 : 932 : c->unparse = nbrec_logical_switch_port_unparse_addresses;
12110 : :
12111 : : /* Initialize nbrec_logical_switch_port_col_dhcpv4_options. */
12112 : 932 : c = &nbrec_logical_switch_port_col_dhcpv4_options;
12113 : 932 : c->name = "dhcpv4_options";
12114 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
12115 : 932 : c->type.key.u.uuid.refTableName = "DHCP_Options";
12116 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
12117 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12118 : 932 : c->type.n_min = 0;
12119 : 932 : c->type.n_max = 1;
12120 : 932 : c->mutable = true;
12121 : 932 : c->parse = nbrec_logical_switch_port_parse_dhcpv4_options;
12122 : 932 : c->unparse = nbrec_logical_switch_port_unparse_dhcpv4_options;
12123 : :
12124 : : /* Initialize nbrec_logical_switch_port_col_dhcpv6_options. */
12125 : 932 : c = &nbrec_logical_switch_port_col_dhcpv6_options;
12126 : 932 : c->name = "dhcpv6_options";
12127 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
12128 : 932 : c->type.key.u.uuid.refTableName = "DHCP_Options";
12129 : 932 : c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
12130 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12131 : 932 : c->type.n_min = 0;
12132 : 932 : c->type.n_max = 1;
12133 : 932 : c->mutable = true;
12134 : 932 : c->parse = nbrec_logical_switch_port_parse_dhcpv6_options;
12135 : 932 : c->unparse = nbrec_logical_switch_port_unparse_dhcpv6_options;
12136 : :
12137 : : /* Initialize nbrec_logical_switch_port_col_dynamic_addresses. */
12138 : 932 : c = &nbrec_logical_switch_port_col_dynamic_addresses;
12139 : 932 : c->name = "dynamic_addresses";
12140 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12141 : 932 : c->type.key.u.string.minLen = 0;
12142 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12143 : 932 : c->type.n_min = 0;
12144 : 932 : c->type.n_max = 1;
12145 : 932 : c->mutable = true;
12146 : 932 : c->parse = nbrec_logical_switch_port_parse_dynamic_addresses;
12147 : 932 : c->unparse = nbrec_logical_switch_port_unparse_dynamic_addresses;
12148 : :
12149 : : /* Initialize nbrec_logical_switch_port_col_enabled. */
12150 : 932 : c = &nbrec_logical_switch_port_col_enabled;
12151 : 932 : c->name = "enabled";
12152 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
12153 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12154 : 932 : c->type.n_min = 0;
12155 : 932 : c->type.n_max = 1;
12156 : 932 : c->mutable = true;
12157 : 932 : c->parse = nbrec_logical_switch_port_parse_enabled;
12158 : 932 : c->unparse = nbrec_logical_switch_port_unparse_enabled;
12159 : :
12160 : : /* Initialize nbrec_logical_switch_port_col_external_ids. */
12161 : 932 : c = &nbrec_logical_switch_port_col_external_ids;
12162 : 932 : c->name = "external_ids";
12163 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12164 : 932 : c->type.key.u.string.minLen = 0;
12165 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12166 : 932 : c->type.value.u.string.minLen = 0;
12167 : 932 : c->type.n_min = 0;
12168 : 932 : c->type.n_max = UINT_MAX;
12169 : 932 : c->mutable = true;
12170 : 932 : c->parse = nbrec_logical_switch_port_parse_external_ids;
12171 : 932 : c->unparse = nbrec_logical_switch_port_unparse_external_ids;
12172 : :
12173 : : /* Initialize nbrec_logical_switch_port_col_name. */
12174 : 932 : c = &nbrec_logical_switch_port_col_name;
12175 : 932 : c->name = "name";
12176 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12177 : 932 : c->type.key.u.string.minLen = 0;
12178 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12179 : 932 : c->type.n_min = 1;
12180 : 932 : c->type.n_max = 1;
12181 : 932 : c->mutable = true;
12182 : 932 : c->parse = nbrec_logical_switch_port_parse_name;
12183 : 932 : c->unparse = nbrec_logical_switch_port_unparse_name;
12184 : :
12185 : : /* Initialize nbrec_logical_switch_port_col_options. */
12186 : 932 : c = &nbrec_logical_switch_port_col_options;
12187 : 932 : c->name = "options";
12188 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12189 : 932 : c->type.key.u.string.minLen = 0;
12190 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12191 : 932 : c->type.value.u.string.minLen = 0;
12192 : 932 : c->type.n_min = 0;
12193 : 932 : c->type.n_max = UINT_MAX;
12194 : 932 : c->mutable = true;
12195 : 932 : c->parse = nbrec_logical_switch_port_parse_options;
12196 : 932 : c->unparse = nbrec_logical_switch_port_unparse_options;
12197 : :
12198 : : /* Initialize nbrec_logical_switch_port_col_parent_name. */
12199 : 932 : c = &nbrec_logical_switch_port_col_parent_name;
12200 : 932 : c->name = "parent_name";
12201 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12202 : 932 : c->type.key.u.string.minLen = 0;
12203 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12204 : 932 : c->type.n_min = 0;
12205 : 932 : c->type.n_max = 1;
12206 : 932 : c->mutable = true;
12207 : 932 : c->parse = nbrec_logical_switch_port_parse_parent_name;
12208 : 932 : c->unparse = nbrec_logical_switch_port_unparse_parent_name;
12209 : :
12210 : : /* Initialize nbrec_logical_switch_port_col_port_security. */
12211 : 932 : c = &nbrec_logical_switch_port_col_port_security;
12212 : 932 : c->name = "port_security";
12213 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12214 : 932 : c->type.key.u.string.minLen = 0;
12215 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12216 : 932 : c->type.n_min = 0;
12217 : 932 : c->type.n_max = UINT_MAX;
12218 : 932 : c->mutable = true;
12219 : 932 : c->parse = nbrec_logical_switch_port_parse_port_security;
12220 : 932 : c->unparse = nbrec_logical_switch_port_unparse_port_security;
12221 : :
12222 : : /* Initialize nbrec_logical_switch_port_col_tag. */
12223 : 932 : c = &nbrec_logical_switch_port_col_tag;
12224 : 932 : c->name = "tag";
12225 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12226 : 932 : c->type.key.u.integer.min = INT64_C(1);
12227 : 932 : c->type.key.u.integer.max = INT64_C(4095);
12228 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12229 : 932 : c->type.n_min = 0;
12230 : 932 : c->type.n_max = 1;
12231 : 932 : c->mutable = true;
12232 : 932 : c->parse = nbrec_logical_switch_port_parse_tag;
12233 : 932 : c->unparse = nbrec_logical_switch_port_unparse_tag;
12234 : :
12235 : : /* Initialize nbrec_logical_switch_port_col_tag_request. */
12236 : 932 : c = &nbrec_logical_switch_port_col_tag_request;
12237 : 932 : c->name = "tag_request";
12238 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12239 : 932 : c->type.key.u.integer.min = INT64_C(0);
12240 : 932 : c->type.key.u.integer.max = INT64_C(4095);
12241 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12242 : 932 : c->type.n_min = 0;
12243 : 932 : c->type.n_max = 1;
12244 : 932 : c->mutable = true;
12245 : 932 : c->parse = nbrec_logical_switch_port_parse_tag_request;
12246 : 932 : c->unparse = nbrec_logical_switch_port_unparse_tag_request;
12247 : :
12248 : : /* Initialize nbrec_logical_switch_port_col_type. */
12249 : 932 : c = &nbrec_logical_switch_port_col_type;
12250 : 932 : c->name = "type";
12251 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12252 : 932 : c->type.key.u.string.minLen = 0;
12253 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12254 : 932 : c->type.n_min = 1;
12255 : 932 : c->type.n_max = 1;
12256 : 932 : c->mutable = true;
12257 : 932 : c->parse = nbrec_logical_switch_port_parse_type;
12258 : 932 : c->unparse = nbrec_logical_switch_port_unparse_type;
12259 : :
12260 : : /* Initialize nbrec_logical_switch_port_col_up. */
12261 : 932 : c = &nbrec_logical_switch_port_col_up;
12262 : 932 : c->name = "up";
12263 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
12264 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12265 : 932 : c->type.n_min = 0;
12266 : 932 : c->type.n_max = 1;
12267 : 932 : c->mutable = true;
12268 : 932 : c->parse = nbrec_logical_switch_port_parse_up;
12269 : 932 : c->unparse = nbrec_logical_switch_port_unparse_up;
12270 : 932 : }
12271 : :
12272 : : /* NAT table. */
12273 : :
12274 : : static void
12275 : 12 : nbrec_nat_parse_external_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12276 : : {
12277 : 12 : struct nbrec_nat *row = nbrec_nat_cast(row_);
12278 : :
12279 [ - + ]: 12 : ovs_assert(inited);
12280 [ + - ]: 12 : if (datum->n >= 1) {
12281 : 12 : row->external_ip = datum->keys[0].string;
12282 : : } else {
12283 : 0 : row->external_ip = "";
12284 : : }
12285 : 12 : }
12286 : :
12287 : : static void
12288 : 12 : nbrec_nat_parse_logical_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12289 : : {
12290 : 12 : struct nbrec_nat *row = nbrec_nat_cast(row_);
12291 : :
12292 [ - + ]: 12 : ovs_assert(inited);
12293 [ + - ]: 12 : if (datum->n >= 1) {
12294 : 12 : row->logical_ip = datum->keys[0].string;
12295 : : } else {
12296 : 0 : row->logical_ip = "";
12297 : : }
12298 : 12 : }
12299 : :
12300 : : static void
12301 : 12 : nbrec_nat_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12302 : : {
12303 : 12 : struct nbrec_nat *row = nbrec_nat_cast(row_);
12304 : :
12305 [ - + ]: 12 : ovs_assert(inited);
12306 [ + - ]: 12 : if (datum->n >= 1) {
12307 : 12 : row->type = datum->keys[0].string;
12308 : : } else {
12309 : 0 : row->type = "";
12310 : : }
12311 : 12 : }
12312 : :
12313 : : static void
12314 : 15 : nbrec_nat_unparse_external_ip(struct ovsdb_idl_row *row OVS_UNUSED)
12315 : : {
12316 : : /* Nothing to do. */
12317 : 15 : }
12318 : :
12319 : : static void
12320 : 15 : nbrec_nat_unparse_logical_ip(struct ovsdb_idl_row *row OVS_UNUSED)
12321 : : {
12322 : : /* Nothing to do. */
12323 : 15 : }
12324 : :
12325 : : static void
12326 : 15 : nbrec_nat_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
12327 : : {
12328 : : /* Nothing to do. */
12329 : 15 : }
12330 : :
12331 : : static void
12332 : 12 : nbrec_nat_init__(struct ovsdb_idl_row *row)
12333 : : {
12334 : 12 : nbrec_nat_init(nbrec_nat_cast(row));
12335 : 12 : }
12336 : :
12337 : : /* Clears the contents of 'row' in table "NAT". */
12338 : : void
12339 : 12 : nbrec_nat_init(struct nbrec_nat *row)
12340 : : {
12341 : 12 : memset(row, 0, sizeof *row);
12342 : 12 : }
12343 : :
12344 : : /* Searches table "NAT" in 'idl' for a row with UUID 'uuid'. Returns
12345 : : * a pointer to the row if there is one, otherwise a null pointer. */
12346 : : const struct nbrec_nat *
12347 : 0 : nbrec_nat_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
12348 : : {
12349 : 0 : return nbrec_nat_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_NAT], uuid));
12350 : : }
12351 : :
12352 : : /* Returns a row in table "NAT" in 'idl', or a null pointer if that
12353 : : * table is empty.
12354 : : *
12355 : : * Database tables are internally maintained as hash tables, so adding or
12356 : : * removing rows while traversing the same table can cause some rows to be
12357 : : * visited twice or not at apply. */
12358 : : const struct nbrec_nat *
12359 : 0 : nbrec_nat_first(const struct ovsdb_idl *idl)
12360 : : {
12361 : 0 : return nbrec_nat_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_NAT]));
12362 : : }
12363 : :
12364 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
12365 : : * is the last row in its table. */
12366 : : const struct nbrec_nat *
12367 : 0 : nbrec_nat_next(const struct nbrec_nat *row)
12368 : : {
12369 : 0 : return nbrec_nat_cast(ovsdb_idl_next_row(&row->header_));
12370 : : }
12371 : :
12372 : 0 : unsigned int nbrec_nat_get_seqno(const struct ovsdb_idl *idl)
12373 : : {
12374 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_NAT]);
12375 : : }
12376 : :
12377 : 0 : unsigned int nbrec_nat_row_get_seqno(const struct nbrec_nat *row, enum ovsdb_idl_change change)
12378 : : {
12379 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
12380 : : }
12381 : :
12382 : : const struct nbrec_nat *
12383 : 0 : nbrec_nat_track_get_first(const struct ovsdb_idl *idl)
12384 : : {
12385 : 0 : return nbrec_nat_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_NAT]));
12386 : : }
12387 : :
12388 : : const struct nbrec_nat
12389 : 0 : *nbrec_nat_track_get_next(const struct nbrec_nat *row)
12390 : : {
12391 : 0 : return nbrec_nat_cast(ovsdb_idl_track_get_next(&row->header_));
12392 : : }
12393 : :
12394 : :
12395 : : /* Deletes 'row' from table "NAT". 'row' may be freed, so it must not be
12396 : : * accessed afterward.
12397 : : *
12398 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12399 : : void
12400 : 0 : nbrec_nat_delete(const struct nbrec_nat *row)
12401 : : {
12402 : 0 : ovsdb_idl_txn_delete(&row->header_);
12403 : 0 : }
12404 : :
12405 : : /* Inserts and returns a new row in the table "NAT" in the database
12406 : : * with open transaction 'txn'.
12407 : : *
12408 : : * The new row is assigned a randomly generated provisional UUID.
12409 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
12410 : : * but the IDL will replace any uses of the provisional UUID in the
12411 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
12412 : : struct nbrec_nat *
12413 : 0 : nbrec_nat_insert(struct ovsdb_idl_txn *txn)
12414 : : {
12415 : 0 : return nbrec_nat_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_NAT], NULL));
12416 : : }
12417 : :
12418 : : bool
12419 : 0 : nbrec_nat_is_updated(const struct nbrec_nat *row, enum nbrec_nat_column_id column)
12420 : : {
12421 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_nat_columns[column]);
12422 : : }
12423 : :
12424 : : /* Causes the original contents of column "external_ip" in 'row' to be
12425 : : * verified as a prerequisite to completing the transaction. That is, if
12426 : : * "external_ip" in 'row' changed (or if 'row' was deleted) between the
12427 : : * time that the IDL originally read its contents and the time that the
12428 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
12429 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
12430 : : * change has already been received).
12431 : : *
12432 : : * The intention is that, to ensure that no transaction commits based on dirty
12433 : : * reads, an application should call this function any time "external_ip" is
12434 : : * read as part of a read-modify-write operation.
12435 : : *
12436 : : * In some cases this function reduces to a no-op, because the current value
12437 : : * of "external_ip" is already known:
12438 : : *
12439 : : * - If 'row' is a row created by the current transaction (returned by
12440 : : * nbrec_nat_insert()).
12441 : : *
12442 : : * - If "external_ip" has already been modified (with
12443 : : * nbrec_nat_set_external_ip()) within the current transaction.
12444 : : *
12445 : : * Because of the latter property, always call this function *before*
12446 : : * nbrec_nat_set_external_ip() for a given read-modify-write.
12447 : : *
12448 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12449 : : void
12450 : 0 : nbrec_nat_verify_external_ip(const struct nbrec_nat *row)
12451 : : {
12452 [ # # ]: 0 : ovs_assert(inited);
12453 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_nat_columns[NBREC_NAT_COL_EXTERNAL_IP]);
12454 : 0 : }
12455 : :
12456 : : /* Causes the original contents of column "logical_ip" in 'row' to be
12457 : : * verified as a prerequisite to completing the transaction. That is, if
12458 : : * "logical_ip" in 'row' changed (or if 'row' was deleted) between the
12459 : : * time that the IDL originally read its contents and the time that the
12460 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
12461 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
12462 : : * change has already been received).
12463 : : *
12464 : : * The intention is that, to ensure that no transaction commits based on dirty
12465 : : * reads, an application should call this function any time "logical_ip" is
12466 : : * read as part of a read-modify-write operation.
12467 : : *
12468 : : * In some cases this function reduces to a no-op, because the current value
12469 : : * of "logical_ip" is already known:
12470 : : *
12471 : : * - If 'row' is a row created by the current transaction (returned by
12472 : : * nbrec_nat_insert()).
12473 : : *
12474 : : * - If "logical_ip" has already been modified (with
12475 : : * nbrec_nat_set_logical_ip()) within the current transaction.
12476 : : *
12477 : : * Because of the latter property, always call this function *before*
12478 : : * nbrec_nat_set_logical_ip() for a given read-modify-write.
12479 : : *
12480 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12481 : : void
12482 : 0 : nbrec_nat_verify_logical_ip(const struct nbrec_nat *row)
12483 : : {
12484 [ # # ]: 0 : ovs_assert(inited);
12485 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_nat_columns[NBREC_NAT_COL_LOGICAL_IP]);
12486 : 0 : }
12487 : :
12488 : : /* Causes the original contents of column "type" in 'row' to be
12489 : : * verified as a prerequisite to completing the transaction. That is, if
12490 : : * "type" in 'row' changed (or if 'row' was deleted) between the
12491 : : * time that the IDL originally read its contents and the time that the
12492 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
12493 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
12494 : : * change has already been received).
12495 : : *
12496 : : * The intention is that, to ensure that no transaction commits based on dirty
12497 : : * reads, an application should call this function any time "type" is
12498 : : * read as part of a read-modify-write operation.
12499 : : *
12500 : : * In some cases this function reduces to a no-op, because the current value
12501 : : * of "type" is already known:
12502 : : *
12503 : : * - If 'row' is a row created by the current transaction (returned by
12504 : : * nbrec_nat_insert()).
12505 : : *
12506 : : * - If "type" has already been modified (with
12507 : : * nbrec_nat_set_type()) within the current transaction.
12508 : : *
12509 : : * Because of the latter property, always call this function *before*
12510 : : * nbrec_nat_set_type() for a given read-modify-write.
12511 : : *
12512 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12513 : : void
12514 : 0 : nbrec_nat_verify_type(const struct nbrec_nat *row)
12515 : : {
12516 [ # # ]: 0 : ovs_assert(inited);
12517 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_nat_columns[NBREC_NAT_COL_TYPE]);
12518 : 0 : }
12519 : :
12520 : : /* Returns the "external_ip" column's value from the "NAT" table in 'row'
12521 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
12522 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
12523 : : * for a given key than implementing the same operation on the "cooked"
12524 : : * form in 'row'.
12525 : : *
12526 : : * 'key_type' must be OVSDB_TYPE_STRING.
12527 : : * (This helps to avoid silent bugs if someone changes external_ip's
12528 : : * type without updating the caller.)
12529 : : *
12530 : : * The caller must not modify or free the returned value.
12531 : : *
12532 : : * Various kinds of changes can invalidate the returned value: modifying
12533 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12534 : : * If the returned value is needed for a long time, it is best to make a copy
12535 : : * of it with ovsdb_datum_clone().
12536 : : *
12537 : : * This function is rarely useful, since it is easier to access the value
12538 : : * directly through the "external_ip" member in nbrec_nat. */
12539 : : const struct ovsdb_datum *
12540 : 0 : nbrec_nat_get_external_ip(const struct nbrec_nat *row,
12541 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
12542 : : {
12543 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
12544 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_nat_col_external_ip);
12545 : : }
12546 : :
12547 : : /* Returns the "logical_ip" column's value from the "NAT" table in 'row'
12548 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
12549 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
12550 : : * for a given key than implementing the same operation on the "cooked"
12551 : : * form in 'row'.
12552 : : *
12553 : : * 'key_type' must be OVSDB_TYPE_STRING.
12554 : : * (This helps to avoid silent bugs if someone changes logical_ip's
12555 : : * type without updating the caller.)
12556 : : *
12557 : : * The caller must not modify or free the returned value.
12558 : : *
12559 : : * Various kinds of changes can invalidate the returned value: modifying
12560 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12561 : : * If the returned value is needed for a long time, it is best to make a copy
12562 : : * of it with ovsdb_datum_clone().
12563 : : *
12564 : : * This function is rarely useful, since it is easier to access the value
12565 : : * directly through the "logical_ip" member in nbrec_nat. */
12566 : : const struct ovsdb_datum *
12567 : 0 : nbrec_nat_get_logical_ip(const struct nbrec_nat *row,
12568 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
12569 : : {
12570 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
12571 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_nat_col_logical_ip);
12572 : : }
12573 : :
12574 : : /* Returns the "type" column's value from the "NAT" table in 'row'
12575 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
12576 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
12577 : : * for a given key than implementing the same operation on the "cooked"
12578 : : * form in 'row'.
12579 : : *
12580 : : * 'key_type' must be OVSDB_TYPE_STRING.
12581 : : * (This helps to avoid silent bugs if someone changes type's
12582 : : * type without updating the caller.)
12583 : : *
12584 : : * The caller must not modify or free the returned value.
12585 : : *
12586 : : * Various kinds of changes can invalidate the returned value: modifying
12587 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12588 : : * If the returned value is needed for a long time, it is best to make a copy
12589 : : * of it with ovsdb_datum_clone().
12590 : : *
12591 : : * This function is rarely useful, since it is easier to access the value
12592 : : * directly through the "type" member in nbrec_nat. */
12593 : : const struct ovsdb_datum *
12594 : 0 : nbrec_nat_get_type(const struct nbrec_nat *row,
12595 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
12596 : : {
12597 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
12598 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_nat_col_type);
12599 : : }
12600 : :
12601 : : /* Sets the "external_ip" column from the "NAT" table in 'row' to
12602 : : * 'external_ip'.
12603 : : *
12604 : : * The caller retains ownership of the arguments. */
12605 : : void
12606 : 0 : nbrec_nat_set_external_ip(const struct nbrec_nat *row, const char *external_ip)
12607 : : {
12608 : : struct ovsdb_datum datum;
12609 : : union ovsdb_atom key;
12610 : :
12611 [ # # ]: 0 : ovs_assert(inited);
12612 : 0 : datum.n = 1;
12613 : 0 : datum.keys = &key;
12614 : 0 : key.string = CONST_CAST(char *, external_ip);
12615 : 0 : datum.values = NULL;
12616 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_nat_columns[NBREC_NAT_COL_EXTERNAL_IP], &datum);
12617 : 0 : }
12618 : :
12619 : : /* Sets the "logical_ip" column from the "NAT" table in 'row' to
12620 : : * 'logical_ip'.
12621 : : *
12622 : : * The caller retains ownership of the arguments. */
12623 : : void
12624 : 0 : nbrec_nat_set_logical_ip(const struct nbrec_nat *row, const char *logical_ip)
12625 : : {
12626 : : struct ovsdb_datum datum;
12627 : : union ovsdb_atom key;
12628 : :
12629 [ # # ]: 0 : ovs_assert(inited);
12630 : 0 : datum.n = 1;
12631 : 0 : datum.keys = &key;
12632 : 0 : key.string = CONST_CAST(char *, logical_ip);
12633 : 0 : datum.values = NULL;
12634 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_nat_columns[NBREC_NAT_COL_LOGICAL_IP], &datum);
12635 : 0 : }
12636 : :
12637 : : /* Sets the "type" column from the "NAT" table in 'row' to
12638 : : * 'type'.
12639 : : *
12640 : : * Argument constraints: one of "snat", "dnat", or "dnat_and_snat"
12641 : : *
12642 : : * The caller retains ownership of the arguments. */
12643 : : void
12644 : 0 : nbrec_nat_set_type(const struct nbrec_nat *row, const char *type)
12645 : : {
12646 : : struct ovsdb_datum datum;
12647 : : union ovsdb_atom key;
12648 : :
12649 [ # # ]: 0 : ovs_assert(inited);
12650 : 0 : datum.n = 1;
12651 : 0 : datum.keys = &key;
12652 : 0 : key.string = CONST_CAST(char *, type);
12653 : 0 : datum.values = NULL;
12654 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_nat_columns[NBREC_NAT_COL_TYPE], &datum);
12655 : 0 : }
12656 : :
12657 : : /* Sets the "external_ip" column from the "NAT" table in 'row' to
12658 : : * 'external_ip'.
12659 : : *
12660 : : * The caller retains ownership of the arguments. */
12661 : : void
12662 : 0 : nbrec_nat_add_clause_external_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *external_ip)
12663 : : {
12664 : : struct ovsdb_datum datum;
12665 : : union ovsdb_atom key;
12666 : :
12667 [ # # ]: 0 : ovs_assert(inited);
12668 : 0 : datum.n = 1;
12669 : 0 : datum.keys = &key;
12670 : 0 : key.string = CONST_CAST(char *, external_ip);
12671 : 0 : datum.values = NULL;
12672 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT],
12673 : : function,
12674 : : &nbrec_nat_columns[NBREC_NAT_COL_EXTERNAL_IP],
12675 : : &datum);
12676 : 0 : }
12677 : :
12678 : : /* Sets the "logical_ip" column from the "NAT" table in 'row' to
12679 : : * 'logical_ip'.
12680 : : *
12681 : : * The caller retains ownership of the arguments. */
12682 : : void
12683 : 0 : nbrec_nat_add_clause_logical_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *logical_ip)
12684 : : {
12685 : : struct ovsdb_datum datum;
12686 : : union ovsdb_atom key;
12687 : :
12688 [ # # ]: 0 : ovs_assert(inited);
12689 : 0 : datum.n = 1;
12690 : 0 : datum.keys = &key;
12691 : 0 : key.string = CONST_CAST(char *, logical_ip);
12692 : 0 : datum.values = NULL;
12693 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT],
12694 : : function,
12695 : : &nbrec_nat_columns[NBREC_NAT_COL_LOGICAL_IP],
12696 : : &datum);
12697 : 0 : }
12698 : :
12699 : : /* Sets the "type" column from the "NAT" table in 'row' to
12700 : : * 'type'.
12701 : : *
12702 : : * Argument constraints: one of "snat", "dnat", or "dnat_and_snat"
12703 : : *
12704 : : * The caller retains ownership of the arguments. */
12705 : : void
12706 : 0 : nbrec_nat_add_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
12707 : : {
12708 : : struct ovsdb_datum datum;
12709 : : union ovsdb_atom key;
12710 : :
12711 [ # # ]: 0 : ovs_assert(inited);
12712 : 0 : datum.n = 1;
12713 : 0 : datum.keys = &key;
12714 : 0 : key.string = CONST_CAST(char *, type);
12715 : 0 : datum.values = NULL;
12716 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT],
12717 : : function,
12718 : : &nbrec_nat_columns[NBREC_NAT_COL_TYPE],
12719 : : &datum);
12720 : 0 : }
12721 : : void
12722 : 0 : nbrec_nat_add_clause_false(struct ovsdb_idl *idl)
12723 : : {
12724 : : struct ovsdb_datum datum;
12725 : :
12726 : 0 : ovsdb_datum_init_empty(&datum);
12727 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT], OVSDB_F_FALSE, NULL, &datum);
12728 : 0 : }
12729 : : void
12730 : 0 : nbrec_nat_add_clause_true(struct ovsdb_idl *idl)
12731 : : {
12732 : : struct ovsdb_datum datum;
12733 : :
12734 : 0 : ovsdb_datum_init_empty(&datum);
12735 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT], OVSDB_F_TRUE, NULL, &datum);
12736 : 0 : }
12737 : :
12738 : : /* Sets the "external_ip" column from the "NAT" table in 'row' to
12739 : : * 'external_ip'.
12740 : : *
12741 : : * The caller retains ownership of the arguments. */
12742 : : void
12743 : 0 : nbrec_nat_remove_clause_external_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *external_ip)
12744 : : {
12745 : : struct ovsdb_datum datum;
12746 : : union ovsdb_atom key;
12747 : :
12748 [ # # ]: 0 : ovs_assert(inited);
12749 : 0 : datum.n = 1;
12750 : 0 : datum.keys = &key;
12751 : 0 : key.string = CONST_CAST(char *, external_ip);
12752 : 0 : datum.values = NULL;
12753 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT],
12754 : : function,
12755 : : &nbrec_nat_columns[NBREC_NAT_COL_EXTERNAL_IP],
12756 : : &datum);
12757 : 0 : }
12758 : :
12759 : : /* Sets the "logical_ip" column from the "NAT" table in 'row' to
12760 : : * 'logical_ip'.
12761 : : *
12762 : : * The caller retains ownership of the arguments. */
12763 : : void
12764 : 0 : nbrec_nat_remove_clause_logical_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *logical_ip)
12765 : : {
12766 : : struct ovsdb_datum datum;
12767 : : union ovsdb_atom key;
12768 : :
12769 [ # # ]: 0 : ovs_assert(inited);
12770 : 0 : datum.n = 1;
12771 : 0 : datum.keys = &key;
12772 : 0 : key.string = CONST_CAST(char *, logical_ip);
12773 : 0 : datum.values = NULL;
12774 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT],
12775 : : function,
12776 : : &nbrec_nat_columns[NBREC_NAT_COL_LOGICAL_IP],
12777 : : &datum);
12778 : 0 : }
12779 : :
12780 : : /* Sets the "type" column from the "NAT" table in 'row' to
12781 : : * 'type'.
12782 : : *
12783 : : * Argument constraints: one of "snat", "dnat", or "dnat_and_snat"
12784 : : *
12785 : : * The caller retains ownership of the arguments. */
12786 : : void
12787 : 0 : nbrec_nat_remove_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
12788 : : {
12789 : : struct ovsdb_datum datum;
12790 : : union ovsdb_atom key;
12791 : :
12792 [ # # ]: 0 : ovs_assert(inited);
12793 : 0 : datum.n = 1;
12794 : 0 : datum.keys = &key;
12795 : 0 : key.string = CONST_CAST(char *, type);
12796 : 0 : datum.values = NULL;
12797 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT],
12798 : : function,
12799 : : &nbrec_nat_columns[NBREC_NAT_COL_TYPE],
12800 : : &datum);
12801 : 0 : }
12802 : : void
12803 : 0 : nbrec_nat_remove_clause_false(struct ovsdb_idl *idl)
12804 : : {
12805 : : struct ovsdb_datum datum;
12806 : :
12807 : 0 : ovsdb_datum_init_empty(&datum);
12808 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT], OVSDB_F_FALSE, NULL, &datum);
12809 : 0 : }
12810 : : void
12811 : 0 : nbrec_nat_remove_clause_true(struct ovsdb_idl *idl)
12812 : : {
12813 : : struct ovsdb_datum datum;
12814 : :
12815 : 0 : ovsdb_datum_init_empty(&datum);
12816 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NAT], OVSDB_F_TRUE, NULL, &datum);
12817 : 0 : }
12818 : :
12819 : : struct ovsdb_idl_column nbrec_nat_columns[NBREC_NAT_N_COLUMNS];
12820 : :
12821 : : static void
12822 : 932 : nbrec_nat_columns_init(void)
12823 : : {
12824 : : struct ovsdb_idl_column *c;
12825 : :
12826 : : /* Initialize nbrec_nat_col_external_ip. */
12827 : 932 : c = &nbrec_nat_col_external_ip;
12828 : 932 : c->name = "external_ip";
12829 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12830 : 932 : c->type.key.u.string.minLen = 0;
12831 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12832 : 932 : c->type.n_min = 1;
12833 : 932 : c->type.n_max = 1;
12834 : 932 : c->mutable = true;
12835 : 932 : c->parse = nbrec_nat_parse_external_ip;
12836 : 932 : c->unparse = nbrec_nat_unparse_external_ip;
12837 : :
12838 : : /* Initialize nbrec_nat_col_logical_ip. */
12839 : 932 : c = &nbrec_nat_col_logical_ip;
12840 : 932 : c->name = "logical_ip";
12841 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12842 : 932 : c->type.key.u.string.minLen = 0;
12843 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12844 : 932 : c->type.n_min = 1;
12845 : 932 : c->type.n_max = 1;
12846 : 932 : c->mutable = true;
12847 : 932 : c->parse = nbrec_nat_parse_logical_ip;
12848 : 932 : c->unparse = nbrec_nat_unparse_logical_ip;
12849 : :
12850 : : /* Initialize nbrec_nat_col_type. */
12851 : 932 : c = &nbrec_nat_col_type;
12852 : 932 : c->name = "type";
12853 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12854 : 932 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
12855 : 932 : c->type.key.enum_->n = 3;
12856 : 932 : c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
12857 : 932 : c->type.key.enum_->keys[0].string = xstrdup("dnat");
12858 : 932 : c->type.key.enum_->keys[1].string = xstrdup("dnat_and_snat");
12859 : 932 : c->type.key.enum_->keys[2].string = xstrdup("snat");
12860 : 932 : c->type.key.enum_->values = NULL;
12861 : 932 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
12862 : 932 : c->type.key.u.string.minLen = 0;
12863 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12864 : 932 : c->type.n_min = 1;
12865 : 932 : c->type.n_max = 1;
12866 : 932 : c->mutable = true;
12867 : 932 : c->parse = nbrec_nat_parse_type;
12868 : 932 : c->unparse = nbrec_nat_unparse_type;
12869 : 932 : }
12870 : :
12871 : : /* NB_Global table. */
12872 : :
12873 : : static void
12874 : 1012 : nbrec_nb_global_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12875 : : {
12876 : 1012 : struct nbrec_nb_global *row = nbrec_nb_global_cast(row_);
12877 : : size_t i;
12878 : :
12879 [ - + ]: 1012 : ovs_assert(inited);
12880 : 1012 : smap_init(&row->external_ids);
12881 [ - + ]: 1012 : for (i = 0; i < datum->n; i++) {
12882 : 0 : smap_add(&row->external_ids,
12883 : 0 : datum->keys[i].string,
12884 : 0 : datum->values[i].string);
12885 : : }
12886 : 1012 : }
12887 : :
12888 : : static void
12889 : 1020 : nbrec_nb_global_parse_hv_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12890 : : {
12891 : 1020 : struct nbrec_nb_global *row = nbrec_nb_global_cast(row_);
12892 : :
12893 [ - + ]: 1020 : ovs_assert(inited);
12894 [ + - ]: 1020 : if (datum->n >= 1) {
12895 : 1020 : row->hv_cfg = datum->keys[0].integer;
12896 : : } else {
12897 : 0 : row->hv_cfg = 0;
12898 : : }
12899 : 1020 : }
12900 : :
12901 : : static void
12902 : 1012 : nbrec_nb_global_parse_nb_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12903 : : {
12904 : 1012 : struct nbrec_nb_global *row = nbrec_nb_global_cast(row_);
12905 : :
12906 [ - + ]: 1012 : ovs_assert(inited);
12907 [ + - ]: 1012 : if (datum->n >= 1) {
12908 : 1012 : row->nb_cfg = datum->keys[0].integer;
12909 : : } else {
12910 : 0 : row->nb_cfg = 0;
12911 : : }
12912 : 1012 : }
12913 : :
12914 : : static void
12915 : 1020 : nbrec_nb_global_parse_sb_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12916 : : {
12917 : 1020 : struct nbrec_nb_global *row = nbrec_nb_global_cast(row_);
12918 : :
12919 [ - + ]: 1020 : ovs_assert(inited);
12920 [ + - ]: 1020 : if (datum->n >= 1) {
12921 : 1020 : row->sb_cfg = datum->keys[0].integer;
12922 : : } else {
12923 : 0 : row->sb_cfg = 0;
12924 : : }
12925 : 1020 : }
12926 : :
12927 : : static void
12928 : 1061 : nbrec_nb_global_unparse_external_ids(struct ovsdb_idl_row *row_)
12929 : : {
12930 : 1061 : struct nbrec_nb_global *row = nbrec_nb_global_cast(row_);
12931 : :
12932 [ - + ]: 1061 : ovs_assert(inited);
12933 : 1061 : smap_destroy(&row->external_ids);
12934 : 1061 : }
12935 : :
12936 : : static void
12937 : 1069 : nbrec_nb_global_unparse_hv_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
12938 : : {
12939 : : /* Nothing to do. */
12940 : 1069 : }
12941 : :
12942 : : static void
12943 : 1061 : nbrec_nb_global_unparse_nb_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
12944 : : {
12945 : : /* Nothing to do. */
12946 : 1061 : }
12947 : :
12948 : : static void
12949 : 1069 : nbrec_nb_global_unparse_sb_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
12950 : : {
12951 : : /* Nothing to do. */
12952 : 1069 : }
12953 : :
12954 : : static void
12955 : 980 : nbrec_nb_global_init__(struct ovsdb_idl_row *row)
12956 : : {
12957 : 980 : nbrec_nb_global_init(nbrec_nb_global_cast(row));
12958 : 980 : }
12959 : :
12960 : : /* Clears the contents of 'row' in table "NB_Global". */
12961 : : void
12962 : 980 : nbrec_nb_global_init(struct nbrec_nb_global *row)
12963 : : {
12964 : 980 : memset(row, 0, sizeof *row);
12965 : 980 : smap_init(&row->external_ids);
12966 : 980 : }
12967 : :
12968 : : /* Searches table "NB_Global" in 'idl' for a row with UUID 'uuid'. Returns
12969 : : * a pointer to the row if there is one, otherwise a null pointer. */
12970 : : const struct nbrec_nb_global *
12971 : 0 : nbrec_nb_global_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
12972 : : {
12973 : 0 : return nbrec_nb_global_cast(ovsdb_idl_get_row_for_uuid(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL], uuid));
12974 : : }
12975 : :
12976 : : /* Returns a row in table "NB_Global" in 'idl', or a null pointer if that
12977 : : * table is empty.
12978 : : *
12979 : : * Database tables are internally maintained as hash tables, so adding or
12980 : : * removing rows while traversing the same table can cause some rows to be
12981 : : * visited twice or not at apply. */
12982 : : const struct nbrec_nb_global *
12983 : 6140 : nbrec_nb_global_first(const struct ovsdb_idl *idl)
12984 : : {
12985 : 6140 : return nbrec_nb_global_cast(ovsdb_idl_first_row(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL]));
12986 : : }
12987 : :
12988 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
12989 : : * is the last row in its table. */
12990 : : const struct nbrec_nb_global *
12991 : 5 : nbrec_nb_global_next(const struct nbrec_nb_global *row)
12992 : : {
12993 : 5 : return nbrec_nb_global_cast(ovsdb_idl_next_row(&row->header_));
12994 : : }
12995 : :
12996 : 0 : unsigned int nbrec_nb_global_get_seqno(const struct ovsdb_idl *idl)
12997 : : {
12998 : 0 : return ovsdb_idl_table_get_seqno(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL]);
12999 : : }
13000 : :
13001 : 0 : unsigned int nbrec_nb_global_row_get_seqno(const struct nbrec_nb_global *row, enum ovsdb_idl_change change)
13002 : : {
13003 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
13004 : : }
13005 : :
13006 : : const struct nbrec_nb_global *
13007 : 0 : nbrec_nb_global_track_get_first(const struct ovsdb_idl *idl)
13008 : : {
13009 : 0 : return nbrec_nb_global_cast(ovsdb_idl_track_get_first(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL]));
13010 : : }
13011 : :
13012 : : const struct nbrec_nb_global
13013 : 0 : *nbrec_nb_global_track_get_next(const struct nbrec_nb_global *row)
13014 : : {
13015 : 0 : return nbrec_nb_global_cast(ovsdb_idl_track_get_next(&row->header_));
13016 : : }
13017 : :
13018 : :
13019 : : /* Deletes 'row' from table "NB_Global". 'row' may be freed, so it must not be
13020 : : * accessed afterward.
13021 : : *
13022 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13023 : : void
13024 : 0 : nbrec_nb_global_delete(const struct nbrec_nb_global *row)
13025 : : {
13026 : 0 : ovsdb_idl_txn_delete(&row->header_);
13027 : 0 : }
13028 : :
13029 : : /* Inserts and returns a new row in the table "NB_Global" in the database
13030 : : * with open transaction 'txn'.
13031 : : *
13032 : : * The new row is assigned a randomly generated provisional UUID.
13033 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
13034 : : * but the IDL will replace any uses of the provisional UUID in the
13035 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
13036 : : struct nbrec_nb_global *
13037 : 49 : nbrec_nb_global_insert(struct ovsdb_idl_txn *txn)
13038 : : {
13039 : 49 : return nbrec_nb_global_cast(ovsdb_idl_txn_insert(txn, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL], NULL));
13040 : : }
13041 : :
13042 : : bool
13043 : 0 : nbrec_nb_global_is_updated(const struct nbrec_nb_global *row, enum nbrec_nb_global_column_id column)
13044 : : {
13045 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &nbrec_nb_global_columns[column]);
13046 : : }
13047 : :
13048 : : /* Causes the original contents of column "external_ids" in 'row' to be
13049 : : * verified as a prerequisite to completing the transaction. That is, if
13050 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
13051 : : * time that the IDL originally read its contents and the time that the
13052 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
13053 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
13054 : : * change has already been received).
13055 : : *
13056 : : * The intention is that, to ensure that no transaction commits based on dirty
13057 : : * reads, an application should call this function any time "external_ids" is
13058 : : * read as part of a read-modify-write operation.
13059 : : *
13060 : : * In some cases this function reduces to a no-op, because the current value
13061 : : * of "external_ids" is already known:
13062 : : *
13063 : : * - If 'row' is a row created by the current transaction (returned by
13064 : : * nbrec_nb_global_insert()).
13065 : : *
13066 : : * - If "external_ids" has already been modified (with
13067 : : * nbrec_nb_global_set_external_ids()) within the current transaction.
13068 : : *
13069 : : * Because of the latter property, always call this function *before*
13070 : : * nbrec_nb_global_set_external_ids() for a given read-modify-write.
13071 : : *
13072 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13073 : : void
13074 : 0 : nbrec_nb_global_verify_external_ids(const struct nbrec_nb_global *row)
13075 : : {
13076 [ # # ]: 0 : ovs_assert(inited);
13077 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_EXTERNAL_IDS]);
13078 : 0 : }
13079 : :
13080 : : /* Causes the original contents of column "hv_cfg" in 'row' to be
13081 : : * verified as a prerequisite to completing the transaction. That is, if
13082 : : * "hv_cfg" in 'row' changed (or if 'row' was deleted) between the
13083 : : * time that the IDL originally read its contents and the time that the
13084 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
13085 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
13086 : : * change has already been received).
13087 : : *
13088 : : * The intention is that, to ensure that no transaction commits based on dirty
13089 : : * reads, an application should call this function any time "hv_cfg" is
13090 : : * read as part of a read-modify-write operation.
13091 : : *
13092 : : * In some cases this function reduces to a no-op, because the current value
13093 : : * of "hv_cfg" is already known:
13094 : : *
13095 : : * - If 'row' is a row created by the current transaction (returned by
13096 : : * nbrec_nb_global_insert()).
13097 : : *
13098 : : * - If "hv_cfg" has already been modified (with
13099 : : * nbrec_nb_global_set_hv_cfg()) within the current transaction.
13100 : : *
13101 : : * Because of the latter property, always call this function *before*
13102 : : * nbrec_nb_global_set_hv_cfg() for a given read-modify-write.
13103 : : *
13104 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13105 : : void
13106 : 0 : nbrec_nb_global_verify_hv_cfg(const struct nbrec_nb_global *row)
13107 : : {
13108 [ # # ]: 0 : ovs_assert(inited);
13109 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_HV_CFG]);
13110 : 0 : }
13111 : :
13112 : : /* Causes the original contents of column "nb_cfg" in 'row' to be
13113 : : * verified as a prerequisite to completing the transaction. That is, if
13114 : : * "nb_cfg" in 'row' changed (or if 'row' was deleted) between the
13115 : : * time that the IDL originally read its contents and the time that the
13116 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
13117 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
13118 : : * change has already been received).
13119 : : *
13120 : : * The intention is that, to ensure that no transaction commits based on dirty
13121 : : * reads, an application should call this function any time "nb_cfg" is
13122 : : * read as part of a read-modify-write operation.
13123 : : *
13124 : : * In some cases this function reduces to a no-op, because the current value
13125 : : * of "nb_cfg" is already known:
13126 : : *
13127 : : * - If 'row' is a row created by the current transaction (returned by
13128 : : * nbrec_nb_global_insert()).
13129 : : *
13130 : : * - If "nb_cfg" has already been modified (with
13131 : : * nbrec_nb_global_set_nb_cfg()) within the current transaction.
13132 : : *
13133 : : * Because of the latter property, always call this function *before*
13134 : : * nbrec_nb_global_set_nb_cfg() for a given read-modify-write.
13135 : : *
13136 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13137 : : void
13138 : 0 : nbrec_nb_global_verify_nb_cfg(const struct nbrec_nb_global *row)
13139 : : {
13140 [ # # ]: 0 : ovs_assert(inited);
13141 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_NB_CFG]);
13142 : 0 : }
13143 : :
13144 : : /* Causes the original contents of column "sb_cfg" in 'row' to be
13145 : : * verified as a prerequisite to completing the transaction. That is, if
13146 : : * "sb_cfg" in 'row' changed (or if 'row' was deleted) between the
13147 : : * time that the IDL originally read its contents and the time that the
13148 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
13149 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
13150 : : * change has already been received).
13151 : : *
13152 : : * The intention is that, to ensure that no transaction commits based on dirty
13153 : : * reads, an application should call this function any time "sb_cfg" is
13154 : : * read as part of a read-modify-write operation.
13155 : : *
13156 : : * In some cases this function reduces to a no-op, because the current value
13157 : : * of "sb_cfg" is already known:
13158 : : *
13159 : : * - If 'row' is a row created by the current transaction (returned by
13160 : : * nbrec_nb_global_insert()).
13161 : : *
13162 : : * - If "sb_cfg" has already been modified (with
13163 : : * nbrec_nb_global_set_sb_cfg()) within the current transaction.
13164 : : *
13165 : : * Because of the latter property, always call this function *before*
13166 : : * nbrec_nb_global_set_sb_cfg() for a given read-modify-write.
13167 : : *
13168 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13169 : : void
13170 : 0 : nbrec_nb_global_verify_sb_cfg(const struct nbrec_nb_global *row)
13171 : : {
13172 [ # # ]: 0 : ovs_assert(inited);
13173 : 0 : ovsdb_idl_txn_verify(&row->header_, &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_SB_CFG]);
13174 : 0 : }
13175 : :
13176 : : /* Returns the "external_ids" column's value from the "NB_Global" table in 'row'
13177 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
13178 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
13179 : : * for a given key than implementing the same operation on the "cooked"
13180 : : * form in 'row'.
13181 : : *
13182 : : * 'key_type' must be OVSDB_TYPE_STRING.
13183 : : * 'value_type' must be OVSDB_TYPE_STRING.
13184 : : * (This helps to avoid silent bugs if someone changes external_ids's
13185 : : * type without updating the caller.)
13186 : : *
13187 : : * The caller must not modify or free the returned value.
13188 : : *
13189 : : * Various kinds of changes can invalidate the returned value: modifying
13190 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13191 : : * If the returned value is needed for a long time, it is best to make a copy
13192 : : * of it with ovsdb_datum_clone().
13193 : : *
13194 : : * This function is rarely useful, since it is easier to access the value
13195 : : * directly through the "external_ids" member in nbrec_nb_global. */
13196 : : const struct ovsdb_datum *
13197 : 0 : nbrec_nb_global_get_external_ids(const struct nbrec_nb_global *row,
13198 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
13199 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
13200 : : {
13201 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
13202 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
13203 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_nb_global_col_external_ids);
13204 : : }
13205 : :
13206 : : /* Returns the "hv_cfg" column's value from the "NB_Global" table in 'row'
13207 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
13208 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
13209 : : * for a given key than implementing the same operation on the "cooked"
13210 : : * form in 'row'.
13211 : : *
13212 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
13213 : : * (This helps to avoid silent bugs if someone changes hv_cfg's
13214 : : * type without updating the caller.)
13215 : : *
13216 : : * The caller must not modify or free the returned value.
13217 : : *
13218 : : * Various kinds of changes can invalidate the returned value: modifying
13219 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13220 : : * If the returned value is needed for a long time, it is best to make a copy
13221 : : * of it with ovsdb_datum_clone().
13222 : : *
13223 : : * This function is rarely useful, since it is easier to access the value
13224 : : * directly through the "hv_cfg" member in nbrec_nb_global. */
13225 : : const struct ovsdb_datum *
13226 : 0 : nbrec_nb_global_get_hv_cfg(const struct nbrec_nb_global *row,
13227 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
13228 : : {
13229 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13230 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_nb_global_col_hv_cfg);
13231 : : }
13232 : :
13233 : : /* Returns the "nb_cfg" column's value from the "NB_Global" table in 'row'
13234 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
13235 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
13236 : : * for a given key than implementing the same operation on the "cooked"
13237 : : * form in 'row'.
13238 : : *
13239 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
13240 : : * (This helps to avoid silent bugs if someone changes nb_cfg's
13241 : : * type without updating the caller.)
13242 : : *
13243 : : * The caller must not modify or free the returned value.
13244 : : *
13245 : : * Various kinds of changes can invalidate the returned value: modifying
13246 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13247 : : * If the returned value is needed for a long time, it is best to make a copy
13248 : : * of it with ovsdb_datum_clone().
13249 : : *
13250 : : * This function is rarely useful, since it is easier to access the value
13251 : : * directly through the "nb_cfg" member in nbrec_nb_global. */
13252 : : const struct ovsdb_datum *
13253 : 0 : nbrec_nb_global_get_nb_cfg(const struct nbrec_nb_global *row,
13254 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
13255 : : {
13256 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13257 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_nb_global_col_nb_cfg);
13258 : : }
13259 : :
13260 : : /* Returns the "sb_cfg" column's value from the "NB_Global" table in 'row'
13261 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
13262 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
13263 : : * for a given key than implementing the same operation on the "cooked"
13264 : : * form in 'row'.
13265 : : *
13266 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
13267 : : * (This helps to avoid silent bugs if someone changes sb_cfg's
13268 : : * type without updating the caller.)
13269 : : *
13270 : : * The caller must not modify or free the returned value.
13271 : : *
13272 : : * Various kinds of changes can invalidate the returned value: modifying
13273 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13274 : : * If the returned value is needed for a long time, it is best to make a copy
13275 : : * of it with ovsdb_datum_clone().
13276 : : *
13277 : : * This function is rarely useful, since it is easier to access the value
13278 : : * directly through the "sb_cfg" member in nbrec_nb_global. */
13279 : : const struct ovsdb_datum *
13280 : 0 : nbrec_nb_global_get_sb_cfg(const struct nbrec_nb_global *row,
13281 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
13282 : : {
13283 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13284 : 0 : return ovsdb_idl_read(&row->header_, &nbrec_nb_global_col_sb_cfg);
13285 : : }
13286 : :
13287 : : /* Sets the "external_ids" column's value from the "NB_Global" table in 'row'
13288 : : * to 'external_ids'.
13289 : : *
13290 : : * The caller retains ownership of 'external_ids' and everything in it. */
13291 : : void
13292 : 0 : nbrec_nb_global_set_external_ids(const struct nbrec_nb_global *row, const struct smap *external_ids)
13293 : : {
13294 : : struct ovsdb_datum datum;
13295 : :
13296 [ # # ]: 0 : ovs_assert(inited);
13297 [ # # ]: 0 : if (external_ids) {
13298 : : struct smap_node *node;
13299 : : size_t i;
13300 : :
13301 : 0 : datum.n = smap_count(external_ids);
13302 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
13303 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
13304 : :
13305 : 0 : i = 0;
13306 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
13307 : 0 : datum.keys[i].string = xstrdup(node->key);
13308 : 0 : datum.values[i].string = xstrdup(node->value);
13309 : 0 : i++;
13310 : : }
13311 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
13312 : : } else {
13313 : 0 : ovsdb_datum_init_empty(&datum);
13314 : : }
13315 : 0 : ovsdb_idl_txn_write(&row->header_,
13316 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_EXTERNAL_IDS],
13317 : : &datum);
13318 : 0 : }
13319 : :
13320 : :
13321 : : /* Sets the "hv_cfg" column from the "NB_Global" table in 'row' to
13322 : : * 'hv_cfg'.
13323 : : *
13324 : : * The caller retains ownership of the arguments. */
13325 : : void
13326 : 8 : nbrec_nb_global_set_hv_cfg(const struct nbrec_nb_global *row, int64_t hv_cfg)
13327 : : {
13328 : : struct ovsdb_datum datum;
13329 : : union ovsdb_atom key;
13330 : :
13331 [ - + ]: 8 : ovs_assert(inited);
13332 : 8 : datum.n = 1;
13333 : 8 : datum.keys = &key;
13334 : 8 : key.integer = hv_cfg;
13335 : 8 : datum.values = NULL;
13336 : 8 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_HV_CFG], &datum);
13337 : 8 : }
13338 : :
13339 : : /* Sets the "nb_cfg" column from the "NB_Global" table in 'row' to
13340 : : * 'nb_cfg'.
13341 : : *
13342 : : * The caller retains ownership of the arguments. */
13343 : : void
13344 : 0 : nbrec_nb_global_set_nb_cfg(const struct nbrec_nb_global *row, int64_t nb_cfg)
13345 : : {
13346 : : struct ovsdb_datum datum;
13347 : : union ovsdb_atom key;
13348 : :
13349 [ # # ]: 0 : ovs_assert(inited);
13350 : 0 : datum.n = 1;
13351 : 0 : datum.keys = &key;
13352 : 0 : key.integer = nb_cfg;
13353 : 0 : datum.values = NULL;
13354 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_NB_CFG], &datum);
13355 : 0 : }
13356 : :
13357 : : /* Sets the "sb_cfg" column from the "NB_Global" table in 'row' to
13358 : : * 'sb_cfg'.
13359 : : *
13360 : : * The caller retains ownership of the arguments. */
13361 : : void
13362 : 8 : nbrec_nb_global_set_sb_cfg(const struct nbrec_nb_global *row, int64_t sb_cfg)
13363 : : {
13364 : : struct ovsdb_datum datum;
13365 : : union ovsdb_atom key;
13366 : :
13367 [ - + ]: 8 : ovs_assert(inited);
13368 : 8 : datum.n = 1;
13369 : 8 : datum.keys = &key;
13370 : 8 : key.integer = sb_cfg;
13371 : 8 : datum.values = NULL;
13372 : 8 : ovsdb_idl_txn_write_clone(&row->header_, &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_SB_CFG], &datum);
13373 : 8 : }
13374 : :
13375 : : /* Sets an element of the "external_ids" map column from the "NB_Global" table in 'row'
13376 : : * to 'new_value' given the key value 'new_key'.
13377 : : *
13378 : : */
13379 : : void
13380 : 0 : nbrec_nb_global_update_external_ids_setkey(const struct nbrec_nb_global *row, const char *new_key, const char *new_value)
13381 : : {
13382 : : struct ovsdb_datum *datum;
13383 : :
13384 [ # # ]: 0 : ovs_assert(inited);
13385 : :
13386 : 0 : datum = xmalloc(sizeof *datum);
13387 : 0 : datum->n = 1;
13388 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
13389 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
13390 : :
13391 : 0 : datum->keys[0].string = xstrdup(new_key);
13392 : 0 : datum->values[0].string = xstrdup(new_value);
13393 : :
13394 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
13395 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_EXTERNAL_IDS],
13396 : : datum);
13397 : 0 : }
13398 : :
13399 : : /* Deletes an element of the "external_ids" map column from the "NB_Global" table in 'row'
13400 : : * given the key value 'delete_key'.
13401 : : *
13402 : : */
13403 : : void
13404 : 0 : nbrec_nb_global_update_external_ids_delkey(const struct nbrec_nb_global *row, const char *delete_key)
13405 : : {
13406 : : struct ovsdb_datum *datum;
13407 : :
13408 [ # # ]: 0 : ovs_assert(inited);
13409 : :
13410 : 0 : datum = xmalloc(sizeof *datum);
13411 : 0 : datum->n = 1;
13412 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
13413 : 0 : datum->values = NULL;
13414 : :
13415 : 0 : datum->keys[0].string = xstrdup(delete_key);
13416 : :
13417 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
13418 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_EXTERNAL_IDS],
13419 : : datum);
13420 : 0 : }
13421 : :
13422 : : /* Sets the "external_ids" column's value from the "NB_Global" table in 'row'
13423 : : * to 'external_ids'.
13424 : : *
13425 : : * The caller retains ownership of 'external_ids' and everything in it. */
13426 : : void
13427 : 0 : nbrec_nb_global_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
13428 : : {
13429 : : struct ovsdb_datum datum;
13430 : :
13431 [ # # ]: 0 : ovs_assert(inited);
13432 [ # # ]: 0 : if (external_ids) {
13433 : : struct smap_node *node;
13434 : : size_t i;
13435 : :
13436 : 0 : datum.n = smap_count(external_ids);
13437 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
13438 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
13439 : :
13440 : 0 : i = 0;
13441 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
13442 : 0 : datum.keys[i].string = xstrdup(node->key);
13443 : 0 : datum.values[i].string = xstrdup(node->value);
13444 : 0 : i++;
13445 : : }
13446 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
13447 : : } else {
13448 : 0 : ovsdb_datum_init_empty(&datum);
13449 : : }
13450 : :
13451 : 0 : ovsdb_idl_condition_add_clause(idl,
13452 : : &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13453 : : function,
13454 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_EXTERNAL_IDS],
13455 : : &datum);
13456 : :
13457 : 0 : ovsdb_datum_destroy(&datum, &nbrec_nb_global_col_external_ids.type);
13458 : 0 : }
13459 : :
13460 : :
13461 : : /* Sets the "hv_cfg" column from the "NB_Global" table in 'row' to
13462 : : * 'hv_cfg'.
13463 : : *
13464 : : * The caller retains ownership of the arguments. */
13465 : : void
13466 : 0 : nbrec_nb_global_add_clause_hv_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t hv_cfg)
13467 : : {
13468 : : struct ovsdb_datum datum;
13469 : : union ovsdb_atom key;
13470 : :
13471 [ # # ]: 0 : ovs_assert(inited);
13472 : 0 : datum.n = 1;
13473 : 0 : datum.keys = &key;
13474 : 0 : key.integer = hv_cfg;
13475 : 0 : datum.values = NULL;
13476 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13477 : : function,
13478 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_HV_CFG],
13479 : : &datum);
13480 : 0 : }
13481 : :
13482 : : /* Sets the "nb_cfg" column from the "NB_Global" table in 'row' to
13483 : : * 'nb_cfg'.
13484 : : *
13485 : : * The caller retains ownership of the arguments. */
13486 : : void
13487 : 0 : nbrec_nb_global_add_clause_nb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t nb_cfg)
13488 : : {
13489 : : struct ovsdb_datum datum;
13490 : : union ovsdb_atom key;
13491 : :
13492 [ # # ]: 0 : ovs_assert(inited);
13493 : 0 : datum.n = 1;
13494 : 0 : datum.keys = &key;
13495 : 0 : key.integer = nb_cfg;
13496 : 0 : datum.values = NULL;
13497 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13498 : : function,
13499 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_NB_CFG],
13500 : : &datum);
13501 : 0 : }
13502 : :
13503 : : /* Sets the "sb_cfg" column from the "NB_Global" table in 'row' to
13504 : : * 'sb_cfg'.
13505 : : *
13506 : : * The caller retains ownership of the arguments. */
13507 : : void
13508 : 0 : nbrec_nb_global_add_clause_sb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t sb_cfg)
13509 : : {
13510 : : struct ovsdb_datum datum;
13511 : : union ovsdb_atom key;
13512 : :
13513 [ # # ]: 0 : ovs_assert(inited);
13514 : 0 : datum.n = 1;
13515 : 0 : datum.keys = &key;
13516 : 0 : key.integer = sb_cfg;
13517 : 0 : datum.values = NULL;
13518 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13519 : : function,
13520 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_SB_CFG],
13521 : : &datum);
13522 : 0 : }
13523 : : void
13524 : 0 : nbrec_nb_global_add_clause_false(struct ovsdb_idl *idl)
13525 : : {
13526 : : struct ovsdb_datum datum;
13527 : :
13528 : 0 : ovsdb_datum_init_empty(&datum);
13529 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL], OVSDB_F_FALSE, NULL, &datum);
13530 : 0 : }
13531 : : void
13532 : 0 : nbrec_nb_global_add_clause_true(struct ovsdb_idl *idl)
13533 : : {
13534 : : struct ovsdb_datum datum;
13535 : :
13536 : 0 : ovsdb_datum_init_empty(&datum);
13537 : 0 : ovsdb_idl_condition_add_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL], OVSDB_F_TRUE, NULL, &datum);
13538 : 0 : }
13539 : :
13540 : : /* Sets the "external_ids" column's value from the "NB_Global" table in 'row'
13541 : : * to 'external_ids'.
13542 : : *
13543 : : * The caller retains ownership of 'external_ids' and everything in it. */
13544 : : void
13545 : 0 : nbrec_nb_global_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
13546 : : {
13547 : : struct ovsdb_datum datum;
13548 : :
13549 [ # # ]: 0 : ovs_assert(inited);
13550 [ # # ]: 0 : if (external_ids) {
13551 : : struct smap_node *node;
13552 : : size_t i;
13553 : :
13554 : 0 : datum.n = smap_count(external_ids);
13555 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
13556 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
13557 : :
13558 : 0 : i = 0;
13559 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
13560 : 0 : datum.keys[i].string = xstrdup(node->key);
13561 : 0 : datum.values[i].string = xstrdup(node->value);
13562 : 0 : i++;
13563 : : }
13564 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
13565 : : } else {
13566 : 0 : ovsdb_datum_init_empty(&datum);
13567 : : }
13568 : :
13569 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13570 : : function,
13571 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_EXTERNAL_IDS],
13572 : : &datum);
13573 : :
13574 : 0 : ovsdb_datum_destroy(&datum, &nbrec_nb_global_col_external_ids.type);
13575 : 0 : }
13576 : :
13577 : :
13578 : : /* Sets the "hv_cfg" column from the "NB_Global" table in 'row' to
13579 : : * 'hv_cfg'.
13580 : : *
13581 : : * The caller retains ownership of the arguments. */
13582 : : void
13583 : 0 : nbrec_nb_global_remove_clause_hv_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t hv_cfg)
13584 : : {
13585 : : struct ovsdb_datum datum;
13586 : : union ovsdb_atom key;
13587 : :
13588 [ # # ]: 0 : ovs_assert(inited);
13589 : 0 : datum.n = 1;
13590 : 0 : datum.keys = &key;
13591 : 0 : key.integer = hv_cfg;
13592 : 0 : datum.values = NULL;
13593 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13594 : : function,
13595 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_HV_CFG],
13596 : : &datum);
13597 : 0 : }
13598 : :
13599 : : /* Sets the "nb_cfg" column from the "NB_Global" table in 'row' to
13600 : : * 'nb_cfg'.
13601 : : *
13602 : : * The caller retains ownership of the arguments. */
13603 : : void
13604 : 0 : nbrec_nb_global_remove_clause_nb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t nb_cfg)
13605 : : {
13606 : : struct ovsdb_datum datum;
13607 : : union ovsdb_atom key;
13608 : :
13609 [ # # ]: 0 : ovs_assert(inited);
13610 : 0 : datum.n = 1;
13611 : 0 : datum.keys = &key;
13612 : 0 : key.integer = nb_cfg;
13613 : 0 : datum.values = NULL;
13614 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13615 : : function,
13616 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_NB_CFG],
13617 : : &datum);
13618 : 0 : }
13619 : :
13620 : : /* Sets the "sb_cfg" column from the "NB_Global" table in 'row' to
13621 : : * 'sb_cfg'.
13622 : : *
13623 : : * The caller retains ownership of the arguments. */
13624 : : void
13625 : 0 : nbrec_nb_global_remove_clause_sb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t sb_cfg)
13626 : : {
13627 : : struct ovsdb_datum datum;
13628 : : union ovsdb_atom key;
13629 : :
13630 [ # # ]: 0 : ovs_assert(inited);
13631 : 0 : datum.n = 1;
13632 : 0 : datum.keys = &key;
13633 : 0 : key.integer = sb_cfg;
13634 : 0 : datum.values = NULL;
13635 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL],
13636 : : function,
13637 : : &nbrec_nb_global_columns[NBREC_NB_GLOBAL_COL_SB_CFG],
13638 : : &datum);
13639 : 0 : }
13640 : : void
13641 : 0 : nbrec_nb_global_remove_clause_false(struct ovsdb_idl *idl)
13642 : : {
13643 : : struct ovsdb_datum datum;
13644 : :
13645 : 0 : ovsdb_datum_init_empty(&datum);
13646 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL], OVSDB_F_FALSE, NULL, &datum);
13647 : 0 : }
13648 : : void
13649 : 0 : nbrec_nb_global_remove_clause_true(struct ovsdb_idl *idl)
13650 : : {
13651 : : struct ovsdb_datum datum;
13652 : :
13653 : 0 : ovsdb_datum_init_empty(&datum);
13654 : 0 : ovsdb_idl_condition_remove_clause(idl, &nbrec_table_classes[NBREC_TABLE_NB_GLOBAL], OVSDB_F_TRUE, NULL, &datum);
13655 : 0 : }
13656 : :
13657 : : struct ovsdb_idl_column nbrec_nb_global_columns[NBREC_NB_GLOBAL_N_COLUMNS];
13658 : :
13659 : : static void
13660 : 932 : nbrec_nb_global_columns_init(void)
13661 : : {
13662 : : struct ovsdb_idl_column *c;
13663 : :
13664 : : /* Initialize nbrec_nb_global_col_external_ids. */
13665 : 932 : c = &nbrec_nb_global_col_external_ids;
13666 : 932 : c->name = "external_ids";
13667 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13668 : 932 : c->type.key.u.string.minLen = 0;
13669 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
13670 : 932 : c->type.value.u.string.minLen = 0;
13671 : 932 : c->type.n_min = 0;
13672 : 932 : c->type.n_max = UINT_MAX;
13673 : 932 : c->mutable = true;
13674 : 932 : c->parse = nbrec_nb_global_parse_external_ids;
13675 : 932 : c->unparse = nbrec_nb_global_unparse_external_ids;
13676 : :
13677 : : /* Initialize nbrec_nb_global_col_hv_cfg. */
13678 : 932 : c = &nbrec_nb_global_col_hv_cfg;
13679 : 932 : c->name = "hv_cfg";
13680 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
13681 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13682 : 932 : c->type.n_min = 1;
13683 : 932 : c->type.n_max = 1;
13684 : 932 : c->mutable = true;
13685 : 932 : c->parse = nbrec_nb_global_parse_hv_cfg;
13686 : 932 : c->unparse = nbrec_nb_global_unparse_hv_cfg;
13687 : :
13688 : : /* Initialize nbrec_nb_global_col_nb_cfg. */
13689 : 932 : c = &nbrec_nb_global_col_nb_cfg;
13690 : 932 : c->name = "nb_cfg";
13691 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
13692 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13693 : 932 : c->type.n_min = 1;
13694 : 932 : c->type.n_max = 1;
13695 : 932 : c->mutable = true;
13696 : 932 : c->parse = nbrec_nb_global_parse_nb_cfg;
13697 : 932 : c->unparse = nbrec_nb_global_unparse_nb_cfg;
13698 : :
13699 : : /* Initialize nbrec_nb_global_col_sb_cfg. */
13700 : 932 : c = &nbrec_nb_global_col_sb_cfg;
13701 : 932 : c->name = "sb_cfg";
13702 : 932 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
13703 : 932 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13704 : 932 : c->type.n_min = 1;
13705 : 932 : c->type.n_max = 1;
13706 : 932 : c->mutable = true;
13707 : 932 : c->parse = nbrec_nb_global_parse_sb_cfg;
13708 : 932 : c->unparse = nbrec_nb_global_unparse_sb_cfg;
13709 : 932 : }
13710 : :
13711 : : struct ovsdb_idl_table_class nbrec_table_classes[NBREC_N_TABLES] = {
13712 : : {"ACL", false,
13713 : : nbrec_acl_columns, ARRAY_SIZE(nbrec_acl_columns),
13714 : : sizeof(struct nbrec_acl), nbrec_acl_init__},
13715 : : {"Address_Set", true,
13716 : : nbrec_address_set_columns, ARRAY_SIZE(nbrec_address_set_columns),
13717 : : sizeof(struct nbrec_address_set), nbrec_address_set_init__},
13718 : : {"DHCP_Options", true,
13719 : : nbrec_dhcp_options_columns, ARRAY_SIZE(nbrec_dhcp_options_columns),
13720 : : sizeof(struct nbrec_dhcp_options), nbrec_dhcp_options_init__},
13721 : : {"Load_Balancer", true,
13722 : : nbrec_load_balancer_columns, ARRAY_SIZE(nbrec_load_balancer_columns),
13723 : : sizeof(struct nbrec_load_balancer), nbrec_load_balancer_init__},
13724 : : {"Logical_Router", true,
13725 : : nbrec_logical_router_columns, ARRAY_SIZE(nbrec_logical_router_columns),
13726 : : sizeof(struct nbrec_logical_router), nbrec_logical_router_init__},
13727 : : {"Logical_Router_Port", false,
13728 : : nbrec_logical_router_port_columns, ARRAY_SIZE(nbrec_logical_router_port_columns),
13729 : : sizeof(struct nbrec_logical_router_port), nbrec_logical_router_port_init__},
13730 : : {"Logical_Router_Static_Route", false,
13731 : : nbrec_logical_router_static_route_columns, ARRAY_SIZE(nbrec_logical_router_static_route_columns),
13732 : : sizeof(struct nbrec_logical_router_static_route), nbrec_logical_router_static_route_init__},
13733 : : {"Logical_Switch", true,
13734 : : nbrec_logical_switch_columns, ARRAY_SIZE(nbrec_logical_switch_columns),
13735 : : sizeof(struct nbrec_logical_switch), nbrec_logical_switch_init__},
13736 : : {"Logical_Switch_Port", false,
13737 : : nbrec_logical_switch_port_columns, ARRAY_SIZE(nbrec_logical_switch_port_columns),
13738 : : sizeof(struct nbrec_logical_switch_port), nbrec_logical_switch_port_init__},
13739 : : {"NAT", false,
13740 : : nbrec_nat_columns, ARRAY_SIZE(nbrec_nat_columns),
13741 : : sizeof(struct nbrec_nat), nbrec_nat_init__},
13742 : : {"NB_Global", true,
13743 : : nbrec_nb_global_columns, ARRAY_SIZE(nbrec_nb_global_columns),
13744 : : sizeof(struct nbrec_nb_global), nbrec_nb_global_init__},
13745 : : };
13746 : :
13747 : : struct ovsdb_idl_class nbrec_idl_class = {
13748 : : "OVN_Northbound", nbrec_table_classes, ARRAY_SIZE(nbrec_table_classes)
13749 : : };
13750 : :
13751 : : void
13752 : 932 : nbrec_init(void)
13753 : : {
13754 [ - + ]: 932 : if (inited) {
13755 : 0 : return;
13756 : : }
13757 : 932 : assert_single_threaded();
13758 : 932 : inited = true;
13759 : :
13760 : 932 : nbrec_acl_columns_init();
13761 : 932 : nbrec_address_set_columns_init();
13762 : 932 : nbrec_dhcp_options_columns_init();
13763 : 932 : nbrec_load_balancer_columns_init();
13764 : 932 : nbrec_logical_router_columns_init();
13765 : 932 : nbrec_logical_router_port_columns_init();
13766 : 932 : nbrec_logical_router_static_route_columns_init();
13767 : 932 : nbrec_logical_switch_columns_init();
13768 : 932 : nbrec_logical_switch_port_columns_init();
13769 : 932 : nbrec_nat_columns_init();
13770 : 932 : nbrec_nb_global_columns_init();
13771 : : }
13772 : :
13773 : : /* Return the schema version. The caller must not free the returned value. */
13774 : : const char *
13775 : 0 : nbrec_get_db_version(void)
13776 : : {
13777 : 0 : return "5.3.3";
13778 : : }
13779 : :
|