1
/* Generated automatically -- do not modify! -*- buffer-read-only: t -*- */
4
#include "lib/vswitch-idl.h"
6
#include "ovs-thread.h"
7
#include "ovsdb-data.h"
8
#include "ovsdb-error.h"
12
/* Sparse dislikes sizeof(bool) ("warning: expression using sizeof bool"). */
13
enum { sizeof_bool = 1 };
15
enum { sizeof_bool = sizeof(bool) };
21
static struct ovsrec_bridge *
22
ovsrec_bridge_cast(const struct ovsdb_idl_row *row)
24
return row ? CONTAINER_OF(row, struct ovsrec_bridge, header_) : NULL;
27
static struct ovsrec_controller *
28
ovsrec_controller_cast(const struct ovsdb_idl_row *row)
30
return row ? CONTAINER_OF(row, struct ovsrec_controller, header_) : NULL;
33
static struct ovsrec_flow_sample_collector_set *
34
ovsrec_flow_sample_collector_set_cast(const struct ovsdb_idl_row *row)
36
return row ? CONTAINER_OF(row, struct ovsrec_flow_sample_collector_set, header_) : NULL;
39
static struct ovsrec_flow_table *
40
ovsrec_flow_table_cast(const struct ovsdb_idl_row *row)
42
return row ? CONTAINER_OF(row, struct ovsrec_flow_table, header_) : NULL;
45
static struct ovsrec_ipfix *
46
ovsrec_ipfix_cast(const struct ovsdb_idl_row *row)
48
return row ? CONTAINER_OF(row, struct ovsrec_ipfix, header_) : NULL;
51
static struct ovsrec_interface *
52
ovsrec_interface_cast(const struct ovsdb_idl_row *row)
54
return row ? CONTAINER_OF(row, struct ovsrec_interface, header_) : NULL;
57
static struct ovsrec_manager *
58
ovsrec_manager_cast(const struct ovsdb_idl_row *row)
60
return row ? CONTAINER_OF(row, struct ovsrec_manager, header_) : NULL;
63
static struct ovsrec_mirror *
64
ovsrec_mirror_cast(const struct ovsdb_idl_row *row)
66
return row ? CONTAINER_OF(row, struct ovsrec_mirror, header_) : NULL;
69
static struct ovsrec_netflow *
70
ovsrec_netflow_cast(const struct ovsdb_idl_row *row)
72
return row ? CONTAINER_OF(row, struct ovsrec_netflow, header_) : NULL;
75
static struct ovsrec_open_vswitch *
76
ovsrec_open_vswitch_cast(const struct ovsdb_idl_row *row)
78
return row ? CONTAINER_OF(row, struct ovsrec_open_vswitch, header_) : NULL;
81
static struct ovsrec_port *
82
ovsrec_port_cast(const struct ovsdb_idl_row *row)
84
return row ? CONTAINER_OF(row, struct ovsrec_port, header_) : NULL;
87
static struct ovsrec_qos *
88
ovsrec_qos_cast(const struct ovsdb_idl_row *row)
90
return row ? CONTAINER_OF(row, struct ovsrec_qos, header_) : NULL;
93
static struct ovsrec_queue *
94
ovsrec_queue_cast(const struct ovsdb_idl_row *row)
96
return row ? CONTAINER_OF(row, struct ovsrec_queue, header_) : NULL;
99
static struct ovsrec_ssl *
100
ovsrec_ssl_cast(const struct ovsdb_idl_row *row)
102
return row ? CONTAINER_OF(row, struct ovsrec_ssl, header_) : NULL;
105
static struct ovsrec_sflow *
106
ovsrec_sflow_cast(const struct ovsdb_idl_row *row)
108
return row ? CONTAINER_OF(row, struct ovsrec_sflow, header_) : NULL;
114
ovsrec_bridge_parse_controller(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
116
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
120
row->controller = NULL;
121
row->n_controller = 0;
122
for (i = 0; i < datum->n; i++) {
123
struct ovsrec_controller *keyRow = ovsrec_controller_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER], &datum->keys[i].uuid));
125
if (!row->n_controller) {
126
row->controller = xmalloc(datum->n * sizeof *row->controller);
128
row->controller[row->n_controller] = keyRow;
135
ovsrec_bridge_parse_datapath_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
137
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
141
row->datapath_id = datum->keys[0].string;
143
row->datapath_id = NULL;
148
ovsrec_bridge_parse_datapath_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
150
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
154
row->datapath_type = datum->keys[0].string;
156
row->datapath_type = "";
161
ovsrec_bridge_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
163
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
167
smap_init(&row->external_ids);
168
for (i = 0; i < datum->n; i++) {
169
smap_add(&row->external_ids,
170
datum->keys[i].string,
171
datum->values[i].string);
176
ovsrec_bridge_parse_fail_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
178
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
182
row->fail_mode = datum->keys[0].string;
184
row->fail_mode = NULL;
189
ovsrec_bridge_parse_flood_vlans(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
191
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
192
size_t n = MIN(4096, datum->n);
196
row->flood_vlans = NULL;
197
row->n_flood_vlans = 0;
198
for (i = 0; i < n; i++) {
199
if (!row->n_flood_vlans) {
200
row->flood_vlans = xmalloc(n * sizeof *row->flood_vlans);
202
row->flood_vlans[row->n_flood_vlans] = datum->keys[i].integer;
203
row->n_flood_vlans++;
208
ovsrec_bridge_parse_flow_tables(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
210
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
214
row->key_flow_tables = NULL;
215
row->value_flow_tables = NULL;
216
row->n_flow_tables = 0;
217
for (i = 0; i < datum->n; i++) {
218
struct ovsrec_flow_table *valueRow = ovsrec_flow_table_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE], &datum->values[i].uuid));
220
if (!row->n_flow_tables) {
221
row->key_flow_tables = xmalloc(datum->n * sizeof *row->key_flow_tables);
222
row->value_flow_tables = xmalloc(datum->n * sizeof *row->value_flow_tables);
224
row->key_flow_tables[row->n_flow_tables] = datum->keys[i].integer;
225
row->value_flow_tables[row->n_flow_tables] = valueRow;
226
row->n_flow_tables++;
232
ovsrec_bridge_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
234
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
238
row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], &datum->keys[0].uuid));
245
ovsrec_bridge_parse_mirrors(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
247
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
253
for (i = 0; i < datum->n; i++) {
254
struct ovsrec_mirror *keyRow = ovsrec_mirror_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_MIRROR], &datum->keys[i].uuid));
256
if (!row->n_mirrors) {
257
row->mirrors = xmalloc(datum->n * sizeof *row->mirrors);
259
row->mirrors[row->n_mirrors] = keyRow;
266
ovsrec_bridge_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
268
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
272
row->name = datum->keys[0].string;
279
ovsrec_bridge_parse_netflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
281
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
285
row->netflow = ovsrec_netflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW], &datum->keys[0].uuid));
292
ovsrec_bridge_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
294
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
298
smap_init(&row->other_config);
299
for (i = 0; i < datum->n; i++) {
300
smap_add(&row->other_config,
301
datum->keys[i].string,
302
datum->values[i].string);
307
ovsrec_bridge_parse_ports(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
309
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
315
for (i = 0; i < datum->n; i++) {
316
struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[i].uuid));
319
row->ports = xmalloc(datum->n * sizeof *row->ports);
321
row->ports[row->n_ports] = keyRow;
328
ovsrec_bridge_parse_protocols(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
330
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
334
row->protocols = NULL;
335
row->n_protocols = 0;
336
for (i = 0; i < datum->n; i++) {
337
if (!row->n_protocols) {
338
row->protocols = xmalloc(datum->n * sizeof *row->protocols);
340
row->protocols[row->n_protocols] = datum->keys[i].string;
346
ovsrec_bridge_parse_sflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
348
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
352
row->sflow = ovsrec_sflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_SFLOW], &datum->keys[0].uuid));
359
ovsrec_bridge_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
361
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
365
smap_init(&row->status);
366
for (i = 0; i < datum->n; i++) {
367
smap_add(&row->status,
368
datum->keys[i].string,
369
datum->values[i].string);
374
ovsrec_bridge_parse_stp_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
376
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
380
row->stp_enable = datum->keys[0].boolean;
382
row->stp_enable = false;
387
ovsrec_bridge_unparse_controller(struct ovsdb_idl_row *row_)
389
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
392
free(row->controller);
396
ovsrec_bridge_unparse_datapath_id(struct ovsdb_idl_row *row OVS_UNUSED)
402
ovsrec_bridge_unparse_datapath_type(struct ovsdb_idl_row *row OVS_UNUSED)
408
ovsrec_bridge_unparse_external_ids(struct ovsdb_idl_row *row_)
410
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
413
smap_destroy(&row->external_ids);
417
ovsrec_bridge_unparse_fail_mode(struct ovsdb_idl_row *row OVS_UNUSED)
423
ovsrec_bridge_unparse_flood_vlans(struct ovsdb_idl_row *row_)
425
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
428
free(row->flood_vlans);
432
ovsrec_bridge_unparse_flow_tables(struct ovsdb_idl_row *row_)
434
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
437
free(row->key_flow_tables);
438
free(row->value_flow_tables);
442
ovsrec_bridge_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
448
ovsrec_bridge_unparse_mirrors(struct ovsdb_idl_row *row_)
450
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
457
ovsrec_bridge_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
463
ovsrec_bridge_unparse_netflow(struct ovsdb_idl_row *row OVS_UNUSED)
469
ovsrec_bridge_unparse_other_config(struct ovsdb_idl_row *row_)
471
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
474
smap_destroy(&row->other_config);
478
ovsrec_bridge_unparse_ports(struct ovsdb_idl_row *row_)
480
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
487
ovsrec_bridge_unparse_protocols(struct ovsdb_idl_row *row_)
489
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
492
free(row->protocols);
496
ovsrec_bridge_unparse_sflow(struct ovsdb_idl_row *row OVS_UNUSED)
502
ovsrec_bridge_unparse_status(struct ovsdb_idl_row *row_)
504
struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
507
smap_destroy(&row->status);
511
ovsrec_bridge_unparse_stp_enable(struct ovsdb_idl_row *row OVS_UNUSED)
517
ovsrec_bridge_init__(struct ovsdb_idl_row *row)
519
ovsrec_bridge_init(ovsrec_bridge_cast(row));
523
ovsrec_bridge_init(struct ovsrec_bridge *row)
525
memset(row, 0, sizeof *row);
526
smap_init(&row->external_ids);
527
smap_init(&row->other_config);
528
smap_init(&row->status);
531
const struct ovsrec_bridge *
532
ovsrec_bridge_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
534
return ovsrec_bridge_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], uuid));
537
const struct ovsrec_bridge *
538
ovsrec_bridge_first(const struct ovsdb_idl *idl)
540
return ovsrec_bridge_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]));
543
const struct ovsrec_bridge *
544
ovsrec_bridge_next(const struct ovsrec_bridge *row)
546
return ovsrec_bridge_cast(ovsdb_idl_next_row(&row->header_));
550
ovsrec_bridge_delete(const struct ovsrec_bridge *row)
552
ovsdb_idl_txn_delete(&row->header_);
555
struct ovsrec_bridge *
556
ovsrec_bridge_insert(struct ovsdb_idl_txn *txn)
558
return ovsrec_bridge_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], NULL));
563
ovsrec_bridge_verify_controller(const struct ovsrec_bridge *row)
566
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_CONTROLLER]);
570
ovsrec_bridge_verify_datapath_id(const struct ovsrec_bridge *row)
573
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_ID]);
577
ovsrec_bridge_verify_datapath_type(const struct ovsrec_bridge *row)
580
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_TYPE]);
584
ovsrec_bridge_verify_external_ids(const struct ovsrec_bridge *row)
587
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_EXTERNAL_IDS]);
591
ovsrec_bridge_verify_fail_mode(const struct ovsrec_bridge *row)
594
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FAIL_MODE]);
598
ovsrec_bridge_verify_flood_vlans(const struct ovsrec_bridge *row)
601
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOOD_VLANS]);
605
ovsrec_bridge_verify_flow_tables(const struct ovsrec_bridge *row)
608
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOW_TABLES]);
612
ovsrec_bridge_verify_ipfix(const struct ovsrec_bridge *row)
615
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_IPFIX]);
619
ovsrec_bridge_verify_mirrors(const struct ovsrec_bridge *row)
622
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_MIRRORS]);
626
ovsrec_bridge_verify_name(const struct ovsrec_bridge *row)
629
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NAME]);
633
ovsrec_bridge_verify_netflow(const struct ovsrec_bridge *row)
636
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NETFLOW]);
640
ovsrec_bridge_verify_other_config(const struct ovsrec_bridge *row)
643
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_OTHER_CONFIG]);
647
ovsrec_bridge_verify_ports(const struct ovsrec_bridge *row)
650
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PORTS]);
654
ovsrec_bridge_verify_protocols(const struct ovsrec_bridge *row)
657
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PROTOCOLS]);
661
ovsrec_bridge_verify_sflow(const struct ovsrec_bridge *row)
664
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_SFLOW]);
668
ovsrec_bridge_verify_status(const struct ovsrec_bridge *row)
671
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STATUS]);
675
ovsrec_bridge_verify_stp_enable(const struct ovsrec_bridge *row)
678
ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STP_ENABLE]);
681
/* Returns the controller column's value in 'row' as a struct ovsdb_datum.
682
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
683
* easier and more efficient way to search for a given key than implementing
684
* the same operation on the "cooked" form in 'row'.
686
* 'key_type' must be OVSDB_TYPE_UUID.
687
* (This helps to avoid silent bugs if someone changes controller's
688
* type without updating the caller.)
690
* The caller must not modify or free the returned value.
692
* Various kinds of changes can invalidate the returned value: modifying
693
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
694
* If the returned value is needed for a long time, it is best to make a copy
695
* of it with ovsdb_datum_clone(). */
696
const struct ovsdb_datum *
697
ovsrec_bridge_get_controller(const struct ovsrec_bridge *row,
698
enum ovsdb_atomic_type key_type OVS_UNUSED)
700
ovs_assert(key_type == OVSDB_TYPE_UUID);
701
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_controller);
704
/* Returns the datapath_id column's value in 'row' as a struct ovsdb_datum.
705
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
706
* easier and more efficient way to search for a given key than implementing
707
* the same operation on the "cooked" form in 'row'.
709
* 'key_type' must be OVSDB_TYPE_STRING.
710
* (This helps to avoid silent bugs if someone changes datapath_id's
711
* type without updating the caller.)
713
* The caller must not modify or free the returned value.
715
* Various kinds of changes can invalidate the returned value: modifying
716
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
717
* If the returned value is needed for a long time, it is best to make a copy
718
* of it with ovsdb_datum_clone(). */
719
const struct ovsdb_datum *
720
ovsrec_bridge_get_datapath_id(const struct ovsrec_bridge *row,
721
enum ovsdb_atomic_type key_type OVS_UNUSED)
723
ovs_assert(key_type == OVSDB_TYPE_STRING);
724
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_id);
727
/* Returns the datapath_type column's value in 'row' as a struct ovsdb_datum.
728
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
729
* easier and more efficient way to search for a given key than implementing
730
* the same operation on the "cooked" form in 'row'.
732
* 'key_type' must be OVSDB_TYPE_STRING.
733
* (This helps to avoid silent bugs if someone changes datapath_type's
734
* type without updating the caller.)
736
* The caller must not modify or free the returned value.
738
* Various kinds of changes can invalidate the returned value: modifying
739
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
740
* If the returned value is needed for a long time, it is best to make a copy
741
* of it with ovsdb_datum_clone(). */
742
const struct ovsdb_datum *
743
ovsrec_bridge_get_datapath_type(const struct ovsrec_bridge *row,
744
enum ovsdb_atomic_type key_type OVS_UNUSED)
746
ovs_assert(key_type == OVSDB_TYPE_STRING);
747
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_type);
750
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
751
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
752
* easier and more efficient way to search for a given key than implementing
753
* the same operation on the "cooked" form in 'row'.
755
* 'key_type' must be OVSDB_TYPE_STRING.
756
* 'value_type' must be OVSDB_TYPE_STRING.
757
* (This helps to avoid silent bugs if someone changes external_ids's
758
* type without updating the caller.)
760
* The caller must not modify or free the returned value.
762
* Various kinds of changes can invalidate the returned value: modifying
763
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
764
* If the returned value is needed for a long time, it is best to make a copy
765
* of it with ovsdb_datum_clone(). */
766
const struct ovsdb_datum *
767
ovsrec_bridge_get_external_ids(const struct ovsrec_bridge *row,
768
enum ovsdb_atomic_type key_type OVS_UNUSED,
769
enum ovsdb_atomic_type value_type OVS_UNUSED)
771
ovs_assert(key_type == OVSDB_TYPE_STRING);
772
ovs_assert(value_type == OVSDB_TYPE_STRING);
773
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_external_ids);
776
/* Returns the fail_mode column's value in 'row' as a struct ovsdb_datum.
777
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
778
* easier and more efficient way to search for a given key than implementing
779
* the same operation on the "cooked" form in 'row'.
781
* 'key_type' must be OVSDB_TYPE_STRING.
782
* (This helps to avoid silent bugs if someone changes fail_mode's
783
* type without updating the caller.)
785
* The caller must not modify or free the returned value.
787
* Various kinds of changes can invalidate the returned value: modifying
788
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
789
* If the returned value is needed for a long time, it is best to make a copy
790
* of it with ovsdb_datum_clone(). */
791
const struct ovsdb_datum *
792
ovsrec_bridge_get_fail_mode(const struct ovsrec_bridge *row,
793
enum ovsdb_atomic_type key_type OVS_UNUSED)
795
ovs_assert(key_type == OVSDB_TYPE_STRING);
796
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_fail_mode);
799
/* Returns the flood_vlans column's value in 'row' as a struct ovsdb_datum.
800
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
801
* easier and more efficient way to search for a given key than implementing
802
* the same operation on the "cooked" form in 'row'.
804
* 'key_type' must be OVSDB_TYPE_INTEGER.
805
* (This helps to avoid silent bugs if someone changes flood_vlans's
806
* type without updating the caller.)
808
* The caller must not modify or free the returned value.
810
* Various kinds of changes can invalidate the returned value: modifying
811
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
812
* If the returned value is needed for a long time, it is best to make a copy
813
* of it with ovsdb_datum_clone(). */
814
const struct ovsdb_datum *
815
ovsrec_bridge_get_flood_vlans(const struct ovsrec_bridge *row,
816
enum ovsdb_atomic_type key_type OVS_UNUSED)
818
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
819
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flood_vlans);
822
/* Returns the flow_tables column's value in 'row' as a struct ovsdb_datum.
823
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
824
* easier and more efficient way to search for a given key than implementing
825
* the same operation on the "cooked" form in 'row'.
827
* 'key_type' must be OVSDB_TYPE_INTEGER.
828
* 'value_type' must be OVSDB_TYPE_UUID.
829
* (This helps to avoid silent bugs if someone changes flow_tables's
830
* type without updating the caller.)
832
* The caller must not modify or free the returned value.
834
* Various kinds of changes can invalidate the returned value: modifying
835
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
836
* If the returned value is needed for a long time, it is best to make a copy
837
* of it with ovsdb_datum_clone(). */
838
const struct ovsdb_datum *
839
ovsrec_bridge_get_flow_tables(const struct ovsrec_bridge *row,
840
enum ovsdb_atomic_type key_type OVS_UNUSED,
841
enum ovsdb_atomic_type value_type OVS_UNUSED)
843
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
844
ovs_assert(value_type == OVSDB_TYPE_UUID);
845
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flow_tables);
848
/* Returns the ipfix column's value in 'row' as a struct ovsdb_datum.
849
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
850
* easier and more efficient way to search for a given key than implementing
851
* the same operation on the "cooked" form in 'row'.
853
* 'key_type' must be OVSDB_TYPE_UUID.
854
* (This helps to avoid silent bugs if someone changes ipfix's
855
* type without updating the caller.)
857
* The caller must not modify or free the returned value.
859
* Various kinds of changes can invalidate the returned value: modifying
860
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
861
* If the returned value is needed for a long time, it is best to make a copy
862
* of it with ovsdb_datum_clone(). */
863
const struct ovsdb_datum *
864
ovsrec_bridge_get_ipfix(const struct ovsrec_bridge *row,
865
enum ovsdb_atomic_type key_type OVS_UNUSED)
867
ovs_assert(key_type == OVSDB_TYPE_UUID);
868
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ipfix);
871
/* Returns the mirrors column's value in 'row' as a struct ovsdb_datum.
872
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
873
* easier and more efficient way to search for a given key than implementing
874
* the same operation on the "cooked" form in 'row'.
876
* 'key_type' must be OVSDB_TYPE_UUID.
877
* (This helps to avoid silent bugs if someone changes mirrors's
878
* type without updating the caller.)
880
* The caller must not modify or free the returned value.
882
* Various kinds of changes can invalidate the returned value: modifying
883
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
884
* If the returned value is needed for a long time, it is best to make a copy
885
* of it with ovsdb_datum_clone(). */
886
const struct ovsdb_datum *
887
ovsrec_bridge_get_mirrors(const struct ovsrec_bridge *row,
888
enum ovsdb_atomic_type key_type OVS_UNUSED)
890
ovs_assert(key_type == OVSDB_TYPE_UUID);
891
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_mirrors);
894
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
895
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
896
* easier and more efficient way to search for a given key than implementing
897
* the same operation on the "cooked" form in 'row'.
899
* 'key_type' must be OVSDB_TYPE_STRING.
900
* (This helps to avoid silent bugs if someone changes name's
901
* type without updating the caller.)
903
* The caller must not modify or free the returned value.
905
* Various kinds of changes can invalidate the returned value: modifying
906
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
907
* If the returned value is needed for a long time, it is best to make a copy
908
* of it with ovsdb_datum_clone(). */
909
const struct ovsdb_datum *
910
ovsrec_bridge_get_name(const struct ovsrec_bridge *row,
911
enum ovsdb_atomic_type key_type OVS_UNUSED)
913
ovs_assert(key_type == OVSDB_TYPE_STRING);
914
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_name);
917
/* Returns the netflow column's value in 'row' as a struct ovsdb_datum.
918
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
919
* easier and more efficient way to search for a given key than implementing
920
* the same operation on the "cooked" form in 'row'.
922
* 'key_type' must be OVSDB_TYPE_UUID.
923
* (This helps to avoid silent bugs if someone changes netflow's
924
* type without updating the caller.)
926
* The caller must not modify or free the returned value.
928
* Various kinds of changes can invalidate the returned value: modifying
929
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
930
* If the returned value is needed for a long time, it is best to make a copy
931
* of it with ovsdb_datum_clone(). */
932
const struct ovsdb_datum *
933
ovsrec_bridge_get_netflow(const struct ovsrec_bridge *row,
934
enum ovsdb_atomic_type key_type OVS_UNUSED)
936
ovs_assert(key_type == OVSDB_TYPE_UUID);
937
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_netflow);
940
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
941
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
942
* easier and more efficient way to search for a given key than implementing
943
* the same operation on the "cooked" form in 'row'.
945
* 'key_type' must be OVSDB_TYPE_STRING.
946
* 'value_type' must be OVSDB_TYPE_STRING.
947
* (This helps to avoid silent bugs if someone changes other_config's
948
* type without updating the caller.)
950
* The caller must not modify or free the returned value.
952
* Various kinds of changes can invalidate the returned value: modifying
953
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
954
* If the returned value is needed for a long time, it is best to make a copy
955
* of it with ovsdb_datum_clone(). */
956
const struct ovsdb_datum *
957
ovsrec_bridge_get_other_config(const struct ovsrec_bridge *row,
958
enum ovsdb_atomic_type key_type OVS_UNUSED,
959
enum ovsdb_atomic_type value_type OVS_UNUSED)
961
ovs_assert(key_type == OVSDB_TYPE_STRING);
962
ovs_assert(value_type == OVSDB_TYPE_STRING);
963
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_other_config);
966
/* Returns the ports column's value in 'row' as a struct ovsdb_datum.
967
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
968
* easier and more efficient way to search for a given key than implementing
969
* the same operation on the "cooked" form in 'row'.
971
* 'key_type' must be OVSDB_TYPE_UUID.
972
* (This helps to avoid silent bugs if someone changes ports's
973
* type without updating the caller.)
975
* The caller must not modify or free the returned value.
977
* Various kinds of changes can invalidate the returned value: modifying
978
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
979
* If the returned value is needed for a long time, it is best to make a copy
980
* of it with ovsdb_datum_clone(). */
981
const struct ovsdb_datum *
982
ovsrec_bridge_get_ports(const struct ovsrec_bridge *row,
983
enum ovsdb_atomic_type key_type OVS_UNUSED)
985
ovs_assert(key_type == OVSDB_TYPE_UUID);
986
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ports);
989
/* Returns the protocols column's value in 'row' as a struct ovsdb_datum.
990
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
991
* easier and more efficient way to search for a given key than implementing
992
* the same operation on the "cooked" form in 'row'.
994
* 'key_type' must be OVSDB_TYPE_STRING.
995
* (This helps to avoid silent bugs if someone changes protocols's
996
* type without updating the caller.)
998
* The caller must not modify or free the returned value.
1000
* Various kinds of changes can invalidate the returned value: modifying
1001
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1002
* If the returned value is needed for a long time, it is best to make a copy
1003
* of it with ovsdb_datum_clone(). */
1004
const struct ovsdb_datum *
1005
ovsrec_bridge_get_protocols(const struct ovsrec_bridge *row,
1006
enum ovsdb_atomic_type key_type OVS_UNUSED)
1008
ovs_assert(key_type == OVSDB_TYPE_STRING);
1009
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_protocols);
1012
/* Returns the sflow column's value in 'row' as a struct ovsdb_datum.
1013
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
1014
* easier and more efficient way to search for a given key than implementing
1015
* the same operation on the "cooked" form in 'row'.
1017
* 'key_type' must be OVSDB_TYPE_UUID.
1018
* (This helps to avoid silent bugs if someone changes sflow's
1019
* type without updating the caller.)
1021
* The caller must not modify or free the returned value.
1023
* Various kinds of changes can invalidate the returned value: modifying
1024
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1025
* If the returned value is needed for a long time, it is best to make a copy
1026
* of it with ovsdb_datum_clone(). */
1027
const struct ovsdb_datum *
1028
ovsrec_bridge_get_sflow(const struct ovsrec_bridge *row,
1029
enum ovsdb_atomic_type key_type OVS_UNUSED)
1031
ovs_assert(key_type == OVSDB_TYPE_UUID);
1032
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_sflow);
1035
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
1036
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
1037
* easier and more efficient way to search for a given key than implementing
1038
* the same operation on the "cooked" form in 'row'.
1040
* 'key_type' must be OVSDB_TYPE_STRING.
1041
* 'value_type' must be OVSDB_TYPE_STRING.
1042
* (This helps to avoid silent bugs if someone changes status's
1043
* type without updating the caller.)
1045
* The caller must not modify or free the returned value.
1047
* Various kinds of changes can invalidate the returned value: modifying
1048
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1049
* If the returned value is needed for a long time, it is best to make a copy
1050
* of it with ovsdb_datum_clone(). */
1051
const struct ovsdb_datum *
1052
ovsrec_bridge_get_status(const struct ovsrec_bridge *row,
1053
enum ovsdb_atomic_type key_type OVS_UNUSED,
1054
enum ovsdb_atomic_type value_type OVS_UNUSED)
1056
ovs_assert(key_type == OVSDB_TYPE_STRING);
1057
ovs_assert(value_type == OVSDB_TYPE_STRING);
1058
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_status);
1061
/* Returns the stp_enable column's value in 'row' as a struct ovsdb_datum.
1062
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
1063
* easier and more efficient way to search for a given key than implementing
1064
* the same operation on the "cooked" form in 'row'.
1066
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
1067
* (This helps to avoid silent bugs if someone changes stp_enable's
1068
* type without updating the caller.)
1070
* The caller must not modify or free the returned value.
1072
* Various kinds of changes can invalidate the returned value: modifying
1073
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1074
* If the returned value is needed for a long time, it is best to make a copy
1075
* of it with ovsdb_datum_clone(). */
1076
const struct ovsdb_datum *
1077
ovsrec_bridge_get_stp_enable(const struct ovsrec_bridge *row,
1078
enum ovsdb_atomic_type key_type OVS_UNUSED)
1080
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
1081
return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_stp_enable);
1085
ovsrec_bridge_set_controller(const struct ovsrec_bridge *row, struct ovsrec_controller **controller, size_t n_controller)
1087
struct ovsdb_datum datum;
1091
datum.n = n_controller;
1092
datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
1093
datum.values = NULL;
1094
for (i = 0; i < n_controller; i++) {
1095
datum.keys[i].uuid = controller[i]->header_.uuid;
1097
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1098
ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_CONTROLLER], &datum);
1102
ovsrec_bridge_set_datapath_id(const struct ovsrec_bridge *row, const char *datapath_id)
1104
struct ovsdb_datum datum;
1105
union ovsdb_atom key;
1111
key.string = CONST_CAST(char *, datapath_id);
1116
datum.values = NULL;
1117
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_ID], &datum);
1121
ovsrec_bridge_set_datapath_type(const struct ovsrec_bridge *row, const char *datapath_type)
1123
struct ovsdb_datum datum;
1124
union ovsdb_atom key;
1129
key.string = CONST_CAST(char *, datapath_type);
1130
datum.values = NULL;
1131
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_TYPE], &datum);
1135
ovsrec_bridge_set_external_ids(const struct ovsrec_bridge *row, const struct smap *smap)
1137
struct ovsdb_datum datum;
1141
struct smap_node *node;
1144
datum.n = smap_count(smap);
1145
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1146
datum.values = xmalloc(datum.n * sizeof *datum.values);
1149
SMAP_FOR_EACH (node, smap) {
1150
datum.keys[i].string = xstrdup(node->key);
1151
datum.values[i].string = xstrdup(node->value);
1154
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1156
ovsdb_datum_init_empty(&datum);
1158
ovsdb_idl_txn_write(&row->header_,
1159
&ovsrec_bridge_columns[OVSREC_BRIDGE_COL_EXTERNAL_IDS],
1165
ovsrec_bridge_set_fail_mode(const struct ovsrec_bridge *row, const char *fail_mode)
1167
struct ovsdb_datum datum;
1168
union ovsdb_atom key;
1174
key.string = CONST_CAST(char *, fail_mode);
1179
datum.values = NULL;
1180
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FAIL_MODE], &datum);
1184
ovsrec_bridge_set_flood_vlans(const struct ovsrec_bridge *row, const int64_t *flood_vlans, size_t n_flood_vlans)
1186
struct ovsdb_datum datum;
1190
datum.n = n_flood_vlans;
1191
datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
1192
datum.values = NULL;
1193
for (i = 0; i < n_flood_vlans; i++) {
1194
datum.keys[i].integer = flood_vlans[i];
1196
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
1197
ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOOD_VLANS], &datum);
1201
ovsrec_bridge_set_flow_tables(const struct ovsrec_bridge *row, const int64_t *key_flow_tables, struct ovsrec_flow_table **value_flow_tables, size_t n_flow_tables)
1203
struct ovsdb_datum datum;
1207
datum.n = n_flow_tables;
1208
datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
1209
datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
1210
for (i = 0; i < n_flow_tables; i++) {
1211
datum.keys[i].integer = key_flow_tables[i];
1212
datum.values[i].uuid = value_flow_tables[i]->header_.uuid;
1214
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_UUID);
1215
ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOW_TABLES], &datum);
1219
ovsrec_bridge_set_ipfix(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *ipfix)
1221
struct ovsdb_datum datum;
1222
union ovsdb_atom key;
1228
key.uuid = ipfix->header_.uuid;
1233
datum.values = NULL;
1234
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_IPFIX], &datum);
1238
ovsrec_bridge_set_mirrors(const struct ovsrec_bridge *row, struct ovsrec_mirror **mirrors, size_t n_mirrors)
1240
struct ovsdb_datum datum;
1244
datum.n = n_mirrors;
1245
datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
1246
datum.values = NULL;
1247
for (i = 0; i < n_mirrors; i++) {
1248
datum.keys[i].uuid = mirrors[i]->header_.uuid;
1250
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1251
ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_MIRRORS], &datum);
1255
ovsrec_bridge_set_name(const struct ovsrec_bridge *row, const char *name)
1257
struct ovsdb_datum datum;
1258
union ovsdb_atom key;
1263
key.string = CONST_CAST(char *, name);
1264
datum.values = NULL;
1265
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NAME], &datum);
1269
ovsrec_bridge_set_netflow(const struct ovsrec_bridge *row, const struct ovsrec_netflow *netflow)
1271
struct ovsdb_datum datum;
1272
union ovsdb_atom key;
1278
key.uuid = netflow->header_.uuid;
1283
datum.values = NULL;
1284
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NETFLOW], &datum);
1288
ovsrec_bridge_set_other_config(const struct ovsrec_bridge *row, const struct smap *smap)
1290
struct ovsdb_datum datum;
1294
struct smap_node *node;
1297
datum.n = smap_count(smap);
1298
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1299
datum.values = xmalloc(datum.n * sizeof *datum.values);
1302
SMAP_FOR_EACH (node, smap) {
1303
datum.keys[i].string = xstrdup(node->key);
1304
datum.values[i].string = xstrdup(node->value);
1307
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1309
ovsdb_datum_init_empty(&datum);
1311
ovsdb_idl_txn_write(&row->header_,
1312
&ovsrec_bridge_columns[OVSREC_BRIDGE_COL_OTHER_CONFIG],
1318
ovsrec_bridge_set_ports(const struct ovsrec_bridge *row, struct ovsrec_port **ports, size_t n_ports)
1320
struct ovsdb_datum datum;
1325
datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
1326
datum.values = NULL;
1327
for (i = 0; i < n_ports; i++) {
1328
datum.keys[i].uuid = ports[i]->header_.uuid;
1330
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1331
ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PORTS], &datum);
1335
ovsrec_bridge_set_protocols(const struct ovsrec_bridge *row, char **protocols, size_t n_protocols)
1337
struct ovsdb_datum datum;
1341
datum.n = n_protocols;
1342
datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
1343
datum.values = NULL;
1344
for (i = 0; i < n_protocols; i++) {
1345
datum.keys[i].string = xstrdup(protocols[i]);
1347
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1348
ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PROTOCOLS], &datum);
1352
ovsrec_bridge_set_sflow(const struct ovsrec_bridge *row, const struct ovsrec_sflow *sflow)
1354
struct ovsdb_datum datum;
1355
union ovsdb_atom key;
1361
key.uuid = sflow->header_.uuid;
1366
datum.values = NULL;
1367
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_SFLOW], &datum);
1371
ovsrec_bridge_set_status(const struct ovsrec_bridge *row, const struct smap *smap)
1373
struct ovsdb_datum datum;
1377
struct smap_node *node;
1380
datum.n = smap_count(smap);
1381
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1382
datum.values = xmalloc(datum.n * sizeof *datum.values);
1385
SMAP_FOR_EACH (node, smap) {
1386
datum.keys[i].string = xstrdup(node->key);
1387
datum.values[i].string = xstrdup(node->value);
1390
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1392
ovsdb_datum_init_empty(&datum);
1394
ovsdb_idl_txn_write(&row->header_,
1395
&ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STATUS],
1401
ovsrec_bridge_set_stp_enable(const struct ovsrec_bridge *row, bool stp_enable)
1403
struct ovsdb_datum datum;
1404
union ovsdb_atom key;
1409
key.boolean = stp_enable;
1410
datum.values = NULL;
1411
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STP_ENABLE], &datum);
1414
struct ovsdb_idl_column ovsrec_bridge_columns[OVSREC_BRIDGE_N_COLUMNS];
1417
ovsrec_bridge_columns_init(void)
1419
struct ovsdb_idl_column *c;
1421
/* Initialize ovsrec_bridge_col_controller. */
1422
c = &ovsrec_bridge_col_controller;
1423
c->name = "controller";
1424
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1425
c->type.key.u.uuid.refTableName = "Controller";
1426
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1427
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1429
c->type.n_max = UINT_MAX;
1431
c->parse = ovsrec_bridge_parse_controller;
1432
c->unparse = ovsrec_bridge_unparse_controller;
1434
/* Initialize ovsrec_bridge_col_datapath_id. */
1435
c = &ovsrec_bridge_col_datapath_id;
1436
c->name = "datapath_id";
1437
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1438
c->type.key.u.string.minLen = 0;
1439
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1443
c->parse = ovsrec_bridge_parse_datapath_id;
1444
c->unparse = ovsrec_bridge_unparse_datapath_id;
1446
/* Initialize ovsrec_bridge_col_datapath_type. */
1447
c = &ovsrec_bridge_col_datapath_type;
1448
c->name = "datapath_type";
1449
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1450
c->type.key.u.string.minLen = 0;
1451
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1455
c->parse = ovsrec_bridge_parse_datapath_type;
1456
c->unparse = ovsrec_bridge_unparse_datapath_type;
1458
/* Initialize ovsrec_bridge_col_external_ids. */
1459
c = &ovsrec_bridge_col_external_ids;
1460
c->name = "external_ids";
1461
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1462
c->type.key.u.string.minLen = 0;
1463
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1464
c->type.value.u.string.minLen = 0;
1466
c->type.n_max = UINT_MAX;
1468
c->parse = ovsrec_bridge_parse_external_ids;
1469
c->unparse = ovsrec_bridge_unparse_external_ids;
1471
/* Initialize ovsrec_bridge_col_fail_mode. */
1472
c = &ovsrec_bridge_col_fail_mode;
1473
c->name = "fail_mode";
1474
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1475
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
1476
c->type.key.enum_->n = 2;
1477
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
1478
c->type.key.enum_->keys[0].string = xstrdup("secure");
1479
c->type.key.enum_->keys[1].string = xstrdup("standalone");
1480
c->type.key.enum_->values = NULL;
1481
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
1482
c->type.key.u.string.minLen = 0;
1483
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1487
c->parse = ovsrec_bridge_parse_fail_mode;
1488
c->unparse = ovsrec_bridge_unparse_fail_mode;
1490
/* Initialize ovsrec_bridge_col_flood_vlans. */
1491
c = &ovsrec_bridge_col_flood_vlans;
1492
c->name = "flood_vlans";
1493
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
1494
c->type.key.u.integer.min = INT64_C(0);
1495
c->type.key.u.integer.max = INT64_C(4095);
1496
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1498
c->type.n_max = 4096;
1500
c->parse = ovsrec_bridge_parse_flood_vlans;
1501
c->unparse = ovsrec_bridge_unparse_flood_vlans;
1503
/* Initialize ovsrec_bridge_col_flow_tables. */
1504
c = &ovsrec_bridge_col_flow_tables;
1505
c->name = "flow_tables";
1506
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
1507
c->type.key.u.integer.min = INT64_C(0);
1508
c->type.key.u.integer.max = INT64_C(254);
1509
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_UUID);
1510
c->type.value.u.uuid.refTableName = "Flow_Table";
1511
c->type.value.u.uuid.refType = OVSDB_REF_STRONG;
1513
c->type.n_max = UINT_MAX;
1515
c->parse = ovsrec_bridge_parse_flow_tables;
1516
c->unparse = ovsrec_bridge_unparse_flow_tables;
1518
/* Initialize ovsrec_bridge_col_ipfix. */
1519
c = &ovsrec_bridge_col_ipfix;
1521
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1522
c->type.key.u.uuid.refTableName = "IPFIX";
1523
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1524
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1528
c->parse = ovsrec_bridge_parse_ipfix;
1529
c->unparse = ovsrec_bridge_unparse_ipfix;
1531
/* Initialize ovsrec_bridge_col_mirrors. */
1532
c = &ovsrec_bridge_col_mirrors;
1533
c->name = "mirrors";
1534
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1535
c->type.key.u.uuid.refTableName = "Mirror";
1536
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1537
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1539
c->type.n_max = UINT_MAX;
1541
c->parse = ovsrec_bridge_parse_mirrors;
1542
c->unparse = ovsrec_bridge_unparse_mirrors;
1544
/* Initialize ovsrec_bridge_col_name. */
1545
c = &ovsrec_bridge_col_name;
1547
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1548
c->type.key.u.string.minLen = 0;
1549
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1553
c->parse = ovsrec_bridge_parse_name;
1554
c->unparse = ovsrec_bridge_unparse_name;
1556
/* Initialize ovsrec_bridge_col_netflow. */
1557
c = &ovsrec_bridge_col_netflow;
1558
c->name = "netflow";
1559
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1560
c->type.key.u.uuid.refTableName = "NetFlow";
1561
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1562
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1566
c->parse = ovsrec_bridge_parse_netflow;
1567
c->unparse = ovsrec_bridge_unparse_netflow;
1569
/* Initialize ovsrec_bridge_col_other_config. */
1570
c = &ovsrec_bridge_col_other_config;
1571
c->name = "other_config";
1572
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1573
c->type.key.u.string.minLen = 0;
1574
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1575
c->type.value.u.string.minLen = 0;
1577
c->type.n_max = UINT_MAX;
1579
c->parse = ovsrec_bridge_parse_other_config;
1580
c->unparse = ovsrec_bridge_unparse_other_config;
1582
/* Initialize ovsrec_bridge_col_ports. */
1583
c = &ovsrec_bridge_col_ports;
1585
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1586
c->type.key.u.uuid.refTableName = "Port";
1587
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1588
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1590
c->type.n_max = UINT_MAX;
1592
c->parse = ovsrec_bridge_parse_ports;
1593
c->unparse = ovsrec_bridge_unparse_ports;
1595
/* Initialize ovsrec_bridge_col_protocols. */
1596
c = &ovsrec_bridge_col_protocols;
1597
c->name = "protocols";
1598
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1599
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
1600
c->type.key.enum_->n = 6;
1601
c->type.key.enum_->keys = xmalloc(6 * sizeof *c->type.key.enum_->keys);
1602
c->type.key.enum_->keys[0].string = xstrdup("OpenFlow10");
1603
c->type.key.enum_->keys[1].string = xstrdup("OpenFlow11");
1604
c->type.key.enum_->keys[2].string = xstrdup("OpenFlow12");
1605
c->type.key.enum_->keys[3].string = xstrdup("OpenFlow13");
1606
c->type.key.enum_->keys[4].string = xstrdup("OpenFlow14");
1607
c->type.key.enum_->keys[5].string = xstrdup("OpenFlow15");
1608
c->type.key.enum_->values = NULL;
1609
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
1610
c->type.key.u.string.minLen = 0;
1611
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1613
c->type.n_max = UINT_MAX;
1615
c->parse = ovsrec_bridge_parse_protocols;
1616
c->unparse = ovsrec_bridge_unparse_protocols;
1618
/* Initialize ovsrec_bridge_col_sflow. */
1619
c = &ovsrec_bridge_col_sflow;
1621
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1622
c->type.key.u.uuid.refTableName = "sFlow";
1623
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1624
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1628
c->parse = ovsrec_bridge_parse_sflow;
1629
c->unparse = ovsrec_bridge_unparse_sflow;
1631
/* Initialize ovsrec_bridge_col_status. */
1632
c = &ovsrec_bridge_col_status;
1634
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1635
c->type.key.u.string.minLen = 0;
1636
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1637
c->type.value.u.string.minLen = 0;
1639
c->type.n_max = UINT_MAX;
1641
c->parse = ovsrec_bridge_parse_status;
1642
c->unparse = ovsrec_bridge_unparse_status;
1644
/* Initialize ovsrec_bridge_col_stp_enable. */
1645
c = &ovsrec_bridge_col_stp_enable;
1646
c->name = "stp_enable";
1647
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
1648
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1652
c->parse = ovsrec_bridge_parse_stp_enable;
1653
c->unparse = ovsrec_bridge_unparse_stp_enable;
1656
/* Controller table. */
1659
ovsrec_controller_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1661
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1664
if (datum->n >= 1) {
1665
row->connection_mode = datum->keys[0].string;
1667
row->connection_mode = NULL;
1672
ovsrec_controller_parse_controller_burst_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1674
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1675
size_t n = MIN(1, datum->n);
1679
row->controller_burst_limit = NULL;
1680
row->n_controller_burst_limit = 0;
1681
for (i = 0; i < n; i++) {
1682
if (!row->n_controller_burst_limit) {
1683
row->controller_burst_limit = xmalloc(n * sizeof *row->controller_burst_limit);
1685
row->controller_burst_limit[row->n_controller_burst_limit] = datum->keys[i].integer;
1686
row->n_controller_burst_limit++;
1691
ovsrec_controller_parse_controller_rate_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1693
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1694
size_t n = MIN(1, datum->n);
1698
row->controller_rate_limit = NULL;
1699
row->n_controller_rate_limit = 0;
1700
for (i = 0; i < n; i++) {
1701
if (!row->n_controller_rate_limit) {
1702
row->controller_rate_limit = xmalloc(n * sizeof *row->controller_rate_limit);
1704
row->controller_rate_limit[row->n_controller_rate_limit] = datum->keys[i].integer;
1705
row->n_controller_rate_limit++;
1710
ovsrec_controller_parse_enable_async_messages(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1712
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1713
size_t n = MIN(1, datum->n);
1717
row->enable_async_messages = NULL;
1718
row->n_enable_async_messages = 0;
1719
for (i = 0; i < n; i++) {
1720
if (!row->n_enable_async_messages) {
1721
row->enable_async_messages = xmalloc(n * sizeof_bool);
1723
row->enable_async_messages[row->n_enable_async_messages] = datum->keys[i].boolean;
1724
row->n_enable_async_messages++;
1729
ovsrec_controller_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1731
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1735
smap_init(&row->external_ids);
1736
for (i = 0; i < datum->n; i++) {
1737
smap_add(&row->external_ids,
1738
datum->keys[i].string,
1739
datum->values[i].string);
1744
ovsrec_controller_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1746
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1747
size_t n = MIN(1, datum->n);
1751
row->inactivity_probe = NULL;
1752
row->n_inactivity_probe = 0;
1753
for (i = 0; i < n; i++) {
1754
if (!row->n_inactivity_probe) {
1755
row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
1757
row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
1758
row->n_inactivity_probe++;
1763
ovsrec_controller_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1765
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1768
if (datum->n >= 1) {
1769
row->is_connected = datum->keys[0].boolean;
1771
row->is_connected = false;
1776
ovsrec_controller_parse_local_gateway(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1778
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1781
if (datum->n >= 1) {
1782
row->local_gateway = datum->keys[0].string;
1784
row->local_gateway = NULL;
1789
ovsrec_controller_parse_local_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1791
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1794
if (datum->n >= 1) {
1795
row->local_ip = datum->keys[0].string;
1797
row->local_ip = NULL;
1802
ovsrec_controller_parse_local_netmask(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1804
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1807
if (datum->n >= 1) {
1808
row->local_netmask = datum->keys[0].string;
1810
row->local_netmask = NULL;
1815
ovsrec_controller_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1817
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1818
size_t n = MIN(1, datum->n);
1822
row->max_backoff = NULL;
1823
row->n_max_backoff = 0;
1824
for (i = 0; i < n; i++) {
1825
if (!row->n_max_backoff) {
1826
row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
1828
row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
1829
row->n_max_backoff++;
1834
ovsrec_controller_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1836
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1840
smap_init(&row->other_config);
1841
for (i = 0; i < datum->n; i++) {
1842
smap_add(&row->other_config,
1843
datum->keys[i].string,
1844
datum->values[i].string);
1849
ovsrec_controller_parse_role(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1851
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1854
if (datum->n >= 1) {
1855
row->role = datum->keys[0].string;
1862
ovsrec_controller_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1864
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1868
smap_init(&row->status);
1869
for (i = 0; i < datum->n; i++) {
1870
smap_add(&row->status,
1871
datum->keys[i].string,
1872
datum->values[i].string);
1877
ovsrec_controller_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1879
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1882
if (datum->n >= 1) {
1883
row->target = datum->keys[0].string;
1890
ovsrec_controller_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
1892
/* Nothing to do. */
1896
ovsrec_controller_unparse_controller_burst_limit(struct ovsdb_idl_row *row_)
1898
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1901
free(row->controller_burst_limit);
1905
ovsrec_controller_unparse_controller_rate_limit(struct ovsdb_idl_row *row_)
1907
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1910
free(row->controller_rate_limit);
1914
ovsrec_controller_unparse_enable_async_messages(struct ovsdb_idl_row *row_)
1916
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1919
free(row->enable_async_messages);
1923
ovsrec_controller_unparse_external_ids(struct ovsdb_idl_row *row_)
1925
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1928
smap_destroy(&row->external_ids);
1932
ovsrec_controller_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
1934
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1937
free(row->inactivity_probe);
1941
ovsrec_controller_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
1943
/* Nothing to do. */
1947
ovsrec_controller_unparse_local_gateway(struct ovsdb_idl_row *row OVS_UNUSED)
1949
/* Nothing to do. */
1953
ovsrec_controller_unparse_local_ip(struct ovsdb_idl_row *row OVS_UNUSED)
1955
/* Nothing to do. */
1959
ovsrec_controller_unparse_local_netmask(struct ovsdb_idl_row *row OVS_UNUSED)
1961
/* Nothing to do. */
1965
ovsrec_controller_unparse_max_backoff(struct ovsdb_idl_row *row_)
1967
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1970
free(row->max_backoff);
1974
ovsrec_controller_unparse_other_config(struct ovsdb_idl_row *row_)
1976
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1979
smap_destroy(&row->other_config);
1983
ovsrec_controller_unparse_role(struct ovsdb_idl_row *row OVS_UNUSED)
1985
/* Nothing to do. */
1989
ovsrec_controller_unparse_status(struct ovsdb_idl_row *row_)
1991
struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1994
smap_destroy(&row->status);
1998
ovsrec_controller_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
2000
/* Nothing to do. */
2004
ovsrec_controller_init__(struct ovsdb_idl_row *row)
2006
ovsrec_controller_init(ovsrec_controller_cast(row));
2010
ovsrec_controller_init(struct ovsrec_controller *row)
2012
memset(row, 0, sizeof *row);
2013
smap_init(&row->external_ids);
2014
smap_init(&row->other_config);
2015
smap_init(&row->status);
2018
const struct ovsrec_controller *
2019
ovsrec_controller_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
2021
return ovsrec_controller_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER], uuid));
2024
const struct ovsrec_controller *
2025
ovsrec_controller_first(const struct ovsdb_idl *idl)
2027
return ovsrec_controller_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]));
2030
const struct ovsrec_controller *
2031
ovsrec_controller_next(const struct ovsrec_controller *row)
2033
return ovsrec_controller_cast(ovsdb_idl_next_row(&row->header_));
2037
ovsrec_controller_delete(const struct ovsrec_controller *row)
2039
ovsdb_idl_txn_delete(&row->header_);
2042
struct ovsrec_controller *
2043
ovsrec_controller_insert(struct ovsdb_idl_txn *txn)
2045
return ovsrec_controller_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER], NULL));
2050
ovsrec_controller_verify_connection_mode(const struct ovsrec_controller *row)
2053
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONNECTION_MODE]);
2057
ovsrec_controller_verify_controller_burst_limit(const struct ovsrec_controller *row)
2060
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_BURST_LIMIT]);
2064
ovsrec_controller_verify_controller_rate_limit(const struct ovsrec_controller *row)
2067
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_RATE_LIMIT]);
2071
ovsrec_controller_verify_enable_async_messages(const struct ovsrec_controller *row)
2074
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ENABLE_ASYNC_MESSAGES]);
2078
ovsrec_controller_verify_external_ids(const struct ovsrec_controller *row)
2081
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_EXTERNAL_IDS]);
2085
ovsrec_controller_verify_inactivity_probe(const struct ovsrec_controller *row)
2088
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_INACTIVITY_PROBE]);
2092
ovsrec_controller_verify_is_connected(const struct ovsrec_controller *row)
2095
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_IS_CONNECTED]);
2099
ovsrec_controller_verify_local_gateway(const struct ovsrec_controller *row)
2102
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_GATEWAY]);
2106
ovsrec_controller_verify_local_ip(const struct ovsrec_controller *row)
2109
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_IP]);
2113
ovsrec_controller_verify_local_netmask(const struct ovsrec_controller *row)
2116
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_NETMASK]);
2120
ovsrec_controller_verify_max_backoff(const struct ovsrec_controller *row)
2123
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_MAX_BACKOFF]);
2127
ovsrec_controller_verify_other_config(const struct ovsrec_controller *row)
2130
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_OTHER_CONFIG]);
2134
ovsrec_controller_verify_role(const struct ovsrec_controller *row)
2137
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ROLE]);
2141
ovsrec_controller_verify_status(const struct ovsrec_controller *row)
2144
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_STATUS]);
2148
ovsrec_controller_verify_target(const struct ovsrec_controller *row)
2151
ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_TARGET]);
2154
/* Returns the connection_mode column's value in 'row' as a struct ovsdb_datum.
2155
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2156
* easier and more efficient way to search for a given key than implementing
2157
* the same operation on the "cooked" form in 'row'.
2159
* 'key_type' must be OVSDB_TYPE_STRING.
2160
* (This helps to avoid silent bugs if someone changes connection_mode's
2161
* type without updating the caller.)
2163
* The caller must not modify or free the returned value.
2165
* Various kinds of changes can invalidate the returned value: modifying
2166
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2167
* If the returned value is needed for a long time, it is best to make a copy
2168
* of it with ovsdb_datum_clone(). */
2169
const struct ovsdb_datum *
2170
ovsrec_controller_get_connection_mode(const struct ovsrec_controller *row,
2171
enum ovsdb_atomic_type key_type OVS_UNUSED)
2173
ovs_assert(key_type == OVSDB_TYPE_STRING);
2174
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_connection_mode);
2177
/* Returns the controller_burst_limit column's value in 'row' as a struct ovsdb_datum.
2178
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2179
* easier and more efficient way to search for a given key than implementing
2180
* the same operation on the "cooked" form in 'row'.
2182
* 'key_type' must be OVSDB_TYPE_INTEGER.
2183
* (This helps to avoid silent bugs if someone changes controller_burst_limit's
2184
* type without updating the caller.)
2186
* The caller must not modify or free the returned value.
2188
* Various kinds of changes can invalidate the returned value: modifying
2189
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2190
* If the returned value is needed for a long time, it is best to make a copy
2191
* of it with ovsdb_datum_clone(). */
2192
const struct ovsdb_datum *
2193
ovsrec_controller_get_controller_burst_limit(const struct ovsrec_controller *row,
2194
enum ovsdb_atomic_type key_type OVS_UNUSED)
2196
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2197
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_burst_limit);
2200
/* Returns the controller_rate_limit column's value in 'row' as a struct ovsdb_datum.
2201
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2202
* easier and more efficient way to search for a given key than implementing
2203
* the same operation on the "cooked" form in 'row'.
2205
* 'key_type' must be OVSDB_TYPE_INTEGER.
2206
* (This helps to avoid silent bugs if someone changes controller_rate_limit's
2207
* type without updating the caller.)
2209
* The caller must not modify or free the returned value.
2211
* Various kinds of changes can invalidate the returned value: modifying
2212
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2213
* If the returned value is needed for a long time, it is best to make a copy
2214
* of it with ovsdb_datum_clone(). */
2215
const struct ovsdb_datum *
2216
ovsrec_controller_get_controller_rate_limit(const struct ovsrec_controller *row,
2217
enum ovsdb_atomic_type key_type OVS_UNUSED)
2219
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2220
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_rate_limit);
2223
/* Returns the enable_async_messages column's value in 'row' as a struct ovsdb_datum.
2224
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2225
* easier and more efficient way to search for a given key than implementing
2226
* the same operation on the "cooked" form in 'row'.
2228
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
2229
* (This helps to avoid silent bugs if someone changes enable_async_messages's
2230
* type without updating the caller.)
2232
* The caller must not modify or free the returned value.
2234
* Various kinds of changes can invalidate the returned value: modifying
2235
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2236
* If the returned value is needed for a long time, it is best to make a copy
2237
* of it with ovsdb_datum_clone(). */
2238
const struct ovsdb_datum *
2239
ovsrec_controller_get_enable_async_messages(const struct ovsrec_controller *row,
2240
enum ovsdb_atomic_type key_type OVS_UNUSED)
2242
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2243
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_enable_async_messages);
2246
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
2247
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2248
* easier and more efficient way to search for a given key than implementing
2249
* the same operation on the "cooked" form in 'row'.
2251
* 'key_type' must be OVSDB_TYPE_STRING.
2252
* 'value_type' must be OVSDB_TYPE_STRING.
2253
* (This helps to avoid silent bugs if someone changes external_ids's
2254
* type without updating the caller.)
2256
* The caller must not modify or free the returned value.
2258
* Various kinds of changes can invalidate the returned value: modifying
2259
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2260
* If the returned value is needed for a long time, it is best to make a copy
2261
* of it with ovsdb_datum_clone(). */
2262
const struct ovsdb_datum *
2263
ovsrec_controller_get_external_ids(const struct ovsrec_controller *row,
2264
enum ovsdb_atomic_type key_type OVS_UNUSED,
2265
enum ovsdb_atomic_type value_type OVS_UNUSED)
2267
ovs_assert(key_type == OVSDB_TYPE_STRING);
2268
ovs_assert(value_type == OVSDB_TYPE_STRING);
2269
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_external_ids);
2272
/* Returns the inactivity_probe column's value in 'row' as a struct ovsdb_datum.
2273
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2274
* easier and more efficient way to search for a given key than implementing
2275
* the same operation on the "cooked" form in 'row'.
2277
* 'key_type' must be OVSDB_TYPE_INTEGER.
2278
* (This helps to avoid silent bugs if someone changes inactivity_probe's
2279
* type without updating the caller.)
2281
* The caller must not modify or free the returned value.
2283
* Various kinds of changes can invalidate the returned value: modifying
2284
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2285
* If the returned value is needed for a long time, it is best to make a copy
2286
* of it with ovsdb_datum_clone(). */
2287
const struct ovsdb_datum *
2288
ovsrec_controller_get_inactivity_probe(const struct ovsrec_controller *row,
2289
enum ovsdb_atomic_type key_type OVS_UNUSED)
2291
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2292
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_inactivity_probe);
2295
/* Returns the is_connected column's value in 'row' as a struct ovsdb_datum.
2296
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2297
* easier and more efficient way to search for a given key than implementing
2298
* the same operation on the "cooked" form in 'row'.
2300
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
2301
* (This helps to avoid silent bugs if someone changes is_connected's
2302
* type without updating the caller.)
2304
* The caller must not modify or free the returned value.
2306
* Various kinds of changes can invalidate the returned value: modifying
2307
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2308
* If the returned value is needed for a long time, it is best to make a copy
2309
* of it with ovsdb_datum_clone(). */
2310
const struct ovsdb_datum *
2311
ovsrec_controller_get_is_connected(const struct ovsrec_controller *row,
2312
enum ovsdb_atomic_type key_type OVS_UNUSED)
2314
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2315
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_is_connected);
2318
/* Returns the local_gateway column's value in 'row' as a struct ovsdb_datum.
2319
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2320
* easier and more efficient way to search for a given key than implementing
2321
* the same operation on the "cooked" form in 'row'.
2323
* 'key_type' must be OVSDB_TYPE_STRING.
2324
* (This helps to avoid silent bugs if someone changes local_gateway's
2325
* type without updating the caller.)
2327
* The caller must not modify or free the returned value.
2329
* Various kinds of changes can invalidate the returned value: modifying
2330
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2331
* If the returned value is needed for a long time, it is best to make a copy
2332
* of it with ovsdb_datum_clone(). */
2333
const struct ovsdb_datum *
2334
ovsrec_controller_get_local_gateway(const struct ovsrec_controller *row,
2335
enum ovsdb_atomic_type key_type OVS_UNUSED)
2337
ovs_assert(key_type == OVSDB_TYPE_STRING);
2338
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_gateway);
2341
/* Returns the local_ip column's value in 'row' as a struct ovsdb_datum.
2342
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2343
* easier and more efficient way to search for a given key than implementing
2344
* the same operation on the "cooked" form in 'row'.
2346
* 'key_type' must be OVSDB_TYPE_STRING.
2347
* (This helps to avoid silent bugs if someone changes local_ip's
2348
* type without updating the caller.)
2350
* The caller must not modify or free the returned value.
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
const struct ovsdb_datum *
2357
ovsrec_controller_get_local_ip(const struct ovsrec_controller *row,
2358
enum ovsdb_atomic_type key_type OVS_UNUSED)
2360
ovs_assert(key_type == OVSDB_TYPE_STRING);
2361
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_ip);
2364
/* Returns the local_netmask column's value in 'row' as a struct ovsdb_datum.
2365
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2366
* easier and more efficient way to search for a given key than implementing
2367
* the same operation on the "cooked" form in 'row'.
2369
* 'key_type' must be OVSDB_TYPE_STRING.
2370
* (This helps to avoid silent bugs if someone changes local_netmask's
2371
* type without updating the caller.)
2373
* The caller must not modify or free the returned value.
2375
* Various kinds of changes can invalidate the returned value: modifying
2376
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2377
* If the returned value is needed for a long time, it is best to make a copy
2378
* of it with ovsdb_datum_clone(). */
2379
const struct ovsdb_datum *
2380
ovsrec_controller_get_local_netmask(const struct ovsrec_controller *row,
2381
enum ovsdb_atomic_type key_type OVS_UNUSED)
2383
ovs_assert(key_type == OVSDB_TYPE_STRING);
2384
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_netmask);
2387
/* Returns the max_backoff column's value in 'row' as a struct ovsdb_datum.
2388
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2389
* easier and more efficient way to search for a given key than implementing
2390
* the same operation on the "cooked" form in 'row'.
2392
* 'key_type' must be OVSDB_TYPE_INTEGER.
2393
* (This helps to avoid silent bugs if someone changes max_backoff's
2394
* type without updating the caller.)
2396
* The caller must not modify or free the returned value.
2398
* Various kinds of changes can invalidate the returned value: modifying
2399
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2400
* If the returned value is needed for a long time, it is best to make a copy
2401
* of it with ovsdb_datum_clone(). */
2402
const struct ovsdb_datum *
2403
ovsrec_controller_get_max_backoff(const struct ovsrec_controller *row,
2404
enum ovsdb_atomic_type key_type OVS_UNUSED)
2406
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2407
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_max_backoff);
2410
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
2411
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2412
* easier and more efficient way to search for a given key than implementing
2413
* the same operation on the "cooked" form in 'row'.
2415
* 'key_type' must be OVSDB_TYPE_STRING.
2416
* 'value_type' must be OVSDB_TYPE_STRING.
2417
* (This helps to avoid silent bugs if someone changes other_config's
2418
* type without updating the caller.)
2420
* The caller must not modify or free the returned value.
2422
* Various kinds of changes can invalidate the returned value: modifying
2423
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2424
* If the returned value is needed for a long time, it is best to make a copy
2425
* of it with ovsdb_datum_clone(). */
2426
const struct ovsdb_datum *
2427
ovsrec_controller_get_other_config(const struct ovsrec_controller *row,
2428
enum ovsdb_atomic_type key_type OVS_UNUSED,
2429
enum ovsdb_atomic_type value_type OVS_UNUSED)
2431
ovs_assert(key_type == OVSDB_TYPE_STRING);
2432
ovs_assert(value_type == OVSDB_TYPE_STRING);
2433
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_other_config);
2436
/* Returns the role column's value in 'row' as a struct ovsdb_datum.
2437
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2438
* easier and more efficient way to search for a given key than implementing
2439
* the same operation on the "cooked" form in 'row'.
2441
* 'key_type' must be OVSDB_TYPE_STRING.
2442
* (This helps to avoid silent bugs if someone changes role's
2443
* type without updating the caller.)
2445
* The caller must not modify or free the returned value.
2447
* Various kinds of changes can invalidate the returned value: modifying
2448
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2449
* If the returned value is needed for a long time, it is best to make a copy
2450
* of it with ovsdb_datum_clone(). */
2451
const struct ovsdb_datum *
2452
ovsrec_controller_get_role(const struct ovsrec_controller *row,
2453
enum ovsdb_atomic_type key_type OVS_UNUSED)
2455
ovs_assert(key_type == OVSDB_TYPE_STRING);
2456
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_role);
2459
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
2460
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2461
* easier and more efficient way to search for a given key than implementing
2462
* the same operation on the "cooked" form in 'row'.
2464
* 'key_type' must be OVSDB_TYPE_STRING.
2465
* 'value_type' must be OVSDB_TYPE_STRING.
2466
* (This helps to avoid silent bugs if someone changes status's
2467
* type without updating the caller.)
2469
* The caller must not modify or free the returned value.
2471
* Various kinds of changes can invalidate the returned value: modifying
2472
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2473
* If the returned value is needed for a long time, it is best to make a copy
2474
* of it with ovsdb_datum_clone(). */
2475
const struct ovsdb_datum *
2476
ovsrec_controller_get_status(const struct ovsrec_controller *row,
2477
enum ovsdb_atomic_type key_type OVS_UNUSED,
2478
enum ovsdb_atomic_type value_type OVS_UNUSED)
2480
ovs_assert(key_type == OVSDB_TYPE_STRING);
2481
ovs_assert(value_type == OVSDB_TYPE_STRING);
2482
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_status);
2485
/* Returns the target column's value in 'row' as a struct ovsdb_datum.
2486
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
2487
* easier and more efficient way to search for a given key than implementing
2488
* the same operation on the "cooked" form in 'row'.
2490
* 'key_type' must be OVSDB_TYPE_STRING.
2491
* (This helps to avoid silent bugs if someone changes target's
2492
* type without updating the caller.)
2494
* The caller must not modify or free the returned value.
2496
* Various kinds of changes can invalidate the returned value: modifying
2497
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2498
* If the returned value is needed for a long time, it is best to make a copy
2499
* of it with ovsdb_datum_clone(). */
2500
const struct ovsdb_datum *
2501
ovsrec_controller_get_target(const struct ovsrec_controller *row,
2502
enum ovsdb_atomic_type key_type OVS_UNUSED)
2504
ovs_assert(key_type == OVSDB_TYPE_STRING);
2505
return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_target);
2509
ovsrec_controller_set_connection_mode(const struct ovsrec_controller *row, const char *connection_mode)
2511
struct ovsdb_datum datum;
2512
union ovsdb_atom key;
2515
if (connection_mode) {
2518
key.string = CONST_CAST(char *, connection_mode);
2523
datum.values = NULL;
2524
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONNECTION_MODE], &datum);
2528
ovsrec_controller_set_controller_burst_limit(const struct ovsrec_controller *row, const int64_t *controller_burst_limit, size_t n_controller_burst_limit)
2530
struct ovsdb_datum datum;
2531
union ovsdb_atom key;
2534
if (n_controller_burst_limit) {
2537
key.integer = *controller_burst_limit;
2542
datum.values = NULL;
2543
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_BURST_LIMIT], &datum);
2547
ovsrec_controller_set_controller_rate_limit(const struct ovsrec_controller *row, const int64_t *controller_rate_limit, size_t n_controller_rate_limit)
2549
struct ovsdb_datum datum;
2550
union ovsdb_atom key;
2553
if (n_controller_rate_limit) {
2556
key.integer = *controller_rate_limit;
2561
datum.values = NULL;
2562
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_RATE_LIMIT], &datum);
2566
ovsrec_controller_set_enable_async_messages(const struct ovsrec_controller *row, const bool *enable_async_messages, size_t n_enable_async_messages)
2568
struct ovsdb_datum datum;
2569
union ovsdb_atom key;
2572
if (n_enable_async_messages) {
2575
key.boolean = *enable_async_messages;
2580
datum.values = NULL;
2581
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ENABLE_ASYNC_MESSAGES], &datum);
2585
ovsrec_controller_set_external_ids(const struct ovsrec_controller *row, const struct smap *smap)
2587
struct ovsdb_datum datum;
2591
struct smap_node *node;
2594
datum.n = smap_count(smap);
2595
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2596
datum.values = xmalloc(datum.n * sizeof *datum.values);
2599
SMAP_FOR_EACH (node, smap) {
2600
datum.keys[i].string = xstrdup(node->key);
2601
datum.values[i].string = xstrdup(node->value);
2604
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2606
ovsdb_datum_init_empty(&datum);
2608
ovsdb_idl_txn_write(&row->header_,
2609
&ovsrec_controller_columns[OVSREC_CONTROLLER_COL_EXTERNAL_IDS],
2615
ovsrec_controller_set_inactivity_probe(const struct ovsrec_controller *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
2617
struct ovsdb_datum datum;
2618
union ovsdb_atom key;
2621
if (n_inactivity_probe) {
2624
key.integer = *inactivity_probe;
2629
datum.values = NULL;
2630
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_INACTIVITY_PROBE], &datum);
2634
ovsrec_controller_set_is_connected(const struct ovsrec_controller *row, bool is_connected)
2636
struct ovsdb_datum datum;
2637
union ovsdb_atom key;
2642
key.boolean = is_connected;
2643
datum.values = NULL;
2644
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_IS_CONNECTED], &datum);
2648
ovsrec_controller_set_local_gateway(const struct ovsrec_controller *row, const char *local_gateway)
2650
struct ovsdb_datum datum;
2651
union ovsdb_atom key;
2654
if (local_gateway) {
2657
key.string = CONST_CAST(char *, local_gateway);
2662
datum.values = NULL;
2663
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_GATEWAY], &datum);
2667
ovsrec_controller_set_local_ip(const struct ovsrec_controller *row, const char *local_ip)
2669
struct ovsdb_datum datum;
2670
union ovsdb_atom key;
2676
key.string = CONST_CAST(char *, local_ip);
2681
datum.values = NULL;
2682
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_IP], &datum);
2686
ovsrec_controller_set_local_netmask(const struct ovsrec_controller *row, const char *local_netmask)
2688
struct ovsdb_datum datum;
2689
union ovsdb_atom key;
2692
if (local_netmask) {
2695
key.string = CONST_CAST(char *, local_netmask);
2700
datum.values = NULL;
2701
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_NETMASK], &datum);
2705
ovsrec_controller_set_max_backoff(const struct ovsrec_controller *row, const int64_t *max_backoff, size_t n_max_backoff)
2707
struct ovsdb_datum datum;
2708
union ovsdb_atom key;
2711
if (n_max_backoff) {
2714
key.integer = *max_backoff;
2719
datum.values = NULL;
2720
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_MAX_BACKOFF], &datum);
2724
ovsrec_controller_set_other_config(const struct ovsrec_controller *row, const struct smap *smap)
2726
struct ovsdb_datum datum;
2730
struct smap_node *node;
2733
datum.n = smap_count(smap);
2734
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2735
datum.values = xmalloc(datum.n * sizeof *datum.values);
2738
SMAP_FOR_EACH (node, smap) {
2739
datum.keys[i].string = xstrdup(node->key);
2740
datum.values[i].string = xstrdup(node->value);
2743
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2745
ovsdb_datum_init_empty(&datum);
2747
ovsdb_idl_txn_write(&row->header_,
2748
&ovsrec_controller_columns[OVSREC_CONTROLLER_COL_OTHER_CONFIG],
2754
ovsrec_controller_set_role(const struct ovsrec_controller *row, const char *role)
2756
struct ovsdb_datum datum;
2757
union ovsdb_atom key;
2763
key.string = CONST_CAST(char *, role);
2768
datum.values = NULL;
2769
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ROLE], &datum);
2773
ovsrec_controller_set_status(const struct ovsrec_controller *row, const struct smap *smap)
2775
struct ovsdb_datum datum;
2779
struct smap_node *node;
2782
datum.n = smap_count(smap);
2783
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2784
datum.values = xmalloc(datum.n * sizeof *datum.values);
2787
SMAP_FOR_EACH (node, smap) {
2788
datum.keys[i].string = xstrdup(node->key);
2789
datum.values[i].string = xstrdup(node->value);
2792
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2794
ovsdb_datum_init_empty(&datum);
2796
ovsdb_idl_txn_write(&row->header_,
2797
&ovsrec_controller_columns[OVSREC_CONTROLLER_COL_STATUS],
2803
ovsrec_controller_set_target(const struct ovsrec_controller *row, const char *target)
2805
struct ovsdb_datum datum;
2806
union ovsdb_atom key;
2811
key.string = CONST_CAST(char *, target);
2812
datum.values = NULL;
2813
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_TARGET], &datum);
2816
struct ovsdb_idl_column ovsrec_controller_columns[OVSREC_CONTROLLER_N_COLUMNS];
2819
ovsrec_controller_columns_init(void)
2821
struct ovsdb_idl_column *c;
2823
/* Initialize ovsrec_controller_col_connection_mode. */
2824
c = &ovsrec_controller_col_connection_mode;
2825
c->name = "connection_mode";
2826
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2827
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
2828
c->type.key.enum_->n = 2;
2829
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
2830
c->type.key.enum_->keys[0].string = xstrdup("in-band");
2831
c->type.key.enum_->keys[1].string = xstrdup("out-of-band");
2832
c->type.key.enum_->values = NULL;
2833
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
2834
c->type.key.u.string.minLen = 0;
2835
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2839
c->parse = ovsrec_controller_parse_connection_mode;
2840
c->unparse = ovsrec_controller_unparse_connection_mode;
2842
/* Initialize ovsrec_controller_col_controller_burst_limit. */
2843
c = &ovsrec_controller_col_controller_burst_limit;
2844
c->name = "controller_burst_limit";
2845
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2846
c->type.key.u.integer.min = INT64_C(25);
2847
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2851
c->parse = ovsrec_controller_parse_controller_burst_limit;
2852
c->unparse = ovsrec_controller_unparse_controller_burst_limit;
2854
/* Initialize ovsrec_controller_col_controller_rate_limit. */
2855
c = &ovsrec_controller_col_controller_rate_limit;
2856
c->name = "controller_rate_limit";
2857
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2858
c->type.key.u.integer.min = INT64_C(100);
2859
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2863
c->parse = ovsrec_controller_parse_controller_rate_limit;
2864
c->unparse = ovsrec_controller_unparse_controller_rate_limit;
2866
/* Initialize ovsrec_controller_col_enable_async_messages. */
2867
c = &ovsrec_controller_col_enable_async_messages;
2868
c->name = "enable_async_messages";
2869
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
2870
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2874
c->parse = ovsrec_controller_parse_enable_async_messages;
2875
c->unparse = ovsrec_controller_unparse_enable_async_messages;
2877
/* Initialize ovsrec_controller_col_external_ids. */
2878
c = &ovsrec_controller_col_external_ids;
2879
c->name = "external_ids";
2880
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2881
c->type.key.u.string.minLen = 0;
2882
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2883
c->type.value.u.string.minLen = 0;
2885
c->type.n_max = UINT_MAX;
2887
c->parse = ovsrec_controller_parse_external_ids;
2888
c->unparse = ovsrec_controller_unparse_external_ids;
2890
/* Initialize ovsrec_controller_col_inactivity_probe. */
2891
c = &ovsrec_controller_col_inactivity_probe;
2892
c->name = "inactivity_probe";
2893
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2894
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2898
c->parse = ovsrec_controller_parse_inactivity_probe;
2899
c->unparse = ovsrec_controller_unparse_inactivity_probe;
2901
/* Initialize ovsrec_controller_col_is_connected. */
2902
c = &ovsrec_controller_col_is_connected;
2903
c->name = "is_connected";
2904
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
2905
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2909
c->parse = ovsrec_controller_parse_is_connected;
2910
c->unparse = ovsrec_controller_unparse_is_connected;
2912
/* Initialize ovsrec_controller_col_local_gateway. */
2913
c = &ovsrec_controller_col_local_gateway;
2914
c->name = "local_gateway";
2915
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2916
c->type.key.u.string.minLen = 0;
2917
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2921
c->parse = ovsrec_controller_parse_local_gateway;
2922
c->unparse = ovsrec_controller_unparse_local_gateway;
2924
/* Initialize ovsrec_controller_col_local_ip. */
2925
c = &ovsrec_controller_col_local_ip;
2926
c->name = "local_ip";
2927
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2928
c->type.key.u.string.minLen = 0;
2929
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2933
c->parse = ovsrec_controller_parse_local_ip;
2934
c->unparse = ovsrec_controller_unparse_local_ip;
2936
/* Initialize ovsrec_controller_col_local_netmask. */
2937
c = &ovsrec_controller_col_local_netmask;
2938
c->name = "local_netmask";
2939
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2940
c->type.key.u.string.minLen = 0;
2941
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2945
c->parse = ovsrec_controller_parse_local_netmask;
2946
c->unparse = ovsrec_controller_unparse_local_netmask;
2948
/* Initialize ovsrec_controller_col_max_backoff. */
2949
c = &ovsrec_controller_col_max_backoff;
2950
c->name = "max_backoff";
2951
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2952
c->type.key.u.integer.min = INT64_C(1000);
2953
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2957
c->parse = ovsrec_controller_parse_max_backoff;
2958
c->unparse = ovsrec_controller_unparse_max_backoff;
2960
/* Initialize ovsrec_controller_col_other_config. */
2961
c = &ovsrec_controller_col_other_config;
2962
c->name = "other_config";
2963
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2964
c->type.key.u.string.minLen = 0;
2965
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2966
c->type.value.u.string.minLen = 0;
2968
c->type.n_max = UINT_MAX;
2970
c->parse = ovsrec_controller_parse_other_config;
2971
c->unparse = ovsrec_controller_unparse_other_config;
2973
/* Initialize ovsrec_controller_col_role. */
2974
c = &ovsrec_controller_col_role;
2976
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2977
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
2978
c->type.key.enum_->n = 3;
2979
c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
2980
c->type.key.enum_->keys[0].string = xstrdup("master");
2981
c->type.key.enum_->keys[1].string = xstrdup("other");
2982
c->type.key.enum_->keys[2].string = xstrdup("slave");
2983
c->type.key.enum_->values = NULL;
2984
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
2985
c->type.key.u.string.minLen = 0;
2986
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2990
c->parse = ovsrec_controller_parse_role;
2991
c->unparse = ovsrec_controller_unparse_role;
2993
/* Initialize ovsrec_controller_col_status. */
2994
c = &ovsrec_controller_col_status;
2996
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2997
c->type.key.u.string.minLen = 0;
2998
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2999
c->type.value.u.string.minLen = 0;
3001
c->type.n_max = UINT_MAX;
3003
c->parse = ovsrec_controller_parse_status;
3004
c->unparse = ovsrec_controller_unparse_status;
3006
/* Initialize ovsrec_controller_col_target. */
3007
c = &ovsrec_controller_col_target;
3009
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3010
c->type.key.u.string.minLen = 0;
3011
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3015
c->parse = ovsrec_controller_parse_target;
3016
c->unparse = ovsrec_controller_unparse_target;
3019
/* Flow_Sample_Collector_Set table. */
3022
ovsrec_flow_sample_collector_set_parse_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3024
struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3027
if (datum->n >= 1) {
3028
row->bridge = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], &datum->keys[0].uuid));
3035
ovsrec_flow_sample_collector_set_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3037
struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3041
smap_init(&row->external_ids);
3042
for (i = 0; i < datum->n; i++) {
3043
smap_add(&row->external_ids,
3044
datum->keys[i].string,
3045
datum->values[i].string);
3050
ovsrec_flow_sample_collector_set_parse_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3052
struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3055
if (datum->n >= 1) {
3056
row->id = datum->keys[0].integer;
3063
ovsrec_flow_sample_collector_set_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3065
struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3068
if (datum->n >= 1) {
3069
row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], &datum->keys[0].uuid));
3076
ovsrec_flow_sample_collector_set_unparse_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
3078
/* Nothing to do. */
3082
ovsrec_flow_sample_collector_set_unparse_external_ids(struct ovsdb_idl_row *row_)
3084
struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3087
smap_destroy(&row->external_ids);
3091
ovsrec_flow_sample_collector_set_unparse_id(struct ovsdb_idl_row *row OVS_UNUSED)
3093
/* Nothing to do. */
3097
ovsrec_flow_sample_collector_set_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
3099
/* Nothing to do. */
3103
ovsrec_flow_sample_collector_set_init__(struct ovsdb_idl_row *row)
3105
ovsrec_flow_sample_collector_set_init(ovsrec_flow_sample_collector_set_cast(row));
3109
ovsrec_flow_sample_collector_set_init(struct ovsrec_flow_sample_collector_set *row)
3111
memset(row, 0, sizeof *row);
3112
smap_init(&row->external_ids);
3115
const struct ovsrec_flow_sample_collector_set *
3116
ovsrec_flow_sample_collector_set_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
3118
return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET], uuid));
3121
const struct ovsrec_flow_sample_collector_set *
3122
ovsrec_flow_sample_collector_set_first(const struct ovsdb_idl *idl)
3124
return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]));
3127
const struct ovsrec_flow_sample_collector_set *
3128
ovsrec_flow_sample_collector_set_next(const struct ovsrec_flow_sample_collector_set *row)
3130
return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_next_row(&row->header_));
3134
ovsrec_flow_sample_collector_set_delete(const struct ovsrec_flow_sample_collector_set *row)
3136
ovsdb_idl_txn_delete(&row->header_);
3139
struct ovsrec_flow_sample_collector_set *
3140
ovsrec_flow_sample_collector_set_insert(struct ovsdb_idl_txn *txn)
3142
return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET], NULL));
3147
ovsrec_flow_sample_collector_set_verify_bridge(const struct ovsrec_flow_sample_collector_set *row)
3150
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_BRIDGE]);
3154
ovsrec_flow_sample_collector_set_verify_external_ids(const struct ovsrec_flow_sample_collector_set *row)
3157
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS]);
3161
ovsrec_flow_sample_collector_set_verify_id(const struct ovsrec_flow_sample_collector_set *row)
3164
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_ID]);
3168
ovsrec_flow_sample_collector_set_verify_ipfix(const struct ovsrec_flow_sample_collector_set *row)
3171
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_IPFIX]);
3174
/* Returns the bridge column's value in 'row' as a struct ovsdb_datum.
3175
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3176
* easier and more efficient way to search for a given key than implementing
3177
* the same operation on the "cooked" form in 'row'.
3179
* 'key_type' must be OVSDB_TYPE_UUID.
3180
* (This helps to avoid silent bugs if someone changes bridge's
3181
* type without updating the caller.)
3183
* The caller must not modify or free the returned value.
3185
* Various kinds of changes can invalidate the returned value: modifying
3186
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3187
* If the returned value is needed for a long time, it is best to make a copy
3188
* of it with ovsdb_datum_clone(). */
3189
const struct ovsdb_datum *
3190
ovsrec_flow_sample_collector_set_get_bridge(const struct ovsrec_flow_sample_collector_set *row,
3191
enum ovsdb_atomic_type key_type OVS_UNUSED)
3193
ovs_assert(key_type == OVSDB_TYPE_UUID);
3194
return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge);
3197
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
3198
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3199
* easier and more efficient way to search for a given key than implementing
3200
* the same operation on the "cooked" form in 'row'.
3202
* 'key_type' must be OVSDB_TYPE_STRING.
3203
* 'value_type' must be OVSDB_TYPE_STRING.
3204
* (This helps to avoid silent bugs if someone changes external_ids's
3205
* type without updating the caller.)
3207
* The caller must not modify or free the returned value.
3209
* Various kinds of changes can invalidate the returned value: modifying
3210
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3211
* If the returned value is needed for a long time, it is best to make a copy
3212
* of it with ovsdb_datum_clone(). */
3213
const struct ovsdb_datum *
3214
ovsrec_flow_sample_collector_set_get_external_ids(const struct ovsrec_flow_sample_collector_set *row,
3215
enum ovsdb_atomic_type key_type OVS_UNUSED,
3216
enum ovsdb_atomic_type value_type OVS_UNUSED)
3218
ovs_assert(key_type == OVSDB_TYPE_STRING);
3219
ovs_assert(value_type == OVSDB_TYPE_STRING);
3220
return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_external_ids);
3223
/* Returns the id column's value in 'row' as a struct ovsdb_datum.
3224
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3225
* easier and more efficient way to search for a given key than implementing
3226
* the same operation on the "cooked" form in 'row'.
3228
* 'key_type' must be OVSDB_TYPE_INTEGER.
3229
* (This helps to avoid silent bugs if someone changes id's
3230
* type without updating the caller.)
3232
* The caller must not modify or free the returned value.
3234
* Various kinds of changes can invalidate the returned value: modifying
3235
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3236
* If the returned value is needed for a long time, it is best to make a copy
3237
* of it with ovsdb_datum_clone(). */
3238
const struct ovsdb_datum *
3239
ovsrec_flow_sample_collector_set_get_id(const struct ovsrec_flow_sample_collector_set *row,
3240
enum ovsdb_atomic_type key_type OVS_UNUSED)
3242
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
3243
return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_id);
3246
/* Returns the ipfix column's value in 'row' as a struct ovsdb_datum.
3247
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3248
* easier and more efficient way to search for a given key than implementing
3249
* the same operation on the "cooked" form in 'row'.
3251
* 'key_type' must be OVSDB_TYPE_UUID.
3252
* (This helps to avoid silent bugs if someone changes ipfix's
3253
* type without updating the caller.)
3255
* The caller must not modify or free the returned value.
3257
* Various kinds of changes can invalidate the returned value: modifying
3258
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3259
* If the returned value is needed for a long time, it is best to make a copy
3260
* of it with ovsdb_datum_clone(). */
3261
const struct ovsdb_datum *
3262
ovsrec_flow_sample_collector_set_get_ipfix(const struct ovsrec_flow_sample_collector_set *row,
3263
enum ovsdb_atomic_type key_type OVS_UNUSED)
3265
ovs_assert(key_type == OVSDB_TYPE_UUID);
3266
return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix);
3270
ovsrec_flow_sample_collector_set_set_bridge(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_bridge *bridge)
3272
struct ovsdb_datum datum;
3273
union ovsdb_atom key;
3278
key.uuid = bridge->header_.uuid;
3279
datum.values = NULL;
3280
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_BRIDGE], &datum);
3284
ovsrec_flow_sample_collector_set_set_external_ids(const struct ovsrec_flow_sample_collector_set *row, const struct smap *smap)
3286
struct ovsdb_datum datum;
3290
struct smap_node *node;
3293
datum.n = smap_count(smap);
3294
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3295
datum.values = xmalloc(datum.n * sizeof *datum.values);
3298
SMAP_FOR_EACH (node, smap) {
3299
datum.keys[i].string = xstrdup(node->key);
3300
datum.values[i].string = xstrdup(node->value);
3303
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3305
ovsdb_datum_init_empty(&datum);
3307
ovsdb_idl_txn_write(&row->header_,
3308
&ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS],
3314
ovsrec_flow_sample_collector_set_set_id(const struct ovsrec_flow_sample_collector_set *row, int64_t id)
3316
struct ovsdb_datum datum;
3317
union ovsdb_atom key;
3323
datum.values = NULL;
3324
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_ID], &datum);
3328
ovsrec_flow_sample_collector_set_set_ipfix(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *ipfix)
3330
struct ovsdb_datum datum;
3331
union ovsdb_atom key;
3337
key.uuid = ipfix->header_.uuid;
3342
datum.values = NULL;
3343
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_IPFIX], &datum);
3346
struct ovsdb_idl_column ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_N_COLUMNS];
3349
ovsrec_flow_sample_collector_set_columns_init(void)
3351
struct ovsdb_idl_column *c;
3353
/* Initialize ovsrec_flow_sample_collector_set_col_bridge. */
3354
c = &ovsrec_flow_sample_collector_set_col_bridge;
3356
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
3357
c->type.key.u.uuid.refTableName = "Bridge";
3358
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
3359
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3363
c->parse = ovsrec_flow_sample_collector_set_parse_bridge;
3364
c->unparse = ovsrec_flow_sample_collector_set_unparse_bridge;
3366
/* Initialize ovsrec_flow_sample_collector_set_col_external_ids. */
3367
c = &ovsrec_flow_sample_collector_set_col_external_ids;
3368
c->name = "external_ids";
3369
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3370
c->type.key.u.string.minLen = 0;
3371
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
3372
c->type.value.u.string.minLen = 0;
3374
c->type.n_max = UINT_MAX;
3376
c->parse = ovsrec_flow_sample_collector_set_parse_external_ids;
3377
c->unparse = ovsrec_flow_sample_collector_set_unparse_external_ids;
3379
/* Initialize ovsrec_flow_sample_collector_set_col_id. */
3380
c = &ovsrec_flow_sample_collector_set_col_id;
3382
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
3383
c->type.key.u.integer.min = INT64_C(0);
3384
c->type.key.u.integer.max = INT64_C(4294967295);
3385
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3389
c->parse = ovsrec_flow_sample_collector_set_parse_id;
3390
c->unparse = ovsrec_flow_sample_collector_set_unparse_id;
3392
/* Initialize ovsrec_flow_sample_collector_set_col_ipfix. */
3393
c = &ovsrec_flow_sample_collector_set_col_ipfix;
3395
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
3396
c->type.key.u.uuid.refTableName = "IPFIX";
3397
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
3398
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3402
c->parse = ovsrec_flow_sample_collector_set_parse_ipfix;
3403
c->unparse = ovsrec_flow_sample_collector_set_unparse_ipfix;
3406
/* Flow_Table table. */
3409
ovsrec_flow_table_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3411
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3415
smap_init(&row->external_ids);
3416
for (i = 0; i < datum->n; i++) {
3417
smap_add(&row->external_ids,
3418
datum->keys[i].string,
3419
datum->values[i].string);
3424
ovsrec_flow_table_parse_flow_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3426
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3427
size_t n = MIN(1, datum->n);
3431
row->flow_limit = NULL;
3432
row->n_flow_limit = 0;
3433
for (i = 0; i < n; i++) {
3434
if (!row->n_flow_limit) {
3435
row->flow_limit = xmalloc(n * sizeof *row->flow_limit);
3437
row->flow_limit[row->n_flow_limit] = datum->keys[i].integer;
3438
row->n_flow_limit++;
3443
ovsrec_flow_table_parse_groups(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3445
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3451
for (i = 0; i < datum->n; i++) {
3452
if (!row->n_groups) {
3453
row->groups = xmalloc(datum->n * sizeof *row->groups);
3455
row->groups[row->n_groups] = datum->keys[i].string;
3461
ovsrec_flow_table_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3463
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3466
if (datum->n >= 1) {
3467
row->name = datum->keys[0].string;
3474
ovsrec_flow_table_parse_overflow_policy(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3476
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3479
if (datum->n >= 1) {
3480
row->overflow_policy = datum->keys[0].string;
3482
row->overflow_policy = NULL;
3487
ovsrec_flow_table_parse_prefixes(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3489
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3490
size_t n = MIN(3, datum->n);
3494
row->prefixes = NULL;
3495
row->n_prefixes = 0;
3496
for (i = 0; i < n; i++) {
3497
if (!row->n_prefixes) {
3498
row->prefixes = xmalloc(n * sizeof *row->prefixes);
3500
row->prefixes[row->n_prefixes] = datum->keys[i].string;
3506
ovsrec_flow_table_unparse_external_ids(struct ovsdb_idl_row *row_)
3508
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3511
smap_destroy(&row->external_ids);
3515
ovsrec_flow_table_unparse_flow_limit(struct ovsdb_idl_row *row_)
3517
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3520
free(row->flow_limit);
3524
ovsrec_flow_table_unparse_groups(struct ovsdb_idl_row *row_)
3526
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3533
ovsrec_flow_table_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
3535
/* Nothing to do. */
3539
ovsrec_flow_table_unparse_overflow_policy(struct ovsdb_idl_row *row OVS_UNUSED)
3541
/* Nothing to do. */
3545
ovsrec_flow_table_unparse_prefixes(struct ovsdb_idl_row *row_)
3547
struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3550
free(row->prefixes);
3554
ovsrec_flow_table_init__(struct ovsdb_idl_row *row)
3556
ovsrec_flow_table_init(ovsrec_flow_table_cast(row));
3560
ovsrec_flow_table_init(struct ovsrec_flow_table *row)
3562
memset(row, 0, sizeof *row);
3563
smap_init(&row->external_ids);
3566
const struct ovsrec_flow_table *
3567
ovsrec_flow_table_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
3569
return ovsrec_flow_table_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE], uuid));
3572
const struct ovsrec_flow_table *
3573
ovsrec_flow_table_first(const struct ovsdb_idl *idl)
3575
return ovsrec_flow_table_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]));
3578
const struct ovsrec_flow_table *
3579
ovsrec_flow_table_next(const struct ovsrec_flow_table *row)
3581
return ovsrec_flow_table_cast(ovsdb_idl_next_row(&row->header_));
3585
ovsrec_flow_table_delete(const struct ovsrec_flow_table *row)
3587
ovsdb_idl_txn_delete(&row->header_);
3590
struct ovsrec_flow_table *
3591
ovsrec_flow_table_insert(struct ovsdb_idl_txn *txn)
3593
return ovsrec_flow_table_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE], NULL));
3598
ovsrec_flow_table_verify_external_ids(const struct ovsrec_flow_table *row)
3601
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS]);
3605
ovsrec_flow_table_verify_flow_limit(const struct ovsrec_flow_table *row)
3608
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_FLOW_LIMIT]);
3612
ovsrec_flow_table_verify_groups(const struct ovsrec_flow_table *row)
3615
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_GROUPS]);
3619
ovsrec_flow_table_verify_name(const struct ovsrec_flow_table *row)
3622
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_NAME]);
3626
ovsrec_flow_table_verify_overflow_policy(const struct ovsrec_flow_table *row)
3629
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_OVERFLOW_POLICY]);
3633
ovsrec_flow_table_verify_prefixes(const struct ovsrec_flow_table *row)
3636
ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_PREFIXES]);
3639
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
3640
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3641
* easier and more efficient way to search for a given key than implementing
3642
* the same operation on the "cooked" form in 'row'.
3644
* 'key_type' must be OVSDB_TYPE_STRING.
3645
* 'value_type' must be OVSDB_TYPE_STRING.
3646
* (This helps to avoid silent bugs if someone changes external_ids's
3647
* type without updating the caller.)
3649
* The caller must not modify or free the returned value.
3651
* Various kinds of changes can invalidate the returned value: modifying
3652
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3653
* If the returned value is needed for a long time, it is best to make a copy
3654
* of it with ovsdb_datum_clone(). */
3655
const struct ovsdb_datum *
3656
ovsrec_flow_table_get_external_ids(const struct ovsrec_flow_table *row,
3657
enum ovsdb_atomic_type key_type OVS_UNUSED,
3658
enum ovsdb_atomic_type value_type OVS_UNUSED)
3660
ovs_assert(key_type == OVSDB_TYPE_STRING);
3661
ovs_assert(value_type == OVSDB_TYPE_STRING);
3662
return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_external_ids);
3665
/* Returns the flow_limit column's value in 'row' as a struct ovsdb_datum.
3666
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3667
* easier and more efficient way to search for a given key than implementing
3668
* the same operation on the "cooked" form in 'row'.
3670
* 'key_type' must be OVSDB_TYPE_INTEGER.
3671
* (This helps to avoid silent bugs if someone changes flow_limit's
3672
* type without updating the caller.)
3674
* The caller must not modify or free the returned value.
3676
* Various kinds of changes can invalidate the returned value: modifying
3677
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3678
* If the returned value is needed for a long time, it is best to make a copy
3679
* of it with ovsdb_datum_clone(). */
3680
const struct ovsdb_datum *
3681
ovsrec_flow_table_get_flow_limit(const struct ovsrec_flow_table *row,
3682
enum ovsdb_atomic_type key_type OVS_UNUSED)
3684
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
3685
return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_flow_limit);
3688
/* Returns the groups column's value in 'row' as a struct ovsdb_datum.
3689
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3690
* easier and more efficient way to search for a given key than implementing
3691
* the same operation on the "cooked" form in 'row'.
3693
* 'key_type' must be OVSDB_TYPE_STRING.
3694
* (This helps to avoid silent bugs if someone changes groups's
3695
* type without updating the caller.)
3697
* The caller must not modify or free the returned value.
3699
* Various kinds of changes can invalidate the returned value: modifying
3700
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3701
* If the returned value is needed for a long time, it is best to make a copy
3702
* of it with ovsdb_datum_clone(). */
3703
const struct ovsdb_datum *
3704
ovsrec_flow_table_get_groups(const struct ovsrec_flow_table *row,
3705
enum ovsdb_atomic_type key_type OVS_UNUSED)
3707
ovs_assert(key_type == OVSDB_TYPE_STRING);
3708
return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_groups);
3711
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
3712
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3713
* easier and more efficient way to search for a given key than implementing
3714
* the same operation on the "cooked" form in 'row'.
3716
* 'key_type' must be OVSDB_TYPE_STRING.
3717
* (This helps to avoid silent bugs if someone changes name's
3718
* type without updating the caller.)
3720
* The caller must not modify or free the returned value.
3722
* Various kinds of changes can invalidate the returned value: modifying
3723
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3724
* If the returned value is needed for a long time, it is best to make a copy
3725
* of it with ovsdb_datum_clone(). */
3726
const struct ovsdb_datum *
3727
ovsrec_flow_table_get_name(const struct ovsrec_flow_table *row,
3728
enum ovsdb_atomic_type key_type OVS_UNUSED)
3730
ovs_assert(key_type == OVSDB_TYPE_STRING);
3731
return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_name);
3734
/* Returns the overflow_policy column's value in 'row' as a struct ovsdb_datum.
3735
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3736
* easier and more efficient way to search for a given key than implementing
3737
* the same operation on the "cooked" form in 'row'.
3739
* 'key_type' must be OVSDB_TYPE_STRING.
3740
* (This helps to avoid silent bugs if someone changes overflow_policy's
3741
* type without updating the caller.)
3743
* The caller must not modify or free the returned value.
3745
* Various kinds of changes can invalidate the returned value: modifying
3746
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3747
* If the returned value is needed for a long time, it is best to make a copy
3748
* of it with ovsdb_datum_clone(). */
3749
const struct ovsdb_datum *
3750
ovsrec_flow_table_get_overflow_policy(const struct ovsrec_flow_table *row,
3751
enum ovsdb_atomic_type key_type OVS_UNUSED)
3753
ovs_assert(key_type == OVSDB_TYPE_STRING);
3754
return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_overflow_policy);
3757
/* Returns the prefixes column's value in 'row' as a struct ovsdb_datum.
3758
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
3759
* easier and more efficient way to search for a given key than implementing
3760
* the same operation on the "cooked" form in 'row'.
3762
* 'key_type' must be OVSDB_TYPE_STRING.
3763
* (This helps to avoid silent bugs if someone changes prefixes's
3764
* type without updating the caller.)
3766
* The caller must not modify or free the returned value.
3768
* Various kinds of changes can invalidate the returned value: modifying
3769
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3770
* If the returned value is needed for a long time, it is best to make a copy
3771
* of it with ovsdb_datum_clone(). */
3772
const struct ovsdb_datum *
3773
ovsrec_flow_table_get_prefixes(const struct ovsrec_flow_table *row,
3774
enum ovsdb_atomic_type key_type OVS_UNUSED)
3776
ovs_assert(key_type == OVSDB_TYPE_STRING);
3777
return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_prefixes);
3781
ovsrec_flow_table_set_external_ids(const struct ovsrec_flow_table *row, const struct smap *smap)
3783
struct ovsdb_datum datum;
3787
struct smap_node *node;
3790
datum.n = smap_count(smap);
3791
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3792
datum.values = xmalloc(datum.n * sizeof *datum.values);
3795
SMAP_FOR_EACH (node, smap) {
3796
datum.keys[i].string = xstrdup(node->key);
3797
datum.values[i].string = xstrdup(node->value);
3800
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3802
ovsdb_datum_init_empty(&datum);
3804
ovsdb_idl_txn_write(&row->header_,
3805
&ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS],
3811
ovsrec_flow_table_set_flow_limit(const struct ovsrec_flow_table *row, const int64_t *flow_limit, size_t n_flow_limit)
3813
struct ovsdb_datum datum;
3814
union ovsdb_atom key;
3820
key.integer = *flow_limit;
3825
datum.values = NULL;
3826
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_FLOW_LIMIT], &datum);
3830
ovsrec_flow_table_set_groups(const struct ovsrec_flow_table *row, char **groups, size_t n_groups)
3832
struct ovsdb_datum datum;
3837
datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
3838
datum.values = NULL;
3839
for (i = 0; i < n_groups; i++) {
3840
datum.keys[i].string = xstrdup(groups[i]);
3842
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
3843
ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_GROUPS], &datum);
3847
ovsrec_flow_table_set_name(const struct ovsrec_flow_table *row, const char *name)
3849
struct ovsdb_datum datum;
3850
union ovsdb_atom key;
3856
key.string = CONST_CAST(char *, name);
3861
datum.values = NULL;
3862
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_NAME], &datum);
3866
ovsrec_flow_table_set_overflow_policy(const struct ovsrec_flow_table *row, const char *overflow_policy)
3868
struct ovsdb_datum datum;
3869
union ovsdb_atom key;
3872
if (overflow_policy) {
3875
key.string = CONST_CAST(char *, overflow_policy);
3880
datum.values = NULL;
3881
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_OVERFLOW_POLICY], &datum);
3885
ovsrec_flow_table_set_prefixes(const struct ovsrec_flow_table *row, char **prefixes, size_t n_prefixes)
3887
struct ovsdb_datum datum;
3891
datum.n = n_prefixes;
3892
datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
3893
datum.values = NULL;
3894
for (i = 0; i < n_prefixes; i++) {
3895
datum.keys[i].string = xstrdup(prefixes[i]);
3897
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
3898
ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_PREFIXES], &datum);
3901
struct ovsdb_idl_column ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_N_COLUMNS];
3904
ovsrec_flow_table_columns_init(void)
3906
struct ovsdb_idl_column *c;
3908
/* Initialize ovsrec_flow_table_col_external_ids. */
3909
c = &ovsrec_flow_table_col_external_ids;
3910
c->name = "external_ids";
3911
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3912
c->type.key.u.string.minLen = 0;
3913
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
3914
c->type.value.u.string.minLen = 0;
3916
c->type.n_max = UINT_MAX;
3918
c->parse = ovsrec_flow_table_parse_external_ids;
3919
c->unparse = ovsrec_flow_table_unparse_external_ids;
3921
/* Initialize ovsrec_flow_table_col_flow_limit. */
3922
c = &ovsrec_flow_table_col_flow_limit;
3923
c->name = "flow_limit";
3924
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
3925
c->type.key.u.integer.min = INT64_C(0);
3926
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3930
c->parse = ovsrec_flow_table_parse_flow_limit;
3931
c->unparse = ovsrec_flow_table_unparse_flow_limit;
3933
/* Initialize ovsrec_flow_table_col_groups. */
3934
c = &ovsrec_flow_table_col_groups;
3936
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3937
c->type.key.u.string.minLen = 0;
3938
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3940
c->type.n_max = UINT_MAX;
3942
c->parse = ovsrec_flow_table_parse_groups;
3943
c->unparse = ovsrec_flow_table_unparse_groups;
3945
/* Initialize ovsrec_flow_table_col_name. */
3946
c = &ovsrec_flow_table_col_name;
3948
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3949
c->type.key.u.string.minLen = 0;
3950
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3954
c->parse = ovsrec_flow_table_parse_name;
3955
c->unparse = ovsrec_flow_table_unparse_name;
3957
/* Initialize ovsrec_flow_table_col_overflow_policy. */
3958
c = &ovsrec_flow_table_col_overflow_policy;
3959
c->name = "overflow_policy";
3960
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3961
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
3962
c->type.key.enum_->n = 2;
3963
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
3964
c->type.key.enum_->keys[0].string = xstrdup("evict");
3965
c->type.key.enum_->keys[1].string = xstrdup("refuse");
3966
c->type.key.enum_->values = NULL;
3967
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
3968
c->type.key.u.string.minLen = 0;
3969
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3973
c->parse = ovsrec_flow_table_parse_overflow_policy;
3974
c->unparse = ovsrec_flow_table_unparse_overflow_policy;
3976
/* Initialize ovsrec_flow_table_col_prefixes. */
3977
c = &ovsrec_flow_table_col_prefixes;
3978
c->name = "prefixes";
3979
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3980
c->type.key.u.string.minLen = 0;
3981
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3985
c->parse = ovsrec_flow_table_parse_prefixes;
3986
c->unparse = ovsrec_flow_table_unparse_prefixes;
3992
ovsrec_ipfix_parse_cache_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3994
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
3995
size_t n = MIN(1, datum->n);
3999
row->cache_active_timeout = NULL;
4000
row->n_cache_active_timeout = 0;
4001
for (i = 0; i < n; i++) {
4002
if (!row->n_cache_active_timeout) {
4003
row->cache_active_timeout = xmalloc(n * sizeof *row->cache_active_timeout);
4005
row->cache_active_timeout[row->n_cache_active_timeout] = datum->keys[i].integer;
4006
row->n_cache_active_timeout++;
4011
ovsrec_ipfix_parse_cache_max_flows(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4013
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4014
size_t n = MIN(1, datum->n);
4018
row->cache_max_flows = NULL;
4019
row->n_cache_max_flows = 0;
4020
for (i = 0; i < n; i++) {
4021
if (!row->n_cache_max_flows) {
4022
row->cache_max_flows = xmalloc(n * sizeof *row->cache_max_flows);
4024
row->cache_max_flows[row->n_cache_max_flows] = datum->keys[i].integer;
4025
row->n_cache_max_flows++;
4030
ovsrec_ipfix_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4032
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4036
smap_init(&row->external_ids);
4037
for (i = 0; i < datum->n; i++) {
4038
smap_add(&row->external_ids,
4039
datum->keys[i].string,
4040
datum->values[i].string);
4045
ovsrec_ipfix_parse_obs_domain_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4047
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4048
size_t n = MIN(1, datum->n);
4052
row->obs_domain_id = NULL;
4053
row->n_obs_domain_id = 0;
4054
for (i = 0; i < n; i++) {
4055
if (!row->n_obs_domain_id) {
4056
row->obs_domain_id = xmalloc(n * sizeof *row->obs_domain_id);
4058
row->obs_domain_id[row->n_obs_domain_id] = datum->keys[i].integer;
4059
row->n_obs_domain_id++;
4064
ovsrec_ipfix_parse_obs_point_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4066
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4067
size_t n = MIN(1, datum->n);
4071
row->obs_point_id = NULL;
4072
row->n_obs_point_id = 0;
4073
for (i = 0; i < n; i++) {
4074
if (!row->n_obs_point_id) {
4075
row->obs_point_id = xmalloc(n * sizeof *row->obs_point_id);
4077
row->obs_point_id[row->n_obs_point_id] = datum->keys[i].integer;
4078
row->n_obs_point_id++;
4083
ovsrec_ipfix_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4085
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4086
size_t n = MIN(1, datum->n);
4090
row->sampling = NULL;
4091
row->n_sampling = 0;
4092
for (i = 0; i < n; i++) {
4093
if (!row->n_sampling) {
4094
row->sampling = xmalloc(n * sizeof *row->sampling);
4096
row->sampling[row->n_sampling] = datum->keys[i].integer;
4102
ovsrec_ipfix_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4104
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4108
row->targets = NULL;
4110
for (i = 0; i < datum->n; i++) {
4111
if (!row->n_targets) {
4112
row->targets = xmalloc(datum->n * sizeof *row->targets);
4114
row->targets[row->n_targets] = datum->keys[i].string;
4120
ovsrec_ipfix_unparse_cache_active_timeout(struct ovsdb_idl_row *row_)
4122
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4125
free(row->cache_active_timeout);
4129
ovsrec_ipfix_unparse_cache_max_flows(struct ovsdb_idl_row *row_)
4131
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4134
free(row->cache_max_flows);
4138
ovsrec_ipfix_unparse_external_ids(struct ovsdb_idl_row *row_)
4140
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4143
smap_destroy(&row->external_ids);
4147
ovsrec_ipfix_unparse_obs_domain_id(struct ovsdb_idl_row *row_)
4149
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4152
free(row->obs_domain_id);
4156
ovsrec_ipfix_unparse_obs_point_id(struct ovsdb_idl_row *row_)
4158
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4161
free(row->obs_point_id);
4165
ovsrec_ipfix_unparse_sampling(struct ovsdb_idl_row *row_)
4167
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4170
free(row->sampling);
4174
ovsrec_ipfix_unparse_targets(struct ovsdb_idl_row *row_)
4176
struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4183
ovsrec_ipfix_init__(struct ovsdb_idl_row *row)
4185
ovsrec_ipfix_init(ovsrec_ipfix_cast(row));
4189
ovsrec_ipfix_init(struct ovsrec_ipfix *row)
4191
memset(row, 0, sizeof *row);
4192
smap_init(&row->external_ids);
4195
const struct ovsrec_ipfix *
4196
ovsrec_ipfix_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
4198
return ovsrec_ipfix_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], uuid));
4201
const struct ovsrec_ipfix *
4202
ovsrec_ipfix_first(const struct ovsdb_idl *idl)
4204
return ovsrec_ipfix_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]));
4207
const struct ovsrec_ipfix *
4208
ovsrec_ipfix_next(const struct ovsrec_ipfix *row)
4210
return ovsrec_ipfix_cast(ovsdb_idl_next_row(&row->header_));
4214
ovsrec_ipfix_delete(const struct ovsrec_ipfix *row)
4216
ovsdb_idl_txn_delete(&row->header_);
4219
struct ovsrec_ipfix *
4220
ovsrec_ipfix_insert(struct ovsdb_idl_txn *txn)
4222
return ovsrec_ipfix_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], NULL));
4227
ovsrec_ipfix_verify_cache_active_timeout(const struct ovsrec_ipfix *row)
4230
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_ACTIVE_TIMEOUT]);
4234
ovsrec_ipfix_verify_cache_max_flows(const struct ovsrec_ipfix *row)
4237
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_MAX_FLOWS]);
4241
ovsrec_ipfix_verify_external_ids(const struct ovsrec_ipfix *row)
4244
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_EXTERNAL_IDS]);
4248
ovsrec_ipfix_verify_obs_domain_id(const struct ovsrec_ipfix *row)
4251
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_DOMAIN_ID]);
4255
ovsrec_ipfix_verify_obs_point_id(const struct ovsrec_ipfix *row)
4258
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_POINT_ID]);
4262
ovsrec_ipfix_verify_sampling(const struct ovsrec_ipfix *row)
4265
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_SAMPLING]);
4269
ovsrec_ipfix_verify_targets(const struct ovsrec_ipfix *row)
4272
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_TARGETS]);
4275
/* Returns the cache_active_timeout column's value in 'row' as a struct ovsdb_datum.
4276
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
4277
* easier and more efficient way to search for a given key than implementing
4278
* the same operation on the "cooked" form in 'row'.
4280
* 'key_type' must be OVSDB_TYPE_INTEGER.
4281
* (This helps to avoid silent bugs if someone changes cache_active_timeout's
4282
* type without updating the caller.)
4284
* The caller must not modify or free the returned value.
4286
* Various kinds of changes can invalidate the returned value: modifying
4287
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4288
* If the returned value is needed for a long time, it is best to make a copy
4289
* of it with ovsdb_datum_clone(). */
4290
const struct ovsdb_datum *
4291
ovsrec_ipfix_get_cache_active_timeout(const struct ovsrec_ipfix *row,
4292
enum ovsdb_atomic_type key_type OVS_UNUSED)
4294
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4295
return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_active_timeout);
4298
/* Returns the cache_max_flows column's value in 'row' as a struct ovsdb_datum.
4299
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
4300
* easier and more efficient way to search for a given key than implementing
4301
* the same operation on the "cooked" form in 'row'.
4303
* 'key_type' must be OVSDB_TYPE_INTEGER.
4304
* (This helps to avoid silent bugs if someone changes cache_max_flows's
4305
* type without updating the caller.)
4307
* The caller must not modify or free the returned value.
4309
* Various kinds of changes can invalidate the returned value: modifying
4310
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4311
* If the returned value is needed for a long time, it is best to make a copy
4312
* of it with ovsdb_datum_clone(). */
4313
const struct ovsdb_datum *
4314
ovsrec_ipfix_get_cache_max_flows(const struct ovsrec_ipfix *row,
4315
enum ovsdb_atomic_type key_type OVS_UNUSED)
4317
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4318
return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_max_flows);
4321
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
4322
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
4323
* easier and more efficient way to search for a given key than implementing
4324
* the same operation on the "cooked" form in 'row'.
4326
* 'key_type' must be OVSDB_TYPE_STRING.
4327
* 'value_type' must be OVSDB_TYPE_STRING.
4328
* (This helps to avoid silent bugs if someone changes external_ids's
4329
* type without updating the caller.)
4331
* The caller must not modify or free the returned value.
4333
* Various kinds of changes can invalidate the returned value: modifying
4334
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4335
* If the returned value is needed for a long time, it is best to make a copy
4336
* of it with ovsdb_datum_clone(). */
4337
const struct ovsdb_datum *
4338
ovsrec_ipfix_get_external_ids(const struct ovsrec_ipfix *row,
4339
enum ovsdb_atomic_type key_type OVS_UNUSED,
4340
enum ovsdb_atomic_type value_type OVS_UNUSED)
4342
ovs_assert(key_type == OVSDB_TYPE_STRING);
4343
ovs_assert(value_type == OVSDB_TYPE_STRING);
4344
return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_external_ids);
4347
/* Returns the obs_domain_id column's value in 'row' as a struct ovsdb_datum.
4348
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
4349
* easier and more efficient way to search for a given key than implementing
4350
* the same operation on the "cooked" form in 'row'.
4352
* 'key_type' must be OVSDB_TYPE_INTEGER.
4353
* (This helps to avoid silent bugs if someone changes obs_domain_id's
4354
* type without updating the caller.)
4356
* The caller must not modify or free the returned value.
4358
* Various kinds of changes can invalidate the returned value: modifying
4359
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4360
* If the returned value is needed for a long time, it is best to make a copy
4361
* of it with ovsdb_datum_clone(). */
4362
const struct ovsdb_datum *
4363
ovsrec_ipfix_get_obs_domain_id(const struct ovsrec_ipfix *row,
4364
enum ovsdb_atomic_type key_type OVS_UNUSED)
4366
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4367
return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_domain_id);
4370
/* Returns the obs_point_id column's value in 'row' as a struct ovsdb_datum.
4371
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
4372
* easier and more efficient way to search for a given key than implementing
4373
* the same operation on the "cooked" form in 'row'.
4375
* 'key_type' must be OVSDB_TYPE_INTEGER.
4376
* (This helps to avoid silent bugs if someone changes obs_point_id's
4377
* type without updating the caller.)
4379
* The caller must not modify or free the returned value.
4381
* Various kinds of changes can invalidate the returned value: modifying
4382
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4383
* If the returned value is needed for a long time, it is best to make a copy
4384
* of it with ovsdb_datum_clone(). */
4385
const struct ovsdb_datum *
4386
ovsrec_ipfix_get_obs_point_id(const struct ovsrec_ipfix *row,
4387
enum ovsdb_atomic_type key_type OVS_UNUSED)
4389
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4390
return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_point_id);
4393
/* Returns the sampling column's value in 'row' as a struct ovsdb_datum.
4394
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
4395
* easier and more efficient way to search for a given key than implementing
4396
* the same operation on the "cooked" form in 'row'.
4398
* 'key_type' must be OVSDB_TYPE_INTEGER.
4399
* (This helps to avoid silent bugs if someone changes sampling's
4400
* type without updating the caller.)
4402
* The caller must not modify or free the returned value.
4404
* Various kinds of changes can invalidate the returned value: modifying
4405
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4406
* If the returned value is needed for a long time, it is best to make a copy
4407
* of it with ovsdb_datum_clone(). */
4408
const struct ovsdb_datum *
4409
ovsrec_ipfix_get_sampling(const struct ovsrec_ipfix *row,
4410
enum ovsdb_atomic_type key_type OVS_UNUSED)
4412
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4413
return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_sampling);
4416
/* Returns the targets column's value in 'row' as a struct ovsdb_datum.
4417
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
4418
* easier and more efficient way to search for a given key than implementing
4419
* the same operation on the "cooked" form in 'row'.
4421
* 'key_type' must be OVSDB_TYPE_STRING.
4422
* (This helps to avoid silent bugs if someone changes targets's
4423
* type without updating the caller.)
4425
* The caller must not modify or free the returned value.
4427
* Various kinds of changes can invalidate the returned value: modifying
4428
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4429
* If the returned value is needed for a long time, it is best to make a copy
4430
* of it with ovsdb_datum_clone(). */
4431
const struct ovsdb_datum *
4432
ovsrec_ipfix_get_targets(const struct ovsrec_ipfix *row,
4433
enum ovsdb_atomic_type key_type OVS_UNUSED)
4435
ovs_assert(key_type == OVSDB_TYPE_STRING);
4436
return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_targets);
4440
ovsrec_ipfix_set_cache_active_timeout(const struct ovsrec_ipfix *row, const int64_t *cache_active_timeout, size_t n_cache_active_timeout)
4442
struct ovsdb_datum datum;
4443
union ovsdb_atom key;
4446
if (n_cache_active_timeout) {
4449
key.integer = *cache_active_timeout;
4454
datum.values = NULL;
4455
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_ACTIVE_TIMEOUT], &datum);
4459
ovsrec_ipfix_set_cache_max_flows(const struct ovsrec_ipfix *row, const int64_t *cache_max_flows, size_t n_cache_max_flows)
4461
struct ovsdb_datum datum;
4462
union ovsdb_atom key;
4465
if (n_cache_max_flows) {
4468
key.integer = *cache_max_flows;
4473
datum.values = NULL;
4474
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_MAX_FLOWS], &datum);
4478
ovsrec_ipfix_set_external_ids(const struct ovsrec_ipfix *row, const struct smap *smap)
4480
struct ovsdb_datum datum;
4484
struct smap_node *node;
4487
datum.n = smap_count(smap);
4488
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
4489
datum.values = xmalloc(datum.n * sizeof *datum.values);
4492
SMAP_FOR_EACH (node, smap) {
4493
datum.keys[i].string = xstrdup(node->key);
4494
datum.values[i].string = xstrdup(node->value);
4497
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
4499
ovsdb_datum_init_empty(&datum);
4501
ovsdb_idl_txn_write(&row->header_,
4502
&ovsrec_ipfix_columns[OVSREC_IPFIX_COL_EXTERNAL_IDS],
4508
ovsrec_ipfix_set_obs_domain_id(const struct ovsrec_ipfix *row, const int64_t *obs_domain_id, size_t n_obs_domain_id)
4510
struct ovsdb_datum datum;
4511
union ovsdb_atom key;
4514
if (n_obs_domain_id) {
4517
key.integer = *obs_domain_id;
4522
datum.values = NULL;
4523
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_DOMAIN_ID], &datum);
4527
ovsrec_ipfix_set_obs_point_id(const struct ovsrec_ipfix *row, const int64_t *obs_point_id, size_t n_obs_point_id)
4529
struct ovsdb_datum datum;
4530
union ovsdb_atom key;
4533
if (n_obs_point_id) {
4536
key.integer = *obs_point_id;
4541
datum.values = NULL;
4542
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_POINT_ID], &datum);
4546
ovsrec_ipfix_set_sampling(const struct ovsrec_ipfix *row, const int64_t *sampling, size_t n_sampling)
4548
struct ovsdb_datum datum;
4549
union ovsdb_atom key;
4555
key.integer = *sampling;
4560
datum.values = NULL;
4561
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_SAMPLING], &datum);
4565
ovsrec_ipfix_set_targets(const struct ovsrec_ipfix *row, char **targets, size_t n_targets)
4567
struct ovsdb_datum datum;
4571
datum.n = n_targets;
4572
datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
4573
datum.values = NULL;
4574
for (i = 0; i < n_targets; i++) {
4575
datum.keys[i].string = xstrdup(targets[i]);
4577
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
4578
ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_TARGETS], &datum);
4581
struct ovsdb_idl_column ovsrec_ipfix_columns[OVSREC_IPFIX_N_COLUMNS];
4584
ovsrec_ipfix_columns_init(void)
4586
struct ovsdb_idl_column *c;
4588
/* Initialize ovsrec_ipfix_col_cache_active_timeout. */
4589
c = &ovsrec_ipfix_col_cache_active_timeout;
4590
c->name = "cache_active_timeout";
4591
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4592
c->type.key.u.integer.min = INT64_C(0);
4593
c->type.key.u.integer.max = INT64_C(4200);
4594
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4598
c->parse = ovsrec_ipfix_parse_cache_active_timeout;
4599
c->unparse = ovsrec_ipfix_unparse_cache_active_timeout;
4601
/* Initialize ovsrec_ipfix_col_cache_max_flows. */
4602
c = &ovsrec_ipfix_col_cache_max_flows;
4603
c->name = "cache_max_flows";
4604
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4605
c->type.key.u.integer.min = INT64_C(0);
4606
c->type.key.u.integer.max = INT64_C(4294967295);
4607
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4611
c->parse = ovsrec_ipfix_parse_cache_max_flows;
4612
c->unparse = ovsrec_ipfix_unparse_cache_max_flows;
4614
/* Initialize ovsrec_ipfix_col_external_ids. */
4615
c = &ovsrec_ipfix_col_external_ids;
4616
c->name = "external_ids";
4617
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
4618
c->type.key.u.string.minLen = 0;
4619
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
4620
c->type.value.u.string.minLen = 0;
4622
c->type.n_max = UINT_MAX;
4624
c->parse = ovsrec_ipfix_parse_external_ids;
4625
c->unparse = ovsrec_ipfix_unparse_external_ids;
4627
/* Initialize ovsrec_ipfix_col_obs_domain_id. */
4628
c = &ovsrec_ipfix_col_obs_domain_id;
4629
c->name = "obs_domain_id";
4630
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4631
c->type.key.u.integer.min = INT64_C(0);
4632
c->type.key.u.integer.max = INT64_C(4294967295);
4633
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4637
c->parse = ovsrec_ipfix_parse_obs_domain_id;
4638
c->unparse = ovsrec_ipfix_unparse_obs_domain_id;
4640
/* Initialize ovsrec_ipfix_col_obs_point_id. */
4641
c = &ovsrec_ipfix_col_obs_point_id;
4642
c->name = "obs_point_id";
4643
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4644
c->type.key.u.integer.min = INT64_C(0);
4645
c->type.key.u.integer.max = INT64_C(4294967295);
4646
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4650
c->parse = ovsrec_ipfix_parse_obs_point_id;
4651
c->unparse = ovsrec_ipfix_unparse_obs_point_id;
4653
/* Initialize ovsrec_ipfix_col_sampling. */
4654
c = &ovsrec_ipfix_col_sampling;
4655
c->name = "sampling";
4656
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4657
c->type.key.u.integer.min = INT64_C(1);
4658
c->type.key.u.integer.max = INT64_C(4294967295);
4659
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4663
c->parse = ovsrec_ipfix_parse_sampling;
4664
c->unparse = ovsrec_ipfix_unparse_sampling;
4666
/* Initialize ovsrec_ipfix_col_targets. */
4667
c = &ovsrec_ipfix_col_targets;
4668
c->name = "targets";
4669
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
4670
c->type.key.u.string.minLen = 0;
4671
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4673
c->type.n_max = UINT_MAX;
4675
c->parse = ovsrec_ipfix_parse_targets;
4676
c->unparse = ovsrec_ipfix_unparse_targets;
4679
/* Interface table. */
4682
ovsrec_interface_parse_admin_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4684
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4687
if (datum->n >= 1) {
4688
row->admin_state = datum->keys[0].string;
4690
row->admin_state = NULL;
4695
ovsrec_interface_parse_bfd(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4697
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4701
smap_init(&row->bfd);
4702
for (i = 0; i < datum->n; i++) {
4704
datum->keys[i].string,
4705
datum->values[i].string);
4710
ovsrec_interface_parse_bfd_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4712
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4716
smap_init(&row->bfd_status);
4717
for (i = 0; i < datum->n; i++) {
4718
smap_add(&row->bfd_status,
4719
datum->keys[i].string,
4720
datum->values[i].string);
4725
ovsrec_interface_parse_cfm_fault(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4727
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4728
size_t n = MIN(1, datum->n);
4732
row->cfm_fault = NULL;
4733
row->n_cfm_fault = 0;
4734
for (i = 0; i < n; i++) {
4735
if (!row->n_cfm_fault) {
4736
row->cfm_fault = xmalloc(n * sizeof_bool);
4738
row->cfm_fault[row->n_cfm_fault] = datum->keys[i].boolean;
4744
ovsrec_interface_parse_cfm_fault_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4746
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4750
row->cfm_fault_status = NULL;
4751
row->n_cfm_fault_status = 0;
4752
for (i = 0; i < datum->n; i++) {
4753
if (!row->n_cfm_fault_status) {
4754
row->cfm_fault_status = xmalloc(datum->n * sizeof *row->cfm_fault_status);
4756
row->cfm_fault_status[row->n_cfm_fault_status] = datum->keys[i].string;
4757
row->n_cfm_fault_status++;
4762
ovsrec_interface_parse_cfm_flap_count(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4764
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4765
size_t n = MIN(1, datum->n);
4769
row->cfm_flap_count = NULL;
4770
row->n_cfm_flap_count = 0;
4771
for (i = 0; i < n; i++) {
4772
if (!row->n_cfm_flap_count) {
4773
row->cfm_flap_count = xmalloc(n * sizeof *row->cfm_flap_count);
4775
row->cfm_flap_count[row->n_cfm_flap_count] = datum->keys[i].integer;
4776
row->n_cfm_flap_count++;
4781
ovsrec_interface_parse_cfm_health(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4783
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4784
size_t n = MIN(1, datum->n);
4788
row->cfm_health = NULL;
4789
row->n_cfm_health = 0;
4790
for (i = 0; i < n; i++) {
4791
if (!row->n_cfm_health) {
4792
row->cfm_health = xmalloc(n * sizeof *row->cfm_health);
4794
row->cfm_health[row->n_cfm_health] = datum->keys[i].integer;
4795
row->n_cfm_health++;
4800
ovsrec_interface_parse_cfm_mpid(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4802
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4803
size_t n = MIN(1, datum->n);
4807
row->cfm_mpid = NULL;
4808
row->n_cfm_mpid = 0;
4809
for (i = 0; i < n; i++) {
4810
if (!row->n_cfm_mpid) {
4811
row->cfm_mpid = xmalloc(n * sizeof *row->cfm_mpid);
4813
row->cfm_mpid[row->n_cfm_mpid] = datum->keys[i].integer;
4819
ovsrec_interface_parse_cfm_remote_mpids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4821
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4825
row->cfm_remote_mpids = NULL;
4826
row->n_cfm_remote_mpids = 0;
4827
for (i = 0; i < datum->n; i++) {
4828
if (!row->n_cfm_remote_mpids) {
4829
row->cfm_remote_mpids = xmalloc(datum->n * sizeof *row->cfm_remote_mpids);
4831
row->cfm_remote_mpids[row->n_cfm_remote_mpids] = datum->keys[i].integer;
4832
row->n_cfm_remote_mpids++;
4837
ovsrec_interface_parse_cfm_remote_opstate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4839
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4842
if (datum->n >= 1) {
4843
row->cfm_remote_opstate = datum->keys[0].string;
4845
row->cfm_remote_opstate = NULL;
4850
ovsrec_interface_parse_duplex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4852
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4855
if (datum->n >= 1) {
4856
row->duplex = datum->keys[0].string;
4863
ovsrec_interface_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4865
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4869
smap_init(&row->external_ids);
4870
for (i = 0; i < datum->n; i++) {
4871
smap_add(&row->external_ids,
4872
datum->keys[i].string,
4873
datum->values[i].string);
4878
ovsrec_interface_parse_ifindex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4880
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4881
size_t n = MIN(1, datum->n);
4885
row->ifindex = NULL;
4887
for (i = 0; i < n; i++) {
4888
if (!row->n_ifindex) {
4889
row->ifindex = xmalloc(n * sizeof *row->ifindex);
4891
row->ifindex[row->n_ifindex] = datum->keys[i].integer;
4897
ovsrec_interface_parse_ingress_policing_burst(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4899
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4902
if (datum->n >= 1) {
4903
row->ingress_policing_burst = datum->keys[0].integer;
4905
row->ingress_policing_burst = 0;
4910
ovsrec_interface_parse_ingress_policing_rate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4912
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4915
if (datum->n >= 1) {
4916
row->ingress_policing_rate = datum->keys[0].integer;
4918
row->ingress_policing_rate = 0;
4923
ovsrec_interface_parse_lacp_current(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4925
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4926
size_t n = MIN(1, datum->n);
4930
row->lacp_current = NULL;
4931
row->n_lacp_current = 0;
4932
for (i = 0; i < n; i++) {
4933
if (!row->n_lacp_current) {
4934
row->lacp_current = xmalloc(n * sizeof_bool);
4936
row->lacp_current[row->n_lacp_current] = datum->keys[i].boolean;
4937
row->n_lacp_current++;
4942
ovsrec_interface_parse_link_resets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4944
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4945
size_t n = MIN(1, datum->n);
4949
row->link_resets = NULL;
4950
row->n_link_resets = 0;
4951
for (i = 0; i < n; i++) {
4952
if (!row->n_link_resets) {
4953
row->link_resets = xmalloc(n * sizeof *row->link_resets);
4955
row->link_resets[row->n_link_resets] = datum->keys[i].integer;
4956
row->n_link_resets++;
4961
ovsrec_interface_parse_link_speed(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4963
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4964
size_t n = MIN(1, datum->n);
4968
row->link_speed = NULL;
4969
row->n_link_speed = 0;
4970
for (i = 0; i < n; i++) {
4971
if (!row->n_link_speed) {
4972
row->link_speed = xmalloc(n * sizeof *row->link_speed);
4974
row->link_speed[row->n_link_speed] = datum->keys[i].integer;
4975
row->n_link_speed++;
4980
ovsrec_interface_parse_link_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4982
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4985
if (datum->n >= 1) {
4986
row->link_state = datum->keys[0].string;
4988
row->link_state = NULL;
4993
ovsrec_interface_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4995
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4998
if (datum->n >= 1) {
4999
row->mac = datum->keys[0].string;
5006
ovsrec_interface_parse_mac_in_use(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5008
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5011
if (datum->n >= 1) {
5012
row->mac_in_use = datum->keys[0].string;
5014
row->mac_in_use = NULL;
5019
ovsrec_interface_parse_mtu(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5021
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5022
size_t n = MIN(1, datum->n);
5028
for (i = 0; i < n; i++) {
5030
row->mtu = xmalloc(n * sizeof *row->mtu);
5032
row->mtu[row->n_mtu] = datum->keys[i].integer;
5038
ovsrec_interface_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5040
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5043
if (datum->n >= 1) {
5044
row->name = datum->keys[0].string;
5051
ovsrec_interface_parse_ofport(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5053
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5054
size_t n = MIN(1, datum->n);
5060
for (i = 0; i < n; i++) {
5061
if (!row->n_ofport) {
5062
row->ofport = xmalloc(n * sizeof *row->ofport);
5064
row->ofport[row->n_ofport] = datum->keys[i].integer;
5070
ovsrec_interface_parse_ofport_request(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5072
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5073
size_t n = MIN(1, datum->n);
5077
row->ofport_request = NULL;
5078
row->n_ofport_request = 0;
5079
for (i = 0; i < n; i++) {
5080
if (!row->n_ofport_request) {
5081
row->ofport_request = xmalloc(n * sizeof *row->ofport_request);
5083
row->ofport_request[row->n_ofport_request] = datum->keys[i].integer;
5084
row->n_ofport_request++;
5089
ovsrec_interface_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5091
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5095
smap_init(&row->options);
5096
for (i = 0; i < datum->n; i++) {
5097
smap_add(&row->options,
5098
datum->keys[i].string,
5099
datum->values[i].string);
5104
ovsrec_interface_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5106
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5110
smap_init(&row->other_config);
5111
for (i = 0; i < datum->n; i++) {
5112
smap_add(&row->other_config,
5113
datum->keys[i].string,
5114
datum->values[i].string);
5119
ovsrec_interface_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5121
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5125
row->key_statistics = NULL;
5126
row->value_statistics = NULL;
5127
row->n_statistics = 0;
5128
for (i = 0; i < datum->n; i++) {
5129
if (!row->n_statistics) {
5130
row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
5131
row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
5133
row->key_statistics[row->n_statistics] = datum->keys[i].string;
5134
row->value_statistics[row->n_statistics] = datum->values[i].integer;
5135
row->n_statistics++;
5140
ovsrec_interface_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5142
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5146
smap_init(&row->status);
5147
for (i = 0; i < datum->n; i++) {
5148
smap_add(&row->status,
5149
datum->keys[i].string,
5150
datum->values[i].string);
5155
ovsrec_interface_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5157
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5160
if (datum->n >= 1) {
5161
row->type = datum->keys[0].string;
5168
ovsrec_interface_unparse_admin_state(struct ovsdb_idl_row *row OVS_UNUSED)
5170
/* Nothing to do. */
5174
ovsrec_interface_unparse_bfd(struct ovsdb_idl_row *row_)
5176
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5179
smap_destroy(&row->bfd);
5183
ovsrec_interface_unparse_bfd_status(struct ovsdb_idl_row *row_)
5185
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5188
smap_destroy(&row->bfd_status);
5192
ovsrec_interface_unparse_cfm_fault(struct ovsdb_idl_row *row_)
5194
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5197
free(row->cfm_fault);
5201
ovsrec_interface_unparse_cfm_fault_status(struct ovsdb_idl_row *row_)
5203
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5206
free(row->cfm_fault_status);
5210
ovsrec_interface_unparse_cfm_flap_count(struct ovsdb_idl_row *row_)
5212
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5215
free(row->cfm_flap_count);
5219
ovsrec_interface_unparse_cfm_health(struct ovsdb_idl_row *row_)
5221
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5224
free(row->cfm_health);
5228
ovsrec_interface_unparse_cfm_mpid(struct ovsdb_idl_row *row_)
5230
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5233
free(row->cfm_mpid);
5237
ovsrec_interface_unparse_cfm_remote_mpids(struct ovsdb_idl_row *row_)
5239
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5242
free(row->cfm_remote_mpids);
5246
ovsrec_interface_unparse_cfm_remote_opstate(struct ovsdb_idl_row *row OVS_UNUSED)
5248
/* Nothing to do. */
5252
ovsrec_interface_unparse_duplex(struct ovsdb_idl_row *row OVS_UNUSED)
5254
/* Nothing to do. */
5258
ovsrec_interface_unparse_external_ids(struct ovsdb_idl_row *row_)
5260
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5263
smap_destroy(&row->external_ids);
5267
ovsrec_interface_unparse_ifindex(struct ovsdb_idl_row *row_)
5269
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5276
ovsrec_interface_unparse_ingress_policing_burst(struct ovsdb_idl_row *row OVS_UNUSED)
5278
/* Nothing to do. */
5282
ovsrec_interface_unparse_ingress_policing_rate(struct ovsdb_idl_row *row OVS_UNUSED)
5284
/* Nothing to do. */
5288
ovsrec_interface_unparse_lacp_current(struct ovsdb_idl_row *row_)
5290
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5293
free(row->lacp_current);
5297
ovsrec_interface_unparse_link_resets(struct ovsdb_idl_row *row_)
5299
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5302
free(row->link_resets);
5306
ovsrec_interface_unparse_link_speed(struct ovsdb_idl_row *row_)
5308
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5311
free(row->link_speed);
5315
ovsrec_interface_unparse_link_state(struct ovsdb_idl_row *row OVS_UNUSED)
5317
/* Nothing to do. */
5321
ovsrec_interface_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
5323
/* Nothing to do. */
5327
ovsrec_interface_unparse_mac_in_use(struct ovsdb_idl_row *row OVS_UNUSED)
5329
/* Nothing to do. */
5333
ovsrec_interface_unparse_mtu(struct ovsdb_idl_row *row_)
5335
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5342
ovsrec_interface_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
5344
/* Nothing to do. */
5348
ovsrec_interface_unparse_ofport(struct ovsdb_idl_row *row_)
5350
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5357
ovsrec_interface_unparse_ofport_request(struct ovsdb_idl_row *row_)
5359
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5362
free(row->ofport_request);
5366
ovsrec_interface_unparse_options(struct ovsdb_idl_row *row_)
5368
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5371
smap_destroy(&row->options);
5375
ovsrec_interface_unparse_other_config(struct ovsdb_idl_row *row_)
5377
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5380
smap_destroy(&row->other_config);
5384
ovsrec_interface_unparse_statistics(struct ovsdb_idl_row *row_)
5386
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5389
free(row->key_statistics);
5390
free(row->value_statistics);
5394
ovsrec_interface_unparse_status(struct ovsdb_idl_row *row_)
5396
struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5399
smap_destroy(&row->status);
5403
ovsrec_interface_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
5405
/* Nothing to do. */
5409
ovsrec_interface_init__(struct ovsdb_idl_row *row)
5411
ovsrec_interface_init(ovsrec_interface_cast(row));
5415
ovsrec_interface_init(struct ovsrec_interface *row)
5417
memset(row, 0, sizeof *row);
5418
smap_init(&row->bfd);
5419
smap_init(&row->bfd_status);
5420
smap_init(&row->external_ids);
5421
smap_init(&row->options);
5422
smap_init(&row->other_config);
5423
smap_init(&row->status);
5426
const struct ovsrec_interface *
5427
ovsrec_interface_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
5429
return ovsrec_interface_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE], uuid));
5432
const struct ovsrec_interface *
5433
ovsrec_interface_first(const struct ovsdb_idl *idl)
5435
return ovsrec_interface_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]));
5438
const struct ovsrec_interface *
5439
ovsrec_interface_next(const struct ovsrec_interface *row)
5441
return ovsrec_interface_cast(ovsdb_idl_next_row(&row->header_));
5445
ovsrec_interface_delete(const struct ovsrec_interface *row)
5447
ovsdb_idl_txn_delete(&row->header_);
5450
struct ovsrec_interface *
5451
ovsrec_interface_insert(struct ovsdb_idl_txn *txn)
5453
return ovsrec_interface_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE], NULL));
5458
ovsrec_interface_verify_admin_state(const struct ovsrec_interface *row)
5461
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_ADMIN_STATE]);
5465
ovsrec_interface_verify_bfd(const struct ovsrec_interface *row)
5468
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD]);
5472
ovsrec_interface_verify_bfd_status(const struct ovsrec_interface *row)
5475
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD_STATUS]);
5479
ovsrec_interface_verify_cfm_fault(const struct ovsrec_interface *row)
5482
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT]);
5486
ovsrec_interface_verify_cfm_fault_status(const struct ovsrec_interface *row)
5489
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT_STATUS]);
5493
ovsrec_interface_verify_cfm_flap_count(const struct ovsrec_interface *row)
5496
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FLAP_COUNT]);
5500
ovsrec_interface_verify_cfm_health(const struct ovsrec_interface *row)
5503
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_HEALTH]);
5507
ovsrec_interface_verify_cfm_mpid(const struct ovsrec_interface *row)
5510
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_MPID]);
5514
ovsrec_interface_verify_cfm_remote_mpids(const struct ovsrec_interface *row)
5517
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_MPIDS]);
5521
ovsrec_interface_verify_cfm_remote_opstate(const struct ovsrec_interface *row)
5524
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_OPSTATE]);
5528
ovsrec_interface_verify_duplex(const struct ovsrec_interface *row)
5531
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_DUPLEX]);
5535
ovsrec_interface_verify_external_ids(const struct ovsrec_interface *row)
5538
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_EXTERNAL_IDS]);
5542
ovsrec_interface_verify_ifindex(const struct ovsrec_interface *row)
5545
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_IFINDEX]);
5549
ovsrec_interface_verify_ingress_policing_burst(const struct ovsrec_interface *row)
5552
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_BURST]);
5556
ovsrec_interface_verify_ingress_policing_rate(const struct ovsrec_interface *row)
5559
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_RATE]);
5563
ovsrec_interface_verify_lacp_current(const struct ovsrec_interface *row)
5566
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LACP_CURRENT]);
5570
ovsrec_interface_verify_link_resets(const struct ovsrec_interface *row)
5573
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_RESETS]);
5577
ovsrec_interface_verify_link_speed(const struct ovsrec_interface *row)
5580
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_SPEED]);
5584
ovsrec_interface_verify_link_state(const struct ovsrec_interface *row)
5587
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_STATE]);
5591
ovsrec_interface_verify_mac(const struct ovsrec_interface *row)
5594
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC]);
5598
ovsrec_interface_verify_mac_in_use(const struct ovsrec_interface *row)
5601
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC_IN_USE]);
5605
ovsrec_interface_verify_mtu(const struct ovsrec_interface *row)
5608
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MTU]);
5612
ovsrec_interface_verify_name(const struct ovsrec_interface *row)
5615
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_NAME]);
5619
ovsrec_interface_verify_ofport(const struct ovsrec_interface *row)
5622
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT]);
5626
ovsrec_interface_verify_ofport_request(const struct ovsrec_interface *row)
5629
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT_REQUEST]);
5633
ovsrec_interface_verify_options(const struct ovsrec_interface *row)
5636
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OPTIONS]);
5640
ovsrec_interface_verify_other_config(const struct ovsrec_interface *row)
5643
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OTHER_CONFIG]);
5647
ovsrec_interface_verify_statistics(const struct ovsrec_interface *row)
5650
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATISTICS]);
5654
ovsrec_interface_verify_status(const struct ovsrec_interface *row)
5657
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATUS]);
5661
ovsrec_interface_verify_type(const struct ovsrec_interface *row)
5664
ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_TYPE]);
5667
/* Returns the admin_state column's value in 'row' as a struct ovsdb_datum.
5668
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5669
* easier and more efficient way to search for a given key than implementing
5670
* the same operation on the "cooked" form in 'row'.
5672
* 'key_type' must be OVSDB_TYPE_STRING.
5673
* (This helps to avoid silent bugs if someone changes admin_state's
5674
* type without updating the caller.)
5676
* The caller must not modify or free the returned value.
5678
* Various kinds of changes can invalidate the returned value: modifying
5679
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5680
* If the returned value is needed for a long time, it is best to make a copy
5681
* of it with ovsdb_datum_clone(). */
5682
const struct ovsdb_datum *
5683
ovsrec_interface_get_admin_state(const struct ovsrec_interface *row,
5684
enum ovsdb_atomic_type key_type OVS_UNUSED)
5686
ovs_assert(key_type == OVSDB_TYPE_STRING);
5687
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_admin_state);
5690
/* Returns the bfd column's value in 'row' as a struct ovsdb_datum.
5691
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5692
* easier and more efficient way to search for a given key than implementing
5693
* the same operation on the "cooked" form in 'row'.
5695
* 'key_type' must be OVSDB_TYPE_STRING.
5696
* 'value_type' must be OVSDB_TYPE_STRING.
5697
* (This helps to avoid silent bugs if someone changes bfd's
5698
* type without updating the caller.)
5700
* The caller must not modify or free the returned value.
5702
* Various kinds of changes can invalidate the returned value: modifying
5703
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5704
* If the returned value is needed for a long time, it is best to make a copy
5705
* of it with ovsdb_datum_clone(). */
5706
const struct ovsdb_datum *
5707
ovsrec_interface_get_bfd(const struct ovsrec_interface *row,
5708
enum ovsdb_atomic_type key_type OVS_UNUSED,
5709
enum ovsdb_atomic_type value_type OVS_UNUSED)
5711
ovs_assert(key_type == OVSDB_TYPE_STRING);
5712
ovs_assert(value_type == OVSDB_TYPE_STRING);
5713
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd);
5716
/* Returns the bfd_status column's value in 'row' as a struct ovsdb_datum.
5717
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5718
* easier and more efficient way to search for a given key than implementing
5719
* the same operation on the "cooked" form in 'row'.
5721
* 'key_type' must be OVSDB_TYPE_STRING.
5722
* 'value_type' must be OVSDB_TYPE_STRING.
5723
* (This helps to avoid silent bugs if someone changes bfd_status's
5724
* type without updating the caller.)
5726
* The caller must not modify or free the returned value.
5728
* Various kinds of changes can invalidate the returned value: modifying
5729
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5730
* If the returned value is needed for a long time, it is best to make a copy
5731
* of it with ovsdb_datum_clone(). */
5732
const struct ovsdb_datum *
5733
ovsrec_interface_get_bfd_status(const struct ovsrec_interface *row,
5734
enum ovsdb_atomic_type key_type OVS_UNUSED,
5735
enum ovsdb_atomic_type value_type OVS_UNUSED)
5737
ovs_assert(key_type == OVSDB_TYPE_STRING);
5738
ovs_assert(value_type == OVSDB_TYPE_STRING);
5739
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd_status);
5742
/* Returns the cfm_fault column's value in 'row' as a struct ovsdb_datum.
5743
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5744
* easier and more efficient way to search for a given key than implementing
5745
* the same operation on the "cooked" form in 'row'.
5747
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
5748
* (This helps to avoid silent bugs if someone changes cfm_fault's
5749
* type without updating the caller.)
5751
* The caller must not modify or free the returned value.
5753
* Various kinds of changes can invalidate the returned value: modifying
5754
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5755
* If the returned value is needed for a long time, it is best to make a copy
5756
* of it with ovsdb_datum_clone(). */
5757
const struct ovsdb_datum *
5758
ovsrec_interface_get_cfm_fault(const struct ovsrec_interface *row,
5759
enum ovsdb_atomic_type key_type OVS_UNUSED)
5761
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
5762
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault);
5765
/* Returns the cfm_fault_status column's value in 'row' as a struct ovsdb_datum.
5766
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5767
* easier and more efficient way to search for a given key than implementing
5768
* the same operation on the "cooked" form in 'row'.
5770
* 'key_type' must be OVSDB_TYPE_STRING.
5771
* (This helps to avoid silent bugs if someone changes cfm_fault_status's
5772
* type without updating the caller.)
5774
* The caller must not modify or free the returned value.
5776
* Various kinds of changes can invalidate the returned value: modifying
5777
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5778
* If the returned value is needed for a long time, it is best to make a copy
5779
* of it with ovsdb_datum_clone(). */
5780
const struct ovsdb_datum *
5781
ovsrec_interface_get_cfm_fault_status(const struct ovsrec_interface *row,
5782
enum ovsdb_atomic_type key_type OVS_UNUSED)
5784
ovs_assert(key_type == OVSDB_TYPE_STRING);
5785
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault_status);
5788
/* Returns the cfm_flap_count column's value in 'row' as a struct ovsdb_datum.
5789
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5790
* easier and more efficient way to search for a given key than implementing
5791
* the same operation on the "cooked" form in 'row'.
5793
* 'key_type' must be OVSDB_TYPE_INTEGER.
5794
* (This helps to avoid silent bugs if someone changes cfm_flap_count's
5795
* type without updating the caller.)
5797
* The caller must not modify or free the returned value.
5799
* Various kinds of changes can invalidate the returned value: modifying
5800
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5801
* If the returned value is needed for a long time, it is best to make a copy
5802
* of it with ovsdb_datum_clone(). */
5803
const struct ovsdb_datum *
5804
ovsrec_interface_get_cfm_flap_count(const struct ovsrec_interface *row,
5805
enum ovsdb_atomic_type key_type OVS_UNUSED)
5807
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5808
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_flap_count);
5811
/* Returns the cfm_health column's value in 'row' as a struct ovsdb_datum.
5812
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5813
* easier and more efficient way to search for a given key than implementing
5814
* the same operation on the "cooked" form in 'row'.
5816
* 'key_type' must be OVSDB_TYPE_INTEGER.
5817
* (This helps to avoid silent bugs if someone changes cfm_health's
5818
* type without updating the caller.)
5820
* The caller must not modify or free the returned value.
5822
* Various kinds of changes can invalidate the returned value: modifying
5823
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5824
* If the returned value is needed for a long time, it is best to make a copy
5825
* of it with ovsdb_datum_clone(). */
5826
const struct ovsdb_datum *
5827
ovsrec_interface_get_cfm_health(const struct ovsrec_interface *row,
5828
enum ovsdb_atomic_type key_type OVS_UNUSED)
5830
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5831
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_health);
5834
/* Returns the cfm_mpid column's value in 'row' as a struct ovsdb_datum.
5835
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5836
* easier and more efficient way to search for a given key than implementing
5837
* the same operation on the "cooked" form in 'row'.
5839
* 'key_type' must be OVSDB_TYPE_INTEGER.
5840
* (This helps to avoid silent bugs if someone changes cfm_mpid's
5841
* type without updating the caller.)
5843
* The caller must not modify or free the returned value.
5845
* Various kinds of changes can invalidate the returned value: modifying
5846
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5847
* If the returned value is needed for a long time, it is best to make a copy
5848
* of it with ovsdb_datum_clone(). */
5849
const struct ovsdb_datum *
5850
ovsrec_interface_get_cfm_mpid(const struct ovsrec_interface *row,
5851
enum ovsdb_atomic_type key_type OVS_UNUSED)
5853
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5854
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_mpid);
5857
/* Returns the cfm_remote_mpids column's value in 'row' as a struct ovsdb_datum.
5858
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5859
* easier and more efficient way to search for a given key than implementing
5860
* the same operation on the "cooked" form in 'row'.
5862
* 'key_type' must be OVSDB_TYPE_INTEGER.
5863
* (This helps to avoid silent bugs if someone changes cfm_remote_mpids's
5864
* type without updating the caller.)
5866
* The caller must not modify or free the returned value.
5868
* Various kinds of changes can invalidate the returned value: modifying
5869
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5870
* If the returned value is needed for a long time, it is best to make a copy
5871
* of it with ovsdb_datum_clone(). */
5872
const struct ovsdb_datum *
5873
ovsrec_interface_get_cfm_remote_mpids(const struct ovsrec_interface *row,
5874
enum ovsdb_atomic_type key_type OVS_UNUSED)
5876
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5877
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_mpids);
5880
/* Returns the cfm_remote_opstate column's value in 'row' as a struct ovsdb_datum.
5881
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5882
* easier and more efficient way to search for a given key than implementing
5883
* the same operation on the "cooked" form in 'row'.
5885
* 'key_type' must be OVSDB_TYPE_STRING.
5886
* (This helps to avoid silent bugs if someone changes cfm_remote_opstate's
5887
* type without updating the caller.)
5889
* The caller must not modify or free the returned value.
5891
* Various kinds of changes can invalidate the returned value: modifying
5892
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5893
* If the returned value is needed for a long time, it is best to make a copy
5894
* of it with ovsdb_datum_clone(). */
5895
const struct ovsdb_datum *
5896
ovsrec_interface_get_cfm_remote_opstate(const struct ovsrec_interface *row,
5897
enum ovsdb_atomic_type key_type OVS_UNUSED)
5899
ovs_assert(key_type == OVSDB_TYPE_STRING);
5900
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_opstate);
5903
/* Returns the duplex column's value in 'row' as a struct ovsdb_datum.
5904
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5905
* easier and more efficient way to search for a given key than implementing
5906
* the same operation on the "cooked" form in 'row'.
5908
* 'key_type' must be OVSDB_TYPE_STRING.
5909
* (This helps to avoid silent bugs if someone changes duplex's
5910
* type without updating the caller.)
5912
* The caller must not modify or free the returned value.
5914
* Various kinds of changes can invalidate the returned value: modifying
5915
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5916
* If the returned value is needed for a long time, it is best to make a copy
5917
* of it with ovsdb_datum_clone(). */
5918
const struct ovsdb_datum *
5919
ovsrec_interface_get_duplex(const struct ovsrec_interface *row,
5920
enum ovsdb_atomic_type key_type OVS_UNUSED)
5922
ovs_assert(key_type == OVSDB_TYPE_STRING);
5923
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_duplex);
5926
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
5927
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5928
* easier and more efficient way to search for a given key than implementing
5929
* the same operation on the "cooked" form in 'row'.
5931
* 'key_type' must be OVSDB_TYPE_STRING.
5932
* 'value_type' must be OVSDB_TYPE_STRING.
5933
* (This helps to avoid silent bugs if someone changes external_ids's
5934
* type without updating the caller.)
5936
* The caller must not modify or free the returned value.
5938
* Various kinds of changes can invalidate the returned value: modifying
5939
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5940
* If the returned value is needed for a long time, it is best to make a copy
5941
* of it with ovsdb_datum_clone(). */
5942
const struct ovsdb_datum *
5943
ovsrec_interface_get_external_ids(const struct ovsrec_interface *row,
5944
enum ovsdb_atomic_type key_type OVS_UNUSED,
5945
enum ovsdb_atomic_type value_type OVS_UNUSED)
5947
ovs_assert(key_type == OVSDB_TYPE_STRING);
5948
ovs_assert(value_type == OVSDB_TYPE_STRING);
5949
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_external_ids);
5952
/* Returns the ifindex column's value in 'row' as a struct ovsdb_datum.
5953
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5954
* easier and more efficient way to search for a given key than implementing
5955
* the same operation on the "cooked" form in 'row'.
5957
* 'key_type' must be OVSDB_TYPE_INTEGER.
5958
* (This helps to avoid silent bugs if someone changes ifindex's
5959
* type without updating the caller.)
5961
* The caller must not modify or free the returned value.
5963
* Various kinds of changes can invalidate the returned value: modifying
5964
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5965
* If the returned value is needed for a long time, it is best to make a copy
5966
* of it with ovsdb_datum_clone(). */
5967
const struct ovsdb_datum *
5968
ovsrec_interface_get_ifindex(const struct ovsrec_interface *row,
5969
enum ovsdb_atomic_type key_type OVS_UNUSED)
5971
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5972
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ifindex);
5975
/* Returns the ingress_policing_burst column's value in 'row' as a struct ovsdb_datum.
5976
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
5977
* easier and more efficient way to search for a given key than implementing
5978
* the same operation on the "cooked" form in 'row'.
5980
* 'key_type' must be OVSDB_TYPE_INTEGER.
5981
* (This helps to avoid silent bugs if someone changes ingress_policing_burst's
5982
* type without updating the caller.)
5984
* The caller must not modify or free the returned value.
5986
* Various kinds of changes can invalidate the returned value: modifying
5987
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5988
* If the returned value is needed for a long time, it is best to make a copy
5989
* of it with ovsdb_datum_clone(). */
5990
const struct ovsdb_datum *
5991
ovsrec_interface_get_ingress_policing_burst(const struct ovsrec_interface *row,
5992
enum ovsdb_atomic_type key_type OVS_UNUSED)
5994
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5995
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_burst);
5998
/* Returns the ingress_policing_rate column's value in 'row' as a struct ovsdb_datum.
5999
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6000
* easier and more efficient way to search for a given key than implementing
6001
* the same operation on the "cooked" form in 'row'.
6003
* 'key_type' must be OVSDB_TYPE_INTEGER.
6004
* (This helps to avoid silent bugs if someone changes ingress_policing_rate's
6005
* type without updating the caller.)
6007
* The caller must not modify or free the returned value.
6009
* Various kinds of changes can invalidate the returned value: modifying
6010
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6011
* If the returned value is needed for a long time, it is best to make a copy
6012
* of it with ovsdb_datum_clone(). */
6013
const struct ovsdb_datum *
6014
ovsrec_interface_get_ingress_policing_rate(const struct ovsrec_interface *row,
6015
enum ovsdb_atomic_type key_type OVS_UNUSED)
6017
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6018
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_rate);
6021
/* Returns the lacp_current column's value in 'row' as a struct ovsdb_datum.
6022
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6023
* easier and more efficient way to search for a given key than implementing
6024
* the same operation on the "cooked" form in 'row'.
6026
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
6027
* (This helps to avoid silent bugs if someone changes lacp_current's
6028
* type without updating the caller.)
6030
* The caller must not modify or free the returned value.
6032
* Various kinds of changes can invalidate the returned value: modifying
6033
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6034
* If the returned value is needed for a long time, it is best to make a copy
6035
* of it with ovsdb_datum_clone(). */
6036
const struct ovsdb_datum *
6037
ovsrec_interface_get_lacp_current(const struct ovsrec_interface *row,
6038
enum ovsdb_atomic_type key_type OVS_UNUSED)
6040
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
6041
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_lacp_current);
6044
/* Returns the link_resets column's value in 'row' as a struct ovsdb_datum.
6045
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6046
* easier and more efficient way to search for a given key than implementing
6047
* the same operation on the "cooked" form in 'row'.
6049
* 'key_type' must be OVSDB_TYPE_INTEGER.
6050
* (This helps to avoid silent bugs if someone changes link_resets's
6051
* type without updating the caller.)
6053
* The caller must not modify or free the returned value.
6055
* Various kinds of changes can invalidate the returned value: modifying
6056
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6057
* If the returned value is needed for a long time, it is best to make a copy
6058
* of it with ovsdb_datum_clone(). */
6059
const struct ovsdb_datum *
6060
ovsrec_interface_get_link_resets(const struct ovsrec_interface *row,
6061
enum ovsdb_atomic_type key_type OVS_UNUSED)
6063
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6064
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_resets);
6067
/* Returns the link_speed column's value in 'row' as a struct ovsdb_datum.
6068
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6069
* easier and more efficient way to search for a given key than implementing
6070
* the same operation on the "cooked" form in 'row'.
6072
* 'key_type' must be OVSDB_TYPE_INTEGER.
6073
* (This helps to avoid silent bugs if someone changes link_speed's
6074
* type without updating the caller.)
6076
* The caller must not modify or free the returned value.
6078
* Various kinds of changes can invalidate the returned value: modifying
6079
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6080
* If the returned value is needed for a long time, it is best to make a copy
6081
* of it with ovsdb_datum_clone(). */
6082
const struct ovsdb_datum *
6083
ovsrec_interface_get_link_speed(const struct ovsrec_interface *row,
6084
enum ovsdb_atomic_type key_type OVS_UNUSED)
6086
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6087
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_speed);
6090
/* Returns the link_state column's value in 'row' as a struct ovsdb_datum.
6091
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6092
* easier and more efficient way to search for a given key than implementing
6093
* the same operation on the "cooked" form in 'row'.
6095
* 'key_type' must be OVSDB_TYPE_STRING.
6096
* (This helps to avoid silent bugs if someone changes link_state's
6097
* type without updating the caller.)
6099
* The caller must not modify or free the returned value.
6101
* Various kinds of changes can invalidate the returned value: modifying
6102
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6103
* If the returned value is needed for a long time, it is best to make a copy
6104
* of it with ovsdb_datum_clone(). */
6105
const struct ovsdb_datum *
6106
ovsrec_interface_get_link_state(const struct ovsrec_interface *row,
6107
enum ovsdb_atomic_type key_type OVS_UNUSED)
6109
ovs_assert(key_type == OVSDB_TYPE_STRING);
6110
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_state);
6113
/* Returns the mac column's value in 'row' as a struct ovsdb_datum.
6114
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6115
* easier and more efficient way to search for a given key than implementing
6116
* the same operation on the "cooked" form in 'row'.
6118
* 'key_type' must be OVSDB_TYPE_STRING.
6119
* (This helps to avoid silent bugs if someone changes mac's
6120
* type without updating the caller.)
6122
* The caller must not modify or free the returned value.
6124
* Various kinds of changes can invalidate the returned value: modifying
6125
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6126
* If the returned value is needed for a long time, it is best to make a copy
6127
* of it with ovsdb_datum_clone(). */
6128
const struct ovsdb_datum *
6129
ovsrec_interface_get_mac(const struct ovsrec_interface *row,
6130
enum ovsdb_atomic_type key_type OVS_UNUSED)
6132
ovs_assert(key_type == OVSDB_TYPE_STRING);
6133
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac);
6136
/* Returns the mac_in_use column's value in 'row' as a struct ovsdb_datum.
6137
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6138
* easier and more efficient way to search for a given key than implementing
6139
* the same operation on the "cooked" form in 'row'.
6141
* 'key_type' must be OVSDB_TYPE_STRING.
6142
* (This helps to avoid silent bugs if someone changes mac_in_use's
6143
* type without updating the caller.)
6145
* The caller must not modify or free the returned value.
6147
* Various kinds of changes can invalidate the returned value: modifying
6148
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6149
* If the returned value is needed for a long time, it is best to make a copy
6150
* of it with ovsdb_datum_clone(). */
6151
const struct ovsdb_datum *
6152
ovsrec_interface_get_mac_in_use(const struct ovsrec_interface *row,
6153
enum ovsdb_atomic_type key_type OVS_UNUSED)
6155
ovs_assert(key_type == OVSDB_TYPE_STRING);
6156
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac_in_use);
6159
/* Returns the mtu column's value in 'row' as a struct ovsdb_datum.
6160
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6161
* easier and more efficient way to search for a given key than implementing
6162
* the same operation on the "cooked" form in 'row'.
6164
* 'key_type' must be OVSDB_TYPE_INTEGER.
6165
* (This helps to avoid silent bugs if someone changes mtu's
6166
* type without updating the caller.)
6168
* The caller must not modify or free the returned value.
6170
* Various kinds of changes can invalidate the returned value: modifying
6171
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6172
* If the returned value is needed for a long time, it is best to make a copy
6173
* of it with ovsdb_datum_clone(). */
6174
const struct ovsdb_datum *
6175
ovsrec_interface_get_mtu(const struct ovsrec_interface *row,
6176
enum ovsdb_atomic_type key_type OVS_UNUSED)
6178
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6179
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mtu);
6182
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
6183
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6184
* easier and more efficient way to search for a given key than implementing
6185
* the same operation on the "cooked" form in 'row'.
6187
* 'key_type' must be OVSDB_TYPE_STRING.
6188
* (This helps to avoid silent bugs if someone changes name's
6189
* type without updating the caller.)
6191
* The caller must not modify or free the returned value.
6193
* Various kinds of changes can invalidate the returned value: modifying
6194
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6195
* If the returned value is needed for a long time, it is best to make a copy
6196
* of it with ovsdb_datum_clone(). */
6197
const struct ovsdb_datum *
6198
ovsrec_interface_get_name(const struct ovsrec_interface *row,
6199
enum ovsdb_atomic_type key_type OVS_UNUSED)
6201
ovs_assert(key_type == OVSDB_TYPE_STRING);
6202
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_name);
6205
/* Returns the ofport column's value in 'row' as a struct ovsdb_datum.
6206
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6207
* easier and more efficient way to search for a given key than implementing
6208
* the same operation on the "cooked" form in 'row'.
6210
* 'key_type' must be OVSDB_TYPE_INTEGER.
6211
* (This helps to avoid silent bugs if someone changes ofport's
6212
* type without updating the caller.)
6214
* The caller must not modify or free the returned value.
6216
* Various kinds of changes can invalidate the returned value: modifying
6217
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6218
* If the returned value is needed for a long time, it is best to make a copy
6219
* of it with ovsdb_datum_clone(). */
6220
const struct ovsdb_datum *
6221
ovsrec_interface_get_ofport(const struct ovsrec_interface *row,
6222
enum ovsdb_atomic_type key_type OVS_UNUSED)
6224
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6225
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport);
6228
/* Returns the ofport_request column's value in 'row' as a struct ovsdb_datum.
6229
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6230
* easier and more efficient way to search for a given key than implementing
6231
* the same operation on the "cooked" form in 'row'.
6233
* 'key_type' must be OVSDB_TYPE_INTEGER.
6234
* (This helps to avoid silent bugs if someone changes ofport_request's
6235
* type without updating the caller.)
6237
* The caller must not modify or free the returned value.
6239
* Various kinds of changes can invalidate the returned value: modifying
6240
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6241
* If the returned value is needed for a long time, it is best to make a copy
6242
* of it with ovsdb_datum_clone(). */
6243
const struct ovsdb_datum *
6244
ovsrec_interface_get_ofport_request(const struct ovsrec_interface *row,
6245
enum ovsdb_atomic_type key_type OVS_UNUSED)
6247
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6248
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport_request);
6251
/* Returns the options column's value in 'row' as a struct ovsdb_datum.
6252
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6253
* easier and more efficient way to search for a given key than implementing
6254
* the same operation on the "cooked" form in 'row'.
6256
* 'key_type' must be OVSDB_TYPE_STRING.
6257
* 'value_type' must be OVSDB_TYPE_STRING.
6258
* (This helps to avoid silent bugs if someone changes options's
6259
* type without updating the caller.)
6261
* The caller must not modify or free the returned value.
6263
* Various kinds of changes can invalidate the returned value: modifying
6264
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6265
* If the returned value is needed for a long time, it is best to make a copy
6266
* of it with ovsdb_datum_clone(). */
6267
const struct ovsdb_datum *
6268
ovsrec_interface_get_options(const struct ovsrec_interface *row,
6269
enum ovsdb_atomic_type key_type OVS_UNUSED,
6270
enum ovsdb_atomic_type value_type OVS_UNUSED)
6272
ovs_assert(key_type == OVSDB_TYPE_STRING);
6273
ovs_assert(value_type == OVSDB_TYPE_STRING);
6274
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_options);
6277
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
6278
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6279
* easier and more efficient way to search for a given key than implementing
6280
* the same operation on the "cooked" form in 'row'.
6282
* 'key_type' must be OVSDB_TYPE_STRING.
6283
* 'value_type' must be OVSDB_TYPE_STRING.
6284
* (This helps to avoid silent bugs if someone changes other_config's
6285
* type without updating the caller.)
6287
* The caller must not modify or free the returned value.
6289
* Various kinds of changes can invalidate the returned value: modifying
6290
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6291
* If the returned value is needed for a long time, it is best to make a copy
6292
* of it with ovsdb_datum_clone(). */
6293
const struct ovsdb_datum *
6294
ovsrec_interface_get_other_config(const struct ovsrec_interface *row,
6295
enum ovsdb_atomic_type key_type OVS_UNUSED,
6296
enum ovsdb_atomic_type value_type OVS_UNUSED)
6298
ovs_assert(key_type == OVSDB_TYPE_STRING);
6299
ovs_assert(value_type == OVSDB_TYPE_STRING);
6300
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_other_config);
6303
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
6304
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6305
* easier and more efficient way to search for a given key than implementing
6306
* the same operation on the "cooked" form in 'row'.
6308
* 'key_type' must be OVSDB_TYPE_STRING.
6309
* 'value_type' must be OVSDB_TYPE_INTEGER.
6310
* (This helps to avoid silent bugs if someone changes statistics's
6311
* type without updating the caller.)
6313
* The caller must not modify or free the returned value.
6315
* Various kinds of changes can invalidate the returned value: modifying
6316
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6317
* If the returned value is needed for a long time, it is best to make a copy
6318
* of it with ovsdb_datum_clone(). */
6319
const struct ovsdb_datum *
6320
ovsrec_interface_get_statistics(const struct ovsrec_interface *row,
6321
enum ovsdb_atomic_type key_type OVS_UNUSED,
6322
enum ovsdb_atomic_type value_type OVS_UNUSED)
6324
ovs_assert(key_type == OVSDB_TYPE_STRING);
6325
ovs_assert(value_type == OVSDB_TYPE_INTEGER);
6326
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_statistics);
6329
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
6330
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6331
* easier and more efficient way to search for a given key than implementing
6332
* the same operation on the "cooked" form in 'row'.
6334
* 'key_type' must be OVSDB_TYPE_STRING.
6335
* 'value_type' must be OVSDB_TYPE_STRING.
6336
* (This helps to avoid silent bugs if someone changes status's
6337
* type without updating the caller.)
6339
* The caller must not modify or free the returned value.
6341
* Various kinds of changes can invalidate the returned value: modifying
6342
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6343
* If the returned value is needed for a long time, it is best to make a copy
6344
* of it with ovsdb_datum_clone(). */
6345
const struct ovsdb_datum *
6346
ovsrec_interface_get_status(const struct ovsrec_interface *row,
6347
enum ovsdb_atomic_type key_type OVS_UNUSED,
6348
enum ovsdb_atomic_type value_type OVS_UNUSED)
6350
ovs_assert(key_type == OVSDB_TYPE_STRING);
6351
ovs_assert(value_type == OVSDB_TYPE_STRING);
6352
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_status);
6355
/* Returns the type column's value in 'row' as a struct ovsdb_datum.
6356
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
6357
* easier and more efficient way to search for a given key than implementing
6358
* the same operation on the "cooked" form in 'row'.
6360
* 'key_type' must be OVSDB_TYPE_STRING.
6361
* (This helps to avoid silent bugs if someone changes type's
6362
* type without updating the caller.)
6364
* The caller must not modify or free the returned value.
6366
* Various kinds of changes can invalidate the returned value: modifying
6367
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6368
* If the returned value is needed for a long time, it is best to make a copy
6369
* of it with ovsdb_datum_clone(). */
6370
const struct ovsdb_datum *
6371
ovsrec_interface_get_type(const struct ovsrec_interface *row,
6372
enum ovsdb_atomic_type key_type OVS_UNUSED)
6374
ovs_assert(key_type == OVSDB_TYPE_STRING);
6375
return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_type);
6379
ovsrec_interface_set_admin_state(const struct ovsrec_interface *row, const char *admin_state)
6381
struct ovsdb_datum datum;
6382
union ovsdb_atom key;
6388
key.string = CONST_CAST(char *, admin_state);
6393
datum.values = NULL;
6394
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_ADMIN_STATE], &datum);
6398
ovsrec_interface_set_bfd(const struct ovsrec_interface *row, const struct smap *smap)
6400
struct ovsdb_datum datum;
6404
struct smap_node *node;
6407
datum.n = smap_count(smap);
6408
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6409
datum.values = xmalloc(datum.n * sizeof *datum.values);
6412
SMAP_FOR_EACH (node, smap) {
6413
datum.keys[i].string = xstrdup(node->key);
6414
datum.values[i].string = xstrdup(node->value);
6417
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6419
ovsdb_datum_init_empty(&datum);
6421
ovsdb_idl_txn_write(&row->header_,
6422
&ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD],
6428
ovsrec_interface_set_bfd_status(const struct ovsrec_interface *row, const struct smap *smap)
6430
struct ovsdb_datum datum;
6434
struct smap_node *node;
6437
datum.n = smap_count(smap);
6438
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6439
datum.values = xmalloc(datum.n * sizeof *datum.values);
6442
SMAP_FOR_EACH (node, smap) {
6443
datum.keys[i].string = xstrdup(node->key);
6444
datum.values[i].string = xstrdup(node->value);
6447
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6449
ovsdb_datum_init_empty(&datum);
6451
ovsdb_idl_txn_write(&row->header_,
6452
&ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD_STATUS],
6458
ovsrec_interface_set_cfm_fault(const struct ovsrec_interface *row, const bool *cfm_fault, size_t n_cfm_fault)
6460
struct ovsdb_datum datum;
6461
union ovsdb_atom key;
6467
key.boolean = *cfm_fault;
6472
datum.values = NULL;
6473
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT], &datum);
6477
ovsrec_interface_set_cfm_fault_status(const struct ovsrec_interface *row, char **cfm_fault_status, size_t n_cfm_fault_status)
6479
struct ovsdb_datum datum;
6483
datum.n = n_cfm_fault_status;
6484
datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
6485
datum.values = NULL;
6486
for (i = 0; i < n_cfm_fault_status; i++) {
6487
datum.keys[i].string = xstrdup(cfm_fault_status[i]);
6489
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
6490
ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT_STATUS], &datum);
6494
ovsrec_interface_set_cfm_flap_count(const struct ovsrec_interface *row, const int64_t *cfm_flap_count, size_t n_cfm_flap_count)
6496
struct ovsdb_datum datum;
6497
union ovsdb_atom key;
6500
if (n_cfm_flap_count) {
6503
key.integer = *cfm_flap_count;
6508
datum.values = NULL;
6509
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FLAP_COUNT], &datum);
6513
ovsrec_interface_set_cfm_health(const struct ovsrec_interface *row, const int64_t *cfm_health, size_t n_cfm_health)
6515
struct ovsdb_datum datum;
6516
union ovsdb_atom key;
6522
key.integer = *cfm_health;
6527
datum.values = NULL;
6528
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_HEALTH], &datum);
6532
ovsrec_interface_set_cfm_mpid(const struct ovsrec_interface *row, const int64_t *cfm_mpid, size_t n_cfm_mpid)
6534
struct ovsdb_datum datum;
6535
union ovsdb_atom key;
6541
key.integer = *cfm_mpid;
6546
datum.values = NULL;
6547
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_MPID], &datum);
6551
ovsrec_interface_set_cfm_remote_mpids(const struct ovsrec_interface *row, const int64_t *cfm_remote_mpids, size_t n_cfm_remote_mpids)
6553
struct ovsdb_datum datum;
6557
datum.n = n_cfm_remote_mpids;
6558
datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
6559
datum.values = NULL;
6560
for (i = 0; i < n_cfm_remote_mpids; i++) {
6561
datum.keys[i].integer = cfm_remote_mpids[i];
6563
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
6564
ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_MPIDS], &datum);
6568
ovsrec_interface_set_cfm_remote_opstate(const struct ovsrec_interface *row, const char *cfm_remote_opstate)
6570
struct ovsdb_datum datum;
6571
union ovsdb_atom key;
6574
if (cfm_remote_opstate) {
6577
key.string = CONST_CAST(char *, cfm_remote_opstate);
6582
datum.values = NULL;
6583
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_OPSTATE], &datum);
6587
ovsrec_interface_set_duplex(const struct ovsrec_interface *row, const char *duplex)
6589
struct ovsdb_datum datum;
6590
union ovsdb_atom key;
6596
key.string = CONST_CAST(char *, duplex);
6601
datum.values = NULL;
6602
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_DUPLEX], &datum);
6606
ovsrec_interface_set_external_ids(const struct ovsrec_interface *row, const struct smap *smap)
6608
struct ovsdb_datum datum;
6612
struct smap_node *node;
6615
datum.n = smap_count(smap);
6616
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6617
datum.values = xmalloc(datum.n * sizeof *datum.values);
6620
SMAP_FOR_EACH (node, smap) {
6621
datum.keys[i].string = xstrdup(node->key);
6622
datum.values[i].string = xstrdup(node->value);
6625
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6627
ovsdb_datum_init_empty(&datum);
6629
ovsdb_idl_txn_write(&row->header_,
6630
&ovsrec_interface_columns[OVSREC_INTERFACE_COL_EXTERNAL_IDS],
6636
ovsrec_interface_set_ifindex(const struct ovsrec_interface *row, const int64_t *ifindex, size_t n_ifindex)
6638
struct ovsdb_datum datum;
6639
union ovsdb_atom key;
6645
key.integer = *ifindex;
6650
datum.values = NULL;
6651
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_IFINDEX], &datum);
6655
ovsrec_interface_set_ingress_policing_burst(const struct ovsrec_interface *row, int64_t ingress_policing_burst)
6657
struct ovsdb_datum datum;
6658
union ovsdb_atom key;
6663
key.integer = ingress_policing_burst;
6664
datum.values = NULL;
6665
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_BURST], &datum);
6669
ovsrec_interface_set_ingress_policing_rate(const struct ovsrec_interface *row, int64_t ingress_policing_rate)
6671
struct ovsdb_datum datum;
6672
union ovsdb_atom key;
6677
key.integer = ingress_policing_rate;
6678
datum.values = NULL;
6679
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_RATE], &datum);
6683
ovsrec_interface_set_lacp_current(const struct ovsrec_interface *row, const bool *lacp_current, size_t n_lacp_current)
6685
struct ovsdb_datum datum;
6686
union ovsdb_atom key;
6689
if (n_lacp_current) {
6692
key.boolean = *lacp_current;
6697
datum.values = NULL;
6698
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LACP_CURRENT], &datum);
6702
ovsrec_interface_set_link_resets(const struct ovsrec_interface *row, const int64_t *link_resets, size_t n_link_resets)
6704
struct ovsdb_datum datum;
6705
union ovsdb_atom key;
6708
if (n_link_resets) {
6711
key.integer = *link_resets;
6716
datum.values = NULL;
6717
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_RESETS], &datum);
6721
ovsrec_interface_set_link_speed(const struct ovsrec_interface *row, const int64_t *link_speed, size_t n_link_speed)
6723
struct ovsdb_datum datum;
6724
union ovsdb_atom key;
6730
key.integer = *link_speed;
6735
datum.values = NULL;
6736
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_SPEED], &datum);
6740
ovsrec_interface_set_link_state(const struct ovsrec_interface *row, const char *link_state)
6742
struct ovsdb_datum datum;
6743
union ovsdb_atom key;
6749
key.string = CONST_CAST(char *, link_state);
6754
datum.values = NULL;
6755
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_STATE], &datum);
6759
ovsrec_interface_set_mac(const struct ovsrec_interface *row, const char *mac)
6761
struct ovsdb_datum datum;
6762
union ovsdb_atom key;
6768
key.string = CONST_CAST(char *, mac);
6773
datum.values = NULL;
6774
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC], &datum);
6778
ovsrec_interface_set_mac_in_use(const struct ovsrec_interface *row, const char *mac_in_use)
6780
struct ovsdb_datum datum;
6781
union ovsdb_atom key;
6787
key.string = CONST_CAST(char *, mac_in_use);
6792
datum.values = NULL;
6793
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC_IN_USE], &datum);
6797
ovsrec_interface_set_mtu(const struct ovsrec_interface *row, const int64_t *mtu, size_t n_mtu)
6799
struct ovsdb_datum datum;
6800
union ovsdb_atom key;
6811
datum.values = NULL;
6812
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MTU], &datum);
6816
ovsrec_interface_set_name(const struct ovsrec_interface *row, const char *name)
6818
struct ovsdb_datum datum;
6819
union ovsdb_atom key;
6824
key.string = CONST_CAST(char *, name);
6825
datum.values = NULL;
6826
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_NAME], &datum);
6830
ovsrec_interface_set_ofport(const struct ovsrec_interface *row, const int64_t *ofport, size_t n_ofport)
6832
struct ovsdb_datum datum;
6833
union ovsdb_atom key;
6839
key.integer = *ofport;
6844
datum.values = NULL;
6845
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT], &datum);
6849
ovsrec_interface_set_ofport_request(const struct ovsrec_interface *row, const int64_t *ofport_request, size_t n_ofport_request)
6851
struct ovsdb_datum datum;
6852
union ovsdb_atom key;
6855
if (n_ofport_request) {
6858
key.integer = *ofport_request;
6863
datum.values = NULL;
6864
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT_REQUEST], &datum);
6868
ovsrec_interface_set_options(const struct ovsrec_interface *row, const struct smap *smap)
6870
struct ovsdb_datum datum;
6874
struct smap_node *node;
6877
datum.n = smap_count(smap);
6878
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6879
datum.values = xmalloc(datum.n * sizeof *datum.values);
6882
SMAP_FOR_EACH (node, smap) {
6883
datum.keys[i].string = xstrdup(node->key);
6884
datum.values[i].string = xstrdup(node->value);
6887
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6889
ovsdb_datum_init_empty(&datum);
6891
ovsdb_idl_txn_write(&row->header_,
6892
&ovsrec_interface_columns[OVSREC_INTERFACE_COL_OPTIONS],
6898
ovsrec_interface_set_other_config(const struct ovsrec_interface *row, const struct smap *smap)
6900
struct ovsdb_datum datum;
6904
struct smap_node *node;
6907
datum.n = smap_count(smap);
6908
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6909
datum.values = xmalloc(datum.n * sizeof *datum.values);
6912
SMAP_FOR_EACH (node, smap) {
6913
datum.keys[i].string = xstrdup(node->key);
6914
datum.values[i].string = xstrdup(node->value);
6917
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6919
ovsdb_datum_init_empty(&datum);
6921
ovsdb_idl_txn_write(&row->header_,
6922
&ovsrec_interface_columns[OVSREC_INTERFACE_COL_OTHER_CONFIG],
6928
ovsrec_interface_set_statistics(const struct ovsrec_interface *row, char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
6930
struct ovsdb_datum datum;
6934
datum.n = n_statistics;
6935
datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
6936
datum.values = xmalloc(n_statistics * sizeof *datum.values);
6937
for (i = 0; i < n_statistics; i++) {
6938
datum.keys[i].string = xstrdup(key_statistics[i]);
6939
datum.values[i].integer = value_statistics[i];
6941
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_INTEGER);
6942
ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATISTICS], &datum);
6946
ovsrec_interface_set_status(const struct ovsrec_interface *row, const struct smap *smap)
6948
struct ovsdb_datum datum;
6952
struct smap_node *node;
6955
datum.n = smap_count(smap);
6956
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6957
datum.values = xmalloc(datum.n * sizeof *datum.values);
6960
SMAP_FOR_EACH (node, smap) {
6961
datum.keys[i].string = xstrdup(node->key);
6962
datum.values[i].string = xstrdup(node->value);
6965
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6967
ovsdb_datum_init_empty(&datum);
6969
ovsdb_idl_txn_write(&row->header_,
6970
&ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATUS],
6976
ovsrec_interface_set_type(const struct ovsrec_interface *row, const char *type)
6978
struct ovsdb_datum datum;
6979
union ovsdb_atom key;
6984
key.string = CONST_CAST(char *, type);
6985
datum.values = NULL;
6986
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_TYPE], &datum);
6989
struct ovsdb_idl_column ovsrec_interface_columns[OVSREC_INTERFACE_N_COLUMNS];
6992
ovsrec_interface_columns_init(void)
6994
struct ovsdb_idl_column *c;
6996
/* Initialize ovsrec_interface_col_admin_state. */
6997
c = &ovsrec_interface_col_admin_state;
6998
c->name = "admin_state";
6999
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7000
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7001
c->type.key.enum_->n = 2;
7002
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7003
c->type.key.enum_->keys[0].string = xstrdup("down");
7004
c->type.key.enum_->keys[1].string = xstrdup("up");
7005
c->type.key.enum_->values = NULL;
7006
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7007
c->type.key.u.string.minLen = 0;
7008
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7012
c->parse = ovsrec_interface_parse_admin_state;
7013
c->unparse = ovsrec_interface_unparse_admin_state;
7015
/* Initialize ovsrec_interface_col_bfd. */
7016
c = &ovsrec_interface_col_bfd;
7018
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7019
c->type.key.u.string.minLen = 0;
7020
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7021
c->type.value.u.string.minLen = 0;
7023
c->type.n_max = UINT_MAX;
7025
c->parse = ovsrec_interface_parse_bfd;
7026
c->unparse = ovsrec_interface_unparse_bfd;
7028
/* Initialize ovsrec_interface_col_bfd_status. */
7029
c = &ovsrec_interface_col_bfd_status;
7030
c->name = "bfd_status";
7031
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7032
c->type.key.u.string.minLen = 0;
7033
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7034
c->type.value.u.string.minLen = 0;
7036
c->type.n_max = UINT_MAX;
7038
c->parse = ovsrec_interface_parse_bfd_status;
7039
c->unparse = ovsrec_interface_unparse_bfd_status;
7041
/* Initialize ovsrec_interface_col_cfm_fault. */
7042
c = &ovsrec_interface_col_cfm_fault;
7043
c->name = "cfm_fault";
7044
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
7045
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7049
c->parse = ovsrec_interface_parse_cfm_fault;
7050
c->unparse = ovsrec_interface_unparse_cfm_fault;
7052
/* Initialize ovsrec_interface_col_cfm_fault_status. */
7053
c = &ovsrec_interface_col_cfm_fault_status;
7054
c->name = "cfm_fault_status";
7055
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7056
c->type.key.u.string.minLen = 0;
7057
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7059
c->type.n_max = UINT_MAX;
7061
c->parse = ovsrec_interface_parse_cfm_fault_status;
7062
c->unparse = ovsrec_interface_unparse_cfm_fault_status;
7064
/* Initialize ovsrec_interface_col_cfm_flap_count. */
7065
c = &ovsrec_interface_col_cfm_flap_count;
7066
c->name = "cfm_flap_count";
7067
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7068
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7072
c->parse = ovsrec_interface_parse_cfm_flap_count;
7073
c->unparse = ovsrec_interface_unparse_cfm_flap_count;
7075
/* Initialize ovsrec_interface_col_cfm_health. */
7076
c = &ovsrec_interface_col_cfm_health;
7077
c->name = "cfm_health";
7078
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7079
c->type.key.u.integer.min = INT64_C(0);
7080
c->type.key.u.integer.max = INT64_C(100);
7081
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7085
c->parse = ovsrec_interface_parse_cfm_health;
7086
c->unparse = ovsrec_interface_unparse_cfm_health;
7088
/* Initialize ovsrec_interface_col_cfm_mpid. */
7089
c = &ovsrec_interface_col_cfm_mpid;
7090
c->name = "cfm_mpid";
7091
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7092
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7096
c->parse = ovsrec_interface_parse_cfm_mpid;
7097
c->unparse = ovsrec_interface_unparse_cfm_mpid;
7099
/* Initialize ovsrec_interface_col_cfm_remote_mpids. */
7100
c = &ovsrec_interface_col_cfm_remote_mpids;
7101
c->name = "cfm_remote_mpids";
7102
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7103
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7105
c->type.n_max = UINT_MAX;
7107
c->parse = ovsrec_interface_parse_cfm_remote_mpids;
7108
c->unparse = ovsrec_interface_unparse_cfm_remote_mpids;
7110
/* Initialize ovsrec_interface_col_cfm_remote_opstate. */
7111
c = &ovsrec_interface_col_cfm_remote_opstate;
7112
c->name = "cfm_remote_opstate";
7113
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7114
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7115
c->type.key.enum_->n = 2;
7116
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7117
c->type.key.enum_->keys[0].string = xstrdup("down");
7118
c->type.key.enum_->keys[1].string = xstrdup("up");
7119
c->type.key.enum_->values = NULL;
7120
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7121
c->type.key.u.string.minLen = 0;
7122
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7126
c->parse = ovsrec_interface_parse_cfm_remote_opstate;
7127
c->unparse = ovsrec_interface_unparse_cfm_remote_opstate;
7129
/* Initialize ovsrec_interface_col_duplex. */
7130
c = &ovsrec_interface_col_duplex;
7132
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7133
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7134
c->type.key.enum_->n = 2;
7135
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7136
c->type.key.enum_->keys[0].string = xstrdup("full");
7137
c->type.key.enum_->keys[1].string = xstrdup("half");
7138
c->type.key.enum_->values = NULL;
7139
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7140
c->type.key.u.string.minLen = 0;
7141
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7145
c->parse = ovsrec_interface_parse_duplex;
7146
c->unparse = ovsrec_interface_unparse_duplex;
7148
/* Initialize ovsrec_interface_col_external_ids. */
7149
c = &ovsrec_interface_col_external_ids;
7150
c->name = "external_ids";
7151
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7152
c->type.key.u.string.minLen = 0;
7153
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7154
c->type.value.u.string.minLen = 0;
7156
c->type.n_max = UINT_MAX;
7158
c->parse = ovsrec_interface_parse_external_ids;
7159
c->unparse = ovsrec_interface_unparse_external_ids;
7161
/* Initialize ovsrec_interface_col_ifindex. */
7162
c = &ovsrec_interface_col_ifindex;
7163
c->name = "ifindex";
7164
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7165
c->type.key.u.integer.min = INT64_C(0);
7166
c->type.key.u.integer.max = INT64_C(4294967295);
7167
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7171
c->parse = ovsrec_interface_parse_ifindex;
7172
c->unparse = ovsrec_interface_unparse_ifindex;
7174
/* Initialize ovsrec_interface_col_ingress_policing_burst. */
7175
c = &ovsrec_interface_col_ingress_policing_burst;
7176
c->name = "ingress_policing_burst";
7177
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7178
c->type.key.u.integer.min = INT64_C(0);
7179
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7183
c->parse = ovsrec_interface_parse_ingress_policing_burst;
7184
c->unparse = ovsrec_interface_unparse_ingress_policing_burst;
7186
/* Initialize ovsrec_interface_col_ingress_policing_rate. */
7187
c = &ovsrec_interface_col_ingress_policing_rate;
7188
c->name = "ingress_policing_rate";
7189
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7190
c->type.key.u.integer.min = INT64_C(0);
7191
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7195
c->parse = ovsrec_interface_parse_ingress_policing_rate;
7196
c->unparse = ovsrec_interface_unparse_ingress_policing_rate;
7198
/* Initialize ovsrec_interface_col_lacp_current. */
7199
c = &ovsrec_interface_col_lacp_current;
7200
c->name = "lacp_current";
7201
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
7202
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7206
c->parse = ovsrec_interface_parse_lacp_current;
7207
c->unparse = ovsrec_interface_unparse_lacp_current;
7209
/* Initialize ovsrec_interface_col_link_resets. */
7210
c = &ovsrec_interface_col_link_resets;
7211
c->name = "link_resets";
7212
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7213
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7217
c->parse = ovsrec_interface_parse_link_resets;
7218
c->unparse = ovsrec_interface_unparse_link_resets;
7220
/* Initialize ovsrec_interface_col_link_speed. */
7221
c = &ovsrec_interface_col_link_speed;
7222
c->name = "link_speed";
7223
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7224
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7228
c->parse = ovsrec_interface_parse_link_speed;
7229
c->unparse = ovsrec_interface_unparse_link_speed;
7231
/* Initialize ovsrec_interface_col_link_state. */
7232
c = &ovsrec_interface_col_link_state;
7233
c->name = "link_state";
7234
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7235
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7236
c->type.key.enum_->n = 2;
7237
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7238
c->type.key.enum_->keys[0].string = xstrdup("down");
7239
c->type.key.enum_->keys[1].string = xstrdup("up");
7240
c->type.key.enum_->values = NULL;
7241
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7242
c->type.key.u.string.minLen = 0;
7243
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7247
c->parse = ovsrec_interface_parse_link_state;
7248
c->unparse = ovsrec_interface_unparse_link_state;
7250
/* Initialize ovsrec_interface_col_mac. */
7251
c = &ovsrec_interface_col_mac;
7253
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7254
c->type.key.u.string.minLen = 0;
7255
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7259
c->parse = ovsrec_interface_parse_mac;
7260
c->unparse = ovsrec_interface_unparse_mac;
7262
/* Initialize ovsrec_interface_col_mac_in_use. */
7263
c = &ovsrec_interface_col_mac_in_use;
7264
c->name = "mac_in_use";
7265
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7266
c->type.key.u.string.minLen = 0;
7267
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7271
c->parse = ovsrec_interface_parse_mac_in_use;
7272
c->unparse = ovsrec_interface_unparse_mac_in_use;
7274
/* Initialize ovsrec_interface_col_mtu. */
7275
c = &ovsrec_interface_col_mtu;
7277
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7278
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7282
c->parse = ovsrec_interface_parse_mtu;
7283
c->unparse = ovsrec_interface_unparse_mtu;
7285
/* Initialize ovsrec_interface_col_name. */
7286
c = &ovsrec_interface_col_name;
7288
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7289
c->type.key.u.string.minLen = 0;
7290
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7294
c->parse = ovsrec_interface_parse_name;
7295
c->unparse = ovsrec_interface_unparse_name;
7297
/* Initialize ovsrec_interface_col_ofport. */
7298
c = &ovsrec_interface_col_ofport;
7300
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7301
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7305
c->parse = ovsrec_interface_parse_ofport;
7306
c->unparse = ovsrec_interface_unparse_ofport;
7308
/* Initialize ovsrec_interface_col_ofport_request. */
7309
c = &ovsrec_interface_col_ofport_request;
7310
c->name = "ofport_request";
7311
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7312
c->type.key.u.integer.min = INT64_C(1);
7313
c->type.key.u.integer.max = INT64_C(65279);
7314
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7318
c->parse = ovsrec_interface_parse_ofport_request;
7319
c->unparse = ovsrec_interface_unparse_ofport_request;
7321
/* Initialize ovsrec_interface_col_options. */
7322
c = &ovsrec_interface_col_options;
7323
c->name = "options";
7324
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7325
c->type.key.u.string.minLen = 0;
7326
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7327
c->type.value.u.string.minLen = 0;
7329
c->type.n_max = UINT_MAX;
7331
c->parse = ovsrec_interface_parse_options;
7332
c->unparse = ovsrec_interface_unparse_options;
7334
/* Initialize ovsrec_interface_col_other_config. */
7335
c = &ovsrec_interface_col_other_config;
7336
c->name = "other_config";
7337
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7338
c->type.key.u.string.minLen = 0;
7339
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7340
c->type.value.u.string.minLen = 0;
7342
c->type.n_max = UINT_MAX;
7344
c->parse = ovsrec_interface_parse_other_config;
7345
c->unparse = ovsrec_interface_unparse_other_config;
7347
/* Initialize ovsrec_interface_col_statistics. */
7348
c = &ovsrec_interface_col_statistics;
7349
c->name = "statistics";
7350
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7351
c->type.key.u.string.minLen = 0;
7352
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_INTEGER);
7354
c->type.n_max = UINT_MAX;
7356
c->parse = ovsrec_interface_parse_statistics;
7357
c->unparse = ovsrec_interface_unparse_statistics;
7359
/* Initialize ovsrec_interface_col_status. */
7360
c = &ovsrec_interface_col_status;
7362
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7363
c->type.key.u.string.minLen = 0;
7364
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7365
c->type.value.u.string.minLen = 0;
7367
c->type.n_max = UINT_MAX;
7369
c->parse = ovsrec_interface_parse_status;
7370
c->unparse = ovsrec_interface_unparse_status;
7372
/* Initialize ovsrec_interface_col_type. */
7373
c = &ovsrec_interface_col_type;
7375
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7376
c->type.key.u.string.minLen = 0;
7377
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7381
c->parse = ovsrec_interface_parse_type;
7382
c->unparse = ovsrec_interface_unparse_type;
7385
/* Manager table. */
7388
ovsrec_manager_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7390
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7393
if (datum->n >= 1) {
7394
row->connection_mode = datum->keys[0].string;
7396
row->connection_mode = NULL;
7401
ovsrec_manager_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7403
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7407
smap_init(&row->external_ids);
7408
for (i = 0; i < datum->n; i++) {
7409
smap_add(&row->external_ids,
7410
datum->keys[i].string,
7411
datum->values[i].string);
7416
ovsrec_manager_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7418
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7419
size_t n = MIN(1, datum->n);
7423
row->inactivity_probe = NULL;
7424
row->n_inactivity_probe = 0;
7425
for (i = 0; i < n; i++) {
7426
if (!row->n_inactivity_probe) {
7427
row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
7429
row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
7430
row->n_inactivity_probe++;
7435
ovsrec_manager_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7437
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7440
if (datum->n >= 1) {
7441
row->is_connected = datum->keys[0].boolean;
7443
row->is_connected = false;
7448
ovsrec_manager_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7450
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7451
size_t n = MIN(1, datum->n);
7455
row->max_backoff = NULL;
7456
row->n_max_backoff = 0;
7457
for (i = 0; i < n; i++) {
7458
if (!row->n_max_backoff) {
7459
row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
7461
row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
7462
row->n_max_backoff++;
7467
ovsrec_manager_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7469
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7473
smap_init(&row->other_config);
7474
for (i = 0; i < datum->n; i++) {
7475
smap_add(&row->other_config,
7476
datum->keys[i].string,
7477
datum->values[i].string);
7482
ovsrec_manager_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7484
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7488
smap_init(&row->status);
7489
for (i = 0; i < datum->n; i++) {
7490
smap_add(&row->status,
7491
datum->keys[i].string,
7492
datum->values[i].string);
7497
ovsrec_manager_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7499
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7502
if (datum->n >= 1) {
7503
row->target = datum->keys[0].string;
7510
ovsrec_manager_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
7512
/* Nothing to do. */
7516
ovsrec_manager_unparse_external_ids(struct ovsdb_idl_row *row_)
7518
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7521
smap_destroy(&row->external_ids);
7525
ovsrec_manager_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
7527
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7530
free(row->inactivity_probe);
7534
ovsrec_manager_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
7536
/* Nothing to do. */
7540
ovsrec_manager_unparse_max_backoff(struct ovsdb_idl_row *row_)
7542
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7545
free(row->max_backoff);
7549
ovsrec_manager_unparse_other_config(struct ovsdb_idl_row *row_)
7551
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7554
smap_destroy(&row->other_config);
7558
ovsrec_manager_unparse_status(struct ovsdb_idl_row *row_)
7560
struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7563
smap_destroy(&row->status);
7567
ovsrec_manager_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
7569
/* Nothing to do. */
7573
ovsrec_manager_init__(struct ovsdb_idl_row *row)
7575
ovsrec_manager_init(ovsrec_manager_cast(row));
7579
ovsrec_manager_init(struct ovsrec_manager *row)
7581
memset(row, 0, sizeof *row);
7582
smap_init(&row->external_ids);
7583
smap_init(&row->other_config);
7584
smap_init(&row->status);
7587
const struct ovsrec_manager *
7588
ovsrec_manager_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
7590
return ovsrec_manager_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_MANAGER], uuid));
7593
const struct ovsrec_manager *
7594
ovsrec_manager_first(const struct ovsdb_idl *idl)
7596
return ovsrec_manager_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]));
7599
const struct ovsrec_manager *
7600
ovsrec_manager_next(const struct ovsrec_manager *row)
7602
return ovsrec_manager_cast(ovsdb_idl_next_row(&row->header_));
7606
ovsrec_manager_delete(const struct ovsrec_manager *row)
7608
ovsdb_idl_txn_delete(&row->header_);
7611
struct ovsrec_manager *
7612
ovsrec_manager_insert(struct ovsdb_idl_txn *txn)
7614
return ovsrec_manager_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_MANAGER], NULL));
7619
ovsrec_manager_verify_connection_mode(const struct ovsrec_manager *row)
7622
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_CONNECTION_MODE]);
7626
ovsrec_manager_verify_external_ids(const struct ovsrec_manager *row)
7629
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_EXTERNAL_IDS]);
7633
ovsrec_manager_verify_inactivity_probe(const struct ovsrec_manager *row)
7636
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_INACTIVITY_PROBE]);
7640
ovsrec_manager_verify_is_connected(const struct ovsrec_manager *row)
7643
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_IS_CONNECTED]);
7647
ovsrec_manager_verify_max_backoff(const struct ovsrec_manager *row)
7650
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_MAX_BACKOFF]);
7654
ovsrec_manager_verify_other_config(const struct ovsrec_manager *row)
7657
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_OTHER_CONFIG]);
7661
ovsrec_manager_verify_status(const struct ovsrec_manager *row)
7664
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_STATUS]);
7668
ovsrec_manager_verify_target(const struct ovsrec_manager *row)
7671
ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_TARGET]);
7674
/* Returns the connection_mode column's value in 'row' as a struct ovsdb_datum.
7675
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7676
* easier and more efficient way to search for a given key than implementing
7677
* the same operation on the "cooked" form in 'row'.
7679
* 'key_type' must be OVSDB_TYPE_STRING.
7680
* (This helps to avoid silent bugs if someone changes connection_mode's
7681
* type without updating the caller.)
7683
* The caller must not modify or free the returned value.
7685
* Various kinds of changes can invalidate the returned value: modifying
7686
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7687
* If the returned value is needed for a long time, it is best to make a copy
7688
* of it with ovsdb_datum_clone(). */
7689
const struct ovsdb_datum *
7690
ovsrec_manager_get_connection_mode(const struct ovsrec_manager *row,
7691
enum ovsdb_atomic_type key_type OVS_UNUSED)
7693
ovs_assert(key_type == OVSDB_TYPE_STRING);
7694
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_connection_mode);
7697
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
7698
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7699
* easier and more efficient way to search for a given key than implementing
7700
* the same operation on the "cooked" form in 'row'.
7702
* 'key_type' must be OVSDB_TYPE_STRING.
7703
* 'value_type' must be OVSDB_TYPE_STRING.
7704
* (This helps to avoid silent bugs if someone changes external_ids's
7705
* type without updating the caller.)
7707
* The caller must not modify or free the returned value.
7709
* Various kinds of changes can invalidate the returned value: modifying
7710
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7711
* If the returned value is needed for a long time, it is best to make a copy
7712
* of it with ovsdb_datum_clone(). */
7713
const struct ovsdb_datum *
7714
ovsrec_manager_get_external_ids(const struct ovsrec_manager *row,
7715
enum ovsdb_atomic_type key_type OVS_UNUSED,
7716
enum ovsdb_atomic_type value_type OVS_UNUSED)
7718
ovs_assert(key_type == OVSDB_TYPE_STRING);
7719
ovs_assert(value_type == OVSDB_TYPE_STRING);
7720
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_external_ids);
7723
/* Returns the inactivity_probe column's value in 'row' as a struct ovsdb_datum.
7724
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7725
* easier and more efficient way to search for a given key than implementing
7726
* the same operation on the "cooked" form in 'row'.
7728
* 'key_type' must be OVSDB_TYPE_INTEGER.
7729
* (This helps to avoid silent bugs if someone changes inactivity_probe's
7730
* type without updating the caller.)
7732
* The caller must not modify or free the returned value.
7734
* Various kinds of changes can invalidate the returned value: modifying
7735
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7736
* If the returned value is needed for a long time, it is best to make a copy
7737
* of it with ovsdb_datum_clone(). */
7738
const struct ovsdb_datum *
7739
ovsrec_manager_get_inactivity_probe(const struct ovsrec_manager *row,
7740
enum ovsdb_atomic_type key_type OVS_UNUSED)
7742
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
7743
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_inactivity_probe);
7746
/* Returns the is_connected column's value in 'row' as a struct ovsdb_datum.
7747
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7748
* easier and more efficient way to search for a given key than implementing
7749
* the same operation on the "cooked" form in 'row'.
7751
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
7752
* (This helps to avoid silent bugs if someone changes is_connected's
7753
* type without updating the caller.)
7755
* The caller must not modify or free the returned value.
7757
* Various kinds of changes can invalidate the returned value: modifying
7758
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7759
* If the returned value is needed for a long time, it is best to make a copy
7760
* of it with ovsdb_datum_clone(). */
7761
const struct ovsdb_datum *
7762
ovsrec_manager_get_is_connected(const struct ovsrec_manager *row,
7763
enum ovsdb_atomic_type key_type OVS_UNUSED)
7765
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
7766
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_is_connected);
7769
/* Returns the max_backoff column's value in 'row' as a struct ovsdb_datum.
7770
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7771
* easier and more efficient way to search for a given key than implementing
7772
* the same operation on the "cooked" form in 'row'.
7774
* 'key_type' must be OVSDB_TYPE_INTEGER.
7775
* (This helps to avoid silent bugs if someone changes max_backoff's
7776
* type without updating the caller.)
7778
* The caller must not modify or free the returned value.
7780
* Various kinds of changes can invalidate the returned value: modifying
7781
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7782
* If the returned value is needed for a long time, it is best to make a copy
7783
* of it with ovsdb_datum_clone(). */
7784
const struct ovsdb_datum *
7785
ovsrec_manager_get_max_backoff(const struct ovsrec_manager *row,
7786
enum ovsdb_atomic_type key_type OVS_UNUSED)
7788
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
7789
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_max_backoff);
7792
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
7793
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7794
* easier and more efficient way to search for a given key than implementing
7795
* the same operation on the "cooked" form in 'row'.
7797
* 'key_type' must be OVSDB_TYPE_STRING.
7798
* 'value_type' must be OVSDB_TYPE_STRING.
7799
* (This helps to avoid silent bugs if someone changes other_config's
7800
* type without updating the caller.)
7802
* The caller must not modify or free the returned value.
7804
* Various kinds of changes can invalidate the returned value: modifying
7805
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7806
* If the returned value is needed for a long time, it is best to make a copy
7807
* of it with ovsdb_datum_clone(). */
7808
const struct ovsdb_datum *
7809
ovsrec_manager_get_other_config(const struct ovsrec_manager *row,
7810
enum ovsdb_atomic_type key_type OVS_UNUSED,
7811
enum ovsdb_atomic_type value_type OVS_UNUSED)
7813
ovs_assert(key_type == OVSDB_TYPE_STRING);
7814
ovs_assert(value_type == OVSDB_TYPE_STRING);
7815
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_other_config);
7818
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
7819
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7820
* easier and more efficient way to search for a given key than implementing
7821
* the same operation on the "cooked" form in 'row'.
7823
* 'key_type' must be OVSDB_TYPE_STRING.
7824
* 'value_type' must be OVSDB_TYPE_STRING.
7825
* (This helps to avoid silent bugs if someone changes status's
7826
* type without updating the caller.)
7828
* The caller must not modify or free the returned value.
7830
* Various kinds of changes can invalidate the returned value: modifying
7831
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7832
* If the returned value is needed for a long time, it is best to make a copy
7833
* of it with ovsdb_datum_clone(). */
7834
const struct ovsdb_datum *
7835
ovsrec_manager_get_status(const struct ovsrec_manager *row,
7836
enum ovsdb_atomic_type key_type OVS_UNUSED,
7837
enum ovsdb_atomic_type value_type OVS_UNUSED)
7839
ovs_assert(key_type == OVSDB_TYPE_STRING);
7840
ovs_assert(value_type == OVSDB_TYPE_STRING);
7841
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_status);
7844
/* Returns the target column's value in 'row' as a struct ovsdb_datum.
7845
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
7846
* easier and more efficient way to search for a given key than implementing
7847
* the same operation on the "cooked" form in 'row'.
7849
* 'key_type' must be OVSDB_TYPE_STRING.
7850
* (This helps to avoid silent bugs if someone changes target's
7851
* type without updating the caller.)
7853
* The caller must not modify or free the returned value.
7855
* Various kinds of changes can invalidate the returned value: modifying
7856
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7857
* If the returned value is needed for a long time, it is best to make a copy
7858
* of it with ovsdb_datum_clone(). */
7859
const struct ovsdb_datum *
7860
ovsrec_manager_get_target(const struct ovsrec_manager *row,
7861
enum ovsdb_atomic_type key_type OVS_UNUSED)
7863
ovs_assert(key_type == OVSDB_TYPE_STRING);
7864
return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_target);
7868
ovsrec_manager_set_connection_mode(const struct ovsrec_manager *row, const char *connection_mode)
7870
struct ovsdb_datum datum;
7871
union ovsdb_atom key;
7874
if (connection_mode) {
7877
key.string = CONST_CAST(char *, connection_mode);
7882
datum.values = NULL;
7883
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_CONNECTION_MODE], &datum);
7887
ovsrec_manager_set_external_ids(const struct ovsrec_manager *row, const struct smap *smap)
7889
struct ovsdb_datum datum;
7893
struct smap_node *node;
7896
datum.n = smap_count(smap);
7897
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
7898
datum.values = xmalloc(datum.n * sizeof *datum.values);
7901
SMAP_FOR_EACH (node, smap) {
7902
datum.keys[i].string = xstrdup(node->key);
7903
datum.values[i].string = xstrdup(node->value);
7906
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
7908
ovsdb_datum_init_empty(&datum);
7910
ovsdb_idl_txn_write(&row->header_,
7911
&ovsrec_manager_columns[OVSREC_MANAGER_COL_EXTERNAL_IDS],
7917
ovsrec_manager_set_inactivity_probe(const struct ovsrec_manager *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
7919
struct ovsdb_datum datum;
7920
union ovsdb_atom key;
7923
if (n_inactivity_probe) {
7926
key.integer = *inactivity_probe;
7931
datum.values = NULL;
7932
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_INACTIVITY_PROBE], &datum);
7936
ovsrec_manager_set_is_connected(const struct ovsrec_manager *row, bool is_connected)
7938
struct ovsdb_datum datum;
7939
union ovsdb_atom key;
7944
key.boolean = is_connected;
7945
datum.values = NULL;
7946
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_IS_CONNECTED], &datum);
7950
ovsrec_manager_set_max_backoff(const struct ovsrec_manager *row, const int64_t *max_backoff, size_t n_max_backoff)
7952
struct ovsdb_datum datum;
7953
union ovsdb_atom key;
7956
if (n_max_backoff) {
7959
key.integer = *max_backoff;
7964
datum.values = NULL;
7965
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_MAX_BACKOFF], &datum);
7969
ovsrec_manager_set_other_config(const struct ovsrec_manager *row, const struct smap *smap)
7971
struct ovsdb_datum datum;
7975
struct smap_node *node;
7978
datum.n = smap_count(smap);
7979
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
7980
datum.values = xmalloc(datum.n * sizeof *datum.values);
7983
SMAP_FOR_EACH (node, smap) {
7984
datum.keys[i].string = xstrdup(node->key);
7985
datum.values[i].string = xstrdup(node->value);
7988
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
7990
ovsdb_datum_init_empty(&datum);
7992
ovsdb_idl_txn_write(&row->header_,
7993
&ovsrec_manager_columns[OVSREC_MANAGER_COL_OTHER_CONFIG],
7999
ovsrec_manager_set_status(const struct ovsrec_manager *row, const struct smap *smap)
8001
struct ovsdb_datum datum;
8005
struct smap_node *node;
8008
datum.n = smap_count(smap);
8009
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8010
datum.values = xmalloc(datum.n * sizeof *datum.values);
8013
SMAP_FOR_EACH (node, smap) {
8014
datum.keys[i].string = xstrdup(node->key);
8015
datum.values[i].string = xstrdup(node->value);
8018
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8020
ovsdb_datum_init_empty(&datum);
8022
ovsdb_idl_txn_write(&row->header_,
8023
&ovsrec_manager_columns[OVSREC_MANAGER_COL_STATUS],
8029
ovsrec_manager_set_target(const struct ovsrec_manager *row, const char *target)
8031
struct ovsdb_datum datum;
8032
union ovsdb_atom key;
8037
key.string = CONST_CAST(char *, target);
8038
datum.values = NULL;
8039
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_TARGET], &datum);
8042
struct ovsdb_idl_column ovsrec_manager_columns[OVSREC_MANAGER_N_COLUMNS];
8045
ovsrec_manager_columns_init(void)
8047
struct ovsdb_idl_column *c;
8049
/* Initialize ovsrec_manager_col_connection_mode. */
8050
c = &ovsrec_manager_col_connection_mode;
8051
c->name = "connection_mode";
8052
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8053
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
8054
c->type.key.enum_->n = 2;
8055
c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
8056
c->type.key.enum_->keys[0].string = xstrdup("in-band");
8057
c->type.key.enum_->keys[1].string = xstrdup("out-of-band");
8058
c->type.key.enum_->values = NULL;
8059
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
8060
c->type.key.u.string.minLen = 0;
8061
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8065
c->parse = ovsrec_manager_parse_connection_mode;
8066
c->unparse = ovsrec_manager_unparse_connection_mode;
8068
/* Initialize ovsrec_manager_col_external_ids. */
8069
c = &ovsrec_manager_col_external_ids;
8070
c->name = "external_ids";
8071
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8072
c->type.key.u.string.minLen = 0;
8073
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8074
c->type.value.u.string.minLen = 0;
8076
c->type.n_max = UINT_MAX;
8078
c->parse = ovsrec_manager_parse_external_ids;
8079
c->unparse = ovsrec_manager_unparse_external_ids;
8081
/* Initialize ovsrec_manager_col_inactivity_probe. */
8082
c = &ovsrec_manager_col_inactivity_probe;
8083
c->name = "inactivity_probe";
8084
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8085
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8089
c->parse = ovsrec_manager_parse_inactivity_probe;
8090
c->unparse = ovsrec_manager_unparse_inactivity_probe;
8092
/* Initialize ovsrec_manager_col_is_connected. */
8093
c = &ovsrec_manager_col_is_connected;
8094
c->name = "is_connected";
8095
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
8096
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8100
c->parse = ovsrec_manager_parse_is_connected;
8101
c->unparse = ovsrec_manager_unparse_is_connected;
8103
/* Initialize ovsrec_manager_col_max_backoff. */
8104
c = &ovsrec_manager_col_max_backoff;
8105
c->name = "max_backoff";
8106
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8107
c->type.key.u.integer.min = INT64_C(1000);
8108
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8112
c->parse = ovsrec_manager_parse_max_backoff;
8113
c->unparse = ovsrec_manager_unparse_max_backoff;
8115
/* Initialize ovsrec_manager_col_other_config. */
8116
c = &ovsrec_manager_col_other_config;
8117
c->name = "other_config";
8118
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8119
c->type.key.u.string.minLen = 0;
8120
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8121
c->type.value.u.string.minLen = 0;
8123
c->type.n_max = UINT_MAX;
8125
c->parse = ovsrec_manager_parse_other_config;
8126
c->unparse = ovsrec_manager_unparse_other_config;
8128
/* Initialize ovsrec_manager_col_status. */
8129
c = &ovsrec_manager_col_status;
8131
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8132
c->type.key.u.string.minLen = 0;
8133
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8134
c->type.value.u.string.minLen = 0;
8136
c->type.n_max = UINT_MAX;
8138
c->parse = ovsrec_manager_parse_status;
8139
c->unparse = ovsrec_manager_unparse_status;
8141
/* Initialize ovsrec_manager_col_target. */
8142
c = &ovsrec_manager_col_target;
8144
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8145
c->type.key.u.string.minLen = 0;
8146
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8150
c->parse = ovsrec_manager_parse_target;
8151
c->unparse = ovsrec_manager_unparse_target;
8157
ovsrec_mirror_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8159
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8163
smap_init(&row->external_ids);
8164
for (i = 0; i < datum->n; i++) {
8165
smap_add(&row->external_ids,
8166
datum->keys[i].string,
8167
datum->values[i].string);
8172
ovsrec_mirror_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8174
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8177
if (datum->n >= 1) {
8178
row->name = datum->keys[0].string;
8185
ovsrec_mirror_parse_output_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8187
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8190
if (datum->n >= 1) {
8191
row->output_port = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[0].uuid));
8193
row->output_port = NULL;
8198
ovsrec_mirror_parse_output_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8200
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8201
size_t n = MIN(1, datum->n);
8205
row->output_vlan = NULL;
8206
row->n_output_vlan = 0;
8207
for (i = 0; i < n; i++) {
8208
if (!row->n_output_vlan) {
8209
row->output_vlan = xmalloc(n * sizeof *row->output_vlan);
8211
row->output_vlan[row->n_output_vlan] = datum->keys[i].integer;
8212
row->n_output_vlan++;
8217
ovsrec_mirror_parse_select_all(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8219
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8222
if (datum->n >= 1) {
8223
row->select_all = datum->keys[0].boolean;
8225
row->select_all = false;
8230
ovsrec_mirror_parse_select_dst_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8232
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8236
row->select_dst_port = NULL;
8237
row->n_select_dst_port = 0;
8238
for (i = 0; i < datum->n; i++) {
8239
struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[i].uuid));
8241
if (!row->n_select_dst_port) {
8242
row->select_dst_port = xmalloc(datum->n * sizeof *row->select_dst_port);
8244
row->select_dst_port[row->n_select_dst_port] = keyRow;
8245
row->n_select_dst_port++;
8251
ovsrec_mirror_parse_select_src_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8253
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8257
row->select_src_port = NULL;
8258
row->n_select_src_port = 0;
8259
for (i = 0; i < datum->n; i++) {
8260
struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[i].uuid));
8262
if (!row->n_select_src_port) {
8263
row->select_src_port = xmalloc(datum->n * sizeof *row->select_src_port);
8265
row->select_src_port[row->n_select_src_port] = keyRow;
8266
row->n_select_src_port++;
8272
ovsrec_mirror_parse_select_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8274
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8275
size_t n = MIN(4096, datum->n);
8279
row->select_vlan = NULL;
8280
row->n_select_vlan = 0;
8281
for (i = 0; i < n; i++) {
8282
if (!row->n_select_vlan) {
8283
row->select_vlan = xmalloc(n * sizeof *row->select_vlan);
8285
row->select_vlan[row->n_select_vlan] = datum->keys[i].integer;
8286
row->n_select_vlan++;
8291
ovsrec_mirror_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8293
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8297
row->key_statistics = NULL;
8298
row->value_statistics = NULL;
8299
row->n_statistics = 0;
8300
for (i = 0; i < datum->n; i++) {
8301
if (!row->n_statistics) {
8302
row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
8303
row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
8305
row->key_statistics[row->n_statistics] = datum->keys[i].string;
8306
row->value_statistics[row->n_statistics] = datum->values[i].integer;
8307
row->n_statistics++;
8312
ovsrec_mirror_unparse_external_ids(struct ovsdb_idl_row *row_)
8314
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8317
smap_destroy(&row->external_ids);
8321
ovsrec_mirror_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
8323
/* Nothing to do. */
8327
ovsrec_mirror_unparse_output_port(struct ovsdb_idl_row *row OVS_UNUSED)
8329
/* Nothing to do. */
8333
ovsrec_mirror_unparse_output_vlan(struct ovsdb_idl_row *row_)
8335
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8338
free(row->output_vlan);
8342
ovsrec_mirror_unparse_select_all(struct ovsdb_idl_row *row OVS_UNUSED)
8344
/* Nothing to do. */
8348
ovsrec_mirror_unparse_select_dst_port(struct ovsdb_idl_row *row_)
8350
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8353
free(row->select_dst_port);
8357
ovsrec_mirror_unparse_select_src_port(struct ovsdb_idl_row *row_)
8359
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8362
free(row->select_src_port);
8366
ovsrec_mirror_unparse_select_vlan(struct ovsdb_idl_row *row_)
8368
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8371
free(row->select_vlan);
8375
ovsrec_mirror_unparse_statistics(struct ovsdb_idl_row *row_)
8377
struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8380
free(row->key_statistics);
8381
free(row->value_statistics);
8385
ovsrec_mirror_init__(struct ovsdb_idl_row *row)
8387
ovsrec_mirror_init(ovsrec_mirror_cast(row));
8391
ovsrec_mirror_init(struct ovsrec_mirror *row)
8393
memset(row, 0, sizeof *row);
8394
smap_init(&row->external_ids);
8397
const struct ovsrec_mirror *
8398
ovsrec_mirror_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
8400
return ovsrec_mirror_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_MIRROR], uuid));
8403
const struct ovsrec_mirror *
8404
ovsrec_mirror_first(const struct ovsdb_idl *idl)
8406
return ovsrec_mirror_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]));
8409
const struct ovsrec_mirror *
8410
ovsrec_mirror_next(const struct ovsrec_mirror *row)
8412
return ovsrec_mirror_cast(ovsdb_idl_next_row(&row->header_));
8416
ovsrec_mirror_delete(const struct ovsrec_mirror *row)
8418
ovsdb_idl_txn_delete(&row->header_);
8421
struct ovsrec_mirror *
8422
ovsrec_mirror_insert(struct ovsdb_idl_txn *txn)
8424
return ovsrec_mirror_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_MIRROR], NULL));
8429
ovsrec_mirror_verify_external_ids(const struct ovsrec_mirror *row)
8432
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_EXTERNAL_IDS]);
8436
ovsrec_mirror_verify_name(const struct ovsrec_mirror *row)
8439
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_NAME]);
8443
ovsrec_mirror_verify_output_port(const struct ovsrec_mirror *row)
8446
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_PORT]);
8450
ovsrec_mirror_verify_output_vlan(const struct ovsrec_mirror *row)
8453
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_VLAN]);
8457
ovsrec_mirror_verify_select_all(const struct ovsrec_mirror *row)
8460
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_ALL]);
8464
ovsrec_mirror_verify_select_dst_port(const struct ovsrec_mirror *row)
8467
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_DST_PORT]);
8471
ovsrec_mirror_verify_select_src_port(const struct ovsrec_mirror *row)
8474
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_SRC_PORT]);
8478
ovsrec_mirror_verify_select_vlan(const struct ovsrec_mirror *row)
8481
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_VLAN]);
8485
ovsrec_mirror_verify_statistics(const struct ovsrec_mirror *row)
8488
ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_STATISTICS]);
8491
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
8492
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8493
* easier and more efficient way to search for a given key than implementing
8494
* the same operation on the "cooked" form in 'row'.
8496
* 'key_type' must be OVSDB_TYPE_STRING.
8497
* 'value_type' must be OVSDB_TYPE_STRING.
8498
* (This helps to avoid silent bugs if someone changes external_ids's
8499
* type without updating the caller.)
8501
* The caller must not modify or free the returned value.
8503
* Various kinds of changes can invalidate the returned value: modifying
8504
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8505
* If the returned value is needed for a long time, it is best to make a copy
8506
* of it with ovsdb_datum_clone(). */
8507
const struct ovsdb_datum *
8508
ovsrec_mirror_get_external_ids(const struct ovsrec_mirror *row,
8509
enum ovsdb_atomic_type key_type OVS_UNUSED,
8510
enum ovsdb_atomic_type value_type OVS_UNUSED)
8512
ovs_assert(key_type == OVSDB_TYPE_STRING);
8513
ovs_assert(value_type == OVSDB_TYPE_STRING);
8514
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_external_ids);
8517
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
8518
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8519
* easier and more efficient way to search for a given key than implementing
8520
* the same operation on the "cooked" form in 'row'.
8522
* 'key_type' must be OVSDB_TYPE_STRING.
8523
* (This helps to avoid silent bugs if someone changes name's
8524
* type without updating the caller.)
8526
* The caller must not modify or free the returned value.
8528
* Various kinds of changes can invalidate the returned value: modifying
8529
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8530
* If the returned value is needed for a long time, it is best to make a copy
8531
* of it with ovsdb_datum_clone(). */
8532
const struct ovsdb_datum *
8533
ovsrec_mirror_get_name(const struct ovsrec_mirror *row,
8534
enum ovsdb_atomic_type key_type OVS_UNUSED)
8536
ovs_assert(key_type == OVSDB_TYPE_STRING);
8537
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_name);
8540
/* Returns the output_port column's value in 'row' as a struct ovsdb_datum.
8541
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8542
* easier and more efficient way to search for a given key than implementing
8543
* the same operation on the "cooked" form in 'row'.
8545
* 'key_type' must be OVSDB_TYPE_UUID.
8546
* (This helps to avoid silent bugs if someone changes output_port's
8547
* type without updating the caller.)
8549
* The caller must not modify or free the returned value.
8551
* Various kinds of changes can invalidate the returned value: modifying
8552
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8553
* If the returned value is needed for a long time, it is best to make a copy
8554
* of it with ovsdb_datum_clone(). */
8555
const struct ovsdb_datum *
8556
ovsrec_mirror_get_output_port(const struct ovsrec_mirror *row,
8557
enum ovsdb_atomic_type key_type OVS_UNUSED)
8559
ovs_assert(key_type == OVSDB_TYPE_UUID);
8560
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_port);
8563
/* Returns the output_vlan column's value in 'row' as a struct ovsdb_datum.
8564
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8565
* easier and more efficient way to search for a given key than implementing
8566
* the same operation on the "cooked" form in 'row'.
8568
* 'key_type' must be OVSDB_TYPE_INTEGER.
8569
* (This helps to avoid silent bugs if someone changes output_vlan's
8570
* type without updating the caller.)
8572
* The caller must not modify or free the returned value.
8574
* Various kinds of changes can invalidate the returned value: modifying
8575
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8576
* If the returned value is needed for a long time, it is best to make a copy
8577
* of it with ovsdb_datum_clone(). */
8578
const struct ovsdb_datum *
8579
ovsrec_mirror_get_output_vlan(const struct ovsrec_mirror *row,
8580
enum ovsdb_atomic_type key_type OVS_UNUSED)
8582
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8583
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_vlan);
8586
/* Returns the select_all column's value in 'row' as a struct ovsdb_datum.
8587
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8588
* easier and more efficient way to search for a given key than implementing
8589
* the same operation on the "cooked" form in 'row'.
8591
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
8592
* (This helps to avoid silent bugs if someone changes select_all's
8593
* type without updating the caller.)
8595
* The caller must not modify or free the returned value.
8597
* Various kinds of changes can invalidate the returned value: modifying
8598
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8599
* If the returned value is needed for a long time, it is best to make a copy
8600
* of it with ovsdb_datum_clone(). */
8601
const struct ovsdb_datum *
8602
ovsrec_mirror_get_select_all(const struct ovsrec_mirror *row,
8603
enum ovsdb_atomic_type key_type OVS_UNUSED)
8605
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
8606
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_all);
8609
/* Returns the select_dst_port column's value in 'row' as a struct ovsdb_datum.
8610
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8611
* easier and more efficient way to search for a given key than implementing
8612
* the same operation on the "cooked" form in 'row'.
8614
* 'key_type' must be OVSDB_TYPE_UUID.
8615
* (This helps to avoid silent bugs if someone changes select_dst_port's
8616
* type without updating the caller.)
8618
* The caller must not modify or free the returned value.
8620
* Various kinds of changes can invalidate the returned value: modifying
8621
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8622
* If the returned value is needed for a long time, it is best to make a copy
8623
* of it with ovsdb_datum_clone(). */
8624
const struct ovsdb_datum *
8625
ovsrec_mirror_get_select_dst_port(const struct ovsrec_mirror *row,
8626
enum ovsdb_atomic_type key_type OVS_UNUSED)
8628
ovs_assert(key_type == OVSDB_TYPE_UUID);
8629
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_dst_port);
8632
/* Returns the select_src_port column's value in 'row' as a struct ovsdb_datum.
8633
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8634
* easier and more efficient way to search for a given key than implementing
8635
* the same operation on the "cooked" form in 'row'.
8637
* 'key_type' must be OVSDB_TYPE_UUID.
8638
* (This helps to avoid silent bugs if someone changes select_src_port's
8639
* type without updating the caller.)
8641
* The caller must not modify or free the returned value.
8643
* Various kinds of changes can invalidate the returned value: modifying
8644
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8645
* If the returned value is needed for a long time, it is best to make a copy
8646
* of it with ovsdb_datum_clone(). */
8647
const struct ovsdb_datum *
8648
ovsrec_mirror_get_select_src_port(const struct ovsrec_mirror *row,
8649
enum ovsdb_atomic_type key_type OVS_UNUSED)
8651
ovs_assert(key_type == OVSDB_TYPE_UUID);
8652
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_src_port);
8655
/* Returns the select_vlan column's value in 'row' as a struct ovsdb_datum.
8656
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8657
* easier and more efficient way to search for a given key than implementing
8658
* the same operation on the "cooked" form in 'row'.
8660
* 'key_type' must be OVSDB_TYPE_INTEGER.
8661
* (This helps to avoid silent bugs if someone changes select_vlan's
8662
* type without updating the caller.)
8664
* The caller must not modify or free the returned value.
8666
* Various kinds of changes can invalidate the returned value: modifying
8667
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8668
* If the returned value is needed for a long time, it is best to make a copy
8669
* of it with ovsdb_datum_clone(). */
8670
const struct ovsdb_datum *
8671
ovsrec_mirror_get_select_vlan(const struct ovsrec_mirror *row,
8672
enum ovsdb_atomic_type key_type OVS_UNUSED)
8674
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8675
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_vlan);
8678
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
8679
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
8680
* easier and more efficient way to search for a given key than implementing
8681
* the same operation on the "cooked" form in 'row'.
8683
* 'key_type' must be OVSDB_TYPE_STRING.
8684
* 'value_type' must be OVSDB_TYPE_INTEGER.
8685
* (This helps to avoid silent bugs if someone changes statistics's
8686
* type without updating the caller.)
8688
* The caller must not modify or free the returned value.
8690
* Various kinds of changes can invalidate the returned value: modifying
8691
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8692
* If the returned value is needed for a long time, it is best to make a copy
8693
* of it with ovsdb_datum_clone(). */
8694
const struct ovsdb_datum *
8695
ovsrec_mirror_get_statistics(const struct ovsrec_mirror *row,
8696
enum ovsdb_atomic_type key_type OVS_UNUSED,
8697
enum ovsdb_atomic_type value_type OVS_UNUSED)
8699
ovs_assert(key_type == OVSDB_TYPE_STRING);
8700
ovs_assert(value_type == OVSDB_TYPE_INTEGER);
8701
return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_statistics);
8705
ovsrec_mirror_set_external_ids(const struct ovsrec_mirror *row, const struct smap *smap)
8707
struct ovsdb_datum datum;
8711
struct smap_node *node;
8714
datum.n = smap_count(smap);
8715
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8716
datum.values = xmalloc(datum.n * sizeof *datum.values);
8719
SMAP_FOR_EACH (node, smap) {
8720
datum.keys[i].string = xstrdup(node->key);
8721
datum.values[i].string = xstrdup(node->value);
8724
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8726
ovsdb_datum_init_empty(&datum);
8728
ovsdb_idl_txn_write(&row->header_,
8729
&ovsrec_mirror_columns[OVSREC_MIRROR_COL_EXTERNAL_IDS],
8735
ovsrec_mirror_set_name(const struct ovsrec_mirror *row, const char *name)
8737
struct ovsdb_datum datum;
8738
union ovsdb_atom key;
8743
key.string = CONST_CAST(char *, name);
8744
datum.values = NULL;
8745
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_NAME], &datum);
8749
ovsrec_mirror_set_output_port(const struct ovsrec_mirror *row, const struct ovsrec_port *output_port)
8751
struct ovsdb_datum datum;
8752
union ovsdb_atom key;
8758
key.uuid = output_port->header_.uuid;
8763
datum.values = NULL;
8764
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_PORT], &datum);
8768
ovsrec_mirror_set_output_vlan(const struct ovsrec_mirror *row, const int64_t *output_vlan, size_t n_output_vlan)
8770
struct ovsdb_datum datum;
8771
union ovsdb_atom key;
8774
if (n_output_vlan) {
8777
key.integer = *output_vlan;
8782
datum.values = NULL;
8783
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_VLAN], &datum);
8787
ovsrec_mirror_set_select_all(const struct ovsrec_mirror *row, bool select_all)
8789
struct ovsdb_datum datum;
8790
union ovsdb_atom key;
8795
key.boolean = select_all;
8796
datum.values = NULL;
8797
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_ALL], &datum);
8801
ovsrec_mirror_set_select_dst_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_dst_port, size_t n_select_dst_port)
8803
struct ovsdb_datum datum;
8807
datum.n = n_select_dst_port;
8808
datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
8809
datum.values = NULL;
8810
for (i = 0; i < n_select_dst_port; i++) {
8811
datum.keys[i].uuid = select_dst_port[i]->header_.uuid;
8813
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8814
ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_DST_PORT], &datum);
8818
ovsrec_mirror_set_select_src_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_src_port, size_t n_select_src_port)
8820
struct ovsdb_datum datum;
8824
datum.n = n_select_src_port;
8825
datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
8826
datum.values = NULL;
8827
for (i = 0; i < n_select_src_port; i++) {
8828
datum.keys[i].uuid = select_src_port[i]->header_.uuid;
8830
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8831
ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_SRC_PORT], &datum);
8835
ovsrec_mirror_set_select_vlan(const struct ovsrec_mirror *row, const int64_t *select_vlan, size_t n_select_vlan)
8837
struct ovsdb_datum datum;
8841
datum.n = n_select_vlan;
8842
datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
8843
datum.values = NULL;
8844
for (i = 0; i < n_select_vlan; i++) {
8845
datum.keys[i].integer = select_vlan[i];
8847
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
8848
ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_VLAN], &datum);
8852
ovsrec_mirror_set_statistics(const struct ovsrec_mirror *row, char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
8854
struct ovsdb_datum datum;
8858
datum.n = n_statistics;
8859
datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
8860
datum.values = xmalloc(n_statistics * sizeof *datum.values);
8861
for (i = 0; i < n_statistics; i++) {
8862
datum.keys[i].string = xstrdup(key_statistics[i]);
8863
datum.values[i].integer = value_statistics[i];
8865
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_INTEGER);
8866
ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_STATISTICS], &datum);
8869
struct ovsdb_idl_column ovsrec_mirror_columns[OVSREC_MIRROR_N_COLUMNS];
8872
ovsrec_mirror_columns_init(void)
8874
struct ovsdb_idl_column *c;
8876
/* Initialize ovsrec_mirror_col_external_ids. */
8877
c = &ovsrec_mirror_col_external_ids;
8878
c->name = "external_ids";
8879
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8880
c->type.key.u.string.minLen = 0;
8881
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8882
c->type.value.u.string.minLen = 0;
8884
c->type.n_max = UINT_MAX;
8886
c->parse = ovsrec_mirror_parse_external_ids;
8887
c->unparse = ovsrec_mirror_unparse_external_ids;
8889
/* Initialize ovsrec_mirror_col_name. */
8890
c = &ovsrec_mirror_col_name;
8892
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8893
c->type.key.u.string.minLen = 0;
8894
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8898
c->parse = ovsrec_mirror_parse_name;
8899
c->unparse = ovsrec_mirror_unparse_name;
8901
/* Initialize ovsrec_mirror_col_output_port. */
8902
c = &ovsrec_mirror_col_output_port;
8903
c->name = "output_port";
8904
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
8905
c->type.key.u.uuid.refTableName = "Port";
8906
c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
8907
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8911
c->parse = ovsrec_mirror_parse_output_port;
8912
c->unparse = ovsrec_mirror_unparse_output_port;
8914
/* Initialize ovsrec_mirror_col_output_vlan. */
8915
c = &ovsrec_mirror_col_output_vlan;
8916
c->name = "output_vlan";
8917
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8918
c->type.key.u.integer.min = INT64_C(1);
8919
c->type.key.u.integer.max = INT64_C(4095);
8920
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8924
c->parse = ovsrec_mirror_parse_output_vlan;
8925
c->unparse = ovsrec_mirror_unparse_output_vlan;
8927
/* Initialize ovsrec_mirror_col_select_all. */
8928
c = &ovsrec_mirror_col_select_all;
8929
c->name = "select_all";
8930
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
8931
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8935
c->parse = ovsrec_mirror_parse_select_all;
8936
c->unparse = ovsrec_mirror_unparse_select_all;
8938
/* Initialize ovsrec_mirror_col_select_dst_port. */
8939
c = &ovsrec_mirror_col_select_dst_port;
8940
c->name = "select_dst_port";
8941
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
8942
c->type.key.u.uuid.refTableName = "Port";
8943
c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
8944
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8946
c->type.n_max = UINT_MAX;
8948
c->parse = ovsrec_mirror_parse_select_dst_port;
8949
c->unparse = ovsrec_mirror_unparse_select_dst_port;
8951
/* Initialize ovsrec_mirror_col_select_src_port. */
8952
c = &ovsrec_mirror_col_select_src_port;
8953
c->name = "select_src_port";
8954
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
8955
c->type.key.u.uuid.refTableName = "Port";
8956
c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
8957
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8959
c->type.n_max = UINT_MAX;
8961
c->parse = ovsrec_mirror_parse_select_src_port;
8962
c->unparse = ovsrec_mirror_unparse_select_src_port;
8964
/* Initialize ovsrec_mirror_col_select_vlan. */
8965
c = &ovsrec_mirror_col_select_vlan;
8966
c->name = "select_vlan";
8967
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8968
c->type.key.u.integer.min = INT64_C(0);
8969
c->type.key.u.integer.max = INT64_C(4095);
8970
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8972
c->type.n_max = 4096;
8974
c->parse = ovsrec_mirror_parse_select_vlan;
8975
c->unparse = ovsrec_mirror_unparse_select_vlan;
8977
/* Initialize ovsrec_mirror_col_statistics. */
8978
c = &ovsrec_mirror_col_statistics;
8979
c->name = "statistics";
8980
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8981
c->type.key.u.string.minLen = 0;
8982
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_INTEGER);
8984
c->type.n_max = UINT_MAX;
8986
c->parse = ovsrec_mirror_parse_statistics;
8987
c->unparse = ovsrec_mirror_unparse_statistics;
8990
/* NetFlow table. */
8993
ovsrec_netflow_parse_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8995
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
8998
if (datum->n >= 1) {
8999
row->active_timeout = datum->keys[0].integer;
9001
row->active_timeout = 0;
9006
ovsrec_netflow_parse_add_id_to_interface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9008
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9011
if (datum->n >= 1) {
9012
row->add_id_to_interface = datum->keys[0].boolean;
9014
row->add_id_to_interface = false;
9019
ovsrec_netflow_parse_engine_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9021
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9022
size_t n = MIN(1, datum->n);
9026
row->engine_id = NULL;
9027
row->n_engine_id = 0;
9028
for (i = 0; i < n; i++) {
9029
if (!row->n_engine_id) {
9030
row->engine_id = xmalloc(n * sizeof *row->engine_id);
9032
row->engine_id[row->n_engine_id] = datum->keys[i].integer;
9038
ovsrec_netflow_parse_engine_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9040
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9041
size_t n = MIN(1, datum->n);
9045
row->engine_type = NULL;
9046
row->n_engine_type = 0;
9047
for (i = 0; i < n; i++) {
9048
if (!row->n_engine_type) {
9049
row->engine_type = xmalloc(n * sizeof *row->engine_type);
9051
row->engine_type[row->n_engine_type] = datum->keys[i].integer;
9052
row->n_engine_type++;
9057
ovsrec_netflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9059
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9063
smap_init(&row->external_ids);
9064
for (i = 0; i < datum->n; i++) {
9065
smap_add(&row->external_ids,
9066
datum->keys[i].string,
9067
datum->values[i].string);
9072
ovsrec_netflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9074
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9078
row->targets = NULL;
9080
for (i = 0; i < datum->n; i++) {
9081
if (!row->n_targets) {
9082
row->targets = xmalloc(datum->n * sizeof *row->targets);
9084
row->targets[row->n_targets] = datum->keys[i].string;
9090
ovsrec_netflow_unparse_active_timeout(struct ovsdb_idl_row *row OVS_UNUSED)
9092
/* Nothing to do. */
9096
ovsrec_netflow_unparse_add_id_to_interface(struct ovsdb_idl_row *row OVS_UNUSED)
9098
/* Nothing to do. */
9102
ovsrec_netflow_unparse_engine_id(struct ovsdb_idl_row *row_)
9104
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9107
free(row->engine_id);
9111
ovsrec_netflow_unparse_engine_type(struct ovsdb_idl_row *row_)
9113
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9116
free(row->engine_type);
9120
ovsrec_netflow_unparse_external_ids(struct ovsdb_idl_row *row_)
9122
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9125
smap_destroy(&row->external_ids);
9129
ovsrec_netflow_unparse_targets(struct ovsdb_idl_row *row_)
9131
struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9138
ovsrec_netflow_init__(struct ovsdb_idl_row *row)
9140
ovsrec_netflow_init(ovsrec_netflow_cast(row));
9144
ovsrec_netflow_init(struct ovsrec_netflow *row)
9146
memset(row, 0, sizeof *row);
9147
smap_init(&row->external_ids);
9150
const struct ovsrec_netflow *
9151
ovsrec_netflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
9153
return ovsrec_netflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW], uuid));
9156
const struct ovsrec_netflow *
9157
ovsrec_netflow_first(const struct ovsdb_idl *idl)
9159
return ovsrec_netflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]));
9162
const struct ovsrec_netflow *
9163
ovsrec_netflow_next(const struct ovsrec_netflow *row)
9165
return ovsrec_netflow_cast(ovsdb_idl_next_row(&row->header_));
9169
ovsrec_netflow_delete(const struct ovsrec_netflow *row)
9171
ovsdb_idl_txn_delete(&row->header_);
9174
struct ovsrec_netflow *
9175
ovsrec_netflow_insert(struct ovsdb_idl_txn *txn)
9177
return ovsrec_netflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW], NULL));
9182
ovsrec_netflow_verify_active_timeout(const struct ovsrec_netflow *row)
9185
ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ACTIVE_TIMEOUT]);
9189
ovsrec_netflow_verify_add_id_to_interface(const struct ovsrec_netflow *row)
9192
ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ADD_ID_TO_INTERFACE]);
9196
ovsrec_netflow_verify_engine_id(const struct ovsrec_netflow *row)
9199
ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_ID]);
9203
ovsrec_netflow_verify_engine_type(const struct ovsrec_netflow *row)
9206
ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_TYPE]);
9210
ovsrec_netflow_verify_external_ids(const struct ovsrec_netflow *row)
9213
ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_EXTERNAL_IDS]);
9217
ovsrec_netflow_verify_targets(const struct ovsrec_netflow *row)
9220
ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_TARGETS]);
9223
/* Returns the active_timeout column's value in 'row' as a struct ovsdb_datum.
9224
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9225
* easier and more efficient way to search for a given key than implementing
9226
* the same operation on the "cooked" form in 'row'.
9228
* 'key_type' must be OVSDB_TYPE_INTEGER.
9229
* (This helps to avoid silent bugs if someone changes active_timeout's
9230
* type without updating the caller.)
9232
* The caller must not modify or free the returned value.
9234
* Various kinds of changes can invalidate the returned value: modifying
9235
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9236
* If the returned value is needed for a long time, it is best to make a copy
9237
* of it with ovsdb_datum_clone(). */
9238
const struct ovsdb_datum *
9239
ovsrec_netflow_get_active_timeout(const struct ovsrec_netflow *row,
9240
enum ovsdb_atomic_type key_type OVS_UNUSED)
9242
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9243
return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_active_timeout);
9246
/* Returns the add_id_to_interface column's value in 'row' as a struct ovsdb_datum.
9247
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9248
* easier and more efficient way to search for a given key than implementing
9249
* the same operation on the "cooked" form in 'row'.
9251
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
9252
* (This helps to avoid silent bugs if someone changes add_id_to_interface's
9253
* type without updating the caller.)
9255
* The caller must not modify or free the returned value.
9257
* Various kinds of changes can invalidate the returned value: modifying
9258
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9259
* If the returned value is needed for a long time, it is best to make a copy
9260
* of it with ovsdb_datum_clone(). */
9261
const struct ovsdb_datum *
9262
ovsrec_netflow_get_add_id_to_interface(const struct ovsrec_netflow *row,
9263
enum ovsdb_atomic_type key_type OVS_UNUSED)
9265
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
9266
return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_add_id_to_interface);
9269
/* Returns the engine_id column's value in 'row' as a struct ovsdb_datum.
9270
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9271
* easier and more efficient way to search for a given key than implementing
9272
* the same operation on the "cooked" form in 'row'.
9274
* 'key_type' must be OVSDB_TYPE_INTEGER.
9275
* (This helps to avoid silent bugs if someone changes engine_id's
9276
* type without updating the caller.)
9278
* The caller must not modify or free the returned value.
9280
* Various kinds of changes can invalidate the returned value: modifying
9281
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9282
* If the returned value is needed for a long time, it is best to make a copy
9283
* of it with ovsdb_datum_clone(). */
9284
const struct ovsdb_datum *
9285
ovsrec_netflow_get_engine_id(const struct ovsrec_netflow *row,
9286
enum ovsdb_atomic_type key_type OVS_UNUSED)
9288
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9289
return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_id);
9292
/* Returns the engine_type column's value in 'row' as a struct ovsdb_datum.
9293
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9294
* easier and more efficient way to search for a given key than implementing
9295
* the same operation on the "cooked" form in 'row'.
9297
* 'key_type' must be OVSDB_TYPE_INTEGER.
9298
* (This helps to avoid silent bugs if someone changes engine_type's
9299
* type without updating the caller.)
9301
* The caller must not modify or free the returned value.
9303
* Various kinds of changes can invalidate the returned value: modifying
9304
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9305
* If the returned value is needed for a long time, it is best to make a copy
9306
* of it with ovsdb_datum_clone(). */
9307
const struct ovsdb_datum *
9308
ovsrec_netflow_get_engine_type(const struct ovsrec_netflow *row,
9309
enum ovsdb_atomic_type key_type OVS_UNUSED)
9311
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9312
return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_type);
9315
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
9316
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9317
* easier and more efficient way to search for a given key than implementing
9318
* the same operation on the "cooked" form in 'row'.
9320
* 'key_type' must be OVSDB_TYPE_STRING.
9321
* 'value_type' must be OVSDB_TYPE_STRING.
9322
* (This helps to avoid silent bugs if someone changes external_ids's
9323
* type without updating the caller.)
9325
* The caller must not modify or free the returned value.
9327
* Various kinds of changes can invalidate the returned value: modifying
9328
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9329
* If the returned value is needed for a long time, it is best to make a copy
9330
* of it with ovsdb_datum_clone(). */
9331
const struct ovsdb_datum *
9332
ovsrec_netflow_get_external_ids(const struct ovsrec_netflow *row,
9333
enum ovsdb_atomic_type key_type OVS_UNUSED,
9334
enum ovsdb_atomic_type value_type OVS_UNUSED)
9336
ovs_assert(key_type == OVSDB_TYPE_STRING);
9337
ovs_assert(value_type == OVSDB_TYPE_STRING);
9338
return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_external_ids);
9341
/* Returns the targets column's value in 'row' as a struct ovsdb_datum.
9342
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9343
* easier and more efficient way to search for a given key than implementing
9344
* the same operation on the "cooked" form in 'row'.
9346
* 'key_type' must be OVSDB_TYPE_STRING.
9347
* (This helps to avoid silent bugs if someone changes targets's
9348
* type without updating the caller.)
9350
* The caller must not modify or free the returned value.
9352
* Various kinds of changes can invalidate the returned value: modifying
9353
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9354
* If the returned value is needed for a long time, it is best to make a copy
9355
* of it with ovsdb_datum_clone(). */
9356
const struct ovsdb_datum *
9357
ovsrec_netflow_get_targets(const struct ovsrec_netflow *row,
9358
enum ovsdb_atomic_type key_type OVS_UNUSED)
9360
ovs_assert(key_type == OVSDB_TYPE_STRING);
9361
return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_targets);
9365
ovsrec_netflow_set_active_timeout(const struct ovsrec_netflow *row, int64_t active_timeout)
9367
struct ovsdb_datum datum;
9368
union ovsdb_atom key;
9373
key.integer = active_timeout;
9374
datum.values = NULL;
9375
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ACTIVE_TIMEOUT], &datum);
9379
ovsrec_netflow_set_add_id_to_interface(const struct ovsrec_netflow *row, bool add_id_to_interface)
9381
struct ovsdb_datum datum;
9382
union ovsdb_atom key;
9387
key.boolean = add_id_to_interface;
9388
datum.values = NULL;
9389
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ADD_ID_TO_INTERFACE], &datum);
9393
ovsrec_netflow_set_engine_id(const struct ovsrec_netflow *row, const int64_t *engine_id, size_t n_engine_id)
9395
struct ovsdb_datum datum;
9396
union ovsdb_atom key;
9402
key.integer = *engine_id;
9407
datum.values = NULL;
9408
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_ID], &datum);
9412
ovsrec_netflow_set_engine_type(const struct ovsrec_netflow *row, const int64_t *engine_type, size_t n_engine_type)
9414
struct ovsdb_datum datum;
9415
union ovsdb_atom key;
9418
if (n_engine_type) {
9421
key.integer = *engine_type;
9426
datum.values = NULL;
9427
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_TYPE], &datum);
9431
ovsrec_netflow_set_external_ids(const struct ovsrec_netflow *row, const struct smap *smap)
9433
struct ovsdb_datum datum;
9437
struct smap_node *node;
9440
datum.n = smap_count(smap);
9441
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
9442
datum.values = xmalloc(datum.n * sizeof *datum.values);
9445
SMAP_FOR_EACH (node, smap) {
9446
datum.keys[i].string = xstrdup(node->key);
9447
datum.values[i].string = xstrdup(node->value);
9450
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
9452
ovsdb_datum_init_empty(&datum);
9454
ovsdb_idl_txn_write(&row->header_,
9455
&ovsrec_netflow_columns[OVSREC_NETFLOW_COL_EXTERNAL_IDS],
9461
ovsrec_netflow_set_targets(const struct ovsrec_netflow *row, char **targets, size_t n_targets)
9463
struct ovsdb_datum datum;
9467
datum.n = n_targets;
9468
datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
9469
datum.values = NULL;
9470
for (i = 0; i < n_targets; i++) {
9471
datum.keys[i].string = xstrdup(targets[i]);
9473
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
9474
ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_TARGETS], &datum);
9477
struct ovsdb_idl_column ovsrec_netflow_columns[OVSREC_NETFLOW_N_COLUMNS];
9480
ovsrec_netflow_columns_init(void)
9482
struct ovsdb_idl_column *c;
9484
/* Initialize ovsrec_netflow_col_active_timeout. */
9485
c = &ovsrec_netflow_col_active_timeout;
9486
c->name = "active_timeout";
9487
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9488
c->type.key.u.integer.min = INT64_C(-1);
9489
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9493
c->parse = ovsrec_netflow_parse_active_timeout;
9494
c->unparse = ovsrec_netflow_unparse_active_timeout;
9496
/* Initialize ovsrec_netflow_col_add_id_to_interface. */
9497
c = &ovsrec_netflow_col_add_id_to_interface;
9498
c->name = "add_id_to_interface";
9499
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
9500
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9504
c->parse = ovsrec_netflow_parse_add_id_to_interface;
9505
c->unparse = ovsrec_netflow_unparse_add_id_to_interface;
9507
/* Initialize ovsrec_netflow_col_engine_id. */
9508
c = &ovsrec_netflow_col_engine_id;
9509
c->name = "engine_id";
9510
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9511
c->type.key.u.integer.min = INT64_C(0);
9512
c->type.key.u.integer.max = INT64_C(255);
9513
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9517
c->parse = ovsrec_netflow_parse_engine_id;
9518
c->unparse = ovsrec_netflow_unparse_engine_id;
9520
/* Initialize ovsrec_netflow_col_engine_type. */
9521
c = &ovsrec_netflow_col_engine_type;
9522
c->name = "engine_type";
9523
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9524
c->type.key.u.integer.min = INT64_C(0);
9525
c->type.key.u.integer.max = INT64_C(255);
9526
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9530
c->parse = ovsrec_netflow_parse_engine_type;
9531
c->unparse = ovsrec_netflow_unparse_engine_type;
9533
/* Initialize ovsrec_netflow_col_external_ids. */
9534
c = &ovsrec_netflow_col_external_ids;
9535
c->name = "external_ids";
9536
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9537
c->type.key.u.string.minLen = 0;
9538
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
9539
c->type.value.u.string.minLen = 0;
9541
c->type.n_max = UINT_MAX;
9543
c->parse = ovsrec_netflow_parse_external_ids;
9544
c->unparse = ovsrec_netflow_unparse_external_ids;
9546
/* Initialize ovsrec_netflow_col_targets. */
9547
c = &ovsrec_netflow_col_targets;
9548
c->name = "targets";
9549
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9550
c->type.key.u.string.minLen = 0;
9551
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9553
c->type.n_max = UINT_MAX;
9555
c->parse = ovsrec_netflow_parse_targets;
9556
c->unparse = ovsrec_netflow_unparse_targets;
9559
/* Open_vSwitch table. */
9562
ovsrec_open_vswitch_parse_bridges(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9564
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9568
row->bridges = NULL;
9570
for (i = 0; i < datum->n; i++) {
9571
struct ovsrec_bridge *keyRow = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], &datum->keys[i].uuid));
9573
if (!row->n_bridges) {
9574
row->bridges = xmalloc(datum->n * sizeof *row->bridges);
9576
row->bridges[row->n_bridges] = keyRow;
9583
ovsrec_open_vswitch_parse_cur_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9585
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9588
if (datum->n >= 1) {
9589
row->cur_cfg = datum->keys[0].integer;
9596
ovsrec_open_vswitch_parse_db_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9598
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9601
if (datum->n >= 1) {
9602
row->db_version = datum->keys[0].string;
9604
row->db_version = NULL;
9609
ovsrec_open_vswitch_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9611
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9615
smap_init(&row->external_ids);
9616
for (i = 0; i < datum->n; i++) {
9617
smap_add(&row->external_ids,
9618
datum->keys[i].string,
9619
datum->values[i].string);
9624
ovsrec_open_vswitch_parse_manager_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9626
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9630
row->manager_options = NULL;
9631
row->n_manager_options = 0;
9632
for (i = 0; i < datum->n; i++) {
9633
struct ovsrec_manager *keyRow = ovsrec_manager_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_MANAGER], &datum->keys[i].uuid));
9635
if (!row->n_manager_options) {
9636
row->manager_options = xmalloc(datum->n * sizeof *row->manager_options);
9638
row->manager_options[row->n_manager_options] = keyRow;
9639
row->n_manager_options++;
9645
ovsrec_open_vswitch_parse_next_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9647
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9650
if (datum->n >= 1) {
9651
row->next_cfg = datum->keys[0].integer;
9658
ovsrec_open_vswitch_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9660
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9664
smap_init(&row->other_config);
9665
for (i = 0; i < datum->n; i++) {
9666
smap_add(&row->other_config,
9667
datum->keys[i].string,
9668
datum->values[i].string);
9673
ovsrec_open_vswitch_parse_ovs_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9675
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9678
if (datum->n >= 1) {
9679
row->ovs_version = datum->keys[0].string;
9681
row->ovs_version = NULL;
9686
ovsrec_open_vswitch_parse_ssl(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9688
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9691
if (datum->n >= 1) {
9692
row->ssl = ovsrec_ssl_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_SSL], &datum->keys[0].uuid));
9699
ovsrec_open_vswitch_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9701
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9705
smap_init(&row->statistics);
9706
for (i = 0; i < datum->n; i++) {
9707
smap_add(&row->statistics,
9708
datum->keys[i].string,
9709
datum->values[i].string);
9714
ovsrec_open_vswitch_parse_system_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9716
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9719
if (datum->n >= 1) {
9720
row->system_type = datum->keys[0].string;
9722
row->system_type = NULL;
9727
ovsrec_open_vswitch_parse_system_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9729
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9732
if (datum->n >= 1) {
9733
row->system_version = datum->keys[0].string;
9735
row->system_version = NULL;
9740
ovsrec_open_vswitch_unparse_bridges(struct ovsdb_idl_row *row_)
9742
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9749
ovsrec_open_vswitch_unparse_cur_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
9751
/* Nothing to do. */
9755
ovsrec_open_vswitch_unparse_db_version(struct ovsdb_idl_row *row OVS_UNUSED)
9757
/* Nothing to do. */
9761
ovsrec_open_vswitch_unparse_external_ids(struct ovsdb_idl_row *row_)
9763
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9766
smap_destroy(&row->external_ids);
9770
ovsrec_open_vswitch_unparse_manager_options(struct ovsdb_idl_row *row_)
9772
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9775
free(row->manager_options);
9779
ovsrec_open_vswitch_unparse_next_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
9781
/* Nothing to do. */
9785
ovsrec_open_vswitch_unparse_other_config(struct ovsdb_idl_row *row_)
9787
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9790
smap_destroy(&row->other_config);
9794
ovsrec_open_vswitch_unparse_ovs_version(struct ovsdb_idl_row *row OVS_UNUSED)
9796
/* Nothing to do. */
9800
ovsrec_open_vswitch_unparse_ssl(struct ovsdb_idl_row *row OVS_UNUSED)
9802
/* Nothing to do. */
9806
ovsrec_open_vswitch_unparse_statistics(struct ovsdb_idl_row *row_)
9808
struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9811
smap_destroy(&row->statistics);
9815
ovsrec_open_vswitch_unparse_system_type(struct ovsdb_idl_row *row OVS_UNUSED)
9817
/* Nothing to do. */
9821
ovsrec_open_vswitch_unparse_system_version(struct ovsdb_idl_row *row OVS_UNUSED)
9823
/* Nothing to do. */
9827
ovsrec_open_vswitch_init__(struct ovsdb_idl_row *row)
9829
ovsrec_open_vswitch_init(ovsrec_open_vswitch_cast(row));
9833
ovsrec_open_vswitch_init(struct ovsrec_open_vswitch *row)
9835
memset(row, 0, sizeof *row);
9836
smap_init(&row->external_ids);
9837
smap_init(&row->other_config);
9838
smap_init(&row->statistics);
9841
const struct ovsrec_open_vswitch *
9842
ovsrec_open_vswitch_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
9844
return ovsrec_open_vswitch_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH], uuid));
9847
const struct ovsrec_open_vswitch *
9848
ovsrec_open_vswitch_first(const struct ovsdb_idl *idl)
9850
return ovsrec_open_vswitch_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]));
9853
const struct ovsrec_open_vswitch *
9854
ovsrec_open_vswitch_next(const struct ovsrec_open_vswitch *row)
9856
return ovsrec_open_vswitch_cast(ovsdb_idl_next_row(&row->header_));
9860
ovsrec_open_vswitch_delete(const struct ovsrec_open_vswitch *row)
9862
ovsdb_idl_txn_delete(&row->header_);
9865
struct ovsrec_open_vswitch *
9866
ovsrec_open_vswitch_insert(struct ovsdb_idl_txn *txn)
9868
return ovsrec_open_vswitch_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH], NULL));
9873
ovsrec_open_vswitch_verify_bridges(const struct ovsrec_open_vswitch *row)
9876
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_BRIDGES]);
9880
ovsrec_open_vswitch_verify_cur_cfg(const struct ovsrec_open_vswitch *row)
9883
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_CUR_CFG]);
9887
ovsrec_open_vswitch_verify_db_version(const struct ovsrec_open_vswitch *row)
9890
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_DB_VERSION]);
9894
ovsrec_open_vswitch_verify_external_ids(const struct ovsrec_open_vswitch *row)
9897
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS]);
9901
ovsrec_open_vswitch_verify_manager_options(const struct ovsrec_open_vswitch *row)
9904
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_MANAGER_OPTIONS]);
9908
ovsrec_open_vswitch_verify_next_cfg(const struct ovsrec_open_vswitch *row)
9911
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_NEXT_CFG]);
9915
ovsrec_open_vswitch_verify_other_config(const struct ovsrec_open_vswitch *row)
9918
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG]);
9922
ovsrec_open_vswitch_verify_ovs_version(const struct ovsrec_open_vswitch *row)
9925
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OVS_VERSION]);
9929
ovsrec_open_vswitch_verify_ssl(const struct ovsrec_open_vswitch *row)
9932
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SSL]);
9936
ovsrec_open_vswitch_verify_statistics(const struct ovsrec_open_vswitch *row)
9939
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_STATISTICS]);
9943
ovsrec_open_vswitch_verify_system_type(const struct ovsrec_open_vswitch *row)
9946
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_TYPE]);
9950
ovsrec_open_vswitch_verify_system_version(const struct ovsrec_open_vswitch *row)
9953
ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_VERSION]);
9956
/* Returns the bridges column's value in 'row' as a struct ovsdb_datum.
9957
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9958
* easier and more efficient way to search for a given key than implementing
9959
* the same operation on the "cooked" form in 'row'.
9961
* 'key_type' must be OVSDB_TYPE_UUID.
9962
* (This helps to avoid silent bugs if someone changes bridges's
9963
* type without updating the caller.)
9965
* The caller must not modify or free the returned value.
9967
* Various kinds of changes can invalidate the returned value: modifying
9968
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9969
* If the returned value is needed for a long time, it is best to make a copy
9970
* of it with ovsdb_datum_clone(). */
9971
const struct ovsdb_datum *
9972
ovsrec_open_vswitch_get_bridges(const struct ovsrec_open_vswitch *row,
9973
enum ovsdb_atomic_type key_type OVS_UNUSED)
9975
ovs_assert(key_type == OVSDB_TYPE_UUID);
9976
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_bridges);
9979
/* Returns the cur_cfg column's value in 'row' as a struct ovsdb_datum.
9980
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
9981
* easier and more efficient way to search for a given key than implementing
9982
* the same operation on the "cooked" form in 'row'.
9984
* 'key_type' must be OVSDB_TYPE_INTEGER.
9985
* (This helps to avoid silent bugs if someone changes cur_cfg's
9986
* type without updating the caller.)
9988
* The caller must not modify or free the returned value.
9990
* Various kinds of changes can invalidate the returned value: modifying
9991
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9992
* If the returned value is needed for a long time, it is best to make a copy
9993
* of it with ovsdb_datum_clone(). */
9994
const struct ovsdb_datum *
9995
ovsrec_open_vswitch_get_cur_cfg(const struct ovsrec_open_vswitch *row,
9996
enum ovsdb_atomic_type key_type OVS_UNUSED)
9998
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9999
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_cur_cfg);
10002
/* Returns the db_version column's value in 'row' as a struct ovsdb_datum.
10003
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10004
* easier and more efficient way to search for a given key than implementing
10005
* the same operation on the "cooked" form in 'row'.
10007
* 'key_type' must be OVSDB_TYPE_STRING.
10008
* (This helps to avoid silent bugs if someone changes db_version's
10009
* type without updating the caller.)
10011
* The caller must not modify or free the returned value.
10013
* Various kinds of changes can invalidate the returned value: modifying
10014
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10015
* If the returned value is needed for a long time, it is best to make a copy
10016
* of it with ovsdb_datum_clone(). */
10017
const struct ovsdb_datum *
10018
ovsrec_open_vswitch_get_db_version(const struct ovsrec_open_vswitch *row,
10019
enum ovsdb_atomic_type key_type OVS_UNUSED)
10021
ovs_assert(key_type == OVSDB_TYPE_STRING);
10022
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_db_version);
10025
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
10026
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10027
* easier and more efficient way to search for a given key than implementing
10028
* the same operation on the "cooked" form in 'row'.
10030
* 'key_type' must be OVSDB_TYPE_STRING.
10031
* 'value_type' must be OVSDB_TYPE_STRING.
10032
* (This helps to avoid silent bugs if someone changes external_ids's
10033
* type without updating the caller.)
10035
* The caller must not modify or free the returned value.
10037
* Various kinds of changes can invalidate the returned value: modifying
10038
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10039
* If the returned value is needed for a long time, it is best to make a copy
10040
* of it with ovsdb_datum_clone(). */
10041
const struct ovsdb_datum *
10042
ovsrec_open_vswitch_get_external_ids(const struct ovsrec_open_vswitch *row,
10043
enum ovsdb_atomic_type key_type OVS_UNUSED,
10044
enum ovsdb_atomic_type value_type OVS_UNUSED)
10046
ovs_assert(key_type == OVSDB_TYPE_STRING);
10047
ovs_assert(value_type == OVSDB_TYPE_STRING);
10048
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_external_ids);
10051
/* Returns the manager_options column's value in 'row' as a struct ovsdb_datum.
10052
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10053
* easier and more efficient way to search for a given key than implementing
10054
* the same operation on the "cooked" form in 'row'.
10056
* 'key_type' must be OVSDB_TYPE_UUID.
10057
* (This helps to avoid silent bugs if someone changes manager_options's
10058
* type without updating the caller.)
10060
* The caller must not modify or free the returned value.
10062
* Various kinds of changes can invalidate the returned value: modifying
10063
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10064
* If the returned value is needed for a long time, it is best to make a copy
10065
* of it with ovsdb_datum_clone(). */
10066
const struct ovsdb_datum *
10067
ovsrec_open_vswitch_get_manager_options(const struct ovsrec_open_vswitch *row,
10068
enum ovsdb_atomic_type key_type OVS_UNUSED)
10070
ovs_assert(key_type == OVSDB_TYPE_UUID);
10071
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_manager_options);
10074
/* Returns the next_cfg column's value in 'row' as a struct ovsdb_datum.
10075
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10076
* easier and more efficient way to search for a given key than implementing
10077
* the same operation on the "cooked" form in 'row'.
10079
* 'key_type' must be OVSDB_TYPE_INTEGER.
10080
* (This helps to avoid silent bugs if someone changes next_cfg's
10081
* type without updating the caller.)
10083
* The caller must not modify or free the returned value.
10085
* Various kinds of changes can invalidate the returned value: modifying
10086
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10087
* If the returned value is needed for a long time, it is best to make a copy
10088
* of it with ovsdb_datum_clone(). */
10089
const struct ovsdb_datum *
10090
ovsrec_open_vswitch_get_next_cfg(const struct ovsrec_open_vswitch *row,
10091
enum ovsdb_atomic_type key_type OVS_UNUSED)
10093
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
10094
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_next_cfg);
10097
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
10098
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10099
* easier and more efficient way to search for a given key than implementing
10100
* the same operation on the "cooked" form in 'row'.
10102
* 'key_type' must be OVSDB_TYPE_STRING.
10103
* 'value_type' must be OVSDB_TYPE_STRING.
10104
* (This helps to avoid silent bugs if someone changes other_config's
10105
* type without updating the caller.)
10107
* The caller must not modify or free the returned value.
10109
* Various kinds of changes can invalidate the returned value: modifying
10110
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10111
* If the returned value is needed for a long time, it is best to make a copy
10112
* of it with ovsdb_datum_clone(). */
10113
const struct ovsdb_datum *
10114
ovsrec_open_vswitch_get_other_config(const struct ovsrec_open_vswitch *row,
10115
enum ovsdb_atomic_type key_type OVS_UNUSED,
10116
enum ovsdb_atomic_type value_type OVS_UNUSED)
10118
ovs_assert(key_type == OVSDB_TYPE_STRING);
10119
ovs_assert(value_type == OVSDB_TYPE_STRING);
10120
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_other_config);
10123
/* Returns the ovs_version column's value in 'row' as a struct ovsdb_datum.
10124
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10125
* easier and more efficient way to search for a given key than implementing
10126
* the same operation on the "cooked" form in 'row'.
10128
* 'key_type' must be OVSDB_TYPE_STRING.
10129
* (This helps to avoid silent bugs if someone changes ovs_version's
10130
* type without updating the caller.)
10132
* The caller must not modify or free the returned value.
10134
* Various kinds of changes can invalidate the returned value: modifying
10135
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10136
* If the returned value is needed for a long time, it is best to make a copy
10137
* of it with ovsdb_datum_clone(). */
10138
const struct ovsdb_datum *
10139
ovsrec_open_vswitch_get_ovs_version(const struct ovsrec_open_vswitch *row,
10140
enum ovsdb_atomic_type key_type OVS_UNUSED)
10142
ovs_assert(key_type == OVSDB_TYPE_STRING);
10143
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ovs_version);
10146
/* Returns the ssl column's value in 'row' as a struct ovsdb_datum.
10147
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10148
* easier and more efficient way to search for a given key than implementing
10149
* the same operation on the "cooked" form in 'row'.
10151
* 'key_type' must be OVSDB_TYPE_UUID.
10152
* (This helps to avoid silent bugs if someone changes ssl's
10153
* type without updating the caller.)
10155
* The caller must not modify or free the returned value.
10157
* Various kinds of changes can invalidate the returned value: modifying
10158
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10159
* If the returned value is needed for a long time, it is best to make a copy
10160
* of it with ovsdb_datum_clone(). */
10161
const struct ovsdb_datum *
10162
ovsrec_open_vswitch_get_ssl(const struct ovsrec_open_vswitch *row,
10163
enum ovsdb_atomic_type key_type OVS_UNUSED)
10165
ovs_assert(key_type == OVSDB_TYPE_UUID);
10166
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ssl);
10169
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
10170
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10171
* easier and more efficient way to search for a given key than implementing
10172
* the same operation on the "cooked" form in 'row'.
10174
* 'key_type' must be OVSDB_TYPE_STRING.
10175
* 'value_type' must be OVSDB_TYPE_STRING.
10176
* (This helps to avoid silent bugs if someone changes statistics's
10177
* type without updating the caller.)
10179
* The caller must not modify or free the returned value.
10181
* Various kinds of changes can invalidate the returned value: modifying
10182
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10183
* If the returned value is needed for a long time, it is best to make a copy
10184
* of it with ovsdb_datum_clone(). */
10185
const struct ovsdb_datum *
10186
ovsrec_open_vswitch_get_statistics(const struct ovsrec_open_vswitch *row,
10187
enum ovsdb_atomic_type key_type OVS_UNUSED,
10188
enum ovsdb_atomic_type value_type OVS_UNUSED)
10190
ovs_assert(key_type == OVSDB_TYPE_STRING);
10191
ovs_assert(value_type == OVSDB_TYPE_STRING);
10192
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_statistics);
10195
/* Returns the system_type column's value in 'row' as a struct ovsdb_datum.
10196
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10197
* easier and more efficient way to search for a given key than implementing
10198
* the same operation on the "cooked" form in 'row'.
10200
* 'key_type' must be OVSDB_TYPE_STRING.
10201
* (This helps to avoid silent bugs if someone changes system_type's
10202
* type without updating the caller.)
10204
* The caller must not modify or free the returned value.
10206
* Various kinds of changes can invalidate the returned value: modifying
10207
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10208
* If the returned value is needed for a long time, it is best to make a copy
10209
* of it with ovsdb_datum_clone(). */
10210
const struct ovsdb_datum *
10211
ovsrec_open_vswitch_get_system_type(const struct ovsrec_open_vswitch *row,
10212
enum ovsdb_atomic_type key_type OVS_UNUSED)
10214
ovs_assert(key_type == OVSDB_TYPE_STRING);
10215
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_type);
10218
/* Returns the system_version column's value in 'row' as a struct ovsdb_datum.
10219
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
10220
* easier and more efficient way to search for a given key than implementing
10221
* the same operation on the "cooked" form in 'row'.
10223
* 'key_type' must be OVSDB_TYPE_STRING.
10224
* (This helps to avoid silent bugs if someone changes system_version's
10225
* type without updating the caller.)
10227
* The caller must not modify or free the returned value.
10229
* Various kinds of changes can invalidate the returned value: modifying
10230
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10231
* If the returned value is needed for a long time, it is best to make a copy
10232
* of it with ovsdb_datum_clone(). */
10233
const struct ovsdb_datum *
10234
ovsrec_open_vswitch_get_system_version(const struct ovsrec_open_vswitch *row,
10235
enum ovsdb_atomic_type key_type OVS_UNUSED)
10237
ovs_assert(key_type == OVSDB_TYPE_STRING);
10238
return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_version);
10242
ovsrec_open_vswitch_set_bridges(const struct ovsrec_open_vswitch *row, struct ovsrec_bridge **bridges, size_t n_bridges)
10244
struct ovsdb_datum datum;
10247
ovs_assert(inited);
10248
datum.n = n_bridges;
10249
datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
10250
datum.values = NULL;
10251
for (i = 0; i < n_bridges; i++) {
10252
datum.keys[i].uuid = bridges[i]->header_.uuid;
10254
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
10255
ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_BRIDGES], &datum);
10259
ovsrec_open_vswitch_set_cur_cfg(const struct ovsrec_open_vswitch *row, int64_t cur_cfg)
10261
struct ovsdb_datum datum;
10262
union ovsdb_atom key;
10264
ovs_assert(inited);
10267
key.integer = cur_cfg;
10268
datum.values = NULL;
10269
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_CUR_CFG], &datum);
10273
ovsrec_open_vswitch_set_db_version(const struct ovsrec_open_vswitch *row, const char *db_version)
10275
struct ovsdb_datum datum;
10276
union ovsdb_atom key;
10278
ovs_assert(inited);
10282
key.string = CONST_CAST(char *, db_version);
10287
datum.values = NULL;
10288
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_DB_VERSION], &datum);
10292
ovsrec_open_vswitch_set_external_ids(const struct ovsrec_open_vswitch *row, const struct smap *smap)
10294
struct ovsdb_datum datum;
10296
ovs_assert(inited);
10298
struct smap_node *node;
10301
datum.n = smap_count(smap);
10302
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10303
datum.values = xmalloc(datum.n * sizeof *datum.values);
10306
SMAP_FOR_EACH (node, smap) {
10307
datum.keys[i].string = xstrdup(node->key);
10308
datum.values[i].string = xstrdup(node->value);
10311
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10313
ovsdb_datum_init_empty(&datum);
10315
ovsdb_idl_txn_write(&row->header_,
10316
&ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS],
10322
ovsrec_open_vswitch_set_manager_options(const struct ovsrec_open_vswitch *row, struct ovsrec_manager **manager_options, size_t n_manager_options)
10324
struct ovsdb_datum datum;
10327
ovs_assert(inited);
10328
datum.n = n_manager_options;
10329
datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
10330
datum.values = NULL;
10331
for (i = 0; i < n_manager_options; i++) {
10332
datum.keys[i].uuid = manager_options[i]->header_.uuid;
10334
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
10335
ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_MANAGER_OPTIONS], &datum);
10339
ovsrec_open_vswitch_set_next_cfg(const struct ovsrec_open_vswitch *row, int64_t next_cfg)
10341
struct ovsdb_datum datum;
10342
union ovsdb_atom key;
10344
ovs_assert(inited);
10347
key.integer = next_cfg;
10348
datum.values = NULL;
10349
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_NEXT_CFG], &datum);
10353
ovsrec_open_vswitch_set_other_config(const struct ovsrec_open_vswitch *row, const struct smap *smap)
10355
struct ovsdb_datum datum;
10357
ovs_assert(inited);
10359
struct smap_node *node;
10362
datum.n = smap_count(smap);
10363
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10364
datum.values = xmalloc(datum.n * sizeof *datum.values);
10367
SMAP_FOR_EACH (node, smap) {
10368
datum.keys[i].string = xstrdup(node->key);
10369
datum.values[i].string = xstrdup(node->value);
10372
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10374
ovsdb_datum_init_empty(&datum);
10376
ovsdb_idl_txn_write(&row->header_,
10377
&ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG],
10383
ovsrec_open_vswitch_set_ovs_version(const struct ovsrec_open_vswitch *row, const char *ovs_version)
10385
struct ovsdb_datum datum;
10386
union ovsdb_atom key;
10388
ovs_assert(inited);
10392
key.string = CONST_CAST(char *, ovs_version);
10397
datum.values = NULL;
10398
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OVS_VERSION], &datum);
10402
ovsrec_open_vswitch_set_ssl(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *ssl)
10404
struct ovsdb_datum datum;
10405
union ovsdb_atom key;
10407
ovs_assert(inited);
10411
key.uuid = ssl->header_.uuid;
10416
datum.values = NULL;
10417
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SSL], &datum);
10421
ovsrec_open_vswitch_set_statistics(const struct ovsrec_open_vswitch *row, const struct smap *smap)
10423
struct ovsdb_datum datum;
10425
ovs_assert(inited);
10427
struct smap_node *node;
10430
datum.n = smap_count(smap);
10431
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10432
datum.values = xmalloc(datum.n * sizeof *datum.values);
10435
SMAP_FOR_EACH (node, smap) {
10436
datum.keys[i].string = xstrdup(node->key);
10437
datum.values[i].string = xstrdup(node->value);
10440
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10442
ovsdb_datum_init_empty(&datum);
10444
ovsdb_idl_txn_write(&row->header_,
10445
&ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_STATISTICS],
10451
ovsrec_open_vswitch_set_system_type(const struct ovsrec_open_vswitch *row, const char *system_type)
10453
struct ovsdb_datum datum;
10454
union ovsdb_atom key;
10456
ovs_assert(inited);
10460
key.string = CONST_CAST(char *, system_type);
10465
datum.values = NULL;
10466
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_TYPE], &datum);
10470
ovsrec_open_vswitch_set_system_version(const struct ovsrec_open_vswitch *row, const char *system_version)
10472
struct ovsdb_datum datum;
10473
union ovsdb_atom key;
10475
ovs_assert(inited);
10476
if (system_version) {
10479
key.string = CONST_CAST(char *, system_version);
10484
datum.values = NULL;
10485
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_VERSION], &datum);
10488
struct ovsdb_idl_column ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_N_COLUMNS];
10491
ovsrec_open_vswitch_columns_init(void)
10493
struct ovsdb_idl_column *c;
10495
/* Initialize ovsrec_open_vswitch_col_bridges. */
10496
c = &ovsrec_open_vswitch_col_bridges;
10497
c->name = "bridges";
10498
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
10499
c->type.key.u.uuid.refTableName = "Bridge";
10500
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
10501
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10503
c->type.n_max = UINT_MAX;
10505
c->parse = ovsrec_open_vswitch_parse_bridges;
10506
c->unparse = ovsrec_open_vswitch_unparse_bridges;
10508
/* Initialize ovsrec_open_vswitch_col_cur_cfg. */
10509
c = &ovsrec_open_vswitch_col_cur_cfg;
10510
c->name = "cur_cfg";
10511
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
10512
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10516
c->parse = ovsrec_open_vswitch_parse_cur_cfg;
10517
c->unparse = ovsrec_open_vswitch_unparse_cur_cfg;
10519
/* Initialize ovsrec_open_vswitch_col_db_version. */
10520
c = &ovsrec_open_vswitch_col_db_version;
10521
c->name = "db_version";
10522
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10523
c->type.key.u.string.minLen = 0;
10524
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10528
c->parse = ovsrec_open_vswitch_parse_db_version;
10529
c->unparse = ovsrec_open_vswitch_unparse_db_version;
10531
/* Initialize ovsrec_open_vswitch_col_external_ids. */
10532
c = &ovsrec_open_vswitch_col_external_ids;
10533
c->name = "external_ids";
10534
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10535
c->type.key.u.string.minLen = 0;
10536
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
10537
c->type.value.u.string.minLen = 0;
10539
c->type.n_max = UINT_MAX;
10541
c->parse = ovsrec_open_vswitch_parse_external_ids;
10542
c->unparse = ovsrec_open_vswitch_unparse_external_ids;
10544
/* Initialize ovsrec_open_vswitch_col_manager_options. */
10545
c = &ovsrec_open_vswitch_col_manager_options;
10546
c->name = "manager_options";
10547
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
10548
c->type.key.u.uuid.refTableName = "Manager";
10549
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
10550
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10552
c->type.n_max = UINT_MAX;
10554
c->parse = ovsrec_open_vswitch_parse_manager_options;
10555
c->unparse = ovsrec_open_vswitch_unparse_manager_options;
10557
/* Initialize ovsrec_open_vswitch_col_next_cfg. */
10558
c = &ovsrec_open_vswitch_col_next_cfg;
10559
c->name = "next_cfg";
10560
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
10561
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10565
c->parse = ovsrec_open_vswitch_parse_next_cfg;
10566
c->unparse = ovsrec_open_vswitch_unparse_next_cfg;
10568
/* Initialize ovsrec_open_vswitch_col_other_config. */
10569
c = &ovsrec_open_vswitch_col_other_config;
10570
c->name = "other_config";
10571
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10572
c->type.key.u.string.minLen = 0;
10573
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
10574
c->type.value.u.string.minLen = 0;
10576
c->type.n_max = UINT_MAX;
10578
c->parse = ovsrec_open_vswitch_parse_other_config;
10579
c->unparse = ovsrec_open_vswitch_unparse_other_config;
10581
/* Initialize ovsrec_open_vswitch_col_ovs_version. */
10582
c = &ovsrec_open_vswitch_col_ovs_version;
10583
c->name = "ovs_version";
10584
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10585
c->type.key.u.string.minLen = 0;
10586
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10590
c->parse = ovsrec_open_vswitch_parse_ovs_version;
10591
c->unparse = ovsrec_open_vswitch_unparse_ovs_version;
10593
/* Initialize ovsrec_open_vswitch_col_ssl. */
10594
c = &ovsrec_open_vswitch_col_ssl;
10596
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
10597
c->type.key.u.uuid.refTableName = "SSL";
10598
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
10599
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10603
c->parse = ovsrec_open_vswitch_parse_ssl;
10604
c->unparse = ovsrec_open_vswitch_unparse_ssl;
10606
/* Initialize ovsrec_open_vswitch_col_statistics. */
10607
c = &ovsrec_open_vswitch_col_statistics;
10608
c->name = "statistics";
10609
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10610
c->type.key.u.string.minLen = 0;
10611
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
10612
c->type.value.u.string.minLen = 0;
10614
c->type.n_max = UINT_MAX;
10616
c->parse = ovsrec_open_vswitch_parse_statistics;
10617
c->unparse = ovsrec_open_vswitch_unparse_statistics;
10619
/* Initialize ovsrec_open_vswitch_col_system_type. */
10620
c = &ovsrec_open_vswitch_col_system_type;
10621
c->name = "system_type";
10622
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10623
c->type.key.u.string.minLen = 0;
10624
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10628
c->parse = ovsrec_open_vswitch_parse_system_type;
10629
c->unparse = ovsrec_open_vswitch_unparse_system_type;
10631
/* Initialize ovsrec_open_vswitch_col_system_version. */
10632
c = &ovsrec_open_vswitch_col_system_version;
10633
c->name = "system_version";
10634
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10635
c->type.key.u.string.minLen = 0;
10636
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10640
c->parse = ovsrec_open_vswitch_parse_system_version;
10641
c->unparse = ovsrec_open_vswitch_unparse_system_version;
10647
ovsrec_port_parse_bond_active_slave(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10649
struct ovsrec_port *row = ovsrec_port_cast(row_);
10651
ovs_assert(inited);
10652
if (datum->n >= 1) {
10653
row->bond_active_slave = datum->keys[0].string;
10655
row->bond_active_slave = NULL;
10660
ovsrec_port_parse_bond_downdelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10662
struct ovsrec_port *row = ovsrec_port_cast(row_);
10664
ovs_assert(inited);
10665
if (datum->n >= 1) {
10666
row->bond_downdelay = datum->keys[0].integer;
10668
row->bond_downdelay = 0;
10673
ovsrec_port_parse_bond_fake_iface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10675
struct ovsrec_port *row = ovsrec_port_cast(row_);
10677
ovs_assert(inited);
10678
if (datum->n >= 1) {
10679
row->bond_fake_iface = datum->keys[0].boolean;
10681
row->bond_fake_iface = false;
10686
ovsrec_port_parse_bond_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10688
struct ovsrec_port *row = ovsrec_port_cast(row_);
10690
ovs_assert(inited);
10691
if (datum->n >= 1) {
10692
row->bond_mode = datum->keys[0].string;
10694
row->bond_mode = NULL;
10699
ovsrec_port_parse_bond_updelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10701
struct ovsrec_port *row = ovsrec_port_cast(row_);
10703
ovs_assert(inited);
10704
if (datum->n >= 1) {
10705
row->bond_updelay = datum->keys[0].integer;
10707
row->bond_updelay = 0;
10712
ovsrec_port_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10714
struct ovsrec_port *row = ovsrec_port_cast(row_);
10717
ovs_assert(inited);
10718
smap_init(&row->external_ids);
10719
for (i = 0; i < datum->n; i++) {
10720
smap_add(&row->external_ids,
10721
datum->keys[i].string,
10722
datum->values[i].string);
10727
ovsrec_port_parse_fake_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10729
struct ovsrec_port *row = ovsrec_port_cast(row_);
10731
ovs_assert(inited);
10732
if (datum->n >= 1) {
10733
row->fake_bridge = datum->keys[0].boolean;
10735
row->fake_bridge = false;
10740
ovsrec_port_parse_interfaces(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10742
struct ovsrec_port *row = ovsrec_port_cast(row_);
10745
ovs_assert(inited);
10746
row->interfaces = NULL;
10747
row->n_interfaces = 0;
10748
for (i = 0; i < datum->n; i++) {
10749
struct ovsrec_interface *keyRow = ovsrec_interface_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE], &datum->keys[i].uuid));
10751
if (!row->n_interfaces) {
10752
row->interfaces = xmalloc(datum->n * sizeof *row->interfaces);
10754
row->interfaces[row->n_interfaces] = keyRow;
10755
row->n_interfaces++;
10761
ovsrec_port_parse_lacp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10763
struct ovsrec_port *row = ovsrec_port_cast(row_);
10765
ovs_assert(inited);
10766
if (datum->n >= 1) {
10767
row->lacp = datum->keys[0].string;
10774
ovsrec_port_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10776
struct ovsrec_port *row = ovsrec_port_cast(row_);
10778
ovs_assert(inited);
10779
if (datum->n >= 1) {
10780
row->mac = datum->keys[0].string;
10787
ovsrec_port_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10789
struct ovsrec_port *row = ovsrec_port_cast(row_);
10791
ovs_assert(inited);
10792
if (datum->n >= 1) {
10793
row->name = datum->keys[0].string;
10800
ovsrec_port_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10802
struct ovsrec_port *row = ovsrec_port_cast(row_);
10805
ovs_assert(inited);
10806
smap_init(&row->other_config);
10807
for (i = 0; i < datum->n; i++) {
10808
smap_add(&row->other_config,
10809
datum->keys[i].string,
10810
datum->values[i].string);
10815
ovsrec_port_parse_qos(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10817
struct ovsrec_port *row = ovsrec_port_cast(row_);
10819
ovs_assert(inited);
10820
if (datum->n >= 1) {
10821
row->qos = ovsrec_qos_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_QOS], &datum->keys[0].uuid));
10828
ovsrec_port_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10830
struct ovsrec_port *row = ovsrec_port_cast(row_);
10833
ovs_assert(inited);
10834
row->key_statistics = NULL;
10835
row->value_statistics = NULL;
10836
row->n_statistics = 0;
10837
for (i = 0; i < datum->n; i++) {
10838
if (!row->n_statistics) {
10839
row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
10840
row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
10842
row->key_statistics[row->n_statistics] = datum->keys[i].string;
10843
row->value_statistics[row->n_statistics] = datum->values[i].integer;
10844
row->n_statistics++;
10849
ovsrec_port_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10851
struct ovsrec_port *row = ovsrec_port_cast(row_);
10854
ovs_assert(inited);
10855
smap_init(&row->status);
10856
for (i = 0; i < datum->n; i++) {
10857
smap_add(&row->status,
10858
datum->keys[i].string,
10859
datum->values[i].string);
10864
ovsrec_port_parse_tag(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10866
struct ovsrec_port *row = ovsrec_port_cast(row_);
10867
size_t n = MIN(1, datum->n);
10870
ovs_assert(inited);
10873
for (i = 0; i < n; i++) {
10875
row->tag = xmalloc(n * sizeof *row->tag);
10877
row->tag[row->n_tag] = datum->keys[i].integer;
10883
ovsrec_port_parse_trunks(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10885
struct ovsrec_port *row = ovsrec_port_cast(row_);
10886
size_t n = MIN(4096, datum->n);
10889
ovs_assert(inited);
10890
row->trunks = NULL;
10892
for (i = 0; i < n; i++) {
10893
if (!row->n_trunks) {
10894
row->trunks = xmalloc(n * sizeof *row->trunks);
10896
row->trunks[row->n_trunks] = datum->keys[i].integer;
10902
ovsrec_port_parse_vlan_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10904
struct ovsrec_port *row = ovsrec_port_cast(row_);
10906
ovs_assert(inited);
10907
if (datum->n >= 1) {
10908
row->vlan_mode = datum->keys[0].string;
10910
row->vlan_mode = NULL;
10915
ovsrec_port_unparse_bond_active_slave(struct ovsdb_idl_row *row OVS_UNUSED)
10917
/* Nothing to do. */
10921
ovsrec_port_unparse_bond_downdelay(struct ovsdb_idl_row *row OVS_UNUSED)
10923
/* Nothing to do. */
10927
ovsrec_port_unparse_bond_fake_iface(struct ovsdb_idl_row *row OVS_UNUSED)
10929
/* Nothing to do. */
10933
ovsrec_port_unparse_bond_mode(struct ovsdb_idl_row *row OVS_UNUSED)
10935
/* Nothing to do. */
10939
ovsrec_port_unparse_bond_updelay(struct ovsdb_idl_row *row OVS_UNUSED)
10941
/* Nothing to do. */
10945
ovsrec_port_unparse_external_ids(struct ovsdb_idl_row *row_)
10947
struct ovsrec_port *row = ovsrec_port_cast(row_);
10949
ovs_assert(inited);
10950
smap_destroy(&row->external_ids);
10954
ovsrec_port_unparse_fake_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
10956
/* Nothing to do. */
10960
ovsrec_port_unparse_interfaces(struct ovsdb_idl_row *row_)
10962
struct ovsrec_port *row = ovsrec_port_cast(row_);
10964
ovs_assert(inited);
10965
free(row->interfaces);
10969
ovsrec_port_unparse_lacp(struct ovsdb_idl_row *row OVS_UNUSED)
10971
/* Nothing to do. */
10975
ovsrec_port_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
10977
/* Nothing to do. */
10981
ovsrec_port_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
10983
/* Nothing to do. */
10987
ovsrec_port_unparse_other_config(struct ovsdb_idl_row *row_)
10989
struct ovsrec_port *row = ovsrec_port_cast(row_);
10991
ovs_assert(inited);
10992
smap_destroy(&row->other_config);
10996
ovsrec_port_unparse_qos(struct ovsdb_idl_row *row OVS_UNUSED)
10998
/* Nothing to do. */
11002
ovsrec_port_unparse_statistics(struct ovsdb_idl_row *row_)
11004
struct ovsrec_port *row = ovsrec_port_cast(row_);
11006
ovs_assert(inited);
11007
free(row->key_statistics);
11008
free(row->value_statistics);
11012
ovsrec_port_unparse_status(struct ovsdb_idl_row *row_)
11014
struct ovsrec_port *row = ovsrec_port_cast(row_);
11016
ovs_assert(inited);
11017
smap_destroy(&row->status);
11021
ovsrec_port_unparse_tag(struct ovsdb_idl_row *row_)
11023
struct ovsrec_port *row = ovsrec_port_cast(row_);
11025
ovs_assert(inited);
11030
ovsrec_port_unparse_trunks(struct ovsdb_idl_row *row_)
11032
struct ovsrec_port *row = ovsrec_port_cast(row_);
11034
ovs_assert(inited);
11039
ovsrec_port_unparse_vlan_mode(struct ovsdb_idl_row *row OVS_UNUSED)
11041
/* Nothing to do. */
11045
ovsrec_port_init__(struct ovsdb_idl_row *row)
11047
ovsrec_port_init(ovsrec_port_cast(row));
11051
ovsrec_port_init(struct ovsrec_port *row)
11053
memset(row, 0, sizeof *row);
11054
smap_init(&row->external_ids);
11055
smap_init(&row->other_config);
11056
smap_init(&row->status);
11059
const struct ovsrec_port *
11060
ovsrec_port_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
11062
return ovsrec_port_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_PORT], uuid));
11065
const struct ovsrec_port *
11066
ovsrec_port_first(const struct ovsdb_idl *idl)
11068
return ovsrec_port_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_PORT]));
11071
const struct ovsrec_port *
11072
ovsrec_port_next(const struct ovsrec_port *row)
11074
return ovsrec_port_cast(ovsdb_idl_next_row(&row->header_));
11078
ovsrec_port_delete(const struct ovsrec_port *row)
11080
ovsdb_idl_txn_delete(&row->header_);
11083
struct ovsrec_port *
11084
ovsrec_port_insert(struct ovsdb_idl_txn *txn)
11086
return ovsrec_port_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_PORT], NULL));
11091
ovsrec_port_verify_bond_active_slave(const struct ovsrec_port *row)
11093
ovs_assert(inited);
11094
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_ACTIVE_SLAVE]);
11098
ovsrec_port_verify_bond_downdelay(const struct ovsrec_port *row)
11100
ovs_assert(inited);
11101
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_DOWNDELAY]);
11105
ovsrec_port_verify_bond_fake_iface(const struct ovsrec_port *row)
11107
ovs_assert(inited);
11108
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_FAKE_IFACE]);
11112
ovsrec_port_verify_bond_mode(const struct ovsrec_port *row)
11114
ovs_assert(inited);
11115
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_MODE]);
11119
ovsrec_port_verify_bond_updelay(const struct ovsrec_port *row)
11121
ovs_assert(inited);
11122
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_UPDELAY]);
11126
ovsrec_port_verify_external_ids(const struct ovsrec_port *row)
11128
ovs_assert(inited);
11129
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_EXTERNAL_IDS]);
11133
ovsrec_port_verify_fake_bridge(const struct ovsrec_port *row)
11135
ovs_assert(inited);
11136
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_FAKE_BRIDGE]);
11140
ovsrec_port_verify_interfaces(const struct ovsrec_port *row)
11142
ovs_assert(inited);
11143
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_INTERFACES]);
11147
ovsrec_port_verify_lacp(const struct ovsrec_port *row)
11149
ovs_assert(inited);
11150
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_LACP]);
11154
ovsrec_port_verify_mac(const struct ovsrec_port *row)
11156
ovs_assert(inited);
11157
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_MAC]);
11161
ovsrec_port_verify_name(const struct ovsrec_port *row)
11163
ovs_assert(inited);
11164
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_NAME]);
11168
ovsrec_port_verify_other_config(const struct ovsrec_port *row)
11170
ovs_assert(inited);
11171
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_OTHER_CONFIG]);
11175
ovsrec_port_verify_qos(const struct ovsrec_port *row)
11177
ovs_assert(inited);
11178
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_QOS]);
11182
ovsrec_port_verify_statistics(const struct ovsrec_port *row)
11184
ovs_assert(inited);
11185
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_STATISTICS]);
11189
ovsrec_port_verify_status(const struct ovsrec_port *row)
11191
ovs_assert(inited);
11192
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_STATUS]);
11196
ovsrec_port_verify_tag(const struct ovsrec_port *row)
11198
ovs_assert(inited);
11199
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TAG]);
11203
ovsrec_port_verify_trunks(const struct ovsrec_port *row)
11205
ovs_assert(inited);
11206
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TRUNKS]);
11210
ovsrec_port_verify_vlan_mode(const struct ovsrec_port *row)
11212
ovs_assert(inited);
11213
ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_VLAN_MODE]);
11216
/* Returns the bond_active_slave column's value in 'row' as a struct ovsdb_datum.
11217
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11218
* easier and more efficient way to search for a given key than implementing
11219
* the same operation on the "cooked" form in 'row'.
11221
* 'key_type' must be OVSDB_TYPE_STRING.
11222
* (This helps to avoid silent bugs if someone changes bond_active_slave's
11223
* type without updating the caller.)
11225
* The caller must not modify or free the returned value.
11227
* Various kinds of changes can invalidate the returned value: modifying
11228
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11229
* If the returned value is needed for a long time, it is best to make a copy
11230
* of it with ovsdb_datum_clone(). */
11231
const struct ovsdb_datum *
11232
ovsrec_port_get_bond_active_slave(const struct ovsrec_port *row,
11233
enum ovsdb_atomic_type key_type OVS_UNUSED)
11235
ovs_assert(key_type == OVSDB_TYPE_STRING);
11236
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_active_slave);
11239
/* Returns the bond_downdelay column's value in 'row' as a struct ovsdb_datum.
11240
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11241
* easier and more efficient way to search for a given key than implementing
11242
* the same operation on the "cooked" form in 'row'.
11244
* 'key_type' must be OVSDB_TYPE_INTEGER.
11245
* (This helps to avoid silent bugs if someone changes bond_downdelay's
11246
* type without updating the caller.)
11248
* The caller must not modify or free the returned value.
11250
* Various kinds of changes can invalidate the returned value: modifying
11251
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11252
* If the returned value is needed for a long time, it is best to make a copy
11253
* of it with ovsdb_datum_clone(). */
11254
const struct ovsdb_datum *
11255
ovsrec_port_get_bond_downdelay(const struct ovsrec_port *row,
11256
enum ovsdb_atomic_type key_type OVS_UNUSED)
11258
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11259
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_downdelay);
11262
/* Returns the bond_fake_iface column's value in 'row' as a struct ovsdb_datum.
11263
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11264
* easier and more efficient way to search for a given key than implementing
11265
* the same operation on the "cooked" form in 'row'.
11267
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
11268
* (This helps to avoid silent bugs if someone changes bond_fake_iface's
11269
* type without updating the caller.)
11271
* The caller must not modify or free the returned value.
11273
* Various kinds of changes can invalidate the returned value: modifying
11274
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11275
* If the returned value is needed for a long time, it is best to make a copy
11276
* of it with ovsdb_datum_clone(). */
11277
const struct ovsdb_datum *
11278
ovsrec_port_get_bond_fake_iface(const struct ovsrec_port *row,
11279
enum ovsdb_atomic_type key_type OVS_UNUSED)
11281
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
11282
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_fake_iface);
11285
/* Returns the bond_mode column's value in 'row' as a struct ovsdb_datum.
11286
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11287
* easier and more efficient way to search for a given key than implementing
11288
* the same operation on the "cooked" form in 'row'.
11290
* 'key_type' must be OVSDB_TYPE_STRING.
11291
* (This helps to avoid silent bugs if someone changes bond_mode's
11292
* type without updating the caller.)
11294
* The caller must not modify or free the returned value.
11296
* Various kinds of changes can invalidate the returned value: modifying
11297
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11298
* If the returned value is needed for a long time, it is best to make a copy
11299
* of it with ovsdb_datum_clone(). */
11300
const struct ovsdb_datum *
11301
ovsrec_port_get_bond_mode(const struct ovsrec_port *row,
11302
enum ovsdb_atomic_type key_type OVS_UNUSED)
11304
ovs_assert(key_type == OVSDB_TYPE_STRING);
11305
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_mode);
11308
/* Returns the bond_updelay column's value in 'row' as a struct ovsdb_datum.
11309
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11310
* easier and more efficient way to search for a given key than implementing
11311
* the same operation on the "cooked" form in 'row'.
11313
* 'key_type' must be OVSDB_TYPE_INTEGER.
11314
* (This helps to avoid silent bugs if someone changes bond_updelay's
11315
* type without updating the caller.)
11317
* The caller must not modify or free the returned value.
11319
* Various kinds of changes can invalidate the returned value: modifying
11320
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11321
* If the returned value is needed for a long time, it is best to make a copy
11322
* of it with ovsdb_datum_clone(). */
11323
const struct ovsdb_datum *
11324
ovsrec_port_get_bond_updelay(const struct ovsrec_port *row,
11325
enum ovsdb_atomic_type key_type OVS_UNUSED)
11327
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11328
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_updelay);
11331
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
11332
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11333
* easier and more efficient way to search for a given key than implementing
11334
* the same operation on the "cooked" form in 'row'.
11336
* 'key_type' must be OVSDB_TYPE_STRING.
11337
* 'value_type' must be OVSDB_TYPE_STRING.
11338
* (This helps to avoid silent bugs if someone changes external_ids's
11339
* type without updating the caller.)
11341
* The caller must not modify or free the returned value.
11343
* Various kinds of changes can invalidate the returned value: modifying
11344
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11345
* If the returned value is needed for a long time, it is best to make a copy
11346
* of it with ovsdb_datum_clone(). */
11347
const struct ovsdb_datum *
11348
ovsrec_port_get_external_ids(const struct ovsrec_port *row,
11349
enum ovsdb_atomic_type key_type OVS_UNUSED,
11350
enum ovsdb_atomic_type value_type OVS_UNUSED)
11352
ovs_assert(key_type == OVSDB_TYPE_STRING);
11353
ovs_assert(value_type == OVSDB_TYPE_STRING);
11354
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_external_ids);
11357
/* Returns the fake_bridge column's value in 'row' as a struct ovsdb_datum.
11358
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11359
* easier and more efficient way to search for a given key than implementing
11360
* the same operation on the "cooked" form in 'row'.
11362
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
11363
* (This helps to avoid silent bugs if someone changes fake_bridge's
11364
* type without updating the caller.)
11366
* The caller must not modify or free the returned value.
11368
* Various kinds of changes can invalidate the returned value: modifying
11369
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11370
* If the returned value is needed for a long time, it is best to make a copy
11371
* of it with ovsdb_datum_clone(). */
11372
const struct ovsdb_datum *
11373
ovsrec_port_get_fake_bridge(const struct ovsrec_port *row,
11374
enum ovsdb_atomic_type key_type OVS_UNUSED)
11376
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
11377
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_fake_bridge);
11380
/* Returns the interfaces column's value in 'row' as a struct ovsdb_datum.
11381
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11382
* easier and more efficient way to search for a given key than implementing
11383
* the same operation on the "cooked" form in 'row'.
11385
* 'key_type' must be OVSDB_TYPE_UUID.
11386
* (This helps to avoid silent bugs if someone changes interfaces's
11387
* type without updating the caller.)
11389
* The caller must not modify or free the returned value.
11391
* Various kinds of changes can invalidate the returned value: modifying
11392
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11393
* If the returned value is needed for a long time, it is best to make a copy
11394
* of it with ovsdb_datum_clone(). */
11395
const struct ovsdb_datum *
11396
ovsrec_port_get_interfaces(const struct ovsrec_port *row,
11397
enum ovsdb_atomic_type key_type OVS_UNUSED)
11399
ovs_assert(key_type == OVSDB_TYPE_UUID);
11400
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_interfaces);
11403
/* Returns the lacp column's value in 'row' as a struct ovsdb_datum.
11404
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11405
* easier and more efficient way to search for a given key than implementing
11406
* the same operation on the "cooked" form in 'row'.
11408
* 'key_type' must be OVSDB_TYPE_STRING.
11409
* (This helps to avoid silent bugs if someone changes lacp's
11410
* type without updating the caller.)
11412
* The caller must not modify or free the returned value.
11414
* Various kinds of changes can invalidate the returned value: modifying
11415
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11416
* If the returned value is needed for a long time, it is best to make a copy
11417
* of it with ovsdb_datum_clone(). */
11418
const struct ovsdb_datum *
11419
ovsrec_port_get_lacp(const struct ovsrec_port *row,
11420
enum ovsdb_atomic_type key_type OVS_UNUSED)
11422
ovs_assert(key_type == OVSDB_TYPE_STRING);
11423
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_lacp);
11426
/* Returns the mac column's value in 'row' as a struct ovsdb_datum.
11427
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11428
* easier and more efficient way to search for a given key than implementing
11429
* the same operation on the "cooked" form in 'row'.
11431
* 'key_type' must be OVSDB_TYPE_STRING.
11432
* (This helps to avoid silent bugs if someone changes mac's
11433
* type without updating the caller.)
11435
* The caller must not modify or free the returned value.
11437
* Various kinds of changes can invalidate the returned value: modifying
11438
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11439
* If the returned value is needed for a long time, it is best to make a copy
11440
* of it with ovsdb_datum_clone(). */
11441
const struct ovsdb_datum *
11442
ovsrec_port_get_mac(const struct ovsrec_port *row,
11443
enum ovsdb_atomic_type key_type OVS_UNUSED)
11445
ovs_assert(key_type == OVSDB_TYPE_STRING);
11446
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_mac);
11449
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
11450
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11451
* easier and more efficient way to search for a given key than implementing
11452
* the same operation on the "cooked" form in 'row'.
11454
* 'key_type' must be OVSDB_TYPE_STRING.
11455
* (This helps to avoid silent bugs if someone changes name's
11456
* type without updating the caller.)
11458
* The caller must not modify or free the returned value.
11460
* Various kinds of changes can invalidate the returned value: modifying
11461
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11462
* If the returned value is needed for a long time, it is best to make a copy
11463
* of it with ovsdb_datum_clone(). */
11464
const struct ovsdb_datum *
11465
ovsrec_port_get_name(const struct ovsrec_port *row,
11466
enum ovsdb_atomic_type key_type OVS_UNUSED)
11468
ovs_assert(key_type == OVSDB_TYPE_STRING);
11469
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_name);
11472
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
11473
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11474
* easier and more efficient way to search for a given key than implementing
11475
* the same operation on the "cooked" form in 'row'.
11477
* 'key_type' must be OVSDB_TYPE_STRING.
11478
* 'value_type' must be OVSDB_TYPE_STRING.
11479
* (This helps to avoid silent bugs if someone changes other_config's
11480
* type without updating the caller.)
11482
* The caller must not modify or free the returned value.
11484
* Various kinds of changes can invalidate the returned value: modifying
11485
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11486
* If the returned value is needed for a long time, it is best to make a copy
11487
* of it with ovsdb_datum_clone(). */
11488
const struct ovsdb_datum *
11489
ovsrec_port_get_other_config(const struct ovsrec_port *row,
11490
enum ovsdb_atomic_type key_type OVS_UNUSED,
11491
enum ovsdb_atomic_type value_type OVS_UNUSED)
11493
ovs_assert(key_type == OVSDB_TYPE_STRING);
11494
ovs_assert(value_type == OVSDB_TYPE_STRING);
11495
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_other_config);
11498
/* Returns the qos column's value in 'row' as a struct ovsdb_datum.
11499
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11500
* easier and more efficient way to search for a given key than implementing
11501
* the same operation on the "cooked" form in 'row'.
11503
* 'key_type' must be OVSDB_TYPE_UUID.
11504
* (This helps to avoid silent bugs if someone changes qos's
11505
* type without updating the caller.)
11507
* The caller must not modify or free the returned value.
11509
* Various kinds of changes can invalidate the returned value: modifying
11510
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11511
* If the returned value is needed for a long time, it is best to make a copy
11512
* of it with ovsdb_datum_clone(). */
11513
const struct ovsdb_datum *
11514
ovsrec_port_get_qos(const struct ovsrec_port *row,
11515
enum ovsdb_atomic_type key_type OVS_UNUSED)
11517
ovs_assert(key_type == OVSDB_TYPE_UUID);
11518
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_qos);
11521
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
11522
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11523
* easier and more efficient way to search for a given key than implementing
11524
* the same operation on the "cooked" form in 'row'.
11526
* 'key_type' must be OVSDB_TYPE_STRING.
11527
* 'value_type' must be OVSDB_TYPE_INTEGER.
11528
* (This helps to avoid silent bugs if someone changes statistics's
11529
* type without updating the caller.)
11531
* The caller must not modify or free the returned value.
11533
* Various kinds of changes can invalidate the returned value: modifying
11534
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11535
* If the returned value is needed for a long time, it is best to make a copy
11536
* of it with ovsdb_datum_clone(). */
11537
const struct ovsdb_datum *
11538
ovsrec_port_get_statistics(const struct ovsrec_port *row,
11539
enum ovsdb_atomic_type key_type OVS_UNUSED,
11540
enum ovsdb_atomic_type value_type OVS_UNUSED)
11542
ovs_assert(key_type == OVSDB_TYPE_STRING);
11543
ovs_assert(value_type == OVSDB_TYPE_INTEGER);
11544
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_statistics);
11547
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
11548
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11549
* easier and more efficient way to search for a given key than implementing
11550
* the same operation on the "cooked" form in 'row'.
11552
* 'key_type' must be OVSDB_TYPE_STRING.
11553
* 'value_type' must be OVSDB_TYPE_STRING.
11554
* (This helps to avoid silent bugs if someone changes status's
11555
* type without updating the caller.)
11557
* The caller must not modify or free the returned value.
11559
* Various kinds of changes can invalidate the returned value: modifying
11560
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11561
* If the returned value is needed for a long time, it is best to make a copy
11562
* of it with ovsdb_datum_clone(). */
11563
const struct ovsdb_datum *
11564
ovsrec_port_get_status(const struct ovsrec_port *row,
11565
enum ovsdb_atomic_type key_type OVS_UNUSED,
11566
enum ovsdb_atomic_type value_type OVS_UNUSED)
11568
ovs_assert(key_type == OVSDB_TYPE_STRING);
11569
ovs_assert(value_type == OVSDB_TYPE_STRING);
11570
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_status);
11573
/* Returns the tag column's value in 'row' as a struct ovsdb_datum.
11574
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11575
* easier and more efficient way to search for a given key than implementing
11576
* the same operation on the "cooked" form in 'row'.
11578
* 'key_type' must be OVSDB_TYPE_INTEGER.
11579
* (This helps to avoid silent bugs if someone changes tag's
11580
* type without updating the caller.)
11582
* The caller must not modify or free the returned value.
11584
* Various kinds of changes can invalidate the returned value: modifying
11585
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11586
* If the returned value is needed for a long time, it is best to make a copy
11587
* of it with ovsdb_datum_clone(). */
11588
const struct ovsdb_datum *
11589
ovsrec_port_get_tag(const struct ovsrec_port *row,
11590
enum ovsdb_atomic_type key_type OVS_UNUSED)
11592
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11593
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_tag);
11596
/* Returns the trunks column's value in 'row' as a struct ovsdb_datum.
11597
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11598
* easier and more efficient way to search for a given key than implementing
11599
* the same operation on the "cooked" form in 'row'.
11601
* 'key_type' must be OVSDB_TYPE_INTEGER.
11602
* (This helps to avoid silent bugs if someone changes trunks's
11603
* type without updating the caller.)
11605
* The caller must not modify or free the returned value.
11607
* Various kinds of changes can invalidate the returned value: modifying
11608
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11609
* If the returned value is needed for a long time, it is best to make a copy
11610
* of it with ovsdb_datum_clone(). */
11611
const struct ovsdb_datum *
11612
ovsrec_port_get_trunks(const struct ovsrec_port *row,
11613
enum ovsdb_atomic_type key_type OVS_UNUSED)
11615
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11616
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_trunks);
11619
/* Returns the vlan_mode column's value in 'row' as a struct ovsdb_datum.
11620
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
11621
* easier and more efficient way to search for a given key than implementing
11622
* the same operation on the "cooked" form in 'row'.
11624
* 'key_type' must be OVSDB_TYPE_STRING.
11625
* (This helps to avoid silent bugs if someone changes vlan_mode's
11626
* type without updating the caller.)
11628
* The caller must not modify or free the returned value.
11630
* Various kinds of changes can invalidate the returned value: modifying
11631
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11632
* If the returned value is needed for a long time, it is best to make a copy
11633
* of it with ovsdb_datum_clone(). */
11634
const struct ovsdb_datum *
11635
ovsrec_port_get_vlan_mode(const struct ovsrec_port *row,
11636
enum ovsdb_atomic_type key_type OVS_UNUSED)
11638
ovs_assert(key_type == OVSDB_TYPE_STRING);
11639
return ovsdb_idl_read(&row->header_, &ovsrec_port_col_vlan_mode);
11643
ovsrec_port_set_bond_active_slave(const struct ovsrec_port *row, const char *bond_active_slave)
11645
struct ovsdb_datum datum;
11646
union ovsdb_atom key;
11648
ovs_assert(inited);
11649
if (bond_active_slave) {
11652
key.string = CONST_CAST(char *, bond_active_slave);
11657
datum.values = NULL;
11658
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_ACTIVE_SLAVE], &datum);
11662
ovsrec_port_set_bond_downdelay(const struct ovsrec_port *row, int64_t bond_downdelay)
11664
struct ovsdb_datum datum;
11665
union ovsdb_atom key;
11667
ovs_assert(inited);
11670
key.integer = bond_downdelay;
11671
datum.values = NULL;
11672
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_DOWNDELAY], &datum);
11676
ovsrec_port_set_bond_fake_iface(const struct ovsrec_port *row, bool bond_fake_iface)
11678
struct ovsdb_datum datum;
11679
union ovsdb_atom key;
11681
ovs_assert(inited);
11684
key.boolean = bond_fake_iface;
11685
datum.values = NULL;
11686
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_FAKE_IFACE], &datum);
11690
ovsrec_port_set_bond_mode(const struct ovsrec_port *row, const char *bond_mode)
11692
struct ovsdb_datum datum;
11693
union ovsdb_atom key;
11695
ovs_assert(inited);
11699
key.string = CONST_CAST(char *, bond_mode);
11704
datum.values = NULL;
11705
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_MODE], &datum);
11709
ovsrec_port_set_bond_updelay(const struct ovsrec_port *row, int64_t bond_updelay)
11711
struct ovsdb_datum datum;
11712
union ovsdb_atom key;
11714
ovs_assert(inited);
11717
key.integer = bond_updelay;
11718
datum.values = NULL;
11719
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_UPDELAY], &datum);
11723
ovsrec_port_set_external_ids(const struct ovsrec_port *row, const struct smap *smap)
11725
struct ovsdb_datum datum;
11727
ovs_assert(inited);
11729
struct smap_node *node;
11732
datum.n = smap_count(smap);
11733
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11734
datum.values = xmalloc(datum.n * sizeof *datum.values);
11737
SMAP_FOR_EACH (node, smap) {
11738
datum.keys[i].string = xstrdup(node->key);
11739
datum.values[i].string = xstrdup(node->value);
11742
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11744
ovsdb_datum_init_empty(&datum);
11746
ovsdb_idl_txn_write(&row->header_,
11747
&ovsrec_port_columns[OVSREC_PORT_COL_EXTERNAL_IDS],
11753
ovsrec_port_set_fake_bridge(const struct ovsrec_port *row, bool fake_bridge)
11755
struct ovsdb_datum datum;
11756
union ovsdb_atom key;
11758
ovs_assert(inited);
11761
key.boolean = fake_bridge;
11762
datum.values = NULL;
11763
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_FAKE_BRIDGE], &datum);
11767
ovsrec_port_set_interfaces(const struct ovsrec_port *row, struct ovsrec_interface **interfaces, size_t n_interfaces)
11769
struct ovsdb_datum datum;
11772
ovs_assert(inited);
11773
datum.n = n_interfaces;
11774
datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
11775
datum.values = NULL;
11776
for (i = 0; i < n_interfaces; i++) {
11777
datum.keys[i].uuid = interfaces[i]->header_.uuid;
11779
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
11780
ovsdb_idl_txn_write(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_INTERFACES], &datum);
11784
ovsrec_port_set_lacp(const struct ovsrec_port *row, const char *lacp)
11786
struct ovsdb_datum datum;
11787
union ovsdb_atom key;
11789
ovs_assert(inited);
11793
key.string = CONST_CAST(char *, lacp);
11798
datum.values = NULL;
11799
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_LACP], &datum);
11803
ovsrec_port_set_mac(const struct ovsrec_port *row, const char *mac)
11805
struct ovsdb_datum datum;
11806
union ovsdb_atom key;
11808
ovs_assert(inited);
11812
key.string = CONST_CAST(char *, mac);
11817
datum.values = NULL;
11818
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_MAC], &datum);
11822
ovsrec_port_set_name(const struct ovsrec_port *row, const char *name)
11824
struct ovsdb_datum datum;
11825
union ovsdb_atom key;
11827
ovs_assert(inited);
11830
key.string = CONST_CAST(char *, name);
11831
datum.values = NULL;
11832
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_NAME], &datum);
11836
ovsrec_port_set_other_config(const struct ovsrec_port *row, const struct smap *smap)
11838
struct ovsdb_datum datum;
11840
ovs_assert(inited);
11842
struct smap_node *node;
11845
datum.n = smap_count(smap);
11846
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11847
datum.values = xmalloc(datum.n * sizeof *datum.values);
11850
SMAP_FOR_EACH (node, smap) {
11851
datum.keys[i].string = xstrdup(node->key);
11852
datum.values[i].string = xstrdup(node->value);
11855
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11857
ovsdb_datum_init_empty(&datum);
11859
ovsdb_idl_txn_write(&row->header_,
11860
&ovsrec_port_columns[OVSREC_PORT_COL_OTHER_CONFIG],
11866
ovsrec_port_set_qos(const struct ovsrec_port *row, const struct ovsrec_qos *qos)
11868
struct ovsdb_datum datum;
11869
union ovsdb_atom key;
11871
ovs_assert(inited);
11875
key.uuid = qos->header_.uuid;
11880
datum.values = NULL;
11881
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_QOS], &datum);
11885
ovsrec_port_set_statistics(const struct ovsrec_port *row, char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
11887
struct ovsdb_datum datum;
11890
ovs_assert(inited);
11891
datum.n = n_statistics;
11892
datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
11893
datum.values = xmalloc(n_statistics * sizeof *datum.values);
11894
for (i = 0; i < n_statistics; i++) {
11895
datum.keys[i].string = xstrdup(key_statistics[i]);
11896
datum.values[i].integer = value_statistics[i];
11898
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_INTEGER);
11899
ovsdb_idl_txn_write(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_STATISTICS], &datum);
11903
ovsrec_port_set_status(const struct ovsrec_port *row, const struct smap *smap)
11905
struct ovsdb_datum datum;
11907
ovs_assert(inited);
11909
struct smap_node *node;
11912
datum.n = smap_count(smap);
11913
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11914
datum.values = xmalloc(datum.n * sizeof *datum.values);
11917
SMAP_FOR_EACH (node, smap) {
11918
datum.keys[i].string = xstrdup(node->key);
11919
datum.values[i].string = xstrdup(node->value);
11922
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11924
ovsdb_datum_init_empty(&datum);
11926
ovsdb_idl_txn_write(&row->header_,
11927
&ovsrec_port_columns[OVSREC_PORT_COL_STATUS],
11933
ovsrec_port_set_tag(const struct ovsrec_port *row, const int64_t *tag, size_t n_tag)
11935
struct ovsdb_datum datum;
11936
union ovsdb_atom key;
11938
ovs_assert(inited);
11942
key.integer = *tag;
11947
datum.values = NULL;
11948
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TAG], &datum);
11952
ovsrec_port_set_trunks(const struct ovsrec_port *row, const int64_t *trunks, size_t n_trunks)
11954
struct ovsdb_datum datum;
11957
ovs_assert(inited);
11958
datum.n = n_trunks;
11959
datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
11960
datum.values = NULL;
11961
for (i = 0; i < n_trunks; i++) {
11962
datum.keys[i].integer = trunks[i];
11964
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
11965
ovsdb_idl_txn_write(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TRUNKS], &datum);
11969
ovsrec_port_set_vlan_mode(const struct ovsrec_port *row, const char *vlan_mode)
11971
struct ovsdb_datum datum;
11972
union ovsdb_atom key;
11974
ovs_assert(inited);
11978
key.string = CONST_CAST(char *, vlan_mode);
11983
datum.values = NULL;
11984
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_VLAN_MODE], &datum);
11987
struct ovsdb_idl_column ovsrec_port_columns[OVSREC_PORT_N_COLUMNS];
11990
ovsrec_port_columns_init(void)
11992
struct ovsdb_idl_column *c;
11994
/* Initialize ovsrec_port_col_bond_active_slave. */
11995
c = &ovsrec_port_col_bond_active_slave;
11996
c->name = "bond_active_slave";
11997
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
11998
c->type.key.u.string.minLen = 0;
11999
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12003
c->parse = ovsrec_port_parse_bond_active_slave;
12004
c->unparse = ovsrec_port_unparse_bond_active_slave;
12006
/* Initialize ovsrec_port_col_bond_downdelay. */
12007
c = &ovsrec_port_col_bond_downdelay;
12008
c->name = "bond_downdelay";
12009
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12010
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12014
c->parse = ovsrec_port_parse_bond_downdelay;
12015
c->unparse = ovsrec_port_unparse_bond_downdelay;
12017
/* Initialize ovsrec_port_col_bond_fake_iface. */
12018
c = &ovsrec_port_col_bond_fake_iface;
12019
c->name = "bond_fake_iface";
12020
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
12021
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12025
c->parse = ovsrec_port_parse_bond_fake_iface;
12026
c->unparse = ovsrec_port_unparse_bond_fake_iface;
12028
/* Initialize ovsrec_port_col_bond_mode. */
12029
c = &ovsrec_port_col_bond_mode;
12030
c->name = "bond_mode";
12031
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12032
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
12033
c->type.key.enum_->n = 3;
12034
c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
12035
c->type.key.enum_->keys[0].string = xstrdup("active-backup");
12036
c->type.key.enum_->keys[1].string = xstrdup("balance-slb");
12037
c->type.key.enum_->keys[2].string = xstrdup("balance-tcp");
12038
c->type.key.enum_->values = NULL;
12039
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
12040
c->type.key.u.string.minLen = 0;
12041
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12045
c->parse = ovsrec_port_parse_bond_mode;
12046
c->unparse = ovsrec_port_unparse_bond_mode;
12048
/* Initialize ovsrec_port_col_bond_updelay. */
12049
c = &ovsrec_port_col_bond_updelay;
12050
c->name = "bond_updelay";
12051
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12052
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12056
c->parse = ovsrec_port_parse_bond_updelay;
12057
c->unparse = ovsrec_port_unparse_bond_updelay;
12059
/* Initialize ovsrec_port_col_external_ids. */
12060
c = &ovsrec_port_col_external_ids;
12061
c->name = "external_ids";
12062
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12063
c->type.key.u.string.minLen = 0;
12064
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12065
c->type.value.u.string.minLen = 0;
12067
c->type.n_max = UINT_MAX;
12069
c->parse = ovsrec_port_parse_external_ids;
12070
c->unparse = ovsrec_port_unparse_external_ids;
12072
/* Initialize ovsrec_port_col_fake_bridge. */
12073
c = &ovsrec_port_col_fake_bridge;
12074
c->name = "fake_bridge";
12075
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
12076
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12080
c->parse = ovsrec_port_parse_fake_bridge;
12081
c->unparse = ovsrec_port_unparse_fake_bridge;
12083
/* Initialize ovsrec_port_col_interfaces. */
12084
c = &ovsrec_port_col_interfaces;
12085
c->name = "interfaces";
12086
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
12087
c->type.key.u.uuid.refTableName = "Interface";
12088
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
12089
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12091
c->type.n_max = UINT_MAX;
12093
c->parse = ovsrec_port_parse_interfaces;
12094
c->unparse = ovsrec_port_unparse_interfaces;
12096
/* Initialize ovsrec_port_col_lacp. */
12097
c = &ovsrec_port_col_lacp;
12099
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12100
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
12101
c->type.key.enum_->n = 3;
12102
c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
12103
c->type.key.enum_->keys[0].string = xstrdup("active");
12104
c->type.key.enum_->keys[1].string = xstrdup("off");
12105
c->type.key.enum_->keys[2].string = xstrdup("passive");
12106
c->type.key.enum_->values = NULL;
12107
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
12108
c->type.key.u.string.minLen = 0;
12109
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12113
c->parse = ovsrec_port_parse_lacp;
12114
c->unparse = ovsrec_port_unparse_lacp;
12116
/* Initialize ovsrec_port_col_mac. */
12117
c = &ovsrec_port_col_mac;
12119
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12120
c->type.key.u.string.minLen = 0;
12121
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12125
c->parse = ovsrec_port_parse_mac;
12126
c->unparse = ovsrec_port_unparse_mac;
12128
/* Initialize ovsrec_port_col_name. */
12129
c = &ovsrec_port_col_name;
12131
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12132
c->type.key.u.string.minLen = 0;
12133
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12136
c->mutable = false;
12137
c->parse = ovsrec_port_parse_name;
12138
c->unparse = ovsrec_port_unparse_name;
12140
/* Initialize ovsrec_port_col_other_config. */
12141
c = &ovsrec_port_col_other_config;
12142
c->name = "other_config";
12143
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12144
c->type.key.u.string.minLen = 0;
12145
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12146
c->type.value.u.string.minLen = 0;
12148
c->type.n_max = UINT_MAX;
12150
c->parse = ovsrec_port_parse_other_config;
12151
c->unparse = ovsrec_port_unparse_other_config;
12153
/* Initialize ovsrec_port_col_qos. */
12154
c = &ovsrec_port_col_qos;
12156
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
12157
c->type.key.u.uuid.refTableName = "QoS";
12158
c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
12159
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12163
c->parse = ovsrec_port_parse_qos;
12164
c->unparse = ovsrec_port_unparse_qos;
12166
/* Initialize ovsrec_port_col_statistics. */
12167
c = &ovsrec_port_col_statistics;
12168
c->name = "statistics";
12169
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12170
c->type.key.u.string.minLen = 0;
12171
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_INTEGER);
12173
c->type.n_max = UINT_MAX;
12175
c->parse = ovsrec_port_parse_statistics;
12176
c->unparse = ovsrec_port_unparse_statistics;
12178
/* Initialize ovsrec_port_col_status. */
12179
c = &ovsrec_port_col_status;
12180
c->name = "status";
12181
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12182
c->type.key.u.string.minLen = 0;
12183
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12184
c->type.value.u.string.minLen = 0;
12186
c->type.n_max = UINT_MAX;
12188
c->parse = ovsrec_port_parse_status;
12189
c->unparse = ovsrec_port_unparse_status;
12191
/* Initialize ovsrec_port_col_tag. */
12192
c = &ovsrec_port_col_tag;
12194
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12195
c->type.key.u.integer.min = INT64_C(0);
12196
c->type.key.u.integer.max = INT64_C(4095);
12197
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12201
c->parse = ovsrec_port_parse_tag;
12202
c->unparse = ovsrec_port_unparse_tag;
12204
/* Initialize ovsrec_port_col_trunks. */
12205
c = &ovsrec_port_col_trunks;
12206
c->name = "trunks";
12207
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12208
c->type.key.u.integer.min = INT64_C(0);
12209
c->type.key.u.integer.max = INT64_C(4095);
12210
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12212
c->type.n_max = 4096;
12214
c->parse = ovsrec_port_parse_trunks;
12215
c->unparse = ovsrec_port_unparse_trunks;
12217
/* Initialize ovsrec_port_col_vlan_mode. */
12218
c = &ovsrec_port_col_vlan_mode;
12219
c->name = "vlan_mode";
12220
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12221
c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
12222
c->type.key.enum_->n = 4;
12223
c->type.key.enum_->keys = xmalloc(4 * sizeof *c->type.key.enum_->keys);
12224
c->type.key.enum_->keys[0].string = xstrdup("access");
12225
c->type.key.enum_->keys[1].string = xstrdup("native-tagged");
12226
c->type.key.enum_->keys[2].string = xstrdup("native-untagged");
12227
c->type.key.enum_->keys[3].string = xstrdup("trunk");
12228
c->type.key.enum_->values = NULL;
12229
ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
12230
c->type.key.u.string.minLen = 0;
12231
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12235
c->parse = ovsrec_port_parse_vlan_mode;
12236
c->unparse = ovsrec_port_unparse_vlan_mode;
12242
ovsrec_qos_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12244
struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12247
ovs_assert(inited);
12248
smap_init(&row->external_ids);
12249
for (i = 0; i < datum->n; i++) {
12250
smap_add(&row->external_ids,
12251
datum->keys[i].string,
12252
datum->values[i].string);
12257
ovsrec_qos_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12259
struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12262
ovs_assert(inited);
12263
smap_init(&row->other_config);
12264
for (i = 0; i < datum->n; i++) {
12265
smap_add(&row->other_config,
12266
datum->keys[i].string,
12267
datum->values[i].string);
12272
ovsrec_qos_parse_queues(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12274
struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12277
ovs_assert(inited);
12278
row->key_queues = NULL;
12279
row->value_queues = NULL;
12281
for (i = 0; i < datum->n; i++) {
12282
struct ovsrec_queue *valueRow = ovsrec_queue_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_QUEUE], &datum->values[i].uuid));
12284
if (!row->n_queues) {
12285
row->key_queues = xmalloc(datum->n * sizeof *row->key_queues);
12286
row->value_queues = xmalloc(datum->n * sizeof *row->value_queues);
12288
row->key_queues[row->n_queues] = datum->keys[i].integer;
12289
row->value_queues[row->n_queues] = valueRow;
12296
ovsrec_qos_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12298
struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12300
ovs_assert(inited);
12301
if (datum->n >= 1) {
12302
row->type = datum->keys[0].string;
12309
ovsrec_qos_unparse_external_ids(struct ovsdb_idl_row *row_)
12311
struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12313
ovs_assert(inited);
12314
smap_destroy(&row->external_ids);
12318
ovsrec_qos_unparse_other_config(struct ovsdb_idl_row *row_)
12320
struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12322
ovs_assert(inited);
12323
smap_destroy(&row->other_config);
12327
ovsrec_qos_unparse_queues(struct ovsdb_idl_row *row_)
12329
struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12331
ovs_assert(inited);
12332
free(row->key_queues);
12333
free(row->value_queues);
12337
ovsrec_qos_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
12339
/* Nothing to do. */
12343
ovsrec_qos_init__(struct ovsdb_idl_row *row)
12345
ovsrec_qos_init(ovsrec_qos_cast(row));
12349
ovsrec_qos_init(struct ovsrec_qos *row)
12351
memset(row, 0, sizeof *row);
12352
smap_init(&row->external_ids);
12353
smap_init(&row->other_config);
12356
const struct ovsrec_qos *
12357
ovsrec_qos_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
12359
return ovsrec_qos_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_QOS], uuid));
12362
const struct ovsrec_qos *
12363
ovsrec_qos_first(const struct ovsdb_idl *idl)
12365
return ovsrec_qos_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_QOS]));
12368
const struct ovsrec_qos *
12369
ovsrec_qos_next(const struct ovsrec_qos *row)
12371
return ovsrec_qos_cast(ovsdb_idl_next_row(&row->header_));
12375
ovsrec_qos_delete(const struct ovsrec_qos *row)
12377
ovsdb_idl_txn_delete(&row->header_);
12380
struct ovsrec_qos *
12381
ovsrec_qos_insert(struct ovsdb_idl_txn *txn)
12383
return ovsrec_qos_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_QOS], NULL));
12388
ovsrec_qos_verify_external_ids(const struct ovsrec_qos *row)
12390
ovs_assert(inited);
12391
ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_EXTERNAL_IDS]);
12395
ovsrec_qos_verify_other_config(const struct ovsrec_qos *row)
12397
ovs_assert(inited);
12398
ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_OTHER_CONFIG]);
12402
ovsrec_qos_verify_queues(const struct ovsrec_qos *row)
12404
ovs_assert(inited);
12405
ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_QUEUES]);
12409
ovsrec_qos_verify_type(const struct ovsrec_qos *row)
12411
ovs_assert(inited);
12412
ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_TYPE]);
12415
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
12416
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
12417
* easier and more efficient way to search for a given key than implementing
12418
* the same operation on the "cooked" form in 'row'.
12420
* 'key_type' must be OVSDB_TYPE_STRING.
12421
* 'value_type' must be OVSDB_TYPE_STRING.
12422
* (This helps to avoid silent bugs if someone changes external_ids's
12423
* type without updating the caller.)
12425
* The caller must not modify or free the returned value.
12427
* Various kinds of changes can invalidate the returned value: modifying
12428
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12429
* If the returned value is needed for a long time, it is best to make a copy
12430
* of it with ovsdb_datum_clone(). */
12431
const struct ovsdb_datum *
12432
ovsrec_qos_get_external_ids(const struct ovsrec_qos *row,
12433
enum ovsdb_atomic_type key_type OVS_UNUSED,
12434
enum ovsdb_atomic_type value_type OVS_UNUSED)
12436
ovs_assert(key_type == OVSDB_TYPE_STRING);
12437
ovs_assert(value_type == OVSDB_TYPE_STRING);
12438
return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_external_ids);
12441
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
12442
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
12443
* easier and more efficient way to search for a given key than implementing
12444
* the same operation on the "cooked" form in 'row'.
12446
* 'key_type' must be OVSDB_TYPE_STRING.
12447
* 'value_type' must be OVSDB_TYPE_STRING.
12448
* (This helps to avoid silent bugs if someone changes other_config's
12449
* type without updating the caller.)
12451
* The caller must not modify or free the returned value.
12453
* Various kinds of changes can invalidate the returned value: modifying
12454
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12455
* If the returned value is needed for a long time, it is best to make a copy
12456
* of it with ovsdb_datum_clone(). */
12457
const struct ovsdb_datum *
12458
ovsrec_qos_get_other_config(const struct ovsrec_qos *row,
12459
enum ovsdb_atomic_type key_type OVS_UNUSED,
12460
enum ovsdb_atomic_type value_type OVS_UNUSED)
12462
ovs_assert(key_type == OVSDB_TYPE_STRING);
12463
ovs_assert(value_type == OVSDB_TYPE_STRING);
12464
return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_other_config);
12467
/* Returns the queues column's value in 'row' as a struct ovsdb_datum.
12468
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
12469
* easier and more efficient way to search for a given key than implementing
12470
* the same operation on the "cooked" form in 'row'.
12472
* 'key_type' must be OVSDB_TYPE_INTEGER.
12473
* 'value_type' must be OVSDB_TYPE_UUID.
12474
* (This helps to avoid silent bugs if someone changes queues's
12475
* type without updating the caller.)
12477
* The caller must not modify or free the returned value.
12479
* Various kinds of changes can invalidate the returned value: modifying
12480
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12481
* If the returned value is needed for a long time, it is best to make a copy
12482
* of it with ovsdb_datum_clone(). */
12483
const struct ovsdb_datum *
12484
ovsrec_qos_get_queues(const struct ovsrec_qos *row,
12485
enum ovsdb_atomic_type key_type OVS_UNUSED,
12486
enum ovsdb_atomic_type value_type OVS_UNUSED)
12488
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
12489
ovs_assert(value_type == OVSDB_TYPE_UUID);
12490
return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_queues);
12493
/* Returns the type column's value in 'row' as a struct ovsdb_datum.
12494
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
12495
* easier and more efficient way to search for a given key than implementing
12496
* the same operation on the "cooked" form in 'row'.
12498
* 'key_type' must be OVSDB_TYPE_STRING.
12499
* (This helps to avoid silent bugs if someone changes type's
12500
* type without updating the caller.)
12502
* The caller must not modify or free the returned value.
12504
* Various kinds of changes can invalidate the returned value: modifying
12505
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12506
* If the returned value is needed for a long time, it is best to make a copy
12507
* of it with ovsdb_datum_clone(). */
12508
const struct ovsdb_datum *
12509
ovsrec_qos_get_type(const struct ovsrec_qos *row,
12510
enum ovsdb_atomic_type key_type OVS_UNUSED)
12512
ovs_assert(key_type == OVSDB_TYPE_STRING);
12513
return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_type);
12517
ovsrec_qos_set_external_ids(const struct ovsrec_qos *row, const struct smap *smap)
12519
struct ovsdb_datum datum;
12521
ovs_assert(inited);
12523
struct smap_node *node;
12526
datum.n = smap_count(smap);
12527
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12528
datum.values = xmalloc(datum.n * sizeof *datum.values);
12531
SMAP_FOR_EACH (node, smap) {
12532
datum.keys[i].string = xstrdup(node->key);
12533
datum.values[i].string = xstrdup(node->value);
12536
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12538
ovsdb_datum_init_empty(&datum);
12540
ovsdb_idl_txn_write(&row->header_,
12541
&ovsrec_qos_columns[OVSREC_QOS_COL_EXTERNAL_IDS],
12547
ovsrec_qos_set_other_config(const struct ovsrec_qos *row, const struct smap *smap)
12549
struct ovsdb_datum datum;
12551
ovs_assert(inited);
12553
struct smap_node *node;
12556
datum.n = smap_count(smap);
12557
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12558
datum.values = xmalloc(datum.n * sizeof *datum.values);
12561
SMAP_FOR_EACH (node, smap) {
12562
datum.keys[i].string = xstrdup(node->key);
12563
datum.values[i].string = xstrdup(node->value);
12566
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12568
ovsdb_datum_init_empty(&datum);
12570
ovsdb_idl_txn_write(&row->header_,
12571
&ovsrec_qos_columns[OVSREC_QOS_COL_OTHER_CONFIG],
12577
ovsrec_qos_set_queues(const struct ovsrec_qos *row, const int64_t *key_queues, struct ovsrec_queue **value_queues, size_t n_queues)
12579
struct ovsdb_datum datum;
12582
ovs_assert(inited);
12583
datum.n = n_queues;
12584
datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
12585
datum.values = xmalloc(n_queues * sizeof *datum.values);
12586
for (i = 0; i < n_queues; i++) {
12587
datum.keys[i].integer = key_queues[i];
12588
datum.values[i].uuid = value_queues[i]->header_.uuid;
12590
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_UUID);
12591
ovsdb_idl_txn_write(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_QUEUES], &datum);
12595
ovsrec_qos_set_type(const struct ovsrec_qos *row, const char *type)
12597
struct ovsdb_datum datum;
12598
union ovsdb_atom key;
12600
ovs_assert(inited);
12603
key.string = CONST_CAST(char *, type);
12604
datum.values = NULL;
12605
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_TYPE], &datum);
12608
struct ovsdb_idl_column ovsrec_qos_columns[OVSREC_QOS_N_COLUMNS];
12611
ovsrec_qos_columns_init(void)
12613
struct ovsdb_idl_column *c;
12615
/* Initialize ovsrec_qos_col_external_ids. */
12616
c = &ovsrec_qos_col_external_ids;
12617
c->name = "external_ids";
12618
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12619
c->type.key.u.string.minLen = 0;
12620
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12621
c->type.value.u.string.minLen = 0;
12623
c->type.n_max = UINT_MAX;
12625
c->parse = ovsrec_qos_parse_external_ids;
12626
c->unparse = ovsrec_qos_unparse_external_ids;
12628
/* Initialize ovsrec_qos_col_other_config. */
12629
c = &ovsrec_qos_col_other_config;
12630
c->name = "other_config";
12631
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12632
c->type.key.u.string.minLen = 0;
12633
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12634
c->type.value.u.string.minLen = 0;
12636
c->type.n_max = UINT_MAX;
12638
c->parse = ovsrec_qos_parse_other_config;
12639
c->unparse = ovsrec_qos_unparse_other_config;
12641
/* Initialize ovsrec_qos_col_queues. */
12642
c = &ovsrec_qos_col_queues;
12643
c->name = "queues";
12644
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12645
c->type.key.u.integer.min = INT64_C(0);
12646
c->type.key.u.integer.max = INT64_C(4294967295);
12647
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_UUID);
12648
c->type.value.u.uuid.refTableName = "Queue";
12649
c->type.value.u.uuid.refType = OVSDB_REF_STRONG;
12651
c->type.n_max = UINT_MAX;
12653
c->parse = ovsrec_qos_parse_queues;
12654
c->unparse = ovsrec_qos_unparse_queues;
12656
/* Initialize ovsrec_qos_col_type. */
12657
c = &ovsrec_qos_col_type;
12659
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12660
c->type.key.u.string.minLen = 0;
12661
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12665
c->parse = ovsrec_qos_parse_type;
12666
c->unparse = ovsrec_qos_unparse_type;
12672
ovsrec_queue_parse_dscp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12674
struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12675
size_t n = MIN(1, datum->n);
12678
ovs_assert(inited);
12681
for (i = 0; i < n; i++) {
12682
if (!row->n_dscp) {
12683
row->dscp = xmalloc(n * sizeof *row->dscp);
12685
row->dscp[row->n_dscp] = datum->keys[i].integer;
12691
ovsrec_queue_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12693
struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12696
ovs_assert(inited);
12697
smap_init(&row->external_ids);
12698
for (i = 0; i < datum->n; i++) {
12699
smap_add(&row->external_ids,
12700
datum->keys[i].string,
12701
datum->values[i].string);
12706
ovsrec_queue_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12708
struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12711
ovs_assert(inited);
12712
smap_init(&row->other_config);
12713
for (i = 0; i < datum->n; i++) {
12714
smap_add(&row->other_config,
12715
datum->keys[i].string,
12716
datum->values[i].string);
12721
ovsrec_queue_unparse_dscp(struct ovsdb_idl_row *row_)
12723
struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12725
ovs_assert(inited);
12730
ovsrec_queue_unparse_external_ids(struct ovsdb_idl_row *row_)
12732
struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12734
ovs_assert(inited);
12735
smap_destroy(&row->external_ids);
12739
ovsrec_queue_unparse_other_config(struct ovsdb_idl_row *row_)
12741
struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12743
ovs_assert(inited);
12744
smap_destroy(&row->other_config);
12748
ovsrec_queue_init__(struct ovsdb_idl_row *row)
12750
ovsrec_queue_init(ovsrec_queue_cast(row));
12754
ovsrec_queue_init(struct ovsrec_queue *row)
12756
memset(row, 0, sizeof *row);
12757
smap_init(&row->external_ids);
12758
smap_init(&row->other_config);
12761
const struct ovsrec_queue *
12762
ovsrec_queue_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
12764
return ovsrec_queue_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_QUEUE], uuid));
12767
const struct ovsrec_queue *
12768
ovsrec_queue_first(const struct ovsdb_idl *idl)
12770
return ovsrec_queue_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_QUEUE]));
12773
const struct ovsrec_queue *
12774
ovsrec_queue_next(const struct ovsrec_queue *row)
12776
return ovsrec_queue_cast(ovsdb_idl_next_row(&row->header_));
12780
ovsrec_queue_delete(const struct ovsrec_queue *row)
12782
ovsdb_idl_txn_delete(&row->header_);
12785
struct ovsrec_queue *
12786
ovsrec_queue_insert(struct ovsdb_idl_txn *txn)
12788
return ovsrec_queue_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_QUEUE], NULL));
12793
ovsrec_queue_verify_dscp(const struct ovsrec_queue *row)
12795
ovs_assert(inited);
12796
ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_DSCP]);
12800
ovsrec_queue_verify_external_ids(const struct ovsrec_queue *row)
12802
ovs_assert(inited);
12803
ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_EXTERNAL_IDS]);
12807
ovsrec_queue_verify_other_config(const struct ovsrec_queue *row)
12809
ovs_assert(inited);
12810
ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_OTHER_CONFIG]);
12813
/* Returns the dscp column's value in 'row' as a struct ovsdb_datum.
12814
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
12815
* easier and more efficient way to search for a given key than implementing
12816
* the same operation on the "cooked" form in 'row'.
12818
* 'key_type' must be OVSDB_TYPE_INTEGER.
12819
* (This helps to avoid silent bugs if someone changes dscp's
12820
* type without updating the caller.)
12822
* The caller must not modify or free the returned value.
12824
* Various kinds of changes can invalidate the returned value: modifying
12825
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12826
* If the returned value is needed for a long time, it is best to make a copy
12827
* of it with ovsdb_datum_clone(). */
12828
const struct ovsdb_datum *
12829
ovsrec_queue_get_dscp(const struct ovsrec_queue *row,
12830
enum ovsdb_atomic_type key_type OVS_UNUSED)
12832
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
12833
return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_dscp);
12836
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
12837
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
12838
* easier and more efficient way to search for a given key than implementing
12839
* the same operation on the "cooked" form in 'row'.
12841
* 'key_type' must be OVSDB_TYPE_STRING.
12842
* 'value_type' must be OVSDB_TYPE_STRING.
12843
* (This helps to avoid silent bugs if someone changes external_ids's
12844
* type without updating the caller.)
12846
* The caller must not modify or free the returned value.
12848
* Various kinds of changes can invalidate the returned value: modifying
12849
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12850
* If the returned value is needed for a long time, it is best to make a copy
12851
* of it with ovsdb_datum_clone(). */
12852
const struct ovsdb_datum *
12853
ovsrec_queue_get_external_ids(const struct ovsrec_queue *row,
12854
enum ovsdb_atomic_type key_type OVS_UNUSED,
12855
enum ovsdb_atomic_type value_type OVS_UNUSED)
12857
ovs_assert(key_type == OVSDB_TYPE_STRING);
12858
ovs_assert(value_type == OVSDB_TYPE_STRING);
12859
return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_external_ids);
12862
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
12863
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
12864
* easier and more efficient way to search for a given key than implementing
12865
* the same operation on the "cooked" form in 'row'.
12867
* 'key_type' must be OVSDB_TYPE_STRING.
12868
* 'value_type' must be OVSDB_TYPE_STRING.
12869
* (This helps to avoid silent bugs if someone changes other_config's
12870
* type without updating the caller.)
12872
* The caller must not modify or free the returned value.
12874
* Various kinds of changes can invalidate the returned value: modifying
12875
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12876
* If the returned value is needed for a long time, it is best to make a copy
12877
* of it with ovsdb_datum_clone(). */
12878
const struct ovsdb_datum *
12879
ovsrec_queue_get_other_config(const struct ovsrec_queue *row,
12880
enum ovsdb_atomic_type key_type OVS_UNUSED,
12881
enum ovsdb_atomic_type value_type OVS_UNUSED)
12883
ovs_assert(key_type == OVSDB_TYPE_STRING);
12884
ovs_assert(value_type == OVSDB_TYPE_STRING);
12885
return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_other_config);
12889
ovsrec_queue_set_dscp(const struct ovsrec_queue *row, const int64_t *dscp, size_t n_dscp)
12891
struct ovsdb_datum datum;
12892
union ovsdb_atom key;
12894
ovs_assert(inited);
12898
key.integer = *dscp;
12903
datum.values = NULL;
12904
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_DSCP], &datum);
12908
ovsrec_queue_set_external_ids(const struct ovsrec_queue *row, const struct smap *smap)
12910
struct ovsdb_datum datum;
12912
ovs_assert(inited);
12914
struct smap_node *node;
12917
datum.n = smap_count(smap);
12918
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12919
datum.values = xmalloc(datum.n * sizeof *datum.values);
12922
SMAP_FOR_EACH (node, smap) {
12923
datum.keys[i].string = xstrdup(node->key);
12924
datum.values[i].string = xstrdup(node->value);
12927
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12929
ovsdb_datum_init_empty(&datum);
12931
ovsdb_idl_txn_write(&row->header_,
12932
&ovsrec_queue_columns[OVSREC_QUEUE_COL_EXTERNAL_IDS],
12938
ovsrec_queue_set_other_config(const struct ovsrec_queue *row, const struct smap *smap)
12940
struct ovsdb_datum datum;
12942
ovs_assert(inited);
12944
struct smap_node *node;
12947
datum.n = smap_count(smap);
12948
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12949
datum.values = xmalloc(datum.n * sizeof *datum.values);
12952
SMAP_FOR_EACH (node, smap) {
12953
datum.keys[i].string = xstrdup(node->key);
12954
datum.values[i].string = xstrdup(node->value);
12957
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12959
ovsdb_datum_init_empty(&datum);
12961
ovsdb_idl_txn_write(&row->header_,
12962
&ovsrec_queue_columns[OVSREC_QUEUE_COL_OTHER_CONFIG],
12967
struct ovsdb_idl_column ovsrec_queue_columns[OVSREC_QUEUE_N_COLUMNS];
12970
ovsrec_queue_columns_init(void)
12972
struct ovsdb_idl_column *c;
12974
/* Initialize ovsrec_queue_col_dscp. */
12975
c = &ovsrec_queue_col_dscp;
12977
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12978
c->type.key.u.integer.min = INT64_C(0);
12979
c->type.key.u.integer.max = INT64_C(63);
12980
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12984
c->parse = ovsrec_queue_parse_dscp;
12985
c->unparse = ovsrec_queue_unparse_dscp;
12987
/* Initialize ovsrec_queue_col_external_ids. */
12988
c = &ovsrec_queue_col_external_ids;
12989
c->name = "external_ids";
12990
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12991
c->type.key.u.string.minLen = 0;
12992
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12993
c->type.value.u.string.minLen = 0;
12995
c->type.n_max = UINT_MAX;
12997
c->parse = ovsrec_queue_parse_external_ids;
12998
c->unparse = ovsrec_queue_unparse_external_ids;
13000
/* Initialize ovsrec_queue_col_other_config. */
13001
c = &ovsrec_queue_col_other_config;
13002
c->name = "other_config";
13003
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13004
c->type.key.u.string.minLen = 0;
13005
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
13006
c->type.value.u.string.minLen = 0;
13008
c->type.n_max = UINT_MAX;
13010
c->parse = ovsrec_queue_parse_other_config;
13011
c->unparse = ovsrec_queue_unparse_other_config;
13017
ovsrec_ssl_parse_bootstrap_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13019
struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13021
ovs_assert(inited);
13022
if (datum->n >= 1) {
13023
row->bootstrap_ca_cert = datum->keys[0].boolean;
13025
row->bootstrap_ca_cert = false;
13030
ovsrec_ssl_parse_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13032
struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13034
ovs_assert(inited);
13035
if (datum->n >= 1) {
13036
row->ca_cert = datum->keys[0].string;
13043
ovsrec_ssl_parse_certificate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13045
struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13047
ovs_assert(inited);
13048
if (datum->n >= 1) {
13049
row->certificate = datum->keys[0].string;
13051
row->certificate = "";
13056
ovsrec_ssl_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13058
struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13061
ovs_assert(inited);
13062
smap_init(&row->external_ids);
13063
for (i = 0; i < datum->n; i++) {
13064
smap_add(&row->external_ids,
13065
datum->keys[i].string,
13066
datum->values[i].string);
13071
ovsrec_ssl_parse_private_key(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13073
struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13075
ovs_assert(inited);
13076
if (datum->n >= 1) {
13077
row->private_key = datum->keys[0].string;
13079
row->private_key = "";
13084
ovsrec_ssl_unparse_bootstrap_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
13086
/* Nothing to do. */
13090
ovsrec_ssl_unparse_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
13092
/* Nothing to do. */
13096
ovsrec_ssl_unparse_certificate(struct ovsdb_idl_row *row OVS_UNUSED)
13098
/* Nothing to do. */
13102
ovsrec_ssl_unparse_external_ids(struct ovsdb_idl_row *row_)
13104
struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13106
ovs_assert(inited);
13107
smap_destroy(&row->external_ids);
13111
ovsrec_ssl_unparse_private_key(struct ovsdb_idl_row *row OVS_UNUSED)
13113
/* Nothing to do. */
13117
ovsrec_ssl_init__(struct ovsdb_idl_row *row)
13119
ovsrec_ssl_init(ovsrec_ssl_cast(row));
13123
ovsrec_ssl_init(struct ovsrec_ssl *row)
13125
memset(row, 0, sizeof *row);
13126
smap_init(&row->external_ids);
13129
const struct ovsrec_ssl *
13130
ovsrec_ssl_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
13132
return ovsrec_ssl_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_SSL], uuid));
13135
const struct ovsrec_ssl *
13136
ovsrec_ssl_first(const struct ovsdb_idl *idl)
13138
return ovsrec_ssl_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_SSL]));
13141
const struct ovsrec_ssl *
13142
ovsrec_ssl_next(const struct ovsrec_ssl *row)
13144
return ovsrec_ssl_cast(ovsdb_idl_next_row(&row->header_));
13148
ovsrec_ssl_delete(const struct ovsrec_ssl *row)
13150
ovsdb_idl_txn_delete(&row->header_);
13153
struct ovsrec_ssl *
13154
ovsrec_ssl_insert(struct ovsdb_idl_txn *txn)
13156
return ovsrec_ssl_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_SSL], NULL));
13161
ovsrec_ssl_verify_bootstrap_ca_cert(const struct ovsrec_ssl *row)
13163
ovs_assert(inited);
13164
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_BOOTSTRAP_CA_CERT]);
13168
ovsrec_ssl_verify_ca_cert(const struct ovsrec_ssl *row)
13170
ovs_assert(inited);
13171
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CA_CERT]);
13175
ovsrec_ssl_verify_certificate(const struct ovsrec_ssl *row)
13177
ovs_assert(inited);
13178
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CERTIFICATE]);
13182
ovsrec_ssl_verify_external_ids(const struct ovsrec_ssl *row)
13184
ovs_assert(inited);
13185
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_EXTERNAL_IDS]);
13189
ovsrec_ssl_verify_private_key(const struct ovsrec_ssl *row)
13191
ovs_assert(inited);
13192
ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_PRIVATE_KEY]);
13195
/* Returns the bootstrap_ca_cert column's value in 'row' as a struct ovsdb_datum.
13196
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13197
* easier and more efficient way to search for a given key than implementing
13198
* the same operation on the "cooked" form in 'row'.
13200
* 'key_type' must be OVSDB_TYPE_BOOLEAN.
13201
* (This helps to avoid silent bugs if someone changes bootstrap_ca_cert's
13202
* type without updating the caller.)
13204
* The caller must not modify or free the returned value.
13206
* Various kinds of changes can invalidate the returned value: modifying
13207
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13208
* If the returned value is needed for a long time, it is best to make a copy
13209
* of it with ovsdb_datum_clone(). */
13210
const struct ovsdb_datum *
13211
ovsrec_ssl_get_bootstrap_ca_cert(const struct ovsrec_ssl *row,
13212
enum ovsdb_atomic_type key_type OVS_UNUSED)
13214
ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
13215
return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert);
13218
/* Returns the ca_cert column's value in 'row' as a struct ovsdb_datum.
13219
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13220
* easier and more efficient way to search for a given key than implementing
13221
* the same operation on the "cooked" form in 'row'.
13223
* 'key_type' must be OVSDB_TYPE_STRING.
13224
* (This helps to avoid silent bugs if someone changes ca_cert's
13225
* type without updating the caller.)
13227
* The caller must not modify or free the returned value.
13229
* Various kinds of changes can invalidate the returned value: modifying
13230
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13231
* If the returned value is needed for a long time, it is best to make a copy
13232
* of it with ovsdb_datum_clone(). */
13233
const struct ovsdb_datum *
13234
ovsrec_ssl_get_ca_cert(const struct ovsrec_ssl *row,
13235
enum ovsdb_atomic_type key_type OVS_UNUSED)
13237
ovs_assert(key_type == OVSDB_TYPE_STRING);
13238
return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_ca_cert);
13241
/* Returns the certificate column's value in 'row' as a struct ovsdb_datum.
13242
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13243
* easier and more efficient way to search for a given key than implementing
13244
* the same operation on the "cooked" form in 'row'.
13246
* 'key_type' must be OVSDB_TYPE_STRING.
13247
* (This helps to avoid silent bugs if someone changes certificate's
13248
* type without updating the caller.)
13250
* The caller must not modify or free the returned value.
13252
* Various kinds of changes can invalidate the returned value: modifying
13253
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13254
* If the returned value is needed for a long time, it is best to make a copy
13255
* of it with ovsdb_datum_clone(). */
13256
const struct ovsdb_datum *
13257
ovsrec_ssl_get_certificate(const struct ovsrec_ssl *row,
13258
enum ovsdb_atomic_type key_type OVS_UNUSED)
13260
ovs_assert(key_type == OVSDB_TYPE_STRING);
13261
return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_certificate);
13264
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
13265
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13266
* easier and more efficient way to search for a given key than implementing
13267
* the same operation on the "cooked" form in 'row'.
13269
* 'key_type' must be OVSDB_TYPE_STRING.
13270
* 'value_type' must be OVSDB_TYPE_STRING.
13271
* (This helps to avoid silent bugs if someone changes external_ids's
13272
* type without updating the caller.)
13274
* The caller must not modify or free the returned value.
13276
* Various kinds of changes can invalidate the returned value: modifying
13277
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13278
* If the returned value is needed for a long time, it is best to make a copy
13279
* of it with ovsdb_datum_clone(). */
13280
const struct ovsdb_datum *
13281
ovsrec_ssl_get_external_ids(const struct ovsrec_ssl *row,
13282
enum ovsdb_atomic_type key_type OVS_UNUSED,
13283
enum ovsdb_atomic_type value_type OVS_UNUSED)
13285
ovs_assert(key_type == OVSDB_TYPE_STRING);
13286
ovs_assert(value_type == OVSDB_TYPE_STRING);
13287
return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_external_ids);
13290
/* Returns the private_key column's value in 'row' as a struct ovsdb_datum.
13291
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13292
* easier and more efficient way to search for a given key than implementing
13293
* the same operation on the "cooked" form in 'row'.
13295
* 'key_type' must be OVSDB_TYPE_STRING.
13296
* (This helps to avoid silent bugs if someone changes private_key's
13297
* type without updating the caller.)
13299
* The caller must not modify or free the returned value.
13301
* Various kinds of changes can invalidate the returned value: modifying
13302
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13303
* If the returned value is needed for a long time, it is best to make a copy
13304
* of it with ovsdb_datum_clone(). */
13305
const struct ovsdb_datum *
13306
ovsrec_ssl_get_private_key(const struct ovsrec_ssl *row,
13307
enum ovsdb_atomic_type key_type OVS_UNUSED)
13309
ovs_assert(key_type == OVSDB_TYPE_STRING);
13310
return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_private_key);
13314
ovsrec_ssl_set_bootstrap_ca_cert(const struct ovsrec_ssl *row, bool bootstrap_ca_cert)
13316
struct ovsdb_datum datum;
13317
union ovsdb_atom key;
13319
ovs_assert(inited);
13322
key.boolean = bootstrap_ca_cert;
13323
datum.values = NULL;
13324
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_BOOTSTRAP_CA_CERT], &datum);
13328
ovsrec_ssl_set_ca_cert(const struct ovsrec_ssl *row, const char *ca_cert)
13330
struct ovsdb_datum datum;
13331
union ovsdb_atom key;
13333
ovs_assert(inited);
13336
key.string = CONST_CAST(char *, ca_cert);
13337
datum.values = NULL;
13338
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CA_CERT], &datum);
13342
ovsrec_ssl_set_certificate(const struct ovsrec_ssl *row, const char *certificate)
13344
struct ovsdb_datum datum;
13345
union ovsdb_atom key;
13347
ovs_assert(inited);
13350
key.string = CONST_CAST(char *, certificate);
13351
datum.values = NULL;
13352
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CERTIFICATE], &datum);
13356
ovsrec_ssl_set_external_ids(const struct ovsrec_ssl *row, const struct smap *smap)
13358
struct ovsdb_datum datum;
13360
ovs_assert(inited);
13362
struct smap_node *node;
13365
datum.n = smap_count(smap);
13366
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
13367
datum.values = xmalloc(datum.n * sizeof *datum.values);
13370
SMAP_FOR_EACH (node, smap) {
13371
datum.keys[i].string = xstrdup(node->key);
13372
datum.values[i].string = xstrdup(node->value);
13375
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
13377
ovsdb_datum_init_empty(&datum);
13379
ovsdb_idl_txn_write(&row->header_,
13380
&ovsrec_ssl_columns[OVSREC_SSL_COL_EXTERNAL_IDS],
13386
ovsrec_ssl_set_private_key(const struct ovsrec_ssl *row, const char *private_key)
13388
struct ovsdb_datum datum;
13389
union ovsdb_atom key;
13391
ovs_assert(inited);
13394
key.string = CONST_CAST(char *, private_key);
13395
datum.values = NULL;
13396
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_PRIVATE_KEY], &datum);
13399
struct ovsdb_idl_column ovsrec_ssl_columns[OVSREC_SSL_N_COLUMNS];
13402
ovsrec_ssl_columns_init(void)
13404
struct ovsdb_idl_column *c;
13406
/* Initialize ovsrec_ssl_col_bootstrap_ca_cert. */
13407
c = &ovsrec_ssl_col_bootstrap_ca_cert;
13408
c->name = "bootstrap_ca_cert";
13409
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
13410
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13414
c->parse = ovsrec_ssl_parse_bootstrap_ca_cert;
13415
c->unparse = ovsrec_ssl_unparse_bootstrap_ca_cert;
13417
/* Initialize ovsrec_ssl_col_ca_cert. */
13418
c = &ovsrec_ssl_col_ca_cert;
13419
c->name = "ca_cert";
13420
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13421
c->type.key.u.string.minLen = 0;
13422
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13426
c->parse = ovsrec_ssl_parse_ca_cert;
13427
c->unparse = ovsrec_ssl_unparse_ca_cert;
13429
/* Initialize ovsrec_ssl_col_certificate. */
13430
c = &ovsrec_ssl_col_certificate;
13431
c->name = "certificate";
13432
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13433
c->type.key.u.string.minLen = 0;
13434
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13438
c->parse = ovsrec_ssl_parse_certificate;
13439
c->unparse = ovsrec_ssl_unparse_certificate;
13441
/* Initialize ovsrec_ssl_col_external_ids. */
13442
c = &ovsrec_ssl_col_external_ids;
13443
c->name = "external_ids";
13444
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13445
c->type.key.u.string.minLen = 0;
13446
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
13447
c->type.value.u.string.minLen = 0;
13449
c->type.n_max = UINT_MAX;
13451
c->parse = ovsrec_ssl_parse_external_ids;
13452
c->unparse = ovsrec_ssl_unparse_external_ids;
13454
/* Initialize ovsrec_ssl_col_private_key. */
13455
c = &ovsrec_ssl_col_private_key;
13456
c->name = "private_key";
13457
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13458
c->type.key.u.string.minLen = 0;
13459
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13463
c->parse = ovsrec_ssl_parse_private_key;
13464
c->unparse = ovsrec_ssl_unparse_private_key;
13470
ovsrec_sflow_parse_agent(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13472
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13474
ovs_assert(inited);
13475
if (datum->n >= 1) {
13476
row->agent = datum->keys[0].string;
13483
ovsrec_sflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13485
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13488
ovs_assert(inited);
13489
smap_init(&row->external_ids);
13490
for (i = 0; i < datum->n; i++) {
13491
smap_add(&row->external_ids,
13492
datum->keys[i].string,
13493
datum->values[i].string);
13498
ovsrec_sflow_parse_header(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13500
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13501
size_t n = MIN(1, datum->n);
13504
ovs_assert(inited);
13505
row->header = NULL;
13507
for (i = 0; i < n; i++) {
13508
if (!row->n_header) {
13509
row->header = xmalloc(n * sizeof *row->header);
13511
row->header[row->n_header] = datum->keys[i].integer;
13517
ovsrec_sflow_parse_polling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13519
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13520
size_t n = MIN(1, datum->n);
13523
ovs_assert(inited);
13524
row->polling = NULL;
13525
row->n_polling = 0;
13526
for (i = 0; i < n; i++) {
13527
if (!row->n_polling) {
13528
row->polling = xmalloc(n * sizeof *row->polling);
13530
row->polling[row->n_polling] = datum->keys[i].integer;
13536
ovsrec_sflow_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13538
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13539
size_t n = MIN(1, datum->n);
13542
ovs_assert(inited);
13543
row->sampling = NULL;
13544
row->n_sampling = 0;
13545
for (i = 0; i < n; i++) {
13546
if (!row->n_sampling) {
13547
row->sampling = xmalloc(n * sizeof *row->sampling);
13549
row->sampling[row->n_sampling] = datum->keys[i].integer;
13555
ovsrec_sflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13557
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13560
ovs_assert(inited);
13561
row->targets = NULL;
13562
row->n_targets = 0;
13563
for (i = 0; i < datum->n; i++) {
13564
if (!row->n_targets) {
13565
row->targets = xmalloc(datum->n * sizeof *row->targets);
13567
row->targets[row->n_targets] = datum->keys[i].string;
13573
ovsrec_sflow_unparse_agent(struct ovsdb_idl_row *row OVS_UNUSED)
13575
/* Nothing to do. */
13579
ovsrec_sflow_unparse_external_ids(struct ovsdb_idl_row *row_)
13581
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13583
ovs_assert(inited);
13584
smap_destroy(&row->external_ids);
13588
ovsrec_sflow_unparse_header(struct ovsdb_idl_row *row_)
13590
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13592
ovs_assert(inited);
13597
ovsrec_sflow_unparse_polling(struct ovsdb_idl_row *row_)
13599
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13601
ovs_assert(inited);
13602
free(row->polling);
13606
ovsrec_sflow_unparse_sampling(struct ovsdb_idl_row *row_)
13608
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13610
ovs_assert(inited);
13611
free(row->sampling);
13615
ovsrec_sflow_unparse_targets(struct ovsdb_idl_row *row_)
13617
struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13619
ovs_assert(inited);
13620
free(row->targets);
13624
ovsrec_sflow_init__(struct ovsdb_idl_row *row)
13626
ovsrec_sflow_init(ovsrec_sflow_cast(row));
13630
ovsrec_sflow_init(struct ovsrec_sflow *row)
13632
memset(row, 0, sizeof *row);
13633
smap_init(&row->external_ids);
13636
const struct ovsrec_sflow *
13637
ovsrec_sflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
13639
return ovsrec_sflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_SFLOW], uuid));
13642
const struct ovsrec_sflow *
13643
ovsrec_sflow_first(const struct ovsdb_idl *idl)
13645
return ovsrec_sflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]));
13648
const struct ovsrec_sflow *
13649
ovsrec_sflow_next(const struct ovsrec_sflow *row)
13651
return ovsrec_sflow_cast(ovsdb_idl_next_row(&row->header_));
13655
ovsrec_sflow_delete(const struct ovsrec_sflow *row)
13657
ovsdb_idl_txn_delete(&row->header_);
13660
struct ovsrec_sflow *
13661
ovsrec_sflow_insert(struct ovsdb_idl_txn *txn)
13663
return ovsrec_sflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_SFLOW], NULL));
13668
ovsrec_sflow_verify_agent(const struct ovsrec_sflow *row)
13670
ovs_assert(inited);
13671
ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_AGENT]);
13675
ovsrec_sflow_verify_external_ids(const struct ovsrec_sflow *row)
13677
ovs_assert(inited);
13678
ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_EXTERNAL_IDS]);
13682
ovsrec_sflow_verify_header(const struct ovsrec_sflow *row)
13684
ovs_assert(inited);
13685
ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_HEADER]);
13689
ovsrec_sflow_verify_polling(const struct ovsrec_sflow *row)
13691
ovs_assert(inited);
13692
ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_POLLING]);
13696
ovsrec_sflow_verify_sampling(const struct ovsrec_sflow *row)
13698
ovs_assert(inited);
13699
ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_SAMPLING]);
13703
ovsrec_sflow_verify_targets(const struct ovsrec_sflow *row)
13705
ovs_assert(inited);
13706
ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_TARGETS]);
13709
/* Returns the agent column's value in 'row' as a struct ovsdb_datum.
13710
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13711
* easier and more efficient way to search for a given key than implementing
13712
* the same operation on the "cooked" form in 'row'.
13714
* 'key_type' must be OVSDB_TYPE_STRING.
13715
* (This helps to avoid silent bugs if someone changes agent's
13716
* type without updating the caller.)
13718
* The caller must not modify or free the returned value.
13720
* Various kinds of changes can invalidate the returned value: modifying
13721
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13722
* If the returned value is needed for a long time, it is best to make a copy
13723
* of it with ovsdb_datum_clone(). */
13724
const struct ovsdb_datum *
13725
ovsrec_sflow_get_agent(const struct ovsrec_sflow *row,
13726
enum ovsdb_atomic_type key_type OVS_UNUSED)
13728
ovs_assert(key_type == OVSDB_TYPE_STRING);
13729
return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_agent);
13732
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
13733
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13734
* easier and more efficient way to search for a given key than implementing
13735
* the same operation on the "cooked" form in 'row'.
13737
* 'key_type' must be OVSDB_TYPE_STRING.
13738
* 'value_type' must be OVSDB_TYPE_STRING.
13739
* (This helps to avoid silent bugs if someone changes external_ids's
13740
* type without updating the caller.)
13742
* The caller must not modify or free the returned value.
13744
* Various kinds of changes can invalidate the returned value: modifying
13745
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13746
* If the returned value is needed for a long time, it is best to make a copy
13747
* of it with ovsdb_datum_clone(). */
13748
const struct ovsdb_datum *
13749
ovsrec_sflow_get_external_ids(const struct ovsrec_sflow *row,
13750
enum ovsdb_atomic_type key_type OVS_UNUSED,
13751
enum ovsdb_atomic_type value_type OVS_UNUSED)
13753
ovs_assert(key_type == OVSDB_TYPE_STRING);
13754
ovs_assert(value_type == OVSDB_TYPE_STRING);
13755
return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_external_ids);
13758
/* Returns the header column's value in 'row' as a struct ovsdb_datum.
13759
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13760
* easier and more efficient way to search for a given key than implementing
13761
* the same operation on the "cooked" form in 'row'.
13763
* 'key_type' must be OVSDB_TYPE_INTEGER.
13764
* (This helps to avoid silent bugs if someone changes header's
13765
* type without updating the caller.)
13767
* The caller must not modify or free the returned value.
13769
* Various kinds of changes can invalidate the returned value: modifying
13770
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13771
* If the returned value is needed for a long time, it is best to make a copy
13772
* of it with ovsdb_datum_clone(). */
13773
const struct ovsdb_datum *
13774
ovsrec_sflow_get_header(const struct ovsrec_sflow *row,
13775
enum ovsdb_atomic_type key_type OVS_UNUSED)
13777
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13778
return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_header);
13781
/* Returns the polling column's value in 'row' as a struct ovsdb_datum.
13782
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13783
* easier and more efficient way to search for a given key than implementing
13784
* the same operation on the "cooked" form in 'row'.
13786
* 'key_type' must be OVSDB_TYPE_INTEGER.
13787
* (This helps to avoid silent bugs if someone changes polling's
13788
* type without updating the caller.)
13790
* The caller must not modify or free the returned value.
13792
* Various kinds of changes can invalidate the returned value: modifying
13793
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13794
* If the returned value is needed for a long time, it is best to make a copy
13795
* of it with ovsdb_datum_clone(). */
13796
const struct ovsdb_datum *
13797
ovsrec_sflow_get_polling(const struct ovsrec_sflow *row,
13798
enum ovsdb_atomic_type key_type OVS_UNUSED)
13800
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13801
return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_polling);
13804
/* Returns the sampling column's value in 'row' as a struct ovsdb_datum.
13805
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13806
* easier and more efficient way to search for a given key than implementing
13807
* the same operation on the "cooked" form in 'row'.
13809
* 'key_type' must be OVSDB_TYPE_INTEGER.
13810
* (This helps to avoid silent bugs if someone changes sampling's
13811
* type without updating the caller.)
13813
* The caller must not modify or free the returned value.
13815
* Various kinds of changes can invalidate the returned value: modifying
13816
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13817
* If the returned value is needed for a long time, it is best to make a copy
13818
* of it with ovsdb_datum_clone(). */
13819
const struct ovsdb_datum *
13820
ovsrec_sflow_get_sampling(const struct ovsrec_sflow *row,
13821
enum ovsdb_atomic_type key_type OVS_UNUSED)
13823
ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13824
return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_sampling);
13827
/* Returns the targets column's value in 'row' as a struct ovsdb_datum.
13828
* This is useful occasionally: for example, ovsdb_datum_find_key() is an
13829
* easier and more efficient way to search for a given key than implementing
13830
* the same operation on the "cooked" form in 'row'.
13832
* 'key_type' must be OVSDB_TYPE_STRING.
13833
* (This helps to avoid silent bugs if someone changes targets's
13834
* type without updating the caller.)
13836
* The caller must not modify or free the returned value.
13838
* Various kinds of changes can invalidate the returned value: modifying
13839
* 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13840
* If the returned value is needed for a long time, it is best to make a copy
13841
* of it with ovsdb_datum_clone(). */
13842
const struct ovsdb_datum *
13843
ovsrec_sflow_get_targets(const struct ovsrec_sflow *row,
13844
enum ovsdb_atomic_type key_type OVS_UNUSED)
13846
ovs_assert(key_type == OVSDB_TYPE_STRING);
13847
return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_targets);
13851
ovsrec_sflow_set_agent(const struct ovsrec_sflow *row, const char *agent)
13853
struct ovsdb_datum datum;
13854
union ovsdb_atom key;
13856
ovs_assert(inited);
13860
key.string = CONST_CAST(char *, agent);
13865
datum.values = NULL;
13866
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_AGENT], &datum);
13870
ovsrec_sflow_set_external_ids(const struct ovsrec_sflow *row, const struct smap *smap)
13872
struct ovsdb_datum datum;
13874
ovs_assert(inited);
13876
struct smap_node *node;
13879
datum.n = smap_count(smap);
13880
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
13881
datum.values = xmalloc(datum.n * sizeof *datum.values);
13884
SMAP_FOR_EACH (node, smap) {
13885
datum.keys[i].string = xstrdup(node->key);
13886
datum.values[i].string = xstrdup(node->value);
13889
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
13891
ovsdb_datum_init_empty(&datum);
13893
ovsdb_idl_txn_write(&row->header_,
13894
&ovsrec_sflow_columns[OVSREC_SFLOW_COL_EXTERNAL_IDS],
13900
ovsrec_sflow_set_header(const struct ovsrec_sflow *row, const int64_t *header, size_t n_header)
13902
struct ovsdb_datum datum;
13903
union ovsdb_atom key;
13905
ovs_assert(inited);
13909
key.integer = *header;
13914
datum.values = NULL;
13915
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_HEADER], &datum);
13919
ovsrec_sflow_set_polling(const struct ovsrec_sflow *row, const int64_t *polling, size_t n_polling)
13921
struct ovsdb_datum datum;
13922
union ovsdb_atom key;
13924
ovs_assert(inited);
13928
key.integer = *polling;
13933
datum.values = NULL;
13934
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_POLLING], &datum);
13938
ovsrec_sflow_set_sampling(const struct ovsrec_sflow *row, const int64_t *sampling, size_t n_sampling)
13940
struct ovsdb_datum datum;
13941
union ovsdb_atom key;
13943
ovs_assert(inited);
13947
key.integer = *sampling;
13952
datum.values = NULL;
13953
ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_SAMPLING], &datum);
13957
ovsrec_sflow_set_targets(const struct ovsrec_sflow *row, char **targets, size_t n_targets)
13959
struct ovsdb_datum datum;
13962
ovs_assert(inited);
13963
datum.n = n_targets;
13964
datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
13965
datum.values = NULL;
13966
for (i = 0; i < n_targets; i++) {
13967
datum.keys[i].string = xstrdup(targets[i]);
13969
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
13970
ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_TARGETS], &datum);
13973
struct ovsdb_idl_column ovsrec_sflow_columns[OVSREC_SFLOW_N_COLUMNS];
13976
ovsrec_sflow_columns_init(void)
13978
struct ovsdb_idl_column *c;
13980
/* Initialize ovsrec_sflow_col_agent. */
13981
c = &ovsrec_sflow_col_agent;
13983
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13984
c->type.key.u.string.minLen = 0;
13985
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13989
c->parse = ovsrec_sflow_parse_agent;
13990
c->unparse = ovsrec_sflow_unparse_agent;
13992
/* Initialize ovsrec_sflow_col_external_ids. */
13993
c = &ovsrec_sflow_col_external_ids;
13994
c->name = "external_ids";
13995
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13996
c->type.key.u.string.minLen = 0;
13997
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
13998
c->type.value.u.string.minLen = 0;
14000
c->type.n_max = UINT_MAX;
14002
c->parse = ovsrec_sflow_parse_external_ids;
14003
c->unparse = ovsrec_sflow_unparse_external_ids;
14005
/* Initialize ovsrec_sflow_col_header. */
14006
c = &ovsrec_sflow_col_header;
14007
c->name = "header";
14008
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
14009
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14013
c->parse = ovsrec_sflow_parse_header;
14014
c->unparse = ovsrec_sflow_unparse_header;
14016
/* Initialize ovsrec_sflow_col_polling. */
14017
c = &ovsrec_sflow_col_polling;
14018
c->name = "polling";
14019
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
14020
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14024
c->parse = ovsrec_sflow_parse_polling;
14025
c->unparse = ovsrec_sflow_unparse_polling;
14027
/* Initialize ovsrec_sflow_col_sampling. */
14028
c = &ovsrec_sflow_col_sampling;
14029
c->name = "sampling";
14030
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
14031
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14035
c->parse = ovsrec_sflow_parse_sampling;
14036
c->unparse = ovsrec_sflow_unparse_sampling;
14038
/* Initialize ovsrec_sflow_col_targets. */
14039
c = &ovsrec_sflow_col_targets;
14040
c->name = "targets";
14041
ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
14042
c->type.key.u.string.minLen = 0;
14043
ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14045
c->type.n_max = UINT_MAX;
14047
c->parse = ovsrec_sflow_parse_targets;
14048
c->unparse = ovsrec_sflow_unparse_targets;
14051
struct ovsdb_idl_table_class ovsrec_table_classes[OVSREC_N_TABLES] = {
14053
ovsrec_bridge_columns, ARRAY_SIZE(ovsrec_bridge_columns),
14054
sizeof(struct ovsrec_bridge), ovsrec_bridge_init__},
14055
{"Controller", false,
14056
ovsrec_controller_columns, ARRAY_SIZE(ovsrec_controller_columns),
14057
sizeof(struct ovsrec_controller), ovsrec_controller_init__},
14058
{"Flow_Sample_Collector_Set", true,
14059
ovsrec_flow_sample_collector_set_columns, ARRAY_SIZE(ovsrec_flow_sample_collector_set_columns),
14060
sizeof(struct ovsrec_flow_sample_collector_set), ovsrec_flow_sample_collector_set_init__},
14061
{"Flow_Table", false,
14062
ovsrec_flow_table_columns, ARRAY_SIZE(ovsrec_flow_table_columns),
14063
sizeof(struct ovsrec_flow_table), ovsrec_flow_table_init__},
14065
ovsrec_ipfix_columns, ARRAY_SIZE(ovsrec_ipfix_columns),
14066
sizeof(struct ovsrec_ipfix), ovsrec_ipfix_init__},
14067
{"Interface", false,
14068
ovsrec_interface_columns, ARRAY_SIZE(ovsrec_interface_columns),
14069
sizeof(struct ovsrec_interface), ovsrec_interface_init__},
14071
ovsrec_manager_columns, ARRAY_SIZE(ovsrec_manager_columns),
14072
sizeof(struct ovsrec_manager), ovsrec_manager_init__},
14074
ovsrec_mirror_columns, ARRAY_SIZE(ovsrec_mirror_columns),
14075
sizeof(struct ovsrec_mirror), ovsrec_mirror_init__},
14077
ovsrec_netflow_columns, ARRAY_SIZE(ovsrec_netflow_columns),
14078
sizeof(struct ovsrec_netflow), ovsrec_netflow_init__},
14079
{"Open_vSwitch", true,
14080
ovsrec_open_vswitch_columns, ARRAY_SIZE(ovsrec_open_vswitch_columns),
14081
sizeof(struct ovsrec_open_vswitch), ovsrec_open_vswitch_init__},
14083
ovsrec_port_columns, ARRAY_SIZE(ovsrec_port_columns),
14084
sizeof(struct ovsrec_port), ovsrec_port_init__},
14086
ovsrec_qos_columns, ARRAY_SIZE(ovsrec_qos_columns),
14087
sizeof(struct ovsrec_qos), ovsrec_qos_init__},
14089
ovsrec_queue_columns, ARRAY_SIZE(ovsrec_queue_columns),
14090
sizeof(struct ovsrec_queue), ovsrec_queue_init__},
14092
ovsrec_ssl_columns, ARRAY_SIZE(ovsrec_ssl_columns),
14093
sizeof(struct ovsrec_ssl), ovsrec_ssl_init__},
14095
ovsrec_sflow_columns, ARRAY_SIZE(ovsrec_sflow_columns),
14096
sizeof(struct ovsrec_sflow), ovsrec_sflow_init__},
14099
struct ovsdb_idl_class ovsrec_idl_class = {
14100
"Open_vSwitch", ovsrec_table_classes, ARRAY_SIZE(ovsrec_table_classes)
14109
assert_single_threaded();
14112
ovsrec_bridge_columns_init();
14113
ovsrec_controller_columns_init();
14114
ovsrec_flow_sample_collector_set_columns_init();
14115
ovsrec_flow_table_columns_init();
14116
ovsrec_ipfix_columns_init();
14117
ovsrec_interface_columns_init();
14118
ovsrec_manager_columns_init();
14119
ovsrec_mirror_columns_init();
14120
ovsrec_netflow_columns_init();
14121
ovsrec_open_vswitch_columns_init();
14122
ovsrec_port_columns_init();
14123
ovsrec_qos_columns_init();
14124
ovsrec_queue_columns_init();
14125
ovsrec_ssl_columns_init();
14126
ovsrec_sflow_columns_init();
14129
/* Return the schema version. The caller must not free the returned value. */
14131
ovsrec_get_db_version(void)