[frr] [PATCH v2 10/10] tests: fix BGP VRF interactions

Philippe Guibert philippe.guibert at 6wind.com
Wed Dec 21 09:02:13 EST 2016


From: David Lamparter <equinox at opensourcerouting.org>

This commit is ensuring that VRF context is well initialised before
performing BGP testing.

Signed-off-by: David Lamparter <equinox at opensourcerouting.org>
---
 tests/bgp_mpath_test.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c
index 723f2977d585..38b758f53d10 100644
--- a/tests/bgp_mpath_test.c
+++ b/tests/bgp_mpath_test.c
@@ -28,6 +28,7 @@
 #include "stream.h"
 #include "privs.h"
 #include "linklist.h"
+#include "hash.h"
 #include "memory.h"
 #include "zclient.h"
 #include "queue.h"
@@ -86,6 +87,17 @@ struct zebra_privs_t bgpd_privs =
 
 static int tty = 0;
 
+static unsigned int
+hash_make_dummy (void *arg)
+{
+  return 0;
+}
+static int
+hash_cmp_dummy (const void *a, const void *b)
+{
+  return 0;
+}
+
 /* Create fake bgp instance */
 static struct bgp *
 bgp_create_fake (as_t *as, const char *name)
@@ -107,6 +119,9 @@ bgp_create_fake (as_t *as, const char *name)
   bgp->group = list_new ();
   //bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp;
 
+  bgp->vrfs = list_new ();
+  bgp->rt_subscribers = hash_create (hash_make_dummy, hash_cmp_dummy);
+
   for (afi = AFI_IP; afi < AFI_MAX; afi++)
     for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
       {
-- 
2.1.4





More information about the dev mailing list