]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/bgpd/test_mpath.c
*: Replace zclient_new with zclient_new_notify
[mirror_frr.git] / tests / bgpd / test_mpath.c
index d8d2286bf7c92c808577fc74f07c4dac07eecdc0..04fbda42ebde788e5e1416eaa78739333d8fc25a 100644 (file)
@@ -207,7 +207,7 @@ struct peer test_mp_list_peer[] = {
 };
 int test_mp_list_peer_count = sizeof(test_mp_list_peer) / sizeof(struct peer);
 struct attr test_mp_list_attr[4];
-struct bgp_info test_mp_list_info[] = {
+struct bgp_path_info test_mp_list_info[] = {
        {.peer = &test_mp_list_peer[0], .attr = &test_mp_list_attr[0]},
        {.peer = &test_mp_list_peer[1], .attr = &test_mp_list_attr[1]},
        {.peer = &test_mp_list_peer[2], .attr = &test_mp_list_attr[1]},
@@ -215,7 +215,7 @@ struct bgp_info test_mp_list_info[] = {
        {.peer = &test_mp_list_peer[4], .attr = &test_mp_list_attr[3]},
 };
 int test_mp_list_info_count =
-       sizeof(test_mp_list_info) / sizeof(struct bgp_info);
+       sizeof(test_mp_list_info) / sizeof(struct bgp_path_info);
 
 static int setup_bgp_mp_list(testcase_t *t)
 {
@@ -247,7 +247,7 @@ static int run_bgp_mp_list(testcase_t *t)
 {
        struct list mp_list;
        struct listnode *mp_node;
-       struct bgp_info *info;
+       struct bgp_path_info *info;
        int i;
        int test_result = TEST_PASSED;
        bgp_mp_list_init(&mp_list);
@@ -289,24 +289,24 @@ testcase_t test_bgp_mp_list = {
 };
 
 /*=========================================================
- * Testcase for bgp_info_mpath_update
+ * Testcase for bgp_path_info_mpath_update
  */
 
 struct bgp_node test_rn;
 
-static int setup_bgp_info_mpath_update(testcase_t *t)
+static int setup_bgp_path_info_mpath_update(testcase_t *t)
 {
        int i;
        str2prefix("42.1.1.0/24", &test_rn.p);
        setup_bgp_mp_list(t);
        for (i = 0; i < test_mp_list_info_count; i++)
-               bgp_info_add(&test_rn, &test_mp_list_info[i]);
+               bgp_path_info_add(&test_rn, &test_mp_list_info[i]);
        return 0;
 }
 
-static int run_bgp_info_mpath_update(testcase_t *t)
+static int run_bgp_path_info_mpath_update(testcase_t *t)
 {
-       struct bgp_info *new_best, *old_best, *mpath;
+       struct bgp_path_info *new_best, *old_best, *mpath;
        struct list mp_list;
        struct bgp_maxpaths_cfg mp_cfg = {3, 3};
        int test_result = TEST_PASSED;
@@ -317,33 +317,35 @@ static int run_bgp_info_mpath_update(testcase_t *t)
        bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
        new_best = &test_mp_list_info[3];
        old_best = NULL;
-       bgp_info_mpath_update(&test_rn, new_best, old_best, &mp_list, &mp_cfg);
+       bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+                                  &mp_cfg);
        bgp_mp_list_clear(&mp_list);
-       EXPECT_TRUE(bgp_info_mpath_count(new_best) == 2, test_result);
-       mpath = bgp_info_mpath_first(new_best);
+       EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 2, test_result);
+       mpath = bgp_path_info_mpath_first(new_best);
        EXPECT_TRUE(mpath == &test_mp_list_info[0], test_result);
-       EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
-       mpath = bgp_info_mpath_next(mpath);
+       EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result);
+       mpath = bgp_path_info_mpath_next(mpath);
        EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result);
-       EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
+       EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result);
 
        bgp_mp_list_add(&mp_list, &test_mp_list_info[0]);
        bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
        new_best = &test_mp_list_info[0];
        old_best = &test_mp_list_info[3];
-       bgp_info_mpath_update(&test_rn, new_best, old_best, &mp_list, &mp_cfg);
+       bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+                                  &mp_cfg);
        bgp_mp_list_clear(&mp_list);
-       EXPECT_TRUE(bgp_info_mpath_count(new_best) == 1, test_result);
-       mpath = bgp_info_mpath_first(new_best);
+       EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 1, test_result);
+       mpath = bgp_path_info_mpath_first(new_best);
        EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result);
-       EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
-       EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_INFO_MULTIPATH),
+       EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result);
+       EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_PATH_MULTIPATH),
                    test_result);
 
        return test_result;
 }
 
-static int cleanup_bgp_info_mpath_update(testcase_t *t)
+static int cleanup_bgp_path_info_mpath_update(testcase_t *t)
 {
        int i;
 
@@ -353,11 +355,11 @@ static int cleanup_bgp_info_mpath_update(testcase_t *t)
        return 0;
 }
 
-testcase_t test_bgp_info_mpath_update = {
-       .desc = "Test bgp_info_mpath_update",
-       .setup = setup_bgp_info_mpath_update,
-       .run = run_bgp_info_mpath_update,
-       .cleanup = cleanup_bgp_info_mpath_update,
+testcase_t test_bgp_path_info_mpath_update = {
+       .desc = "Test bgp_path_info_mpath_update",
+       .setup = setup_bgp_path_info_mpath_update,
+       .run = run_bgp_path_info_mpath_update,
+       .cleanup = cleanup_bgp_path_info_mpath_update,
 };
 
 /*=========================================================
@@ -365,7 +367,7 @@ testcase_t test_bgp_info_mpath_update = {
  */
 testcase_t *all_tests[] = {
        &test_bgp_cfg_maximum_paths, &test_bgp_mp_list,
-       &test_bgp_info_mpath_update,
+       &test_bgp_path_info_mpath_update,
 };
 
 int all_tests_count = (sizeof(all_tests) / sizeof(testcase_t *));
@@ -377,9 +379,9 @@ static int global_test_init(void)
 {
        qobj_init();
        master = thread_master_create(NULL);
-       zclient = zclient_new_notify(master, &zclient_options_default);
+       zclient = zclient_new(master, &zclient_options_default);
        bgp_master_init(master);
-       vrf_init(NULL, NULL, NULL, NULL);
+       vrf_init(NULL, NULL, NULL, NULL, NULL);
        bgp_option_set(BGP_OPT_NO_LISTEN);
 
        if (fileno(stdout) >= 0)