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;
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);
}
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;
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);
}
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;
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));
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;
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);
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