diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-30 19:54:38 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-02-09 02:31:37 +0100 |
commit | ab18a4954fc892a668e6eb4a39e249135d91bd1b (patch) | |
tree | ced65c5447ad0142140133794d58d0b97f450496 /sharpd | |
parent | lib, zebra: Add new api to specify a label associated with the vrf (diff) | |
download | frr-ab18a4954fc892a668e6eb4a39e249135d91bd1b.tar.xz frr-ab18a4954fc892a668e6eb4a39e249135d91bd1b.zip |
sharpd: Add some infrastructure to allow test of ZEBRA_VRF_LABEL
Add some infrastructure to allow the testing of ZEBRA_VRF_LABEL
Signed-off-by: Donald Sharp <sharp@cumulusnetworks.com>
Diffstat (limited to 'sharpd')
-rw-r--r-- | sharpd/sharp_vty.c | 27 | ||||
-rw-r--r-- | sharpd/sharp_zebra.c | 5 | ||||
-rw-r--r-- | sharpd/sharp_zebra.h | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index a35157faa..efbe98972 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -26,6 +26,8 @@ #include "prefix.h" #include "nexthop.h" #include "log.h" +#include "vrf.h" +#include "zclient.h" #include "sharpd/sharp_zebra.h" #include "sharpd/sharp_vty.h" @@ -76,6 +78,30 @@ DEFPY (install_routes, return CMD_SUCCESS; } +DEFPY(vrf_label, + vrf_label_cmd, + "label vrf NAME$name label (0-100000)$label", + "Give a vrf a label\n" + VRF_CMD_HELP_STR + "The label to use\n" + "Specified range to use\n") +{ + struct vrf *vrf; + + if (strcmp(name, "default") == 0) + vrf = vrf_lookup_by_id(VRF_DEFAULT); + else + vrf = vrf_lookup_by_name(name); + + if (!vrf) { + vty_out(vty, "Unable to find vrf you silly head"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrf_label_add(vrf->vrf_id, label); + return CMD_SUCCESS; +} + DEFPY (remove_routes, remove_routes_cmd, "remove routes A.B.C.D$start (1-1000000)$routes", @@ -112,5 +138,6 @@ void sharp_vty_init(void) { install_element(ENABLE_NODE, &install_routes_cmd); install_element(ENABLE_NODE, &remove_routes_cmd); + install_element(ENABLE_NODE, &vrf_label_cmd); return; } diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index 10e48ac62..5dffd4ab9 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -152,6 +152,11 @@ static void zebra_connected(struct zclient *zclient) zclient_send_reg_requests(zclient, VRF_DEFAULT); } +void vrf_label_add(vrf_id_t vrf_id, mpls_label_t label) +{ + zclient_send_vrf_label(zclient, vrf_id, label); +} + void route_add(struct prefix *p, struct nexthop *nh) { struct zapi_route api; diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h index 97100f61a..281c67ff9 100644 --- a/sharpd/sharp_zebra.h +++ b/sharpd/sharp_zebra.h @@ -24,6 +24,7 @@ extern void sharp_zebra_init(void); +extern void vrf_label_add(vrf_id_t vrf_id, mpls_label_t label); extern void route_add(struct prefix *p, struct nexthop *nh); extern void route_delete(struct prefix *p); #endif |