summaryrefslogtreecommitdiffstats
path: root/sharpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-05-17 16:56:45 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-05-17 16:59:17 +0200
commitae252c027f6e9dcc5ae804d8c8ba5575860bf4d2 (patch)
tree18461dec74f81f08e45628f32e213ecfe085e902 /sharpd
parentsharpd: Add some ability to ignore route-map commands (diff)
downloadfrr-ae252c027f6e9dcc5ae804d8c8ba5575860bf4d2.tar.xz
frr-ae252c027f6e9dcc5ae804d8c8ba5575860bf4d2.zip
sharp: Allow the specification of instance when adding/deleting routes
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'sharpd')
-rw-r--r--sharpd/sharp_vty.c17
-rw-r--r--sharpd/sharp_zebra.c6
-rw-r--r--sharpd/sharp_zebra.h4
3 files changed, 16 insertions, 11 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index 4d19484a6..956da9d4e 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -81,14 +81,16 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,
DEFPY (install_routes,
install_routes_cmd,
- "sharp install routes A.B.C.D$start nexthop A.B.C.D$nexthop (1-1000000)$routes",
+ "sharp install routes A.B.C.D$start nexthop A.B.C.D$nexthop (1-1000000)$routes [instance (0-255)$instance]",
"Sharp routing Protocol\n"
"install some routes\n"
"Routes to install\n"
"Address to start /32 generation at\n"
"Nexthop to use\n"
"Nexthop address\n"
- "How many to create\n")
+ "How many to create\n"
+ "Instance to use\n"
+ "Instance\n")
{
int i;
struct prefix p;
@@ -112,7 +114,7 @@ DEFPY (install_routes,
temp = ntohl(p.u.prefix4.s_addr);
for (i = 0; i < routes; i++) {
- route_add(&p, &nhop);
+ route_add(&p, (uint8_t)instance, &nhop);
p.u.prefix4.s_addr = htonl(++temp);
}
@@ -151,17 +153,18 @@ DEFPY(vrf_label, vrf_label_cmd,
DEFPY (remove_routes,
remove_routes_cmd,
- "sharp remove routes A.B.C.D$start (1-1000000)$routes",
+ "sharp remove routes A.B.C.D$start (1-1000000)$routes [instance (0-255)$instance]",
"Sharp Routing Protocol\n"
"Remove some routes\n"
"Routes to remove\n"
"Starting spot\n"
- "Routes to uniinstall\n")
+ "Routes to uniinstall\n"
+ "instance to use\n"
+ "Value of instance\n")
{
int i;
struct prefix p;
uint32_t temp;
-
total_routes = routes;
removed_routes = 0;
@@ -175,7 +178,7 @@ DEFPY (remove_routes,
temp = ntohl(p.u.prefix4.s_addr);
for (i = 0; i < routes; i++) {
- route_delete(&p);
+ route_delete(&p, (uint8_t)instance);
p.u.prefix4.s_addr = htonl(++temp);
}
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index 999255e92..fcb555170 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -176,7 +176,7 @@ void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label)
zclient_send_vrf_label(zclient, vrf_id, afi, label, ZEBRA_LSP_SHARP);
}
-void route_add(struct prefix *p, struct nexthop *nh)
+void route_add(struct prefix *p, uint8_t instance, struct nexthop *nh)
{
struct zapi_route api;
struct zapi_nexthop *api_nh;
@@ -184,6 +184,7 @@ void route_add(struct prefix *p, struct nexthop *nh)
memset(&api, 0, sizeof(api));
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_SHARP;
+ api.instance = instance;
api.safi = SAFI_UNICAST;
memcpy(&api.prefix, p, sizeof(*p));
@@ -200,7 +201,7 @@ void route_add(struct prefix *p, struct nexthop *nh)
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
}
-void route_delete(struct prefix *p)
+void route_delete(struct prefix *p, uint8_t instance)
{
struct zapi_route api;
@@ -208,6 +209,7 @@ void route_delete(struct prefix *p)
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_SHARP;
api.safi = SAFI_UNICAST;
+ api.instance = instance;
memcpy(&api.prefix, p, sizeof(*p));
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h
index 0c906fc4f..58438ed01 100644
--- a/sharpd/sharp_zebra.h
+++ b/sharpd/sharp_zebra.h
@@ -25,7 +25,7 @@
extern void sharp_zebra_init(void);
extern void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label);
-extern void route_add(struct prefix *p, struct nexthop *nh);
-extern void route_delete(struct prefix *p);
+extern void route_add(struct prefix *p, uint8_t instance, struct nexthop *nh);
+extern void route_delete(struct prefix *p, uint8_t instance);
extern void sharp_zebra_nexthop_watch(struct prefix *p, bool watch);
#endif