diff options
| author | Sarita Patra <saritap@vmware.com> | 2020-10-30 00:44:04 -0700 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-03-30 22:59:30 +0300 |
| commit | a623b52619466dc977e37f78a6d0afb69cb0e2b6 (patch) | |
| tree | 8a6e2696b29a3c3dcf3a3daab1ef90bbf7cc980f /ospfd/ospf_routemap.c | |
| parent | 078110ca601eb266ef2baea80b0026fa31882426 (diff) | |
ospfd: North-bound implementation for ospfd rmaps
This commit introduces the implementation for the north-bound
callbacks for the ospfd-specific route-map match and set clauses.
Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
Signed-off-by: Sarita Patra <saritap@vmware.com>
Diffstat (limited to 'ospfd/ospf_routemap.c')
| -rw-r--r-- | ospfd/ospf_routemap.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index bdc65d23bf..d3b114840e 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -33,6 +33,7 @@ #include "plist.h" #include "vrf.h" #include "frrstr.h" +#include "northbound_cli.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_asbr.h" @@ -534,7 +535,7 @@ static const struct route_map_rule_cmd route_set_tag_cmd = { route_map_rule_tag_free, }; -DEFUN (set_metric_type, +DEFUN_YANG (set_metric_type, set_metric_type_cmd, "set metric-type <type-1|type-2>", SET_STR @@ -543,11 +544,19 @@ DEFUN (set_metric_type, "OSPF[6] external type 2 metric\n") { char *ext = argv[2]->text; - return generic_set_add(vty, VTY_GET_CONTEXT(route_map_index), - "metric-type", ext); + + const char *xpath = + "./set-action[action='frr-ospf-route-map:metric-type']"; + char xpath_value[XPATH_MAXLEN]; + + nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); + snprintf(xpath_value, sizeof(xpath_value), + "%s/rmap-set-action/frr-ospf-route-map:metric-type", xpath); + nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, ext); + return nb_cli_apply_changes(vty, NULL); } -DEFUN (no_set_metric_type, +DEFUN_YANG (no_set_metric_type, no_set_metric_type_cmd, "no set metric-type [<type-1|type-2>]", NO_STR @@ -556,9 +565,11 @@ DEFUN (no_set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") { - char *ext = (argc == 4) ? argv[3]->text : NULL; - return generic_set_delete(vty, VTY_GET_CONTEXT(route_map_index), - "metric-type", ext); + const char *xpath = + "./set-action[action='frr-ospf-route-map:metric-type']"; + + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); } /* Route-map init */ |
