diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bgpd/test_bgp_table.c | 26 | ||||
| -rw-r--r-- | tests/bgpd/test_mpath.c | 2 | ||||
| -rw-r--r-- | tests/topotests/lib/common_config.py | 33 |
3 files changed, 44 insertions, 17 deletions
diff --git a/tests/bgpd/test_bgp_table.c b/tests/bgpd/test_bgp_table.c index 7d81d42afb..4eb132df55 100644 --- a/tests/bgpd/test_bgp_table.c +++ b/tests/bgpd/test_bgp_table.c @@ -53,15 +53,15 @@ static void add_node(struct bgp_table *table, const char *prefix_str) { struct prefix_ipv4 p; struct test_node_t *node; - struct bgp_node *rn; + struct bgp_dest *dest; assert(prefix_str); if (str2prefix_ipv4(prefix_str, &p) <= 0) assert(0); - rn = bgp_node_get(table, (struct prefix *)&p); - if (rn->info) { + dest = bgp_node_get(table, (struct prefix *)&p); + if (dest->info) { assert(0); return; } @@ -70,7 +70,7 @@ static void add_node(struct bgp_table *table, const char *prefix_str) assert(node); node->prefix_str = strdup(prefix_str); assert(node->prefix_str); - rn->info = node; + dest->info = node; } static bool prefix_in_array(const struct prefix *p, struct prefix *prefix_array, @@ -83,7 +83,7 @@ static bool prefix_in_array(const struct prefix *p, struct prefix *prefix_array, return false; } -static void check_lookup_result(struct bgp_node *match, va_list arglist) +static void check_lookup_result(struct bgp_dest *match, va_list arglist) { char *prefix_str; struct prefix *prefixes = NULL; @@ -102,16 +102,16 @@ static void check_lookup_result(struct bgp_node *match, va_list arglist) if (!match) return; - struct bgp_node *node = match; + struct bgp_dest *dest = match; - while ((node = bgp_route_next_until(node, match))) { - const struct prefix *node_p = bgp_node_get_prefix(node); + while ((dest = bgp_route_next_until(dest, match))) { + const struct prefix *dest_p = bgp_dest_get_prefix(dest); - if (bgp_node_has_bgp_path_info_data(node) - && !prefix_in_array(node_p, prefixes, prefix_count)) { + if (bgp_dest_has_bgp_path_info_data(dest) + && !prefix_in_array(dest_p, prefixes, prefix_count)) { char buf[PREFIX2STR_BUFFER]; - prefix2str(node_p, buf, PREFIX2STR_BUFFER); + prefix2str(dest_p, buf, PREFIX2STR_BUFFER); printf("prefix %s was not expected!\n", buf); assert(0); } @@ -128,9 +128,9 @@ static void do_test(struct bgp_table *table, const char *prefix, ...) printf("\nDoing lookup for %s\n", prefix); if (str2prefix(prefix, &p) <= 0) assert(0); - struct bgp_node *node = bgp_table_subtree_lookup(table, &p); + struct bgp_dest *dest = bgp_table_subtree_lookup(table, &p); - check_lookup_result(node, arglist); + check_lookup_result(dest, arglist); va_end(arglist); diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c index 87c214969f..99fb7b620d 100644 --- a/tests/bgpd/test_mpath.c +++ b/tests/bgpd/test_mpath.c @@ -313,7 +313,7 @@ static int setup_bgp_path_info_mpath_update(testcase_t *t) return -1; str2prefix("42.1.1.0/24", &test_rn.p); - rt_node = bgp_node_to_rnode(&test_rn); + rt_node = bgp_dest_to_rnode(&test_rn); memcpy((struct route_table *)&rt_node->table, &rt->route_table, sizeof(struct route_table *)); setup_bgp_mp_list(t); diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index 3de7ab3ebe..1f2acb7f88 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -469,20 +469,40 @@ def reset_config_on_routers(tgen, routerName=None): delta = StringIO.StringIO() delta.write("configure terminal\n") t_delta = f.read() + + # Don't disable debugs + check_debug = True + for line in t_delta.split("\n"): line = line.strip() if ( line == "Lines To Delete" or line == "===============" - or line == "Lines To Add" - or line == "============" or not line ): continue + + if (line == "Lines To Add"): + check_debug = False + continue + + if (line == "============" + or not line + ): + continue + + # Leave debugs and log output alone + if check_debug: + if ('debug' in line or 'log file' in line): + continue + delta.write(line) delta.write("\n") + f.close() + delta.write("end\n") + output = router.vtysh_multicmd(delta.getvalue(), pretty_output=False) delta.close() @@ -1256,7 +1276,14 @@ def create_interfaces_cfg(tgen, topo, build=False): else: interface_name = data["interface"] - interface_data.append("interface {}".format(str(interface_name))) + # Include vrf if present + if "vrf" in data: + interface_data.append("interface {} vrf {}".format( + str(interface_name), + str(data["vrf"]))) + else: + interface_data.append("interface {}".format(str(interface_name))) + if "ipv4" in data: intf_addr = c_data["links"][destRouterLink]["ipv4"] |
