From: claudio Date: Sat, 17 Jun 2023 08:01:22 +0000 (+0000) Subject: Add community tests for various ext-community * versions. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=000e30a885963a8f5cbb81cbd4f401f0825aabfc;p=openbsd Add community tests for various ext-community * versions. While there move one test down so that the numbering is consistent again and make the error strings for counts clear. --- diff --git a/regress/usr.sbin/bgpd/unittests/rde_community_test.c b/regress/usr.sbin/bgpd/unittests/rde_community_test.c index 38c2a8a50d2..4b4457158dc 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_community_test.c +++ b/regress/usr.sbin/bgpd/unittests/rde_community_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_community_test.c,v 1.6 2023/01/30 17:02:48 claudio Exp $ */ +/* $OpenBSD: rde_community_test.c,v 1.7 2023/06/17 08:01:22 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker @@ -161,7 +161,7 @@ test_filter(size_t num, struct testfilter *f) if (f->next != 0) { if (community_count(&comm, COMMUNITY_TYPE_EXT) != f->next - 1) { - printf("Test %zu: community_count unexpected " + printf("Test %zu: ext community_count unexpected " "return %d != %d\n", num, r, f->next - 1); return -1; } @@ -170,7 +170,7 @@ test_filter(size_t num, struct testfilter *f) if (f->nlarge != 0) { if (community_count(&comm, COMMUNITY_TYPE_LARGE) != f->nlarge - 1) { - printf("Test %zu: community_count unexpected " + printf("Test %zu: large community_count unexpected " "return %d != %d\n", num, r, f->nlarge - 1); return -1; } diff --git a/regress/usr.sbin/bgpd/unittests/rde_community_test.h b/regress/usr.sbin/bgpd/unittests/rde_community_test.h index 2d2439a0e02..00368912f22 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_community_test.h +++ b/regress/usr.sbin/bgpd/unittests/rde_community_test.h @@ -502,6 +502,22 @@ struct community filters[] = { .data2 = 196618, .data3 = EXT_COMMUNITY_TRANS_TWO_AS << 8 | 0x02, }, + { /* 42 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 24), + }, + { /* 43 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 8), + .data3 = (-1 << 8) | 0x02, + }, + { /* 44 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 8), + .data3 = EXT_COMMUNITY_TRANS_FOUR_AS << 8 | 0x02, + }, + { /* 45 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 16), + .data3 = EXT_COMMUNITY_TRANS_FOUR_AS << 8 | 0x02, + .data1 = 196618, + }, }; struct testfilter { @@ -514,12 +530,6 @@ struct testfilter { int nlarge; struct rde_peer *peer; } testfilters[] = { - { - .in = { 38, -1 }, - .match = 30, - .mout = 1, - .peer = &peer, - }, { .in = { 1, 2, -1 }, .match = 1, @@ -952,5 +962,54 @@ struct testfilter { .mout = 1, .peer = &peer_r4, }, + { + .in = { 38, -1 }, + .match = 30, + .mout = 1, + .peer = &peer, + }, + { /* 70 */ + .in = { 38, 39, 40, -1 }, + .match = 42, + .mout = 1, + .delete = 42, + .next = 0 + 1, + .peer = &peer, + }, + { + .in = { 38, 39, 40, -1 }, + .match = 43, + .mout = 1, + .delete = 43, + .next = 0 + 1, + .peer = &peer, + }, + { + .in = { 39, 40, -1 }, + .match = 44, + .mout = 1, + .delete = 44, + .next = 0 + 1, + .peer = &peer, + }, + { + .in = { 38, -1 }, + .match = 44, + .mout = 0, + .peer = &peer, + }, + { + .in = { 40, -1 }, + .match = 45, + .mout = 1, + .delete = 45, + .next = 0 + 1, + .peer = &peer, + }, + { /* 75 */ + .in = { 38, 39, 41, -1 }, + .match = 45, + .mout = 0, + .peer = &peer, + }, }; -