From a1fb05159004aa061ed0c7fb727ea1872f695812 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sun, 24 Nov 2024 03:05:44 -0500 Subject: [PATCH 1/3] tools: add support for multiple YANG paths Signed-off-by: Christian Hopps --- tools/gen_northbound_callbacks.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/gen_northbound_callbacks.c b/tools/gen_northbound_callbacks.c index 046dc9e99ef1..516743acabaa 100644 --- a/tools/gen_northbound_callbacks.c +++ b/tools/gen_northbound_callbacks.c @@ -11,6 +11,7 @@ #include +#include "darr.h" #include "yang.h" #include "northbound.h" @@ -19,7 +20,7 @@ static bool static_cbs; static void __attribute__((noreturn)) usage(int status) { extern const char *__progname; - fprintf(stderr, "usage: %s [-h] [-s] [-p path] MODULE\n", __progname); + fprintf(stderr, "usage: %s [-h] [-s] [-p path]* MODULE\n", __progname); exit(status); } @@ -408,7 +409,8 @@ static int generate_nb_nodes(const struct lysc_node *snode, void *arg) int main(int argc, char *argv[]) { - const char *search_path = NULL; + char **search_paths = NULL; + char **iter = NULL; struct yang_module *module; char module_name_underscores[64]; struct stat st; @@ -433,7 +435,7 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - search_path = optarg; + *darr_append(search_paths) = darr_strdup(optarg); break; case 's': static_cbs = true; @@ -450,8 +452,11 @@ int main(int argc, char *argv[]) yang_init(false, true, false); - if (search_path) - ly_ctx_set_searchdir(ly_native_ctx, search_path); + darr_foreach_p (search_paths, iter) { + ly_ctx_set_searchdir(ly_native_ctx, *iter); + darr_free(*iter); + } + darr_free(search_paths); /* Load all FRR native models to ensure all augmentations are loaded. */ yang_module_load_all(); From 3d3ee2a1afbae9ea00483223af6de42d19653e3b Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sun, 24 Nov 2024 03:06:05 -0500 Subject: [PATCH 2/3] tests: enable failure and fix broken tests This test was not actually failing when the results didn't match. Fail now. Also fix the tests that are now found to be failing incorrectly (wrong expected result). Signed-off-by: Christian Hopps --- .../oper-results/result-lib-vrf-default.json | 49 ++-- .../oper-results/result-lib-vrf-nokey.json | 160 +++++++----- .../oper-results/result-lib-vrf-red.json | 64 +++-- .../result-lib-vrf-zebra-ribs.json | 48 ++-- .../oper-results/result-lib-vrf-zebra.json | 16 ++ .../mgmt_oper/oper-results/result-lib.json | 96 +++++--- .../result-ribs-rib-ipv4-unicast.json | 8 +- .../oper-results/result-ribs-rib-nokeys.json | 46 ++-- .../result-ribs-rib-route-nokey.json | 229 ++++++++++++++++++ tests/topotests/mgmt_oper/oper.py | 17 +- .../result-intf-eth0-wd-trim-empty-label.json | 3 + .../result-intf-eth0-wd-trim.json | 1 - .../result-lib-vrf-default.json | 4 + .../simple-results/result-lib-vrf-nokey.json | 8 + .../simple-results/result-lib-vrf-red.json | 4 + .../result-lib-vrf-zebra-ribs.json | 4 + .../simple-results/result-lib-vrf-zebra.json | 4 + .../mgmt_oper/simple-results/result-lib.json | 8 + .../result-ribs-rib-nokeys.json | 4 + tests/topotests/mgmt_oper/test_oper.py | 1 + tests/topotests/mgmt_oper/test_simple.py | 8 +- 21 files changed, 614 insertions(+), 168 deletions(-) create mode 100644 tests/topotests/mgmt_oper/oper-results/result-ribs-rib-route-nokey.json create mode 100644 tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim-empty-label.json diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-default.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-default.json index 948f4e6c23b4..da2d8e362572 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-default.json +++ b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-default.json @@ -39,7 +39,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -68,7 +68,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -97,7 +97,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -126,7 +126,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -238,7 +238,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -250,7 +252,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -265,7 +267,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -277,7 +281,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -292,7 +296,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -304,7 +310,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -319,7 +325,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -331,7 +339,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -369,7 +377,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -398,7 +406,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -427,7 +435,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -456,7 +464,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -480,7 +488,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -492,7 +502,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -507,7 +517,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -519,7 +531,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -534,7 +546,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -546,7 +560,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -561,7 +575,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -573,7 +589,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -589,3 +605,4 @@ ] } } + diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-nokey.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-nokey.json index 30daecf16ebc..b4abdde46578 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-nokey.json +++ b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-nokey.json @@ -38,8 +38,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight":1 + "fib": [null], + "weight": 1 } ] } @@ -67,8 +67,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight":1 + "fib": [null], + "weight": 1 } ] } @@ -96,8 +96,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight":1 + "fib": [null], + "weight": 1 } ] } @@ -125,8 +125,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -238,7 +238,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -249,8 +251,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight":1 + "fib": [null], + "weight": 1 } ] } @@ -265,7 +267,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -276,8 +280,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight":1 + "fib": [null], + "weight": 1 } ] } @@ -292,7 +296,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -303,8 +309,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -319,7 +325,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -330,8 +338,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -368,8 +376,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -397,8 +405,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -426,8 +434,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -455,8 +463,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -480,7 +488,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -491,8 +501,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -507,7 +517,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -518,8 +530,8 @@ "gateway": "", "interface": "r1-eth0", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -534,7 +546,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -545,8 +559,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -561,7 +575,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -572,8 +588,8 @@ "gateway": "", "interface": "r1-eth1", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -623,8 +639,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -652,8 +668,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -681,8 +697,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -710,8 +726,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -823,7 +839,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -834,8 +852,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -850,7 +868,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -861,8 +881,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -877,7 +897,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -888,8 +910,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -904,7 +926,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -915,8 +939,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -953,8 +977,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -982,8 +1006,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -1011,8 +1035,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -1040,8 +1064,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -1065,7 +1089,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1076,8 +1102,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -1092,7 +1118,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1103,8 +1131,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -1119,7 +1147,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1130,8 +1160,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } @@ -1146,7 +1176,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1157,8 +1189,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null], - "weight": 1 + "fib": [null], + "weight": 1 } ] } diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-red.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-red.json index cfabd49c45d3..5d61b9865f54 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-red.json +++ b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-red.json @@ -38,7 +38,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -66,7 +67,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -94,7 +96,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -122,7 +125,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -234,7 +238,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -245,7 +251,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -260,7 +267,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -271,7 +280,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -286,7 +296,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -297,7 +309,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -312,7 +325,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -323,7 +338,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -360,7 +376,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -388,7 +405,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -416,7 +434,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -444,7 +463,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -468,7 +488,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -479,7 +501,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -494,7 +517,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -505,7 +530,8 @@ "gateway": "", "interface": "r1-eth2", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -520,7 +546,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -531,7 +559,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } @@ -546,7 +575,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -557,7 +588,8 @@ "gateway": "", "interface": "r1-eth3", "active": [null], - "fib": [null] + "fib": [null], + "weight": 1 } ] } diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra-ribs.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra-ribs.json index b1124bd7bb55..86e67a9e23d1 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra-ribs.json +++ b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra-ribs.json @@ -35,7 +35,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -64,7 +64,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -93,7 +93,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -122,7 +122,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -234,7 +234,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -246,7 +248,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -261,7 +263,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -273,7 +277,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -288,7 +292,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -300,7 +306,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -315,7 +321,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -327,7 +335,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -365,7 +373,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -394,7 +402,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -423,7 +431,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -452,7 +460,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -476,7 +484,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -488,7 +498,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -503,7 +513,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -515,7 +527,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -530,7 +542,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -542,7 +556,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -557,7 +571,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -569,7 +585,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra.json index 70c8798b31fe..86e67a9e23d1 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra.json +++ b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra.json @@ -234,7 +234,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -261,7 +263,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -288,7 +292,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -315,7 +321,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -476,7 +484,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -503,7 +513,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -530,7 +542,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -557,7 +571,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib.json b/tests/topotests/mgmt_oper/oper-results/result-lib.json index 0b2a9fa4270a..b4abdde46578 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-lib.json +++ b/tests/topotests/mgmt_oper/oper-results/result-lib.json @@ -39,7 +39,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -68,7 +68,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -97,7 +97,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -126,7 +126,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -238,7 +238,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -250,7 +252,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -265,7 +267,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -277,7 +281,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -292,7 +296,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -304,7 +310,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -319,7 +325,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -331,7 +339,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -369,7 +377,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -398,7 +406,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -427,7 +435,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -456,7 +464,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -480,7 +488,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -492,7 +502,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -507,7 +517,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -519,7 +531,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -534,7 +546,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -546,7 +560,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -561,7 +575,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -573,7 +589,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -624,7 +640,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -653,7 +669,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -682,7 +698,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -711,7 +727,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -823,7 +839,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -835,7 +853,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -850,7 +868,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -862,7 +882,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -877,7 +897,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -889,7 +911,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -904,7 +926,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -916,7 +940,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -954,7 +978,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -983,7 +1007,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -1012,7 +1036,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -1041,7 +1065,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -1065,7 +1089,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1077,7 +1103,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -1092,7 +1118,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1104,7 +1132,7 @@ "interface": "r1-eth2", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -1119,7 +1147,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1131,7 +1161,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -1146,7 +1176,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -1158,7 +1190,7 @@ "interface": "r1-eth3", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } diff --git a/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-ipv4-unicast.json b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-ipv4-unicast.json index 769c1f73a579..e313a158a3ad 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-ipv4-unicast.json +++ b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-ipv4-unicast.json @@ -35,7 +35,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -64,7 +64,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -93,7 +93,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -122,7 +122,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } diff --git a/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-nokeys.json b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-nokeys.json index c740f592f7bc..86e67a9e23d1 100644 --- a/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-nokeys.json +++ b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-nokeys.json @@ -35,7 +35,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -64,7 +64,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -93,7 +93,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -122,7 +122,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -234,7 +234,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -246,7 +248,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -261,7 +263,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -273,7 +277,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -288,7 +292,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -300,7 +306,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -315,7 +321,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -327,7 +335,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -365,7 +373,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -394,7 +402,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -423,7 +431,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -476,7 +484,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -488,7 +498,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -503,7 +513,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -515,7 +527,7 @@ "interface": "r1-eth0", "active": [null], "fib": [null], - "weight": 1 + "weight": 1 } ] } @@ -530,7 +542,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -542,7 +556,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } @@ -557,7 +571,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -569,7 +585,7 @@ "interface": "r1-eth1", "active": [null], "fib": [null], - "weight":1 + "weight": 1 } ] } diff --git a/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-route-nokey.json b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-route-nokey.json new file mode 100644 index 000000000000..e313a158a3ad --- /dev/null +++ b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-route-nokey.json @@ -0,0 +1,229 @@ +{ + "frr-vrf:lib": { + "vrf": [ + { + "name": "default", + "frr-zebra:zebra": { + "ribs": { + "rib": [ + { + "afi-safi-name": "frr-routing:ipv4-unicast", + "table-id": 254, + "route": [ + { + "prefix": "0.0.0.0/0" + }, + { + "prefix": "1.1.1.0/24", + "route-entry": [ + { + "protocol": "connected", + "distance": 0, + "metric": 0, + "selected": [null], + "installed": [null], + "internal-flags": 8, + "internal-status": 16, + "uptime": "rubout", + "nexthop-group": { + "id": "rubout", + "nexthop": [ + { + "nh-type": "ifindex", + "vrf": "rubout", + "gateway": "", + "interface": "r1-eth0", + "active": [null], + "fib": [null], + "weight": 1 + } + ] + } + } + ] + }, + { + "prefix": "1.1.1.1/32", + "route-entry": [ + { + "protocol": "local", + "distance": 0, + "metric": 0, + "selected": [null], + "installed": [null], + "internal-flags": 8, + "internal-status": 16, + "uptime": "rubout", + "nexthop-group": { + "id": "rubout", + "nexthop": [ + { + "nh-type": "ifindex", + "vrf": "rubout", + "gateway": "", + "interface": "r1-eth0", + "active": [null], + "fib": [null], + "weight": 1 + } + ] + } + } + ] + }, + { + "prefix": "2.2.2.0/24", + "route-entry": [ + { + "protocol": "connected", + "distance": 0, + "metric": 0, + "selected": [null], + "installed": [null], + "internal-flags": 8, + "internal-status": 16, + "uptime": "rubout", + "nexthop-group": { + "id": "rubout", + "nexthop": [ + { + "nh-type": "ifindex", + "vrf": "rubout", + "gateway": "", + "interface": "r1-eth1", + "active": [null], + "fib": [null], + "weight": 1 + } + ] + } + } + ] + }, + { + "prefix": "2.2.2.1/32", + "route-entry": [ + { + "protocol": "local", + "distance": 0, + "metric": 0, + "selected": [null], + "installed": [null], + "internal-flags": 8, + "internal-status": 16, + "uptime": "rubout", + "nexthop-group": { + "id": "rubout", + "nexthop": [ + { + "nh-type": "ifindex", + "vrf": "rubout", + "gateway": "", + "interface": "r1-eth1", + "active": [null], + "fib": [null], + "weight": 1 + } + ] + } + } + ] + }, + { + "prefix": "11.0.0.0/8", + "route-entry": [ + { + "protocol": "static", + "distance": 1, + "metric": 0, + "selected": [null], + "installed": [null], + "internal-flags": 73, + "internal-status": 16, + "uptime": "rubout", + "nexthop-group": { + "id": "rubout", + "nexthop": [ + { + "nh-type": "blackhole", + "vrf": "rubout", + "gateway": "", + "interface": " ", + "bh-type": "null", + "active": [null], + "fib": [null], + "weight": 1 + } + ] + } + } + ] + }, + { + "prefix": "11.11.11.11/32", + "route-entry": [ + { + "protocol": "static", + "distance": 1, + "metric": 0, + "selected": [null], + "installed": [null], + "internal-flags": 73, + "internal-status": 16, + "uptime": "rubout", + "nexthop-group": { + "id": "rubout", + "nexthop": [ + { + "nh-type": "ip4-ifindex", + "vrf": "rubout", + "gateway": "1.1.1.2", + "interface": "r1-eth0", + "active": [null], + "fib": [null], + "weight": 1 + } + ] + } + } + ] + }, + { + "prefix": "12.12.12.12/32", + "route-entry": [ + { + "protocol": "static", + "distance": 1, + "metric": 0, + "selected": [null], + "installed": [null], + "internal-flags": 73, + "internal-status": 16, + "uptime": "rubout", + "nexthop-group": { + "id": "rubout", + "nexthop": [ + { + "nh-type": "ip4-ifindex", + "vrf": "rubout", + "gateway": "2.2.2.2", + "interface": "r1-eth1", + "active": [null], + "fib": [null], + "weight": 1 + } + ] + } + } + ] + } + ] + } + ] + } + } + } + ] + } +} + diff --git a/tests/topotests/mgmt_oper/oper.py b/tests/topotests/mgmt_oper/oper.py index f54e64ae1808..bca452d0115b 100644 --- a/tests/topotests/mgmt_oper/oper.py +++ b/tests/topotests/mgmt_oper/oper.py @@ -77,7 +77,13 @@ def _do_oper_test(tgen, qr, seconds_left=None): # Don't use this for now. dd_json_cmp = None - expected = open(qr[1], encoding="ascii").read() + if isinstance(qr[1], str): + expected = open(qr[1], encoding="ascii").read() + expected_alt = None + else: + expected = open(qr[1][0], encoding="ascii").read() + expected_alt = open(qr[1][1], encoding="ascii").read() + output = r1.cmd_nostatus(qcmd.format(qr[0], qr[2] if len(qr) > 2 else "")) diag = logging.debug if seconds_left else logging.warning @@ -90,6 +96,7 @@ def _do_oper_test(tgen, qr, seconds_left=None): try: ejson = json.loads(expected) + ejson_alt = json.loads(expected_alt) if expected_alt is not None else None except json.decoder.JSONDecodeError as error: logging.error( "Error decoding json exp result: %s\noutput:\n%s", error, expected @@ -99,6 +106,8 @@ def _do_oper_test(tgen, qr, seconds_left=None): if dd_json_cmp: cmpout = json_cmp(ojson, ejson, exact_match=True) + if cmpout and ejson_alt is not None: + cmpout = json_cmp(ojson, ejson_alt, exact_match=True) if cmpout: diag( "-------DIFF---------\n%s\n---------DIFF----------", @@ -106,6 +115,8 @@ def _do_oper_test(tgen, qr, seconds_left=None): ) else: cmpout = tt_json_cmp(ojson, ejson, exact=True) + if cmpout and ejson_alt is not None: + cmpout = tt_json_cmp(ojson, ejson_alt, exact=True) if cmpout: diag( "-------EXPECT--------\n%s\n------END-EXPECT------", @@ -118,6 +129,7 @@ def _do_oper_test(tgen, qr, seconds_left=None): diag("----diff---\n{}".format(cmpout)) diag("Command: {}".format(qcmd.format(qr[0], qr[2] if len(qr) > 2 else ""))) diag("File: {}".format(qr[1])) + cmpout = str(cmpout) return cmpout @@ -127,7 +139,8 @@ def do_oper_test(tgen, query_results): step(f"Perform query '{qr[0]}'", reset=reset) if reset: reset = False - _do_oper_test(tgen, qr) + ret = _do_oper_test(tgen, qr) + assert ret is None, "Unexpected diff: " + str(ret) def get_ip_networks(super_prefix, count): diff --git a/tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim-empty-label.json b/tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim-empty-label.json new file mode 100644 index 000000000000..efd7e8c684c0 --- /dev/null +++ b/tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim-empty-label.json @@ -0,0 +1,3 @@ +{ + "frr-zebra:evpn-mh": {} +} diff --git a/tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim.json b/tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim.json index efd7e8c684c0..2c63c0851048 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim.json +++ b/tests/topotests/mgmt_oper/simple-results/result-intf-eth0-wd-trim.json @@ -1,3 +1,2 @@ { - "frr-zebra:evpn-mh": {} } diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-default.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-default.json index f85b163bd6bb..19295870d5ca 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-default.json +++ b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-default.json @@ -121,7 +121,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -148,7 +150,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-nokey.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-nokey.json index e2cfec972443..f0bde048f23c 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-nokey.json +++ b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-nokey.json @@ -121,7 +121,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -148,7 +150,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -282,7 +286,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -309,7 +315,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-red.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-red.json index 3567f35a349b..8b632bac664b 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-red.json +++ b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-red.json @@ -92,7 +92,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -119,7 +121,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra-ribs.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra-ribs.json index d9ca58d25d91..678a80ab97b5 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra-ribs.json +++ b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra-ribs.json @@ -117,7 +117,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -144,7 +146,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra.json index d9ca58d25d91..678a80ab97b5 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra.json +++ b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra.json @@ -117,7 +117,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -144,7 +146,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib.json b/tests/topotests/mgmt_oper/simple-results/result-lib.json index e2cfec972443..f0bde048f23c 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-lib.json +++ b/tests/topotests/mgmt_oper/simple-results/result-lib.json @@ -121,7 +121,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -148,7 +150,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -282,7 +286,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -309,7 +315,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-nokeys.json b/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-nokeys.json index d9ca58d25d91..678a80ab97b5 100644 --- a/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-nokeys.json +++ b/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-nokeys.json @@ -117,7 +117,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", @@ -144,7 +146,9 @@ "distance": 0, "metric": 0, "selected": [null], + "installed": [null], "internal-flags": 8, + "internal-status": 16, "uptime": "rubout", "nexthop-group": { "id": "rubout", diff --git a/tests/topotests/mgmt_oper/test_oper.py b/tests/topotests/mgmt_oper/test_oper.py index e4ceabf35275..23529bc75eca 100644 --- a/tests/topotests/mgmt_oper/test_oper.py +++ b/tests/topotests/mgmt_oper/test_oper.py @@ -107,6 +107,7 @@ def test_oper(tgen): for f in ${resdir}/result-*; do sed -i -e 's/"uptime": ".*"/"uptime": "rubout"/;s/"id": [0-9][0-9]*/"id": "rubout"/' $f + sed -i -e 's/"phy-address": ".*"/"phy-address": "rubout"/' $f sed -i -e 's/"if-index": [0-9][0-9]*/"if-index": "rubout"/' $f sed -i -e 's,"vrf": "[0-9]*","vrf": "rubout",' $f done diff --git a/tests/topotests/mgmt_oper/test_simple.py b/tests/topotests/mgmt_oper/test_simple.py index 2b3d6ff6a52a..237f7d57d5f0 100644 --- a/tests/topotests/mgmt_oper/test_simple.py +++ b/tests/topotests/mgmt_oper/test_simple.py @@ -154,7 +154,11 @@ def test_oper_simple(tgen): ), ( '/frr-interface:lib/interface[name="r1-eth0"]/frr-zebra:zebra/evpn-mh', - "simple-results/result-intf-eth0-wd-trim.json", + ( + # Output is different between libyang2 and libyang3+ + "simple-results/result-intf-eth0-wd-trim.json", + "simple-results/result-intf-eth0-wd-trim-empty-label.json", + ), "with-config exact with-defaults trim", ), ( @@ -181,7 +185,7 @@ def test_oper_simple(tgen): vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf' > ${resdir}/result-lib-vrf-nokey.json vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]' > ${resdir}/result-lib-vrf-default.json vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="red"]' > ${resdir}/result-lib-vrf-red.json -vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra' > ${resdir}/result-lib-vrf-ebra.json +vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra' > ${resdir}/result-lib-vrf-zebra.json vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs' > ${resdir}/result-lib-vrf-zebra-ribs.json vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib' > ${resdir}/result-ribs-rib-nokeys.json vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]' > ${resdir}/result-ribs-rib-ipv4-unicast.json From 764f2760226150da0545804c4ae3938ab550f510 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sat, 14 Dec 2024 20:54:33 -0500 Subject: [PATCH 3/3] mgmtd: fix memory leak in FE adapter Signed-off-by: Christian Hopps --- mgmtd/mgmt_fe_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c index 32f28a5774c5..7f7a5d9a8e91 100644 --- a/mgmtd/mgmt_fe_adapter.c +++ b/mgmtd/mgmt_fe_adapter.c @@ -190,7 +190,7 @@ static void mgmt_fe_cleanup_session(struct mgmt_fe_session_ctx **sessionp) assert(session->adapter->refcount > 1); mgmt_fe_adapter_unlock(&session->adapter); } - + darr_free_free(session->notify_xpaths); hash_release(mgmt_fe_sessions, session); XFREE(MTYPE_MGMTD_FE_SESSION, session); *sessionp = NULL;