summaryrefslogtreecommitdiff
path: root/sharpd/sharp_zebra.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-01-03 09:49:15 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-01-03 09:49:15 -0500
commitb939f6ff513808aba46f4797a4349d85989ae01b (patch)
tree8e3d73e412eb92e05026d1094f610dd72e6a1344 /sharpd/sharp_zebra.c
parent6b98d34fdfeeafeb51887044f02f2496d2807bfd (diff)
sharpd: Add code to allow install/uninstall repeatedly
Add a bit of test code to allow the tester to install/uninstall the routes via: sharp install routes A.B.C.D nexthop Y.Z.M.D 1000000 repeat 100 This will install 1000000 routes wait for them to be finished then uninstall them then start installation over 100 times. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
Diffstat (limited to 'sharpd/sharp_zebra.c')
-rw-r--r--sharpd/sharp_zebra.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index 72e1eb2b21..37591fa41f 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -132,6 +132,10 @@ static int interface_state_down(int command, struct zclient *zclient,
extern uint32_t total_routes;
extern uint32_t installed_routes;
extern uint32_t removed_routes;
+extern int32_t repeat;
+extern struct prefix orig_prefix;
+extern struct nexthop_group nhop_group;
+extern uint8_t inst;
void sharp_install_routes_helper(struct prefix *p, uint8_t instance,
struct nexthop_group *nhg,
@@ -162,8 +166,9 @@ void sharp_remove_routes_helper(struct prefix *p, uint8_t instance,
}
}
-static int handle_repeated(bool installed)
+static void handle_repeated(bool installed)
{
+ struct prefix p = orig_prefix;
repeat--;
if (repeat <= 0)
@@ -171,12 +176,13 @@ static int handle_repeated(bool installed)
if (installed) {
removed_routes = 0;
- sharp_remove_routes_helper(&prefix, inst, total_routes);
+ sharp_remove_routes_helper(&p, inst, total_routes);
}
if (!installed) {
installed_routes = 0;
- sharp_remove_routes
+ sharp_install_routes_helper(&p, inst, &nhop_group,
+ total_routes);
}
}