Newer
Older
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
CHECK_CONNTRACK()
CHECK_CONNTRACK_NAT()
diff --git a/tests/system-userspace-macros.at b/tests/system-userspace-macros.at
index 34f82cee3d..9f0d38dfb3 100644
--- a/tests/system-userspace-macros.at
+++ b/tests/system-userspace-macros.at
@@ -96,6 +96,16 @@ m4_define([CHECK_CONNTRACK_FRAG_OVERLAP])
#
m4_define([CHECK_CONNTRACK_NAT])
+# CHECK_CONNTRACK_ZEROIP_SNAT()
+#
+# Perform requirements checks for running conntrack all-zero IP SNAT tests.
+# The userspace datapath does not support all-zero IP SNAT.
+#
+m4_define([CHECK_CONNTRACK_ZEROIP_SNAT],
+[
+ AT_SKIP_IF([:])
+])
+
# CHECK_CONNTRACK_TIMEOUT()
#
# Perform requirements checks for running conntrack customized timeout tests.
diff --git a/tests/test-jsonrpc.py b/tests/test-jsonrpc.py
index 3eabcd78d5..1df5afa221 100644
--- a/tests/test-jsonrpc.py
+++ b/tests/test-jsonrpc.py
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import print_function
-
import argparse
import errno
import os
diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c
index 15433e3472..a886f971e7 100644
--- a/tests/test-ovsdb.c
+++ b/tests/test-ovsdb.c
@@ -1861,6 +1861,23 @@ print_and_log(const char *format, ...)
free(message);
}
+static char *
+format_idl_row(const struct ovsdb_idl_row *row, int step, const char *contents)
+{
+ const char *change_str =
+ !ovsdb_idl_track_is_set(row->table)
+ ? ""
+ : ovsdb_idl_row_get_seqno(row, OVSDB_IDL_CHANGE_INSERT) > 0
+ ? "inserted row: "
+ : ovsdb_idl_row_get_seqno(row, OVSDB_IDL_CHANGE_DELETE) > 0
+ ? "deleted row: "
+ : "";
+
+ return xasprintf("%03d: table %s: %s%s uuid=" UUID_FMT,
+ step, row->table->class_->name, change_str, contents,
+ UUID_ARGS(&row->uuid));
+}
+
static void
print_idl_row_updated_simple(const struct idltest_simple *s, int step)
{
@@ -1871,7 +1888,9 @@ print_idl_row_updated_simple(const struct idltest_simple *s, int step)
}
}
if (updates.length) {
- print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates));
+ print_and_log("%03d: table %s: updated columns:%s",
+ step, s->header_.table->class_->name,
+ ds_cstr(&updates));
ds_destroy(&updates);
}
}
@@ -1886,7 +1905,9 @@ print_idl_row_updated_link1(const struct idltest_link1 *l1, int step)
}
}
if (updates.length) {
- print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates));
+ print_and_log("%03d: table %s: updated columns:%s",
+ step, l1->header_.table->class_->name,
+ ds_cstr(&updates));
ds_destroy(&updates);
}
}
@@ -1901,7 +1922,43 @@ print_idl_row_updated_link2(const struct idltest_link2 *l2, int step)
}
}
if (updates.length) {
- print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates));
+ print_and_log("%03d: table %s: updated columns:%s",
+ step, l2->header_.table->class_->name,
+ ds_cstr(&updates));
+ ds_destroy(&updates);
+ }
+}
+
+static void
+print_idl_row_updated_simple3(const struct idltest_simple3 *s3, int step)
+{
+ struct ds updates = DS_EMPTY_INITIALIZER;
+ for (size_t i = 0; i < IDLTEST_SIMPLE3_N_COLUMNS; i++) {
+ if (idltest_simple3_is_updated(s3, i)) {
+ ds_put_format(&updates, " %s", idltest_simple3_columns[i].name);
+ }
+ }
+ if (updates.length) {
+ print_and_log("%03d: table %s: updated columns:%s",
+ step, s3->header_.table->class_->name,
+ ds_cstr(&updates));
+ ds_destroy(&updates);
+ }
+}
+
+static void
+print_idl_row_updated_simple4(const struct idltest_simple4 *s4, int step)
+{
+ struct ds updates = DS_EMPTY_INITIALIZER;
+ for (size_t i = 0; i < IDLTEST_SIMPLE4_N_COLUMNS; i++) {
+ if (idltest_simple4_is_updated(s4, i)) {
+ ds_put_format(&updates, " %s", idltest_simple4_columns[i].name);
+ }
+ }
+ if (updates.length) {
+ print_and_log("%03d: table %s: updated columns:%s",
+ step, s4->header_.table->class_->name,
+ ds_cstr(&updates));
ds_destroy(&updates);
}
}
@@ -1916,7 +1973,9 @@ print_idl_row_updated_simple6(const struct idltest_simple6 *s6, int step)
}
}
if (updates.length) {
- print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates));
+ print_and_log("%03d: table %s: updated columns:%s",
+ step, s6->header_.table->class_->name,
+ ds_cstr(&updates));
ds_destroy(&updates);
}
}
@@ -1931,7 +1990,9 @@ print_idl_row_updated_singleton(const struct idltest_singleton *sng, int step)
}
}
if (updates.length) {
- print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates));
+ print_and_log("%03d: table %s: updated columns:%s",
+ step, sng->header_.table->class_->name,
+ ds_cstr(&updates));
ds_destroy(&updates);
}
}
@@ -1940,8 +2001,8 @@ static void
print_idl_row_simple(const struct idltest_simple *s, int step)
{
struct ds msg = DS_EMPTY_INITIALIZER;
- ds_put_format(&msg, "%03d: i=%"PRId64" r=%g b=%s s=%s u="UUID_FMT" ia=[",
- step, s->i, s->r, s->b ? "true" : "false",
+ ds_put_format(&msg, "i=%"PRId64" r=%g b=%s s=%s u="UUID_FMT" ia=[",
+ s->i, s->r, s->b ? "true" : "false",
s->s, UUID_ARGS(&s->u));
for (size_t i = 0; i < s->n_ia; i++) {
ds_put_format(&msg, "%s%"PRId64, i ? " " : "", s->ia[i]);
@@ -1962,9 +2023,12 @@ print_idl_row_simple(const struct idltest_simple *s, int step)
for (size_t i = 0; i < s->n_ua; i++) {
ds_put_format(&msg, "%s"UUID_FMT, i ? " " : "", UUID_ARGS(&s->ua[i]));
}
- ds_put_format(&msg, "] uuid="UUID_FMT, UUID_ARGS(&s->header_.uuid));
- print_and_log("%s", ds_cstr(&msg));
+ ds_put_cstr(&msg, "]");
+
+ char *row_msg = format_idl_row(&s->header_, step, ds_cstr(&msg));
+ print_and_log("%s", row_msg);
ds_destroy(&msg);
+ free(row_msg);
print_idl_row_updated_simple(s, step);
}
@@ -1973,7 +2037,7 @@ static void
print_idl_row_link1(const struct idltest_link1 *l1, int step)
{
struct ds msg = DS_EMPTY_INITIALIZER;
- ds_put_format(&msg, "%03d: i=%"PRId64" k=", step, l1->i);
+ ds_put_format(&msg, "i=%"PRId64" k=", l1->i);
if (l1->k) {
ds_put_format(&msg, "%"PRId64, l1->k->i);
}
@@ -1988,9 +2052,11 @@ print_idl_row_link1(const struct idltest_link1 *l1, int step)
if (l1->l2) {
ds_put_format(&msg, "%"PRId64, l1->l2->i);
}
- ds_put_format(&msg, " uuid="UUID_FMT, UUID_ARGS(&l1->header_.uuid));
- print_and_log("%s", ds_cstr(&msg));
+
+ char *row_msg = format_idl_row(&l1->header_, step, ds_cstr(&msg));
+ print_and_log("%s", row_msg);
ds_destroy(&msg);
+ free(row_msg);
print_idl_row_updated_link1(l1, step);
}
@@ -1999,30 +2065,77 @@ static void
print_idl_row_link2(const struct idltest_link2 *l2, int step)
{
struct ds msg = DS_EMPTY_INITIALIZER;
- ds_put_format(&msg, "%03d: i=%"PRId64" l1=", step, l2->i);
+ ds_put_format(&msg, "i=%"PRId64" l1=", l2->i);
if (l2->l1) {
ds_put_format(&msg, "%"PRId64, l2->l1->i);
}
- ds_put_format(&msg, " uuid="UUID_FMT, UUID_ARGS(&l2->header_.uuid));
- print_and_log("%s", ds_cstr(&msg));
+
+ char *row_msg = format_idl_row(&l2->header_, step, ds_cstr(&msg));
+ print_and_log("%s", row_msg);
ds_destroy(&msg);
+ free(row_msg);
print_idl_row_updated_link2(l2, step);
}
+static void
+print_idl_row_simple3(const struct idltest_simple3 *s3, int step)
+{
+ struct ds msg = DS_EMPTY_INITIALIZER;
+ size_t i;
+
+ ds_put_format(&msg, "name=%s uset=[", s3->name);
+ for (i = 0; i < s3->n_uset; i++) {
+ ds_put_format(&msg, UUID_FMT"%s",
+ UUID_ARGS(&s3->uset[i]),
+ i < s3->n_uset - 1 ? "," : "");
+ }
+ ds_put_cstr(&msg, "] uref=[");
+ for (i = 0; i < s3->n_uref; i++) {
+ ds_put_format(&msg, UUID_FMT"%s",
+ UUID_ARGS(&s3->uref[i]->header_.uuid),
+ i < s3->n_uref -1 ? "," : "");
+ }
+ ds_put_cstr(&msg, "]");
+
+ char *row_msg = format_idl_row(&s3->header_, step, ds_cstr(&msg));
+ print_and_log("%s", row_msg);
+ ds_destroy(&msg);
+ free(row_msg);
+
+ print_idl_row_updated_simple3(s3, step);
+}
+
+static void
+print_idl_row_simple4(const struct idltest_simple4 *s4, int step)
+{
+ struct ds msg = DS_EMPTY_INITIALIZER;
+ ds_put_format(&msg, "name=%s", s4->name);
+
+ char *row_msg = format_idl_row(&s4->header_, step, ds_cstr(&msg));
+ print_and_log("%s", row_msg);
+ ds_destroy(&msg);
+ free(row_msg);
+
+ print_idl_row_updated_simple4(s4, step);
+}
+
static void
print_idl_row_simple6(const struct idltest_simple6 *s6, int step)
{
struct ds msg = DS_EMPTY_INITIALIZER;
- ds_put_format(&msg, "%03d: name=%s ", step, s6->name);
+ ds_put_format(&msg, "name=%s ", s6->name);
ds_put_cstr(&msg, "weak_ref=[");
for (size_t i = 0; i < s6->n_weak_ref; i++) {
ds_put_format(&msg, "%s"UUID_FMT, i ? " " : "",
UUID_ARGS(&s6->weak_ref[i]->header_.uuid));
}
- ds_put_format(&msg, "] uuid="UUID_FMT, UUID_ARGS(&s6->header_.uuid));
- print_and_log("%s", ds_cstr(&msg));
+ ds_put_cstr(&msg, "]");
+
+ char *row_msg = format_idl_row(&s6->header_, step, ds_cstr(&msg));
+ print_and_log("%s", row_msg);
ds_destroy(&msg);
+ free(row_msg);
print_idl_row_updated_simple6(s6, step);
}
@@ -2030,14 +2143,23 @@ print_idl_row_simple6(const struct idltest_simple6 *s6, int step)
static void
print_idl_row_singleton(const struct idltest_singleton *sng, int step)
{
- print_and_log("%03d: name=%s uuid="UUID_FMT, step, sng->name,
- UUID_ARGS(&sng->header_.uuid));
+ struct ds msg = DS_EMPTY_INITIALIZER;
+ ds_put_format(&msg, "name=%s", sng->name);
+
+ char *row_msg = format_idl_row(&sng->header_, step, ds_cstr(&msg));
+ print_and_log("%s", row_msg);
+ ds_destroy(&msg);
+ free(row_msg);
+
print_idl_row_updated_singleton(sng, step);
}
static void
print_idl(struct ovsdb_idl *idl, int step)
{
+ const struct idltest_simple3 *s3;
+ const struct idltest_simple4 *s4;
+ const struct idltest_simple6 *s6;
const struct idltest_simple *s;
const struct idltest_link1 *l1;
const struct idltest_link2 *l2;
@@ -2056,6 +2178,18 @@ print_idl(struct ovsdb_idl *idl, int step)
print_idl_row_link2(l2, step);
n++;
}
+ IDLTEST_SIMPLE3_FOR_EACH (s3, idl) {
+ print_idl_row_simple3(s3, step);
+ n++;
+ }
+ IDLTEST_SIMPLE4_FOR_EACH (s4, idl) {
+ print_idl_row_simple4(s4, step);
+ n++;
+ }
+ IDLTEST_SIMPLE6_FOR_EACH (s6, idl) {
+ print_idl_row_simple6(s6, step);
+ n++;
+ }
IDLTEST_SINGLETON_FOR_EACH (sng, idl) {
print_idl_row_singleton(sng, step);
n++;
@@ -2068,6 +2202,8 @@ print_idl(struct ovsdb_idl *idl, int step)
static void
print_idl_track(struct ovsdb_idl *idl, int step)
{
+ const struct idltest_simple3 *s3;
+ const struct idltest_simple4 *s4;
const struct idltest_simple6 *s6;
const struct idltest_simple *s;
const struct idltest_link1 *l1;
@@ -2076,51 +2212,26 @@ print_idl_track(struct ovsdb_idl *idl, int step)
IDLTEST_SIMPLE_FOR_EACH_TRACKED (s, idl) {
print_idl_row_simple(s, step);
- if (idltest_simple_is_deleted(s)) {
- print_and_log("%03d: deleted row: uuid="UUID_FMT, step,
- UUID_ARGS(&s->header_.uuid));
- } else if (idltest_simple_is_new(s)) {
- print_and_log("%03d: inserted row: uuid="UUID_FMT, step,
- UUID_ARGS(&s->header_.uuid));
- }
n++;
}
IDLTEST_LINK1_FOR_EACH_TRACKED (l1, idl) {
- if (idltest_link1_is_deleted(l1)) {
- print_and_log("%03d: deleted row: uuid="UUID_FMT, step,
- UUID_ARGS(&l1->header_.uuid));
- } else {
- print_idl_row_link1(l1, step);
- if (idltest_link1_is_new(l1)) {
- print_and_log("%03d: inserted row: uuid="UUID_FMT, step,
- UUID_ARGS(&l1->header_.uuid));
- }
- }
+ print_idl_row_link1(l1, step);
n++;
}
IDLTEST_LINK2_FOR_EACH_TRACKED (l2, idl) {
- if (idltest_link2_is_deleted(l2)) {
- print_and_log("%03d: deleted row: uuid="UUID_FMT, step,
- UUID_ARGS(&l2->header_.uuid));
- } else {
- print_idl_row_link2(l2, step);
- if (idltest_link2_is_new(l2)) {
- print_and_log("%03d: inserted row: uuid="UUID_FMT, step,
- UUID_ARGS(&l2->header_.uuid));
- }
-
- }
+ print_idl_row_link2(l2, step);
+ n++;
+ }
+ IDLTEST_SIMPLE3_FOR_EACH_TRACKED (s3, idl) {
+ print_idl_row_simple3(s3, step);
+ n++;
+ }
+ IDLTEST_SIMPLE4_FOR_EACH_TRACKED (s4, idl) {
+ print_idl_row_simple4(s4, step);
n++;
}
IDLTEST_SIMPLE6_FOR_EACH_TRACKED (s6, idl) {
print_idl_row_simple6(s6, step);
- if (idltest_simple6_is_deleted(s6)) {
- print_and_log("%03d: deleted row: uuid="UUID_FMT, step,
- UUID_ARGS(&s6->header_.uuid));
- } else if (idltest_simple6_is_new(s6)) {
- print_and_log("%03d: inserted row: uuid="UUID_FMT, step,
- UUID_ARGS(&s6->header_.uuid));
- }
n++;
}
@@ -2349,6 +2460,10 @@ find_table_class(const char *name)
return &idltest_table_link1;
} else if (!strcmp(name, "link2")) {
return &idltest_table_link2;
+ } else if (!strcmp(name, "simple3")) {
+ return &idltest_table_simple3;
+ } else if (!strcmp(name, "simple4")) {
+ return &idltest_table_simple4;
} else if (!strcmp(name, "simple6")) {
return &idltest_table_simple6;
}
@@ -2702,27 +2817,6 @@ do_idl_partial_update_map_column(struct ovs_cmdl_context *ctx)
printf("%03d: End test\n", step);
}
-static void
-print_idl_row_simple3(const struct idltest_simple3 *s, int step)
-{
- size_t i;
- const struct ovsdb_datum *uset;
- const struct ovsdb_datum *uref;
-
- uset = idltest_simple3_get_uset(s, OVSDB_TYPE_UUID);
- printf("%03d: name=%s uset=[",
- step, s->name);
- for (i = 0; i < uset->n; i++) {
- printf("["UUID_FMT"]%s", UUID_ARGS(&(uset->keys[i].uuid)), i < uset->n-1? ",": "");
- }
- uref = idltest_simple3_get_uref(s, OVSDB_TYPE_UUID);
- printf("] uref=[");
- for (i = 0; i < uref->n; i++) {
- printf("["UUID_FMT"]%s", UUID_ARGS(&(uref->keys[i].uuid)), i < uref->n-1? ",": "");
- }
- printf("]\n");
-}
-
static void
dump_simple3(struct ovsdb_idl *idl,
const struct idltest_simple3 *myRow,
diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
index a196802743..72a319123e 100644
--- a/tests/test-ovsdb.py
+++ b/tests/test-ovsdb.py
@@ -162,6 +162,10 @@ def get_simple_printable_row_string(row, columns):
if isinstance(value, dict):
value = sorted((row_to_uuid(k), row_to_uuid(v))
for k, v in value.items())
+ if isinstance(value, (list, tuple)):
+ value = sorted((row_to_uuid(v) for v in value))
+ elif isinstance(value, list):
+ value = sorted(row_to_uuid(v) for v in value)
s += "%s=%s " % (column, value)
s = s.strip()
s = re.sub('""|,|u?\'', "", s)
@@ -172,9 +176,10 @@ def get_simple_printable_row_string(row, columns):
return s
-def get_simple_table_printable_row(row):
+def get_simple_table_printable_row(row, *additional_columns):
simple_columns = ["i", "r", "b", "s", "u", "ia",
- "ra", "ba", "sa", "ua", "uuid"]
+ "ra", "ba", "sa", "ua"]
+ simple_columns.extend(additional_columns)
return get_simple_printable_row_string(row, simple_columns)
@@ -184,81 +189,118 @@ def get_simple2_table_printable_row(row):
def get_simple3_table_printable_row(row):
- simple3_columns = ["name", "uset"]
+ simple3_columns = ["name", "uset", "uref"]
return get_simple_printable_row_string(row, simple3_columns)
+def get_simple4_table_printable_row(row):
+ simple4_columns = ["name"]
+ return get_simple_printable_row_string(row, simple4_columns)
+
+
+def get_simple5_table_printable_row(row):
+ simple5_columns = ["name", "irefmap"]
+ return get_simple_printable_row_string(row, simple5_columns)
+
+
+def get_simple6_table_printable_row(row):
+ simple6_columns = ["name", "weak_ref"]
+ return get_simple_printable_row_string(row, simple6_columns)
+
+
+def get_link1_table_printable_row(row):
+ s = ["i=%s k=" % row.i]
+ if hasattr(row, "k") and row.k:
+ s.append(str(row.k.i))
+ if hasattr(row, "ka"):
+ s.append(" ka=[")
+ s.append(' '.join(sorted(str(ka.i) for ka in row.ka)))
+ s.append("] l2=")
+ if hasattr(row, "l2") and row.l2:
+ s.append(str(row.l2[0].i))
+ return ''.join(s)
+
+
+def get_link2_table_printable_row(row):
+ s = "i=%s l1=" % row.i
+ if hasattr(row, "l1") and row.l1:
+ s += str(row.l1[0].i)
+ return s
+
+
+def get_singleton_table_printable_row(row):
+ return "name=%s" % row.name
+
+
+def print_row(table, row, step, contents):
+ s = "%03d: table %s: %s " % (step, table, contents)
+ s += get_simple_printable_row_string(row, ["uuid"])
+ print(s)
+
+
def print_idl(idl, step):
n = 0
if "simple" in idl.tables:
simple = idl.tables["simple"].rows
for row in simple.values():
- s = "%03d: " % step
- s += get_simple_table_printable_row(row)
- print(s)
+ print_row("simple", row, step,
+ get_simple_table_printable_row(row))
n += 1
if "simple2" in idl.tables:
simple2 = idl.tables["simple2"].rows
for row in simple2.values():
- s = "%03d: " % step
- s += get_simple2_table_printable_row(row)
- print(s)
+ print_row("simple2", row, step,
+ get_simple2_table_printable_row(row))
n += 1
if "simple3" in idl.tables:
simple3 = idl.tables["simple3"].rows
for row in simple3.values():
- s = "%03d: " % step
- s += get_simple3_table_printable_row(row)
- print(s)
+ print_row("simple3", row, step,
+ get_simple3_table_printable_row(row))
+ n += 1
+
+ if "simple4" in idl.tables:
+ simple4 = idl.tables["simple4"].rows
+ for row in simple4.values():
+ print_row("simple4", row, step,
+ get_simple4_table_printable_row(row))
n += 1
if "simple5" in idl.tables:
simple5 = idl.tables["simple5"].rows
for row in simple5.values():
- s = "%03d: " % step
- s += get_simple_printable_row_string(row, ["name", "irefmap"])
- print(s)
+ print_row("simple5", row, step,
+ get_simple5_table_printable_row(row))
+ n += 1
+
+ if "simple6" in idl.tables:
+ simple6 = idl.tables["simple6"].rows
+ for row in simple6.values():
+ print_row("simple6", row, step,
+ get_simple6_table_printable_row(row))
n += 1
if "link1" in idl.tables:
l1 = idl.tables["link1"].rows
for row in l1.values():
- s = ["%03d: i=%s k=" % (step, row.i)]
- if hasattr(row, "k") and row.k:
- s.append(str(row.k.i))
- if hasattr(row, "ka"):
- s.append(" ka=[")
- s.append(' '.join(sorted(str(ka.i) for ka in row.ka)))
- s.append("] l2=")
- if hasattr(row, "l2") and row.l2:
- s.append(str(row.l2[0].i))
- if hasattr(row, "uuid"):
- s.append(" uuid=%s" % row.uuid)
- print(''.join(s))
+ print_row("link1", row, step,
+ get_link1_table_printable_row(row))
n += 1
if "link2" in idl.tables:
l2 = idl.tables["link2"].rows
for row in l2.values():
- s = ["%03d:" % step]
- s.append(" i=%s l1=" % row.i)
- if hasattr(row, "l1") and row.l1:
- s.append(str(row.l1[0].i))
- if hasattr(row, "uuid"):
- s.append(" uuid=%s" % row.uuid)
- print(''.join(s))
+ print_row("link2", row, step,
+ get_link2_table_printable_row(row))
n += 1
if "singleton" in idl.tables:
sng = idl.tables["singleton"].rows
for row in sng.values():
- s = ["%03d:" % step]
- s.append(" name=%s" % row.name)
- if hasattr(row, "uuid"):
- s.append(" uuid=%s" % row.uuid)
- print(''.join(s))
+ print_row("singleton", row, step,
+ get_singleton_table_printable_row(row))
n += 1
if not n:
@@ -637,7 +679,8 @@ def do_idl(schema_file, remote, *commands):
def mock_notify(event, row, updates=None):
output = "%03d: " % step
output += "event:" + str(event) + ", row={"
- output += get_simple_table_printable_row(row) + "}, updates="
+ output += get_simple_table_printable_row(row, 'l2', 'l1') + "}, "
+ output += get_simple_printable_row_string(row, ["uuid"]) + ", updates="
if updates is None:
output += "None"
else:
diff --git a/tests/test-reconnect.py b/tests/test-reconnect.py
index f0ad9f9793..cea48eb527 100644
--- a/tests/test-reconnect.py
+++ b/tests/test-reconnect.py
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import print_function
-
import errno
import sys
diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at
--- a/tests/tunnel-push-pop.at
+++ b/tests/tunnel-push-pop.at
@@ -595,6 +595,64 @@ OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep 50540000000a5054000000091235 | wc
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
OVS_VSWITCHD_STOP
AT_CLEANUP
+AT_SETUP([tunnel_push_pop - packet_out debug_slow])
+
+OVS_VSWITCHD_START(
+ [add-port br0 p0 dnl
+ -- set Interface p0 type=dummy ofport_request=1 dnl
+ other-config:hwaddr=aa:55:aa:55:00:00])
+AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg])
+AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy])
+AT_CHECK([ovs-vsctl add-port int-br t2 dnl
+ -- set Interface t2 type=geneve options:remote_ip=1.1.2.92 dnl
+ options:key=123 ofport_request=2])
+
+dnl First setup dummy interface IP address, then add the route
+dnl so that tnl-port table can get valid IP address for the device.
+AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
+])
+AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
+])
+AT_CHECK([ovs-ofctl add-flow br0 action=normal])
+
+dnl This ARP reply from p0 has two effects:
+dnl 1. The ARP cache will learn that 1.1.2.92 is at f8:bc:12:44:34:b6.
+dnl 2. The br0 mac learning will learn that f8:bc:12:44:34:b6 is on p0.
+AT_CHECK([
+ ovs-appctl netdev-dummy/receive p0 dnl
+ 'recirc_id(0),in_port(2),dnl
+ eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),dnl
+ arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'
+])
+
+AT_CHECK([ovs-vsctl -- set Interface p0 options:tx_pcap=p0.pcap])
+
+packet=50540000000a505400000009123
+dnl Source port is based on a packet hash, so it may differ depending on the
+dnl compiler flags and CPU type. Masked with '....'.
+encap=f8bc124434b6aa55aa5500000800450000320000400040113406010102580101025c....17c1001e00000000655800007b00
+
+dnl Output to tunnel from a int-br internal port.
+dnl Checking that the packet arrived and it was correctly encapsulated.
+AT_CHECK([ovs-ofctl add-flow int-br "in_port=LOCAL,actions=debug_slow,output:2"])
+AT_CHECK([ovs-appctl netdev-dummy/receive int-br "${packet}4"])
+OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | egrep "${encap}${packet}4" | wc -l` -ge 1])
+dnl Sending again to exercise the non-miss upcall path.
+AT_CHECK([ovs-appctl netdev-dummy/receive int-br "${packet}4"])
+OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | egrep "${encap}${packet}4" | wc -l` -ge 2])
+
+dnl Output to tunnel from the controller.
+AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out int-br CONTROLLER "debug_slow,output:2" "${packet}5"])
+OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | egrep "${encap}${packet}5" | wc -l` -ge 1])
+
+dnl Datapath actions should not have tunnel push action.
+AT_CHECK([ovs-appctl dpctl/dump-flows | grep -q tnl_push], [1])
+dnl There should be slow_path action instead.
+AT_CHECK([ovs-appctl dpctl/dump-flows | grep -q 'slow_path(action)'], [0])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
AT_SETUP([tunnel_push_pop - underlay bridge match])
OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00])
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index bc6bfae15a..ac14da29b1 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -13,7 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import print_function
import email
import getopt
diff --git a/utilities/gdb/ovs_gdb.py b/utilities/gdb/ovs_gdb.py
index 1111f3100d..0b2ecb81be 100644
--- a/utilities/gdb/ovs_gdb.py
+++ b/utilities/gdb/ovs_gdb.py
@@ -55,7 +55,6 @@
# ...
# ...
#
-from __future__ import print_function
import gdb
import sys
import uuid
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index d71c34e691..4156da20ef 100644
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -226,7 +226,9 @@ start_forwarding () {
if test X"$OVS_VSWITCHD" = Xyes; then
do_start_forwarding || return 1
fi
- set_hostname &
+ if test X"$RECORD_HOSTNAME" = Xyes; then
+ set_hostname &
+ fi
return 0
}
@@ -317,6 +319,7 @@ set_defaults () {
SYSTEM_ID=
FULL_HOSTNAME=yes
+ RECORD_HOSTNAME=yes
DELETE_BRIDGES=no
DELETE_TRANSIENT_PORTS=no
@@ -378,19 +381,24 @@ This program is intended to be invoked internally by Open vSwitch startup
scripts. System administrators should not normally invoke it directly.
Commands:
- start start Open vSwitch daemons
- stop stop Open vSwitch daemons
- restart stop and start Open vSwitch daemons
- status check whether Open vSwitch daemons are running
- version print versions of Open vSwitch daemons
- load-kmod insert modules if not already present
- force-reload-kmod save OVS network device state, stop OVS, unload kernel
- module, reload kernel module, start OVS, restore state
- enable-protocol enable protocol specified in options with iptables
- delete-transient-ports delete transient (other_config:transient=true) ports
- start-ovs-ipsec start Open vSwitch ipsec daemon
- stop-ovs-ipsec stop Open vSwitch ipsec daemon
- help display this help message
+ start start Open vSwitch daemons
+ stop stop Open vSwitch daemons
+ restart stop and start Open vSwitch daemons
+ status check whether Open vSwitch daemons are running
+ version print versions of Open vSwitch daemons
+ load-kmod insert modules if not already present
+ force-reload-kmod save OVS network device state, stop OVS, unload
+ kernel module, reload kernel module, start OVS,
+ restore state
+ enable-protocol enable protocol specified in options with
+ iptables
+ delete-transient-ports delete transient (other_config:transient=true)
+ ports
+ start-ovs-ipsec start Open vSwitch ipsec daemon
+ stop-ovs-ipsec stop Open vSwitch ipsec daemon
+ record-hostname-if-not-set determine the system hostname and record it in
+ the Open vSwitch database if not already set
+ help display this help message
One of the following options is required for "start", "restart" and "force-reload-kmod":
--system-id=UUID set specific ID to uniquely identify this system
@@ -411,6 +419,8 @@ Less important options for "start", "restart" and "force-reload-kmod":
--ovsdb-server-priority=NICE set ovsdb-server's niceness (default: $OVSDB_SERVER_PRIORITY)
--ovs-vswitchd-priority=NICE set ovs-vswitchd's niceness (default: $OVS_VSWITCHD_PRIORITY)
--no-full-hostname set short hostname instead of full hostname
+ --no-record-hostname do not attempt to determine/record system
+ hostname as part of start command
Debugging options for "start", "restart" and "force-reload-kmod":
--ovsdb-server-wrapper=WRAPPER
@@ -569,6 +579,9 @@ case $command in
stop-ovs-ipsec)
stop_ovs_ipsec
;;
+ record-hostname-if-not-set)
+ set_hostname
+ ;;
help)
usage
;;
diff --git a/utilities/ovs-l3ping.in b/utilities/ovs-l3ping.in
index 92d32acb3f..1ece06457c 100644
--- a/utilities/ovs-l3ping.in
+++ b/utilities/ovs-l3ping.in
@@ -19,7 +19,7 @@ achieved by tunneling the control connection inside the tunnel itself.
"""
import socket
-import xmlrpclib
+import xmlrpc.client
import ovstest.args as args
import ovstest.tests as tests
@@ -64,13 +64,13 @@ if __name__ == '__main__':
ps = get_packet_sizes(me, he, args.client[0])
tests.do_direct_tests(me, he, bandwidth, interval, ps)
except KeyboardInterrupt:
- print "Terminating"
- except xmlrpclib.Fault:
- print "Couldn't contact peer"
+ print("Terminating")
+ except xmlrpc.client.Fault:
+ print("Couldn't contact peer")
except socket.error:
- print "Couldn't contact peer"
- except xmlrpclib.ProtocolError:
- print "XMLRPC control channel was abruptly terminated"
+ print("Couldn't contact peer")
+ except xmlrpc.client.ProtocolError:
+ print("XMLRPC control channel was abruptly terminated")
finally:
if local_server is not None:
local_server.terminate()
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 3601890f40..ede7f1e61a 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -4020,6 +4020,7 @@ ofctl_meter_mod__(const char *bridge, const char *str, int command)
enum ofputil_protocol usable_protocols;
enum ofp_version version;
+ memset(&mm, 0, sizeof mm);
if (str) {
char *error;
error = parse_ofp_meter_mod_str(&mm, str, command, &usable_protocols);
@@ -4030,7 +4031,6 @@ ofctl_meter_mod__(const char *bridge, const char *str, int command)
usable_protocols = OFPUTIL_P_OF13_UP;
mm.command = command;
mm.meter.meter_id = OFPM13_ALL;
- mm.meter.bands = NULL;
}
protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols);
@@ -4050,6 +4050,7 @@ ofctl_meter_request__(const char *bridge, const char *str,
enum ofputil_protocol protocol;
enum ofp_version version;
+ memset(&mm, 0, sizeof mm);
if (str) {
char *error;
error = parse_ofp_meter_mod_str(&mm, str, -1, &usable_protocols);
@@ -4059,7 +4060,6 @@ ofctl_meter_request__(const char *bridge, const char *str,
} else {
usable_protocols = OFPUTIL_P_OF13_UP;
mm.meter.meter_id = OFPM13_ALL;
- mm.meter.bands = NULL;
}
protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols);
@@ -5051,7 +5051,7 @@ static const struct ovs_cmdl_command all_commands[] = {
{ "add-group", "switch group",
1, 2, ofctl_add_group, OVS_RW },
{ "add-groups", "switch file",
- 1, 2, ofctl_add_groups, OVS_RW },
+ 2, 2, ofctl_add_groups, OVS_RW },
{ "mod-group", "switch group",
1, 2, ofctl_mod_group, OVS_RW },
{ "del-groups", "switch [group]",
diff --git a/utilities/ovs-parse-backtrace.in b/utilities/ovs-parse-backtrace.in
index d5506769a8..f44f05cd1e 100755
--- a/utilities/ovs-parse-backtrace.in
+++ b/utilities/ovs-parse-backtrace.in
@@ -70,7 +70,7 @@ result. Expected usage is for ovs-appctl backtrace to be piped in.""")
if os.path.exists(debug):
binary = debug
- print "Binary: %s\n" % binary
+ print("Binary: %s\n" % binary)
stdin = sys.stdin.read()
@@ -88,15 +88,15 @@ result. Expected usage is for ovs-appctl backtrace to be piped in.""")
for lines, count in traces:
longest = max(len(l) for l in lines)
- print "Backtrace Count: %d" % count
+ print("Backtrace Count: %d" % count)
for line in lines:
match = re.search(r'\[(0x.*)]', line)
if match:
- print "%s %s" % (line.ljust(longest),
- addr2line(binary, match.group(1)))
+ print("%s %s" % (line.ljust(longest),
+ addr2line(binary, match.group(1))))
else:
- print line
- print
+ print(line)
+ print()
if __name__ == "__main__":
diff --git a/utilities/ovs-pcap.in b/utilities/ovs-pcap.in
index dddbee4dfb..6b5f63399e 100755
--- a/utilities/ovs-pcap.in
+++ b/utilities/ovs-pcap.in
@@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import print_function
-
import binascii
import getopt
import struct
@@ -79,7 +77,7 @@ if __name__ == "__main__":
try:
options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
['help', 'version'])
- except getopt.GetoptException as geo:
+ except getopt.GetoptError as geo:
sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
sys.exit(1)
diff --git a/utilities/ovs-vlan-test.in b/utilities/ovs-vlan-test.in
index 154573a9b5..de3ae16862 100755
--- a/utilities/ovs-vlan-test.in
+++ b/utilities/ovs-vlan-test.in
@@ -14,9 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import BaseHTTPServer
import getopt
-import httplib
+import http.client
+import http.server
import os
import threading
import time
@@ -84,7 +84,7 @@ class UDPReceiver:
try:
sock.bind((self.vlan_ip, self.vlan_port))
- except socket.error, e:
+ except socket.error as e:
print_safe('Failed to bind to %s:%d with error: %s'
% (self.vlan_ip, self.vlan_port, e))
os._exit(1) #sys.exit only exits the current thread.
@@ -95,7 +95,7 @@ class UDPReceiver:
data, _ = sock.recvfrom(4096)
except socket.timeout:
continue
- except socket.error, e:
+ except socket.error as e:
print_safe('Failed to receive from %s:%d with error: %s'
% (self.vlan_ip, self.vlan_port, e))
os._exit(1)
@@ -180,7 +180,7 @@ class VlanServer:
for _ in range(send_time * 2):
try:
send_packet(test_id, size, ip, port)
- except socket.error, e:
+ except socket.error as e:
self.set_result(test_id, 'Failure: ' + str(e))
return
time.sleep(.5)
@@ -194,15 +194,15 @@ class VlanServer:
def run(self):